From: <jen...@us...> - 2009-06-02 14:27:11
|
Revision: 1783 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1783&view=rev Author: jenslehmann Date: 2009-06-02 14:27:09 +0000 (Tue, 02 Jun 2009) Log Message: ----------- suggestion test Modified Paths: -------------- trunk/src/php-examples/Suggestions.php trunk/src/php-examples/Utilities.php Modified: trunk/src/php-examples/Suggestions.php =================================================================== --- trunk/src/php-examples/Suggestions.php 2009-05-29 15:44:38 UTC (rev 1782) +++ trunk/src/php-examples/Suggestions.php 2009-06-02 14:27:09 UTC (rev 1783) @@ -1,11 +1,12 @@ <?php -include('Utilities.php'); - // load WSDL files (has to be done due to a Java web service bug) ini_set("soap.wsdl_cache_enabled","0"); -$wsdluri="http://localhost:8181/services?wsdl"; -Utilities::loadWSDLfiles($wsdluri); +$wsdluri="http://127.0.0.1:8181/services?wsdl"; +if(!file_exists('main.wsdl')) { + include('Utilities.php'); + Utilities::loadWSDLfiles($wsdluri); +} $examples = array('http://dbpedia.org/resource/Leipzig', 'http://dbpedia.org/resource/Dresden'); @@ -15,14 +16,17 @@ $ksID=$client->addKnowledgeSource($id,"sparql","http://dbpedia.org/sparql"); $client->applyConfigEntryInt($id, $ksID, "recursionDepth", 1); -$relatedInstances = $client->getNegativeExamples($id,$ksID,$examples,count($examples),"http://dbpedia.org/resource/",array()); -$instances = array_merge($examples, $relatedInstances->item); +$filterClasses=array("http://xmlns.com/foaf/","http://dbpedia.org/class/yago/","http://dbpedia.org/ontology/Resource"); +// $relatedInstances = $client->getNegativeExamples($id,$ksID,$examples,count($examples),"http://dbpedia.org/resource/",$filterClasses); +// $relatedInstances = $relatedInstances->item; +$relatedInstances = array('http://dbpedia.org/resource/Berlin','http://dbpedia.org/resource/London'); +$instances = array_merge($examples, $relatedInstances); $client->applyConfigEntryStringArray($id, $ksID, "instances", $instances); +// $client->applyConfigEntryString($id, $ksID, "predefinedFilter", "DBPEDIA-NAVIGATOR"); +$client->applyConfigEntryString($id, $ksID, "predefinedEndpoint", "LOCALDBPEDIA"); +$client->applyConfigEntryString($id, $ksID, "predefinedManipulator", "DBPEDIA-NAVIGATOR"); +$client->applyConfigEntryBoolean($id, $ksID, "saveExtractedFragment", true); -// $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"); - $rID = $client->setReasoner($id, "fastInstanceChecker"); $client->setLearningProblem($id, "posOnlyLP"); @@ -32,8 +36,26 @@ $client->initAll($id); +echo '<p>Positive examples:<br />'; +foreach($examples as $example) { + echo $example.'<br />'; +} +echo '</p>'; + +echo '<p>Additional instances:<br />'; +foreach($relatedinstances as $related) { + echo $related.'<br />'; +} +echo '</p>'; + echo 'start learning ... '; -$concept = $client->learnDescriptionsEvaluated($id, 5); +$concepts = $client->learnDescriptionsEvaluated($id, 5); echo 'OK <br />'; +$concepts = json_decode($concepts); + +foreach($concepts as $concept) { + echo $concept; +} + ?> Modified: trunk/src/php-examples/Utilities.php =================================================================== --- trunk/src/php-examples/Utilities.php 2009-05-29 15:44:38 UTC (rev 1782) +++ trunk/src/php-examples/Utilities.php 2009-06-02 14:27:09 UTC (rev 1783) @@ -37,7 +37,9 @@ */ public static function loadWSDLfiles($wsdluri) { $main = self :: getRequest($wsdluri); +// echo "loaded"; $other = self :: getXSDImports($main); +// print_r($other); $newMain = self :: changeXSDImports($main); self :: writeToFile("main.wsdl", $newMain); $x = 0; @@ -71,6 +73,10 @@ * Extracts XSD imports from WSDL file. */ public static function getXSDImports($wsdlFileContent) { + /* + preg_match_all('/\"[^\"\?]*?\?xsd=[^\"]*?\"/',$wsdlFileContent, $matches); + return $matches; + */ $before = "<xsd:import schemaLocation=\""; $after = "\" namespace=\""; $ret = array (); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |