From: <jen...@us...> - 2008-01-11 11:45:23
|
Revision: 366 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=366&view=rev Author: jenslehmann Date: 2008-01-11 03:45:18 -0800 (Fri, 11 Jan 2008) Log Message: ----------- improved article display (intermediate commit due to dead DBpedia SPARQL endpoint) Modified Paths: -------------- trunk/src/dbpedia-navigator/ajaxfunctions.php trunk/src/dbpedia-navigator/index.php Modified: trunk/src/dbpedia-navigator/ajaxfunctions.php =================================================================== --- trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-01-11 09:23:49 UTC (rev 365) +++ trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-01-11 11:45:18 UTC (rev 366) @@ -50,14 +50,15 @@ $settings=new Settings(); $sc=new DLLearnerConnection($settings->dbpediauri,$settings->wsdluri,$_SESSION['id'],$_SESSION['ksID']); $triples=$sc->getTriples($settings->sparqlttl,$subject); - $content=""; + $content="";$contentbuttons=""; if (count($triples)==1) - { + { + // ToDo: find out why this was treated in a special way by Sebastian $content.=substr($triples,7); } - else if (count($triples)==0) + else if (count($triples)==0) { $content.="Did not find an article with that name."; - else { + } else { // goal: display the data in a nice (DBpedia specific way), maybe similar to // dbpedia.org/search @@ -77,12 +78,16 @@ if(isset($triples['http://xmlns.com/foaf/0.1/page'])) $content .= '<p><img src="images/wikipedia_favicon.png" alt"Wikipedia" /> <a href="'.$triples['http://xmlns.com/foaf/0.1/page'][0].'">view Wikipedia article</a>, '; $content .= '<a href="'.$subject.'">view DBpedia resource description</a></p>'; - + // display a list of classes + if(isset($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type'])) + $content .= '<p>Classes: '.array_to_comma($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type']).'</p>'; // filter out uninteresting properties - // unset - + unset($triples['http://xmlns.com/foaf/0.1/page']); + unset($triples['http://xmlns.com/foaf/0.1/depiction']); + unset($triples['http://dbpedia.org/property/abstract']); + // display the remaining properties as list which can be used for further navigation $content .= '<br/><br/><br/><br/><br/><br/>'.get_triple_table($triples); @@ -249,7 +254,10 @@ return $objResponse; } -// helper function +/////////////////////// +// Helper Functions. // +/////////////////////// + function get_triple_table($triples) { $table = '<table border="1"><tr><td>predicate</td><td>object</td></tr>'; @@ -264,5 +272,13 @@ $table .= '</table>'; return $table; } + +function array_to_comma_separated_list($ar) { + $string = $ar[0]; + for($i=1; $i<count($ar); $i++) { + $string .= $ar[$i] . ', '; + } + return $string; +} ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-01-11 09:23:49 UTC (rev 365) +++ trunk/src/dbpedia-navigator/index.php 2008-01-11 11:45:18 UTC (rev 366) @@ -118,8 +118,8 @@ <a href="http://dl-learner.org">DL-Learner</a><br /> <a href="http//dbpedia.org">DBpedia</a><br/> <a href="http://virtuoso.openlinksw.com/wiki/main/">OpenLink Virtuoso</a><br /> - ... and implemented by <a href="http://jens-lehmann.org">Jens Lehmann</a> at - the <a href="http:/aksw.org">AKSW</a> research group (University of Leipzig).</p> + ... and implemented by <a href="http://jens-lehmann.org">Jens Lehmann</a> and + Sebastian Knappe at the <a href="http:/aksw.org">AKSW</a> research group (University of Leipzig).</p> <a href="http://www.w3.org/2004/OWL/"><img src="images/sw-owl-green.png" alt="OWL logo" /></a> <a href="http://www.w3.org/2001/sw/DataAccess/"><img src="images/sw-sparql-green.png" alt="SPARQL logo"/></a> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |