Example #1
0
$client = new SoapClient("main.wsdl");
// load owl file in reasoner
$id = $client->generateID();
$ksID = $client->addKnowledgeSource($id, "owlfile", $ontology);
$rID = $client->setReasoner($id, "cwr");
// create a learning problem
$posExamples = array('http://localhost/foo#heinrich', 'http://localhost/foo#alfred', 'http://localhost/foo#heinz', 'http://localhost/foo#hans', 'http://localhost/foo#alex');
$negExamples = array('http://localhost/foo#jan', 'http://localhost/foo#markus', 'http://localhost/foo#susi', 'http://localhost/foo#anna', 'http://localhost/foo#maria', 'http://localhost/foo#katrin', 'http://localhost/foo#johanna', 'http://localhost/foo#mandy', 'http://localhost/foo#miriam', 'http://localhost/foo#hanna');
$client->setLearningProblem($id, "posNegStandard");
$client->setPositiveExamples($id, $posExamples);
$client->setNegativeExamples($id, $negExamples);
// choose refinement operator approach
$client->setLearningAlgorithm($id, "celoe");
$client->initAll($id);
// start learning process in DL-Learner
$client->learnThreaded($id);
$sleeptime = 2;
$seconds = 0;
do {
    // sleep a while
    sleep($sleeptime);
    // see what we have learned so far
    $concept = $client->getCurrentlyBestConcept($id);
    $running = $client->isAlgorithmRunning($id);
    $seconds += $sleeptime;
    if ($seconds == 10) {
        $sleeptime = 5;
    }
    echo 'result after ' . $seconds . ' seconds: ' . $concept . '<br />';
    flush();
} while ($running);