Example #1
0
/**
 * Small example showing how to use DL-Learner for learning class definitions. 
 * 
 * @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/swore/swore.rdf");
// create DL-Learner client
$client = new SoapClient("main.wsdl");
// $client = new SoapClient($wsdluri);
$id = $client->generateID();
$ksID = $client->addKnowledgeSource($id, "owlfile", $ontology);
$rID = $client->setReasoner($id, "fastInstanceChecker");
// create a learning problem
$lp = $client->setLearningProblem($id, "classLearning");
$client->applyConfigEntryURL($id, $lp, "classToDescribe", "http://ns.softwiki.de/req/CustomerRequirement");
$la_id = $client->setLearningAlgorithm($id, "celoe");
$client->applyConfigEntryInt($id, $la_id, "maxExecutionTimeInSeconds", 5);
$client->initAll($id);
// learn concept
echo 'start learning ... ';
// get only concept
// $concept = $client->learn($id, "manchester");
// get concept and additional information in JSON syntax
$concept = $client->learnDescriptionsEvaluated($id);
echo 'OK <br />';