From: <sk...@us...> - 2008-10-23 14:17:41
|
Revision: 1417 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1417&view=rev Author: sknappe Date: 2008-10-23 14:17:31 +0000 (Thu, 23 Oct 2008) Log Message: ----------- bugfixes Modified Paths: -------------- trunk/src/dbpedia-navigator/ajax_get_article.php trunk/src/dbpedia-navigator/ajax_set_positives_and_negatives.php trunk/src/dbpedia-navigator/helper_functions.php trunk/src/dbpedia-navigator/index.php Modified: trunk/src/dbpedia-navigator/ajax_get_article.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_article.php 2008-10-23 08:44:58 UTC (rev 1416) +++ trunk/src/dbpedia-navigator/ajax_get_article.php 2008-10-23 14:17:31 UTC (rev 1417) @@ -65,7 +65,8 @@ $artTitle=$triples['http://www.w3.org/2000/01/rdf-schema#label'][0]['value']; else $artTitle=urldecode(str_replace("_"," ",substr (strrchr ($uri, "/"), 1))); - + if (strpos($artTitle,'"')==strlen($artTitle)-1) $artTitle=substr($artTitle,0,strlen($artTitle)-1); + // display a picture if there is one if (isset($triples['http://dbpedia.org/property/imageCaption'])&&$triples['http://dbpedia.org/property/imageCaption'][0]['type']!='uri') $alt=$triples['http://dbpedia.org/property/imageCaption'][0]['value']; else if (isset($triples['http://dbpedia.org/property/caption'])&&$triples['http://dbpedia.org/property/caption'][0]['type']!='uri') $alt=$triples['http://dbpedia.org/property/caption'][0]['value']; @@ -96,11 +97,11 @@ // 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" style="max-width:20px;" /> <a href="#" onclick="window.open(\''.getPrintableURL($triples['http://xmlns.com/foaf/0.1/page'][0]['value']).'\',\'Wikiwindow\',\'width=800,height=500,top=50,left=50,scrollbars=yes\');">view Wikipedia article</a>, '; - $content .= '<img src="images/dbpedia-favicon.ico" alt="DBpedia" style="max-width:20px;"/> <a href="#" onclick="window.open(\''.$uri.'\',\'Wikiwindow\',\'width=800,height=500,top=50,left=50,scrollbars=yes\');">view DBpedia resource description</a>'; + $content .= '<p><img src="images/wikipedia_favicon.png" alt="Wikipedia" style="max-width:20px;" /> <a href="'.$triples['http://xmlns.com/foaf/0.1/page'][0]['value'].'" onclick="window.open(\''.getPrintableURL($triples['http://xmlns.com/foaf/0.1/page'][0]['value']).'\',\'Wikiwindow\',\'width=800,height=500,top=50,left=50,scrollbars=yes\');">view Wikipedia article</a>, '; + $content .= '<img src="images/dbpedia-favicon.ico" alt="DBpedia" style="max-width:20px;"/> <a href="'.$uri.'" onclick="window.open(\''.$uri.'\',\'Wikiwindow\',\'width=800,height=500,top=50,left=50,scrollbars=yes\');">view DBpedia resource description</a>'; //display photo collection, if there is one if (isset($triples['http://dbpedia.org/property/hasPhotoCollection'])){ - $content.=', <img src="images/flickr.png" alt="Flickr" style="max-width:20px;" /> <a href="#" onclick="window.open(\''.$triples['http://dbpedia.org/property/hasPhotoCollection'][0]['value'].'\',\'Wikiwindow\',\'width=800,height=500,top=50,left=50,scrollbars=yes\');">view photo collection</a></p>'; + $content.=', <img src="images/flickr.png" alt="Flickr" style="max-width:20px;" /> <a href="'.$triples['http://dbpedia.org/property/hasPhotoCollection'][0]['value'].'" onclick="window.open(\''.$triples['http://dbpedia.org/property/hasPhotoCollection'][0]['value'].'\',\'Wikiwindow\',\'width=800,height=500,top=50,left=50,scrollbars=yes\');">view photo collection</a></p>'; } //display owl:sameAs properties Modified: trunk/src/dbpedia-navigator/ajax_set_positives_and_negatives.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_set_positives_and_negatives.php 2008-10-23 08:44:58 UTC (rev 1416) +++ trunk/src/dbpedia-navigator/ajax_set_positives_and_negatives.php 2008-10-23 14:17:31 UTC (rev 1417) @@ -22,6 +22,7 @@ $query="SELECT label FROM rank WHERE name='$pos' LIMIT 1"; $res=$databaseConnection->query($query); $result=$databaseConnection->nextEntry($res); + if (strlen($result['label'])<=0) $ptemp[$pos]=urldecode(str_replace("_"," ",substr (strrchr ($pos, "/"), 1))); $ptemp[$pos]=$result['label']; } @@ -30,6 +31,7 @@ $query="SELECT label FROM rank WHERE name='$neg' LIMIT 1"; $res=$databaseConnection->query($query); $result=$databaseConnection->nextEntry($res); + if (strlen($result['label'])<=0) $ntemp[$neg]=urldecode(str_replace("_"," ",substr (strrchr ($neg, "/"), 1))); $ntemp[$neg]=$result['label']; } Modified: trunk/src/dbpedia-navigator/helper_functions.php =================================================================== --- trunk/src/dbpedia-navigator/helper_functions.php 2008-10-23 08:44:58 UTC (rev 1416) +++ trunk/src/dbpedia-navigator/helper_functions.php 2008-10-23 14:17:31 UTC (rev 1417) @@ -30,8 +30,10 @@ function subjectToURI($subject) { //if the subject is already a URI return it - if (strpos($subject,"http://dbpedia.org/resource/")===0) - return $subject; + if (strpos($subject,"http://dbpedia.org/resource/")===0){ + $part=substr (strrchr ($subject, "/"), 1); + return substr($subject,0,strlen($subject)-strlen($part)).urlencode($part); + } //delete whitespaces at beginning and end $subject=trim($subject); //get first letters big @@ -260,87 +262,90 @@ function get_triple_table($triples,$subjecttriples) { - $table = '<table border="0" style="width:100%;overflow:hidden"><tr><td><b>Predicate</b></td><td><b>Object/Subject</b></td></tr>'; - $i=1; - foreach($triples as $predicate=>$object) { - $number=count($object); - if ($i>0) $backgroundcolor="eee"; - else $backgroundcolor="ffffff"; - $table .= '<tr style="background-color:#'.$backgroundcolor.';"><td><a href="'.$predicate.'" target="_blank">'.nicePredicate($predicate).'</a></td>'; - $table .= '<td>'; - if ($number>1) $table.='<ul>'; - $k=1; - foreach($object as $element) { - if ($k>3) $display=" style=\"display:none\""; - else $display=""; - if ($element['type']=="uri"){ - if (strpos($element['value'],"http://dbpedia.org/resource/")===0&&substr_count($element['value'],"/")==4&&strpos($element['value'],"Template:")!=28){ - $label=str_replace('_',' ',substr($element['value'],28)); - if (strlen($label)>60) $label=substr($label,0,60).'...'; - if ($number>1) $table.='<li'.$display.'>'; - $table .= '<a href="#" onclick="get_article(\'label='.$element['value'].'&cache=-1\');">'.urldecode($label).'</a>'; - if ($number>1) $table.='</li>'; + if ((is_array($triples)&&count($triples)>0)||(is_array($subjecttriples)&&count($subjecttriples)>0){ + $table = '<table border="0" style="width:100%;overflow:hidden"><tr><td><b>Predicate</b></td><td><b>Object/Subject</b></td></tr>'; + $i=1; + if (is_array($triples)&&count($triples)>0) foreach($triples as $predicate=>$object) { + $number=count($object); + if ($i>0) $backgroundcolor="eee"; + else $backgroundcolor="ffffff"; + $table .= '<tr style="background-color:#'.$backgroundcolor.';"><td><a href="'.$predicate.'" target="_blank">'.nicePredicate($predicate).'</a></td>'; + $table .= '<td>'; + if ($number>1) $table.='<ul>'; + $k=1; + foreach($object as $element) { + if ($k>3) $display=" style=\"display:none\""; + else $display=""; + if ($element['type']=="uri"){ + if (strpos($element['value'],"http://dbpedia.org/resource/")===0&&substr_count($element['value'],"/")==4&&strpos($element['value'],"Template:")!=28){ + $label=str_replace('_',' ',substr($element['value'],28)); + if (strlen($label)>60) $label=substr($label,0,60).'...'; + if ($number>1) $table.='<li'.$display.'>'; + $table .= '<a href="#" onclick="get_article(\'label='.$element['value'].'&cache=-1\');">'.urldecode($label).'</a>'; + if ($number>1) $table.='</li>'; + } + else{ + if ($number>1) $table.='<li'.$display.'>'; + $label=urldecode($element['value']); + if (strlen($label)>60) $label=substr($label,0,60).'...'; + $table .= '<a href="'.$element['value'].'" target="_blank">'.$label.'</a>'; + if ($number>1) $table.='</li>'; + } } else{ if ($number>1) $table.='<li'.$display.'>'; - $label=urldecode($element['value']); - if (strlen($label)>60) $label=substr($label,0,60).'...'; - $table .= '<a href="'.$element['value'].'" target="_blank">'.$label.'</a>'; + $table .= $element['value']; if ($number>1) $table.='</li>'; } + $k++; } - else{ - if ($number>1) $table.='<li'.$display.'>'; - $table .= $element['value']; - if ($number>1) $table.='</li>'; - } - $k++; + if ($number>3) $table.='<a href="javascript:none()" onclick="toggleAttributes(this)"><img src="images/arrow_down.gif"/> show</a>'; + if ($number>1) $table.='</ul>'; + $table .= '</td>'; + $i*=-1; } - if ($number>3) $table.='<a href="javascript:none()" onclick="toggleAttributes(this)"><img src="images/arrow_down.gif"/> show</a>'; - if ($number>1) $table.='</ul>'; - $table .= '</td>'; - $i*=-1; - } - foreach($subjecttriples as $predicate=>$object) { - $number=count($object); - if ($i>0) $backgroundcolor="eee"; - else $backgroundcolor="ffffff"; - $table .= '<tr style="background-color:#'.$backgroundcolor.';"><td><a href="'.$predicate.'" target="_blank">is '.nicePredicate($predicate).' of </a></td>'; - $table .= '<td>'; - if ($number>1) $table.='<ul>'; - $k=1; - foreach($object as $element) { - if ($k>3) $display=" style=\"display:none\""; - else $display=""; - if ($element['type']=="uri"){ - if (strpos($element['value'],"http://dbpedia.org/resource/")===0&&substr_count($element['value'],"/")==4&&strpos($element['value'],"Template:")!=28){ - $label=str_replace('_',' ',substr($element['value'],28)); - if (strlen($label)>60) $label=substr($label,0,60).'...'; - if ($number>1) $table.='<li'.$display.'>'; - $table .= '<a href="#" onclick="get_article(\'label='.$element['value'].'&cache=-1\');">'.urldecode($label).'</a>'; - if ($number>1) $table.='</li>'; + if (is_array($subjecttriples)&&count($subjecttriples)>0) foreach($subjecttriples as $predicate=>$object) { + $number=count($object); + if ($i>0) $backgroundcolor="eee"; + else $backgroundcolor="ffffff"; + $table .= '<tr style="background-color:#'.$backgroundcolor.';"><td><a href="'.$predicate.'" target="_blank">is '.nicePredicate($predicate).' of </a></td>'; + $table .= '<td>'; + if ($number>1) $table.='<ul>'; + $k=1; + foreach($object as $element) { + if ($k>3) $display=" style=\"display:none\""; + else $display=""; + if ($element['type']=="uri"){ + if (strpos($element['value'],"http://dbpedia.org/resource/")===0&&substr_count($element['value'],"/")==4&&strpos($element['value'],"Template:")!=28){ + $label=str_replace('_',' ',substr($element['value'],28)); + if (strlen($label)>60) $label=substr($label,0,60).'...'; + if ($number>1) $table.='<li'.$display.'>'; + $table .= '<a href="#" onclick="get_article(\'label='.$element['value'].'&cache=-1\');">'.urldecode($label).'</a>'; + if ($number>1) $table.='</li>'; + } + else{ + if ($number>1) $table.='<li'.$display.'>'; + $label=urldecode($element['value']); + if (strlen($label)>60) $label=substr($label,0,60).'...'; + $table .= '<a href="'.$element['value'].'" target="_blank">'.$label.'</a>'; + if ($number>1) $table.='</li>'; + } } else{ if ($number>1) $table.='<li'.$display.'>'; - $label=urldecode($element['value']); - if (strlen($label)>60) $label=substr($label,0,60).'...'; - $table .= '<a href="'.$element['value'].'" target="_blank">'.$label.'</a>'; + $table .= $element['value']; if ($number>1) $table.='</li>'; } + $k++; } - else{ - if ($number>1) $table.='<li'.$display.'>'; - $table .= $element['value']; - if ($number>1) $table.='</li>'; - } - $k++; + if ($number>3) $table.='<a href="javascript:none()" onclick="toggleAttributes(this)"><img src="images/arrow_down.gif"/> show</a>'; + if ($number>1) $table.='</ul>'; + $table .= '</td>'; + $i*=-1; } - if ($number>3) $table.='<a href="javascript:none()" onclick="toggleAttributes(this)"><img src="images/arrow_down.gif"/> show</a>'; - if ($number>1) $table.='</ul>'; - $table .= '</td>'; - $i*=-1; + $table .= '</table>'; } - $table .= '</table>'; + else $table="No Tripel left."; return $table; } Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-10-23 08:44:58 UTC (rev 1416) +++ trunk/src/dbpedia-navigator/index.php 2008-10-23 14:17:31 UTC (rev 1417) @@ -18,11 +18,26 @@ $onLoad="onLoad=\"document.getElementById('label').focus();"; if (isset($_GET['positives'])||isset($_GET['negatives'])) $onLoad.="setPositivesAndNegatives('positives=".@$_GET['positives']."&negatives=".@$_GET['negatives']."');"; else if (isset($_SESSION['positives'])||isset($_SESSION['negatives'])) $onLoad.="setPositivesAndNegatives('positives=".$_SESSION['positives']."&negatives=".$_SESSION['negatives']."');"; -if (isset($_GET['showArticle'])) $onLoad.="get_article('label=".$_GET['showArticle']."&cache=-1');"; -else if (isset($_GET['search'])) $onLoad.="search_it('label=".$_GET['search']."&number=10');"; -else if (isset($_GET['showClass'])) $onLoad.="get_class('class=http://dbpedia.org/class/yago/".$_GET['showClass']."&cache=-1');"; -else if (isset($_GET['searchInstances'])) $onLoad.="getSubjectsFromCategory('category=http://dbpedia.org/class/yago/".$_GET['searchInstances']."&number=10');"; -else if (isset($_GET['searchConceptInstances'])) $onLoad.="getSubjectsFromConcept('kb=".htmlentities(urldecode($_GET['concept']))."&number=10');"; +if (isset($_GET['showArticle'])){ + session_unset(); + $onLoad.="get_article('label=".$_GET['showArticle']."&cache=-1');"; +} +else if (isset($_GET['search'])){ + session_unset(); + $onLoad.="search_it('label=".$_GET['search']."&number=10');"; +} +else if (isset($_GET['showClass'])){ + session_unset(); + $onLoad.="get_class('class=http://dbpedia.org/class/yago/".$_GET['showClass']."&cache=-1');"; +} +else if (isset($_GET['searchInstances'])){ + session_unset(); + $onLoad.="getSubjectsFromCategory('category=http://dbpedia.org/class/yago/".$_GET['searchInstances']."&number=10');"; +} +else if (isset($_GET['searchConceptInstances'])){ + session_unset(); + $onLoad.="getSubjectsFromConcept('kb=".htmlentities(urldecode($_GET['concept']))."&number=10');"; +} else if (isset($_SESSION['currentArticle'])){ $onLoad.="get_article('label=&cache=".$_SESSION['currentArticle']."');"; } @@ -86,14 +101,14 @@ <div class="box" id="credits"> <p>DBpedia Navigator is powered by ... <br /> - <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> and - Sebastian Knappe at the <a href="http:/aksw.org">AKSW</a> research group (University of Leipzig).</p> + <a href="http://dl-learner.org" target="_blank">DL-Learner</a><br /> + <a href="http//dbpedia.org" target="_blank">DBpedia</a><br/> + <a href="http://virtuoso.openlinksw.com/wiki/main/" target="_blank">OpenLink Virtuoso</a><br /> + ... and implemented by <a href="http://jens-lehmann.org" target="_blank">Jens Lehmann</a> and + Sebastian Knappe at the <a href="http:/aksw.org" target="_blank">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> + <a href="http://www.w3.org/2004/OWL/" target="_blank"><img src="images/sw-owl-green.png" alt="OWL logo" /></a> + <a href="http://www.w3.org/2001/sw/DataAccess/" target="_blank"><img src="images/sw-sparql-green.png" alt="SPARQL logo"/></a> </div> </div><!-- END leftSidebar --> @@ -152,45 +167,12 @@ $uri = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; echo '<div><a href="http://validator.w3.org/check?uri='.$uri.'"'; - echo '><img src="images/valid-xhtml10.png" alt="valid XHTML 1.0" /></a>'."\n"; + echo ' target="_blank"><img src="images/valid-xhtml10.png" alt="valid XHTML 1.0" /></a>'."\n"; echo '<a href="http://jigsaw.w3.org/css-validator/validator?uri='.$uri.'"'; - echo '><img src="images/valid-css.png" alt="valid CSS" /></a></div>'."\n"; + echo ' target="_blank"><img src="images/valid-css.png" alt="valid CSS" /></a></div>'."\n"; ?> - </div> - <p><a href='rebuild.php'>rebuild [restart session and redownload WSDL file (for debugging)]</a></p> + </div> </div> - -<div id="todo"> -<b>ToDo:</b> -<ul style="float:left"> - <li>Get learning component fast.</li> - <li>Get local DBpedia SPARQL endpoint working (next DBpedia release expected at the endof January and then every - two months, so it would be nice to have a script based partly automated or at least documented solution for - creating a DBpedia mirror).</li> - <li>Improve stability: Fix sometimes occurring PHP errors and warnings (check PHP error log).</li> - <li>For each result, display a "+" which shows more information about the concept in an overlay box, e.g. its - Description Logic or OWL syntax, its classification accuracy on the examples, and which - examples it classifies (in-)correctly.</li> - <li>Create a small number of test cases (e.g. 3), which can be used to verify that DBpedia Navigator is - working in typical scenarios (in particular cases where concepts with length greater one are learned).</li> - <li>Make DBpedia Navigator RESTful, e.g. URLs $base/showArticle/$URL for displaying an article; - $base/search/$phrase for searching; $base/listInstances/$complexClass for listing the instances of - a learned. Maybe session variables (in particuar the selected positive and negative examples) can - also be given, e.g. $base/search/$phrase?positives=[$URL1,$URL2,$URL3]&negatives=[$URL4]. The supported - URI design should be briefly documented (e.g. on a dbpedia.org wiki page). A good URI design allows - easier external access (just give someone a link instead of saying exactly which actions have to be done to - get to a state), simplifies debugging the application, and may be of use for creating further - features.</li> - <li>[if possible] When expensive SPARQL queries or learning problems have been posed, there should be - some way to abandon these if the user has already switched to doing something else. Example: The user - has added 3 positive and 1 negative examples. This is executed as a learning problem, but has no solution (so - DL-Learner would run forever unless we pose some internal time limit). The user adds another negative example a - second later, so instead of letting the previous learning problem run for a long time (and needing much resources), - it should be stopped by DBpedia Navigator.</li> - <li>[if possible] Find an easy way to validate HTML/JS in AJAX applications.</li> -</ul> -</div> - </body> </html> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-10-24 08:47:53
|
Revision: 1423 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1423&view=rev Author: sknappe Date: 2008-10-24 08:45:12 +0000 (Fri, 24 Oct 2008) Log Message: ----------- changed behaviour for naturaldescriptions Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/main.wsdl Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-10-24 07:26:43 UTC (rev 1422) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-10-24 08:45:12 UTC (rev 1423) @@ -139,7 +139,7 @@ function getNaturalDescription($concept) { - return $this->client->getNaturalDescription($concept, $this->endpoint); + return $this->client->getNaturalDescription($this->id, $concept); } function getConceptDepth() Modified: trunk/src/dbpedia-navigator/main.wsdl =================================================================== --- trunk/src/dbpedia-navigator/main.wsdl 2008-10-24 07:26:43 UTC (rev 1422) +++ trunk/src/dbpedia-navigator/main.wsdl 2008-10-24 08:45:12 UTC (rev 1423) @@ -355,8 +355,9 @@ <part name="return" type="xsd:string"></part> </message> <message name="getNaturalDescription"> - <part name="arg0" type="xsd:string"></part> + <part name="arg0" type="xsd:int"></part> <part name="arg1" type="xsd:string"></part> + <part name="arg2" type="xsd:string"></part> </message> <message name="getNaturalDescriptionResponse"> <part name="return" type="xsd:string"></part> @@ -661,10 +662,11 @@ <output message="tns:SparqlRetrievalResponse"></output> <fault message="tns:ParseException" name="ParseException"></fault> </operation> - <operation name="getNaturalDescription" parameterOrder="arg0 arg1"> + <operation name="getNaturalDescription" parameterOrder="arg0 arg1 arg2"> <input message="tns:getNaturalDescription"></input> <output message="tns:getNaturalDescriptionResponse"></output> <fault message="tns:ParseException" name="ParseException"></fault> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> </operation> <operation name="getNegativeExamples" parameterOrder="arg0 arg1 arg2 arg3 arg4"> <input message="tns:getNegativeExamples"></input> @@ -1371,6 +1373,9 @@ <fault name="ParseException"> <soap:fault name="ParseException" use="literal"></soap:fault> </fault> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> </operation> <operation name="getNegativeExamples"> <soap:operation soapAction=""></soap:operation> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-10-27 08:33:59
|
Revision: 1436 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1436&view=rev Author: jenslehmann Date: 2008-10-27 08:29:37 +0000 (Mon, 27 Oct 2008) Log Message: ----------- started DBpedia Navigator templates Added Paths: ----------- trunk/src/dbpedia-navigator/templates/ trunk/src/dbpedia-navigator/templates/AbstractTemplate.php trunk/src/dbpedia-navigator/templates/CityTemplate.php Added: trunk/src/dbpedia-navigator/templates/AbstractTemplate.php =================================================================== --- trunk/src/dbpedia-navigator/templates/AbstractTemplate.php (rev 0) +++ trunk/src/dbpedia-navigator/templates/AbstractTemplate.php 2008-10-27 08:29:37 UTC (rev 1436) @@ -0,0 +1,37 @@ +<?php +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +/** + * Abstract template class. Templates are used for displaying information + * about a particular entity in a user friendly way. + * + * You can also use this class for convenience functions accessible by + * all concrete templates. + * + * @author Jens Lehmann + */ +class AbstractTemplate { + + abstract function printTemplate($triples); + +} + +?> \ No newline at end of file Added: trunk/src/dbpedia-navigator/templates/CityTemplate.php =================================================================== --- trunk/src/dbpedia-navigator/templates/CityTemplate.php (rev 0) +++ trunk/src/dbpedia-navigator/templates/CityTemplate.php 2008-10-27 08:29:37 UTC (rev 1436) @@ -0,0 +1,42 @@ +<?php +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +/** + * Template for cities. + * + * @author Jens Lehmann + */ +class CityTemplate { + + function getTemplate($triples) { + $content = ""; + + $latitude = $triples['http://dbpedia.org/ontology/latitutedegrees'] + "° " + + $triples['http://dbpedia.org/ontology/latitudeminutes'] + "′" + + $triples['http://dbpedia.org/ontology/latitudeseconds'] + "″N"; + + // .. continue ... + + return $content; + } + +} +?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-10-27 09:36:28
|
Revision: 1441 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1441&view=rev Author: jenslehmann Date: 2008-10-27 09:32:07 +0000 (Mon, 27 Oct 2008) Log Message: ----------- continued city template Modified Paths: -------------- trunk/src/dbpedia-navigator/Settings.php.dist trunk/src/dbpedia-navigator/templates/AbstractTemplate.php trunk/src/dbpedia-navigator/templates/CityTemplate.php Added Paths: ----------- trunk/src/dbpedia-navigator/templates/PlaceTemplate.php trunk/src/dbpedia-navigator/templates/PopulatedPlaceTemplate.php Modified: trunk/src/dbpedia-navigator/Settings.php.dist =================================================================== --- trunk/src/dbpedia-navigator/Settings.php.dist 2008-10-27 09:28:53 UTC (rev 1440) +++ trunk/src/dbpedia-navigator/Settings.php.dist 2008-10-27 09:32:07 UTC (rev 1441) @@ -40,6 +40,8 @@ public $endpoint="DBPEDIA"; //public $endpoint="LOCALDBPEDIA"; + public $dbpediaPropertyPrefix = 'http://dbpedia.org/ontology/'; + public $dbpediaClassPrefix = 'http://dbpedia.org/ontology/'; // in mikrosekunden public $sparqlttl=60000000; Modified: trunk/src/dbpedia-navigator/templates/AbstractTemplate.php =================================================================== --- trunk/src/dbpedia-navigator/templates/AbstractTemplate.php 2008-10-27 09:28:53 UTC (rev 1440) +++ trunk/src/dbpedia-navigator/templates/AbstractTemplate.php 2008-10-27 09:32:07 UTC (rev 1441) @@ -32,6 +32,31 @@ abstract function printTemplate($triples); + // utility method, which checks whether the given DBpedia ontology properties exists in the triples + // is they exist, the method returns true and false otherwise; + // TODO: use $dbpediaOntologyPrefix in $settings (how do we access those settings in all scripts?) + function areDBpediaPropertiesSet($triples, $properties) { + foreach($properties as $property) { + if(!isset($triples['http://dbpedia.org/ontology/'.$property])) { + return false; + } + } + return true; + } + + // gets the value of the property + function getPropValue($triples, $property) { + return $triples['http://dbpedia.org/ontology/'.$property]; + } + + // gets the value of the property and removes it from the triple array + // (this means you cannot access this information anymore afterwards) + function extractPropValue($triples, $property) { + $value = $triples['http://dbpedia.org/ontology/'.$property]; + unset($triples['http://dbpedia.org/ontology/'.$property]); + return $value; + } + } ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/templates/CityTemplate.php =================================================================== --- trunk/src/dbpedia-navigator/templates/CityTemplate.php 2008-10-27 09:28:53 UTC (rev 1440) +++ trunk/src/dbpedia-navigator/templates/CityTemplate.php 2008-10-27 09:32:07 UTC (rev 1441) @@ -24,15 +24,15 @@ * * @author Jens Lehmann */ -class CityTemplate { +class CityTemplate extends PopulatedPlaceTemplate { function getTemplate($triples) { $content = ""; + $content .= '<table>'; + $content .= '<tr><td colspan="2">City Information</td></tr>'; + $content .= '<tr><td>total population</td><td>' + getPopulationString($triples) + '</td></tr>'; + $content .= '</table>'; - $latitude = $triples['http://dbpedia.org/ontology/latitutedegrees'] + "° " - + $triples['http://dbpedia.org/ontology/latitudeminutes'] + "′" - + $triples['http://dbpedia.org/ontology/latitudeseconds'] + "″N"; - // .. continue ... return $content; Added: trunk/src/dbpedia-navigator/templates/PlaceTemplate.php =================================================================== --- trunk/src/dbpedia-navigator/templates/PlaceTemplate.php (rev 0) +++ trunk/src/dbpedia-navigator/templates/PlaceTemplate.php 2008-10-27 09:32:07 UTC (rev 1441) @@ -0,0 +1,59 @@ +<?php +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +/** + * Abstract template class. Templates are used for displaying information + * about a particular entity in a user friendly way. + * + * You can also use this class for convenience functions accessible by + * all concrete templates. + * + * @author Jens Lehmann + */ +abstract class PlaceTemplate extends AbstractTemplate { + + // returns a latitude string of the form 49°1′0″N or "unknown" + public getLatitudeString($triples) { + if(!areDBpediaPropertiesSet(array('latitudedegrees','latitudeminutes','latitudeseconds'))) { + return "unknown"; + } + + $latitude = $triples['http://dbpedia.org/ontology/latitutedegrees'] + "° " + + $triples['http://dbpedia.org/ontology/latitudeminutes'] + "′" + + $triples['http://dbpedia.org/ontology/latitudeseconds'] + "″N"; + return $latitude; + } + + // returns a latitude string of the form 49°1′0″E or "unknown" + public getLongitudeString($triples) { + if(!areDBpediaPropertiesSet(array('longitudedegrees','longitudeminutes','longitudeseconds'))) { + return "unknown"; + } + + $longitude = $triples['http://dbpedia.org/ontology/longitutedegrees'] + "° " + + $triples['http://dbpedia.org/ontology/longitudeminutes'] + "′" + + $triples['http://dbpedia.org/ontology/longitudeseconds'] + "″N"; + return $longitude; + } + +} + +?> \ No newline at end of file Added: trunk/src/dbpedia-navigator/templates/PopulatedPlaceTemplate.php =================================================================== --- trunk/src/dbpedia-navigator/templates/PopulatedPlaceTemplate.php (rev 0) +++ trunk/src/dbpedia-navigator/templates/PopulatedPlaceTemplate.php 2008-10-27 09:32:07 UTC (rev 1441) @@ -0,0 +1,36 @@ +<?php +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +/** + * Template for all populated places. + */ +abstract class PopulatedPlaceTemplate extends PlaceTemplate { + + // return a nicely formatted string for the population of the place + public getPopulationString() { + $number = number_format(extractPropValue('populationTotal')); + $asOf = extractPropValue('populationAsOf'); + + return $number + ' (as of ' + $asOf + ')'; + } + +} +?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-10-27 13:52:11
|
Revision: 1445 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1445&view=rev Author: sknappe Date: 2008-10-27 13:51:53 +0000 (Mon, 27 Oct 2008) Log Message: ----------- changes to use new ontology Modified Paths: -------------- trunk/src/dbpedia-navigator/Settings.php.dist trunk/src/dbpedia-navigator/ajax_get_article.php trunk/src/dbpedia-navigator/helper_functions.php Modified: trunk/src/dbpedia-navigator/Settings.php.dist =================================================================== --- trunk/src/dbpedia-navigator/Settings.php.dist 2008-10-27 12:36:06 UTC (rev 1444) +++ trunk/src/dbpedia-navigator/Settings.php.dist 2008-10-27 13:51:53 UTC (rev 1445) @@ -60,6 +60,10 @@ public $ignoredRoles=array(); public $classSystem="YAGO"; + //public $classSystem="DBpedia"; + //the name of the used database + public $database_name='navigator_db'; + //public $database_name='navigator_db_new'; //the type of database server public $database_type='mysql'; @@ -70,9 +74,6 @@ //the password of that user public $database_pass='dbpedia'; - //the name of the used database - if ($classSystem=="YAGO") - public $database_name='navigator_db'; } ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/ajax_get_article.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_article.php 2008-10-27 12:36:06 UTC (rev 1444) +++ trunk/src/dbpedia-navigator/ajax_get_article.php 2008-10-27 13:51:53 UTC (rev 1445) @@ -127,6 +127,7 @@ if(isset($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type'])){ // display a list of classes if ($settings->classSystem=="YAGO") $content.='<br/><hr><h4>YAGO Classes</h4><br/>'; + else if ($settings->classSystem=="DBpedia") $content.='<br/><hr><h4>DBpedia Classes</h4><br/>'; $content .= '<p>'.formatClassArray($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type'],$classSystem).'</p>'; } Modified: trunk/src/dbpedia-navigator/helper_functions.php =================================================================== --- trunk/src/dbpedia-navigator/helper_functions.php 2008-10-27 12:36:06 UTC (rev 1444) +++ trunk/src/dbpedia-navigator/helper_functions.php 2008-10-27 13:51:53 UTC (rev 1445) @@ -397,7 +397,8 @@ $string="<ul>"; for($i=0; $i<count($ar); $i++) { - if ($settings->classSystem=="YAGO") $prefix = 'http://dbpedia.org/class/yago/'; + if ($classSystem=="YAGO") $prefix = 'http://dbpedia.org/class/yago/'; + else if ($classSystem=="DBpedia") $prefix='http://dbpedia.org/ontology/' if(substr($ar[$i]['value'],0,30)!=$prefix) continue; $query="SELECT label FROM categories WHERE category='".$ar[$i]['value']."' LIMIT 1"; $res=$databaseConnection->query($query); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-10-27 14:22:31
|
Revision: 1448 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1448&view=rev Author: sknappe Date: 2008-10-27 14:22:25 +0000 (Mon, 27 Oct 2008) Log Message: ----------- bugfix Modified Paths: -------------- trunk/src/dbpedia-navigator/ajax_get_article.php trunk/src/dbpedia-navigator/helper_functions.php Modified: trunk/src/dbpedia-navigator/ajax_get_article.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_article.php 2008-10-27 14:06:04 UTC (rev 1447) +++ trunk/src/dbpedia-navigator/ajax_get_article.php 2008-10-27 14:22:25 UTC (rev 1448) @@ -128,7 +128,7 @@ // display a list of classes if ($settings->classSystem=="YAGO") $content.='<br/><hr><h4>YAGO Classes</h4><br/>'; else if ($settings->classSystem=="DBpedia") $content.='<br/><hr><h4>DBpedia Classes</h4><br/>'; - $content .= '<p>'.formatClassArray($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type'],$classSystem).'</p>'; + $content .= '<p>'.formatClassArray($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type'],$settings->classSystem).'</p>'; } //skos-subjects Modified: trunk/src/dbpedia-navigator/helper_functions.php =================================================================== --- trunk/src/dbpedia-navigator/helper_functions.php 2008-10-27 14:06:04 UTC (rev 1447) +++ trunk/src/dbpedia-navigator/helper_functions.php 2008-10-27 14:22:25 UTC (rev 1448) @@ -399,7 +399,7 @@ for($i=0; $i<count($ar); $i++) { if ($classSystem=="YAGO") $prefix = 'http://dbpedia.org/class/yago/'; else if ($classSystem=="DBpedia") $prefix='http://dbpedia.org/ontology/'; - if(strpos($ar[$i]['value'],$prefix)!==0) continue; + if (substr($ar[$i]['value'],0,strlen($prefix))!=$prefix) continue; $query="SELECT label FROM categories WHERE category='".$ar[$i]['value']."' LIMIT 1"; $res=$databaseConnection->query($query); $result=$databaseConnection->nextEntry($res); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-10-27 14:39:19
|
Revision: 1449 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1449&view=rev Author: sknappe Date: 2008-10-27 14:39:05 +0000 (Mon, 27 Oct 2008) Log Message: ----------- bugfix Modified Paths: -------------- trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php trunk/src/dbpedia-navigator/helper_functions.php trunk/src/dbpedia-navigator/js/navigator.js Modified: trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php 2008-10-27 14:22:25 UTC (rev 1448) +++ trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php 2008-10-27 14:39:05 UTC (rev 1449) @@ -28,7 +28,7 @@ $result=$databaseConnection->nextEntry($res); $label=$result['label']; - $query="SELECT name FROM articlecategories WHERE category='$category' ORDER BY number DESC LIMIT ".$number; + $query="SELECT DISTINCT name FROM articlecategories WHERE category='$category' ORDER BY number DESC LIMIT ".$number; $res=$databaseConnection->query($query); $bestsearches=""; if ($databaseConnection->numberOfEntries($res)>0){ Modified: trunk/src/dbpedia-navigator/helper_functions.php =================================================================== --- trunk/src/dbpedia-navigator/helper_functions.php 2008-10-27 14:22:25 UTC (rev 1448) +++ trunk/src/dbpedia-navigator/helper_functions.php 2008-10-27 14:39:05 UTC (rev 1449) @@ -399,7 +399,7 @@ for($i=0; $i<count($ar); $i++) { if ($classSystem=="YAGO") $prefix = 'http://dbpedia.org/class/yago/'; else if ($classSystem=="DBpedia") $prefix='http://dbpedia.org/ontology/'; - if (substr($ar[$i]['value'],0,strlen($prefix))!=$prefix) continue; + if (substr($ar[$i]['value'],0,strlen($prefix))!=$prefix||$ar[$i]['value']=='http://dbpedia.org/ontology/Resource') continue; $query="SELECT label FROM categories WHERE category='".$ar[$i]['value']."' LIMIT 1"; $res=$databaseConnection->query($query); $result=$databaseConnection->nextEntry($res); Modified: trunk/src/dbpedia-navigator/js/navigator.js =================================================================== --- trunk/src/dbpedia-navigator/js/navigator.js 2008-10-27 14:22:25 UTC (rev 1448) +++ trunk/src/dbpedia-navigator/js/navigator.js 2008-10-27 14:39:05 UTC (rev 1449) @@ -30,8 +30,8 @@ var names; var hasClass; - if (class=='all') document.getElementById('FilterTags').innerHTML='You currently don\'t filter your search results.'; - else document.getElementById('FilterTags').innerHTML='Filtered by class: '+label+'.'; + if (class=='all'&&document.getElementById('FilterTags')) document.getElementById('FilterTags').innerHTML='You currently don\'t filter your search results.'; + else if (document.getElementById('FilterTags')) document.getElementById('FilterTags').innerHTML='Filtered by class: '+label+'.'; for (var i=0;i<links.length;i++){ if (class=='all'){ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-10-27 14:47:56
|
Revision: 1450 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1450&view=rev Author: sknappe Date: 2008-10-27 14:47:51 +0000 (Mon, 27 Oct 2008) Log Message: ----------- bugfix Modified Paths: -------------- trunk/src/dbpedia-navigator/helper_functions.php trunk/src/dbpedia-navigator/js/navigator.js Modified: trunk/src/dbpedia-navigator/helper_functions.php =================================================================== --- trunk/src/dbpedia-navigator/helper_functions.php 2008-10-27 14:39:05 UTC (rev 1449) +++ trunk/src/dbpedia-navigator/helper_functions.php 2008-10-27 14:47:51 UTC (rev 1450) @@ -70,12 +70,12 @@ $lab=getLabel($tag,$label[$tag]); //$tag_with_entities=htmlentities("\"".$tag."\""); - $ret.='<a style="'.$style.'" href="#" onclick="document.getElementById(\'hidden_class\').value=\''.$tag.'\';show_results(\''.$tag.'\',\''.utf8_to_html($lab).'\',document.getElementById(\'hidden_number\').value);">'.utf8_to_html($lab).'</a> '; + $ret.='<a style="'.$style.'" href="#" onclick="document.getElementById(\'hidden_class\').value=\''.$tag.'\';show_results(\''.$tag.'\',document.getElementById(\'hidden_number\').value,\''.utf8_to_html($lab).'\');">'.utf8_to_html($lab).'</a> '; } $ret.="</p><br/>"; $ret.='<span id="FilterTags">You currently don\'t filter your search results.</span>'; - $ret.=' You can <a style="font-size:11px;" href="#" onclick="document.getElementById(\'hidden_class\').value=\'all\';show_results(\'all\',\'all\',document.getElementById(\'hidden_number\').value);">show all results</a> '; - if ($nc) $ret.=' or <a style="font-size:11px;" href="#" onclick="document.getElementById(\'hidden_class\').value=\'NoCategory\';show_results(\'NoCategory\',\'No Category\',document.getElementById(\'hidden_number\').value);">show results with no category</a> '; + $ret.=' You can <a style="font-size:11px;" href="#" onclick="document.getElementById(\'hidden_class\').value=\'all\';show_results(\'all\',document.getElementById(\'hidden_number\').value,\'all\');">show all results</a> '; + if ($nc) $ret.=' or <a style="font-size:11px;" href="#" onclick="document.getElementById(\'hidden_class\').value=\'NoCategory\';show_results(\'NoCategory\',document.getElementById(\'hidden_number\').value,\'No Category\');">show results with no category</a> '; $ret.='<br/><br/>'; return $ret; } Modified: trunk/src/dbpedia-navigator/js/navigator.js =================================================================== --- trunk/src/dbpedia-navigator/js/navigator.js 2008-10-27 14:39:05 UTC (rev 1449) +++ trunk/src/dbpedia-navigator/js/navigator.js 2008-10-27 14:47:51 UTC (rev 1450) @@ -23,7 +23,7 @@ } } -function show_results(class, label, number) +function show_results(class, number, label) { var links=document.getElementById('results').getElementsByTagName('p'); var j=0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-10-27 15:32:12
|
Revision: 1452 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1452&view=rev Author: sknappe Date: 2008-10-27 15:32:05 +0000 (Mon, 27 Oct 2008) Log Message: ----------- changes to use new ontology Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php trunk/src/dbpedia-navigator/ajax_learn_concepts.php Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-10-27 14:53:57 UTC (rev 1451) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-10-27 15:32:05 UTC (rev 1452) @@ -76,6 +76,7 @@ $algorithmID=$this->client->setLearningAlgorithm($this->id, "dbpediaNavigationSuggestor"); $this->client->applyConfigEntryBoolean($this->id, $algorithmID, "forceRefinementLengthIncrease", true); $this->client->applyConfigEntryBoolean($this->id, $algorithmID, "useHasValueConstructor", true); + $this->client->applyConfigEntryBoolean($this->id, $algorithmID, "useCardinalityRestrictions", false); $this->client->applyConfigEntryInt($this->id, $algorithmID, "valueFrequencyThreshold", 2); $this->client->applyConfigEntryInt($this->id, $algorithmID, "guaranteeXgoodDescriptions", 3); $this->client->applyConfigEntryInt($this->id, $algorithmID, "maxExecutionTimeInSeconds", 3); Modified: trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php 2008-10-27 14:53:57 UTC (rev 1451) +++ trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php 2008-10-27 15:32:05 UTC (rev 1452) @@ -32,12 +32,14 @@ $databaseConnection->connect($settings->database_server,$settings->database_user,$settings->database_pass); $databaseConnection->select_database($settings->database_name); - $test=preg_match("/^([\(]*\"http:\/\/dbpedia\.org\/class\/yago\/[^\040]+\"[\)]*(\040(AND|OR)\040)?)+$/",$kb); + if ($settings->classSystem=="YAGO") $test=preg_match("/^([\(]*\"http:\/\/dbpedia\.org\/class\/yago\/[^\040]+\"[\)]*(\040(AND|OR)\040)?)+$/",$kb); + else if ($settings->classSystem=="DBpedia") $test=preg_match("/^([\(]*\"http:\/\/dbpedia\.org\/ontology\/[^\040]+\"[\)]*(\040(AND|OR)\040)?)+$/",$kb); $content=""; if ($test){ - preg_match_all("/\"http:\/\/dbpedia\.org\/class\/yago\/[^\040()]+\"/",$kb,$treffer,PREG_OFFSET_CAPTURE); - + if ($settings->classSystem=="YAGO") preg_match_all("/\"http:\/\/dbpedia\.org\/class\/yago\/[^\040()]+\"/",$kb,$treffer,PREG_OFFSET_CAPTURE); + else if ($settings->classSystem=="DBpedia") preg_match_all("/\"http:\/\/dbpedia\.org\/ontology\/[^\040()]+\"/",$kb,$treffer,PREG_OFFSET_CAPTURE); + $final=''; $i=1; $pos=0; Modified: trunk/src/dbpedia-navigator/ajax_learn_concepts.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-10-27 14:53:57 UTC (rev 1451) +++ trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-10-27 15:32:05 UTC (rev 1452) @@ -41,16 +41,18 @@ $classes=array(); $noclass=array(); + if ($settings->classSystem=="YAGO") $rekursion=1; + else if ($settings->classSystem=="DBpedia") $rekursion=0; foreach ($all as $pos){ $newclasses=array(); $query="SELECT category FROM articlecategories WHERE name='$pos'"; $res=$databaseConnection->query($query); if (mysql_num_rows($res)<1) $noclass[]=$pos; while ($result=$databaseConnection->nextEntry($res)){ - $classes[$pos][]=$result['category']; - $newclasses[]=$result['category']; + if ($result['category']!="http://dbpedia.org/ontology/Resource") $classes[$pos][]=$result['category']; + if ($result['category']!="http://dbpedia.org/ontology/Resource") $newclasses[]=$result['category']; } - for ($i=0;$i<1;$i++){ + for ($i=0;$i<$rekursion;$i++){ $tempclasses=array(); foreach ($newclasses as $clas){ $query="SELECT father FROM classhierarchy WHERE child='$clas'"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-10-27 15:37:30
|
Revision: 1453 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1453&view=rev Author: jenslehmann Date: 2008-10-27 15:37:25 +0000 (Mon, 27 Oct 2008) Log Message: ----------- included default template Modified Paths: -------------- trunk/src/dbpedia-navigator/ajax_get_article.php trunk/src/dbpedia-navigator/templates/AbstractTemplate.php trunk/src/dbpedia-navigator/templates/CityTemplate.php trunk/src/dbpedia-navigator/templates/DefaultTemplate.php trunk/src/dbpedia-navigator/templates/PersonTemplate.php trunk/src/dbpedia-navigator/templates/PlaceTemplate.php trunk/src/dbpedia-navigator/templates/PopulatedPlaceTemplate.php Property Changed: ---------------- trunk/src/dbpedia-navigator/ Property changes on: trunk/src/dbpedia-navigator ___________________________________________________________________ Modified: svn:ignore - temp .htaccess main.wsdl def0.xsd def1.xsd test.html test.php settings.ini + temp .htaccess main.wsdl def0.xsd def1.xsd test.html test.php settings.ini Settings.php Modified: trunk/src/dbpedia-navigator/ajax_get_article.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_article.php 2008-10-27 15:32:05 UTC (rev 1452) +++ trunk/src/dbpedia-navigator/ajax_get_article.php 2008-10-27 15:37:25 UTC (rev 1453) @@ -1,6 +1,13 @@ <?php - include('helper_functions.php'); - include_once('Settings.php'); + include_once('helper_functions.php'); + include_once('Settings.php'); + // include all templates + include_once('templates/AbstractTemplate.php'); + include_once('templates/CityTemplate.php'); + include_once('templates/DefaultTemplate.php'); + include_once('templates/PersonTemplate.php'); + include_once('templates/PlaceTemplate.php'); + include_once('templates/PopulatedPlaceTemplate.php'); session_start(); @@ -106,6 +113,14 @@ if (isset($triples['http://dbpedia.org/property/hasPhotoCollection'])){ $content.=', <img src="images/flickr.png" alt="Flickr" style="max-width:20px;" /> <a href="'.$triples['http://dbpedia.org/property/hasPhotoCollection'][0]['value'].'" onclick="window.open(\''.$triples['http://dbpedia.org/property/hasPhotoCollection'][0]['value'].'\',\'Wikiwindow\',\'width=800,height=500,top=50,left=50,scrollbars=yes\');return false;">view photo collection</a></p>'; } + + $content .= '<br/><hr><h4>Further Information</h4><br/>'; + // detect appropriate template (currently always default) + $template = new DefaultTemplate(); + + // display template for this instance (currently the template is similar to the remaining + // instance view apart from beautifications) + $content .= $template->printTemplate($triples); //display owl:sameAs properties if (isset($triples['http://www.w3.org/2002/07/owl#sameAs'])||isset($subjecttriples['http://www.w3.org/2002/07/owl#sameAs'])){ Modified: trunk/src/dbpedia-navigator/templates/AbstractTemplate.php =================================================================== --- trunk/src/dbpedia-navigator/templates/AbstractTemplate.php 2008-10-27 15:32:05 UTC (rev 1452) +++ trunk/src/dbpedia-navigator/templates/AbstractTemplate.php 2008-10-27 15:37:25 UTC (rev 1453) @@ -28,7 +28,7 @@ * * @author Jens Lehmann */ -class AbstractTemplate { +abstract class AbstractTemplate { abstract function printTemplate($triples); @@ -44,7 +44,7 @@ else $backgroundcolor="ffffff"; - $table .= '<tr style="background-color:#'.$backgroundcolor.';"><td><a href="'.$predicate.'" target="_blank">'.nicePredicate($predicate).'</a></td>'; + $table = '<tr style="background-color:#'.$backgroundcolor.';"><td><a href="'.$predicate.'" target="_blank">'.nicePredicate($predicate).'</a></td>'; $table .= '<td>'; if ($number>1) $table.='<ul>'; $k=1; Modified: trunk/src/dbpedia-navigator/templates/CityTemplate.php =================================================================== --- trunk/src/dbpedia-navigator/templates/CityTemplate.php 2008-10-27 15:32:05 UTC (rev 1452) +++ trunk/src/dbpedia-navigator/templates/CityTemplate.php 2008-10-27 15:37:25 UTC (rev 1453) @@ -19,6 +19,8 @@ * */ +include_once('PopulatedPlaceTemplate.php'); + /** * Template for cities. * @@ -26,17 +28,17 @@ */ class CityTemplate extends PopulatedPlaceTemplate { - function getTemplate($triples) { + function printTemplate($triples) { $content = ""; $content .= '<table>'; $content .= '<tr><td colspan="2">City Information</td></tr>'; // population - $content .= '<tr><td>total population</td><td>' + getPopulationString($triples) + '</td></tr>'; + $content .= '<tr><td>total population</td><td>' + $this->getPopulationString($triples) + '</td></tr>'; // location - $content .= '<tr><td>latitude</td><td>' + getLatitudeString($triples) + '</td></tr>'; - $content .= '<tr><td>longitude</td><td>' + getLongitudeString($triples) + '</td></tr>'; + $content .= '<tr><td>latitude</td><td>' + $this->getLatitudeString($triples) + '</td></tr>'; + $content .= '<tr><td>longitude</td><td>' + $this->getLongitudeString($triples) + '</td></tr>'; // resources related to city - $content .= displayMultipleValues('city'); + // $content .= displayMultipleValues('city'); $content .= '</table>'; // .. continue ... Modified: trunk/src/dbpedia-navigator/templates/DefaultTemplate.php =================================================================== --- trunk/src/dbpedia-navigator/templates/DefaultTemplate.php 2008-10-27 15:32:05 UTC (rev 1452) +++ trunk/src/dbpedia-navigator/templates/DefaultTemplate.php 2008-10-27 15:37:25 UTC (rev 1453) @@ -27,9 +27,11 @@ */ class DefaultTemplate extends AbstractTemplate { - // simply prints all triples without doing anything special + // simply prints all triples without doing anything special to group/format them function printTemplate($triples) { - return printRemainingTriples($triples); + $content = '<table>'; + $content .= $this->printRemainingTriples($triples); + return $content; } } Modified: trunk/src/dbpedia-navigator/templates/PersonTemplate.php =================================================================== --- trunk/src/dbpedia-navigator/templates/PersonTemplate.php 2008-10-27 15:32:05 UTC (rev 1452) +++ trunk/src/dbpedia-navigator/templates/PersonTemplate.php 2008-10-27 15:37:25 UTC (rev 1453) @@ -27,7 +27,7 @@ function printTemplate($triples) { $content = ""; - $content .= printRemainingTriples($triples); + $content .= $this->printRemainingTriples($triples); return $content; } Modified: trunk/src/dbpedia-navigator/templates/PlaceTemplate.php =================================================================== --- trunk/src/dbpedia-navigator/templates/PlaceTemplate.php 2008-10-27 15:32:05 UTC (rev 1452) +++ trunk/src/dbpedia-navigator/templates/PlaceTemplate.php 2008-10-27 15:37:25 UTC (rev 1453) @@ -31,7 +31,7 @@ abstract class PlaceTemplate extends AbstractTemplate { // returns a latitude string of the form 49°1′0″N or "unknown" - public getLatitudeString($triples) { + public function getLatitudeString($triples) { if(!areDBpediaPropertiesSet(array('latitudedegrees','latitudeminutes','latitudeseconds'))) { return "unknown"; } @@ -43,7 +43,7 @@ } // returns a latitude string of the form 49°1′0″E or "unknown" - public getLongitudeString($triples) { + public function getLongitudeString($triples) { if(!areDBpediaPropertiesSet(array('longitudedegrees','longitudeminutes','longitudeseconds'))) { return "unknown"; } Modified: trunk/src/dbpedia-navigator/templates/PopulatedPlaceTemplate.php =================================================================== --- trunk/src/dbpedia-navigator/templates/PopulatedPlaceTemplate.php 2008-10-27 15:32:05 UTC (rev 1452) +++ trunk/src/dbpedia-navigator/templates/PopulatedPlaceTemplate.php 2008-10-27 15:37:25 UTC (rev 1453) @@ -19,15 +19,18 @@ * */ +include_once('PlaceTemplate.php'); + /** * Template for all populated places. */ abstract class PopulatedPlaceTemplate extends PlaceTemplate { // return a nicely formatted string for the population of the place - public getPopulationString() { - $number = number_format(extractPropValue('populationTotal')); - $asOf = extractPropValue('populationAsOf'); + function getPopulationString() { + $population = $this->extractPropValue($triples, 'populationTotal'); + $number = number_format($population); + $asOf = $this->extractPropValue('populationAsOf'); return $number + ' (as of ' + $asOf + ')'; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-10-27 16:01:48
|
Revision: 1454 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1454&view=rev Author: sknappe Date: 2008-10-27 16:01:36 +0000 (Mon, 27 Oct 2008) Log Message: ----------- bugfix Modified Paths: -------------- trunk/src/dbpedia-navigator/ajax_get_article.php trunk/src/dbpedia-navigator/templates/AbstractTemplate.php Modified: trunk/src/dbpedia-navigator/ajax_get_article.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_article.php 2008-10-27 15:37:25 UTC (rev 1453) +++ trunk/src/dbpedia-navigator/ajax_get_article.php 2008-10-27 16:01:36 UTC (rev 1454) @@ -63,7 +63,9 @@ require_once("DLLearnerConnection.php"); $sc=new DLLearnerConnection($id,$ksID); $alltriples=$sc->getTriples($uri); + // triples where resource is subject $triples=$alltriples[0]; + // triples where resource is object $subjecttriples=$alltriples[1]; //BUILD ARTICLE Modified: trunk/src/dbpedia-navigator/templates/AbstractTemplate.php =================================================================== --- trunk/src/dbpedia-navigator/templates/AbstractTemplate.php 2008-10-27 15:37:25 UTC (rev 1453) +++ trunk/src/dbpedia-navigator/templates/AbstractTemplate.php 2008-10-27 16:01:36 UTC (rev 1454) @@ -44,7 +44,7 @@ else $backgroundcolor="ffffff"; - $table = '<tr style="background-color:#'.$backgroundcolor.';"><td><a href="'.$predicate.'" target="_blank">'.nicePredicate($predicate).'</a></td>'; + $table .= '<tr style="background-color:#'.$backgroundcolor.';"><td><a href="'.$predicate.'" target="_blank">'.nicePredicate($predicate).'</a></td>'; $table .= '<td>'; if ($number>1) $table.='<ul>'; $k=1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-10-27 16:43:10
|
Revision: 1455 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1455&view=rev Author: sknappe Date: 2008-10-27 16:42:58 +0000 (Mon, 27 Oct 2008) Log Message: ----------- changes to use new ontology Modified Paths: -------------- trunk/src/dbpedia-navigator/ajax_get_article.php trunk/src/dbpedia-navigator/templates/AbstractTemplate.php trunk/src/dbpedia-navigator/templates/DefaultTemplate.php Modified: trunk/src/dbpedia-navigator/ajax_get_article.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_article.php 2008-10-27 16:01:36 UTC (rev 1454) +++ trunk/src/dbpedia-navigator/ajax_get_article.php 2008-10-27 16:42:58 UTC (rev 1455) @@ -120,10 +120,6 @@ // detect appropriate template (currently always default) $template = new DefaultTemplate(); - // display template for this instance (currently the template is similar to the remaining - // instance view apart from beautifications) - $content .= $template->printTemplate($triples); - //display owl:sameAs properties if (isset($triples['http://www.w3.org/2002/07/owl#sameAs'])||isset($subjecttriples['http://www.w3.org/2002/07/owl#sameAs'])){ $content.='<br/><hr><h4>Same as</h4><br/>'; @@ -272,13 +268,15 @@ // have already been displayed filterTriples(&$triples, &$subjecttriples); - - if (count($triples)>0||count($subjecttriples)>0){ + // display template for this instance (currently the template is similar to the remaining + // instance view apart from beautifications) + $content .= $template->printTemplate($triples,$subjecttriples); + /*if (count($triples)>0||count($subjecttriples)>0){ $content.='<br/><hr><h4>Remaining Triples</h4><br/>'; // display the remaining properties as list which can be used for further navigation $content .= get_triple_table($triples,$subjecttriples); - } + }*/ //Restart the Session session_start(); Modified: trunk/src/dbpedia-navigator/templates/AbstractTemplate.php =================================================================== --- trunk/src/dbpedia-navigator/templates/AbstractTemplate.php 2008-10-27 16:01:36 UTC (rev 1454) +++ trunk/src/dbpedia-navigator/templates/AbstractTemplate.php 2008-10-27 16:42:58 UTC (rev 1455) @@ -34,59 +34,91 @@ // function to be called after all "special" actions have been taken; // it displays all remaining triples - function printRemainingTriples($triples) { - $i=1; - if (is_array($triples) && count($triples)>0) { - foreach($triples as $predicate=>$object) { - $number=count($object); - if ($i>0) - $backgroundcolor="eee"; - else - $backgroundcolor="ffffff"; - - $table .= '<tr style="background-color:#'.$backgroundcolor.';"><td><a href="'.$predicate.'" target="_blank">'.nicePredicate($predicate).'</a></td>'; - $table .= '<td>'; - if ($number>1) $table.='<ul>'; - $k=1; - foreach($object as $element) { - if ($k>3) $display=" style=\"display:none\""; - else $display=""; - if ($element['type']=="uri") { - if (strpos($element['value'],"http://dbpedia.org/resource/")===0&&substr_count($element['value'],"/")==4&&strpos($element['value'],"Template:")!=28){ - $label=str_replace('_',' ',substr($element['value'],28)); - if (strlen($label)>60) - $label=substr($label,0,60).'...'; - if ($number>1) - $table.='<li'.$display.'>'; - $table .= '<a href="#" onclick="get_article(\'label='.$element['value'].'&cache=-1\');">'.urldecode($label).'</a>'; - if ($number>1) - $table.='</li>'; - } else { - if ($number>1) - $table.='<li'.$display.'>'; - $label=urldecode($element['value']); - if (strlen($label)>60) - $label=substr($label,0,60).'...'; - $table .= '<a href="'.$element['value'].'" target="_blank">'.$label.'</a>'; - if ($number>1) - $table.='</li>'; - } - } else { - if ($number>1) - $table.='<li'.$display.'>'; - $table .= $element['value']; - if ($number>1) - $table.='</li>'; - } - $k++; - } - if ($number>3) $table.='<a href="javascript:none()" onclick="toggleAttributes(this)"><img src="images/arrow_down.gif"/> show</a>'; - if ($number>1) $table.='</ul>'; - $table .= '</td>'; - $i*=-1; - } - } - $table .= '</table>'; + function printRemainingTriples($triples,$subjecttriples) { + if ((is_array($triples)&&count($triples)>0)||(is_array($subjecttriples)&&count($subjecttriples)>0)){ + $table = '<table border="0" style="width:100%;overflow:hidden"><tr><td><b>Predicate</b></td><td><b>Object/Subject</b></td></tr>'; + $i=1; + if (is_array($triples)&&count($triples)>0) foreach($triples as $predicate=>$object) { + $number=count($object); + if ($i>0) $backgroundcolor="eee"; + else $backgroundcolor="ffffff"; + $table .= '<tr style="background-color:#'.$backgroundcolor.';"><td><a href="'.$predicate.'" target="_blank">'.nicePredicate($predicate).'</a></td>'; + $table .= '<td>'; + if ($number>1) $table.='<ul>'; + $k=1; + foreach($object as $element) { + if ($k>3) $display=" style=\"display:none\""; + else $display=""; + if ($element['type']=="uri"){ + if (strpos($element['value'],"http://dbpedia.org/resource/")===0&&substr_count($element['value'],"/")==4&&strpos($element['value'],"Template:")!=28){ + $label=str_replace('_',' ',substr($element['value'],28)); + if (strlen($label)>60) $label=substr($label,0,60).'...'; + if ($number>1) $table.='<li'.$display.'>'; + $table .= '<a href="#" onclick="get_article(\'label='.$element['value'].'&cache=-1\');">'.urldecode($label).'</a>'; + if ($number>1) $table.='</li>'; + } + else{ + if ($number>1) $table.='<li'.$display.'>'; + $label=urldecode($element['value']); + if (strlen($label)>60) $label=substr($label,0,60).'...'; + $table .= '<a href="'.$element['value'].'" target="_blank">'.$label.'</a>'; + if ($number>1) $table.='</li>'; + } + } + else{ + if ($number>1) $table.='<li'.$display.'>'; + $table .= $element['value']; + if ($number>1) $table.='</li>'; + } + $k++; + } + if ($number>3) $table.='<a href="javascript:none()" onclick="toggleAttributes(this)"><img src="images/arrow_down.gif"/> show</a>'; + if ($number>1) $table.='</ul>'; + $table .= '</td>'; + $i*=-1; + } + if (is_array($subjecttriples)&&count($subjecttriples)>0) foreach($subjecttriples as $predicate=>$object) { + $number=count($object); + if ($i>0) $backgroundcolor="eee"; + else $backgroundcolor="ffffff"; + $table .= '<tr style="background-color:#'.$backgroundcolor.';"><td><a href="'.$predicate.'" target="_blank">is '.nicePredicate($predicate).' of </a></td>'; + $table .= '<td>'; + if ($number>1) $table.='<ul>'; + $k=1; + foreach($object as $element) { + if ($k>3) $display=" style=\"display:none\""; + else $display=""; + if ($element['type']=="uri"){ + if (strpos($element['value'],"http://dbpedia.org/resource/")===0&&substr_count($element['value'],"/")==4&&strpos($element['value'],"Template:")!=28){ + $label=str_replace('_',' ',substr($element['value'],28)); + if (strlen($label)>60) $label=substr($label,0,60).'...'; + if ($number>1) $table.='<li'.$display.'>'; + $table .= '<a href="#" onclick="get_article(\'label='.$element['value'].'&cache=-1\');">'.urldecode($label).'</a>'; + if ($number>1) $table.='</li>'; + } + else{ + if ($number>1) $table.='<li'.$display.'>'; + $label=urldecode($element['value']); + if (strlen($label)>60) $label=substr($label,0,60).'...'; + $table .= '<a href="'.$element['value'].'" target="_blank">'.$label.'</a>'; + if ($number>1) $table.='</li>'; + } + } + else{ + if ($number>1) $table.='<li'.$display.'>'; + $table .= $element['value']; + if ($number>1) $table.='</li>'; + } + $k++; + } + if ($number>3) $table.='<a href="javascript:none()" onclick="toggleAttributes(this)"><img src="images/arrow_down.gif"/> show</a>'; + if ($number>1) $table.='</ul>'; + $table .= '</td>'; + $i*=-1; + } + $table .= '</table>'; + } + else $table="No Tripel left."; return $table; } Modified: trunk/src/dbpedia-navigator/templates/DefaultTemplate.php =================================================================== --- trunk/src/dbpedia-navigator/templates/DefaultTemplate.php 2008-10-27 16:01:36 UTC (rev 1454) +++ trunk/src/dbpedia-navigator/templates/DefaultTemplate.php 2008-10-27 16:42:58 UTC (rev 1455) @@ -28,9 +28,8 @@ class DefaultTemplate extends AbstractTemplate { // simply prints all triples without doing anything special to group/format them - function printTemplate($triples) { - $content = '<table>'; - $content .= $this->printRemainingTriples($triples); + function printTemplate($triples,$subjecttriples) { + $content = $this->printRemainingTriples($triples,$subjecttriples); return $content; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-10-28 08:58:25
|
Revision: 1463 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1463&view=rev Author: sknappe Date: 2008-10-28 08:53:58 +0000 (Tue, 28 Oct 2008) Log Message: ----------- changes to use new ontology Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/main.wsdl Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-10-28 07:16:14 UTC (rev 1462) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-10-28 08:53:58 UTC (rev 1463) @@ -61,7 +61,9 @@ $this->client->applyConfigEntryString($this->id, $this->ksID, "predefinedManipulator", "DBPEDIA-NAVIGATOR"); $this->client->applyConfigEntryBoolean($this->id, $this->ksID, "useCache", true); if(empty($negExamples)){ - $negExamples=$this->client->getNegativeExamples($this->id,$this->ksID,$posExamples,count($posExamples),"http://dbpedia.org/resource/"); + if ($settings->classSystem=="YAGO") $filterClasses=array("http://xmlns.com/foaf/","http://dbpedia.org/ontology/"); + else if ($settings->classSystem=="DBpedia") $filterClasses=array("http://xmlns.com/foaf/","http://dbpedia.org/class/yago/"); + $negExamples=$this->client->getNegativeExamples($this->id,$this->ksID,$posExamples,count($posExamples),"http://dbpedia.org/resource/",$filterClasses); $negExamples=$negExamples->item; } $this->client->applyConfigEntryStringArray($this->id, $this->ksID, "instances", array_merge($posExamples,$negExamples)); Modified: trunk/src/dbpedia-navigator/main.wsdl =================================================================== --- trunk/src/dbpedia-navigator/main.wsdl 2008-10-28 07:16:14 UTC (rev 1462) +++ trunk/src/dbpedia-navigator/main.wsdl 2008-10-28 08:53:58 UTC (rev 1463) @@ -7,6 +7,28 @@ <xsd:import schemaLocation="def1.xsd" namespace="http://jaxb.dev.java.net/array"></xsd:import> </xsd:schema> </types> + <message name="init"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + </message> + <message name="initResponse"></message> + <message name="ClientNotKnownException"> + <part element="tns:ClientNotKnownException" name="fault"></part> + </message> + <message name="UnknownComponentException"> + <part element="tns:UnknownComponentException" name="fault"></part> + </message> + <message name="ComponentInitException"> + <part element="tns:ComponentInitException" name="fault"></part> + </message> + <message name="debug"> + <part name="arg0" type="xsd:string"></part> + </message> + <message name="debugResponse"></message> + <message name="stop"> + <part name="arg0" type="xsd:int"></part> + </message> + <message name="stopResponse"></message> <message name="getBuild"></message> <message name="getBuildResponse"> <part name="return" type="xsd:string"></part> @@ -15,32 +37,33 @@ <message name="generateIDResponse"> <part name="return" type="xsd:int"></part> </message> + <message name="getComponents"></message> + <message name="getComponentsResponse"> + <part xmlns:ns1="http://jaxb.dev.java.net/array" name="return" type="ns1:stringArray"></part> + </message> <message name="getKnowledgeSources"></message> <message name="getKnowledgeSourcesResponse"> - <part xmlns:ns1="http://jaxb.dev.java.net/array" name="return" type="ns1:stringArray"></part> + <part xmlns:ns2="http://jaxb.dev.java.net/array" name="return" type="ns2:stringArray"></part> </message> <message name="getReasoners"></message> <message name="getReasonersResponse"> - <part xmlns:ns2="http://jaxb.dev.java.net/array" name="return" type="ns2:stringArray"></part> + <part xmlns:ns3="http://jaxb.dev.java.net/array" name="return" type="ns3:stringArray"></part> </message> <message name="getLearningProblems"></message> <message name="getLearningProblemsResponse"> - <part xmlns:ns3="http://jaxb.dev.java.net/array" name="return" type="ns3:stringArray"></part> + <part xmlns:ns4="http://jaxb.dev.java.net/array" name="return" type="ns4:stringArray"></part> </message> <message name="getLearningAlgorithms"></message> <message name="getLearningAlgorithmsResponse"> - <part xmlns:ns4="http://jaxb.dev.java.net/array" name="return" type="ns4:stringArray"></part> + <part xmlns:ns5="http://jaxb.dev.java.net/array" name="return" type="ns5:stringArray"></part> </message> <message name="getConfigOptions"> <part name="arg0" type="xsd:string"></part> <part name="arg1" type="xsd:boolean"></part> </message> <message name="getConfigOptionsResponse"> - <part xmlns:ns5="http://jaxb.dev.java.net/array" name="return" type="ns5:stringArray"></part> + <part xmlns:ns6="http://jaxb.dev.java.net/array" name="return" type="ns6:stringArray"></part> </message> - <message name="UnknownComponentException"> - <part element="tns:UnknownComponentException" name="fault"></part> - </message> <message name="addKnowledgeSource"> <part name="arg0" type="xsd:int"></part> <part name="arg1" type="xsd:string"></part> @@ -49,9 +72,6 @@ <message name="addKnowledgeSourceResponse"> <part name="return" type="xsd:int"></part> </message> - <message name="ClientNotKnownException"> - <part element="tns:ClientNotKnownException" name="fault"></part> - </message> <message name="MalformedURLException"> <part element="tns:MalformedURLException" name="fault"></part> </message> @@ -88,9 +108,6 @@ <part name="arg0" type="xsd:int"></part> </message> <message name="initAllResponse"></message> - <message name="ComponentInitException"> - <part element="tns:ComponentInitException" name="fault"></part> - </message> <message name="learn"> <part name="arg0" type="xsd:int"></part> <part name="arg1" type="xsd:string"></part> @@ -128,7 +145,7 @@ <part name="arg2" type="xsd:string"></part> </message> <message name="getCurrentlyBestConceptsResponse"> - <part xmlns:ns6="http://jaxb.dev.java.net/array" name="return" type="ns6:stringArray"></part> + <part xmlns:ns7="http://jaxb.dev.java.net/array" name="return" type="ns7:stringArray"></part> </message> <message name="getCurrentlyBestEvaluatedDescriptionsFiltered"> <part name="arg0" type="xsd:int"></part> @@ -147,12 +164,12 @@ </message> <message name="setPositiveExamples"> <part name="arg0" type="xsd:int"></part> - <part xmlns:ns7="http://jaxb.dev.java.net/array" name="arg1" type="ns7:stringArray"></part> + <part xmlns:ns8="http://jaxb.dev.java.net/array" name="arg1" type="ns8:stringArray"></part> </message> <message name="setPositiveExamplesResponse"></message> <message name="setNegativeExamples"> <part name="arg0" type="xsd:int"></part> - <part xmlns:ns8="http://jaxb.dev.java.net/array" name="arg1" type="ns8:stringArray"></part> + <part xmlns:ns9="http://jaxb.dev.java.net/array" name="arg1" type="ns9:stringArray"></part> </message> <message name="setNegativeExamplesResponse"></message> <message name="applyConfigEntryInt"> @@ -180,7 +197,7 @@ <part name="arg0" type="xsd:int"></part> <part name="arg1" type="xsd:int"></part> <part name="arg2" type="xsd:string"></part> - <part xmlns:ns9="http://jaxb.dev.java.net/array" name="arg3" type="ns9:stringArray"></part> + <part xmlns:ns10="http://jaxb.dev.java.net/array" name="arg3" type="ns10:stringArray"></part> </message> <message name="applyConfigEntryStringArrayResponse"></message> <message name="applyConfigEntryBoolean"> @@ -196,7 +213,7 @@ <part name="arg2" type="xsd:string"></part> </message> <message name="getConfigOptionValueStringArrayResponse"> - <part xmlns:ns10="http://jaxb.dev.java.net/array" name="return" type="ns10:stringArray"></part> + <part xmlns:ns11="http://jaxb.dev.java.net/array" name="return" type="ns11:stringArray"></part> </message> <message name="ConfigOptionTypeException"> <part element="tns:ConfigOptionTypeException" name="fault"></part> @@ -245,7 +262,7 @@ <part name="arg0" type="xsd:int"></part> </message> <message name="getAtomicConceptsResponse"> - <part xmlns:ns11="http://jaxb.dev.java.net/array" name="return" type="ns11:stringArray"></part> + <part xmlns:ns12="http://jaxb.dev.java.net/array" name="return" type="ns12:stringArray"></part> </message> <message name="getSubsumptionHierarchy"> <part name="arg0" type="xsd:int"></part> @@ -258,7 +275,7 @@ <part name="arg1" type="xsd:string"></part> </message> <message name="retrievalResponse"> - <part xmlns:ns12="http://jaxb.dev.java.net/array" name="return" type="ns12:stringArray"></part> + <part xmlns:ns13="http://jaxb.dev.java.net/array" name="return" type="ns13:stringArray"></part> </message> <message name="ParseException"> <part element="tns:ParseException" name="fault"></part> @@ -273,20 +290,20 @@ <part name="arg0" type="xsd:int"></part> </message> <message name="getAtomicRolesResponse"> - <part xmlns:ns13="http://jaxb.dev.java.net/array" name="return" type="ns13:stringArray"></part> + <part xmlns:ns14="http://jaxb.dev.java.net/array" name="return" type="ns14:stringArray"></part> </message> <message name="getInstances"> <part name="arg0" type="xsd:int"></part> </message> <message name="getInstancesResponse"> - <part xmlns:ns14="http://jaxb.dev.java.net/array" name="return" type="ns14:stringArray"></part> + <part xmlns:ns15="http://jaxb.dev.java.net/array" name="return" type="ns15:stringArray"></part> </message> <message name="getIndividualsForARole"> <part name="arg0" type="xsd:int"></part> <part name="arg1" type="xsd:string"></part> </message> <message name="getIndividualsForARoleResponse"> - <part xmlns:ns15="http://jaxb.dev.java.net/array" name="return" type="ns15:stringArray"></part> + <part xmlns:ns16="http://jaxb.dev.java.net/array" name="return" type="ns16:stringArray"></part> </message> <message name="getAsJSON"> <part name="arg0" type="xsd:int"></part> @@ -338,14 +355,14 @@ <part name="arg1" type="xsd:int"></part> </message> <message name="getConceptDepthResponse"> - <part xmlns:ns16="http://jaxb.dev.java.net/array" name="return" type="ns16:intArray"></part> + <part xmlns:ns17="http://jaxb.dev.java.net/array" name="return" type="ns17:intArray"></part> </message> <message name="getConceptArity"> <part name="arg0" type="xsd:int"></part> <part name="arg1" type="xsd:int"></part> </message> <message name="getConceptArityResponse"> - <part xmlns:ns17="http://jaxb.dev.java.net/array" name="return" type="ns17:intArray"></part> + <part xmlns:ns18="http://jaxb.dev.java.net/array" name="return" type="ns18:intArray"></part> </message> <message name="SparqlRetrieval"> <part name="arg0" type="xsd:string"></part> @@ -365,31 +382,31 @@ <message name="getNegativeExamples"> <part name="arg0" type="xsd:int"></part> <part name="arg1" type="xsd:int"></part> - <part xmlns:ns18="http://jaxb.dev.java.net/array" name="arg2" type="ns18:stringArray"></part> + <part xmlns:ns19="http://jaxb.dev.java.net/array" name="arg2" type="ns19:stringArray"></part> <part name="arg3" type="xsd:int"></part> <part name="arg4" type="xsd:string"></part> + <part xmlns:ns20="http://jaxb.dev.java.net/array" name="arg5" type="ns20:stringArray"></part> </message> <message name="getNegativeExamplesResponse"> - <part xmlns:ns19="http://jaxb.dev.java.net/array" name="return" type="ns19:stringArray"></part> + <part xmlns:ns21="http://jaxb.dev.java.net/array" name="return" type="ns21:stringArray"></part> </message> - <message name="init"> - <part name="arg0" type="xsd:int"></part> - <part name="arg1" type="xsd:int"></part> - </message> - <message name="initResponse"></message> - <message name="debug"> - <part name="arg0" type="xsd:string"></part> - </message> - <message name="debugResponse"></message> - <message name="stop"> - <part name="arg0" type="xsd:int"></part> - </message> - <message name="stopResponse"></message> - <message name="getComponents"></message> - <message name="getComponentsResponse"> - <part xmlns:ns20="http://jaxb.dev.java.net/array" name="return" type="ns20:stringArray"></part> - </message> <portType name="DLLearnerWebService"> + <operation name="init" parameterOrder="arg0 arg1"> + <input message="tns:init"></input> + <output message="tns:initResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + <fault message="tns:ComponentInitException" name="ComponentInitException"></fault> + </operation> + <operation name="debug" parameterOrder="arg0"> + <input message="tns:debug"></input> + <output message="tns:debugResponse"></output> + </operation> + <operation name="stop" parameterOrder="arg0"> + <input message="tns:stop"></input> + <output message="tns:stopResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> <operation name="getBuild" parameterOrder=""> <input message="tns:getBuild"></input> <output message="tns:getBuildResponse"></output> @@ -398,6 +415,10 @@ <input message="tns:generateID"></input> <output message="tns:generateIDResponse"></output> </operation> + <operation name="getComponents" parameterOrder=""> + <input message="tns:getComponents"></input> + <output message="tns:getComponentsResponse"></output> + </operation> <operation name="getKnowledgeSources" parameterOrder=""> <input message="tns:getKnowledgeSources"></input> <output message="tns:getKnowledgeSourcesResponse"></output> @@ -668,34 +689,53 @@ <fault message="tns:ParseException" name="ParseException"></fault> <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> </operation> - <operation name="getNegativeExamples" parameterOrder="arg0 arg1 arg2 arg3 arg4"> + <operation name="getNegativeExamples" parameterOrder="arg0 arg1 arg2 arg3 arg4 arg5"> <input message="tns:getNegativeExamples"></input> <output message="tns:getNegativeExamplesResponse"></output> <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> </operation> - <operation name="init" parameterOrder="arg0 arg1"> - <input message="tns:init"></input> - <output message="tns:initResponse"></output> - <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> - <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> - <fault message="tns:ComponentInitException" name="ComponentInitException"></fault> + </portType> + <binding name="DLLearnerWebServicePortBinding" type="tns:DLLearnerWebService"> + <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"></soap:binding> + <operation name="init"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + <fault name="ComponentInitException"> + <soap:fault name="ComponentInitException" use="literal"></soap:fault> + </fault> </operation> - <operation name="debug" parameterOrder="arg0"> - <input message="tns:debug"></input> - <output message="tns:debugResponse"></output> + <operation name="debug"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> </operation> - <operation name="stop" parameterOrder="arg0"> - <input message="tns:stop"></input> - <output message="tns:stopResponse"></output> - <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <operation name="stop"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> </operation> - <operation name="getComponents" parameterOrder=""> - <input message="tns:getComponents"></input> - <output message="tns:getComponentsResponse"></output> - </operation> - </portType> - <binding name="DLLearnerWebServicePortBinding" type="tns:DLLearnerWebService"> - <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"></soap:binding> <operation name="getBuild"> <soap:operation soapAction=""></soap:operation> <input> @@ -714,6 +754,15 @@ <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> </output> </operation> + <operation name="getComponents"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + </operation> <operation name="getKnowledgeSources"> <soap:operation soapAction=""></soap:operation> <input> @@ -1389,54 +1438,6 @@ <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> </fault> </operation> - <operation name="init"> - <soap:operation soapAction=""></soap:operation> - <input> - <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> - </input> - <output> - <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> - </output> - <fault name="ClientNotKnownException"> - <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> - </fault> - <fault name="UnknownComponentException"> - <soap:fault name="UnknownComponentException" use="literal"></soap:fault> - </fault> - <fault name="ComponentInitException"> - <soap:fault name="ComponentInitException" use="literal"></soap:fault> - </fault> - </operation> - <operation name="debug"> - <soap:operation soapAction=""></soap:operation> - <input> - <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> - </input> - <output> - <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> - </output> - </operation> - <operation name="stop"> - <soap:operation soapAction=""></soap:operation> - <input> - <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> - </input> - <output> - <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> - </output> - <fault name="ClientNotKnownException"> - <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> - </fault> - </operation> - <operation name="getComponents"> - <soap:operation soapAction=""></soap:operation> - <input> - <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> - </input> - <output> - <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> - </output> - </operation> </binding> <service name="DLLearnerWSService"> <port name="DLLearnerWebServicePort" binding="tns:DLLearnerWebServicePortBinding"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-10-28 13:24:44
|
Revision: 1483 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1483&view=rev Author: sknappe Date: 2008-10-28 13:23:50 +0000 (Tue, 28 Oct 2008) Log Message: ----------- bugfix Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/ajax_get_article.php Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-10-28 12:54:36 UTC (rev 1482) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-10-28 13:23:50 UTC (rev 1483) @@ -182,11 +182,11 @@ } } //geonames - if (strlen($geonames)>0){ - $query="SELECT * WHERE {<".$geonames."> <http://www.geonames.org/ontology#parent> ?parent.<".$geonames."> <http://www.geonames.org/ontology#children> ?children.<".$geonames."> <http://www.geonames.org/ontology#neighbours> ?neighbours.}"; + /*if (strlen($geonames)>0){ + $query="SELECT * WHERE {<".$geonames."> <http://www.geonames.org/ontology#parentFeature> ?parent.<".$geonames."> <http://www.geonames.org/ontology#children> ?children.<".$geonames."> <http://www.geonames.org/ontology#nearbyFeatures> ?neighbours.}"; $result=json_decode($this->client->sparqlQueryPredefinedEndpoint("LOCALGEONAMES", $query, true),true); var_dump($result); - } + }*/ return $ret; } Modified: trunk/src/dbpedia-navigator/ajax_get_article.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_article.php 2008-10-28 12:54:36 UTC (rev 1482) +++ trunk/src/dbpedia-navigator/ajax_get_article.php 2008-10-28 13:23:50 UTC (rev 1483) @@ -264,7 +264,7 @@ $template=""; // detect appropriate template (currently always default) - foreach ($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type'] as $classes){ + if (isset($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type'])) foreach ($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type'] as $classes){ if($class['value'] == 'http://dbpedia.org/ontology/City') { $template = new CityTemplate(); } else if($class['value'] == 'http://dbpedia.org/ontology/Person') { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-10-28 13:35:51
|
Revision: 1479 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1479&view=rev Author: sknappe Date: 2008-10-28 12:37:41 +0000 (Tue, 28 Oct 2008) Log Message: ----------- bugfix Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/main.wsdl Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-10-28 12:27:13 UTC (rev 1478) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-10-28 12:37:41 UTC (rev 1479) @@ -180,7 +180,7 @@ } //geonames $query="SELECT ?obj WHERE {?s <http://www.w3.org/2002/07/owl#sameAs> <".$uri.">.?s ?p ?obj}"; - $result=json_decode($this->client->sparqlQueryPredefinedEndpoint("LOCALGEONAMES", $query),true); + $result=json_decode($this->client->sparqlQueryPredefinedEndpoint("LOCALGEONAMES", $query, true),true); var_dump($result); return $ret; Modified: trunk/src/dbpedia-navigator/main.wsdl =================================================================== --- trunk/src/dbpedia-navigator/main.wsdl 2008-10-28 12:27:13 UTC (rev 1478) +++ trunk/src/dbpedia-navigator/main.wsdl 2008-10-28 12:37:41 UTC (rev 1479) @@ -338,6 +338,14 @@ <message name="sparqlQueryResponse"> <part name="return" type="xsd:string"></part> </message> + <message name="sparqlQueryPredefinedEndpoint"> + <part name="arg0" type="xsd:string"></part> + <part name="arg1" type="xsd:string"></part> + <part name="arg2" type="xsd:boolean"></part> + </message> + <message name="sparqlQueryPredefinedEndpointResponse"> + <part name="return" type="xsd:string"></part> + </message> <message name="isSparqlQueryRunning"> <part name="arg0" type="xsd:int"></part> <part name="arg1" type="xsd:int"></part> @@ -658,6 +666,10 @@ <output message="tns:sparqlQueryResponse"></output> <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> </operation> + <operation name="sparqlQueryPredefinedEndpoint" parameterOrder="arg0 arg1 arg2"> + <input message="tns:sparqlQueryPredefinedEndpoint"></input> + <output message="tns:sparqlQueryPredefinedEndpointResponse"></output> + </operation> <operation name="isSparqlQueryRunning" parameterOrder="arg0 arg1"> <input message="tns:isSparqlQueryRunning"></input> <output message="tns:isSparqlQueryRunningResponse"></output> @@ -1351,6 +1363,15 @@ <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> </fault> </operation> + <operation name="sparqlQueryPredefinedEndpoint"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + </operation> <operation name="isSparqlQueryRunning"> <soap:operation soapAction=""></soap:operation> <input> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Jen...@us...> - 2008-10-28 13:43:23
|
Revision: 1475 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1475&view=rev Author: JensLehmann Date: 2008-10-28 10:50:04 +0000 (Tue, 28 Oct 2008) Log Message: ----------- integrated city and person template Modified Paths: -------------- trunk/src/dbpedia-navigator/ajax_get_article.php trunk/src/dbpedia-navigator/templates/AbstractTemplate.php trunk/src/dbpedia-navigator/templates/CityTemplate.php trunk/src/dbpedia-navigator/templates/DefaultTemplate.php trunk/src/dbpedia-navigator/templates/PersonTemplate.php trunk/src/dbpedia-navigator/templates/PlaceTemplate.php Modified: trunk/src/dbpedia-navigator/ajax_get_article.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_article.php 2008-10-28 10:24:19 UTC (rev 1474) +++ trunk/src/dbpedia-navigator/ajax_get_article.php 2008-10-28 10:50:04 UTC (rev 1475) @@ -259,14 +259,22 @@ $pages=substr($pages,0,strlen($pages)-2); $content.='<br/><hr><h4>Wikipedia articles in different languages</h4><br/><p>'.$pages.'</p>'; } + + $content .= '<br/><hr><h4>Further Information</h4><br/>'; + // detect appropriate template (currently always default) + if($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type']) == 'http://dbpedia.org/ontology/City) { + $template = new CityTemplate(); + } else if($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type']) == 'http://dbpedia.org/ontology/Person) { + $template = new PersonTemplate(); + } else { + $template = new DefaultTemplate(); + } + // filter out uninteresting properties and properties which // have already been displayed - filterTriples(&$triples, &$subjecttriples); + filterTriples(&$triples, &$subjecttriples); - $content .= '<br/><hr><h4>Further Information</h4><br/>'; - // detect appropriate template (currently always default) - $template = new DefaultTemplate(); // display template for this instance (currently the template is similar to the remaining // instance view apart from beautifications) $content .= $template->printTemplate($triples,$subjecttriples); Modified: trunk/src/dbpedia-navigator/templates/AbstractTemplate.php =================================================================== --- trunk/src/dbpedia-navigator/templates/AbstractTemplate.php 2008-10-28 10:24:19 UTC (rev 1474) +++ trunk/src/dbpedia-navigator/templates/AbstractTemplate.php 2008-10-28 10:50:04 UTC (rev 1475) @@ -32,11 +32,15 @@ abstract function printTemplate($triples,$subjecttriples); + function getTableHeader() { + return '<table border="0" style="width:100%;overflow:hidden"><tr><td><b>Predicate</b></td><td><b>Object/Subject</b></td></tr>'; + } + // function to be called after all "special" actions have been taken; // it displays all remaining triples function printRemainingTriples($triples,$subjecttriples) { + $table = ''; if ((is_array($triples)&&count($triples)>0)||(is_array($subjecttriples)&&count($subjecttriples)>0)){ - $table = '<table border="0" style="width:100%;overflow:hidden"><tr><td><b>Predicate</b></td><td><b>Object/Subject</b></td></tr>'; $i=1; if (is_array($triples)&&count($triples)>0) foreach($triples as $predicate=>$object) { $number=count($object); @@ -118,7 +122,7 @@ } $table .= '</table>'; } - else $table="No Tripel left."; + else $table="No triple left."; return $table; } Modified: trunk/src/dbpedia-navigator/templates/CityTemplate.php =================================================================== --- trunk/src/dbpedia-navigator/templates/CityTemplate.php 2008-10-28 10:24:19 UTC (rev 1474) +++ trunk/src/dbpedia-navigator/templates/CityTemplate.php 2008-10-28 10:50:04 UTC (rev 1475) @@ -29,9 +29,8 @@ class CityTemplate extends PopulatedPlaceTemplate { function printTemplate($triples,$subjecttriples) { - $content = ""; - $content .= '<table>'; - $content .= '<tr><td colspan="2">City Information</td></tr>'; + $content = $this-getTableHeader(); + // $content .= '<tr><td colspan="2">City Information</td></tr>'; // population $content .= '<tr><td>total population</td><td>' + $this->getPopulationString($triples) + '</td></tr>'; // location @@ -39,9 +38,9 @@ $content .= '<tr><td>longitude</td><td>' + $this->getLongitudeString($triples) + '</td></tr>'; // resources related to city // $content .= displayMultipleValues('city'); - $content .= '</table>'; + // $content .= '</table>'; - // .. continue ... + $content .= $this->printRemainingTriples(); return $content; } Modified: trunk/src/dbpedia-navigator/templates/DefaultTemplate.php =================================================================== --- trunk/src/dbpedia-navigator/templates/DefaultTemplate.php 2008-10-28 10:24:19 UTC (rev 1474) +++ trunk/src/dbpedia-navigator/templates/DefaultTemplate.php 2008-10-28 10:50:04 UTC (rev 1475) @@ -29,7 +29,8 @@ // simply prints all triples without doing anything special to group/format them function printTemplate($triples,$subjecttriples) { - $content = $this->printRemainingTriples($triples,$subjecttriples); + $content = $this->getTableHeader(); + $content .= $this->printRemainingTriples($triples,$subjecttriples); return $content; } Modified: trunk/src/dbpedia-navigator/templates/PersonTemplate.php =================================================================== --- trunk/src/dbpedia-navigator/templates/PersonTemplate.php 2008-10-28 10:24:19 UTC (rev 1474) +++ trunk/src/dbpedia-navigator/templates/PersonTemplate.php 2008-10-28 10:50:04 UTC (rev 1475) @@ -25,8 +25,7 @@ class PersonTemplate extends AbstractTemplate { function printTemplate($triples,$subjecttriples) { - $content = ""; - + $content = $this->getTableHeader(); $content .= $this->printRemainingTriples($triples,$subjecttriples); return $content; } Modified: trunk/src/dbpedia-navigator/templates/PlaceTemplate.php =================================================================== --- trunk/src/dbpedia-navigator/templates/PlaceTemplate.php 2008-10-28 10:24:19 UTC (rev 1474) +++ trunk/src/dbpedia-navigator/templates/PlaceTemplate.php 2008-10-28 10:50:04 UTC (rev 1475) @@ -36,9 +36,9 @@ return "unknown"; } - $latitude = $triples['http://dbpedia.org/ontology/latitutedegrees'] + "° " - + $triples['http://dbpedia.org/ontology/latitudeminutes'] + "′" - + $triples['http://dbpedia.org/ontology/latitudeseconds'] + "″N"; + $latitude = $this->extractPropValue('latitutedegrees') + "° " + + $this->extractPropValue('latitudeminutes') + "′" + + $this->extractPropValue('latitudeseconds') + "″N"; return $latitude; } @@ -48,10 +48,10 @@ return "unknown"; } - $longitude = $triples['http://dbpedia.org/ontology/longitutedegrees'] + "° " - + $triples['http://dbpedia.org/ontology/longitudeminutes'] + "′" - + $triples['http://dbpedia.org/ontology/longitudeseconds'] + "″N"; - return $longitude; + $longitude = $this->extractPropValue('longitutedegrees') + "° " + + $this->extractPropValue('http://dbpedia.org/ontology/longitudeminutes') + "′" + + $this->extractPropValue('http://dbpedia.org/ontology/longitudeseconds') + "″N"; + return $longitude; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-10-28 13:45:06
|
Revision: 1469 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1469&view=rev Author: sknappe Date: 2008-10-28 10:10:34 +0000 (Tue, 28 Oct 2008) Log Message: ----------- new negativeExampleFinder using database Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/helper_functions.php Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-10-28 09:18:33 UTC (rev 1468) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-10-28 10:10:34 UTC (rev 1469) @@ -53,6 +53,7 @@ function getConceptFromExamples($posExamples,$negExamples,$number) { require_once("Settings.php"); + require_once("helper_functions.php"); $settings=new Settings(); $this->client->applyConfigEntryInt($this->id, $this->ksID, "recursionDepth",1); @@ -61,10 +62,11 @@ $this->client->applyConfigEntryString($this->id, $this->ksID, "predefinedManipulator", "DBPEDIA-NAVIGATOR"); $this->client->applyConfigEntryBoolean($this->id, $this->ksID, "useCache", true); if(empty($negExamples)){ - if ($settings->classSystem=="YAGO") $filterClasses=array("http://xmlns.com/foaf/","http://dbpedia.org/ontology/"); + /*if ($settings->classSystem=="YAGO") $filterClasses=array("http://xmlns.com/foaf/","http://dbpedia.org/ontology/"); else if ($settings->classSystem=="DBpedia") $filterClasses=array("http://xmlns.com/foaf/","http://dbpedia.org/class/yago/","http://dbpedia.org/ontology/Resource"); $negExamples=$this->client->getNegativeExamples($this->id,$this->ksID,$posExamples,count($posExamples),"http://dbpedia.org/resource/",$filterClasses); - $negExamples=$negExamples->item; + $negExamples=$negExamples->item;*/ + $negExamples=getNegativeExamplesFromParallelClass($posExamples); } $this->client->applyConfigEntryStringArray($this->id, $this->ksID, "instances", array_merge($posExamples,$negExamples)); $this->client->setReasoner($this->id, "fastInstanceChecker"); Modified: trunk/src/dbpedia-navigator/helper_functions.php =================================================================== --- trunk/src/dbpedia-navigator/helper_functions.php 2008-10-28 09:18:33 UTC (rev 1468) +++ trunk/src/dbpedia-navigator/helper_functions.php 2008-10-28 10:10:34 UTC (rev 1469) @@ -616,4 +616,51 @@ if (isset($triples['http://dbpedia.org/property/utcDst'])) unset($triples['http://dbpedia.org/property/utcDst']); if (isset($triples['http://dbpedia.org/property/spokenWikipedia2Property'])) unset($triples['http://dbpedia.org/property/spokenWikipedia2Property']); } + +public function getNegativeExamplesFromParallelClass($posExamples){ + include_once('Settings.php'); + include_once('DatabaseConnection.php'); + //connect to the database + $settings=new Settings(); + $databaseConnection=new DatabaseConnection($settings->database_type); + $databaseConnection->connect($settings->database_server,$settings->database_user,$settings->database_pass); + $databaseConnection->select_database($settings->database_name); + + $examples=array(); + foreach ($posExamples as $pos){ + $query="SELECT category FROM articlecategories WHERE name='".$pos."' AND category!='http://dbpedia.org/ontology/Resource'"; + $res=$databaseConnection->query($query); + if ($databaseConnection->numberOfEntries($res)>0) $zufall = rand(1,$databaseConnection->numberOfEntries($res)); + $i=1; + while ($result=$databaseConnection->nextEntry($res)){ + if ($i==$zufall) $class=$result['category']; + $i++; + } + $query="SELECT father FROM classhierarchy WHERE child='".$class."'"; + $res=$databaseConnection->query($query); + if ($databaseConnection->numberOfEntries($res)>0) $zufall = rand(1,$databaseConnection->numberOfEntries($res)); + $i=1; + while ($result=$databaseConnection->nextEntry($res)){ + if ($i==$zufall) $father=$result['father']; + $i++; + } + + $query="SELECT child FROM classhierarchy WHERE father='".$father."' AND child!='".$class."'"; + $res=$databaseConnection->query($query); + if ($databaseConnection->numberOfEntries($res)>0) $zufall = rand(1,$databaseConnection->numberOfEntries($res)); + $i=1; + while ($result=$databaseConnection->nextEntry($res)){ + if ($i==$zufall) $child=$result['child']; + $i++; + } + $query="SELECT name FROM articlecategories WHERE category='".$child."' AND name!='".$pos."' ORDER BY RAND() LIMIT 1"; + $res=$databaseConnection->query($query); + if ($databaseConnection->numberOfEntries($res)>0){ + $result=$databaseConnection->nextEntry($res); + $examples[]=$result['name']; + } + } + + return $examples; +} ?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-10-28 15:22:15
|
Revision: 1486 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1486&view=rev Author: sknappe Date: 2008-10-28 15:21:56 +0000 (Tue, 28 Oct 2008) Log Message: ----------- bugfix Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/index.php Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-10-28 14:17:16 UTC (rev 1485) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-10-28 15:21:56 UTC (rev 1486) @@ -183,7 +183,7 @@ } //geonames /*if (strlen($geonames)>0){ - $query="SELECT * WHERE {<".$geonames."> <http://www.geonames.org/ontology#parentFeature> ?parent.<".$geonames."> <http://www.geonames.org/ontology#childrenFeatures> ?children.<".$geonames."> <http://www.geonames.org/ontology#nearbyFeatures> ?neighbours.}"; + $query="SELECT * WHERE {<".$geonames."> <http://www.geonames.org/ontology#parentFeature> ?parent.?parent <http://www.w3.org/2002/07/owl#sameAs> ?parentName.<".$geonames."> <http://www.geonames.org/ontology#childrenFeatures> ?children.<".$geonames."> <http://www.geonames.org/ontology#nearbyFeatures> ?neighbours.}"; $result=json_decode($this->client->sparqlQueryPredefinedEndpoint("LOCALGEONAMES", $query, true),true); var_dump($result); }*/ Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-10-28 14:17:16 UTC (rev 1485) +++ trunk/src/dbpedia-navigator/index.php 2008-10-28 15:21:56 UTC (rev 1486) @@ -5,15 +5,7 @@ ini_set("soap.wsdl_cache_enabled","1"); session_start(); -require_once('DLLearnerConnection.php'); -$sc=new DLLearnerConnection(); -$ids=$sc->getIDs(); -$_SESSION['id']=$ids[0]; -$_SESSION['ksID']=$ids[1]; -require_once('Settings.php'); -$settings=new Settings(); - //what happens onLoad $onLoad="onLoad=\"document.getElementById('label').focus();"; if (isset($_GET['positives'])||isset($_GET['negatives'])) $onLoad.="setPositivesAndNegatives('positives=".@$_GET['positives']."&negatives=".@$_GET['negatives']."');"; @@ -44,6 +36,14 @@ $onLoad.="\""; +require_once('DLLearnerConnection.php'); +$sc=new DLLearnerConnection(); +$ids=$sc->getIDs(); +$_SESSION['id']=$ids[0]; +$_SESSION['ksID']=$ids[1]; + +require_once('Settings.php'); +$settings=new Settings(); echo '<?xml version="1.0" encoding="UTF-8"?>'; ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-10-28 15:32:16
|
Revision: 1487 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1487&view=rev Author: sknappe Date: 2008-10-28 15:32:03 +0000 (Tue, 28 Oct 2008) Log Message: ----------- bugfix Modified Paths: -------------- trunk/src/dbpedia-navigator/ajax_get_article.php trunk/src/dbpedia-navigator/index.php Modified: trunk/src/dbpedia-navigator/ajax_get_article.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_article.php 2008-10-28 15:21:56 UTC (rev 1486) +++ trunk/src/dbpedia-navigator/ajax_get_article.php 2008-10-28 15:32:03 UTC (rev 1487) @@ -13,6 +13,8 @@ $subject=$_POST['label']; $fromCache=$_POST['cache']; + if ($fromCache==-2) $fromrest=true; + else $fromrest=false; if (isset($_SESSION['articles'])) $articles=$_SESSION['articles']; if (isset($_SESSION['id'])){ @@ -309,7 +311,7 @@ } else{ $array=$_SESSION['positive']; - if (!isset($array[$uri])){ + if (!isset($array[$uri])||$fromrest){ $array[$uri]=$artTitle; if (count($array)>10){ foreach ($array as $key=>$value){ @@ -345,7 +347,7 @@ } else{ $array=$_SESSION['positive']; - if (!isset($array[$uri])){ + if (!isset($array[$uri])||$fromrest){ $array[$uri]=$artTitle; if (count($array)>10){ foreach ($array as $key=>$value){ Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-10-28 15:21:56 UTC (rev 1486) +++ trunk/src/dbpedia-navigator/index.php 2008-10-28 15:32:03 UTC (rev 1487) @@ -12,7 +12,7 @@ else if (isset($_SESSION['positives'])||isset($_SESSION['negatives'])) $onLoad.="setPositivesAndNegatives('positives=".$_SESSION['positives']."&negatives=".$_SESSION['negatives']."');"; if (isset($_GET['showArticle'])){ session_unset(); - $onLoad.="get_article('label=".$_GET['showArticle']."&cache=-1');"; + $onLoad.="get_article('label=".$_GET['showArticle']."&cache=-2');"; } else if (isset($_GET['search'])){ session_unset(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |