From: <sk...@us...> - 2008-02-28 20:25:43
|
Revision: 664 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=664&view=rev Author: sknappe Date: 2008-02-28 12:25:39 -0800 (Thu, 28 Feb 2008) Log Message: ----------- bugfixes Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/Settings.php trunk/src/dbpedia-navigator/ajaxfunctions.php Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-02-28 20:25:13 UTC (rev 663) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-02-28 20:25:39 UTC (rev 664) @@ -120,7 +120,7 @@ { $query="SELECT ?pred ?obj ". "WHERE {{<http://dbpedia.org/resource/".str_replace(' ','_',$label)."> ?pred ?obj}UNION{<http://dbpedia.org/resource/".str_replace(' ','_',$label)."> <http://dbpedia.org/property/redirect> ?Conc.?Conc ?pred ?obj}}"; - $result=json_decode($this->getSparqlResult($query),true); + $result=json_decode($this->getSparqlResultThreaded($query),true); if (count($result['results']['bindings'])==0) throw new Exception("Your query brought no result. The Label-Search is started."); $ret=array(); foreach ($result['results']['bindings'] as $results){ @@ -131,16 +131,16 @@ return $ret; } - function getSparqlResult($query) + function getSparqlResultThreaded($query) { $this->client->applyConfigEntryStringArray($this->id, $this->ksID, "defaultGraphURIs", array("http://dbpedia.org")); $queryID=$this->client->sparqlQueryThreaded($this->id,$this->ksID,$query); $running=true; $i = 1; - $sleeptime = 0.5; + $sleeptime = 500000; do { // sleep a while - sleep($sleeptime); + usleep($sleeptime); $running=$this->client->isSparqlQueryRunning($this->id,$queryID); @@ -162,29 +162,37 @@ } while($seconds<$this->ttl); $this->client->stopSparqlThread($this->id,$queryID); } + + function getSparqlResult($query) + { + $this->client->applyConfigEntryStringArray($this->id, $this->ksID, "defaultGraphURIs", array("http://dbpedia.org")); + $result=$this->client->sparqlQuery($this->id,$this->ksID,$query); + return $result; + } function getSubjects($label,$checkedInstances) { $offset=1; $ret=array(); do{ - if (strlen($checkedInstances[0])>0){ + if (isset($checkedInstances[0])){ $query="SELECT DISTINCT ?subject\n". "WHERE {?subject a <".$checkedInstances[0].">.{SELECT ?zw as ?subject\n". - "WHERE { ?zw <http://www.w3.org/2000/01/rdf-schema#label> ?object. ?object bif:contains '\"".$label."\"'@en}\n". + "WHERE { ?zw <http://www.w3.org/2000/01/rdf-schema#label> ?object. ?object bif:contains \"".$label."\"@en}\n". "LIMIT 1000 OFFSET ".$offset."}}"; }else { $query="SELECT DISTINCT ?subject\n". - "WHERE { ?subject <http://www.w3.org/2000/01/rdf-schema#label> ?object. ?object bif:contains '\"".$label."\"'@en}". + "WHERE { ?subject <http://www.w3.org/2000/01/rdf-schema#label> ?object. ?object bif:contains \"".$label."\"@en}". "LIMIT 1000 OFFSET ".$offset; } - $result=json_decode($this->getSparqlResult($query),true); - if ((count($result['results']['bindings'])==0)&&($offset==1)) throw new Exception("Your query brought no result."); + $result=json_decode($this->getSparqlResultThreaded($query),true); + $count=count($result['results']['bindings']); + if (($count==0)&&($offset==1)) throw new Exception("Your query brought no result."); foreach ($result['results']['bindings'] as $results){ $ret[]=$results['subject']['value']; } $offset+=1000; - } while(count($result['results']['bindings'])==1000); + } while($count==1000); return $ret; } @@ -192,7 +200,7 @@ { $query="SELECT DISTINCT ?subject\n". "WHERE { ?subject a <".$concept.">}\n"; - $result=json_decode($this->getSparqlResult($query),true); + $result=json_decode($this->getSparqlResultThreaded($query),true); if (count($result['results']['bindings'])==0) throw new Exception("Your query brought no result."); $ret=array(); foreach ($result['results']['bindings'] as $results){ @@ -291,6 +299,7 @@ } } /* +ini_set('default_socket_timeout',200); $sc=new DLLearnerConnection(); $ids=$sc->getIDs(); $sc=new DLLearnerConnection($ids[0],$ids[1]); Modified: trunk/src/dbpedia-navigator/Settings.php =================================================================== --- trunk/src/dbpedia-navigator/Settings.php 2008-02-28 20:25:13 UTC (rev 663) +++ trunk/src/dbpedia-navigator/Settings.php 2008-02-28 20:25:39 UTC (rev 664) @@ -36,7 +36,7 @@ // public DBpedia mirror // public $dbpediauri='http://dbpedia2.openlinksw.com:8890/isparql'; - public $sparqlttl=60; + public $sparqlttl=60000000; public $language="en"; Modified: trunk/src/dbpedia-navigator/ajaxfunctions.php =================================================================== --- trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-02-28 20:25:13 UTC (rev 663) +++ trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-02-28 20:25:39 UTC (rev 664) @@ -153,11 +153,6 @@ // display the remaining properties as list which can be used for further navigation $content .= '<br/><br/><br/>'.get_triple_table($triples); - //BUILD SEARCHRESULT - if ($fromCache==-1) - $searchResult.="<a href=\"\" onclick=\"var list=tree.getAllChecked();xajax_getsubjects('".$subject."',list);return false;\">Show more Results</a>"; - - //Restart the Session session_start(); @@ -222,7 +217,6 @@ $objResponse->assign("articlecontent", "innerHTML", $content); $objResponse->assign("ArticleTitle","innerHTML",$artTitle); $objResponse->assign("lastarticles","innerHTML",$lastArticles); - if ($searchResult!="") $objResponse->assign("searchcontent", "innerHTML", $searchResult); $objResponse->assign('Positives','innerHTML',$posInterests); $objResponse->assign('Negatives','innerHTML',$negInterests); return $objResponse; @@ -468,7 +462,7 @@ for ($j=0;($j<30)&&(($i*30+$j)<count($results));$j++) { $result=$results[$i*30+$j]; - $ret.=" <a href=\"\" onclick=\"xajax_getarticle('".urldecode(str_replace("_"," ",substr (strrchr ($result, "/"), 1)))."',-2);return false;\">".urldecode(str_replace("_"," ",substr (strrchr ($result, "/"), 1)))."</a><br/>"; + $ret.=" <a href=\"\" onclick=\"xajax_getarticle('".urldecode(str_replace("_"," ",substr (strrchr ($result, "/"), 1)))."',-1);return false;\">".urldecode(str_replace("_"," ",substr (strrchr ($result, "/"), 1)))."</a><br/>"; } $ret.="</div>"; $i++; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |