Skip to content

Commit

Permalink
fixed Suggestions.php script
Browse files Browse the repository at this point in the history
However it will not work until queries to DBpedia return data that is considered consistent by Pellet. (Fixes were developed after temporarily removing inconsistent axioms from the response data.)
  • Loading branch information
patrickwestphal committed Jul 8, 2015
1 parent 1e661fb commit 1d4af87
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions php-examples/Suggestions.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,24 @@

$id = $client->generateID();

$ksID=$client->addKnowledgeSource($id,"sparql","http://dbpedia.org/sparql");
$ksID=$client->addKnowledgeSource($id,"sparqlfrag","http://dbpedia.org/sparql");
$client->applyConfigEntryInt($id, $ksID, "recursionDepth", 2);
$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->applyConfigEntryString($id, $ksID, "predefinedEndpoint", "DBPEDIA");
$client->applyConfigEntryBoolean($id, $ksID, "saveExtractedFragment", true);
// $client->applyConfigEntryBoolean($id, $ksID, "useLits", true);
$client->applyConfigEntryBoolean($id, $ksID, "getPropertyInformation", true);
$client->applyConfigEntryBoolean($id, $ksID, "propertyInformation", true);

$rID = $client->setReasoner($id, "fastInstanceChecker");
$rID = $client->setReasoner($id, "cwr");

$client->setLearningProblem($id, "posOnlyLP");
$client->setLearningProblem($id, "posonlylp");
$client->setPositiveExamples($id, $examples);

$laID = $client->setLearningAlgorithm($id, "celoe");
$client->applyConfigEntryInt($id, $laID, "maxExecutionTimeInSeconds", 1);
$client->applyConfigEntryBoolean($id, $laID, "useHasValueConstructor", true);
$client->applyConfigEntryInt($id, $laID, "valueFrequencyThreshold", 2);

$client->initAll($id);

Expand All @@ -61,13 +55,10 @@

$concepts = json_decode($concepts);

// var_dump($concepts);

echo '<table border="1px"><tr><td><i>natural description</i></td><td><i>Manchester OWL Syntax</i></td><td><i>accuracy</i></td></tr>';
echo '<table border="1px"><tr><td><i>Manchester OWL Syntax</i></td><td><i>accuracy</i></td></tr>';
foreach($concepts as $concept) {
$natural = $client->getNaturalDescription($id, $concept->descriptionKBSyntax);
// echo $natural . '(Manchester: ' . $concept->descriptionManchesterSyntax . ', acc. ' . $concept->scoreValue . ')<br />'; ;
echo '<tr><td>'.$natural.'</td><td>'.$concept->descriptionManchesterSyntax.'</td><td>'.$concept->scoreValue.'</td></tr>';
echo '<tr><td>'.$concept->descriptionManchesterSyntax.'</td><td>'.$concept->scoreValue.'</td></tr>';
}
echo '</table>';

Expand Down

0 comments on commit 1d4af87

Please sign in to comment.