Example #1
0
 *
 */
/**
 * Small example showing how to use DL-Learner for reasoning. 
 * 
 * @author Jens Lehmann
 */
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);
// specifiy ontology
$ontology = 'file:' . realpath("../../examples/family/father.owl");
// create DL-Learner client
$client = new SoapClient("main.wsdl");
// load owl file in DIG reasoner (you need a running DIG reasoner)
$id = $client->generateID();
$ksID = $client->addKnowledgeSource($id, "owlfile", $ontology);
$client->init($id, $ksID);
$rID = $client->setReasoner($id, "dig");
$client->init($id, $rID);
// create a concept in internal DL-Learner syntax
// ( = all female persons having at least one child)
$concept = '("http://example.com/father#female" AND EXISTS "http://example.com/father#hasChild".TOP)';
$instances = $client->retrieval($id, $concept);
// print instances
echo 'instances of ' . $concept . ': <br />';
echo '<pre>';
print_r($instances->item);
echo '</pre>';