From: <sk...@us...> - 2008-09-23 08:30:58
|
Revision: 1239 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1239&view=rev Author: sknappe Date: 2008-09-23 08:30:47 +0000 (Tue, 23 Sep 2008) Log Message: ----------- some design changes 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-09-22 17:17:49 UTC (rev 1238) +++ trunk/src/dbpedia-navigator/ajax_get_article.php 2008-09-23 08:30:47 UTC (rev 1239) @@ -81,11 +81,22 @@ $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.='<br/><hr><h4>Classes and Categories</h4><br/>'; + if (isset($triples['http://www.w3.org/2002/07/owl#sameAs'])){ + $content.='<br/><hr><h4>Same as</h4><br/>'; + $content.='<ul>'; + foreach ($triples['http://www.w3.org/2002/07/owl#sameAs'] as $same){ + if ($same['type']=="uri") + $content .= '<li><a href="'.$same['value'].'" target="_blank">'.urldecode($same['value']).'</a></li>'; + else $content.= '<li>'.urldecode($same['value']).'</li>'; + } + $content.='</ul>'; + } + $content.='<br/><hr><h4>YAGO Classes</h4><br/>'; + // display a list of classes if(isset($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type'])) - $content .= '<p>Yago classes: '.formatClassArray($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type']).'</p>'; + $content .= '<p>'.formatClassArray($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type']).'</p>'; //skos-subjects //not used, because one class systems, YAGO, is enough @@ -96,7 +107,8 @@ $content .= '</ul></p>'; }*/ - //not used at the moment + //references not used at the moment because some urls cause problems with + //the xml parser that recognizes html entities, where no entities are /*if(isset($triples['http://dbpedia.org/property/reference'])) { $content .= '<p>references: <ul>'; foreach($triples['http://dbpedia.org/property/reference'] as $reference) @@ -117,13 +129,35 @@ } //display only one birthdate - $birthdates=array("http://dbpedia.org/property/dateOfBirth","http://dbpedia.org/property/birth"); + $birthdates=array("http://dbpedia.org/property/dateOfBirth","http://dbpedia.org/property/birth","http://dbpedia.org/property/birthDate"); $date=false; foreach ($birthdates as $dates){ - if ($date) unset($triples[$dates]); - if (isset($triples[$dates])&&!$date) $date=true; + if ($date){ + unset($triples[$dates]); + continue; + } + if (isset($triples[$dates])&&$triples[$dates][0]['type']!='uri') $date=true; + else unset($triples[$dates]); } + //display only one deathdate + $deathdates=array("http://dbpedia.org/property/death","http://dbpedia.org/property/dateOfDeath","http://dbpedia.org/property/deathDate"); + $date=false; + foreach ($deathdates as $dates){ + if ($date){ + unset($triples[$dates]); + continue; + } + if (isset($triples[$dates])&&$triples[$dates][0]['type']!='uri') $date=true; + else unset($triples[$dates]); + } + + //display a small characteristics of a person, if at least the birth date is given + if ($date){ + $information=array(); + } + + //display foreign wiki pages $languages=array('Deutsch'=>'http://dbpedia.org/property/wikipage-de' ,'Espa%C3%B1ol'=>'http://dbpedia.org/property/wikipage-es' @@ -153,6 +187,7 @@ // filter out uninteresting properties and properties which // have already been displayed + unset($triples['http://www.w3.org/2002/07/owl#sameAs']); unset($triples['http://xmlns.com/foaf/0.1/page']); unset($triples['http://xmlns.com/foaf/0.1/depiction']); unset($triples['http://dbpedia.org/property/abstract']); @@ -173,8 +208,25 @@ unset($triples['http://dbpedia.org/property/latDeg']); unset($triples['http://dbpedia.org/property/lonMin']); unset($triples['http://www.georss.org/georss/point']); + unset($triples['http://dbpedia.org/property/audioProperty']); + unset($triples['http://dbpedia.org/property/wikiPageUsesTemplate']); + unset($triples['http://dbpedia.org/property/relatedInstance']); + unset($triples['http://dbpedia.org/property/boxWidth']); + unset($triples['http://dbpedia.org/property/pp']); + unset($triples['http://dbpedia.org/property/caption']); + unset($triples['http://dbpedia.org/property/s']); + unset($triples['http://dbpedia.org/property/lifetimeProperty']); + unset($triples['http://dbpedia.org/property/imagesize']); + unset($triples['http://dbpedia.org/property/id']); + unset($triples['http://dbpedia.org/property/issue']); + if ($triples['http://dbpedia.org/property/hips'][0]['type']=='uri') unset($triples['http://dbpedia.org/property/hips']); + if ($triples['http://dbpedia.org/property/weight'][0]['type']=='uri') unset($triples['http://dbpedia.org/property/weight']); + if ($triples['http://dbpedia.org/property/waist'][0]['type']=='uri') unset($triples['http://dbpedia.org/property/waist']); + if ($triples['http://dbpedia.org/property/height'][0]['type']=='uri') unset($triples['http://dbpedia.org/property/height']); + unset($triples['http://www.geonames.org/ontology#featureCode']); + unset($triples['http://www.geonames.org/ontology#featureClass']); + unset($triples['http://dbpedia.org/property/dmozProperty']); - if (count($triples)>0){ $content.='<br/><hr><h4>Remaining Triples</h4><br/>'; Modified: trunk/src/dbpedia-navigator/helper_functions.php =================================================================== --- trunk/src/dbpedia-navigator/helper_functions.php 2008-09-22 17:17:49 UTC (rev 1238) +++ trunk/src/dbpedia-navigator/helper_functions.php 2008-09-23 08:30:47 UTC (rev 1239) @@ -13,7 +13,7 @@ //add the uri $subject="http://dbpedia.org/resource/".$subject; - return $subject; + return urldecode($subject); } function getTagCloud($tags,$label) @@ -232,7 +232,7 @@ foreach($object as $element) { if ($element['type']=="uri"){ if (strpos($element['value'],"http://dbpedia.org/resource/")===0&&substr_count($element['value'],"/")==4&&strpos($element['value'],"Template:")!=28){ - $label=substr($element['value'],28); + $label=str_replace('_',' ',substr($element['value'],28)); $table .= '<li><a href="#" onclick="get_article(\'label='.$element['value'].'&cache=-1\');return false;">'.urldecode($label).'</a></li>'; } else $table .= '<li><a href="'.$element['value'].'" target="_blank">'.urldecode($element['value']).'</a></li>'; @@ -290,10 +290,12 @@ $string="<ul>"; for($i=0; $i<count($ar); $i++) { + $yagoPrefix = 'http://dbpedia.org/class/yago/'; + if(substr($ar[$i]['value'],0,30)!=$yagoPrefix) continue; $query="SELECT label FROM categories WHERE category='".$ar[$i]['value']."' LIMIT 1"; $res=$databaseConnection->query($query); $result=$databaseConnection->nextEntry($res); - if ($ar[$i]['value']!="http://xmlns.com/foaf/0.1/Person") $string .= '<li>' . formatClass($ar[$i]['value'],$result['label']).'</li>'; + $string .= '<li>' . formatClass($ar[$i]['value'],$result['label']).'</li>'; } return $string."</ul>"; } @@ -301,17 +303,7 @@ // format a class nicely, i.e. link to it and possibly display // it in a better way function formatClass($className,$label) { - $yagoPrefix = 'http://dbpedia.org/class/yago/'; - if(substr($className,0,30)==$yagoPrefix) { - return $label.' <a href="#" onclick="getSubjectsFromCategory(\'category='.$className.'&number=10\');">→ search Instances</a> <a href="#" onclick="get_class(\'class='.$className.'&cache=-1\');">→ show Class in Hierarchy</a>'; - // DBpedia is Linked Data, so it makes always sense to link it - // ToDo: instead of linking to other pages, the resource should better - // be openened within DBpedia Navigator - } else if(substr($className,0,14)=='http://dbpedia') { - return '<a href="'.$className.'" target="_blank">'.$className.'</a>'; - } else { - return $className; - } + return $label.' <a href="#" onclick="getSubjectsFromCategory(\'category='.$className.'&number=10\');">→ search Instances</a> <a href="#" onclick="get_class(\'class='.$className.'&cache=-1\');">→ show Class in Hierarchy</a>'; } function arrayToCommaSseparatedList($ar) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-09-23 10:46:27
|
Revision: 1241 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1241&view=rev Author: sknappe Date: 2008-09-23 10:46:20 +0000 (Tue, 23 Sep 2008) Log Message: ----------- changed design stuff, filtered some triples and made a simple characteristics view for persons and a seperate part for owl:sameAs property 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-09-23 10:44:04 UTC (rev 1240) +++ trunk/src/dbpedia-navigator/ajax_get_article.php 2008-09-23 10:46:20 UTC (rev 1241) @@ -59,8 +59,10 @@ $artTitle=urldecode(str_replace("_"," ",substr (strrchr ($url, "/"), 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 $alt='Picture of '.$artTitle; if(isset($triples['http://xmlns.com/foaf/0.1/depiction'])) - $content.='<img src="'.$triples['http://xmlns.com/foaf/0.1/depiction'][0]['value'].'" alt="Picture of '.$artTitle.'" style="float:right; max-width:200px;" \>'; + $content.='<img src="'.$triples['http://xmlns.com/foaf/0.1/depiction'][0]['value'].'" alt="'.$alt.'" style="float:right; max-width:200px;" \>'; //display where it was redirected from, if it was redirected $redirect=""; @@ -128,33 +130,68 @@ $long=""; } + $characteristic=array(); //display only one birthdate - $birthdates=array("http://dbpedia.org/property/dateOfBirth","http://dbpedia.org/property/birth","http://dbpedia.org/property/birthDate"); - $date=false; + $birthdates=array("http://dbpedia.org/property/dateOfBirth","http://dbpedia.org/property/birth","http://dbpedia.org/property/birthdate","http://dbpedia.org/property/birthDate"); + $birthdate=false; + $birthuri=false; foreach ($birthdates as $dates){ - if ($date){ + if ($birthdate!=false){ unset($triples[$dates]); continue; } - if (isset($triples[$dates])&&$triples[$dates][0]['type']!='uri') $date=true; + if (isset($triples[$dates])&&$triples[$dates][0]['type']!='uri'){ + $birthdate=$dates; + $characteristics['Birthdate']=$triples[$dates]; + } + else if ($triples[$dates][0]['type']=='uri'&&$birthuri==false){ + $birthuri=$dates; + $characteristics['Birthdate']=$triples[$dates]; + } else unset($triples[$dates]); } //display only one deathdate - $deathdates=array("http://dbpedia.org/property/death","http://dbpedia.org/property/dateOfDeath","http://dbpedia.org/property/deathDate"); - $date=false; + $deathdates=array("http://dbpedia.org/property/death","http://dbpedia.org/property/dateOfDeath","http://dbpedia.org/property/deathdate","http://dbpedia.org/property/deathDate"); + $deathdate=false; + $deathuri=false; foreach ($deathdates as $dates){ - if ($date){ + if ($deathdate!=false){ unset($triples[$dates]); continue; } - if (isset($triples[$dates])&&$triples[$dates][0]['type']!='uri') $date=true; + if (isset($triples[$dates])&&$triples[$dates][0]['type']!='uri'){ + $deathdate=$dates; + $characteristics['Deathdate']=$triples[$dates]; + } + else if ($triples[$dates][0]['type']=='uri'&&$deathuri==false){ + $deathuri=$dates; + $characteristics['Deathdate']=$triples[$dates]; + } else unset($triples[$dates]); } //display a small characteristics of a person, if at least the birth date is given - if ($date){ - $information=array(); + if ($birthdate!=false||$birthuri!=false){ + $content.='<br/><hr><h4>Characteristics</h4><br/>'; + + if (isset($triples['http://dbpedia.org/property/birthname'])) $characteristics['Birthname']=$triples['http://dbpedia.org/property/birthname']; + if (isset($triples['http://dbpedia.org/property/birthPlace'])) $characteristics['Birthplace']=$triples['http://dbpedia.org/property/birthPlace']; + if (isset($triples['http://dbpedia.org/property/deathPlace'])) $characteristics['Deathplace']=$triples['http://dbpedia.org/property/deathPlace']; + if (isset($triples['http://dbpedia.org/property/spouse'])) $characteristics['Spouse']=$triples['http://dbpedia.org/property/spouse']; + if (isset($triples['http://dbpedia.org/property/shortDescription'])) $characteristics['Short Description']=$triples['http://dbpedia.org/property/shortDescription']; + if (isset($triples['http://dbpedia.org/property/alternativeNames'])) $characteristics['Alternative Names']=$triples['http://dbpedia.org/property/alternativeNames']; + $content.=createCharacteristics($characteristics); + unset($triples['http://dbpedia.org/property/birthname']); + unset($triples['http://dbpedia.org/property/birthPlace']); + unset($triples['http://dbpedia.org/property/deathPlace']); + unset($triples['http://dbpedia.org/property/spouse']); + unset($triples['http://dbpedia.org/property/shortDescription']); + unset($triples['http://dbpedia.org/property/alternativeNames']); + if ($birthdate!=false) unset($triples[$birthdate]); + if ($birthuri!=false) unset($triples[$birthuri]); + if ($deathdate!=false) unset($triples[$deathdate]); + if ($deathuri!=false) unset($triples[$deathuri]); } @@ -226,6 +263,9 @@ unset($triples['http://www.geonames.org/ontology#featureCode']); unset($triples['http://www.geonames.org/ontology#featureClass']); unset($triples['http://dbpedia.org/property/dmozProperty']); + unset($triples['http://dbpedia.org/property/color']); + unset($triples['http://dbpedia.org/property/imageCaption']); + unset($triples['http://dbpedia.org/property/name']); if (count($triples)>0){ $content.='<br/><hr><h4>Remaining Triples</h4><br/>'; Modified: trunk/src/dbpedia-navigator/helper_functions.php =================================================================== --- trunk/src/dbpedia-navigator/helper_functions.php 2008-09-23 10:44:04 UTC (rev 1240) +++ trunk/src/dbpedia-navigator/helper_functions.php 2008-09-23 10:46:20 UTC (rev 1241) @@ -225,21 +225,34 @@ $table = '<table border="0"><tr><td><b>Predicate</b></td><td><b>Object</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><ul>'; + $table .= '<td>'; + if ($number>1) $table.='<ul>'; foreach($object as $element) { 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)); - $table .= '<li><a href="#" onclick="get_article(\'label='.$element['value'].'&cache=-1\');return false;">'.urldecode($label).'</a></li>'; + if ($number>1) $table.='<li>'; + $table .= '<a href="#" onclick="get_article(\'label='.$element['value'].'&cache=-1\');return false;">'.urldecode($label).'</a>'; + if ($number>1) $table.='</li>'; } - else $table .= '<li><a href="'.$element['value'].'" target="_blank">'.urldecode($element['value']).'</a></li>'; + else{ + if ($number>1) $table.='<li>'; + $table .= '<a href="'.$element['value'].'" target="_blank">'.urldecode($element['value']).'</a>'; + if ($number>1) $table.='</li>'; + } } - else $table .= '<li>'.$element['value'].'</li>'; + else{ + if ($number>1) $table.='<li>'; + $table .= $element['value']; + if ($number>1) $table.='</li>'; + } } - $table .= '</ul></td>'; + if ($number>1) $table.='</ul>'; + $table .= '</td>'; $i*=-1; } $table .= '</table>'; @@ -371,4 +384,46 @@ return $ret; } + +function createCharacteristics($char) +{ + $ret='<table border="0" style="padding:5px">'; + $i=0; + foreach ($char as $label=>$value){ + if ($i%2==0) + $ret.='<tr>'; + $ret.='<td style="width:20%;text-align:right"><b>'.$label.'</b>:</td><td style="width:30%;text-align:left">'; + $number=count($value); + if ($number>1) $ret.='<ul>'; + foreach ($value as $val){ + if ($val['type']=="uri"){ + if (strpos($val['value'],"http://dbpedia.org/resource/")===0&&substr_count($val['value'],"/")==4&&strpos($val['value'],"Template:")!=28){ + $label=str_replace('_',' ',substr($val['value'],28)); + if ($number>1) $ret.='<li>'; + $ret .= '<a href="#" onclick="get_article(\'label='.$val['value'].'&cache=-1\');return false;">'.urldecode($label).'</a>'; + if ($number>1) $ret.='</li>'; + } + else{ + if ($number>1) $ret.='<li>'; + $ret .= '<a href="'.$val['value'].'" target="_blank">'.urldecode($val['value']).'</a>'; + if ($number>1) $ret.='</li>'; + } + } + else{ + if ($number>1) $ret.='<li>'; + $ret .= $val['value']; + if ($number>1) $ret.='</li>'; + } + } + if ($number>1) $ret.='</ul>'; + $ret.='</td>'; + if ($i%2==1||$i==count($char)-1){ + $ret.='</tr>'; + $ret.='<tr><td colspan="4" style="height:10px"></td></tr>'; + } + $i++; + } + $ret.='</table>'; + return $ret; +} ?> \ 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-09-23 18:37:22
|
Revision: 1242 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1242&view=rev Author: sknappe Date: 2008-09-23 18:35:57 +0000 (Tue, 23 Sep 2008) Log Message: ----------- design changes, filters, bugfixes, resource as object, etc. Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/ajax_generate_URL.php trunk/src/dbpedia-navigator/ajax_get_article.php trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php trunk/src/dbpedia-navigator/ajax_learn_concepts.php trunk/src/dbpedia-navigator/helper_functions.php trunk/src/dbpedia-navigator/index.php trunk/src/dbpedia-navigator/js/navigator.js Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-09-23 10:46:20 UTC (rev 1241) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-09-23 18:35:57 UTC (rev 1242) @@ -135,14 +135,18 @@ function getTriples($uri) { //i am filtering the references out at the moment, because they are causing errors with URL with ...&profile=bla, the XMLParser thinks &profile is a HTML-Entitie and misses the ; - $query="SELECT ?pred ?obj ". - "WHERE {{<".$uri."> ?pred ?obj.Filter(!regex(str(?pred),'http://dbpedia.org/property/reference'))}UNION{<".$uri."> <http://dbpedia.org/property/redirect> ?Conc.?Conc ?pred ?obj.Filter(!regex(str(?pred),'http://dbpedia.org/property/reference'))}}"; + $query="SELECT ?pred ?obj ?sub ". + "WHERE {{<".$uri."> ?pred ?obj.Filter(!regex(str(?pred),'http://dbpedia.org/property/reference'))}UNION{<".$uri."> <http://dbpedia.org/property/redirect> ?Conc.?Conc ?pred ?obj.Filter(!regex(str(?pred),'http://dbpedia.org/property/reference'))}UNION{?sub ?pred <".$uri.">}UNION{<".$uri."> <http://dbpedia.org/property/redirect> ?Conc.?sub ?pred ?Conc}}"; $result=json_decode($this->getSparqlResultThreaded($query),true); if (count($result['results']['bindings'])==0) throw new Exception("An article with that name does not exist. The Search is started ..."); $ret=array(); foreach ($result['results']['bindings'] as $results){ - $value=$results['obj']; - if (!(isset($value['xml:lang'])&&($value['xml:lang']!=$this->lang))) $ret[$results['pred']['value']][]=$value; + if (isset($results['obj'])) $value=$results['obj']; + else if (isset($results['sub'])) $value=$results['sub']; + if (!(isset($value['xml:lang'])&&($value['xml:lang']!=$this->lang))){ + if (isset($results['obj'])) $ret[0][$results['pred']['value']][]=$value; + else if (isset($results['sub'])) $ret[1][$results['pred']['value']][]=$value; + } } return $ret; @@ -256,7 +260,7 @@ } return $ret; } - + /*not used at the moment function getYagoSubCategories($category) { $query="SELECT ?subject ?label count(?subclass) as ?numberOfSubclasses\n". @@ -272,7 +276,7 @@ if (strlen($res['label'])>0) $ret[]=$res; } return $ret; - } + }*/ public function loadWSDLfiles($wsdluri){ $main=DLLearnerConnection::getwsdl($wsdluri); Modified: trunk/src/dbpedia-navigator/ajax_generate_URL.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_generate_URL.php 2008-09-23 10:46:20 UTC (rev 1241) +++ trunk/src/dbpedia-navigator/ajax_generate_URL.php 2008-09-23 18:35:57 UTC (rev 1242) @@ -3,6 +3,7 @@ $positives=$_SESSION['positive']; $negatives=$_SESSION['negative']; + $attr=array(); $pos=""; $i=1; if (isset($_SESSION['positive'])) foreach ($positives as $key=>$value){ @@ -10,7 +11,10 @@ else $pos.=$key; $i++; } - if (strlen($pos)>0) $pos='positives=['.$pos.']'; + if (strlen($pos)>0){ + $pos='positives=['.$pos.']'; + $attr[]=$pos; + } $neg=""; $i=1; if (isset($_SESSION['negative'])) foreach ($negatives as $key=>$value){ @@ -18,12 +22,19 @@ else $neg.=$key; $i++; } - if (strlen($neg)>0) $neg='negatives=['.$neg.']'; - - if (strlen($pos)>0||strlen($neg)>0) $interests='?'.$pos.$neg; - else $interests=""; + if (strlen($neg)>0){ + $neg.='negatives=['.$neg.']'; + $attr[]=$neg; + } - $url='http://'.$_SERVER['HTTP_HOST'].'/dbpedia-navigator/'.$_SESSION['lastAction'].$interests; + $last_action=$_SESSION['lastAction']; + if (strpos($last_action,'searchConceptInstances')===0){ + $attr[]='concept='.substr($last_action,strpos($last_action, "/")+1); + $last_action='searchConceptInstances/Concept'; + } + $attributes='?'.implode('&',$attr); + $url='http://'.$_SERVER['HTTP_HOST'].'/dbpedia-navigator/'.$last_action.$attributes; + print $url.'<br/><br/>'; ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/ajax_get_article.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_article.php 2008-09-23 10:46:20 UTC (rev 1241) +++ trunk/src/dbpedia-navigator/ajax_get_article.php 2008-09-23 18:35:57 UTC (rev 1242) @@ -46,7 +46,9 @@ try{ require_once("DLLearnerConnection.php"); $sc=new DLLearnerConnection($id,$ksID); - $triples=$sc->getTriples($uri); + $alltriples=$sc->getTriples($uri); + $triples=$alltriples[0]; + $subjecttriples=$alltriples[1]; //BUILD ARTICLE // goal: display the data in a nice (DBpedia specific way), maybe similar to @@ -83,7 +85,8 @@ $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>'; } - if (isset($triples['http://www.w3.org/2002/07/owl#sameAs'])){ + //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/>'; $content.='<ul>'; foreach ($triples['http://www.w3.org/2002/07/owl#sameAs'] as $same){ @@ -91,12 +94,18 @@ $content .= '<li><a href="'.$same['value'].'" target="_blank">'.urldecode($same['value']).'</a></li>'; else $content.= '<li>'.urldecode($same['value']).'</li>'; } + if (isset($subjecttriples['http://www.w3.org/2002/07/owl#sameAs'])) foreach ($subjecttriples['http://www.w3.org/2002/07/owl#sameAs'] as $same){ + if ($same['type']=="uri") + $content .= '<li><a href="'.$same['value'].'" target="_blank">'.urldecode($same['value']).'</a></li>'; + else $content.= '<li>'.urldecode($same['value']).'</li>'; + } $content.='</ul>'; } + // display a list of classes $content.='<br/><hr><h4>YAGO Classes</h4><br/>'; - // display a list of classes + if(isset($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type'])) $content .= '<p>'.formatClassArray($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type']).'</p>'; @@ -137,7 +146,7 @@ $birthuri=false; foreach ($birthdates as $dates){ if ($birthdate!=false){ - unset($triples[$dates]); + if (isset($triples[$dates])) unset($triples[$dates]); continue; } if (isset($triples[$dates])&&$triples[$dates][0]['type']!='uri'){ @@ -148,7 +157,7 @@ $birthuri=$dates; $characteristics['Birthdate']=$triples[$dates]; } - else unset($triples[$dates]); + else if (isset($triples[$dates])) unset($triples[$dates]); } //display only one deathdate @@ -157,7 +166,7 @@ $deathuri=false; foreach ($deathdates as $dates){ if ($deathdate!=false){ - unset($triples[$dates]); + if (isset($triples[$dates])) unset($triples[$dates]); continue; } if (isset($triples[$dates])&&$triples[$dates][0]['type']!='uri'){ @@ -168,7 +177,7 @@ $deathuri=$dates; $characteristics['Deathdate']=$triples[$dates]; } - else unset($triples[$dates]); + else if (isset($triples[$dates])) unset($triples[$dates]); } //display a small characteristics of a person, if at least the birth date is given @@ -179,15 +188,13 @@ if (isset($triples['http://dbpedia.org/property/birthPlace'])) $characteristics['Birthplace']=$triples['http://dbpedia.org/property/birthPlace']; if (isset($triples['http://dbpedia.org/property/deathPlace'])) $characteristics['Deathplace']=$triples['http://dbpedia.org/property/deathPlace']; if (isset($triples['http://dbpedia.org/property/spouse'])) $characteristics['Spouse']=$triples['http://dbpedia.org/property/spouse']; - if (isset($triples['http://dbpedia.org/property/shortDescription'])) $characteristics['Short Description']=$triples['http://dbpedia.org/property/shortDescription']; if (isset($triples['http://dbpedia.org/property/alternativeNames'])) $characteristics['Alternative Names']=$triples['http://dbpedia.org/property/alternativeNames']; $content.=createCharacteristics($characteristics); - unset($triples['http://dbpedia.org/property/birthname']); - unset($triples['http://dbpedia.org/property/birthPlace']); - unset($triples['http://dbpedia.org/property/deathPlace']); - unset($triples['http://dbpedia.org/property/spouse']); - unset($triples['http://dbpedia.org/property/shortDescription']); - unset($triples['http://dbpedia.org/property/alternativeNames']); + if (isset($triples['http://dbpedia.org/property/birthname'])) unset($triples['http://dbpedia.org/property/birthname']); + if (isset($triples['http://dbpedia.org/property/birthPlace'])) unset($triples['http://dbpedia.org/property/birthPlace']); + if (isset($triples['http://dbpedia.org/property/deathPlace'])) unset($triples['http://dbpedia.org/property/deathPlace']); + if (isset($triples['http://dbpedia.org/property/spouse'])) unset($triples['http://dbpedia.org/property/spouse']); + if (isset($triples['http://dbpedia.org/property/alternativeNames'])) unset($triples['http://dbpedia.org/property/alternativeNames']); if ($birthdate!=false) unset($triples[$birthdate]); if ($birthuri!=false) unset($triples[$birthuri]); if ($deathdate!=false) unset($triples[$deathdate]); @@ -224,54 +231,70 @@ // filter out uninteresting properties and properties which // have already been displayed - unset($triples['http://www.w3.org/2002/07/owl#sameAs']); - unset($triples['http://xmlns.com/foaf/0.1/page']); - unset($triples['http://xmlns.com/foaf/0.1/depiction']); - unset($triples['http://dbpedia.org/property/abstract']); - unset($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type']); - unset($triples['http://dbpedia.org/property/redirect']); - unset($triples['http://dbpedia.org/property/reference']); - unset($triples['http://www.w3.org/2003/01/geo/wgs84_pos#long']); - unset($triples['http://www.w3.org/2003/01/geo/wgs84_pos#lat']); - unset($triples['http://dbpedia.org/property/hasPhotoCollection']); - unset($triples['http://www.w3.org/2004/02/skos/core#subject']); - unset($triples['http://www.w3.org/2000/01/rdf-schema#label']); - unset($triples['http://www.w3.org/2000/01/rdf-schema#comment']); - unset($triples['http://dbpedia.org/property/latSec']); - unset($triples['http://dbpedia.org/property/lonSec']); - unset($triples['http://dbpedia.org/property/lonDeg']); - unset($triples['http://dbpedia.org/property/latMin']); - unset($triples['http://dbpedia.org/property/lonMin']); - unset($triples['http://dbpedia.org/property/latDeg']); - unset($triples['http://dbpedia.org/property/lonMin']); - unset($triples['http://www.georss.org/georss/point']); - unset($triples['http://dbpedia.org/property/audioProperty']); - unset($triples['http://dbpedia.org/property/wikiPageUsesTemplate']); - unset($triples['http://dbpedia.org/property/relatedInstance']); - unset($triples['http://dbpedia.org/property/boxWidth']); - unset($triples['http://dbpedia.org/property/pp']); - unset($triples['http://dbpedia.org/property/caption']); - unset($triples['http://dbpedia.org/property/s']); - unset($triples['http://dbpedia.org/property/lifetimeProperty']); - unset($triples['http://dbpedia.org/property/imagesize']); - unset($triples['http://dbpedia.org/property/id']); - unset($triples['http://dbpedia.org/property/issue']); - if ($triples['http://dbpedia.org/property/hips'][0]['type']=='uri') unset($triples['http://dbpedia.org/property/hips']); - if ($triples['http://dbpedia.org/property/weight'][0]['type']=='uri') unset($triples['http://dbpedia.org/property/weight']); - if ($triples['http://dbpedia.org/property/waist'][0]['type']=='uri') unset($triples['http://dbpedia.org/property/waist']); - if ($triples['http://dbpedia.org/property/height'][0]['type']=='uri') unset($triples['http://dbpedia.org/property/height']); - unset($triples['http://www.geonames.org/ontology#featureCode']); - unset($triples['http://www.geonames.org/ontology#featureClass']); - unset($triples['http://dbpedia.org/property/dmozProperty']); - unset($triples['http://dbpedia.org/property/color']); - unset($triples['http://dbpedia.org/property/imageCaption']); - unset($triples['http://dbpedia.org/property/name']); + if (isset($triples['http://www.w3.org/2002/07/owl#sameAs'])) unset($triples['http://www.w3.org/2002/07/owl#sameAs']); + if (isset($subjecttriples['http://www.w3.org/2002/07/owl#sameAs'])) unset($subjecttriples['http://www.w3.org/2002/07/owl#sameAs']); + if (isset($triples['http://xmlns.com/foaf/0.1/page'])) unset($triples['http://xmlns.com/foaf/0.1/page']); + if (isset($triples['http://xmlns.com/foaf/0.1/depiction'])) unset($triples['http://xmlns.com/foaf/0.1/depiction']); + if (isset($triples['http://dbpedia.org/property/abstract'])) unset($triples['http://dbpedia.org/property/abstract']); + if (isset($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type'])) unset($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type']); + if (isset($triples['http://dbpedia.org/property/redirect'])) unset($triples['http://dbpedia.org/property/redirect']); + if (isset($triples['http://dbpedia.org/property/reference'])) unset($triples['http://dbpedia.org/property/reference']); + if (isset($triples['http://www.w3.org/2003/01/geo/wgs84_pos#long'])) unset($triples['http://www.w3.org/2003/01/geo/wgs84_pos#long']); + if (isset($triples['http://www.w3.org/2003/01/geo/wgs84_pos#lat'])) unset($triples['http://www.w3.org/2003/01/geo/wgs84_pos#lat']); + if (isset($triples['http://dbpedia.org/property/hasPhotoCollection'])) unset($triples['http://dbpedia.org/property/hasPhotoCollection']); + if (isset($triples['http://www.w3.org/2004/02/skos/core#subject'])) unset($triples['http://www.w3.org/2004/02/skos/core#subject']); + if (isset($triples['http://www.w3.org/2000/01/rdf-schema#label'])) unset($triples['http://www.w3.org/2000/01/rdf-schema#label']); + if (isset($triples['http://www.w3.org/2000/01/rdf-schema#comment'])) unset($triples['http://www.w3.org/2000/01/rdf-schema#comment']); + if (isset($triples['http://dbpedia.org/property/latSec'])) unset($triples['http://dbpedia.org/property/latSec']); + if (isset($triples['http://dbpedia.org/property/lonSec'])) unset($triples['http://dbpedia.org/property/lonSec']); + if (isset($triples['http://dbpedia.org/property/lonDeg'])) unset($triples['http://dbpedia.org/property/lonDeg']); + if (isset($triples['http://dbpedia.org/property/latMin'])) unset($triples['http://dbpedia.org/property/latMin']); + if (isset($triples['http://dbpedia.org/property/lonMin'])) unset($triples['http://dbpedia.org/property/lonMin']); + if (isset($triples['http://dbpedia.org/property/latDeg'])) unset($triples['http://dbpedia.org/property/latDeg']); + if (isset($triples['http://dbpedia.org/property/lonMin'])) unset($triples['http://dbpedia.org/property/lonMin']); + if (isset($triples['http://www.georss.org/georss/point'])) unset($triples['http://www.georss.org/georss/point']); + if (isset($triples['http://dbpedia.org/property/audioProperty'])) unset($triples['http://dbpedia.org/property/audioProperty']); + if (isset($triples['http://dbpedia.org/property/wikiPageUsesTemplate'])) unset($triples['http://dbpedia.org/property/wikiPageUsesTemplate']); + if (isset($triples['http://dbpedia.org/property/relatedInstance'])) unset($triples['http://dbpedia.org/property/relatedInstance']); + if (isset($triples['http://dbpedia.org/property/boxWidth'])) unset($triples['http://dbpedia.org/property/boxWidth']); + if (isset($triples['http://dbpedia.org/property/pp'])) unset($triples['http://dbpedia.org/property/pp']); + if (isset($triples['http://dbpedia.org/property/caption'])) unset($triples['http://dbpedia.org/property/caption']); + if (isset($subjecttriples['http://dbpedia.org/property/caption'])) unset($subjecttriples['http://dbpedia.org/property/caption']); + if (isset($triples['http://dbpedia.org/property/s'])) unset($triples['http://dbpedia.org/property/s']); + if (isset($triples['http://dbpedia.org/property/lifetimeProperty'])) unset($triples['http://dbpedia.org/property/lifetimeProperty']); + if (isset($triples['http://dbpedia.org/property/imagesize'])) unset($triples['http://dbpedia.org/property/imagesize']); + if (isset($triples['http://dbpedia.org/property/id'])) unset($triples['http://dbpedia.org/property/id']); + if (isset($triples['http://dbpedia.org/property/issue'])) unset($triples['http://dbpedia.org/property/issue']); + if (isset($triples['http://dbpedia.org/property/hips'][0]['type']=='uri')) unset($triples['http://dbpedia.org/property/hips']); + if (isset($triples['http://dbpedia.org/property/weight'][0]['type']=='uri')) unset($triples['http://dbpedia.org/property/weight']); + if (isset($triples['http://dbpedia.org/property/waist'][0]['type']=='uri')) unset($triples['http://dbpedia.org/property/waist']); + if (isset($triples['http://dbpedia.org/property/height'][0]['type']=='uri')) unset($triples['http://dbpedia.org/property/height']); + if (isset($triples['http://www.geonames.org/ontology#featureCode'])) unset($triples['http://www.geonames.org/ontology#featureCode']); + if (isset($triples['http://www.geonames.org/ontology#featureClass'])) unset($triples['http://www.geonames.org/ontology#featureClass']); + if (isset($triples['http://dbpedia.org/property/dmozProperty'])) unset($triples['http://dbpedia.org/property/dmozProperty']); + if (isset($triples['http://dbpedia.org/property/color'])) unset($triples['http://dbpedia.org/property/color']); + if (isset($triples['http://dbpedia.org/property/imageCaption'])) unset($triples['http://dbpedia.org/property/imageCaption']); + if (isset($triples['http://dbpedia.org/property/name'])) unset($triples['http://dbpedia.org/property/name']); + if (isset($triples['http://dbpedia.org/property/audioIpaProperty'])) unset($triples['http://dbpedia.org/property/audioIpaProperty']); + if (isset($subjecttriples['http://dbpedia.org/property/redirect'])) unset($subjecttriples['http://dbpedia.org/property/redirect']); + if (isset($triples['http://dbpedia.org/property/audioDeProperty'])) unset($triples['http://dbpedia.org/property/audioDeProperty']); + if (isset($triples['http://dbpedia.org/property/art'])) unset($triples['http://dbpedia.org/property/art']); + if (isset($subjecttriples['http://dbpedia.org/property/babAsProperty'])) unset($subjecttriples['http://dbpedia.org/property/babAsProperty']); + if (isset($triples['http://dbpedia.org/property/babAsProperty'])) unset($triples['http://dbpedia.org/property/babAsProperty']); + if (isset($triples['http://dbpedia.org/property/imageWidth'])) unset($triples['http://dbpedia.org/property/imageWidth']); + if (isset($triples['http://dbpedia.org/property/rangeMapWidth'])) unset($triples['http://dbpedia.org/property/rangeMapWidth']); + if (isset($triples['http://dbpedia.org/property/rangeMapCaption'])) unset($triples['http://dbpedia.org/property/rangeMapCaption']); + if (isset($subjecttriples['http://dbpedia.org/property/nihongoProperty'])) unset($subjecttriples['http://dbpedia.org/property/nihongoProperty']); + if (isset($triples['http://dbpedia.org/property/shortDescription'])) unset($triples['http://dbpedia.org/property/shortDescription']); + if (isset($triples['http://dbpedia.org/property/refLabelProperty'])) unset($triples['http://dbpedia.org/property/refLabelProperty']); + if (isset($triples['http://dbpedia.org/property/noteLabelProperty'])) unset($triples['http://dbpedia.org/property/noteLabelProperty']); + if (isset($triples['http://dbpedia.org/property/wikisourcelangProperty'])) unset($triples['http://dbpedia.org/property/wikisourcelangProperty']); if (count($triples)>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); + $content .= get_triple_table($triples,$subjecttriples); } //Restart the Session Modified: trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php 2008-09-23 10:46:20 UTC (rev 1241) +++ trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php 2008-09-23 18:35:57 UTC (rev 1242) @@ -3,20 +3,25 @@ include_once('Settings.php'); include_once('DatabaseConnection.php'); - $manchester=html_entity_decode($_POST['manchester']); $kb=html_entity_decode($_POST['kb']); $number=$_POST['number']; - $label=$_POST['label']; - + session_start(); $id=$_SESSION['id']; $ksID=$_SESSION['ksID']; + //write last action into session + $actionuri=urlencode($kb); + $_SESSION['lastAction']='searchConceptInstances/'.$actionuri; session_write_close(); setRunning($id,"true"); - $test=preg_match("/^([\(]*http:\/\/dbpedia\.org\/class\/yago\/[^\040]+[\)]*(\040(AND|OR)\040)?)+$/",$manchester); + require_once("DLLearnerConnection.php"); + $sc=new DLLearnerConnection($id,$ksID); + $label=$sc->getNaturalDescription($kb); + $test=preg_match("/^([\(]*\"http:\/\/dbpedia\.org\/class\/yago\/[^\040]+\"[\)]*(\040(AND|OR)\040)?)+$/",$kb); + $content=""; if ($test){ //connect to the database @@ -25,24 +30,24 @@ $databaseConnection->connect($settings->database_server,$settings->database_user,$settings->database_pass); $databaseConnection->select_database($settings->database_name); - preg_match_all("/http:\/\/dbpedia\.org\/class\/yago\/[^\040()]+/",$manchester,$treffer,PREG_OFFSET_CAPTURE); + preg_match_all("/\"http:\/\/dbpedia\.org\/class\/yago\/[^\040()]+\"/",$kb,$treffer,PREG_OFFSET_CAPTURE); $final=''; $i=1; $pos=0; foreach ($treffer[0] as $tref){ - $final.=substr($manchester,$pos,$tref[1]-$pos).'('; - $category=substr($manchester,$tref[1],strlen($tref[0])); - $query='SELECT child FROM classhierarchy WHERE father=\''.$category.'\''; + $final.=substr($kb,$pos,$tref[1]-$pos).'('; + $category=substr($kb,$tref[1],strlen($tref[0])); + $query='SELECT child FROM classhierarchy WHERE father='.$category.''; $res=$databaseConnection->query($query); while ($result=$databaseConnection->nextEntry($res)){ - $final.='cat'.$i.'.category=\''.$result['child'].'\' OR '; + $final.='cat'.$i.'.category="'.$result['child'].'" OR '; } - $final.='cat'.$i.'.category=\''.$category.'\')'; + $final.='cat'.$i.'.category='.$category.')'; $i++; $pos=$tref[1]+strlen($tref[0]); } - $final.=substr($manchester,$pos); + $final.=substr($kb,$pos); $temp='SELECT cat1.name FROM '; for ($j=0;$j<$i-1;$j++) if ($j!=$i-2) $temp.='articlecategories as cat'.($j+1).','; @@ -65,7 +70,7 @@ $result2=$databaseConnection->nextEntry($res2); $labels[]=$result2['label']; } - $content.=getConceptResultsTable($names,$labels,htmlentities($manchester),htmlentities($kb),$label,$number); + $content.=getConceptResultsTable($names,$labels,htmlentities($kb),$label,$number); $bestsearches=getBestSearches($names,$labels); } else Modified: trunk/src/dbpedia-navigator/ajax_learn_concepts.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-09-23 10:46:20 UTC (rev 1241) +++ trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-09-23 18:35:57 UTC (rev 1242) @@ -30,7 +30,7 @@ $concept.="<tr><td>You could also be interested in articles matching these descriptions:</td></tr>"; foreach ($concepts as $con){ $label=$sc->getNaturalDescription($con['descriptionKBSyntax']); - $concept.="<tr><td><a href=\"\" onclick=\"getSubjectsFromConcept('manchester=".htmlentities($con['descriptionManchesterSyntax'])."&kb=".htmlentities($con['descriptionKBSyntax'])."&label=".$label."&number=10');return false;\" />".$label."</a> (Accuracy: ".(floatVal($con['accuracy'])*100)."%)</td></tr>"; + $concept.="<tr><td><a href=\"\" onclick=\"getSubjectsFromConcept('kb=".htmlentities($con['descriptionKBSyntax'])."&number=10');return false;\" />".$label."</a> (Accuracy: ".(floatVal($con['accuracy'])*100)."%)</td></tr>"; } $concept.="</table>"; } Modified: trunk/src/dbpedia-navigator/helper_functions.php =================================================================== --- trunk/src/dbpedia-navigator/helper_functions.php 2008-09-23 10:46:20 UTC (rev 1241) +++ trunk/src/dbpedia-navigator/helper_functions.php 2008-09-23 18:35:57 UTC (rev 1242) @@ -10,10 +10,11 @@ $subject=ucfirst($subject); //replace spaces with _ $subject=str_replace(' ','_',$subject); + $subject=urlencode($subject); //add the uri $subject="http://dbpedia.org/resource/".$subject; - return urldecode($subject); + return $subject; } function getTagCloud($tags,$label) @@ -104,6 +105,9 @@ $string=str_replace("u00F6","ö",$string); $string=str_replace("u00FC","ü",$string); $string=str_replace("u0161","š",$string); + $string=str_replace("u00FA","ú",$string); + $string=str_replace("u00F0","ð",$string); + $string=str_replace("u00E6","æ",$string); return $string; } @@ -150,11 +154,11 @@ return $ret; } -function getConceptResultsTable($names,$labels,$manchester,$kb,$label,$number) +function getConceptResultsTable($names,$labels,$kb,$label,$number) { $ret="<p>These are your results. Show best "; for ($k=10;$k<125;){ - $ret.="<a href=\"#\" onclick=\"getSubjectsFromConcept('manchester=".$manchester."&kb=".$kb."&label=".$label."number=".$k."');return false;\""; + $ret.="<a href=\"#\" onclick=\"getSubjectsFromConcept('kb=".$kb."&number=".$k."');return false;\""; if ($k==$number) $ret.=" style=\"text-decoration:none;\""; else $ret.=" style=\"text-decoration:underline;\""; $ret.=">".($k)."</a>"; @@ -220,9 +224,9 @@ fclose($file); } -function get_triple_table($triples) { +function get_triple_table($triples,$subjecttriples) { - $table = '<table border="0"><tr><td><b>Predicate</b></td><td><b>Object</b></td></tr>'; + $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); @@ -231,30 +235,77 @@ $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 ($number>1) $table.='<li>'; + 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\');return false;">'.urldecode($label).'</a>'; if ($number>1) $table.='</li>'; } else{ - if ($number>1) $table.='<li>'; - $table .= '<a href="'.$element['value'].'" target="_blank">'.urldecode($element['value']).'</a>'; + 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>'; + 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; } + 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\');return false;">'.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>'; return $table; } @@ -367,7 +418,7 @@ $ret.='<tr style="height:20px"><td><hr/></td></tr>'; $ret.='<tr><td style="font-size:14px;"><b>Current class</b></td></tr>'; $ret.='<tr style="height:10px"><td></td></tr>'; - $ret.='<tr><td><b>'.$title.'</b></td></tr>'; + $ret.='<tr><td><b>'.$title.'</b> ('.urldecode(str_replace("_"," ",substr (strrchr ($class, "/"), 1))).')</td></tr>'; $ret.='<tr style="height:10px"><td></td></tr>'; $ret.='<tr><td>'; $ret.='<input style="width:70px" type="button" value="Instances" class="button" onclick="getSubjectsFromCategory(\'category='.$class.'&number=10\');" title="Search Instances of Shown class."/>'; Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-09-23 10:46:20 UTC (rev 1241) +++ trunk/src/dbpedia-navigator/index.php 2008-09-23 18:35:57 UTC (rev 1242) @@ -21,6 +21,7 @@ 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');"; else if (isset($_SESSION['currentArticle'])){ $onLoad.="get_article('label=&cache=".$_SESSION['currentArticle']."');"; } @@ -75,7 +76,7 @@ </div> <!-- box --> <div class="box" id="SearchResultBox" style="display:none"> - <div class="boxtitle" style="cursor:help;" title="The best 10 Search Results are shown here.">Search Results</div> + <div class="boxtitle" style="cursor:help;" title="The best 10 Search Results are shown here.">Best Search Results</div> <div class="boxcontent"> <div id="searchcontent" style="display:block"></div> </div> <!-- boxcontent --> Modified: trunk/src/dbpedia-navigator/js/navigator.js =================================================================== --- trunk/src/dbpedia-navigator/js/navigator.js 2008-09-23 10:46:20 UTC (rev 1241) +++ trunk/src/dbpedia-navigator/js/navigator.js 2008-09-23 18:35:57 UTC (rev 1242) @@ -60,4 +60,22 @@ else sitenumbers[i].style.display='inline'; } -} \ No newline at end of file +} + +function toggleAttributes(element) +{ + var list=element.parentNode.getElementsByTagName('li'); + if (element.innerHTML.match('hide'+'$')=='hide'){ + element.innerHTML='<img src="images/arrow_down.gif"> show'; + for (var i=3;i<list.length;i++) + list[i].style.display='none'; + } + else { + element.innerHTML='<img src="images/arrow_up.gif"> hide'; + for (var i=3;i<list.length;i++) + list[i].style.display='list-item'; + } +} + +function none() +{} \ 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-09-24 08:45:26
|
Revision: 1247 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1247&view=rev Author: sknappe Date: 2008-09-24 08:45:14 +0000 (Wed, 24 Sep 2008) Log Message: ----------- some changes when stopping algorithm Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/Settings.php trunk/src/dbpedia-navigator/ajax_get_article.php trunk/src/dbpedia-navigator/ajax_learn_concepts.php trunk/src/dbpedia-navigator/index.php trunk/src/dbpedia-navigator/js/ajax.js trunk/src/dbpedia-navigator/js/navigator.js Added Paths: ----------- trunk/src/dbpedia-navigator/images/spinner.gif Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-09-24 08:09:38 UTC (rev 1246) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-09-24 08:45:14 UTC (rev 1247) @@ -70,7 +70,15 @@ $start = microtime(true); $this->client->initAll($this->id); - + + //look, if algorithm was stopped + $file=fopen("./temp/".$this->id.".temp","r"); + $run=fgets($file); + fclose($file); + if ($run=="false"){ + return array(); + } + $threaded=true; if($threaded == false) { @@ -102,12 +110,13 @@ fclose($file); if ($run=="false"){ $this->client->stop($this->id); - throw new Exception("Learning stopped"); + return json_decode($this->client->getCurrentlyBestEvaluatedDescriptions($this->id,3),true); } } while($seconds<$this->learnttl&&$running); - $this->client->stop($this->id); + if ($running) $this->client->stop($this->id); } + //return $concepts->item; return json_decode($this->client->getCurrentlyBestEvaluatedDescriptions($this->id,3),true); } @@ -170,7 +179,7 @@ return $result; } - $seconds = $i * $sleeptime; + $microseconds = $i * $sleeptime; $i++; //look, if algorithm was stopped $file=fopen("./temp/".$this->id.".temp","r"); @@ -180,7 +189,7 @@ $this->client->stopSparqlThread($this->id,$queryID); throw new Exception("Query stopped"); } - } while($seconds<$this->ttl); + } while($microseconds<$this->ttl); $this->client->stopSparqlThread($this->id,$queryID); } Modified: trunk/src/dbpedia-navigator/Settings.php =================================================================== --- trunk/src/dbpedia-navigator/Settings.php 2008-09-24 08:09:38 UTC (rev 1246) +++ trunk/src/dbpedia-navigator/Settings.php 2008-09-24 08:45:14 UTC (rev 1247) @@ -37,7 +37,7 @@ // public $dbpediauri='http://dbpedia2.openlinksw.com:8890/isparql'; // in mikrosekunden public $sparqlttl=60000000; - public $learnttl=60000000; + public $learnttl=10; public $language="en"; Modified: trunk/src/dbpedia-navigator/ajax_get_article.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_article.php 2008-09-24 08:09:38 UTC (rev 1246) +++ trunk/src/dbpedia-navigator/ajax_get_article.php 2008-09-24 08:45:14 UTC (rev 1247) @@ -265,10 +265,10 @@ if (isset($triples['http://dbpedia.org/property/imagesize'])) unset($triples['http://dbpedia.org/property/imagesize']); if (isset($triples['http://dbpedia.org/property/id'])) unset($triples['http://dbpedia.org/property/id']); if (isset($triples['http://dbpedia.org/property/issue'])) unset($triples['http://dbpedia.org/property/issue']); - if (isset($triples['http://dbpedia.org/property/hips'][0]['type']=='uri')) unset($triples['http://dbpedia.org/property/hips']); - if (isset($triples['http://dbpedia.org/property/weight'][0]['type']=='uri')) unset($triples['http://dbpedia.org/property/weight']); - if (isset($triples['http://dbpedia.org/property/waist'][0]['type']=='uri')) unset($triples['http://dbpedia.org/property/waist']); - if (isset($triples['http://dbpedia.org/property/height'][0]['type']=='uri')) unset($triples['http://dbpedia.org/property/height']); + if (isset($triples['http://dbpedia.org/property/hips'])&&$triples['http://dbpedia.org/property/hips'][0]['type']=='uri') unset($triples['http://dbpedia.org/property/hips']); + if (isset($triples['http://dbpedia.org/property/weight'])&&$triples['http://dbpedia.org/property/weight'][0]['type']=='uri') unset($triples['http://dbpedia.org/property/weight']); + if (isset($triples['http://dbpedia.org/property/waist'])&&$triples['http://dbpedia.org/property/waist'][0]['type']=='uri') unset($triples['http://dbpedia.org/property/waist']); + if (isset($triples['http://dbpedia.org/property/height'])&&$triples['http://dbpedia.org/property/height'][0]['type']=='uri') unset($triples['http://dbpedia.org/property/height']); if (isset($triples['http://www.geonames.org/ontology#featureCode'])) unset($triples['http://www.geonames.org/ontology#featureCode']); if (isset($triples['http://www.geonames.org/ontology#featureClass'])) unset($triples['http://www.geonames.org/ontology#featureClass']); if (isset($triples['http://dbpedia.org/property/dmozProperty'])) unset($triples['http://dbpedia.org/property/dmozProperty']); @@ -328,8 +328,7 @@ } catch (Exception $e) { - $content=$e->getMessage(); - $artTitle="Article not found"; + $content="-"; } } else { Modified: trunk/src/dbpedia-navigator/ajax_learn_concepts.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-09-24 08:09:38 UTC (rev 1246) +++ trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-09-24 08:45:14 UTC (rev 1247) @@ -1,4 +1,6 @@ <?php + ini_set('max_execution_time',200); + include('helper_functions.php'); session_start(); Property changes on: trunk/src/dbpedia-navigator/images/spinner.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-09-24 08:09:38 UTC (rev 1246) +++ trunk/src/dbpedia-navigator/index.php 2008-09-24 08:45:14 UTC (rev 1247) @@ -55,7 +55,7 @@ <div id="conceptlink" style="display:block"></div> </div> <!-- boxcontent --> </div> <!-- box --> -</td><td width="19%" style="text-align:center"><span id="Loading" style="display:none;font-weight:bold;color:#ff0000;">Server Call... <a href=""><img src="images/remove.png" onclick="stopServerCall();return false;" /></a></span></td></tr></table></div> +</td><td width="19%" style="text-align:center"><span id="Loading" style="display:none;font-weight:bold;color:#ff0000;">Server Call... <a href=""><img src="images/remove.png" onclick="stopServerCall();return false;" /></a></span><span id="DatabaseLoading" style="display:none;font-weight:bold;color:#ff0000;">Database Call... <a href=""><img src="images/spinner.gif"/></a></span></td></tr></table></div> <div id="layer" style="display:none"> <div id="layerContent" style="display:none"></div> </div> Modified: trunk/src/dbpedia-navigator/js/ajax.js =================================================================== --- trunk/src/dbpedia-navigator/js/ajax.js 2008-09-24 08:09:38 UTC (rev 1246) +++ trunk/src/dbpedia-navigator/js/ajax.js 2008-09-24 08:45:14 UTC (rev 1247) @@ -1,5 +1,6 @@ function search_it(param) { + setDatabaseRunning(true); if (document.all){ //IE var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); @@ -22,6 +23,9 @@ document.getElementById('SearchResultBox').style.display='block'; } } + if (XhrObj.readyState == 4){ + setDatabaseRunning(false); + } } XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); @@ -44,23 +48,26 @@ XhrObj.onreadystatechange = function() { + if (XhrObj.readyState == 4) + setRunning(false); if (XhrObj.readyState == 4 && XhrObj.status == 200){ var response = XhrObj.responseText.split('$$$'); - document.getElementById('articlecontent').innerHTML=response[0]; - document.getElementById('ArticleTitle').innerHTML=response[1]; - document.getElementById('lastarticles').innerHTML=response[2]; - document.getElementById('Positives').innerHTML=response[3]; - document.getElementById('Negatives').innerHTML=response[4]; - setRunning(false); - if (response[5].length>0&&response[6].length>0) - loadGoogleMap(response[5],response[6],''+response[1]); - if (response[1]=='Article not found'){ - setTimeout("search_it('label='+document.getElementById('label').value+'&number=10')",2000); - } - else - document.getElementById('LastArticlesBox').style.display='block'; - learnConcept(); - } + if (response[0]!='-'){ + document.getElementById('articlecontent').innerHTML=response[0]; + document.getElementById('ArticleTitle').innerHTML=response[1]; + document.getElementById('lastarticles').innerHTML=response[2]; + document.getElementById('Positives').innerHTML=response[3]; + document.getElementById('Negatives').innerHTML=response[4]; + if (response[5].length>0&&response[6].length>0) + loadGoogleMap(response[5],response[6],''+response[1]); + if (response[1]=='Article not found') + setTimeout("search_it('label='+document.getElementById('label').value+'&number=10')",2000); + else { + document.getElementById('LastArticlesBox').style.display='block'; + learnConcept(); + } + } + } } XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); @@ -69,6 +76,7 @@ function get_class(param) { + setDatabaseRunning(true); if (document.all){ //IE var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); @@ -89,6 +97,8 @@ document.getElementById('lastclasses').innerHTML=response[2]; document.getElementById('LastClassesBox').style.display='block'; } + if (XhrObj.readyState == 4) + setDatabaseRunning(false); } XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); @@ -114,6 +124,7 @@ var response = XhrObj.responseText.split('$$$'); document.getElementById('Positives').innerHTML=response[0]; document.getElementById('Negatives').innerHTML=response[1]; + learnConcept(); } } @@ -140,6 +151,7 @@ var response = XhrObj.responseText.split('$$$'); document.getElementById('Positives').innerHTML=response[0]; document.getElementById('Negatives').innerHTML=response[1]; + learnConcept(); } } @@ -188,6 +200,7 @@ { if (XhrObj.readyState == 4 && XhrObj.status == 200){ document.getElementById('Negatives').innerHTML = XhrObj.responseText; + learnConcept(); } } @@ -214,6 +227,7 @@ var response = XhrObj.responseText.split('$$$'); document.getElementById('Positives').innerHTML=response[0]; document.getElementById('Negatives').innerHTML=response[1]; + learnConcept(); } } @@ -240,6 +254,7 @@ var response = XhrObj.responseText.split('$$$'); document.getElementById('Positives').innerHTML=response[0]; document.getElementById('Negatives').innerHTML=response[1]; + learnConcept(); } } @@ -263,12 +278,14 @@ XhrObj.onreadystatechange = function() { + if (XhrObj.readyState == 4){ + setRunning(false); + } if (XhrObj.readyState == 4 && XhrObj.status == 200){ if (XhrObj.responseText!='-'){ document.getElementById('conceptlink').innerHTML=XhrObj.responseText; document.getElementById('ConceptBox').style.display='block'; } - setRunning(false); } } @@ -292,6 +309,7 @@ XhrObj.onreadystatechange = function() { if (XhrObj.readyState == 4 && XhrObj.status == 200){ + setRunning(false); } } @@ -331,6 +349,7 @@ function getSubjectsFromCategory(param) { + setDatabaseRunning(true); if (document.all){ //IE var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); @@ -353,6 +372,8 @@ document.getElementById('SearchResultBox').style.display='block'; } } + if (XhrObj.readyState == 4) + setDatabaseRunning(false); } XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); Modified: trunk/src/dbpedia-navigator/js/navigator.js =================================================================== --- trunk/src/dbpedia-navigator/js/navigator.js 2008-09-24 08:09:38 UTC (rev 1246) +++ trunk/src/dbpedia-navigator/js/navigator.js 2008-09-24 08:45:14 UTC (rev 1247) @@ -3,6 +3,12 @@ if (running) document.getElementById('Loading').style.display='inline'; else document.getElementById('Loading').style.display='none'; } + +function setDatabaseRunning(running) +{ + if (running) document.getElementById('DatabaseLoading').style.display='inline'; + else document.getElementById('DatabaseLoading').style.display='none'; +} function loadGoogleMap(Lat,Lng,Label) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-09-24 11:52:34
|
Revision: 1252 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1252&view=rev Author: sknappe Date: 2008-09-24 11:52:27 +0000 (Wed, 24 Sep 2008) Log Message: ----------- little changes to get more descriptions Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/Settings.php Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-09-24 11:49:47 UTC (rev 1251) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-09-24 11:52:27 UTC (rev 1252) @@ -110,7 +110,7 @@ fclose($file); if ($run=="false"){ $this->client->stop($this->id); - return json_decode($this->client->getCurrentlyBestEvaluatedDescriptions($this->id,3),true); + return json_decode($this->client->getCurrentlyBestEvaluatedDescriptionsFiltered($this->id,3,0.8,true),true); } } while($seconds<$this->learnttl&&$running); @@ -118,7 +118,7 @@ } //return $concepts->item; - return json_decode($this->client->getCurrentlyBestEvaluatedDescriptions($this->id,3),true); + return json_decode($this->client->getCurrentlyBestEvaluatedDescriptionsFiltered($this->id,3,0.8,true),true); } function getNaturalDescription($concept) Modified: trunk/src/dbpedia-navigator/Settings.php =================================================================== --- trunk/src/dbpedia-navigator/Settings.php 2008-09-24 11:49:47 UTC (rev 1251) +++ trunk/src/dbpedia-navigator/Settings.php 2008-09-24 11:52:27 UTC (rev 1252) @@ -37,7 +37,7 @@ // public $dbpediauri='http://dbpedia2.openlinksw.com:8890/isparql'; // in mikrosekunden public $sparqlttl=60000000; - public $learnttl=10; + public $learnttl=5; public $language="en"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-09-24 13:36:52
|
Revision: 1254 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1254&view=rev Author: sknappe Date: 2008-09-24 13:36:46 +0000 (Wed, 24 Sep 2008) Log Message: ----------- worked on getting instances from concepts, should now work for some more concepts, still some are missing (some with NOT and ALL,...) Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/ajax_get_article.php trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php trunk/src/dbpedia-navigator/helper_functions.php Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-09-24 13:35:30 UTC (rev 1253) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-09-24 13:36:46 UTC (rev 1254) @@ -150,11 +150,9 @@ if (count($result['results']['bindings'])==0) throw new Exception("An article with that name does not exist. The Search is started ..."); $ret=array(); foreach ($result['results']['bindings'] as $results){ - if (isset($results['obj'])) $value=$results['obj']; - else if (isset($results['sub'])) $value=$results['sub']; - if (!(isset($value['xml:lang'])&&($value['xml:lang']!=$this->lang))){ - if (isset($results['obj'])) $ret[0][$results['pred']['value']][]=$value; - else if (isset($results['sub'])) $ret[1][$results['pred']['value']][]=$value; + if (!(isset($results['xml:lang'])&&($results['xml:lang']!=$this->lang))){ + if (isset($results['obj'])) $ret[0][$results['pred']['value']][]=$results['obj']; + else if (isset($results['sub'])) $ret[1][$results['pred']['value']][]=$results['sub']; } } @@ -258,9 +256,9 @@ return $return; }*/ - function getSubjectsFromConcept($concept) + function getSubjectsFromConcept($concept,$number) { - $query=$this->client->SparqlRetrieval($concept); + $query=$this->client->SparqlRetrieval($concept,$number); $result=json_decode($this->getSparqlResultThreaded($query),true); if (count($result['results']['bindings'])==0) throw new Exception("Your query brought no result."); $ret=array(); Modified: trunk/src/dbpedia-navigator/ajax_get_article.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_article.php 2008-09-24 13:35:30 UTC (rev 1253) +++ trunk/src/dbpedia-navigator/ajax_get_article.php 2008-09-24 13:36:46 UTC (rev 1254) @@ -49,7 +49,7 @@ $alltriples=$sc->getTriples($uri); $triples=$alltriples[0]; $subjecttriples=$alltriples[1]; - + //BUILD ARTICLE // goal: display the data in a nice (DBpedia specific way), maybe similar to // dbpedia.org/search @@ -294,7 +294,7 @@ $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); + $content .= get_triple_table($triples,$subjecttriples,$predicatelabels); } //Restart the Session Modified: trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php 2008-09-24 13:35:30 UTC (rev 1253) +++ trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php 2008-09-24 13:36:46 UTC (rev 1254) @@ -19,17 +19,16 @@ require_once("DLLearnerConnection.php"); $sc=new DLLearnerConnection($id,$ksID); $label=$sc->getNaturalDescription($kb); + //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); $test=preg_match("/^([\(]*\"http:\/\/dbpedia\.org\/class\/yago\/[^\040]+\"[\)]*(\040(AND|OR)\040)?)+$/",$kb); $content=""; if ($test){ - //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); - preg_match_all("/\"http:\/\/dbpedia\.org\/class\/yago\/[^\040()]+\"/",$kb,$treffer,PREG_OFFSET_CAPTURE); $final=''; @@ -70,21 +69,35 @@ $result2=$databaseConnection->nextEntry($res2); $labels[]=$result2['label']; } - $content.=getConceptResultsTable($names,$labels,htmlentities($kb),$label,$number); + $content.=getConceptResultsTable($names,$labels,htmlentities($kb),$number); $bestsearches=getBestSearches($names,$labels); } else $content.="Your Search brought no results."; } else{ - /*try{ - require_once("DLLearnerConnection.php"); - $sc=new DLLearnerConnection($id,$ksID); - $subjects=$sc->getSubjectsFromConcept($concept); - $content.=getResultsTable($subjects); + try{ + $subjects=$sc->getSubjectsFromConcept($kb,$number); + $names=array(); + $labels=array(); + foreach ($subjects as $subject){ + $query='SELECT number, label FROM rank WHERE name="'.$subject.'"'; + $res=$databaseConnection->query($query); + $result=$databaseConnection->nextEntry($res); + $names[]=$result['number'].'<'.$subject; + $labels[]=$result['number'].$subject.'<'.$result['label']; + } + rsort($labels); + rsort($names); + for ($i=0;$i<count($names);$i++){ + $labels[$i]=substr($labels[$i],strpos($labels[$i],'<')+1); + $names[$i]=substr($names[$i],strpos($names[$i],'<')+1); + } + $content.=getConceptResultsTable($names,$labels,htmlentities($kb),$number); + $bestsearches=getBestSearches($names,$labels); } catch (Exception $e){ $content=$e->getMessage(); - }*/ + } } print $content; Modified: trunk/src/dbpedia-navigator/helper_functions.php =================================================================== --- trunk/src/dbpedia-navigator/helper_functions.php 2008-09-24 13:35:30 UTC (rev 1253) +++ trunk/src/dbpedia-navigator/helper_functions.php 2008-09-24 13:36:46 UTC (rev 1254) @@ -154,7 +154,7 @@ return $ret; } -function getConceptResultsTable($names,$labels,$kb,$label,$number) +function getConceptResultsTable($names,$labels,$kb,$number) { $ret="<p>These are your results. Show best "; for ($k=10;$k<125;){ @@ -224,7 +224,7 @@ fclose($file); } -function get_triple_table($triples,$subjecttriples) { +function get_triple_table($triples,$subjecttriples,$predicateLabels) { $table = '<table border="0" style="width:100%;overflow:hidden"><tr><td><b>Predicate</b></td><td><b>Object/Subject</b></td></tr>'; $i=1; @@ -313,15 +313,15 @@ function nicePredicate($predicate) { if (strripos ($predicate, "#")>strripos ($predicate, "/")){ - $namespace=substr ($predicate,0,strripos ($predicate, "#")); + //$namespace=substr ($predicate,0,strripos ($predicate, "#")); $name=substr ($predicate,strripos ($predicate, "#")+1); } else{ - $namespace=substr ($predicate,0,strripos ($predicate, "/")); + //$namespace=substr ($predicate,0,strripos ($predicate, "/")); $name=substr ($predicate,strripos ($predicate, "/")+1); } - switch ($namespace){ + /*switch ($namespace){ case "http://www.w3.org/2000/01/rdf-schema": $namespace="rdfs"; break; case "http://www.w3.org/2002/07/owl": $namespace="owl"; @@ -336,11 +336,15 @@ break; case "http://www.georss.org/georss/point": $namespace="georss"; break; - } + }*/ - //fl\xE4che has strange url - $name=str_replace('fl_percent_C3_percent_A4che','fl%C3%A4che',$name); - return $namespace.':'.urldecode($name); + //change urls with \xE4,\xF6,\xFC + $name=str_replace('_percent_C3_percent_A4','%C3%A4',$name); + $name=str_replace('_percent_C3_percent_B6','%C3%B6',$name); + $name=str_replace('_percent_C3_percent_BC','%C3%BC',$name); + $name=str_replace('_',' ',$name); + + return urldecode($name); } function formatClassArray($ar) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-09-26 12:22:21
|
Revision: 1266 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1266&view=rev Author: sknappe Date: 2008-09-26 12:22:02 +0000 (Fri, 26 Sep 2008) Log Message: ----------- you can choose which predefined endpoint to use Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/Settings.php Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-09-26 11:24:05 UTC (rev 1265) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-09-26 12:22:02 UTC (rev 1266) @@ -14,6 +14,7 @@ private $lang; // private $client; + private $endpoint; // ID given to this client by the web service private $id; @@ -30,6 +31,7 @@ $this->learnttl=$settings->learnttl; $this->lang=$settings->language; $this->DBPediaUrl=$settings->dbpediauri; + $this->endpoint=$settings->endpoint; $this->client=new SoapClient("main.wsdl",array('features' => SOAP_SINGLE_ELEMENT_ARRAYS)); $this->id=$id; $this->ksID=$ksID; @@ -49,7 +51,7 @@ $this->client->applyConfigEntryInt($this->id, $this->ksID, "recursionDepth",1); $this->client->applyConfigEntryString($this->id, $this->ksID, "predefinedFilter", "DBPEDIA-NAVIGATOR"); - $this->client->applyConfigEntryString($this->id, $this->ksID, "predefinedEndpoint", "DBPEDIA"); + $this->client->applyConfigEntryString($this->id, $this->ksID, "predefinedEndpoint", $this->endpoint); $this->client->applyConfigEntryString($this->id, $this->ksID, "predefinedManipulator", "DBPEDIA-NAVIGATOR"); $this->client->applyConfigEntryBoolean($this->id, $this->ksID, "useCache", $settings->useCache); if(empty($negExamples)){ Modified: trunk/src/dbpedia-navigator/Settings.php =================================================================== --- trunk/src/dbpedia-navigator/Settings.php 2008-09-26 11:24:05 UTC (rev 1265) +++ trunk/src/dbpedia-navigator/Settings.php 2008-09-26 12:22:02 UTC (rev 1266) @@ -34,7 +34,13 @@ // public DBpedia SPARQL endpoint public $dbpediauri='http://dbpedia.openlinksw.com:8890/sparql'; // public DBpedia mirror - // public $dbpediauri='http://dbpedia2.openlinksw.com:8890/isparql'; + // public $dbpediauri='http://dbpedia2.openlinksw.com:8890/isparql'; + + //which predefined Endpoint to use + public $endpoint="DBPEDIA"; + //public $endpoint="LOCALDBPEDIA"; + + // in mikrosekunden public $sparqlttl=60000000; public $learnttl=5; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-09-29 17:31:27
|
Revision: 1307 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1307&view=rev Author: sknappe Date: 2008-09-29 17:31:12 +0000 (Mon, 29 Sep 2008) Log Message: ----------- bugfix Modified Paths: -------------- trunk/src/dbpedia-navigator/ajax_generate_URL.php trunk/src/dbpedia-navigator/htaccess.dist Modified: trunk/src/dbpedia-navigator/ajax_generate_URL.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_generate_URL.php 2008-09-29 17:11:38 UTC (rev 1306) +++ trunk/src/dbpedia-navigator/ajax_generate_URL.php 2008-09-29 17:31:12 UTC (rev 1307) @@ -36,5 +36,5 @@ $url='http://'.$_SERVER['HTTP_HOST'].'/dbpedia-navigator/'.$last_action.$attributes; - print $url.'<br/><br/>'; + print '<a href="'.$url.'">'.$url.'</a><br/><br/>'; ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/htaccess.dist =================================================================== --- trunk/src/dbpedia-navigator/htaccess.dist 2008-09-29 17:11:38 UTC (rev 1306) +++ trunk/src/dbpedia-navigator/htaccess.dist 2008-09-29 17:31:12 UTC (rev 1307) @@ -5,7 +5,7 @@ # Rule Fuer die Module RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d -RewriteRule ^([^/]+)/([^/]+)$ index.php?$1=$2&path=../ +RewriteRule ^([^/]+)/([^/]+)$ index.php?$1=$2&%{QUERY_STRING} RewriteRule ^[^/]+/images/([^/]+)$ images/$1 RewriteRule ^[^/]+/css/([^/]+)$ css/$1 RewriteRule ^[^/]+/js/([^/]+)$ js/$1 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-09-30 08:56:13
|
Revision: 1313 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1313&view=rev Author: sknappe Date: 2008-09-30 08:56:01 +0000 (Tue, 30 Sep 2008) Log Message: ----------- minor changes and bugfixes Modified Paths: -------------- trunk/src/dbpedia-navigator/ajax_generate_URL.php trunk/src/dbpedia-navigator/helper_functions.php trunk/src/dbpedia-navigator/index.php trunk/src/dbpedia-navigator/js/ajax.js trunk/src/dbpedia-navigator/js/navigator.js Modified: trunk/src/dbpedia-navigator/ajax_generate_URL.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_generate_URL.php 2008-09-29 19:33:54 UTC (rev 1312) +++ trunk/src/dbpedia-navigator/ajax_generate_URL.php 2008-09-30 08:56:01 UTC (rev 1313) @@ -32,7 +32,7 @@ $attr[]='concept='.substr($last_action,strpos($last_action, "/")+1); $last_action='searchConceptInstances/Concept'; } - $attributes='?'.implode('&',$attr); + if (count($attr)>0) $attributes='?'.implode('&',$attr); $url='http://'.$_SERVER['HTTP_HOST'].'/dbpedia-navigator/'.$last_action.$attributes; Modified: trunk/src/dbpedia-navigator/helper_functions.php =================================================================== --- trunk/src/dbpedia-navigator/helper_functions.php 2008-09-29 19:33:54 UTC (rev 1312) +++ trunk/src/dbpedia-navigator/helper_functions.php 2008-09-30 08:56:01 UTC (rev 1313) @@ -49,7 +49,7 @@ function getResultsTable($names,$labels,$classes,$number) { - $ret="<p>These are your Searchresults. Show best "; + $ret="<p>These are the results of your search. Show best "; for ($k=10;$k<125;){ $ret.="<a href=\"#\" onclick=\"search_it('label='+document.getElementById('label').value+'&number=".$k."');return false;\""; if ($k==$number) $ret.=" style=\"text-decoration:none;\""; Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-09-29 19:33:54 UTC (rev 1312) +++ trunk/src/dbpedia-navigator/index.php 2008-09-30 08:56:01 UTC (rev 1313) @@ -16,7 +16,7 @@ //what happens onLoad $onLoad="onLoad=\"document.getElementById('label').focus();"; -if (isset($_GET['positives'])||isset($_GET['negatives'])) $onLoad.="setPositivesAndNegatives('positives=".$_GET['positives']."&negatives=".$_GET['negatives']."');"; +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');"; Modified: trunk/src/dbpedia-navigator/js/ajax.js =================================================================== --- trunk/src/dbpedia-navigator/js/ajax.js 2008-09-29 19:33:54 UTC (rev 1312) +++ trunk/src/dbpedia-navigator/js/ajax.js 2008-09-30 08:56:01 UTC (rev 1313) @@ -60,13 +60,11 @@ document.getElementById('Negatives').innerHTML=response[4]; if (response[5].length>0&&response[6].length>0) loadGoogleMap(response[5],response[6],''+response[1]); - if (response[1]=='Article not found') - setTimeout("search_it('label='+document.getElementById('label').value+'&number=10')",2000); else { document.getElementById('LastArticlesBox').style.display='block'; learnConcept(); } - } + }else setTimeout("search_it('label='+document.getElementById('label').value+'&number=10')",2000); } } Modified: trunk/src/dbpedia-navigator/js/navigator.js =================================================================== --- trunk/src/dbpedia-navigator/js/navigator.js 2008-09-29 19:33:54 UTC (rev 1312) +++ trunk/src/dbpedia-navigator/js/navigator.js 2008-09-30 08:56:01 UTC (rev 1313) @@ -61,7 +61,7 @@ for (var i=0;i<sitenumbers.length;i++){ if ((parseInt(sitenumbers[i].getElementsByTagName('a')[0].innerHTML)-1)*25==number) sitenumbers[i].getElementsByTagName('a')[0].style.textDecoration='none'; else sitenumbers[i].getElementsByTagName('a')[0].style.textDecoration='underline'; - if ((parseInt(sitenumbers[i].getElementsByTagName('a')[0].innerHTML)-1)*25>=j) + if ((parseInt(sitenumbers[i].getElementsByTagName('a')[0].innerHTML)-1)*25>=j||sitenumbers.length<2) sitenumbers[i].style.display='none'; else sitenumbers[i].style.display='inline'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-10-01 08:50:07
|
Revision: 1333 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1333&view=rev Author: sknappe Date: 2008-10-01 08:49:57 +0000 (Wed, 01 Oct 2008) Log Message: ----------- algorithm with ordering concepts is working now Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/ajax_learn_concepts.php Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-10-01 07:48:46 UTC (rev 1332) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-10-01 08:49:57 UTC (rev 1333) @@ -44,7 +44,7 @@ return array(0 => $id, 1 => $ksID); } - function getConceptFromExamples($posExamples,$negExamples) + function getConceptFromExamples($posExamples,$negExamples,$number) { require_once("Settings.php"); $settings=new Settings(); @@ -53,7 +53,7 @@ $this->client->applyConfigEntryString($this->id, $this->ksID, "predefinedFilter", "DBPEDIA-NAVIGATOR"); $this->client->applyConfigEntryString($this->id, $this->ksID, "predefinedEndpoint", $this->endpoint); $this->client->applyConfigEntryString($this->id, $this->ksID, "predefinedManipulator", "DBPEDIA-NAVIGATOR"); - $this->client->applyConfigEntryBoolean($this->id, $this->ksID, "useCache", $settings->useCache); + $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/"); $negExamples=$negExamples->item; @@ -69,6 +69,10 @@ $this->client->setNegativeExamples($this->id, $negExamples); $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->applyConfigEntryInt($this->id, $algorithmID, "valueFrequencyThreshold", 2); + $this->client->applyConfigEntryBoolean($this->id, $algorithmID, "useNegation", false); + $this->client->applyConfigEntryBoolean($this->id, $algorithmID, "useAllConstructor", false); $start = microtime(true); $this->client->initAll($this->id); @@ -112,7 +116,7 @@ fclose($file); if ($run=="false"){ $this->client->stop($this->id); - return json_decode($this->client->getCurrentlyBestEvaluatedDescriptionsFiltered($this->id,3,0.8,true),true); + return json_decode($this->client->getCurrentlyBestEvaluatedDescriptionsFiltered($this->id,$number,0.8,true),true); } } while($seconds<$this->learnttl&&$running); @@ -120,7 +124,7 @@ } //return $concepts->item; - return json_decode($this->client->getCurrentlyBestEvaluatedDescriptionsFiltered($this->id,3,0.8,true),true); + return json_decode($this->client->getCurrentlyBestEvaluatedDescriptionsFiltered($this->id,$number,0.8,true),true); } function getNaturalDescription($concept) Modified: trunk/src/dbpedia-navigator/ajax_learn_concepts.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-10-01 07:48:46 UTC (rev 1332) +++ trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-10-01 08:49:57 UTC (rev 1333) @@ -78,7 +78,7 @@ } } } - $groups[]=$noclass; + if (count($noclass)>0) $groups[]=$noclass; $problems=array(); foreach ($groups as $group){ $pos=array(); @@ -92,24 +92,29 @@ require_once("DLLearnerConnection.php"); $sc=new DLLearnerConnection($id, $ksID); + if (count($problems)==1) $number=3; + else if (count($problems)==2) $number=2; + else $number=1; try{ $concepts=array(); - foreach ($problems as $problem) - $concepts=array_merge($concepts,@$sc->getConceptFromExamples($problem['pos'],$problem['neg'])); - - + foreach ($problems as $problem){ + $concepts[]=@$sc->getConceptFromExamples($problem['pos'],$problem['neg'],$number); + } + if (count($concepts)>0){ $concept.="<table border=0>\n"; $concept.="<tr><td>You could also be interested in articles matching these descriptions:</td></tr>"; - foreach ($concepts as $con){ - $label=$sc->getNaturalDescription($con['descriptionKBSyntax']); - $concept.="<tr><td><a href=\"\" onclick=\"getSubjectsFromConcept('kb=".htmlentities($con['descriptionKBSyntax'])."&number=10');return false;\" />".$label."</a> (Accuracy: ".(floatVal($con['accuracy'])*100)."%)</td></tr>"; + foreach ($concepts as $conc){ + foreach ($conc as $con){ + $label=$sc->getNaturalDescription($con['descriptionKBSyntax']); + $concept.="<tr><td><a href=\"\" onclick=\"getSubjectsFromConcept('kb=".htmlentities($con['descriptionKBSyntax'])."&number=10');return false;\" />".$label."</a> (Accuracy: ".(floatVal($con['accuracy'])*100)."%)</td></tr>"; + } } $concept.="</table>"; } else $concept="-"; } catch(Exception $e){ - $concept.=$e->getMessage(); + $concept.="-"; } } else $concept="-"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-10-01 16:31:19
|
Revision: 1336 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1336&view=rev Author: sknappe Date: 2008-10-01 16:30:50 +0000 (Wed, 01 Oct 2008) Log Message: ----------- some cahnges Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/ajax_get_article.php trunk/src/dbpedia-navigator/ajax_learn_concepts.php trunk/src/dbpedia-navigator/helper_functions.php trunk/src/dbpedia-navigator/index.php trunk/src/dbpedia-navigator/js/ajax.js Added Paths: ----------- trunk/src/dbpedia-navigator/images/favicon.ico Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-10-01 13:04:47 UTC (rev 1335) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-10-01 16:30:50 UTC (rev 1336) @@ -71,6 +71,8 @@ $this->client->applyConfigEntryBoolean($this->id, $algorithmID, "forceRefinementLengthIncrease", true); $this->client->applyConfigEntryBoolean($this->id, $algorithmID, "useHasValueConstructor", true); $this->client->applyConfigEntryInt($this->id, $algorithmID, "valueFrequencyThreshold", 2); + $this->client->applyConfigEntryInt($this->id, $algorithmID, "guaranteeXgoodDescriptions", 3); + $this->client->applyConfigEntryInt($this->id, $algorithmID, "maxExecutionTimeInSeconds", 3); $this->client->applyConfigEntryBoolean($this->id, $algorithmID, "useNegation", false); $this->client->applyConfigEntryBoolean($this->id, $algorithmID, "useAllConstructor", false); $start = microtime(true); Modified: trunk/src/dbpedia-navigator/ajax_get_article.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_article.php 2008-10-01 13:04:47 UTC (rev 1335) +++ trunk/src/dbpedia-navigator/ajax_get_article.php 2008-10-01 16:30:50 UTC (rev 1336) @@ -108,12 +108,11 @@ $content.='</ul>'; } - // display a list of classes - $content.='<br/><hr><h4>YAGO Classes</h4><br/>'; - - - if(isset($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type'])) + if(isset($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type'])){ + // display a list of classes + $content.='<br/><hr><h4>YAGO Classes</h4><br/>'; $content .= '<p>'.formatClassArray($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type']).'</p>'; + } //skos-subjects //not used, because one class systems, YAGO, is enough Modified: trunk/src/dbpedia-navigator/ajax_learn_concepts.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-10-01 13:04:47 UTC (rev 1335) +++ trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-10-01 16:30:50 UTC (rev 1336) @@ -15,7 +15,7 @@ setRunning($id,"true"); $concept=""; $conceptinformation=""; - if (isset($positives)) + if (isset($positives)&&count($positives)>0) { $posArray=array(); foreach ($positives as $name=>$lab) @@ -107,7 +107,7 @@ foreach ($concepts as $conc){ foreach ($conc as $con){ $label=$sc->getNaturalDescription($con['descriptionKBSyntax']); - $concept.="<tr><td><a href=\"\" onclick=\"getSubjectsFromConcept('kb=".htmlentities($con['descriptionKBSyntax'])."&number=10');return false;\" />".$label."</a> (Accuracy: ".(floatVal($con['accuracy'])*100)."%)</td></tr>"; + $concept.="<tr><td><a href=\"\" onclick=\"getSubjectsFromConcept('kb=".htmlentities($con['descriptionKBSyntax'])."&number=10');return false;\" />".$label."</a> (accuracy: ".(floatVal($con['accuracy'])*100)."%)</td></tr>"; } } $concept.="</table>"; Modified: trunk/src/dbpedia-navigator/helper_functions.php =================================================================== --- trunk/src/dbpedia-navigator/helper_functions.php 2008-10-01 13:04:47 UTC (rev 1335) +++ trunk/src/dbpedia-navigator/helper_functions.php 2008-10-01 16:30:50 UTC (rev 1336) @@ -366,7 +366,12 @@ $query="SELECT label FROM categories WHERE category='".$ar[$i]['value']."' LIMIT 1"; $res=$databaseConnection->query($query); $result=$databaseConnection->nextEntry($res); - $string .= '<li>' . formatClass($ar[$i]['value'],$result['label']).'</li>'; + $label=urldecode(str_replace("_"," ",substr (strrchr ($ar[$i]['value'], "/"), 1))); + if (strlen($result['label'])>strlen($label)-3||preg_match('/[0-9]/',$label)===1){ + $label=$result['label']; + } + $label=utf8_to_html($label); + $string .= '<li>' . formatClass($ar[$i]['value'],$label).'</li>'; } return $string."</ul>"; } Property changes on: trunk/src/dbpedia-navigator/images/favicon.ico ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-10-01 13:04:47 UTC (rev 1335) +++ trunk/src/dbpedia-navigator/index.php 2008-10-01 16:30:50 UTC (rev 1336) @@ -145,7 +145,6 @@ </div><!-- wrapper --> <div id="footer"> <div id="generatedURL"></div> - <input type="button" class="button" value="generate URL" onclick="generateURL();"/> <p>Licensed under the GNU General Public License (GPL) 3 as part of the DL-Learner open source project.<br />Copyright © Jens Lehmann 2007-2008 </p> <div id="validation"> Modified: trunk/src/dbpedia-navigator/js/ajax.js =================================================================== --- trunk/src/dbpedia-navigator/js/ajax.js 2008-10-01 13:04:47 UTC (rev 1335) +++ trunk/src/dbpedia-navigator/js/ajax.js 2008-10-01 16:30:50 UTC (rev 1336) @@ -26,6 +26,7 @@ if (XhrObj.readyState == 4){ setDatabaseRunning(false); } + generateURL(); } XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); @@ -64,6 +65,7 @@ learnConcept(); }else setTimeout("search_it('label='+document.getElementById('label').value+'&number=10')",2000); } + generateURL(); } XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); @@ -95,6 +97,7 @@ } if (XhrObj.readyState == 4) setDatabaseRunning(false); + generateURL(); } XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); @@ -337,6 +340,7 @@ document.getElementById('SearchResultBox').style.display='block'; } } + generateURL(); } XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); @@ -370,6 +374,7 @@ } if (XhrObj.readyState == 4) setDatabaseRunning(false); + generateURL(); } XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-10-02 09:11:37
|
Revision: 1339 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1339&view=rev Author: sknappe Date: 2008-10-02 09:11:24 +0000 (Thu, 02 Oct 2008) Log Message: ----------- bugfixes Modified Paths: -------------- trunk/src/dbpedia-navigator/ajax_generate_URL.php trunk/src/dbpedia-navigator/ajax_get_article.php trunk/src/dbpedia-navigator/helper_functions.php trunk/src/dbpedia-navigator/js/ajax.js Modified: trunk/src/dbpedia-navigator/ajax_generate_URL.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_generate_URL.php 2008-10-02 05:10:43 UTC (rev 1338) +++ trunk/src/dbpedia-navigator/ajax_generate_URL.php 2008-10-02 09:11:24 UTC (rev 1339) @@ -1,7 +1,7 @@ <?php session_start(); - $positives=$_SESSION['positive']; - $negatives=$_SESSION['negative']; + if (isset($_SESSION['positive'])) $positives=$_SESSION['positive']; + if (isset($_SESSION['negative'])) $negatives=$_SESSION['negative']; $attr=array(); $pos=""; @@ -23,18 +23,21 @@ $i++; } if (strlen($neg)>0){ - $neg.='negatives=['.$neg.']'; + $neg='negatives=['.$neg.']'; $attr[]=$neg; } - $last_action=$_SESSION['lastAction']; - if (strpos($last_action,'searchConceptInstances')===0){ - $attr[]='concept='.substr($last_action,strpos($last_action, "/")+1); - $last_action='searchConceptInstances/Concept'; + if (isset($_SESSION['lastAction'])){ + $last_action=$_SESSION['lastAction']; + if (strpos($last_action,'searchConceptInstances')===0){ + $attr[]='concept='.substr($last_action,strpos($last_action, "/")+1); + $last_action='searchConceptInstances/Concept'; + } + if (count($attr)>0) $attributes='?'.implode('&',$attr); + else $attributes=''; + + $url='http://'.$_SERVER['HTTP_HOST'].'/dbpedia-navigator/'.$last_action.$attributes; + + print '<a href="'.$url.'">'.$url.'</a><br/><br/>'; } - if (count($attr)>0) $attributes='?'.implode('&',$attr); - - $url='http://'.$_SERVER['HTTP_HOST'].'/dbpedia-navigator/'.$last_action.$attributes; - - print '<a href="'.$url.'">'.$url.'</a><br/><br/>'; ?> \ 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-02 05:10:43 UTC (rev 1338) +++ trunk/src/dbpedia-navigator/ajax_get_article.php 2008-10-02 09:11:24 UTC (rev 1339) @@ -158,7 +158,7 @@ $birthdate=$dates; $characteristics['Birthdate']=$triples[$dates]; } - else if ($triples[$dates][0]['type']=='uri'&&$birthuri==false){ + else if (isset($triples[$dates])&&$triples[$dates][0]['type']=='uri'&&$birthuri==false){ $birthuri=$dates; $characteristics['Birthdate']=$triples[$dates]; } @@ -178,7 +178,7 @@ $deathdate=$dates; $characteristics['Deathdate']=$triples[$dates]; } - else if ($triples[$dates][0]['type']=='uri'&&$deathuri==false){ + else if (isset($triples[$dates])&&$triples[$dates][0]['type']=='uri'&&$deathuri==false){ $deathuri=$dates; $characteristics['Deathdate']=$triples[$dates]; } @@ -349,6 +349,27 @@ $artTitle=$_SESSION['articles'][$fromCache]['subject']; $lat=$_SESSION['articles'][$fromCache]['lat']; $long=$_SESSION['articles'][$fromCache]['long']; + + //Add Positives to Session + if (!isset($_SESSION['positive'])){ + if ($redirect!=""){ + $array=array($redirect => $artTitle); + } + else $array=array($uri => $artTitle); + $_SESSION['positive']=$array; + } + else{ + $array=$_SESSION['positive']; + if ($redirect!="") $array[$redirect] = $artTitle; + else $array[$uri]=$artTitle; + if (count($array)>3){ + foreach ($array as $key=>$value){ + unset($array[$key]); + break; + } + } + $_SESSION['positive']=$array; + } } //Build lastArticles Modified: trunk/src/dbpedia-navigator/helper_functions.php =================================================================== --- trunk/src/dbpedia-navigator/helper_functions.php 2008-10-02 05:10:43 UTC (rev 1338) +++ trunk/src/dbpedia-navigator/helper_functions.php 2008-10-02 09:11:24 UTC (rev 1339) @@ -40,8 +40,12 @@ else if ($count>($min+$distribution)) $style="font-size:medium;"; else $style="font-size:small;"; + $lab=urldecode(str_replace("_"," ",substr (strrchr ($tag, "/"), 1))); + if (strlen($label[$tag])>strlen($lab)-3||preg_match('/[0-9]/',$lab)===1){ + $lab=$label[$tag]; + } //$tag_with_entities=htmlentities("\"".$tag."\""); - $ret.='<a style="'.$style.'" href="#" onclick="document.getElementById(\'hidden_class\').value=\''.$tag.'\';show_results(\''.$tag.'\',document.getElementById(\'hidden_number\').value);">'.$label[$tag].'</a> '; + $ret.='<a style="'.$style.'" href="#" onclick="document.getElementById(\'hidden_class\').value=\''.$tag.'\';show_results(\''.$tag.'\',document.getElementById(\'hidden_number\').value);">'.$lab.'</a> '; } $ret.="</p><br/>"; return $ret; Modified: trunk/src/dbpedia-navigator/js/ajax.js =================================================================== --- trunk/src/dbpedia-navigator/js/ajax.js 2008-10-02 05:10:43 UTC (rev 1338) +++ trunk/src/dbpedia-navigator/js/ajax.js 2008-10-02 09:11:24 UTC (rev 1339) @@ -125,6 +125,7 @@ document.getElementById('Negatives').innerHTML=response[1]; learnConcept(); } + generateURL(); } XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); @@ -152,6 +153,7 @@ document.getElementById('Negatives').innerHTML=response[1]; learnConcept(); } + generateURL(); } XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); @@ -176,6 +178,7 @@ if (XhrObj.readyState == 4 && XhrObj.status == 200){ document.getElementById('Positives').innerHTML = XhrObj.responseText; } + generateURL(); } XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); @@ -201,6 +204,7 @@ document.getElementById('Negatives').innerHTML = XhrObj.responseText; learnConcept(); } + generateURL(); } XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); @@ -228,6 +232,7 @@ document.getElementById('Negatives').innerHTML=response[1]; learnConcept(); } + generateURL(); } XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); @@ -255,6 +260,7 @@ document.getElementById('Negatives').innerHTML=response[1]; learnConcept(); } + generateURL(); } XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-09-26 12:52:35
|
Revision: 1267 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1267&view=rev Author: sknappe Date: 2008-09-26 12:52:19 +0000 (Fri, 26 Sep 2008) Log Message: ----------- Added Paths: ----------- trunk/src/dbpedia-navigator/Settings.php.dist Removed Paths: ------------- trunk/src/dbpedia-navigator/Settings.php Deleted: trunk/src/dbpedia-navigator/Settings.php =================================================================== --- trunk/src/dbpedia-navigator/Settings.php 2008-09-26 12:22:02 UTC (rev 1266) +++ trunk/src/dbpedia-navigator/Settings.php 2008-09-26 12:52:19 UTC (rev 1267) @@ -1,69 +0,0 @@ -<?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/>. - * - */ - -/** - * DBpedia navigator settings. - * - * @author Sebastian Knappe - * @author Jens Lehmann - */ -class Settings{ - - public $wsdluri='http://localhost:8181/services?wsdl'; - - // local OpenLink SPARQL endpoint - // public $dbpediauri="http://localhost:8890/sparql"; - // public DBpedia SPARQL endpoint - public $dbpediauri='http://dbpedia.openlinksw.com:8890/sparql'; - // public DBpedia mirror - // public $dbpediauri='http://dbpedia2.openlinksw.com:8890/isparql'; - - //which predefined Endpoint to use - public $endpoint="DBPEDIA"; - //public $endpoint="LOCALDBPEDIA"; - - - // in mikrosekunden - public $sparqlttl=60000000; - public $learnttl=5; - - public $language="en"; - - //localhost - public $googleMapsKey="ABQIAAAAWwHG9WuZ8hxFSPjRX2-D-hSOxlJeL3USfakgDtFzmQkGhQTW0xTFM1Yr38ho8qREnjt-6oLs37o4xg"; - //db.aksw.org - //public $googleMapsKey="ABQIAAAAWwHG9WuZ8hxFSPjRX2-D-hRHWRcfpxRnIG10qrJMLnZO-_MKjRRpu2rZj8etMweqJES04ZL_eht1iQ"; - - public $useCache=true; - - //the type of database server - public $database_type='mysql'; - //the server, where the mysql databank is located - public $database_server='localhost'; - //the user, that has rights to access the navigator databank - public $database_user='navigator'; - //the password of that user - public $database_pass='dbpedia'; - //the name of the used database - public $database_name='navigator_db'; -} - -?> \ No newline at end of file Added: trunk/src/dbpedia-navigator/Settings.php.dist =================================================================== --- trunk/src/dbpedia-navigator/Settings.php.dist (rev 0) +++ trunk/src/dbpedia-navigator/Settings.php.dist 2008-09-26 12:52:19 UTC (rev 1267) @@ -0,0 +1,69 @@ +<?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/>. + * + */ + +/** + * DBpedia navigator settings. + * + * @author Sebastian Knappe + * @author Jens Lehmann + */ +class Settings{ + + public $wsdluri='http://localhost:8181/services?wsdl'; + + // local OpenLink SPARQL endpoint + // public $dbpediauri="http://localhost:8890/sparql"; + // public DBpedia SPARQL endpoint + public $dbpediauri='http://dbpedia.openlinksw.com:8890/sparql'; + // public DBpedia mirror + // public $dbpediauri='http://dbpedia2.openlinksw.com:8890/isparql'; + + //which predefined Endpoint to use + public $endpoint="DBPEDIA"; + //public $endpoint="LOCALDBPEDIA"; + + + // in mikrosekunden + public $sparqlttl=60000000; + public $learnttl=5; + + public $language="en"; + + //localhost + public $googleMapsKey="ABQIAAAAWwHG9WuZ8hxFSPjRX2-D-hSOxlJeL3USfakgDtFzmQkGhQTW0xTFM1Yr38ho8qREnjt-6oLs37o4xg"; + //db.aksw.org + //public $googleMapsKey="ABQIAAAAWwHG9WuZ8hxFSPjRX2-D-hRHWRcfpxRnIG10qrJMLnZO-_MKjRRpu2rZj8etMweqJES04ZL_eht1iQ"; + + public $useCache=true; + + //the type of database server + public $database_type='mysql'; + //the server, where the mysql databank is located + public $database_server='localhost'; + //the user, that has rights to access the navigator databank + public $database_user='navigator'; + //the password of that user + public $database_pass='dbpedia'; + //the name of the used database + public $database_name='navigator_db'; +} + +?> \ 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-09-30 20:16:22
|
Revision: 1330 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1330&view=rev Author: sknappe Date: 2008-09-30 20:16:04 +0000 (Tue, 30 Sep 2008) Log Message: ----------- some changes, major one is that examples are combined to classes of examples (to yet finished) Modified Paths: -------------- trunk/src/dbpedia-navigator/ajax_get_article.php trunk/src/dbpedia-navigator/ajax_learn_concepts.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-09-30 19:05:21 UTC (rev 1329) +++ trunk/src/dbpedia-navigator/ajax_get_article.php 2008-09-30 20:16:04 UTC (rev 1330) @@ -300,7 +300,7 @@ $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,$predicatelabels); + $content .= get_triple_table($triples,$subjecttriples); } //Restart the Session Modified: trunk/src/dbpedia-navigator/ajax_learn_concepts.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-09-30 19:05:21 UTC (rev 1329) +++ trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-09-30 20:16:04 UTC (rev 1330) @@ -2,6 +2,8 @@ ini_set('max_execution_time',200); include('helper_functions.php'); + include('Settings.php'); + include('DatabaseConnection.php'); session_start(); @@ -22,11 +24,80 @@ if (isset($negatives)) foreach ($negatives as $name=>$lab) $negArray[]=$name; - + + //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); + + $all=array_merge($posArray,$negArray); + + $classes=array(); + $noclass=array(); + 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']; + } + for ($i=0;$i<1;$i++){ + $tempclasses=array(); + foreach ($newclasses as $clas){ + $query="SELECT father FROM classhierarchy WHERE child='$clas'"; + $res=$databaseConnection->query($query); + while ($result=$databaseConnection->nextEntry($res)){ + $classes[$pos][]=$result['father']; + $tempclasses[]=$result['father']; + } + } + $newclasses=$tempclasses; + } + } + $groups=array(); + $groupclasses=array(); + $i=0; + foreach ($classes as $key=>$value){ + $i++; + $groups[$i][]=$key; + $groupclasses[$i]=$value; + } + + for ($j=1;$j<=$i;$j++){ + if (!isset($groups[$j])) continue; + for ($k=$j+1;$k<=$i;$k++){ + if (!isset($groups[$k])) continue; + if (count(array_intersect($groupclasses[$j],$groupclasses[$k]))>0){ + $groups[$j]=array_merge($groups[$j],$groups[$k]); + $groupclasses[$j]=array_merge($groupclasses[$j],$groupclasses[$k]); + unset($groups[$k]); + unset($groupclasses[$k]); + } + } + } + $groups[]=$noclass; + $problems=array(); + foreach ($groups as $group){ + $pos=array(); + $neg=array(); + foreach ($group as $uri){ + if (in_array($uri,$posArray)) $pos[]=$uri; + else $neg[]=$uri; + } + $problems[]=array('pos'=>$pos,'neg'=>$neg); + } + require_once("DLLearnerConnection.php"); $sc=new DLLearnerConnection($id, $ksID); try{ - $concepts=$sc->getConceptFromExamples($posArray,$negArray); + $concepts=array(); + foreach ($problems as $problem) + $concepts=array_merge($concepts,@$sc->getConceptFromExamples($problem['pos'],$problem['neg'])); + + if (count($concepts)>0){ $concept.="<table border=0>\n"; $concept.="<tr><td>You could also be interested in articles matching these descriptions:</td></tr>"; Modified: trunk/src/dbpedia-navigator/helper_functions.php =================================================================== --- trunk/src/dbpedia-navigator/helper_functions.php 2008-09-30 19:05:21 UTC (rev 1329) +++ trunk/src/dbpedia-navigator/helper_functions.php 2008-09-30 20:16:04 UTC (rev 1330) @@ -227,7 +227,7 @@ fclose($file); } -function get_triple_table($triples,$subjecttriples,$predicateLabels) { +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; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-10-01 13:04:57
|
Revision: 1335 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1335&view=rev Author: sknappe Date: 2008-10-01 13:04:47 +0000 (Wed, 01 Oct 2008) Log Message: ----------- added favicon 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-01 08:50:21 UTC (rev 1334) +++ trunk/src/dbpedia-navigator/ajax_get_article.php 2008-10-01 13:04:47 UTC (rev 1335) @@ -329,6 +329,12 @@ $array=$_SESSION['positive']; if ($redirect!="") $array[$redirect] = $artTitle; else $array[$uri]=$artTitle; + if (count($array)>3){ + foreach ($array as $key=>$value){ + unset($array[$key]); + break; + } + } $_SESSION['positive']=$array; } Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-10-01 08:50:21 UTC (rev 1334) +++ trunk/src/dbpedia-navigator/index.php 2008-10-01 13:04:47 UTC (rev 1335) @@ -40,6 +40,7 @@ <title>DBpedia Navigator</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> <link rel="stylesheet" href="css/default.css"/> + <link rel="Shortcut Icon" href="images/favicon.ico"> <script src="http://maps.google.com/maps?file=api&v=2&key=<?php print $settings->googleMapsKey;?>" type="text/javascript"></script> <script src="js/ajax.js"></script> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-10-05 08:06:31
|
Revision: 1341 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1341&view=rev Author: sknappe Date: 2008-10-05 08:02:09 +0000 (Sun, 05 Oct 2008) Log Message: ----------- changes according to email Modified Paths: -------------- trunk/src/dbpedia-navigator/ajax_get_article.php trunk/src/dbpedia-navigator/ajax_learn_concepts.php trunk/src/dbpedia-navigator/js/ajax.js Modified: trunk/src/dbpedia-navigator/ajax_get_article.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_article.php 2008-10-02 09:20:38 UTC (rev 1340) +++ trunk/src/dbpedia-navigator/ajax_get_article.php 2008-10-05 08:02:09 UTC (rev 1341) @@ -61,14 +61,14 @@ $artTitle=urldecode(str_replace("_"," ",substr (strrchr ($url, "/"), 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']; + 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/imageCaption'][0]['type']!='uri') $alt=$triples['http://dbpedia.org/property/caption'][0]['value']; else $alt='Picture of '.$artTitle; if(isset($triples['http://xmlns.com/foaf/0.1/depiction'])&&@fopen($triples['http://xmlns.com/foaf/0.1/depiction'][0]['value'], 'r')){ $content.='<img src="'.$triples['http://xmlns.com/foaf/0.1/depiction'][0]['value'].'" alt="'.$alt.'" style="float:right; max-width:200px;" title="'.$alt.'"\>'; } - else if(isset($triples['http://xmlns.com/foaf/0.1/img'])&&fopen($triples['http://xmlns.com/foaf/0.1/img'][0]['value'], 'r')){ + else if(isset($triples['http://xmlns.com/foaf/0.1/img'])&&@fopen($triples['http://xmlns.com/foaf/0.1/img'][0]['value'], 'r')){ $content.='<img src="'.$triples['http://xmlns.com/foaf/0.1/img'][0]['value'].'" alt="'.$alt.'" style="float:right; max-width:200px;" title="'.$alt.'"\>'; } @@ -77,6 +77,7 @@ if (isset($triples['http://dbpedia.org/property/redirect'])){ $content.="<span id=\"redirectedFrom\">redirected from '$subject'</span>"; $redirect=$triples['http://dbpedia.org/property/redirect'][0]['value']; + $uri=$redirect; } // add short description in english @@ -318,16 +319,12 @@ //Add Positives to Session if (!isset($_SESSION['positive'])){ - if ($redirect!=""){ - $array=array($redirect => $artTitle); - } - else $array=array($uri => $artTitle); + $array=array($uri => $artTitle); $_SESSION['positive']=$array; } else{ $array=$_SESSION['positive']; - if ($redirect!="") $array[$redirect] = $artTitle; - else $array[$uri]=$artTitle; + $array[$uri]=$artTitle; if (count($array)>3){ foreach ($array as $key=>$value){ unset($array[$key]); @@ -349,19 +346,16 @@ $artTitle=$_SESSION['articles'][$fromCache]['subject']; $lat=$_SESSION['articles'][$fromCache]['lat']; $long=$_SESSION['articles'][$fromCache]['long']; + $uri=$_SESSION['articles'][$fromCache]['uri']; //Add Positives to Session if (!isset($_SESSION['positive'])){ - if ($redirect!=""){ - $array=array($redirect => $artTitle); - } - else $array=array($uri => $artTitle); + $array=array($uri => $artTitle); $_SESSION['positive']=$array; } else{ $array=$_SESSION['positive']; - if ($redirect!="") $array[$redirect] = $artTitle; - else $array[$uri]=$artTitle; + $array[$uri]=$artTitle; if (count($array)>3){ foreach ($array as $key=>$value){ unset($array[$key]); Modified: trunk/src/dbpedia-navigator/ajax_learn_concepts.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-10-02 09:20:38 UTC (rev 1340) +++ trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-10-05 08:02:09 UTC (rev 1341) @@ -107,7 +107,7 @@ foreach ($concepts as $conc){ foreach ($conc as $con){ $label=$sc->getNaturalDescription($con['descriptionKBSyntax']); - $concept.="<tr><td><a href=\"\" onclick=\"getSubjectsFromConcept('kb=".htmlentities($con['descriptionKBSyntax'])."&number=10');return false;\" />".$label."</a> (accuracy: ".(floatVal($con['accuracy'])*100)."%)</td></tr>"; + $concept.="<tr><td><a href=\"\" onclick=\"getSubjectsFromConcept('kb=".htmlentities($con['descriptionKBSyntax'])."&number=10');return false;\" />".$label."</a></td></tr>"; } } $concept.="</table>"; Modified: trunk/src/dbpedia-navigator/js/ajax.js =================================================================== --- trunk/src/dbpedia-navigator/js/ajax.js 2008-10-02 09:20:38 UTC (rev 1340) +++ trunk/src/dbpedia-navigator/js/ajax.js 2008-10-05 08:02:09 UTC (rev 1341) @@ -25,8 +25,8 @@ } if (XhrObj.readyState == 4){ setDatabaseRunning(false); + generateURL(); } - generateURL(); } XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); @@ -64,8 +64,8 @@ document.getElementById('LastArticlesBox').style.display='block'; learnConcept(); }else setTimeout("search_it('label='+document.getElementById('label').value+'&number=10')",2000); + generateURL(); } - generateURL(); } XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); @@ -95,9 +95,10 @@ document.getElementById('lastclasses').innerHTML=response[2]; document.getElementById('LastClassesBox').style.display='block'; } - if (XhrObj.readyState == 4) + if (XhrObj.readyState == 4){ setDatabaseRunning(false); - generateURL(); + generateURL(); + } } XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); @@ -124,8 +125,8 @@ document.getElementById('Positives').innerHTML=response[0]; document.getElementById('Negatives').innerHTML=response[1]; learnConcept(); + generateURL(); } - generateURL(); } XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); @@ -152,8 +153,8 @@ document.getElementById('Positives').innerHTML=response[0]; document.getElementById('Negatives').innerHTML=response[1]; learnConcept(); + generateURL(); } - generateURL(); } XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); @@ -177,8 +178,8 @@ { if (XhrObj.readyState == 4 && XhrObj.status == 200){ document.getElementById('Positives').innerHTML = XhrObj.responseText; + generateURL(); } - generateURL(); } XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); @@ -203,8 +204,8 @@ if (XhrObj.readyState == 4 && XhrObj.status == 200){ document.getElementById('Negatives').innerHTML = XhrObj.responseText; learnConcept(); + generateURL(); } - generateURL(); } XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); @@ -231,8 +232,8 @@ document.getElementById('Positives').innerHTML=response[0]; document.getElementById('Negatives').innerHTML=response[1]; learnConcept(); + generateURL(); } - generateURL(); } XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); @@ -259,8 +260,8 @@ document.getElementById('Positives').innerHTML=response[0]; document.getElementById('Negatives').innerHTML=response[1]; learnConcept(); + generateURL(); } - generateURL(); } XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); @@ -345,8 +346,8 @@ document.getElementById('searchcontent').innerHTML=response[2]; document.getElementById('SearchResultBox').style.display='block'; } + generateURL(); } - generateURL(); } XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); @@ -378,9 +379,10 @@ document.getElementById('SearchResultBox').style.display='block'; } } - if (XhrObj.readyState == 4) + if (XhrObj.readyState == 4){ setDatabaseRunning(false); - generateURL(); + generateURL(); + } } XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-10-05 10:26:32
|
Revision: 1343 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1343&view=rev Author: sknappe Date: 2008-10-05 09:08:08 +0000 (Sun, 05 Oct 2008) Log Message: ----------- bugfixes Modified Paths: -------------- trunk/src/dbpedia-navigator/ajax_search.php trunk/src/dbpedia-navigator/helper_functions.php trunk/src/dbpedia-navigator/js/navigator.js Modified: trunk/src/dbpedia-navigator/ajax_search.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_search.php 2008-10-05 09:07:00 UTC (rev 1342) +++ trunk/src/dbpedia-navigator/ajax_search.php 2008-10-05 09:08:08 UTC (rev 1343) @@ -62,11 +62,11 @@ $bestsearches=getBestSearches($names,$labels); } else - $content.="Your Search brought no results."; + $content.="Your search brought no results."; print $content; print '$$$'; - print "Searchresult for \"".$label."\""; + print "search result for \"".$label."\""; print '$$$'; print $bestsearches; ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/helper_functions.php =================================================================== --- trunk/src/dbpedia-navigator/helper_functions.php 2008-10-05 09:07:00 UTC (rev 1342) +++ trunk/src/dbpedia-navigator/helper_functions.php 2008-10-05 09:08:08 UTC (rev 1343) @@ -119,7 +119,7 @@ function getCategoryResultsTable($names,$labels,$category,$number) { - $ret="<p>These are your Searchresults. Show best "; + $ret="<p>These are your the results of your search. Show best "; for ($k=10;$k<125;){ $ret.="<a href=\"#\" onclick=\"getSubjectsFromCategory('category=".$category."&number=".$k."');return false;\""; if ($k==$number) $ret.=" style=\"text-decoration:none;\""; Modified: trunk/src/dbpedia-navigator/js/navigator.js =================================================================== --- trunk/src/dbpedia-navigator/js/navigator.js 2008-10-05 09:07:00 UTC (rev 1342) +++ trunk/src/dbpedia-navigator/js/navigator.js 2008-10-05 09:08:08 UTC (rev 1343) @@ -51,6 +51,7 @@ } else links[i].style.display='none'; } + links[i].innerHTML=links[i].innerHTML.substr(0,24)+j+links[i].innerHTML.substr(links[i].innerHTML.indexOf('<a')-7); } if (j<number){ show_results(class,0); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-10-17 12:46:44
|
Revision: 1382 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1382&view=rev Author: sknappe Date: 2008-10-17 12:46:32 +0000 (Fri, 17 Oct 2008) Log Message: ----------- bugfixes Modified Paths: -------------- trunk/src/dbpedia-navigator/ajax_generate_URL.php trunk/src/dbpedia-navigator/ajax_get_article.php trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php trunk/src/dbpedia-navigator/ajax_learn_concepts.php Modified: trunk/src/dbpedia-navigator/ajax_generate_URL.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_generate_URL.php 2008-10-16 12:41:49 UTC (rev 1381) +++ trunk/src/dbpedia-navigator/ajax_generate_URL.php 2008-10-17 12:46:32 UTC (rev 1382) @@ -38,6 +38,6 @@ $url='http://'.$_SERVER['HTTP_HOST'].'/dbpedia-navigator/'.$last_action.$attributes; - print '<a href="'.$url.'">'.$url.'</a><br/><br/>'; + print '<font style="font-size:9px"><a href="'.$url.'">'.$url.'</a></font><br/><br/>'; } ?> \ 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-16 12:41:49 UTC (rev 1381) +++ trunk/src/dbpedia-navigator/ajax_get_article.php 2008-10-17 12:46:32 UTC (rev 1382) @@ -7,8 +7,14 @@ $fromCache=$_POST['cache']; if (isset($_SESSION['articles'])) $articles=$_SESSION['articles']; - $id=$_SESSION['id']; - $ksID=$_SESSION['ksID']; + if (isset($_SESSION['id'])){ + $id=$_SESSION['id']; + $ksID=$_SESSION['ksID']; + } + else{ + print "Your Session expired. Please reload."; + die(); + } //write last action into session if (strpos($subject,"http://dbpedia.org/resource/")===0) $actionuri=substr (strrchr ($subject, "/"), 1); @@ -62,7 +68,7 @@ // 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/imageCaption'][0]['type']!='uri') $alt=$triples['http://dbpedia.org/property/caption'][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']; else $alt='Picture of '.$artTitle; if(isset($triples['http://xmlns.com/foaf/0.1/depiction'])&&@fopen($triples['http://xmlns.com/foaf/0.1/depiction'][0]['value'], 'r')){ Modified: trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php 2008-10-16 12:41:49 UTC (rev 1381) +++ trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php 2008-10-17 12:46:32 UTC (rev 1382) @@ -8,8 +8,14 @@ $kb=str_replace('\"','"',$kb); session_start(); - $id=$_SESSION['id']; - $ksID=$_SESSION['ksID']; + if (isset($_SESSION['id'])){ + $id=$_SESSION['id']; + $ksID=$_SESSION['ksID']; + } + else{ + print "Your Session expired. Please reload."; + die(); + } //write last action into session $actionuri=urlencode($kb); $_SESSION['lastAction']='searchConceptInstances/'.$actionuri; Modified: trunk/src/dbpedia-navigator/ajax_learn_concepts.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-10-16 12:41:49 UTC (rev 1381) +++ trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-10-17 12:46:32 UTC (rev 1382) @@ -9,8 +9,14 @@ if (isset($_SESSION['positive'])) $positives=$_SESSION['positive']; if (isset($_SESSION['negative'])) $negatives=$_SESSION['negative']; - $id=$_SESSION['id']; - $ksID=$_SESSION['ksID']; + if (isset($_SESSION['id'])){ + $id=$_SESSION['id']; + $ksID=$_SESSION['ksID']; + } + else{ + print "Your Session expired. Please reload."; + die(); + } session_write_close(); setRunning($id,"true"); $concept=""; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-10-17 13:38:53
|
Revision: 1383 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1383&view=rev Author: sknappe Date: 2008-10-17 13:38:47 +0000 (Fri, 17 Oct 2008) Log Message: ----------- bugfix mit endpoint 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-17 12:46:32 UTC (rev 1382) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-10-17 13:38:47 UTC (rev 1383) @@ -131,7 +131,7 @@ function getNaturalDescription($concept) { - return $this->client->getNaturalDescription($concept); + return $this->client->getNaturalDescription($concept, $this->endpoint); } function getConceptDepth() Modified: trunk/src/dbpedia-navigator/main.wsdl =================================================================== --- trunk/src/dbpedia-navigator/main.wsdl 2008-10-17 12:46:32 UTC (rev 1382) +++ trunk/src/dbpedia-navigator/main.wsdl 2008-10-17 13:38:47 UTC (rev 1383) @@ -356,6 +356,7 @@ </message> <message name="getNaturalDescription"> <part name="arg0" type="xsd:string"></part> + <part name="arg1" type="xsd:string"></part> </message> <message name="getNaturalDescriptionResponse"> <part name="return" type="xsd:string"></part> @@ -660,7 +661,7 @@ <output message="tns:SparqlRetrievalResponse"></output> <fault message="tns:ParseException" name="ParseException"></fault> </operation> - <operation name="getNaturalDescription" parameterOrder="arg0"> + <operation name="getNaturalDescription" parameterOrder="arg0 arg1"> <input message="tns:getNaturalDescription"></input> <output message="tns:getNaturalDescriptionResponse"></output> <fault message="tns:ParseException" name="ParseException"></fault> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-10-21 10:44:00
|
Revision: 1386 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1386&view=rev Author: sknappe Date: 2008-10-21 10:43:54 +0000 (Tue, 21 Oct 2008) Log Message: ----------- bugfixes and added ignoredConcepts and -Roles to settings Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/Settings.php.dist trunk/src/dbpedia-navigator/ajax_get_article.php Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-10-21 10:25:14 UTC (rev 1385) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-10-21 10:43:54 UTC (rev 1386) @@ -21,7 +21,11 @@ // ID of the DBpedia knowledge source private $ksID; - + + private $ignoredConcepts; + + private $ignoredRoles; + function DLLearnerConnection($id=0,$ksID=0) { ini_set('default_socket_timeout',200); @@ -32,6 +36,8 @@ $this->lang=$settings->language; $this->DBPediaUrl=$settings->dbpediauri; $this->endpoint=$settings->endpoint; + $this->ignoredConcepts=$settings->ignoredConcepts; + $this->ignoredRoles=$settings->ignoredRoles; $this->client=new SoapClient("main.wsdl",array('features' => SOAP_SINGLE_ELEMENT_ARRAYS)); $this->id=$id; $this->ksID=$ksID; @@ -75,6 +81,8 @@ $this->client->applyConfigEntryInt($this->id, $algorithmID, "maxExecutionTimeInSeconds", 3); $this->client->applyConfigEntryBoolean($this->id, $algorithmID, "useNegation", false); $this->client->applyConfigEntryBoolean($this->id, $algorithmID, "useAllConstructor", false); + $this->client->applyConfigEntryStringArray($this->id, $algorithmID, "ignoredConcepts",$this->ignoredConcepts); + $this->client->applyConfigEntryStringArray($this->id, $algorithmID, "ignoredRoles",$this->ignoredRoles); $start = microtime(true); $this->client->initAll($this->id); Modified: trunk/src/dbpedia-navigator/Settings.php.dist =================================================================== --- trunk/src/dbpedia-navigator/Settings.php.dist 2008-10-21 10:25:14 UTC (rev 1385) +++ trunk/src/dbpedia-navigator/Settings.php.dist 2008-10-21 10:43:54 UTC (rev 1386) @@ -54,6 +54,10 @@ public $useCache=true; + public $ignoredConcepts=array(); + public $ignoredRoles=array(); + + //the type of database server public $database_type='mysql'; //the server, where the mysql databank is located Modified: trunk/src/dbpedia-navigator/ajax_get_article.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_article.php 2008-10-21 10:25:14 UTC (rev 1385) +++ trunk/src/dbpedia-navigator/ajax_get_article.php 2008-10-21 10:43:54 UTC (rev 1386) @@ -331,7 +331,7 @@ else{ $array=$_SESSION['positive']; $array[$uri]=$artTitle; - if (count($array)>3){ + if (count($array)>10){ foreach ($array as $key=>$value){ unset($array[$key]); break; @@ -362,7 +362,7 @@ else{ $array=$_SESSION['positive']; $array[$uri]=$artTitle; - if (count($array)>3){ + if (count($array)>10){ foreach ($array as $key=>$value){ unset($array[$key]); break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-10-22 06:43:23
|
Revision: 1389 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1389&view=rev Author: sknappe Date: 2008-10-22 06:43:16 +0000 (Wed, 22 Oct 2008) Log Message: ----------- little change to labels in yago classes and some more predicate filters Modified Paths: -------------- trunk/src/dbpedia-navigator/ajax_get_article.php trunk/src/dbpedia-navigator/helper_functions.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 + temp .htaccess main.wsdl def0.xsd def1.xsd test.html test.php Modified: trunk/src/dbpedia-navigator/ajax_get_article.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_article.php 2008-10-22 06:41:32 UTC (rev 1388) +++ trunk/src/dbpedia-navigator/ajax_get_article.php 2008-10-22 06:43:16 UTC (rev 1389) @@ -306,7 +306,26 @@ if (isset($triples['http://dbpedia.org/property/refLabelProperty'])) unset($triples['http://dbpedia.org/property/refLabelProperty']); if (isset($triples['http://dbpedia.org/property/noteLabelProperty'])) unset($triples['http://dbpedia.org/property/noteLabelProperty']); if (isset($triples['http://dbpedia.org/property/wikisourcelangProperty'])) unset($triples['http://dbpedia.org/property/wikisourcelangProperty']); + if (isset($triples['http://dbpedia.org/property/lk'])) unset($triples['http://dbpedia.org/property/lk']); + if (isset($triples['http://dbpedia.org/property/abbr'])) unset($triples['http://dbpedia.org/property/abbr']); + if (isset($triples['http://dbpedia.org/property/x'])) unset($triples['http://dbpedia.org/property/x']); + if (isset($triples['http://dbpedia.org/property/y'])) unset($triples['http://dbpedia.org/property/y']); + if (isset($triples['http://dbpedia.org/property/imageFlagSize'])) unset($triples['http://dbpedia.org/property/imageFlagSize']); + if (isset($triples['http://dbpedia.org/property/imageCoatOfArmsSize'])) unset($triples['http://dbpedia.org/property/imageCoatOfArmsSize']); + if (isset($triples['http://dbpedia.org/property/wikiaProperty'])) unset($triples['http://dbpedia.org/property/wikiaProperty']); + if (isset($triples['http://dbpedia.org/property/coorDmProperty'])) unset($triples['http://dbpedia.org/property/coorDmProperty']); + if (isset($triples['http://dbpedia.org/property/nuts'])) unset($triples['http://dbpedia.org/property/nuts']); + if (isset($triples['http://dbpedia.org/property/years'])) unset($triples['http://dbpedia.org/property/years']); + if (isset($triples['http://dbpedia.org/property/dateofbirth'])) unset($triples['http://dbpedia.org/property/dateofbirth']); + if (isset($triples['http://dbpedia.org/property/caps_percent_28goals_percent_29'])) unset($triples['http://dbpedia.org/property/caps_percent_28goals_percent_29']); + if (isset($triples['http://dbpedia.org/property/nationalcaps_percent_28goals_percent_29'])) unset($triples['http://dbpedia.org/property/nationalcaps_percent_28goals_percent_29']); + if (isset($triples['http://dbpedia.org/property/ntupdate'])) unset($triples['http://dbpedia.org/property/ntupdate']); + if (isset($triples['http://dbpedia.org/property/footballPlayerStatistics2Property'])) unset($triples['http://dbpedia.org/property/footballPlayerStatistics2Property']); + if (isset($triples['http://dbpedia.org/property/footballPlayerStatistics3Property'])) unset($triples['http://dbpedia.org/property/footballPlayerStatistics3Property']); + if (isset($triples['http://dbpedia.org/property/is_percent_7D_percent_7D_percent_7B_percent_7BsuccessionBox_percent_23_percent_23_percent_23_percent_23Before_of'])) unset($triples['is_percent_7D_percent_7D_percent_7B_percent_7BsuccessionBox_percent_23_percent_23_percent_23_percent_23Before_of']); + if (isset($triples['http://dbpedia.org/property/is_percent_7D_percent_7D_percent_7B_percent_7BsuccessionBox_percent_23_percent_23_percent_23_percent_23title_of'])) unset($triples['is_percent_7D_percent_7D_percent_7B_percent_7BsuccessionBox_percent_23_percent_23_percent_23_percent_23title_of']); + if (count($triples)>0){ $content.='<br/><hr><h4>Remaining Triples</h4><br/>'; Modified: trunk/src/dbpedia-navigator/helper_functions.php =================================================================== --- trunk/src/dbpedia-navigator/helper_functions.php 2008-10-22 06:41:32 UTC (rev 1388) +++ trunk/src/dbpedia-navigator/helper_functions.php 2008-10-22 06:43:16 UTC (rev 1389) @@ -45,7 +45,7 @@ $lab=$label[$tag]; } //$tag_with_entities=htmlentities("\"".$tag."\""); - $ret.='<a style="'.$style.'" href="#" onclick="document.getElementById(\'hidden_class\').value=\''.$tag.'\';show_results(\''.$tag.'\',document.getElementById(\'hidden_number\').value);">'.$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).'</a> '; } $ret.="</p><br/>"; return $ret; @@ -371,7 +371,7 @@ $res=$databaseConnection->query($query); $result=$databaseConnection->nextEntry($res); $label=urldecode(str_replace("_"," ",substr (strrchr ($ar[$i]['value'], "/"), 1))); - if (strlen($result['label'])>strlen($label)-3||preg_match('/[0-9]/',$label)===1){ + if (strlen($result['label'])>strlen($label)-3||preg_match('/[0-9]$/',$label)===1){ $label=$result['label']; } $label=utf8_to_html($label); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-10-22 07:37:21
|
Revision: 1395 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1395&view=rev Author: sknappe Date: 2008-10-22 07:37:17 +0000 (Wed, 22 Oct 2008) Log Message: ----------- better titles for classview Modified Paths: -------------- trunk/src/dbpedia-navigator/ajax_get_class.php trunk/src/dbpedia-navigator/helper_functions.php Modified: trunk/src/dbpedia-navigator/ajax_get_class.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_class.php 2008-10-22 07:26:37 UTC (rev 1394) +++ trunk/src/dbpedia-navigator/ajax_get_class.php 2008-10-22 07:37:17 UTC (rev 1395) @@ -51,8 +51,11 @@ $res2=$databaseConnection->query($query); $result2=$databaseConnection->nextEntry($res2); $identify=urldecode(str_replace("_"," ",substr (strrchr ($result['child'], "/"), 1))); - if ((strlen($identify)+strlen($result2['label']))>100) $identify=substr($identify,0,100-strlen($result2['label'])); - $childClasses.='<option value="'.$result['child'].'">'.utf8_to_html($result2['label']).' ('.$identify.')</option>'; + if (strlen($result2['label'])>strlen($identify)-3||preg_match('/[0-9]$/',$identify)===1){ + $identify=$result2['label']; + } + if (strlen($identify)>100) $identify=substr($identify,0,100); + $childClasses.='<option value="'.$result['child'].'">'.utf8_to_html($identify).'</option>'; } if (strlen($childClasses)>0) $childClasses='<select size="1" style="width:500px" id="childSelect">'.$childClasses.'</select>'; @@ -67,8 +70,11 @@ $res2=$databaseConnection->query($query); $result2=$databaseConnection->nextEntry($res2); $identify=urldecode(str_replace("_"," ",substr (strrchr ($result['father'], "/"), 1))); - if ((strlen($identify)+strlen($result2['label']))>100) $identify=substr($identify,0,100-strlen($result2['label'])); - $fatherClasses.='<option value="'.$result['father'].'">'.utf8_to_html($result2['label']).' ('.$identify.')</option>'; + if (strlen($result2['label'])>strlen($identify)-3||preg_match('/[0-9]$/',$identify)===1){ + $identify=$result2['label']; + } + if (strlen($identify)>100) $identify=substr($identify,0,100); + $fatherClasses.='<option value="'.$result['father'].'">'.utf8_to_html($identify).'</option>'; } if (strlen($fatherClasses)>0) $fatherClasses='<select size="1" style="width:500px" id="fatherSelect">'.$fatherClasses.'</select>'; @@ -77,8 +83,11 @@ $query="SELECT label FROM categories WHERE category='$class' LIMIT 1"; $res=$databaseConnection->query($query); $result=$databaseConnection->nextEntry($res); - $title=$result['label']; - + $title=urldecode(str_replace("_"," ",substr (strrchr ($class, "/"), 1))); + if (strlen($result['label'])>strlen($title)-3||preg_match('/[0-9]$/',$title)===1){ + $title=$result['label']; + }\xB4 + $content.=getClassView($fatherClasses,$childClasses,$title,$class); //Restart the Session @@ -111,7 +120,7 @@ if (isset($_SESSION['classes'])){ foreach ($_SESSION['classes'] as $key => $value) { - $lastClasses.="<a href=\"\" onclick=\"get_class('class=&cache=".$key."');return false;\">".$value['title']." (".urldecode(str_replace("_"," ",substr (strrchr ($value['uri'], "/"), 1))).")</a><br/>"; + $lastClasses.="<a href=\"\" onclick=\"get_class('class=".$value['uri']."&cache=".$key."');return false;\">".$value['title']."</a><br/>"; } } Modified: trunk/src/dbpedia-navigator/helper_functions.php =================================================================== --- trunk/src/dbpedia-navigator/helper_functions.php 2008-10-22 07:26:37 UTC (rev 1394) +++ trunk/src/dbpedia-navigator/helper_functions.php 2008-10-22 07:37:17 UTC (rev 1395) @@ -434,7 +434,7 @@ $ret.='<tr style="height:20px"><td><hr/></td></tr>'; $ret.='<tr><td style="font-size:14px;"><b>Current class</b></td></tr>'; $ret.='<tr style="height:10px"><td></td></tr>'; - $ret.='<tr><td><b>'.$title.'</b> ('.urldecode(str_replace("_"," ",substr (strrchr ($class, "/"), 1))).')</td></tr>'; + $ret.='<tr><td><b>'.$title.'</b></td></tr>'; $ret.='<tr style="height:10px"><td></td></tr>'; $ret.='<tr><td>'; $ret.='<input style="width:70px" type="button" value="Instances" class="button" onclick="getSubjectsFromCategory(\'category='.$class.'&number=10\');" title="Search Instances of Shown class."/>'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-10-22 11:00:31
|
Revision: 1397 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1397&view=rev Author: sknappe Date: 2008-10-22 11:00:26 +0000 (Wed, 22 Oct 2008) Log Message: ----------- changed tag-cloud and labels Modified Paths: -------------- trunk/src/dbpedia-navigator/ajax_get_class.php trunk/src/dbpedia-navigator/helper_functions.php trunk/src/dbpedia-navigator/js/navigator.js Modified: trunk/src/dbpedia-navigator/ajax_get_class.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_class.php 2008-10-22 07:40:12 UTC (rev 1396) +++ trunk/src/dbpedia-navigator/ajax_get_class.php 2008-10-22 11:00:26 UTC (rev 1397) @@ -50,10 +50,7 @@ $query="SELECT label FROM categories WHERE category='".$result['child']."' LIMIT 1"; $res2=$databaseConnection->query($query); $result2=$databaseConnection->nextEntry($res2); - $identify=urldecode(str_replace("_"," ",substr (strrchr ($result['child'], "/"), 1))); - if (strlen($result2['label'])>strlen($identify)-3||preg_match('/[0-9]$/',$identify)===1){ - $identify=$result2['label']; - } + $identify=getLabel($result['child'],$result2['label']); if (strlen($identify)>100) $identify=substr($identify,0,100); $childClasses.='<option value="'.$result['child'].'">'.utf8_to_html($identify).'</option>'; } @@ -69,10 +66,7 @@ $query="SELECT label FROM categories WHERE category='".$result['father']."' LIMIT 1"; $res2=$databaseConnection->query($query); $result2=$databaseConnection->nextEntry($res2); - $identify=urldecode(str_replace("_"," ",substr (strrchr ($result['father'], "/"), 1))); - if (strlen($result2['label'])>strlen($identify)-3||preg_match('/[0-9]$/',$identify)===1){ - $identify=$result2['label']; - } + $identify=getLabel($result['father'],$result2['label']); if (strlen($identify)>100) $identify=substr($identify,0,100); $fatherClasses.='<option value="'.$result['father'].'">'.utf8_to_html($identify).'</option>'; } @@ -83,10 +77,7 @@ $query="SELECT label FROM categories WHERE category='$class' LIMIT 1"; $res=$databaseConnection->query($query); $result=$databaseConnection->nextEntry($res); - $title=urldecode(str_replace("_"," ",substr (strrchr ($class, "/"), 1))); - if (strlen($result['label'])>strlen($title)-3||preg_match('/[0-9]$/',$title)===1){ - $title=$result['label']; - } + $title=getLabel($class,$result['label']); $content.=getClassView($fatherClasses,$childClasses,$title,$class); Modified: trunk/src/dbpedia-navigator/helper_functions.php =================================================================== --- trunk/src/dbpedia-navigator/helper_functions.php 2008-10-22 07:40:12 UTC (rev 1396) +++ trunk/src/dbpedia-navigator/helper_functions.php 2008-10-22 11:00:26 UTC (rev 1397) @@ -1,4 +1,24 @@ <?php +function getLabel($uri,$label) +{ + $res=urldecode(str_replace("_"," ",substr (strrchr ($uri, "/"), 1))); + if (strlen($label)>strlen($res)-5||preg_match('/[0-9]$/',$res)===1){ + $res=$label; + } + $res=utf8_to_html($res); + + preg_match_all("/([A-Z])/",$res,$treffer,PREG_OFFSET_CAPTURE); + foreach ($treffer[0] as $treff){ + if ($res[$treff[1]-1]!=' '&&$res[$treff[1]-1]!='-'&&$treff[1]!=0) $res=substr($res,0,$treff[1]).' '.substr($res,$treff[1]); + } + + //replacements + $res=str_replace('cities','City',$res); + $res=str_replace('Cities','City',$res); + + return $res; +} + function subjectToURI($subject) { //if the subject is already a URI return it @@ -31,29 +51,27 @@ $distribution=$diff/3; $ret="<p>"; - $ret.='<a style="font-size:xx-large;" href="#" onclick="document.getElementById(\'hidden_class\').value=\'all\';show_results(\'all\',document.getElementById(\'hidden_number\').value);">All</a> '; - if ($nc) $ret.='<a style="font-size:xx-small;" href="#" onclick="document.getElementById(\'hidden_class\').value=\'NoCategory\';show_results(\'NoCategory\',document.getElementById(\'hidden_number\').value);">No Category</a> '; foreach ($tags as $tag=>$count){ - if ($count==$min) $style="font-size:xx-small;"; - else if ($count==$max) $style="font-size:xx-large;"; - else if ($count>($min+2*$distribution)) $style="font-size:large;"; - else if ($count>($min+$distribution)) $style="font-size:medium;"; - else $style="font-size:small;"; + if ($count==$min) $style="font-size:9px;"; + else if ($count==$max) $style="font-size:17px;"; + else if ($count>($min+2*$distribution)) $style="font-size:15px;"; + else if ($count>($min+$distribution)) $style="font-size:13px;"; + else $style="font-size:11px;"; - $lab=urldecode(str_replace("_"," ",substr (strrchr ($tag, "/"), 1))); - if (strlen($label[$tag])>strlen($lab)-3||preg_match('/[0-9]/',$lab)===1){ - $lab=$label[$tag]; - } + $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.'\',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.'\',\''.utf8_to_html($lab).'\',document.getElementById(\'hidden_number\').value);">'.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> '; return $ret; } function getResultsTable($names,$labels,$classes,$number) { - $ret="<p>These are the results of your search. Show best "; + $ret="<p>You got ".count($names)." results. Show best "; for ($k=10;$k<125;){ $ret.="<a href=\"#\" onclick=\"search_it('label='+document.getElementById('label').value+'&number=".$k."');return false;\""; if ($k==$number) $ret.=" style=\"text-decoration:none;\""; @@ -119,7 +137,7 @@ function getCategoryResultsTable($names,$labels,$category,$number) { - $ret="<p>These are your the results of your search. Show best "; + $ret="<p>You got ".count($names)." results. Show best "; for ($k=10;$k<125;){ $ret.="<a href=\"#\" onclick=\"getSubjectsFromCategory('category=".$category."&number=".$k."');return false;\""; if ($k==$number) $ret.=" style=\"text-decoration:none;\""; @@ -162,7 +180,7 @@ function getConceptResultsTable($names,$labels,$kb,$number) { - $ret="<p>These are your results. Show best "; + $ret="<p>You got ".count($names)." results. Show best "; for ($k=10;$k<125;){ $ret.="<a href=\"#\" onclick=\"getSubjectsFromConcept('kb=".$kb."&number=".$k."');return false;\""; if ($k==$number) $ret.=" style=\"text-decoration:none;\""; @@ -370,10 +388,7 @@ $query="SELECT label FROM categories WHERE category='".$ar[$i]['value']."' LIMIT 1"; $res=$databaseConnection->query($query); $result=$databaseConnection->nextEntry($res); - $label=urldecode(str_replace("_"," ",substr (strrchr ($ar[$i]['value'], "/"), 1))); - if (strlen($result['label'])>strlen($label)-3||preg_match('/[0-9]$/',$label)===1){ - $label=$result['label']; - } + $label=getLabel($ar[$i]['value'],$result['label']); $label=utf8_to_html($label); $string .= '<li>' . formatClass($ar[$i]['value'],$label).'</li>'; } Modified: trunk/src/dbpedia-navigator/js/navigator.js =================================================================== --- trunk/src/dbpedia-navigator/js/navigator.js 2008-10-22 07:40:12 UTC (rev 1396) +++ trunk/src/dbpedia-navigator/js/navigator.js 2008-10-22 11:00:26 UTC (rev 1397) @@ -23,12 +23,16 @@ } } -function show_results(class, number) +function show_results(class, label, number) { var links=document.getElementById('results').getElementsByTagName('p'); var j=0; var names; var hasClass; + + if (class='all') document.getElementById('FilterTags').innerHTML='You currently don\'t filter your search results.'; + else document.getElementById('FilterTags').innerHTML='You filter your search results by class '+label+'.'; + for (var i=0;i<links.length;i++){ if (class=='all'){ if ((j+1)>number&&j<(number+25)) links[i].style.display='block'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-10-22 11:20:21
|
Revision: 1399 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1399&view=rev Author: sknappe Date: 2008-10-22 11:20:08 +0000 (Wed, 22 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-22 11:00:47 UTC (rev 1398) +++ trunk/src/dbpedia-navigator/helper_functions.php 2008-10-22 11:20:08 UTC (rev 1399) @@ -66,6 +66,7 @@ $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.='<br/><br/>'; return $ret; } Modified: trunk/src/dbpedia-navigator/js/navigator.js =================================================================== --- trunk/src/dbpedia-navigator/js/navigator.js 2008-10-22 11:00:47 UTC (rev 1398) +++ trunk/src/dbpedia-navigator/js/navigator.js 2008-10-22 11:20:08 UTC (rev 1399) @@ -30,9 +30,9 @@ var names; var hasClass; - if (class='all') document.getElementById('FilterTags').innerHTML='You currently don\'t filter your search results.'; - else document.getElementById('FilterTags').innerHTML='You filter your search results by class '+label+'.'; - + if (class=='all') document.getElementById('FilterTags').innerHTML='You currently don\'t filter your search results.'; + else document.getElementById('FilterTags').innerHTML='Filtered by class: '+label+'.'; + for (var i=0;i<links.length;i++){ if (class=='all'){ if ((j+1)>number&&j<(number+25)) links[i].style.display='block'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-10-23 07:41:08
|
Revision: 1414 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1414&view=rev Author: sknappe Date: 2008-10-23 07:41:02 +0000 (Thu, 23 Oct 2008) Log Message: ----------- no learning, if there is no change in examples Modified Paths: -------------- trunk/src/dbpedia-navigator/ajax_get_article.php trunk/src/dbpedia-navigator/js/ajax.js Modified: trunk/src/dbpedia-navigator/ajax_get_article.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_article.php 2008-10-23 07:30:04 UTC (rev 1413) +++ trunk/src/dbpedia-navigator/ajax_get_article.php 2008-10-23 07:41:02 UTC (rev 1414) @@ -362,19 +362,24 @@ $_SESSION['nextArticle']++; //Add Positives to Session + $noChange="false"; if (!isset($_SESSION['positive'])){ $array=array($uri => $artTitle); $_SESSION['positive']=$array; } else{ $array=$_SESSION['positive']; - $array[$uri]=$artTitle; - if (count($array)>10){ - foreach ($array as $key=>$value){ - unset($array[$key]); - break; + if (!isset($array[$uri])){ + $array[$uri]=$artTitle; + if (count($array)>10){ + foreach ($array as $key=>$value){ + unset($array[$key]); + break; + } } } + else + $noChange="true"; $_SESSION['positive']=$array; } @@ -393,19 +398,24 @@ $uri=$_SESSION['articles'][$fromCache]['uri']; //Add Positives to Session + $noChange="false"; if (!isset($_SESSION['positive'])){ $array=array($uri => $artTitle); $_SESSION['positive']=$array; } else{ $array=$_SESSION['positive']; - $array[$uri]=$artTitle; - if (count($array)>10){ - foreach ($array as $key=>$value){ - unset($array[$key]); - break; + if (!isset($array[$uri])){ + $array[$uri]=$artTitle; + if (count($array)>10){ + foreach ($array as $key=>$value){ + unset($array[$key]); + break; + } } } + else + $noChange="true"; $_SESSION['positive']=$array; } } @@ -431,6 +441,8 @@ print '$$$'; print $interests[1]; print '$$$'; + print $noChange; + print '$$$'; print $lat; print '$$$'; print $long; Modified: trunk/src/dbpedia-navigator/js/ajax.js =================================================================== --- trunk/src/dbpedia-navigator/js/ajax.js 2008-10-23 07:30:04 UTC (rev 1413) +++ trunk/src/dbpedia-navigator/js/ajax.js 2008-10-23 07:41:02 UTC (rev 1414) @@ -59,10 +59,10 @@ document.getElementById('lastarticles').innerHTML=response[2]; document.getElementById('Positives').innerHTML=response[3]; document.getElementById('Negatives').innerHTML=response[4]; - if (response[5].length>0&&response[6].length>0) - loadGoogleMap(response[5],response[6],''+response[1]); + if (response[6].length>0&&response[7].length>0) + loadGoogleMap(response[6],response[7],''+response[1]); document.getElementById('LastArticlesBox').style.display='block'; - learnConcept(); + if (response[5]=="false") learnConcept(); }else setTimeout("search_it('label='+document.getElementById('label').value+'&number=10')",2000); generateURL(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |