From: <jen...@us...> - 2008-01-09 11:25:39
|
Revision: 354 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=354&view=rev Author: jenslehmann Date: 2008-01-09 03:25:03 -0800 (Wed, 09 Jan 2008) Log Message: ----------- - changed calls in DBpedia navigator and DLLearner web service to new SPARQL component - basic search functionality working (learning not working yet) - code improvements Modified Paths: -------------- trunk/src/dbpedia-navigator/Settings.php trunk/src/dbpedia-navigator/ajaxfunctions.php trunk/src/dbpedia-navigator/clearsession.php trunk/src/dbpedia-navigator/default.css trunk/src/dbpedia-navigator/index.php trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java Added Paths: ----------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/images/ajax-loader.gif Removed Paths: ------------- trunk/src/dbpedia-navigator/SparqlConnection.php trunk/src/dbpedia-navigator/ajax-loader.gif Copied: trunk/src/dbpedia-navigator/DLLearnerConnection.php (from rev 351, trunk/src/dbpedia-navigator/SparqlConnection.php) =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php (rev 0) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-01-09 11:25:03 UTC (rev 354) @@ -0,0 +1,243 @@ +<?php + +class DLLearnerConnection +{ + private $DBPediaUrl; + private $DLLearnerUri; + private $client; + private $id; + private $ksID; + + function DLLearnerConnection($DBPediaUrl,$DLLearnerUri,$id=0,$ksID=0) + { + ini_set('default_socket_timeout',200); + $this->DBPediaUrl=$DBPediaUrl; + $this->DLLearnerUri=$DLLearnerUri; + $this->client=new SoapClient("main.wsdl"); + $this->id=$id; + $this->ksID=$ksID; + } + + function getIDs() + { + $id=$this->client->generateID(); + $ksID=$this->client->addKnowledgeSource($id,"sparql",$this->DBPediaUrl); + return array(0 => $id, 1 => $ksID); + } + + function test() + { + $object=$this->client->test($this->id,$this->ksID); + return $object->item; + } + + function getConceptFromExamples($ttl,$posExamples,$negExamples) + { + $this->client->applyConfigEntryInt($this->id, $this->ksID, "numberOfRecursions", 2); + $this->client->applyConfigEntryStringArray($this->id, $this->ksID, "instances", array_merge($posExamples,$negExamples)); + $this->client->applyConfigEntryInt($this->id, $this->ksID, "filterMode", 0); + $this->client->applyConfigEntryStringArray($this->id, $this->ksID, "predList", array()); + $this->client->applyConfigEntryStringArray($this->id, $this->ksID, "objList", array()); + $this->client->applyConfigEntryStringArray($this->id, $this->ksID, "classList", array()); + $this->client->applyConfigEntryString($this->id, $this->ksID, "format", "KB"); + $this->client->applyConfigEntryBoolean($this->id, $this->ksID, "dumpToFile", true); + + $this->client->setReasoner($this->id, "dig"); + $this->client->setLearningProblem($this->id, "posNegDefinition"); + $this->client->setPositiveExamples($this->id, $posExamples); + $this->client->setNegativeExamples($this->id, $negExamples); + $this->client->setLearningAlgorithm($this->id, "refinement"); + + $start = microtime(true); + + $this->client->init($this->id); + + $threaded=true; + + if($threaded == false) { + + $concept = $this->client->learn($this->id); + + } else { + + $this->client->learnThreaded($this->id); + + $i = 1; + $sleeptime = 1; + + do { + // sleep a while + sleep($sleeptime); + + // see what we have learned so far + $concept=$this->client->getCurrentlyBestConcept($this->id); + $running=$this->client->isAlgorithmRunning($this->id); + + $seconds = $i * $sleeptime; + + $i++; + } while($seconds<$ttl&&$running); + + $this->client->stop($this->id); + } + return $concept; + } + + function getTriples($ttl,$individual) + { + $options=array("triples",$individual); + $this->client->startThread($this->id,$this->ksID,$options); + $i = 1; + $sleeptime = 1; + + do { + // sleep a while + sleep($sleeptime); + + // see if algorithm is running + if (!$this->client->isThreadRunning($this->id,$this->ksID,"triples")) + { + $object=$this->client->getFromSparql($this->id,$this->ksID,"triples"); + $array=$object->item; + if (count($array)==1) return $array; + $ret=array(); + foreach ($array as $element) + { + $items=preg_split("[<]",$element,-1, PREG_SPLIT_NO_EMPTY); + $ret[$items[0]]=$items[1]; + } + return $ret; + } + + $seconds = $i * $sleeptime; + $i++; + } while($seconds<$ttl); + + $this->client->stopSparqlThread($this->id,$this->ksID,"triples"); + return array(); + } + + function getSubjects($ttl,$label) + { + $options=array("subjects",$label,15); + $this->client->startThread($this->id,$this->ksID,$options); + $i = 1; + $sleeptime = 1; + + do { + // sleep a while + sleep($sleeptime); + + // see if algorithm is running + if (!$this->client->isThreadRunning($this->id,$this->ksID,"subjects")) + { + $object=$this->client->getFromSparql($this->id,$this->ksID,"subjects"); + return $object->item; + } + + $seconds = $i * $sleeptime; + $i++; + } while($seconds<$ttl); + + $this->client->stopSparqlThread($this->id,$this->ksID,"subjects"); + return array(); + } + + function getSubjectsFromConcept($ttl,$concept) + { + $options=array("conceptSubjects",$concept); + $this->client->startThread($this->id,$this->ksID,$options); + $i = 1; + $sleeptime = 1; + do { + // sleep a while + sleep($sleeptime); + + // see if algorithm is running + if (!$this->client->isThreadRunning($this->id,$this->ksID,"conceptSubjects")) + { + $object=$this->client->getFromSparql($this->id,$this->ksID,"conceptSubjects"); + return $object->item; + } + + $seconds = $i * $sleeptime; + $i++; + } while($seconds<$ttl); + + $this->client->stopSparqlThread($this->id,$this->ksID,"conceptSubjects"); + return array(); + } + + public function loadWSDLfiles($wsdluri){ + $main=DLLearnerConnection::getwsdl($wsdluri); + $other=DLLearnerConnection::getOtherWSDL($main); + $newMain=DLLearnerConnection::changeWSDL($main); + DLLearnerConnection::writeToFile("main.wsdl",$newMain); + $x=0; + foreach ($other as $o){ + DLLearnerConnection::writeToFile("def".($x++).".xsd",DLLearnerConnection::getwsdl($o)); + } + + } + + private function changeWSDL($wsdl){ + $before="<xsd:import schemaLocation=\""; + $after="\" namespace=\""; + $newWSDL=""; + $desca="def"; + $descb=".xsd"; + $x=0; + while($posstart= strpos ( $wsdl, $before )){ + + $posstart+=strlen($before); + $newWSDL.=substr($wsdl,0,$posstart); + $wsdl=substr($wsdl,$posstart); + $newWSDL.=$desca.($x++).$descb; + $posend= strpos ( $wsdl, $after ); + $wsdl=substr($wsdl,$posend); + + } + return $newWSDL.$wsdl; + + } + + private function getOtherWSDL($wsdl){ + $before="<xsd:import schemaLocation=\""; + $after="\" namespace=\""; + $ret=array(); + while($posstart= strpos ( $wsdl, $before )){ + $posstart+=strlen($before); + $wsdl=substr($wsdl,$posstart); + $posend= strpos ( $wsdl, $after ); + $tmp=substr($wsdl,0,$posend); + $ret[]=$tmp; + $wsdl=substr($wsdl,$posend+strlen($after)); + } + return $ret; + } + + + + + private function getwsdl($wsdluri){ + // this is copied from the Pear example + // please don't ask me how it works + $req = &new HTTP_Request($wsdluri); + $message=""; + $req->setMethod(HTTP_REQUEST_METHOD_GET); + $req->sendRequest(); + $ret=$req->getResponseBody(); + return $ret; + } + + + + private function writeToFile($filename,$content){ + + $fp=fopen($filename,"w"); + fwrite($fp,$content); + fclose($fp); + + } +} +?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/Settings.php =================================================================== --- trunk/src/dbpedia-navigator/Settings.php 2008-01-09 09:37:00 UTC (rev 353) +++ trunk/src/dbpedia-navigator/Settings.php 2008-01-09 11:25:03 UTC (rev 354) @@ -1,8 +1,12 @@ <?php class Settings{ - public $wsdluri="http://localhost:8181/services?wsdl"; - public $dbpediauri="http://localhost:8890/sparql"; + public $wsdluri='http://localhost:8181/services?wsdl'; + // local OpenLink SPARQL endpoint + // public $dbpediauri="http://localhost:8890/sparql"; + // public DBpedia SPARQL endpoint + public $dbpediauri='http://dbpedia.openlinksw.com:8890/sparql'; public $sparqlttl=60; -} +} + ?> \ No newline at end of file Deleted: trunk/src/dbpedia-navigator/SparqlConnection.php =================================================================== --- trunk/src/dbpedia-navigator/SparqlConnection.php 2008-01-09 09:37:00 UTC (rev 353) +++ trunk/src/dbpedia-navigator/SparqlConnection.php 2008-01-09 11:25:03 UTC (rev 354) @@ -1,243 +0,0 @@ -<?php - -class SparqlConnection -{ - private $DBPediaUrl; - private $DLLearnerUri; - private $client; - private $id; - private $ksID; - - function SparqlConnection($DBPediaUrl,$DLLearnerUri,$id=0,$ksID=0) - { - ini_set('default_socket_timeout',200); - $this->DBPediaUrl=$DBPediaUrl; - $this->DLLearnerUri=$DLLearnerUri; - $this->client=new SoapClient("main.wsdl"); - $this->id=$id; - $this->ksID=$ksID; - } - - function getIDs() - { - $id=$this->client->generateID(); - $ksID=$this->client->addKnowledgeSource($id,"sparql",$this->DBPediaUrl); - return array(0 => $id, 1 => $ksID); - } - - function test() - { - $object=$this->client->test($this->id,$this->ksID); - return $object->item; - } - - function getConceptFromExamples($ttl,$posExamples,$negExamples) - { - $this->client->applyConfigEntryInt($this->id, $this->ksID, "numberOfRecursions", 2); - $this->client->applyConfigEntryStringArray($this->id, $this->ksID, "instances", array_merge($posExamples,$negExamples)); - $this->client->applyConfigEntryInt($this->id, $this->ksID, "filterMode", 0); - $this->client->applyConfigEntryStringArray($this->id, $this->ksID, "predList", array()); - $this->client->applyConfigEntryStringArray($this->id, $this->ksID, "objList", array()); - $this->client->applyConfigEntryStringArray($this->id, $this->ksID, "classList", array()); - $this->client->applyConfigEntryString($this->id, $this->ksID, "format", "KB"); - $this->client->applyConfigEntryBoolean($this->id, $this->ksID, "dumpToFile", true); - - $this->client->setReasoner($this->id, "dig"); - $this->client->setLearningProblem($this->id, "posNegDefinition"); - $this->client->setPositiveExamples($this->id, $posExamples); - $this->client->setNegativeExamples($this->id, $negExamples); - $this->client->setLearningAlgorithm($this->id, "refinement"); - - $start = microtime(true); - - $this->client->init($this->id); - - $threaded=true; - - if($threaded == false) { - - $concept = $this->client->learn($this->id); - - } else { - - $this->client->learnThreaded($this->id); - - $i = 1; - $sleeptime = 1; - - do { - // sleep a while - sleep($sleeptime); - - // see what we have learned so far - $concept=$this->client->getCurrentlyBestConcept($this->id); - $running=$this->client->isAlgorithmRunning($this->id); - - $seconds = $i * $sleeptime; - - $i++; - } while($seconds<$ttl&&$running); - - $this->client->stop($this->id); - } - return $concept; - } - - function getTriples($ttl,$individual) - { - $options=array("triples",$individual); - $this->client->startThread($this->id,$this->ksID,$options); - $i = 1; - $sleeptime = 1; - - do { - // sleep a while - sleep($sleeptime); - - // see if algorithm is running - if (!$this->client->isThreadRunning($this->id,$this->ksID,"triples")) - { - $object=$this->client->getFromSparql($this->id,$this->ksID,"triples"); - $array=$object->item; - if (count($array)==1) return $array; - $ret=array(); - foreach ($array as $element) - { - $items=preg_split("[<]",$element,-1, PREG_SPLIT_NO_EMPTY); - $ret[$items[0]]=$items[1]; - } - return $ret; - } - - $seconds = $i * $sleeptime; - $i++; - } while($seconds<$ttl); - - $this->client->stopSparqlThread($this->id,$this->ksID,"triples"); - return array(); - } - - function getSubjects($ttl,$label) - { - $options=array("subjects",$label,15); - $this->client->startThread($this->id,$this->ksID,$options); - $i = 1; - $sleeptime = 1; - - do { - // sleep a while - sleep($sleeptime); - - // see if algorithm is running - if (!$this->client->isThreadRunning($this->id,$this->ksID,"subjects")) - { - $object=$this->client->getFromSparql($this->id,$this->ksID,"subjects"); - return $object->item; - } - - $seconds = $i * $sleeptime; - $i++; - } while($seconds<$ttl); - - $this->client->stopSparqlThread($this->id,$this->ksID,"subjects"); - return array(); - } - - function getSubjectsFromConcept($ttl,$concept) - { - $options=array("conceptSubjects",$concept); - $this->client->startThread($this->id,$this->ksID,$options); - $i = 1; - $sleeptime = 1; - do { - // sleep a while - sleep($sleeptime); - - // see if algorithm is running - if (!$this->client->isThreadRunning($this->id,$this->ksID,"conceptSubjects")) - { - $object=$this->client->getFromSparql($this->id,$this->ksID,"conceptSubjects"); - return $object->item; - } - - $seconds = $i * $sleeptime; - $i++; - } while($seconds<$ttl); - - $this->client->stopSparqlThread($this->id,$this->ksID,"conceptSubjects"); - return array(); - } - - public function loadWSDLfiles($wsdluri){ - $main=SparqlConnection::getwsdl($wsdluri); - $other=SparqlConnection::getOtherWSDL($main); - $newMain=SparqlConnection::changeWSDL($main); - SparqlConnection::writeToFile("main.wsdl",$newMain); - $x=0; - foreach ($other as $o){ - SparqlConnection::writeToFile("def".($x++).".xsd",SparqlConnection::getwsdl($o)); - } - - } - - private function changeWSDL($wsdl){ - $before="<xsd:import schemaLocation=\""; - $after="\" namespace=\""; - $newWSDL=""; - $desca="def"; - $descb=".xsd"; - $x=0; - while($posstart= strpos ( $wsdl, $before )){ - - $posstart+=strlen($before); - $newWSDL.=substr($wsdl,0,$posstart); - $wsdl=substr($wsdl,$posstart); - $newWSDL.=$desca.($x++).$descb; - $posend= strpos ( $wsdl, $after ); - $wsdl=substr($wsdl,$posend); - - } - return $newWSDL.$wsdl; - - } - - private function getOtherWSDL($wsdl){ - $before="<xsd:import schemaLocation=\""; - $after="\" namespace=\""; - $ret=array(); - while($posstart= strpos ( $wsdl, $before )){ - $posstart+=strlen($before); - $wsdl=substr($wsdl,$posstart); - $posend= strpos ( $wsdl, $after ); - $tmp=substr($wsdl,0,$posend); - $ret[]=$tmp; - $wsdl=substr($wsdl,$posend+strlen($after)); - } - return $ret; - } - - - - - private function getwsdl($wsdluri){ - // this is copied from the Pear example - // please don't ask me how it works - $req = &new HTTP_Request($wsdluri); - $message=""; - $req->setMethod(HTTP_REQUEST_METHOD_GET); - $req->sendRequest(); - $ret=$req->getResponseBody(); - return $ret; - } - - - - private function writeToFile($filename,$content){ - - $fp=fopen($filename,"w"); - fwrite($fp,$content); - fclose($fp); - - } -} -?> \ No newline at end of file Deleted: trunk/src/dbpedia-navigator/ajax-loader.gif =================================================================== (Binary files differ) Modified: trunk/src/dbpedia-navigator/ajaxfunctions.php =================================================================== --- trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-01-09 09:37:00 UTC (rev 353) +++ trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-01-09 11:25:03 UTC (rev 354) @@ -10,9 +10,9 @@ function getsubjects($label) { require_once("Settings.php"); - require_once("SparqlConnection.php"); + require_once("DLLearnerConnection.php"); $settings=new Settings(); - $sc=new SparqlConnection($settings->dbpediauri,$settings->wsdluri,$_SESSION['id'],$_SESSION['ksID']); + $sc=new DLLearnerConnection($settings->dbpediauri,$settings->wsdluri,$_SESSION['id'],$_SESSION['ksID']); $content=""; $subjects=$sc->getSubjects($settings->sparqlttl,$label); @@ -46,9 +46,9 @@ } if ($fromCache==-1) { require_once("Settings.php"); - require_once("SparqlConnection.php"); + require_once("DLLearnerConnection.php"); $settings=new Settings(); - $sc=new SparqlConnection($settings->dbpediauri,$settings->wsdluri,$_SESSION['id'],$_SESSION['ksID']); + $sc=new DLLearnerConnection($settings->dbpediauri,$settings->wsdluri,$_SESSION['id'],$_SESSION['ksID']); $triples=$sc->getTriples($settings->sparqlttl,$subject); $content=""; if (count($triples)==1) @@ -157,9 +157,9 @@ if (isset($_SESSION['positive'])&&isset($_SESSION['negative'])) { require_once("Settings.php"); - require_once("SparqlConnection.php"); + require_once("DLLearnerConnection.php"); $settings=new Settings(); - $sc=new SparqlConnection($settings->dbpediauri,$settings->wsdluri,$_SESSION['id'],$_SESSION['ksID']); + $sc=new DLLearnerConnection($settings->dbpediauri,$settings->wsdluri,$_SESSION['id'],$_SESSION['ksID']); $concept=$sc->getConceptFromExamples($settings->sparqlttl,$_SESSION['positive'],$_SESSION['negative']); $_SESSION['lastLearnedConcept']=$concept; @@ -175,9 +175,9 @@ function getSubjectsFromConcept() { require_once("Settings.php"); - require_once("SparqlConnection.php"); + require_once("DLLearnerConnection.php"); $settings=new Settings(); - $sc=new SparqlConnection($settings->dbpediauri,$settings->wsdluri,$_SESSION['id'],$_SESSION['ksID']); + $sc=new DLLearnerConnection($settings->dbpediauri,$settings->wsdluri,$_SESSION['id'],$_SESSION['ksID']); $content=""; if (isset($_SESSION['lastLearnedConcept'])) @@ -206,10 +206,10 @@ function searchAndShowArticle($keyword) { require_once("Settings.php"); - require_once("SparqlConnection.php"); + require_once("DLLearnerConnection.php"); $settings=new Settings(); - $sc=new SparqlConnection($settings->dbpediauri,$settings->wsdluri,$_SESSION['id'],$_SESSION['ksID']); + $sc=new DLLearnerConnection($settings->dbpediauri,$settings->wsdluri,$_SESSION['id'],$_SESSION['ksID']); $content=""; Modified: trunk/src/dbpedia-navigator/clearsession.php =================================================================== --- trunk/src/dbpedia-navigator/clearsession.php 2008-01-09 09:37:00 UTC (rev 353) +++ trunk/src/dbpedia-navigator/clearsession.php 2008-01-09 11:25:03 UTC (rev 354) @@ -4,10 +4,10 @@ session_unset(); ob_start(); require_once 'pear/HTTP_Request.php'; -require_once 'SparqlConnection.php'; +require_once 'DLLearnerConnection.php'; require_once 'Settings.php'; $settings=new Settings(); -SparqlConnection::loadWSDLfiles($settings->wsdluri); +DLLearnerConnection::loadWSDLfiles($settings->wsdluri); $index_uri = 'http://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['SCRIPT_NAME']).'/index.php'; header('Location: ' . $index_uri); ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/default.css =================================================================== --- trunk/src/dbpedia-navigator/default.css 2008-01-09 09:37:00 UTC (rev 353) +++ trunk/src/dbpedia-navigator/default.css 2008-01-09 11:25:03 UTC (rev 354) @@ -18,14 +18,15 @@ p { margin: 8px 0; } - -h2 { - margin: 0.5em 0 0.1em 0; -/* background-color: #eee;*/ - font-size: 110%; + +h1 { + margin: 0.2em; } + +h2 { + margin: 0.1em; +} - /* * Main site structure */ @@ -66,8 +67,11 @@ #clear { clear: both; } + +#validation { + padding: 0.5em; +} - /* * sidebar content (boxes) */ @@ -181,7 +185,7 @@ a, a:link, a:visited { color: #02a; text-decoration: none; - cursor: pointer; + /* cursor: pointer; */ } a:hover { Copied: trunk/src/dbpedia-navigator/images/ajax-loader.gif (from rev 351, trunk/src/dbpedia-navigator/ajax-loader.gif) =================================================================== (Binary files differ) Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-01-09 09:37:00 UTC (rev 353) +++ trunk/src/dbpedia-navigator/index.php 2008-01-09 11:25:03 UTC (rev 354) @@ -1,12 +1,14 @@ -<?php +<?php + ini_set('error_reporting',E_ALL); ini_set('max_execution_time',200); -ini_set("soap.wsdl_cache_enabled","1"); +ini_set("soap.wsdl_cache_enabled","1"); + session_start(); require_once('Settings.php'); -require_once('SparqlConnection.php'); +require_once('DLLearnerConnection.php'); $settings=new Settings(); -$sc=new SparqlConnection($settings->dbpediauri,$settings->wsdluri); +$sc=new DLLearnerConnection($settings->dbpediauri,$settings->wsdluri); $ids=$sc->getIDs(); $_SESSION['id']=$ids[0]; $_SESSION['ksID']=$ids[1]; @@ -20,7 +22,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> - <title>DL Learner</title> + <title>DBpedia Navigator</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> <link rel="stylesheet" href="default.css"/> <?php $xajax->printJavascript('xajax/'); ?> @@ -60,95 +62,99 @@ </script> </head> <body> + <p><a href='clearsession.php'>start from scratch</a></p> -<h3>DBPedia-Navigator-Test</h3> -<div id="layer" style="display:none"><div id="layerContent" style="display:none"></div></div> +<h1>DBPedia Navigator</h1> +<div id="layer" style="display:none"> + <div id="layerContent" style="display:none"></div> +</div> <div id="wrapper"> -<div id="leftSidebar"> + <div id="leftSidebar"> -<div class="box"> - <div class="boxtitle">Search</div> - <div class="boxcontent" id="search"> - Search:<br/> - <input type="text" name="label" id="label" /><br/> - <input type="button" value="Article" class="button" onclick="xajax_searchAndShowArticle(document.getElementById('label').value);return false;" /> - <input type="button" value="Fulltext" class="button" onclick=""/> - </div> <!-- boxcontent --> -</div> <!-- box --> + <div class="box"> + <div class="boxtitle">Search DBpedia</div> + <div class="boxcontent" id="search"> + <!-- Search:<br/> --> + <input type="text" name="label" id="label" /><br/> + <input type="button" value="Search" class="button" onclick="xajax_searchAndShowArticle(document.getElementById('label').value);return false;" /> + <!-- <input type="button" value="Fulltext" class="button" onclick=""/> --> + </div> <!-- boxcontent --> + </div> <!-- box --> -<div class="box"> - <div class="boxtitle">Searchresults</div> - <div class="boxcontent"> - <div id="searchcontent" style="display:block"></div> - <div id="loadingSubject" style="display:none"><img src="ajax-loader.gif" alt="Loading..."/></div> - </div> <!-- boxcontent --> -</div> <!-- box --> + <div class="box"> + <div class="boxtitle">Search Results</div> + <div class="boxcontent"> + <div id="searchcontent" style="display:block"></div> + <div id="loadingSubject" style="display:none"><img src="ajax-loader.gif" alt="Loading..."/></div> + </div> <!-- boxcontent --> + </div> <!-- box --> -<div class="box" id="concept"> - <div class="boxtitlewithbutton"><table border="0" class="titletable"><tr><td class="left">Learned Concept</td><td class="right"><input type="button" value="Learn" class="button" onclick="xajax_learnConcept();return false;" /></td></tr></table></div> - <div class="boxcontent"> - <div id="conceptcontent" style="display:none"></div> - <div id="loadingConcept" style="display:none"><img src="ajax-loader.gif" alt="Loading..."/></div> - </div> <!-- boxcontent --> -</div> <!-- box --> + <div class="box" id="concept"> + <div class="boxtitlewithbutton"><table border="0" class="titletable"><tr><td class="left">Learned Concept</td><td class="right"><input type="button" value="Learn" class="button" onclick="xajax_learnConcept();return false;" /></td></tr></table></div> + <div class="boxcontent"> + <div id="conceptcontent" style="display:none"></div> + <div id="loadingConcept" style="display:none"><img src="ajax-loader.gif" alt="Loading..."/></div> + </div> <!-- boxcontent --> + </div> <!-- box --> -<div class="box" id="conceptSubjects"> - <div class="boxtitlewithbutton"><table border="0" class="titletable"><tr><td class="left">Subjects From Concept</td><td class="right"><input type="button" value="Show" class="button" onclick="xajax_getSubjectsFromConcept();return false;" /></td></tr></table></div> - <div class="boxcontent"> - <div id="conceptsubjectcontent" style="display:none"></div> - <div id="loadingConceptSubjects" style="display:none"><img src="ajax-loader.gif" alt="Loading..."/></div> - </div> <!-- boxcontent --> -</div> <!-- box --> + <div class="box" id="conceptSubjects"> + <div class="boxtitlewithbutton"><table border="0" class="titletable"><tr><td class="left">Subjects From Concept</td><td class="right"><input type="button" value="Show" class="button" onclick="xajax_getSubjectsFromConcept();return false;" /></td></tr></table></div> + <div class="boxcontent"> + <div id="conceptsubjectcontent" style="display:none"></div> + <div id="loadingConceptSubjects" style="display:none"><img src="ajax-loader.gif" alt="Loading..."/></div> + </div> <!-- boxcontent --> + </div> <!-- box --> + + <div id="validation"> + <?php + $uri = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; + + echo '<div><a href="http://validator.w3.org/check?uri='.$uri.'"'; + echo '><img src="images/valid-xhtml10.png" alt="valid XHTML 1.0" /></a>'."\n"; + echo '<a href="http://jigsaw.w3.org/css-validator/validator?uri='.$uri.'"'; + echo '><img src="images/valid-css.png" alt="valid CSS" /></a></div>'."\n"; + ?> + </div> + + </div><!-- END leftSidebar --> -<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> -</div><!-- END leftSidebar --> + <div id="content"> + <div class="box"> + <div class="boxtitlewithbutton"><table border="0" class="titletable"><tr><td class="left" id="ArticleTitle">Article</td><td class="right"><span id="contentbuttons"></span></td></tr></table></div> + <div class="boxcontent" id="article"> + <div id="articlecontent" style="display:block"></div> + <div id="loadingArticle" style="display:none"><img src="ajax-loader.gif" alt="Loading..."/></div> + </div> <!-- boxcontent --> + </div> <!-- box --> + </div><!-- content --> + + <div id="rightSidebar"> -<div id="content"> -<div class="box"> - <div class="boxtitlewithbutton"><table border="0" class="titletable"><tr><td class="left" id="ArticleTitle">Article</td><td class="right"><span id="contentbuttons"></span></td></tr></table></div> - <div class="boxcontent" id="article"> - <div id="articlecontent" style="display:block"></div> - <div id="loadingArticle" style="display:none"><img src="ajax-loader.gif" alt="Loading..."/></div> - </div> <!-- boxcontent --> -</div> <!-- box --> + <div class="box"> + <div class="boxtitlewithbutton"><table border="0" class="titletable"><tr><td class="left">Positives</td><td class="right"><input type="button" value="Clear" class="button" onclick="xajax_clearPositives();return false;" /></td></tr></table></div> + <div class="boxcontent" id="Positives"> + </div> <!-- boxcontent --> + </div> <!-- box --> -<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> -</div><!-- content --> -<div id="rightSidebar"> + <div class="box"> + <div class="boxtitlewithbutton"><table border="0" class="titletable"><tr><td class="left">Negatives</td><td class="right"><input type="button" value="Clear" class="button" onclick="xajax_clearNegatives();return false;" /></td></tr></table></div> + <div class="boxcontent" id="Negatives"> + </div> <!-- boxcontent --> + </div> <!-- box --> -<div class="box"> - <div class="boxtitlewithbutton"><table border="0" class="titletable"><tr><td class="left">Positives</td><td class="right"><input type="button" value="Clear" class="button" onclick="xajax_clearPositives();return false;" /></td></tr></table></div> - <div class="boxcontent" id="Positives"> - </div> <!-- boxcontent --> -</div> <!-- box --> + <div class="box"> + <div class="boxtitle">Last Articles</div> + <div class="boxcontent" id="lastarticles"> + </div> <!-- boxcontent --> + </div> <!-- box --> -<div class="box"> - <div class="boxtitlewithbutton"><table border="0" class="titletable"><tr><td class="left">Negatives</td><td class="right"><input type="button" value="Clear" class="button" onclick="xajax_clearNegatives();return false;" /></td></tr></table></div> - <div class="boxcontent" id="Negatives"> - </div> <!-- boxcontent --> -</div> <!-- box --> - -<div class="box"> - <div class="boxtitle">Last Articles</div> - <div class="boxcontent" id="lastarticles"> - </div> <!-- boxcontent --> -</div> <!-- box --> - -<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> -</div><!-- rightSidebar --> -<div id="clear"></div> -</div> -<?php + </div><!-- rightSidebar --> + + <!-- <div id="clear"></div> --> + -$uri = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; - -echo '<div><a href="http://validator.w3.org/check?uri='.$uri.'"'; -echo '><img src="images/valid-xhtml10.png" alt="valid XHTML 1.0" /></a>'."\n"; -echo '<a href="http://jigsaw.w3.org/css-validator/validator?uri='.$uri.'"'; -echo '><img src="images/valid-css.png" alt="valid CSS" /></a></div>'."\n"; - -?> - + +</div><!-- wrapper --> </body> </html> \ No newline at end of file Modified: trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2008-01-09 09:37:00 UTC (rev 353) +++ trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2008-01-09 11:25:03 UTC (rev 354) @@ -46,6 +46,7 @@ import org.dllearner.core.dl.Individual; import org.dllearner.kb.OWLFile; import org.dllearner.kb.SparqlEndpoint; +import org.dllearner.kb.SparqlEndpointRestructured; import org.dllearner.learningproblems.PosNegDefinitionLP; import org.dllearner.learningproblems.PosNegInclusionLP; import org.dllearner.learningproblems.PosOnlyDefinitionLP; @@ -59,7 +60,6 @@ * DL-Learner web service interface. * * @author Jens Lehmann - * @author Sebastian Hellmann * */ @WebService(name = "DLLearnerWebService") @@ -79,7 +79,8 @@ public DLLearnerWS() { knowledgeSourceMapping.put("owlfile", OWLFile.class); - knowledgeSourceMapping.put("sparql", SparqlEndpoint.class); + knowledgeSourceMapping.put("sparqlold", SparqlEndpoint.class); + knowledgeSourceMapping.put("sparql", SparqlEndpointRestructured.class); reasonerMapping.put("dig", DIGReasoner.class); learningProblemMapping.put("posNegDefinition", PosNegDefinitionLP.class); learningProblemMapping.put("posNegInclusion", PosNegInclusionLP.class); @@ -460,11 +461,10 @@ return Datastructures.sortedSet2StringListIndividuals(individuals); } - //////////////////////////////////// - // sparql modul methods // - //////////////////////////////////// + //////////////////////////////////////// + // SPARQL component methods // + //////////////////////////////////////// - @WebMethod public void startThread(int id, int componentID, String[] options) throws ClientNotKnownException { @@ -478,10 +478,10 @@ thread = new Thread() { @Override public void run() { - ((SparqlEndpoint)component).setSubjectThread(this); - ((SparqlEndpoint)component).setSubjectThreadRunning(true); - ((SparqlEndpoint)component).calculateSubjects(label,limit); - ((SparqlEndpoint)component).setSubjectThreadRunning(false); + ((SparqlEndpointRestructured)component).setSubjectThread(this); + ((SparqlEndpointRestructured)component).setSubjectThreadRunning(true); + ((SparqlEndpointRestructured)component).calculateSubjects(label,limit); + ((SparqlEndpointRestructured)component).setSubjectThreadRunning(false); } }; } else if (method.equals("triples")){ @@ -489,10 +489,10 @@ thread = new Thread() { @Override public void run() { - ((SparqlEndpoint)component).setTriplesThread(this); - ((SparqlEndpoint)component).setTriplesThreadRunning(true); - ((SparqlEndpoint)component).calculateTriples(subject); - ((SparqlEndpoint)component).setTriplesThreadRunning(false); + ((SparqlEndpointRestructured)component).setTriplesThread(this); + ((SparqlEndpointRestructured)component).setTriplesThreadRunning(true); + ((SparqlEndpointRestructured)component).calculateTriples(subject); + ((SparqlEndpointRestructured)component).setTriplesThreadRunning(false); } }; } else if (method.equals("conceptSubjects")){ @@ -500,10 +500,10 @@ thread = new Thread() { @Override public void run() { - ((SparqlEndpoint)component).setConceptThread(this); - ((SparqlEndpoint)component).setConceptThreadRunning(true); - ((SparqlEndpoint)component).calculateConceptSubjects(concept); - ((SparqlEndpoint)component).setConceptThreadRunning(false); + ((SparqlEndpointRestructured)component).setConceptThread(this); + ((SparqlEndpointRestructured)component).setConceptThreadRunning(true); + ((SparqlEndpointRestructured)component).calculateConceptSubjects(concept); + ((SparqlEndpointRestructured)component).setConceptThreadRunning(false); } }; } @@ -516,11 +516,11 @@ ClientState state = getState(id); Component component = state.getComponent(componentID); if (option.equals("subjects")) - return ((SparqlEndpoint)component).subjectThreadIsRunning(); + return ((SparqlEndpointRestructured)component).subjectThreadIsRunning(); else if (option.equals("triples")) - return ((SparqlEndpoint)component).triplesThreadIsRunning(); + return ((SparqlEndpointRestructured)component).triplesThreadIsRunning(); else if (option.equals("conceptSubjects")) - return ((SparqlEndpoint)component).conceptThreadIsRunning(); + return ((SparqlEndpointRestructured)component).conceptThreadIsRunning(); return true; } @@ -530,11 +530,11 @@ ClientState state = getState(id); Component component = state.getComponent(componentID); if (option.equals("subjects")) - ((SparqlEndpoint)component).getSubjectThread().stop(); + ((SparqlEndpointRestructured)component).getSubjectThread().stop(); else if (option.equals("triples")) - ((SparqlEndpoint)component).getTriplesThread().stop(); + ((SparqlEndpointRestructured)component).getTriplesThread().stop(); else if (option.equals("conceptSubjects")) - ((SparqlEndpoint)component).getConceptThread().stop(); + ((SparqlEndpointRestructured)component).getConceptThread().stop(); } @WebMethod @@ -543,11 +543,11 @@ ClientState state = getState(id); Component component = state.getComponent(componentID); if (option.equals("subjects")) - return ((SparqlEndpoint)component).getSubjects(); + return ((SparqlEndpointRestructured)component).getSubjects(); else if (option.equals("triples")) - return ((SparqlEndpoint)component).getTriples(); + return ((SparqlEndpointRestructured)component).getTriples(); else if (option.equals("conceptSubjects")) - return ((SparqlEndpoint)component).getConceptSubjects(); + return ((SparqlEndpointRestructured)component).getConceptSubjects(); return new String[0]; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |