From: <jen...@us...> - 2008-01-09 17:55:29
|
Revision: 357 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=357&view=rev Author: jenslehmann Date: 2008-01-09 09:55:25 -0800 (Wed, 09 Jan 2008) Log Message: ----------- fixed bug which caused some triples not to appear Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/ajaxfunctions.php trunk/src/dbpedia-navigator/default.css trunk/src/dbpedia-navigator/index.php trunk/src/dl-learner/org/dllearner/kb/SparqlOntologyCollector.java Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-01-09 16:32:14 UTC (rev 356) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-01-09 17:55:25 UTC (rev 357) @@ -103,8 +103,12 @@ $ret=array(); foreach ($array as $element) { - $items=preg_split("[<]",$element,-1, PREG_SPLIT_NO_EMPTY); - $ret[$items[0]]=$items[1]; + $items=preg_split("[<]",$element,-1, PREG_SPLIT_NO_EMPTY); + + // each property can occur multiple times (!) + // bug: $ret[$items[0]]=$items[1]; + + $ret[$items[0]][] = $items[1]; } return $ret; } Modified: trunk/src/dbpedia-navigator/ajaxfunctions.php =================================================================== --- trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-01-09 16:32:14 UTC (rev 356) +++ trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-01-09 17:55:25 UTC (rev 357) @@ -68,14 +68,14 @@ // display a picture if there is one if(isset($triples['http://xmlns.com/foaf/0.1/depiction'])) - $content.='<img src="'.$triples['http://xmlns.com/foaf/0.1/depiction'].'" alt="Picture of '.$subject_nice.'" style="float:right; max-width:200px;" \>'; + $content.='<img src="'.$triples['http://xmlns.com/foaf/0.1/depiction'][0].'" alt="Picture of '.$subject_nice.'" style="float:right; max-width:200px;" \>'; // add short description in english - $content.="<h3>Short Description</h3><p>".urldecode($triples['http://dbpedia.org/property/abstract'])."</p>"; + $content.="<h4>Short Description</h4><p>".urldecode($triples['http://dbpedia.org/property/abstract'][0])."</p>"; // give the link to the corresponding Wikipedia article 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'].'">view Wikipedia article</a>, '; + $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 @@ -248,9 +248,15 @@ // helper function function get_triple_table($triples) { + $table = '<table border="1"><tr><td>predicate</td><td>object</td></tr>'; foreach($triples as $predicate=>$object) { - $table .= '<tr><td>'.$predicate.'</td><td>'.$object.'</td></tr>'; + $table .= '<tr><td>'.$predicate.'</td>'; + $table .= '<td><ul>'; + foreach($object as $element) { + $table .= '<li>'.$element.'</li>'; + } + $table .= '</ul></td>'; } $table .= '</table>'; return $table; Modified: trunk/src/dbpedia-navigator/default.css =================================================================== --- trunk/src/dbpedia-navigator/default.css 2008-01-09 16:32:14 UTC (rev 356) +++ trunk/src/dbpedia-navigator/default.css 2008-01-09 17:55:25 UTC (rev 357) @@ -12,7 +12,7 @@ } html { - font: 80%/1.2 "Lucida Grande", Helvetica, Arial, sans-serif; + font: 85%/1.2 "Lucida Grande", Helvetica, Arial, sans-serif; } p { @@ -367,7 +367,8 @@ } #ArticleTitle { - font-size: 110%; + font-size: 150%; + color:black; } #footer { Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-01-09 16:32:14 UTC (rev 356) +++ trunk/src/dbpedia-navigator/index.php 2008-01-09 17:55:25 UTC (rev 357) @@ -12,6 +12,12 @@ $ids=$sc->getIDs(); $_SESSION['id']=$ids[0]; $_SESSION['ksID']=$ids[1]; + +// debugging code +// echo '<pre>'; +// $sc=new DLLearnerConnection($settings->dbpediauri,$settings->wsdluri,$_SESSION['id'],$_SESSION['ksID']); +// print_r($sc->getTriples($settings->sparqlttl,'http://dbpedia.org/resource/Dog')); +// echo '</pre>'; require("ajax.php"); @@ -184,6 +190,9 @@ <li>get local DBpedia SPARQL endpoint working</li> <li>many queries work correctly on the server, but yield to response in the interface (seems to be rather random)</li> <li>fix sometimes occurring PHP errors and warnings</li> + <li>would be interesting to somehow view the Wikipedia article (without the left navigation part, + tabs etc.) as an overlay, because the Wikipedia article will almost always be a human-friendlier + description of an object compared to the extracted one</li> </ul> </p> </div> Modified: trunk/src/dl-learner/org/dllearner/kb/SparqlOntologyCollector.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/SparqlOntologyCollector.java 2008-01-09 16:32:14 UTC (rev 356) +++ trunk/src/dl-learner/org/dllearner/kb/SparqlOntologyCollector.java 2008-01-09 17:55:25 UTC (rev 357) @@ -47,7 +47,7 @@ boolean print_flag=false; SparqlQueryMaker q; - SparqlCache c; + SparqlCache cache; URL url; SparqlFilter sf; String[] subjectList; @@ -90,7 +90,7 @@ this.numberOfRecursions=numberOfRecursions; this.format=format; this.q=new SparqlQueryMaker(); - this.c=new SparqlCache("cache"); + this.cache=new SparqlCache("cache"); if(defClasses!=null && defClasses.length>0 ){ this.defaultClasses=defClasses; } @@ -108,7 +108,7 @@ public SparqlOntologyCollector(URL url) { this.q=new SparqlQueryMaker(); - this.c=new SparqlCache("cache"); + this.cache=new SparqlCache("cache"); this.url=url; } @@ -131,16 +131,16 @@ public String[] collectTriples(String subject) throws IOException{ System.out.println("Searching for Article: "+subject); String sparql=q.makeArticleQuery(subject); - String FromCache=c.get(subject, sparql); + String fromCache=cache.get(subject, sparql); String xml; // if not in cache get it from dbpedia - if(FromCache==null){ + if(fromCache==null){ xml=sendAndReceive(sparql); - c.put(subject, xml, sparql); + cache.put(subject, xml, sparql); System.out.print("\n"); } else{ - xml=FromCache; + xml=fromCache; System.out.println("FROM CACHE"); } @@ -181,12 +181,12 @@ public String[] getSubjectsFromLabel(String label, int limit) throws IOException{ System.out.println("Searching for Label: "+label); String sparql=q.makeLabelQuery(label,limit); - String FromCache=c.get(label, sparql); + String FromCache=cache.get(label, sparql); String xml; // if not in cache get it from dbpedia if(FromCache==null){ xml=sendAndReceive(sparql); - c.put(label, xml, sparql); + cache.put(label, xml, sparql); System.out.print("\n"); } else{ @@ -201,12 +201,12 @@ { System.out.println("Searching for Subjects of type: "+concept); String sparql=q.makeConceptQuery(concept); - String FromCache=c.get(concept, sparql); + String FromCache=cache.get(concept, sparql); String xml; // if not in cache get it from dbpedia if(FromCache==null){ xml=sendAndReceive(sparql); - c.put(concept, xml, sparql); + cache.put(concept, xml, sparql); System.out.print("\n"); } else{ @@ -242,12 +242,12 @@ String sparql=q.makeQueryFilter(StartingSubject,this.sf); // checks cache - String FromCache=c.get(StartingSubject, sparql); + String FromCache=cache.get(StartingSubject, sparql); String xml; // if not in cache get it from dbpedia if(FromCache==null){ xml=sendAndReceive(sparql); - c.put(StartingSubject, xml, sparql); + cache.put(StartingSubject, xml, sparql); System.out.print("\n"); } else{ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |