From: <sk...@us...> - 2008-01-30 10:26:42
|
Revision: 463 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=463&view=rev Author: sknappe Date: 2008-01-30 02:26:38 -0800 (Wed, 30 Jan 2008) Log Message: ----------- changed for new Web-Service interface Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/rebuild.php Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-01-30 07:20:32 UTC (rev 462) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-01-30 10:26:38 UTC (rev 463) @@ -44,11 +44,8 @@ { $this->client->applyConfigEntryInt($this->id, $this->ksID, "recursionDepth",1); $this->client->applyConfigEntryStringArray($this->id, $this->ksID, "instances", array_merge($posExamples,$negExamples)); - // $this->client->applyConfigEntryStringArray($this->id, $this->ksID, "predList", array()); - // $this->client->applyConfigEntryStringArray($this->id, $this->ksID, "objList", array()); - // $this->client->applyConfigEntryStringArray($this->id, $this->ksID, "classList", array()); - // $this->client->applyConfigEntryString($this->id, $this->ksID, "format", "KB"); - // $this->client->applyConfigEntryBoolean($this->id, $this->ksID, "dumpToFile", true); + $this->client->applyConfigEntryInt($this->id, $this->ksID, "predefinedFilter", 5); + $this->client->applyConfigEntryInt($this->id, $this->ksID, "predefinedEndpoint", 1); $this->client->setReasoner($this->id, "dig"); if(empty($negExamples)) @@ -111,28 +108,31 @@ function getSparqlResult($query) { - $this->client->applyConfigEntryStringArray($this->id, $this->ksID, "defaultGraphURIs", array("http://dbpedia.org")); - $this->client->applyConfigEntryBoolean($this->id, $this->ksID, "cached", true); - $queryID=$this->client->sparqlQueryThreaded($this->id,$this->ksID,$query); - $running=true; - $i = 1; - $sleeptime = 1; - - do { - // sleep a while - sleep($sleeptime); - + try { + $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 = 1; - $running=$this->client->isSparqlQueryRunning($this->id,$queryID); - if (!$running){ - $result=$this->client->getAsStringArray($this->id,$queryID); - return $result; - } - - $seconds = $i * $sleeptime; - $i++; - } while($seconds<$this->ttl); - $this->client->stopSparqlQuery($id,$queryID); + do { + // sleep a while + sleep($sleeptime); + + + $running=$this->client->isSparqlQueryRunning($this->id,$queryID); + if (!$running){ + $result=$this->client->getAsStringArray($this->id,$queryID); + return $result; + } + + $seconds = $i * $sleeptime; + $i++; + } while($seconds<$this->ttl); + $this->client->stopSparqlQuery($id,$queryID); + } catch (Exception $e){ + echo $e->getMessage(); + } } function getSubjects($label) @@ -233,12 +233,10 @@ } } - -/*require_once("Settings.php"); +/* require_once("DLLearnerConnection.php"); -$settings=new Settings(); -$sc=new DLLearnerConnection($settings->dbpediauri,$settings->wsdluri); +$sc=new DLLearnerConnection(); $ids=$sc->getIDs(); -$sc=new DLLearnerConnection($settings->dbpediauri,$settings->wsdluri,$ids[0],$ids[1]); -$triples=$sc->getTriples($settings->sparqlttl,"dog");*/ +$sc=new DLLearnerConnection($ids[0],$ids[1]); +$triples=$sc->getTriples("Leipzig");*/ ?> Modified: trunk/src/dbpedia-navigator/rebuild.php =================================================================== --- trunk/src/dbpedia-navigator/rebuild.php 2008-01-30 07:20:32 UTC (rev 462) +++ trunk/src/dbpedia-navigator/rebuild.php 2008-01-30 10:26:38 UTC (rev 463) @@ -14,11 +14,6 @@ // we need to make sure that PHP really uses the new WSDL file // and does not cache, so we disable the cache and load it ini_set("soap.wsdl_cache_enabled","0"); -$sc=new DLLearnerConnection($settings->dbpediauri,$settings->wsdluri); -//$sc->getIDs(); -// TODO: does not work; -// maybe try to set ttl of cache to 1 second, -// wait for 1 second and then redirect to start page // redirect to index page $index_uri = 'http://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['SCRIPT_NAME']).'/index.php'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |