You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(120) |
Sep
(36) |
Oct
(116) |
Nov
(17) |
Dec
(44) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(143) |
Feb
(192) |
Mar
(74) |
Apr
(84) |
May
(105) |
Jun
(64) |
Jul
(49) |
Aug
(120) |
Sep
(159) |
Oct
(156) |
Nov
(51) |
Dec
(28) |
2009 |
Jan
(17) |
Feb
(55) |
Mar
(33) |
Apr
(57) |
May
(54) |
Jun
(28) |
Jul
(6) |
Aug
(16) |
Sep
(38) |
Oct
(30) |
Nov
(26) |
Dec
(52) |
2010 |
Jan
(7) |
Feb
(91) |
Mar
(65) |
Apr
(2) |
May
(14) |
Jun
(25) |
Jul
(38) |
Aug
(48) |
Sep
(80) |
Oct
(70) |
Nov
(75) |
Dec
(77) |
2011 |
Jan
(68) |
Feb
(53) |
Mar
(51) |
Apr
(35) |
May
(65) |
Jun
(101) |
Jul
(29) |
Aug
(230) |
Sep
(95) |
Oct
(49) |
Nov
(110) |
Dec
(63) |
2012 |
Jan
(41) |
Feb
(42) |
Mar
(25) |
Apr
(46) |
May
(51) |
Jun
(44) |
Jul
(45) |
Aug
(29) |
Sep
(12) |
Oct
(9) |
Nov
(17) |
Dec
(2) |
2013 |
Jan
(12) |
Feb
(14) |
Mar
(7) |
Apr
(16) |
May
(54) |
Jun
(27) |
Jul
(11) |
Aug
(5) |
Sep
(85) |
Oct
(27) |
Nov
(37) |
Dec
(32) |
2014 |
Jan
(8) |
Feb
(29) |
Mar
(5) |
Apr
(3) |
May
(22) |
Jun
(3) |
Jul
(4) |
Aug
(3) |
Sep
|
Oct
|
Nov
|
Dec
|
From: <sk...@us...> - 2008-01-15 16:00:12
|
Revision: 377 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=377&view=rev Author: sknappe Date: 2008-01-15 08:00:04 -0800 (Tue, 15 Jan 2008) Log Message: ----------- added language support (very rudimentary) Modified Paths: -------------- trunk/src/dbpedia-navigator/Settings.php Modified: trunk/src/dbpedia-navigator/Settings.php =================================================================== --- trunk/src/dbpedia-navigator/Settings.php 2008-01-15 15:58:49 UTC (rev 376) +++ trunk/src/dbpedia-navigator/Settings.php 2008-01-15 16:00:04 UTC (rev 377) @@ -37,6 +37,8 @@ // public $dbpediauri='http://dbpedia2.openlinksw.com:8890/isparql'; public $sparqlttl=60; + //not yet used + public $language="en"; } ?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-01-15 15:58:51
|
Revision: 376 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=376&view=rev Author: sknappe Date: 2008-01-15 07:58:49 -0800 (Tue, 15 Jan 2008) Log Message: ----------- now only gets english labels Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryMaker.java Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryMaker.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryMaker.java 2008-01-15 15:56:51 UTC (rev 375) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryMaker.java 2008-01-15 15:58:49 UTC (rev 376) @@ -169,7 +169,7 @@ public static String makeLabelQuery(String label,int limit){ //TODO maybe use http://xmlns:com/foaf/0.1/page return "SELECT DISTINCT ?subject\n"+ - "WHERE { ?subject <http://www.w3.org/2000/01/rdf-schema#label> ?object.?object bif:contains '\""+label+"\"'}\n"+ + "WHERE { ?subject <http://www.w3.org/2000/01/rdf-schema#label> ?object.?object bif:contains '\""+label+"\"'@en}\n"+ "LIMIT "+limit; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-01-15 15:56:53
|
Revision: 375 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=375&view=rev Author: sknappe Date: 2008-01-15 07:56:51 -0800 (Tue, 15 Jan 2008) Log Message: ----------- changed sparql query for subjects, it's faster now Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryMaker.java Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryMaker.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryMaker.java 2008-01-15 15:24:16 UTC (rev 374) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryMaker.java 2008-01-15 15:56:51 UTC (rev 375) @@ -169,7 +169,7 @@ public static String makeLabelQuery(String label,int limit){ //TODO maybe use http://xmlns:com/foaf/0.1/page return "SELECT DISTINCT ?subject\n"+ - "WHERE { ?subject <http://xmlns.com/foaf/0.1/page> ?object.FILTER regex(?object,\""+label+"\"@en)}\n"+ + "WHERE { ?subject <http://www.w3.org/2000/01/rdf-schema#label> ?object.?object bif:contains '\""+label+"\"'}\n"+ "LIMIT "+limit; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-01-15 15:24:22
|
Revision: 374 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=374&view=rev Author: sknappe Date: 2008-01-15 07:24:16 -0800 (Tue, 15 Jan 2008) Log Message: ----------- fixed bug, that learning wasn't possible Modified Paths: -------------- trunk/src/dbpedia-navigator/ajaxfunctions.php trunk/src/dbpedia-navigator/index.php Modified: trunk/src/dbpedia-navigator/ajaxfunctions.php =================================================================== --- trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-01-15 13:31:14 UTC (rev 373) +++ trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-01-15 15:24:16 UTC (rev 374) @@ -287,15 +287,22 @@ { if (isset($_SESSION['positive'])) { + $posArray=array(); + foreach ($_SESSION['positive'] as $pos) + $posArray[]=$pos; + $negArray=array(); + if (isset($_SESSION['negative'])) + foreach ($_SESSION['negative'] as $neg) + $negArray[]=$neg; + require_once("Settings.php"); require_once("DLLearnerConnection.php"); $settings=new Settings(); $sc=new DLLearnerConnection($settings->dbpediauri,$settings->wsdluri,$_SESSION['id'],$_SESSION['ksID']); - if(isset($_SESSION['negative'])) - $concept=$sc->getConceptFromExamples($settings->sparqlttl,$_SESSION['positive'],$_SESSION['negative']); - else - $concept=$sc->getConceptFromExamples($settings->sparqlttl,$_SESSION['positive'], array()); + + $concept=$sc->getConceptFromExamples($settings->sparqlttl,$posArray,$negArray); + $_SESSION['lastLearnedConcept']=$concept; if (strlen(substr (strrchr ($concept, "/"), 1))>0) $concept=urldecode(substr (strrchr ($concept, "/"), 1)); } Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-01-15 13:31:14 UTC (rev 373) +++ trunk/src/dbpedia-navigator/index.php 2008-01-15 15:24:16 UTC (rev 374) @@ -238,7 +238,10 @@ <li>[if possible] Find an easy way to validate HTML/JS in AJAX applications.</li> <li>[maybe] Would be interesting to somehow view the Wikipedia article (without the left navigation part, tabs etc.) as an overlay, because the Wikipedia article will almost always be a human-friendlier - description of an object compared to the extracted one.</li> + description of an object compared to the extracted one.</li> + <li>Handle redirect for example if you look for 'Deutschland'</li> + <li>Ich habe mir gestern deswegen mal angeschaut welche fertigen SPARQL-APIs es gibt. Eine der verbreitesten und deshalb auch aktiven Projekt ist Jena. F\xFCr uns relevant ist das ARQ-Teilprojekt: http://jena.sourceforge.net/ARQ/. + </li> </ul> </div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-01-15 13:31:16
|
Revision: 373 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=373&view=rev Author: sknappe Date: 2008-01-15 05:31:14 -0800 (Tue, 15 Jan 2008) Log Message: ----------- when nothing is found, now automatically a search is started Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/ajaxfunctions.php Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-01-15 10:21:31 UTC (rev 372) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-01-15 13:31:14 UTC (rev 373) @@ -113,8 +113,8 @@ if (!$this->client->isThreadRunning($this->id,$this->ksID,"triples")) { $object=$this->client->getFromSparql($this->id,$this->ksID,"triples"); - if (count($object)==0) return array(); - $array=$object->item; + @$array=$object->item; + if ($array==NULL) return array(); if (count($array)==1) return $array; $ret=array(); foreach ($array as $element) @@ -260,4 +260,12 @@ } } -?> \ No newline at end of file + +/*require_once("Settings.php"); +require_once("DLLearnerConnection.php"); +$settings=new Settings(); +$sc=new DLLearnerConnection($settings->dbpediauri,$settings->wsdluri); +$ids=$sc->getIDs(); +$sc=new DLLearnerConnection($settings->dbpediauri,$settings->wsdluri,$ids[0],$ids[1]); +$triples=$sc->getTriples($settings->sparqlttl,"dog");*/ +?> Modified: trunk/src/dbpedia-navigator/ajaxfunctions.php =================================================================== --- trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-01-15 10:21:31 UTC (rev 372) +++ trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-01-15 13:31:14 UTC (rev 373) @@ -20,13 +20,13 @@ if (count($subjects)==1) { if (strpos($subjects,"[Error]")===0) $content.=substr($subjects,7); - else $content.="<a href=\"\" onclick=\"xajax_getAndShowArticle('".str_replace("_"," ",substr (strrchr ($subjects, "/"), 1))."',-1);return false;\">".str_replace("_"," ",urldecode(substr (strrchr ($subjects, "/"), 1)))."</a><br/>"; + else $content.="<a href=\"\" onclick=\"xajax_getAndShowArticle('".str_replace("_"," ",substr (strrchr ($subjects, "/"), 1))."',-2);return false;\">".str_replace("_"," ",urldecode(substr (strrchr ($subjects, "/"), 1)))."</a><br/>"; } else if (count($subjects)==0) $content.="No search result found in time."; else{ foreach ($subjects as $subject) { - $content.="<a href=\"\" onclick=\"xajax_getAndShowArticle('".str_replace("_"," ",substr (strrchr ($subject, "/"), 1))."',-1);return false;\">".str_replace("_"," ",urldecode(substr (strrchr ($subject, "/"), 1)))."</a><br/>"; + $content.="<a href=\"\" onclick=\"xajax_getAndShowArticle('".str_replace("_"," ",substr (strrchr ($subject, "/"), 1))."',-2);return false;\">".str_replace("_"," ",urldecode(substr (strrchr ($subject, "/"), 1)))."</a><br/>"; } } @@ -57,20 +57,22 @@ break; } } - if ($fromCache==-1) { + if ($fromCache<0) { require_once("Settings.php"); require_once("DLLearnerConnection.php"); $settings=new Settings(); $sc=new DLLearnerConnection($settings->dbpediauri,$settings->wsdluri,$_SESSION['id'],$_SESSION['ksID']); $triples=$sc->getTriples($settings->sparqlttl,$subject); $content=""; + $searchResult=""; + $objResponse = new xajaxResponse(); if (count($triples)==1) { // ToDo: find out why this was treated in a special way by Sebastian $content.=substr($triples,7); } else if (count($triples)==0) { - $content.="Did not find an article with that name."; + $content.="Did not find an article with that name. Similar Articles are shown under 'Search Results'."; } else { // goal: display the data in a nice (DBpedia specific way), maybe similar to @@ -112,19 +114,34 @@ // display the remaining properties as list which can be used for further navigation - $content .= '<br/><br/><br/><br/><br/><br/>'.get_triple_table($triples); + $content .= '<br/><br/><br/><br/><br/><br/>'.get_triple_table($triples); + + //store article in session, to navigate between last 5 articles quickly + $contentArray=array('content' => $content,'subject' => $subject); + if (!isset($_SESSION['nextArticle'])){ + $_SESSION['nextArticle']=0; + $_SESSION['articles']=array(); + } + if ($_SESSION['nextArticle']==5) $_SESSION['nextArticle']=0; + $_SESSION['articles'][$_SESSION['nextArticle']]=$contentArray; + $_SESSION['currentArticle']=$_SESSION['nextArticle']; + $_SESSION['nextArticle']++; + + //Add Positives to Session + if (!isset($_SESSION['positive'])){ + $array=array($subject => $subject); + $_SESSION['positive']=$array; + } + else{ + $array=$_SESSION['positive']; + $array[$subject]=$subject; + $_SESSION['positive']=$array; + } + + //build Subject and Searchresults + if ($fromCache==-1) + $searchResult.="<a href=\"\" onclick=\"xajax_getAndShowSubjects('".str_replace("_"," ",substr (strrchr ($subject, "/"), 1))."');return false;\">Show more Results</a>"; } - - //store article in session, to navigate between last 5 articles quickly - $contentArray=array('content' => $content,'subject' => $subject); - if (!isset($_SESSION['nextArticle'])){ - $_SESSION['nextArticle']=0; - $_SESSION['articles']=array(); - } - if ($_SESSION['nextArticle']==5) $_SESSION['nextArticle']=0; - $_SESSION['articles'][$_SESSION['nextArticle']]=$contentArray; - $_SESSION['currentArticle']=$_SESSION['nextArticle']; - $_SESSION['nextArticle']++; } else { $content=$_SESSION['articles'][$fromCache]['content']; @@ -132,47 +149,33 @@ } $lastArticles=""; - foreach ($_SESSION['articles'] as $key => $value) - { - $lastArticles.="<a href=\"\" onclick=\"xajax_getAndShowArticle('',".$key.");return false;\">".str_replace("_"," ",urldecode(substr (strrchr ($value['subject'], "/"), 1)))."</a><br/>"; - } + if (isset($_SESSION['articles'])) + foreach ($_SESSION['articles'] as $key => $value) + { + $lastArticles.="<a href=\"\" onclick=\"xajax_getAndShowArticle('',".$key.");return false;\">".str_replace("_"," ",urldecode(substr (strrchr ($value['subject'], "/"), 1)))."</a><br/>"; + } - //Add Positives to Session - if (!isset($_SESSION['positive'])){ - $array=array($subject => $subject); - $_SESSION['positive']=$array; - } - else{ - $array=$_SESSION['positive']; - $array[$subject]=$subject; - $_SESSION['positive']=$array; - } - - //build Subject and Searchresults - $searchResult="<a href=\"\" onclick=\"xajax_getAndShowArticle('".$subject."',-1);return false;\">".str_replace("_"," ",urldecode(substr (strrchr ($subject, "/"), 1)))."</a><br/>"; - $searchResult.="<a href=\"\" onclick=\"xajax_getAndShowSubjects('".str_replace("_"," ",substr (strrchr ($subject, "/"), 1))."');return false;\">Show more Results</a>"; - //put whole site content into session $_SESSION['artContent']=$content; $_SESSION['artTitle']=str_replace("_"," ",urldecode(substr (strrchr ($subject, "/"), 1))); $_SESSION['artLast']=$lastArticles; $_SESSION['artSubjects']=$searchResult; - //build the response - $objResponse = new xajaxResponse(); return $objResponse; } function showArticle() { - while (!isset($_SESSION['artLast'])){ + while (!isset($_SESSION['artSubjects'])){ sleep(0.5); } $objResponse = new xajaxResponse(); $objResponse->assign("articlecontent", "innerHTML", $_SESSION['artContent']); $objResponse->assign("ArticleTitle","innerHTML",$_SESSION['artTitle']); $objResponse->assign("lastarticles","innerHTML",$_SESSION['artLast']); - $objResponse->assign("searchcontent", "innerHTML", $_SESSION['artSubjects']); + if ($_SESSION['artSubjects']!="") $objResponse->assign("searchcontent", "innerHTML", $_SESSION['artSubjects']); + if (strpos($_SESSION['artContent'],"Did not find an article with that name")===0) + $objResponse->call('xajax_getAndShowSubjects',$_SESSION['artTitle']); unset($_SESSION['artContent']); unset($_SESSION['artTitle']); unset($_SESSION['artLast']); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-01-15 10:21:40
|
Revision: 372 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=372&view=rev Author: sknappe Date: 2008-01-15 02:21:31 -0800 (Tue, 15 Jan 2008) Log Message: ----------- removed bug with empty result Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-01-15 09:29:18 UTC (rev 371) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-01-15 10:21:31 UTC (rev 372) @@ -113,6 +113,7 @@ if (!$this->client->isThreadRunning($this->id,$this->ksID,"triples")) { $object=$this->client->getFromSparql($this->id,$this->ksID,"triples"); + if (count($object)==0) return array(); $array=$object->item; if (count($array)==1) return $array; $ret=array(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-01-15 09:29:21
|
Revision: 371 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=371&view=rev Author: sknappe Date: 2008-01-15 01:29:18 -0800 (Tue, 15 Jan 2008) Log Message: ----------- Articles are now automatically added to relevant interests but can be swapped to unrelevant or removed changed the way xajax is used to get better performance Modified Paths: -------------- trunk/src/dbpedia-navigator/ajax.php trunk/src/dbpedia-navigator/ajaxfunctions.php trunk/src/dbpedia-navigator/index.php Added Paths: ----------- trunk/src/dbpedia-navigator/images/minus.jpg trunk/src/dbpedia-navigator/images/plus.jpg Modified: trunk/src/dbpedia-navigator/ajax.php =================================================================== --- trunk/src/dbpedia-navigator/ajax.php 2008-01-14 11:54:55 UTC (rev 370) +++ trunk/src/dbpedia-navigator/ajax.php 2008-01-15 09:29:18 UTC (rev 371) @@ -3,15 +3,18 @@ $sid = session_id(); $xajax = new xajax("ajaxfunctions.php?sid=$sid"); -$xajax->register(XAJAX_FUNCTION, 'getsubjects', array( +$xajax->configureMany(array('debug'=>true)); +$xajax->register(XAJAX_FUNCTION, 'showSubjects', array( 'onResponseDelay' => 'showLoadingSubjects', 'beforeResponseProcessing' => 'hideLoadingSubjects' )); $xajax->registerFunction('getarticle'); -$xajax->registerFunction('addPositive'); -$xajax->registerFunction('addNegative'); +$xajax->registerFunction('toPositive'); +$xajax->registerFunction('toNegative'); $xajax->registerFunction('clearPositives'); $xajax->registerFunction('clearNegatives'); +$xajax->registerFunction('showInterests'); +$xajax->registerFunction('getAndShowArticle'); $xajax->register(XAJAX_FUNCTION, 'learnConcept', array( 'onResponseDelay' => 'showLoadingConcept', 'beforeResponseProcessing' => 'hideLoadingConcept' @@ -20,5 +23,9 @@ 'onResponseDelay' => 'showLoadingConceptSubjects', 'beforeResponseProcessing' => 'hideLoadingConceptSubjects' )); -$xajax->registerFunction('searchAndShowArticle'); +$xajax->registerFunction('getAndShowSubjects'); +$xajax->registerFunction('getsubjects'); +$xajax->registerFunction('showArticle'); +$xajax->registerFunction('removePosInterest'); +$xajax->registerFunction('removeNegInterest'); ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/ajaxfunctions.php =================================================================== --- trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-01-14 11:54:55 UTC (rev 370) +++ trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-01-15 09:29:18 UTC (rev 371) @@ -16,24 +16,37 @@ $content=""; $subjects=$sc->getSubjects($settings->sparqlttl,$label); + if (count($subjects)==1) { if (strpos($subjects,"[Error]")===0) $content.=substr($subjects,7); - else $content.="<a href=\"\" onclick=\"xajax_getarticle('".$subjects."',-1);return false;\">".str_replace("_"," ",urldecode(substr (strrchr ($subjects, "/"), 1)))."</a><br/>"; + else $content.="<a href=\"\" onclick=\"xajax_getAndShowArticle('".str_replace("_"," ",substr (strrchr ($subjects, "/"), 1))."',-1);return false;\">".str_replace("_"," ",urldecode(substr (strrchr ($subjects, "/"), 1)))."</a><br/>"; } else if (count($subjects)==0) $content.="No search result found in time."; else{ foreach ($subjects as $subject) { - $content.="<a href=\"\" onclick=\"xajax_getarticle('".$subject."',-1);return false;\">".str_replace("_"," ",urldecode(substr (strrchr ($subject, "/"), 1)))."</a><br/>"; + $content.="<a href=\"\" onclick=\"xajax_getAndShowArticle('".str_replace("_"," ",substr (strrchr ($subject, "/"), 1))."',-1);return false;\">".str_replace("_"," ",urldecode(substr (strrchr ($subject, "/"), 1)))."</a><br/>"; } } + $_SESSION['subjects']=$content; + $objResponse = new xajaxResponse(); - $objResponse->assign("searchcontent", "innerHTML", $content); return $objResponse; } +function showSubjects() +{ + while (!isset($_SESSION['subjects'])){ + sleep(0.5); + } + $objResponse = new xajaxResponse(); + $objResponse->assign("searchcontent", "innerHTML", $_SESSION['subjects']); + unset($_SESSION['subjects']); + return $objResponse; +} + function getarticle($subject,$fromCache) { if (isset($_SESSION['articles'])) @@ -50,7 +63,7 @@ $settings=new Settings(); $sc=new DLLearnerConnection($settings->dbpediauri,$settings->wsdluri,$_SESSION['id'],$_SESSION['ksID']); $triples=$sc->getTriples($settings->sparqlttl,$subject); - $content="";$contentbuttons=""; + $content=""; if (count($triples)==1) { // ToDo: find out why this was treated in a special way by Sebastian @@ -99,14 +112,11 @@ // display the remaining properties as list which can be used for further navigation - $content .= '<br/><br/><br/><br/><br/><br/>'.get_triple_table($triples); - - // $contentbuttons="<input type=\"button\" value=\"Positive\" class=\"button\" onclick=\"xajax_addPositive('".$subject."');return false;\" /> <input type=\"button\" value=\"Negative\" class=\"button\" onclick=\"xajax_addNegative('".$subject."');return false;\" />"; - $contentbuttons='<img src="images/green-plus.png" alt="positive example" onclick="xajax_addPositive(\''.$subject.'\')" /> <img src="images/red-minus.png" alt="negative example" onclick="xajax_addNegative(\''.$subject.'\') />'; + $content .= '<br/><br/><br/><br/><br/><br/>'.get_triple_table($triples); } //store article in session, to navigate between last 5 articles quickly - $contentArray=array('content' => $content,'contentbuttons' => $contentbuttons, 'subject' => $subject); + $contentArray=array('content' => $content,'subject' => $subject); if (!isset($_SESSION['nextArticle'])){ $_SESSION['nextArticle']=0; $_SESSION['articles']=array(); @@ -118,60 +128,101 @@ } else { $content=$_SESSION['articles'][$fromCache]['content']; - $contentbuttons=$_SESSION['articles'][$fromCache]['contentbuttons']; $subject=$_SESSION['articles'][$fromCache]['subject']; } $lastArticles=""; foreach ($_SESSION['articles'] as $key => $value) { - $lastArticles.="<a href=\"\" onclick=\"xajax_getarticle('',".$key.");return false;\">".str_replace("_"," ",urldecode(substr (strrchr ($value['subject'], "/"), 1)))."</a><br/>"; + $lastArticles.="<a href=\"\" onclick=\"xajax_getAndShowArticle('',".$key.");return false;\">".str_replace("_"," ",urldecode(substr (strrchr ($value['subject'], "/"), 1)))."</a><br/>"; } + //Add Positives to Session + if (!isset($_SESSION['positive'])){ + $array=array($subject => $subject); + $_SESSION['positive']=$array; + } + else{ + $array=$_SESSION['positive']; + $array[$subject]=$subject; + $_SESSION['positive']=$array; + } + + //build Subject and Searchresults + $searchResult="<a href=\"\" onclick=\"xajax_getAndShowArticle('".$subject."',-1);return false;\">".str_replace("_"," ",urldecode(substr (strrchr ($subject, "/"), 1)))."</a><br/>"; + $searchResult.="<a href=\"\" onclick=\"xajax_getAndShowSubjects('".str_replace("_"," ",substr (strrchr ($subject, "/"), 1))."');return false;\">Show more Results</a>"; + + //put whole site content into session + $_SESSION['artContent']=$content; + $_SESSION['artTitle']=str_replace("_"," ",urldecode(substr (strrchr ($subject, "/"), 1))); + $_SESSION['artLast']=$lastArticles; + $_SESSION['artSubjects']=$searchResult; + //build the response $objResponse = new xajaxResponse(); - $objResponse->assign("articlecontent", "innerHTML", $content); - $objResponse->assign("contentbuttons", "innerHTML", $contentbuttons); - $objResponse->assign("ArticleTitle","innerHTML",str_replace("_"," ",urldecode(substr (strrchr ($subject, "/"), 1)))); - $objResponse->assign("lastarticles","innerHTML",$lastArticles); return $objResponse; } -function addPositive($subject) +function showArticle() { + while (!isset($_SESSION['artLast'])){ + sleep(0.5); + } + $objResponse = new xajaxResponse(); + $objResponse->assign("articlecontent", "innerHTML", $_SESSION['artContent']); + $objResponse->assign("ArticleTitle","innerHTML",$_SESSION['artTitle']); + $objResponse->assign("lastarticles","innerHTML",$_SESSION['artLast']); + $objResponse->assign("searchcontent", "innerHTML", $_SESSION['artSubjects']); + unset($_SESSION['artContent']); + unset($_SESSION['artTitle']); + unset($_SESSION['artLast']); + unset($_SESSION['artSubjects']); + + $objResponse->call('xajax_showInterests'); + return $objResponse; +} + +function getAndShowArticle($subject,$fromCache) +{ + $objResponse = new xajaxResponse(); + $objResponse->call('xajax_getarticle',"http://dbpedia.org/resource/".str_replace(" ","_",$subject),$fromCache); + $objResponse->call('xajax_showArticle'); + return $objResponse; +} + +function toPositive($subject) +{ + unset($_SESSION['negative'][$subject]); if (!isset($_SESSION['positive'])){ - $array=array($subject); + $array=array($subject => $subject); $_SESSION['positive']=$array; } else{ $array=$_SESSION['positive']; - $array[]=$subject; + $array[$subject]=$subject; $_SESSION['positive']=$array; } - $content=str_replace("_"," ",urldecode(substr (strrchr ($subject, "/"), 1)))."<br/>"; - $objResponse = new xajaxResponse(); - $objResponse->append("Positives", "innerHTML", $content); + $objResponse->call('xajax_showInterests'); return $objResponse; } -function addNegative($subject) +function toNegative($subject) { + unset($_SESSION['positive'][$subject]); if (!isset($_SESSION['negative'])){ - $array=array($subject); + $array=array($subject => $subject); $_SESSION['negative']=$array; } else{ $array=$_SESSION['negative']; - $array[]=$subject; + $array[$subject]=$subject; $_SESSION['negative']=$array; } - $content=str_replace("_"," ",urldecode(substr (strrchr ($subject, "/"), 1)))."<br/>"; - $objResponse = new xajaxResponse(); - $objResponse->append("Negatives", "innerHTML", $content); + $objResponse->call('xajax_showInterests'); return $objResponse; } @@ -193,6 +244,42 @@ return $objResponse; } +function showInterests() +{ + //add Positives and Negatives to Interests + $posInterests=""; + if (isset($_SESSION['positive'])) foreach($_SESSION['positive'] as $pos){ + $posInterests=$posInterests.str_replace("_"," ",urldecode(substr (strrchr ($pos, "/"), 1)))." <a href=\"\" onclick=\"xajax_toNegative('".$pos."');return false;\"><img src=\"images/minus.jpg\" alt=\"Minus\"/></a> <a href=\"\" onclick=\"xajax_removePosInterest('".$pos."');return false;\"><img src=\"images/remove.png\" alt=\"Minus\"/></a><br/>"; + } + $negInterests=""; + if (isset($_SESSION['negative'])) foreach($_SESSION['negative'] as $neg){ + $negInterests=$negInterests.str_replace("_"," ",urldecode(substr (strrchr ($neg, "/"), 1)))." <a href=\"\" onclick=\"xajax_toPositive('".$neg."');return false;\"><img src=\"images/plus.jpg\" alt=\"Plus\"/></a> <a href=\"\" onclick=\"xajax_removeNegInterest('".$pos."');return false;\"><img src=\"images/remove.png\" alt=\"Minus\"/></a><br/>"; + } + + $objResponse=new xajaxResponse(); + $objResponse->assign('Positives','innerHTML',$posInterests); + $objResponse->assign('Negatives','innerHTML',$negInterests); + return $objResponse; +} + +function removePosInterest($subject) +{ + unset($_SESSION['positive'][$subject]); + + $objResponse = new xajaxResponse(); + $objResponse->call('xajax_showInterests'); + return $objResponse; +} + +function removeNegInterest($subject) +{ + unset($_SESSION['negative'][$subject]); + + $objResponse = new xajaxResponse(); + $objResponse->call('xajax_showInterests'); + return $objResponse; +} + function learnConcept() { if (isset($_SESSION['positive'])) @@ -247,19 +334,11 @@ return $objResponse; } -function searchAndShowArticle($keyword) +function getAndShowSubjects($keyword) { - require_once("Settings.php"); - require_once("DLLearnerConnection.php"); - $settings=new Settings(); - - $sc=new DLLearnerConnection($settings->dbpediauri,$settings->wsdluri,$_SESSION['id'],$_SESSION['ksID']); - - $content=""; - $objResponse = new xajaxResponse(); - $objResponse->call('xajax_getarticle', "http://dbpedia.org/resource/".str_replace(" ","_",$keyword),-1); $objResponse->call('xajax_getsubjects',$keyword); + $objResponse->call('xajax_showSubjects'); return $objResponse; } Added: trunk/src/dbpedia-navigator/images/minus.jpg =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/minus.jpg ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/plus.jpg =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/plus.jpg ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-01-14 11:54:55 UTC (rev 370) +++ trunk/src/dbpedia-navigator/index.php 2008-01-15 09:29:18 UTC (rev 371) @@ -81,9 +81,9 @@ <div class="boxtitle">Search DBpedia</div> <div class="boxcontent" id="search"> <!-- Search:<br/> --> - <form onSubmit="xajax_searchAndShowArticle(document.getElementById('label').value);return false;"> + <form onSubmit="xajax_getAndShowArticle(document.getElementById('label').value,-1);return false;"> <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="Search" class="button" onclick="xajax_getAndShowArticle(document.getElementById('label').value,-1);return false;" /> <!-- <input type="button" value="Fulltext" class="button" onclick=""/> --> </form> </div> <!-- boxcontent --> @@ -131,7 +131,7 @@ <div id="content"> <div class="box"> - <div class="boxtitlewithbutton"><table border="0" class="titletable"><tr><td class="left" id="ArticleTitle">Welcome</td><td class="right"><span id="contentbuttons"></span></td></tr></table></div> + <div class="boxtitle" id="ArticleTitle">Welcome</div> <div class="boxcontent" id="article"> <div id="articlecontent" style="display:block"> <br /><br /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-01-14 11:54:59
|
Revision: 370 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=370&view=rev Author: jenslehmann Date: 2008-01-14 03:54:55 -0800 (Mon, 14 Jan 2008) Log Message: ----------- - continued merge of SPARQL components - added example for SPARQL queries using Jena in org.dllearner.kb.sparql.SparqlQuery - updated and added Jena libraries @developers: Please update your classpath by adding the new jars in lib! Modified Paths: -------------- trunk/lib/jena/iri.jar trunk/lib/jena/jena.jar trunk/src/dl-learner/org/dllearner/cli/Start.java trunk/src/dl-learner/org/dllearner/server/ClientState.java trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java Added Paths: ----------- trunk/lib/jena/arq.jar trunk/lib/jena/commons-logging-1.1.jar trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlEndpoint.java trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQuery.java Removed Paths: ------------- trunk/lib/jena/commons-logging.jar trunk/src/dl-learner/org/dllearner/kb/SparqlEndpoint.java Added: trunk/lib/jena/arq.jar =================================================================== (Binary files differ) Property changes on: trunk/lib/jena/arq.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/lib/jena/commons-logging-1.1.jar =================================================================== (Binary files differ) Property changes on: trunk/lib/jena/commons-logging-1.1.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Deleted: trunk/lib/jena/commons-logging.jar =================================================================== (Binary files differ) Modified: trunk/lib/jena/iri.jar =================================================================== (Binary files differ) Modified: trunk/lib/jena/jena.jar =================================================================== (Binary files differ) Modified: trunk/src/dl-learner/org/dllearner/cli/Start.java =================================================================== --- trunk/src/dl-learner/org/dllearner/cli/Start.java 2008-01-14 08:56:17 UTC (rev 369) +++ trunk/src/dl-learner/org/dllearner/cli/Start.java 2008-01-14 11:54:55 UTC (rev 370) @@ -60,7 +60,7 @@ import org.dllearner.core.dl.Individual; import org.dllearner.kb.KBFile; import org.dllearner.kb.OWLFile; -import org.dllearner.kb.SparqlEndpoint; +import org.dllearner.kb.sparql.SparqlEndpoint; import org.dllearner.learningproblems.PosNegDefinitionLP; import org.dllearner.learningproblems.PosNegInclusionLP; import org.dllearner.learningproblems.PosOnlyDefinitionLP; Deleted: trunk/src/dl-learner/org/dllearner/kb/SparqlEndpoint.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/SparqlEndpoint.java 2008-01-14 08:56:17 UTC (rev 369) +++ trunk/src/dl-learner/org/dllearner/kb/SparqlEndpoint.java 2008-01-14 11:54:55 UTC (rev 370) @@ -1,510 +0,0 @@ -/** - * Copyright (C) 2007, Jens Lehmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.dllearner.kb; - -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URI; -import java.net.URL; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.Set; - -import org.dllearner.core.KnowledgeSource; -import org.dllearner.core.OntologyFormat; -import org.dllearner.core.OntologyFormatUnsupportedException; -import org.dllearner.core.config.BooleanConfigOption; -import org.dllearner.core.config.ConfigEntry; -import org.dllearner.core.config.ConfigOption; -import org.dllearner.core.config.IntegerConfigOption; -import org.dllearner.core.config.InvalidConfigOptionValueException; -import org.dllearner.core.config.StringConfigOption; -import org.dllearner.core.config.StringSetConfigOption; -import org.dllearner.core.config.StringTupleListConfigOption; -import org.dllearner.core.dl.KB; -import org.dllearner.kb.sparql.Manager; -import org.dllearner.kb.sparql.Manipulator; -import org.dllearner.kb.sparql.PredefinedEndpoint; -import org.dllearner.kb.sparql.PredefinedFilter; -import org.dllearner.kb.sparql.SparqlOntologyCollector; -import org.dllearner.kb.sparql.SparqlQueryType; -import org.dllearner.kb.sparql.SpecificSparqlEndpoint; -import org.dllearner.parser.KBParser; -import org.dllearner.reasoning.DIGConverter; -import org.dllearner.reasoning.JenaOWLDIGConverter; -import org.dllearner.utilities.StringTuple; - -/** - * Represents a SPARQL Endpoint. - * - * @author Jens Lehmann - * @author Sebastian Knappe - * @author Sebastian Hellmann - */ -public class SparqlEndpoint extends KnowledgeSource { - - // ConfigOptions - private URL url; - String host; - private Set<String> instances=new HashSet<String>();; - private URL dumpFile; - private int recursionDepth = 1; - private int predefinedFilter = 0; - private int predefinedEndpoint = 0; - private Set<String> predList=new HashSet<String>(); - private Set<String> objList=new HashSet<String>(); - // private Set<String> classList; - private String format = "N-TRIPLES"; - private boolean dumpToFile = true; - private boolean useLits = false; - private boolean getAllSuperClasses = true; - private boolean closeAfterRecursion = true; - private int breakSuperClassRetrievalAfter = 200; - - private boolean learnDomain = false; - private boolean learnRange = false; - private int numberOfInstancesUsedForRoleLearning=40; - private String role=""; - private String blankNodeIdentifier = "bnode"; - - LinkedList<StringTuple> URIParameters = new LinkedList<StringTuple>(); - LinkedList<StringTuple> replacePredicate = new LinkedList<StringTuple>(); - LinkedList<StringTuple> replaceObject = new LinkedList<StringTuple>(); - - /** - * Holds the results of the calculateSubjects method - */ - private String[] subjects; - - /** - * Holds the results of the calculateTriples method - */ - private String[] triples; - - /** - * Holds the results of the calculateConceptSubjects method - */ - private String[] conceptSubjects; - - /** - * if a method is running this becomes true - */ - private boolean subjectThreadRunning = false; - - private boolean triplesThreadRunning = false; - - private boolean conceptThreadRunning = false; - - /** - * the Thread that is running a method - */ - private Thread subjectThread; - - private Thread triplesThread; - - private Thread conceptThread; - - // received ontology as array, used if format=Array(an element of the - // array consists of the subject, predicate and object separated by '<' - private String[] ontArray; - - // received ontology as KB, the internal format - private KB kb; - - public static String getName() { - return "SPARQL Endpoint Restructured"; - } - - /** - * sets the ConfigOptions for this KnowledgeSource - * - * @return - */ - public static Collection<ConfigOption<?>> createConfigOptions() { - Collection<ConfigOption<?>> options = new LinkedList<ConfigOption<?>>(); - options.add(new StringConfigOption("url", "URL of SPARQL Endpoint")); - options.add(new StringConfigOption("host", "host of SPARQL Endpoint")); - options.add(new StringSetConfigOption("instances", - "relevant instances e.g. positive and negative examples in a learning problem")); - options.add(new IntegerConfigOption("recursionDepth", - "recursion depth of KB fragment selection", 2)); - options.add(new IntegerConfigOption("predefinedFilter", "the mode of the SPARQL Filter")); - options.add(new IntegerConfigOption("predefinedEndpoint", "the mode of the SPARQL Filter")); - - options.add(new StringSetConfigOption("predList", "list of all ignored roles")); - options.add(new StringSetConfigOption("objList", "list of all ignored objects")); - options.add(new StringSetConfigOption("classList", "list of all ignored classes")); - options.add(new StringConfigOption("format", "N-TRIPLES or KB format", "N-TRIPLES")); - options.add(new BooleanConfigOption("dumpToFile", - "Specifies whether the extracted ontology is written to a file or not.", true)); - options.add(new BooleanConfigOption("useLits", "use Literals in SPARQL query")); - options.add(new BooleanConfigOption("getAllSuperClasses", "If true then all superclasses are retrieved until the most general class (owl:Thing) is reached.", true)); - - options.add(new BooleanConfigOption("learnDomain", "learns the Domain for a Role")); - options.add(new BooleanConfigOption("learnRange", "learns the Range for a Role")); - options.add(new StringConfigOption("role", "role to learn Domain/Range from")); - options.add(new StringConfigOption("blankNodeIdentifier", - "used to identify blanknodes in Tripels")); - - options.add(new StringTupleListConfigOption("example", "example")); - options.add(new StringTupleListConfigOption("replacePredicate", "rule for replacing predicates")); - options.add(new StringTupleListConfigOption("replaceObject", "rule for replacing predicates")); - options.add(new IntegerConfigOption("breakSuperClassRetrievalAfter", "stops a cyclic hierarchy after specified number of classes")); - options.add(new IntegerConfigOption("numberOfInstancesUsedForRoleLearning", "")); - options.add(new BooleanConfigOption("closeAfterRecursion", "gets all classes for all instances")); - - - - return options; - } - - /* - * @see org.dllearner.core.Component#applyConfigEntry(org.dllearner.core.ConfigEntry) - */ - @Override - @SuppressWarnings( { "unchecked" }) - public <T> void applyConfigEntry(ConfigEntry<T> entry) throws InvalidConfigOptionValueException { - String option = entry.getOptionName(); - if (option.equals("url")) { - String s = (String) entry.getValue(); - try { - url = new URL(s); - } catch (MalformedURLException e) { - throw new InvalidConfigOptionValueException(entry.getOption(), entry.getValue(), - "malformed URL " + s); - } - } else if (option.equals("host")) { - host = (String) entry.getValue(); - } else if (option.equals("instances")) { - instances = (Set<String>) entry.getValue(); - } else if (option.equals("recursionDepth")) { - recursionDepth = (Integer) entry.getValue(); - } else if (option.equals("predList")) { - predList = (Set<String>) entry.getValue(); - } else if (option.equals("objList")) { - objList = (Set<String>) entry.getValue(); - //} else if (option.equals("classList")) { - // classList = (Set<String>) entry.getValue(); - } else if (option.equals("predefinedEndpoint")) { - predefinedEndpoint = (Integer) entry.getValue(); - } else if (option.equals("predefinedFilter")) { - predefinedFilter = (Integer) entry.getValue(); - } else if (option.equals("format")) { - format = (String) entry.getValue(); - } else if (option.equals("dumpToFile")) { - dumpToFile = (Boolean) entry.getValue(); - } else if (option.equals("useLits")) { - useLits = (Boolean) entry.getValue(); - } else if (option.equals("getAllSuperClasses")) { - getAllSuperClasses = (Boolean) entry.getValue(); - } else if (option.equals("learnDomain")) { - learnDomain = (Boolean) entry.getValue(); - }else if (option.equals("learnRange")) { - learnRange = (Boolean) entry.getValue(); - } else if (option.equals("role")) { - role = (String) entry.getValue(); - } else if (option.equals("blankNodeIdentifier")) { - blankNodeIdentifier = (String) entry.getValue(); - } else if (option.equals("example")) { - //System.out.println(entry.getValue()); - }else if (option.equals("replacePredicate")) { - replacePredicate = (LinkedList)entry.getValue(); - }else if (option.equals("replaceObject")) { - replaceObject = (LinkedList)entry.getValue(); - }else if (option.equals("breakSuperClassRetrievalAfter")) { - breakSuperClassRetrievalAfter = (Integer) entry.getValue(); - }else if (option.equals("numberOfInstancesUsedForRoleLearning")) { - numberOfInstancesUsedForRoleLearning = (Integer) entry.getValue(); - }else if (option.equals("closeAfterRecursion")) { - closeAfterRecursion = (Boolean) entry.getValue(); - } - - } - - /* - * (non-Javadoc) - * - * @see org.dllearner.core.Component#init() - */ - @Override - public void init() { - System.out.println("SparqlModul: Collecting Ontology"); - // SparqlOntologyCollector oc= - // new SparqlOntologyCollector(Datastructures.setToArray(instances), - // numberOfRecursions, filterMode, - // Datastructures.setToArray(predList),Datastructures.setToArray( - // objList),Datastructures.setToArray(classList),format,url,useLits); - Manager m = new Manager(); - SpecificSparqlEndpoint sse = null; - SparqlQueryType sqt = null; - // get Options for Manipulator - Manipulator man = new Manipulator(blankNodeIdentifier,breakSuperClassRetrievalAfter,replacePredicate,replaceObject); - HashMap<String, String> parameters = new HashMap<String, String>(); - parameters.put("default-graph-uri", "http://dbpedia.org"); - parameters.put("format", "application/sparql-results.xml"); - - // get Options for endpoints - if (predefinedEndpoint >= 1) { - sse = PredefinedEndpoint.getEndpoint(predefinedEndpoint); - } else { - sse = new SpecificSparqlEndpoint(url, host, parameters); - } - - // get Options for Filters - - if (predefinedFilter >= 1) { - sqt = PredefinedFilter.getFilter(predefinedFilter); - - } else { - sqt = new SparqlQueryType("forbid", objList, predList, useLits + ""); - - } - // give everything to the manager - m.useConfiguration(sqt, sse, man, recursionDepth, getAllSuperClasses,closeAfterRecursion); - try { - String ont = ""; - //System.out.println(learnDomain); - // used to learn a domain of a role - if (learnDomain || learnRange) { - Set<String> pos=new HashSet<String>(); - Set<String> neg=new HashSet<String>(); - if(learnDomain){ - pos = m.getDomainInstancesForRole(role); - neg = m.getRangeInstancesForRole(role); - }else if(learnRange){ - neg = m.getDomainInstancesForRole(role); - pos = m.getRangeInstancesForRole(role); - } - //choose 30 - - - Set<String> tmp=new HashSet<String>(); - for(String one:pos){ - tmp.add(one); - if(tmp.size()>=numberOfInstancesUsedForRoleLearning)break; - } - pos=tmp; - System.out.println("Instances used: "+pos.size()); - - tmp=new HashSet<String>(); - for(String one:neg){ - tmp.add(one); - if(tmp.size()>=numberOfInstancesUsedForRoleLearning)break; - } - neg=tmp; - - instances=new HashSet<String>(); - instances.addAll(pos); - - instances.addAll(neg); - - for(String one:pos){ - System.out.println("+\""+one+"\""); - } - for(String one:neg){ - System.out.println("-\""+one+"\""); - } - - /*Random r= new Random(); - - - Object[] arr=instances.toArray(); - while(instances.size()>=30){ - - }*/ - // add the role to the filter(a solution is always EXISTS - // role.TOP) - m.addPredicateFilter(role); - //System.out.println(instances); - // THIS is a workaround - - } - // the actual extraction is started here - ont = m.extract(instances); - System.out.println("Number of cached SPARQL queries: "+m.getConfiguration().numberOfCachedSparqlQueries); - System.out.println("Number of uncached SPARQL queries: "+m.getConfiguration().numberOfUncachedSparqlQueries); - - System.out.println("Finished collecting Fragment"); - - if (dumpToFile) { - String filename = System.currentTimeMillis() + ".nt"; - String basedir = "cache" + File.separator; - try { - if (!new File(basedir).exists()) - new File(basedir).mkdir(); - - FileWriter fw = new FileWriter(new File(basedir + filename), true); - fw.write(ont); - fw.flush(); - fw.close(); - - dumpFile = (new File(basedir + filename)).toURI().toURL(); - } catch (Exception e) { - e.printStackTrace(); - } - } - if (format.equals("KB")) { - try { - //kb = KBParser.parseKBFile(new StringReader(ont)); - kb=KBParser.parseKBFile(dumpFile); - } catch (Exception e) { - e.printStackTrace(); - } - } - } catch (Exception e) { - e.printStackTrace(); - } - System.out.println("SparqlModul: ****Finished"); - } - - /* - * (non-Javadoc) - * - * @see org.dllearner.core.KnowledgeSource#toDIG() - */ - @Override - public String toDIG(URI kbURI) { - if (format.equals("N-TRIPLES")) - return JenaOWLDIGConverter.getTellsString(dumpFile, OntologyFormat.N_TRIPLES, kbURI); - else - return DIGConverter.getDIGString(kb, kbURI).toString(); - } - - /* - * (non-Javadoc) - * - * @see org.dllearner.core.KnowledgeSource#export(java.io.File, - * org.dllearner.core.OntologyFormat) - */ - @Override - public void export(File file, OntologyFormat format) throws OntologyFormatUnsupportedException { - // currently no export functions implemented, so we just throw an - // exception - throw new OntologyFormatUnsupportedException("export", format); - } - - public URL getURL() { - return url; - } - - public String[] getOntArray() { - return ontArray; - } - - public void calculateSubjects(String label, int limit) { - System.out.println("SparqlModul: Collecting Subjects"); - SparqlOntologyCollector oc = new SparqlOntologyCollector(url); - try { - subjects = oc.getSubjectsFromLabel(label, limit); - } catch (IOException e) { - subjects = new String[1]; - subjects[0] = "[Error]Sparql Endpoint could not be reached."; - } - System.out.println("SparqlModul: ****Finished"); - } - - public void calculateTriples(String subject) { - System.out.println("SparqlModul: Collecting Triples"); - SparqlOntologyCollector oc = new SparqlOntologyCollector(url); - try { - triples = oc.collectTriples(subject); - } catch (IOException e) { - triples = new String[1]; - triples[0] = "[Error]Sparql Endpoint could not be reached."; - } - System.out.println("SparqlModul: ****Finished"); - } - - public void calculateConceptSubjects(String concept) { - System.out.println("SparqlModul: Collecting Subjects"); - SparqlOntologyCollector oc = new SparqlOntologyCollector(url); - try { - conceptSubjects = oc.getSubjectsFromConcept(concept); - } catch (IOException e) { - conceptSubjects = new String[1]; - conceptSubjects[0] = "[Error]Sparql Endpoint could not be reached."; - } - System.out.println("SparqlModul: ****Finished"); - } - - public boolean subjectThreadIsRunning() { - return subjectThreadRunning; - } - - public void setSubjectThreadRunning(boolean bool) { - subjectThreadRunning = bool; - } - - public boolean triplesThreadIsRunning() { - return triplesThreadRunning; - } - - public void setTriplesThreadRunning(boolean bool) { - triplesThreadRunning = bool; - } - - public boolean conceptThreadIsRunning() { - return conceptThreadRunning; - } - - public void setConceptThreadRunning(boolean bool) { - conceptThreadRunning = bool; - } - - public String[] getSubjects() { - return subjects; - } - - public Thread getSubjectThread() { - return subjectThread; - } - - public void setSubjectThread(Thread subjectThread) { - this.subjectThread = subjectThread; - } - - public Thread getTriplesThread() { - return triplesThread; - } - - public void setTriplesThread(Thread triplesThread) { - this.triplesThread = triplesThread; - } - - public Thread getConceptThread() { - return conceptThread; - } - - public void setConceptThread(Thread conceptThread) { - this.conceptThread = conceptThread; - } - - public String[] getTriples() { - return triples; - } - - public String[] getConceptSubjects() { - return conceptSubjects; - } -} Copied: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlEndpoint.java (from rev 369, trunk/src/dl-learner/org/dllearner/kb/SparqlEndpoint.java) =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlEndpoint.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlEndpoint.java 2008-01-14 11:54:55 UTC (rev 370) @@ -0,0 +1,503 @@ +/** + * Copyright (C) 2007, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.kb.sparql; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URL; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.Set; + +import org.dllearner.core.KnowledgeSource; +import org.dllearner.core.OntologyFormat; +import org.dllearner.core.OntologyFormatUnsupportedException; +import org.dllearner.core.config.BooleanConfigOption; +import org.dllearner.core.config.ConfigEntry; +import org.dllearner.core.config.ConfigOption; +import org.dllearner.core.config.IntegerConfigOption; +import org.dllearner.core.config.InvalidConfigOptionValueException; +import org.dllearner.core.config.StringConfigOption; +import org.dllearner.core.config.StringSetConfigOption; +import org.dllearner.core.config.StringTupleListConfigOption; +import org.dllearner.core.dl.KB; +import org.dllearner.parser.KBParser; +import org.dllearner.reasoning.DIGConverter; +import org.dllearner.reasoning.JenaOWLDIGConverter; +import org.dllearner.utilities.StringTuple; + +/** + * Represents a SPARQL Endpoint. + * + * @author Jens Lehmann + * @author Sebastian Knappe + * @author Sebastian Hellmann + */ +public class SparqlEndpoint extends KnowledgeSource { + + // ConfigOptions + private URL url; + String host; + private Set<String> instances=new HashSet<String>();; + private URL dumpFile; + private int recursionDepth = 1; + private int predefinedFilter = 0; + private int predefinedEndpoint = 0; + private Set<String> predList=new HashSet<String>(); + private Set<String> objList=new HashSet<String>(); + // private Set<String> classList; + private String format = "N-TRIPLES"; + private boolean dumpToFile = true; + private boolean useLits = false; + private boolean getAllSuperClasses = true; + private boolean closeAfterRecursion = true; + private int breakSuperClassRetrievalAfter = 200; + + private boolean learnDomain = false; + private boolean learnRange = false; + private int numberOfInstancesUsedForRoleLearning=40; + private String role=""; + private String blankNodeIdentifier = "bnode"; + + LinkedList<StringTuple> URIParameters = new LinkedList<StringTuple>(); + LinkedList<StringTuple> replacePredicate = new LinkedList<StringTuple>(); + LinkedList<StringTuple> replaceObject = new LinkedList<StringTuple>(); + + /** + * Holds the results of the calculateSubjects method + */ + private String[] subjects; + + /** + * Holds the results of the calculateTriples method + */ + private String[] triples; + + /** + * Holds the results of the calculateConceptSubjects method + */ + private String[] conceptSubjects; + + /** + * if a method is running this becomes true + */ + private boolean subjectThreadRunning = false; + + private boolean triplesThreadRunning = false; + + private boolean conceptThreadRunning = false; + + /** + * the Thread that is running a method + */ + private Thread subjectThread; + + private Thread triplesThread; + + private Thread conceptThread; + + // received ontology as array, used if format=Array(an element of the + // array consists of the subject, predicate and object separated by '<' + private String[] ontArray; + + // received ontology as KB, the internal format + private KB kb; + + public static String getName() { + return "SPARQL Endpoint Restructured"; + } + + /** + * sets the ConfigOptions for this KnowledgeSource + * + * @return + */ + public static Collection<ConfigOption<?>> createConfigOptions() { + Collection<ConfigOption<?>> options = new LinkedList<ConfigOption<?>>(); + options.add(new StringConfigOption("url", "URL of SPARQL Endpoint")); + options.add(new StringConfigOption("host", "host of SPARQL Endpoint")); + options.add(new StringSetConfigOption("instances", + "relevant instances e.g. positive and negative examples in a learning problem")); + options.add(new IntegerConfigOption("recursionDepth", + "recursion depth of KB fragment selection", 2)); + options.add(new IntegerConfigOption("predefinedFilter", "the mode of the SPARQL Filter")); + options.add(new IntegerConfigOption("predefinedEndpoint", "the mode of the SPARQL Filter")); + + options.add(new StringSetConfigOption("predList", "list of all ignored roles")); + options.add(new StringSetConfigOption("objList", "list of all ignored objects")); + options.add(new StringSetConfigOption("classList", "list of all ignored classes")); + options.add(new StringConfigOption("format", "N-TRIPLES or KB format", "N-TRIPLES")); + options.add(new BooleanConfigOption("dumpToFile", + "Specifies whether the extracted ontology is written to a file or not.", true)); + options.add(new BooleanConfigOption("useLits", "use Literals in SPARQL query")); + options.add(new BooleanConfigOption("getAllSuperClasses", "If true then all superclasses are retrieved until the most general class (owl:Thing) is reached.", true)); + + options.add(new BooleanConfigOption("learnDomain", "learns the Domain for a Role")); + options.add(new BooleanConfigOption("learnRange", "learns the Range for a Role")); + options.add(new StringConfigOption("role", "role to learn Domain/Range from")); + options.add(new StringConfigOption("blankNodeIdentifier", + "used to identify blanknodes in Tripels")); + + options.add(new StringTupleListConfigOption("example", "example")); + options.add(new StringTupleListConfigOption("replacePredicate", "rule for replacing predicates")); + options.add(new StringTupleListConfigOption("replaceObject", "rule for replacing predicates")); + options.add(new IntegerConfigOption("breakSuperClassRetrievalAfter", "stops a cyclic hierarchy after specified number of classes")); + options.add(new IntegerConfigOption("numberOfInstancesUsedForRoleLearning", "")); + options.add(new BooleanConfigOption("closeAfterRecursion", "gets all classes for all instances")); + + + + return options; + } + + /* + * @see org.dllearner.core.Component#applyConfigEntry(org.dllearner.core.ConfigEntry) + */ + @Override + @SuppressWarnings( { "unchecked" }) + public <T> void applyConfigEntry(ConfigEntry<T> entry) throws InvalidConfigOptionValueException { + String option = entry.getOptionName(); + if (option.equals("url")) { + String s = (String) entry.getValue(); + try { + url = new URL(s); + } catch (MalformedURLException e) { + throw new InvalidConfigOptionValueException(entry.getOption(), entry.getValue(), + "malformed URL " + s); + } + } else if (option.equals("host")) { + host = (String) entry.getValue(); + } else if (option.equals("instances")) { + instances = (Set<String>) entry.getValue(); + } else if (option.equals("recursionDepth")) { + recursionDepth = (Integer) entry.getValue(); + } else if (option.equals("predList")) { + predList = (Set<String>) entry.getValue(); + } else if (option.equals("objList")) { + objList = (Set<String>) entry.getValue(); + //} else if (option.equals("classList")) { + // classList = (Set<String>) entry.getValue(); + } else if (option.equals("predefinedEndpoint")) { + predefinedEndpoint = (Integer) entry.getValue(); + } else if (option.equals("predefinedFilter")) { + predefinedFilter = (Integer) entry.getValue(); + } else if (option.equals("format")) { + format = (String) entry.getValue(); + } else if (option.equals("dumpToFile")) { + dumpToFile = (Boolean) entry.getValue(); + } else if (option.equals("useLits")) { + useLits = (Boolean) entry.getValue(); + } else if (option.equals("getAllSuperClasses")) { + getAllSuperClasses = (Boolean) entry.getValue(); + } else if (option.equals("learnDomain")) { + learnDomain = (Boolean) entry.getValue(); + }else if (option.equals("learnRange")) { + learnRange = (Boolean) entry.getValue(); + } else if (option.equals("role")) { + role = (String) entry.getValue(); + } else if (option.equals("blankNodeIdentifier")) { + blankNodeIdentifier = (String) entry.getValue(); + } else if (option.equals("example")) { + //System.out.println(entry.getValue()); + }else if (option.equals("replacePredicate")) { + replacePredicate = (LinkedList)entry.getValue(); + }else if (option.equals("replaceObject")) { + replaceObject = (LinkedList)entry.getValue(); + }else if (option.equals("breakSuperClassRetrievalAfter")) { + breakSuperClassRetrievalAfter = (Integer) entry.getValue(); + }else if (option.equals("numberOfInstancesUsedForRoleLearning")) { + numberOfInstancesUsedForRoleLearning = (Integer) entry.getValue(); + }else if (option.equals("closeAfterRecursion")) { + closeAfterRecursion = (Boolean) entry.getValue(); + } + + } + + /* + * (non-Javadoc) + * + * @see org.dllearner.core.Component#init() + */ + @Override + public void init() { + System.out.println("SparqlModul: Collecting Ontology"); + // SparqlOntologyCollector oc= + // new SparqlOntologyCollector(Datastructures.setToArray(instances), + // numberOfRecursions, filterMode, + // Datastructures.setToArray(predList),Datastructures.setToArray( + // objList),Datastructures.setToArray(classList),format,url,useLits); + Manager m = new Manager(); + SpecificSparqlEndpoint sse = null; + SparqlQueryType sqt = null; + // get Options for Manipulator + Manipulator man = new Manipulator(blankNodeIdentifier,breakSuperClassRetrievalAfter,replacePredicate,replaceObject); + HashMap<String, String> parameters = new HashMap<String, String>(); + parameters.put("default-graph-uri", "http://dbpedia.org"); + parameters.put("format", "application/sparql-results.xml"); + + // get Options for endpoints + if (predefinedEndpoint >= 1) { + sse = PredefinedEndpoint.getEndpoint(predefinedEndpoint); + } else { + sse = new SpecificSparqlEndpoint(url, host, parameters); + } + + // get Options for Filters + + if (predefinedFilter >= 1) { + sqt = PredefinedFilter.getFilter(predefinedFilter); + + } else { + sqt = new SparqlQueryType("forbid", objList, predList, useLits + ""); + + } + // give everything to the manager + m.useConfiguration(sqt, sse, man, recursionDepth, getAllSuperClasses,closeAfterRecursion); + try { + String ont = ""; + //System.out.println(learnDomain); + // used to learn a domain of a role + if (learnDomain || learnRange) { + Set<String> pos=new HashSet<String>(); + Set<String> neg=new HashSet<String>(); + if(learnDomain){ + pos = m.getDomainInstancesForRole(role); + neg = m.getRangeInstancesForRole(role); + }else if(learnRange){ + neg = m.getDomainInstancesForRole(role); + pos = m.getRangeInstancesForRole(role); + } + //choose 30 + + + Set<String> tmp=new HashSet<String>(); + for(String one:pos){ + tmp.add(one); + if(tmp.size()>=numberOfInstancesUsedForRoleLearning)break; + } + pos=tmp; + System.out.println("Instances used: "+pos.size()); + + tmp=new HashSet<String>(); + for(String one:neg){ + tmp.add(one); + if(tmp.size()>=numberOfInstancesUsedForRoleLearning)break; + } + neg=tmp; + + instances=new HashSet<String>(); + instances.addAll(pos); + + instances.addAll(neg); + + for(String one:pos){ + System.out.println("+\""+one+"\""); + } + for(String one:neg){ + System.out.println("-\""+one+"\""); + } + + /*Random r= new Random(); + + + Object[] arr=instances.toArray(); + while(instances.size()>=30){ + + }*/ + // add the role to the filter(a solution is always EXISTS + // role.TOP) + m.addPredicateFilter(role); + //System.out.println(instances); + // THIS is a workaround + + } + // the actual extraction is started here + ont = m.extract(instances); + System.out.println("Number of cached SPARQL queries: "+m.getConfiguration().numberOfCachedSparqlQueries); + System.out.println("Number of uncached SPARQL queries: "+m.getConfiguration().numberOfUncachedSparqlQueries); + + System.out.println("Finished collecting Fragment"); + + if (dumpToFile) { + String filename = System.currentTimeMillis() + ".nt"; + String basedir = "cache" + File.separator; + try { + if (!new File(basedir).exists()) + new File(basedir).mkdir(); + + FileWriter fw = new FileWriter(new File(basedir + filename), true); + fw.write(ont); + fw.flush(); + fw.close(); + + dumpFile = (new File(basedir + filename)).toURI().toURL(); + } catch (Exception e) { + e.printStackTrace(); + } + } + if (format.equals("KB")) { + try { + //kb = KBParser.parseKBFile(new StringReader(ont)); + kb=KBParser.parseKBFile(dumpFile); + } catch (Exception e) { + e.printStackTrace(); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + System.out.println("SparqlModul: ****Finished"); + } + + /* + * (non-Javadoc) + * + * @see org.dllearner.core.KnowledgeSource#toDIG() + */ + @Override + public String toDIG(URI kbURI) { + if (format.equals("N-TRIPLES")) + return JenaOWLDIGConverter.getTellsString(dumpFile, OntologyFormat.N_TRIPLES, kbURI); + else + return DIGConverter.getDIGString(kb, kbURI).toString(); + } + + /* + * (non-Javadoc) + * + * @see org.dllearner.core.KnowledgeSource#export(java.io.File, + * org.dllearner.core.OntologyFormat) + */ + @Override + public void export(File file, OntologyFormat format) throws OntologyFormatUnsupportedException { + // currently no export functions implemented, so we just throw an + // exception + throw new OntologyFormatUnsupportedException("export", format); + } + + public URL getURL() { + return url; + } + + public String[] getOntArray() { + return ontArray; + } + + public void calculateSubjects(String label, int limit) { + System.out.println("SparqlModul: Collecting Subjects"); + SparqlOntologyCollector oc = new SparqlOntologyCollector(url); + try { + subjects = oc.getSubjectsFromLabel(label, limit); + } catch (IOException e) { + subjects = new String[1]; + subjects[0] = "[Error]Sparql Endpoint could not be reached."; + } + System.out.println("SparqlModul: ****Finished"); + } + + public void calculateTriples(String subject) { + System.out.println("SparqlModul: Collecting Triples"); + SparqlOntologyCollector oc = new SparqlOntologyCollector(url); + try { + triples = oc.collectTriples(subject); + } catch (IOException e) { + triples = new String[1]; + triples[0] = "[Error]Sparql Endpoint could not be reached."; + } + System.out.println("SparqlModul: ****Finished"); + } + + public void calculateConceptSubjects(String concept) { + System.out.println("SparqlModul: Collecting Subjects"); + SparqlOntologyCollector oc = new SparqlOntologyCollector(url); + try { + conceptSubjects = oc.getSubjectsFromConcept(concept); + } catch (IOException e) { + conceptSubjects = new String[1]; + conceptSubjects[0] = "[Error]Sparql Endpoint could not be reached."; + } + System.out.println("SparqlModul: ****Finished"); + } + + public boolean subjectThreadIsRunning() { + return subjectThreadRunning; + } + + public void setSubjectThreadRunning(boolean bool) { + subjectThreadRunning = bool; + } + + public boolean triplesThreadIsRunning() { + return triplesThreadRunning; + } + + public void setTriplesThreadRunning(boolean bool) { + triplesThreadRunning = bool; + } + + public boolean conceptThreadIsRunning() { + return conceptThreadRunning; + } + + public void setConceptThreadRunning(boolean bool) { + conceptThreadRunning = bool; + } + + public String[] getSubjects() { + return subjects; + } + + public Thread getSubjectThread() { + return subjectThread; + } + + public void setSubjectThread(Thread subjectThread) { + this.subjectThread = subjectThread; + } + + public Thread getTriplesThread() { + return triplesThread; + } + + public void setTriplesThread(Thread triplesThread) { + this.triplesThread = triplesThread; + } + + public Thread getConceptThread() { + return conceptThread; + } + + public void setConceptThread(Thread conceptThread) { + this.conceptThread = conceptThread; + } + + public String[] getTriples() { + return triples; + } + + public String[] getConceptSubjects() { + return conceptSubjects; + } +} Added: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQuery.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQuery.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQuery.java 2008-01-14 11:54:55 UTC (rev 370) @@ -0,0 +1,89 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.kb.sparql; + +import com.hp.hpl.jena.query.Query; +import com.hp.hpl.jena.query.QueryExecution; +import com.hp.hpl.jena.query.QueryExecutionFactory; +import com.hp.hpl.jena.query.QueryFactory; +import com.hp.hpl.jena.query.ResultSet; +import com.hp.hpl.jena.query.ResultSetFormatter; + +/** + * Represents a SPARQL query. It includes support for stopping the SPARQL + * query (which may be necessary if a timeout is reached). + * + * TODO: It is probably good to change all SPARQL query calls to use only + * this class. + * + * TODO: Could we use Jena as a solid foundation here? (com.hp.jena.query) + * + * @author Jens Lehmann + * + */ +public class SparqlQuery { + + private boolean isRunning = false; + + public SparqlQuery(SpecificSparqlEndpoint endpoint, String query) { + + } + + public void send() { + isRunning = true; + + // ... send query + // ... check periodically whether isRunning is still true, if not + // abort the query + } + + public void stop() { + isRunning = false; + } + + public boolean isRunning() { + return isRunning; + } + + // this is a working Jena script + // TODO: query runtime seems to be much too high (compared to running it in http://dbpedia.org/sparql) + // verify whether our SPARQL query implementation is faster and why; + // TODO: check whether Jena works with the other endpoints in PredefinedEndpoint; if not + // check whether it can be configured to run with these + public static void main(String[] args) { + + String queryString = "PREFIX dbpedia2: <http://dbpedia.org/property/> " + + "PREFIX skos: <http://www.w3.org/2004/02/skos/core#>" + + "SELECT ?episode ?chalkboard_gag WHERE { ?episode skos:subject" + + " <http://dbpedia.org/resource/Category:The_Simpsons_episodes%2C_season_12>." + + " ?episode dbpedia2:blackboard ?chalkboard_gag }"; + + System.out.println(queryString); + // create a query and parse it into Jena + Query query = QueryFactory.create(queryString); + query.validate(); + // Jena access to DBpedia SPARQL endpoint + QueryExecution queryExecution = QueryExecutionFactory.sparqlService("http://dbpedia.org/sparql", query); + System.out.println("query SPARQL server"); + ResultSet rs = queryExecution.execSelect(); + ResultSetFormatter.out(System.out, rs, query) ; + } + +} Modified: trunk/src/dl-learner/org/dllearner/server/ClientState.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/ClientState.java 2008-01-14 08:56:17 UTC (rev 369) +++ trunk/src/dl-learner/org/dllearner/server/ClientState.java 2008-01-14 11:54:55 UTC (rev 370) @@ -33,7 +33,7 @@ import org.dllearner.core.ReasonerComponent; import org.dllearner.core.ReasoningService; import org.dllearner.kb.OWLFile; -import org.dllearner.kb.SparqlEndpoint; +import org.dllearner.kb.sparql.SparqlEndpoint; /** * Stores the state of a DL-Learner client session. Modified: trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2008-01-14 08:56:17 UTC (rev 369) +++ trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2008-01-14 11:54:55 UTC (rev 370) @@ -46,7 +46,7 @@ import org.dllearner.core.dl.Concept; import org.dllearner.core.dl.Individual; import org.dllearner.kb.OWLFile; -import org.dllearner.kb.SparqlEndpoint; +import org.dllearner.kb.sparql.SparqlEndpoint; import org.dllearner.learningproblems.PosNegDefinitionLP; import org.dllearner.learningproblems.PosNegInclusionLP; import org.dllearner.learningproblems.PosOnlyDefinitionLP; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-01-14 08:56:23
|
Revision: 369 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=369&view=rev Author: jenslehmann Date: 2008-01-14 00:56:17 -0800 (Mon, 14 Jan 2008) Log Message: ----------- started to merge the two SPARQL components Modified Paths: -------------- trunk/lib/components.ini trunk/src/dl-learner/org/dllearner/cli/Start.java trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryMaker.java trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/kb/SparqlEndpoint.java trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlCache.java trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlFilter.java trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlOntologyCollector.java Removed Paths: ------------- trunk/src/dl-learner/org/dllearner/kb/SparqlCache.java trunk/src/dl-learner/org/dllearner/kb/SparqlEndpoint.java trunk/src/dl-learner/org/dllearner/kb/SparqlEndpointRestructured.java trunk/src/dl-learner/org/dllearner/kb/SparqlFilter.java trunk/src/dl-learner/org/dllearner/kb/SparqlOntologyCollector.java trunk/src/dl-learner/org/dllearner/kb/SparqlQueryMaker.java Modified: trunk/lib/components.ini =================================================================== --- trunk/lib/components.ini 2008-01-13 10:22:16 UTC (rev 368) +++ trunk/lib/components.ini 2008-01-14 08:56:17 UTC (rev 369) @@ -3,8 +3,7 @@ # knowledge sources org.dllearner.kb.OWLFile org.dllearner.kb.KBFile -org.dllearner.kb.SparqlEndpoint -org.dllearner.kb.SparqlEndpointRestructured +org.dllearner.kb.sparql.SparqlEndpoint # reasoners org.dllearner.reasoning.OWLAPIReasoner org.dllearner.reasoning.DIGReasoner Modified: trunk/src/dl-learner/org/dllearner/cli/Start.java =================================================================== --- trunk/src/dl-learner/org/dllearner/cli/Start.java 2008-01-13 10:22:16 UTC (rev 368) +++ trunk/src/dl-learner/org/dllearner/cli/Start.java 2008-01-14 08:56:17 UTC (rev 369) @@ -61,7 +61,6 @@ import org.dllearner.kb.KBFile; 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; @@ -231,7 +230,6 @@ Map<Class<? extends Component>, String> componentPrefixMapping = new HashMap<Class<? extends Component>, String>(); // knowledge sources componentPrefixMapping.put(SparqlEndpoint.class, "sparql"); - componentPrefixMapping.put(SparqlEndpointRestructured.class, "sparql2"); // reasoners componentPrefixMapping.put(DIGReasoner.class, "digReasoner"); componentPrefixMapping.put(OWLAPIReasoner.class, "owlAPIReasoner"); @@ -386,8 +384,6 @@ ksClass = KBFile.class; else if (formatString.equals("SPARQL")) ksClass = SparqlEndpoint.class; - else if (formatString.equals("SPARQL2")) - ksClass = SparqlEndpointRestructured.class; else if (formatString.equals("NT")) ksClass = OWLFile.class; else { Deleted: trunk/src/dl-learner/org/dllearner/kb/SparqlCache.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/SparqlCache.java 2008-01-13 10:22:16 UTC (rev 368) +++ trunk/src/dl-learner/org/dllearner/kb/SparqlCache.java 2008-01-14 08:56:17 UTC (rev 369) @@ -1,202 +0,0 @@ -/** - * Copyright (C) 2007, Sebastian Hellmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.dllearner.kb; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.Serializable; -import java.net.URLEncoder; -/** - * - * This is a primitive cache. - * The objects of this class can be either the cache itself or just on entry in the cache - * - * the cache remembers: a timestamp, the original sparql-query, the result - * key is the subject http://dbpedia.org/resource/Angela_Merkel which is first urlencoded - * and so serves as the hash for the filename. - * Cache validates if timestamp too old and Sparql-Query the same - * before returning the SPARQL xml-result - * - * @author Sebastian Hellmann - * @author Sebastian Knappe - */ -public class SparqlCache implements Serializable{ - - final static long serialVersionUID=104; - transient String basedir=""; - transient String fileending=".cache"; - long timestamp; - String content=""; - long daysoffreshness=15; - long multiplier=24*60*60*1000;//h m s ms - String sparqlquery=""; - - - /** - * Constructor for the cache itself. - * Called once at the beginning - * - * @param path Where the base path to the cache is - */ - public SparqlCache(String path){ - this.basedir=path+File.separator; - if(!new File(path).exists()) - {System.out.println(new File(path).mkdir());;} - - } - -// - /** - * Constructor for single cache object(one entry) - * - * @param content the sparql xml result - * @param sparql the sparql query - */ - public SparqlCache(String content, String sparql){ - this.content=content; - this.sparqlquery=sparql; - this.timestamp=System.currentTimeMillis(); - } - - - - /** - * use only on the cache object describing the cache itself - * - * @param key the individual - * @param sparql the sparql query - * @return the cached sparql result or null - */ - public String get(String key, String sparql){ - String ret=null; - try{ - SparqlCache c =readFromFile(makeFilename(key)); - if(c==null)return null; - if(!c.checkFreshness())return null; - if(!c.validate(sparql))return null; - - ret=c.content; - }catch (Exception e) {e.printStackTrace();} - return ret; - } - - /** - * - * constructor for single cache object(one entry) - * - * @param key the individual - * @param content the sparql result - * @param sparql the sparql query - */ - public void put(String key, String content, String sparql){ - SparqlCache c=new SparqlCache(content,sparql); - putIntoFile(makeFilename(key), c); - } - - - /** - * to normalize the filenames - * - * @param key - * @return - */ - String makeFilename(String key){ - String ret=""; - try{ - ret=basedir+URLEncoder.encode(key, "UTF-8")+fileending; - }catch (Exception e) {e.printStackTrace();} - return ret; - } - - /** - * how old is the result - * @return - */ - boolean checkFreshness(){ - if((System.currentTimeMillis()-this.timestamp)<=(daysoffreshness*multiplier)) - //fresh - return true; - else return false; - } - - - /** - * some sparql query - * @param sparql - * @return - */ - boolean validate(String sparql){ - if(this.sparqlquery.equals(sparql)) - //valid - return true; - else return false; - } - - /** - * makes a new file if none exists - * @param Filename - */ - public void checkFile(String Filename){ - if(!new File(Filename).exists()){ - try{ - new File(Filename).createNewFile(); - }catch (Exception e) {e.printStackTrace();} - - } - - } - - /** - * internal saving function - * puts a cache object into a file - * - * @param Filename - * @param content - */ - public void putIntoFile(String Filename,SparqlCache content){ - try{ - FileOutputStream fos = new FileOutputStream( Filename , false ); - ObjectOutputStream o = new ObjectOutputStream( fos ); - o.writeObject( content ); - fos.flush(); - fos.close(); - }catch (Exception e) {System.out.println("Not in cache creating: "+Filename);} - } - - /** - * internal retrieval function - * - * @param Filename - * @return one entry object - */ - public SparqlCache readFromFile(String Filename){ - SparqlCache content=null; - try{ - FileInputStream fos = new FileInputStream( Filename ); - ObjectInputStream o = new ObjectInputStream( fos ); - content=(SparqlCache)o.readObject(); - }catch (Exception e) {} - return content; - - } -} Deleted: trunk/src/dl-learner/org/dllearner/kb/SparqlEndpoint.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/SparqlEndpoint.java 2008-01-13 10:22:16 UTC (rev 368) +++ trunk/src/dl-learner/org/dllearner/kb/SparqlEndpoint.java 2008-01-14 08:56:17 UTC (rev 369) @@ -1,342 +0,0 @@ -/** - * Copyright (C) 2007, Jens Lehmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.dllearner.kb; - -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URI; -import java.net.URL; -import java.util.Collection; -import java.util.LinkedList; -import java.util.Set; - -import org.dllearner.core.KnowledgeSource; -import org.dllearner.core.OntologyFormat; -import org.dllearner.core.OntologyFormatUnsupportedException; -import org.dllearner.core.config.BooleanConfigOption; -import org.dllearner.core.config.ConfigEntry; -import org.dllearner.core.config.ConfigOption; -import org.dllearner.core.config.IntegerConfigOption; -import org.dllearner.core.config.InvalidConfigOptionValueException; -import org.dllearner.core.config.StringConfigOption; -import org.dllearner.core.config.StringSetConfigOption; -import org.dllearner.core.dl.KB; -import org.dllearner.parser.KBParser; -import org.dllearner.reasoning.DIGConverter; -import org.dllearner.reasoning.JenaOWLDIGConverter; -import org.dllearner.utilities.Datastructures; - -/** - * Represents a SPARQL Endpoint. - * TODO: Is it necessary to create a class DBpediaSparqlEndpoint? - * - * @author Jens Lehmann - * @author Sebastian Knappe - */ -public class SparqlEndpoint extends KnowledgeSource { - - //ConfigOptions - private URL url; - private Set<String> instances; - private URL dumpFile; - private int numberOfRecursions; - private int filterMode; - private Set<String> predList; - private Set<String> objList; - private Set<String> classList; - private String format; - private boolean dumpToFile; - private boolean useLits=false; - - /** - * Holds the results of the calculateSubjects method - */ - private String[] subjects; - - /** - * Holds the results of the calculateTriples method - */ - private String[] triples; - - /** - * Holds the results of the calculateConceptSubjects method - */ - private String[] conceptSubjects; - - /** - * if a method is running this becomes true - */ - private boolean subjectThreadRunning=false; - - private boolean triplesThreadRunning=false; - - private boolean conceptThreadRunning=false; - - /** - * the Thread that is running a method - */ - private Thread subjectThread; - - private Thread triplesThread; - - private Thread conceptThread; - - //received ontology as array, used if format=Array(an element of the - //array consists of the subject, predicate and object separated by '<' - private String[] ontArray; - - //received ontology as KB, the internal format - private KB kb; - - public static String getName() { - return "SPARQL Endpoint"; - } - - /** - * sets the ConfigOptions for this KnowledgeSource - * @return - */ - public static Collection<ConfigOption<?>> createConfigOptions() { - Collection<ConfigOption<?>> options = new LinkedList<ConfigOption<?>>(); - options.add(new StringConfigOption("url", "URL of SPARQL Endpoint")); - options.add(new StringSetConfigOption("instances","relevant instances e.g. positive and negative examples in a learning problem")); - options.add(new IntegerConfigOption("numberOfRecursions","number of Recursions, the Sparql-Endpoint is asked")); - options.add(new IntegerConfigOption("filterMode","the mode of the SPARQL Filter")); - options.add(new StringSetConfigOption("predList","a predicate list")); - options.add(new StringSetConfigOption("objList","an object list")); - options.add(new StringSetConfigOption("classList","a class list")); - options.add(new StringConfigOption("format", "N-TRIPLES or KB format")); - options.add(new BooleanConfigOption("dumpToFile", "wether Ontology from DBPedia is written to a file or not")); - options.add(new BooleanConfigOption("useLits","use Literals in SPARQL query")); - return options; - } - - /* - * @see org.dllearner.core.Component#applyConfigEntry(org.dllearner.core.ConfigEntry) - */ - @Override - @SuppressWarnings({"unchecked"}) - public <T> void applyConfigEntry(ConfigEntry<T> entry) throws InvalidConfigOptionValueException { - String option = entry.getOptionName(); - if (option.equals("url")) { - String s = (String) entry.getValue(); - try { - url = new URL(s); - } catch (MalformedURLException e) { - throw new InvalidConfigOptionValueException(entry.getOption(), entry.getValue(),"malformed URL " + s); - } - } else if(option.equals("instances")) { - instances = (Set<String>) entry.getValue(); - } else if(option.equals("numberOfRecursions")){ - numberOfRecursions=(Integer)entry.getValue(); - } else if(option.equals("predList")) { - predList = (Set<String>) entry.getValue(); - } else if(option.equals("objList")) { - objList = (Set<String>) entry.getValue(); - } else if(option.equals("classList")) { - classList = (Set<String>) entry.getValue(); - } else if(option.equals("filterMode")){ - filterMode=(Integer)entry.getValue(); - } else if(option.equals("format")){ - format=(String)entry.getValue(); - } else if(option.equals("dumpToFile")){ - dumpToFile=(Boolean)entry.getValue(); - } else if(option.equals("useLits")){ - useLits=(Boolean)entry.getValue(); - } - } - - /* (non-Javadoc) - * @see org.dllearner.core.Component#init() - */ - @Override - public void init() { - System.out.println("SparqlModul: Collecting Ontology"); - SparqlOntologyCollector oc=new SparqlOntologyCollector(Datastructures.setToArray(instances), numberOfRecursions, filterMode, - Datastructures.setToArray(predList),Datastructures.setToArray( objList),Datastructures.setToArray(classList),format,url,useLits); - - try - { - String ont=oc.collectOntology(); - - if (dumpToFile){ - String filename=System.currentTimeMillis()+".nt"; - String basedir="cache"+File.separator; - try{ - if(!new File(basedir).exists()) - new File(basedir).mkdir(); - - FileWriter fw=new FileWriter(new File(basedir+filename),true); - fw.write(ont); - fw.flush(); - fw.close(); - - dumpFile=(new File(basedir+filename)).toURI().toURL(); - }catch (Exception e) {e.printStackTrace();} - } - if (format.equals("KB")) { - try{ - // kb=KBParser.parseKBFile(new StringReader(ont)); - kb=KBParser.parseKBFile(dumpFile); - } catch(Exception e) {e.printStackTrace();} - } - }catch(IOException e) { - e.printStackTrace(); - } - System.out.println("SparqlModul: ****Finished"); - } - - /* - * (non-Javadoc) - * - * @see org.dllearner.core.KnowledgeSource#toDIG() - */ - @Override - public String toDIG(URI kbURI) { - if (format.equals("N-TRIPLES")) return JenaOWLDIGConverter.getTellsString(dumpFile, OntologyFormat.N_TRIPLES, kbURI); - else return DIGConverter.getDIGString(kb, kbURI).toString(); - } - - /* (non-Javadoc) - * @see org.dllearner.core.KnowledgeSource#export(java.io.File, org.dllearner.core.OntologyFormat) - */ - @Override - public void export(File file, OntologyFormat format) throws OntologyFormatUnsupportedException { - // currently no export functions implemented, so we just throw an exception - throw new OntologyFormatUnsupportedException("export", format); - } - - public URL getURL() { - return url; - } - - public String[] getOntArray() { - return ontArray; - } - - public void calculateSubjects(String label,int limit) - { - System.out.println("SparqlModul: Collecting Subjects"); - SparqlOntologyCollector oc=new SparqlOntologyCollector(url); - try{ - subjects=oc.getSubjectsFromLabel(label,limit); - }catch (IOException e){ - subjects=new String[1]; - subjects[0]="[Error]Sparql Endpoint could not be reached."; - } - System.out.println("SparqlModul: ****Finished"); - } - - public void calculateTriples(String subject) { - System.out.println("SparqlModul: Collecting Triples"); - SparqlOntologyCollector oc=new SparqlOntologyCollector(url); - try{ - triples=oc.collectTriples(subject); - }catch (IOException e){ - triples=new String[1]; - triples[0]="[Error]Sparql Endpoint could not be reached."; - } - System.out.println("SparqlModul: ****Finished"); - } - - public void calculateConceptSubjects(String concept) - { - System.out.println("SparqlModul: Collecting Subjects"); - SparqlOntologyCollector oc=new SparqlOntologyCollector(url); - try{ - conceptSubjects=oc.getSubjectsFromConcept(concept); - }catch (IOException e){ - conceptSubjects=new String[1]; - conceptSubjects[0]="[Error]Sparql Endpoint could not be reached."; - } - System.out.println("SparqlModul: ****Finished"); - } - - public boolean subjectThreadIsRunning() - { - return subjectThreadRunning; - } - - public void setSubjectThreadRunning(boolean bool) - { - subjectThreadRunning=bool; - } - - public boolean triplesThreadIsRunning() - { - return triplesThreadRunning; - } - - public void setTriplesThreadRunning(boolean bool) - { - triplesThreadRunning=bool; - } - - public boolean conceptThreadIsRunning() - { - return conceptThreadRunning; - } - - public void setConceptThreadRunning(boolean bool) - { - conceptThreadRunning=bool; - } - - public String[] getSubjects() - { - return subjects; - } - - public Thread getSubjectThread() { - return subjectThread; - } - - public void setSubjectThread(Thread subjectThread) { - this.subjectThread = subjectThread; - } - - public Thread getTriplesThread() { - return triplesThread; - } - - public void setTriplesThread(Thread triplesThread) { - this.triplesThread = triplesThread; - } - - public Thread getConceptThread() { - return conceptThread; - } - - public void setConceptThread(Thread conceptThread) { - this.conceptThread = conceptThread; - } - - public String[] getTriples() - { - return triples; - } - - public String[] getConceptSubjects() - { - return conceptSubjects; - } -} Copied: trunk/src/dl-learner/org/dllearner/kb/SparqlEndpoint.java (from rev 367, trunk/src/dl-learner/org/dllearner/kb/SparqlEndpointRestructured.java) =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/SparqlEndpoint.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/kb/SparqlEndpoint.java 2008-01-14 08:56:17 UTC (rev 369) @@ -0,0 +1,510 @@ +/** + * Copyright (C) 2007, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.kb; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URL; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.Set; + +import org.dllearner.core.KnowledgeSource; +import org.dllearner.core.OntologyFormat; +import org.dllearner.core.OntologyFormatUnsupportedException; +import org.dllearner.core.config.BooleanConfigOption; +import org.dllearner.core.config.ConfigEntry; +import org.dllearner.core.config.ConfigOption; +import org.dllearner.core.config.IntegerConfigOption; +import org.dllearner.core.config.InvalidConfigOptionValueException; +import org.dllearner.core.config.StringConfigOption; +import org.dllearner.core.config.StringSetConfigOption; +import org.dllearner.core.config.StringTupleListConfigOption; +import org.dllearner.core.dl.KB; +import org.dllearner.kb.sparql.Manager; +import org.dllearner.kb.sparql.Manipulator; +import org.dllearner.kb.sparql.PredefinedEndpoint; +import org.dllearner.kb.sparql.PredefinedFilter; +import org.dllearner.kb.sparql.SparqlOntologyCollector; +import org.dllearner.kb.sparql.SparqlQueryType; +import org.dllearner.kb.sparql.SpecificSparqlEndpoint; +import org.dllearner.parser.KBParser; +import org.dllearner.reasoning.DIGConverter; +import org.dllearner.reasoning.JenaOWLDIGConverter; +import org.dllearner.utilities.StringTuple; + +/** + * Represents a SPARQL Endpoint. + * + * @author Jens Lehmann + * @author Sebastian Knappe + * @author Sebastian Hellmann + */ +public class SparqlEndpoint extends KnowledgeSource { + + // ConfigOptions + private URL url; + String host; + private Set<String> instances=new HashSet<String>();; + private URL dumpFile; + private int recursionDepth = 1; + private int predefinedFilter = 0; + private int predefinedEndpoint = 0; + private Set<String> predList=new HashSet<String>(); + private Set<String> objList=new HashSet<String>(); + // private Set<String> classList; + private String format = "N-TRIPLES"; + private boolean dumpToFile = true; + private boolean useLits = false; + private boolean getAllSuperClasses = true; + private boolean closeAfterRecursion = true; + private int breakSuperClassRetrievalAfter = 200; + + private boolean learnDomain = false; + private boolean learnRange = false; + private int numberOfInstancesUsedForRoleLearning=40; + private String role=""; + private String blankNodeIdentifier = "bnode"; + + LinkedList<StringTuple> URIParameters = new LinkedList<StringTuple>(); + LinkedList<StringTuple> replacePredicate = new LinkedList<StringTuple>(); + LinkedList<StringTuple> replaceObject = new LinkedList<StringTuple>(); + + /** + * Holds the results of the calculateSubjects method + */ + private String[] subjects; + + /** + * Holds the results of the calculateTriples method + */ + private String[] triples; + + /** + * Holds the results of the calculateConceptSubjects method + */ + private String[] conceptSubjects; + + /** + * if a method is running this becomes true + */ + private boolean subjectThreadRunning = false; + + private boolean triplesThreadRunning = false; + + private boolean conceptThreadRunning = false; + + /** + * the Thread that is running a method + */ + private Thread subjectThread; + + private Thread triplesThread; + + private Thread conceptThread; + + // received ontology as array, used if format=Array(an element of the + // array consists of the subject, predicate and object separated by '<' + private String[] ontArray; + + // received ontology as KB, the internal format + private KB kb; + + public static String getName() { + return "SPARQL Endpoint Restructured"; + } + + /** + * sets the ConfigOptions for this KnowledgeSource + * + * @return + */ + public static Collection<ConfigOption<?>> createConfigOptions() { + Collection<ConfigOption<?>> options = new LinkedList<ConfigOption<?>>(); + options.add(new StringConfigOption("url", "URL of SPARQL Endpoint")); + options.add(new StringConfigOption("host", "host of SPARQL Endpoint")); + options.add(new StringSetConfigOption("instances", + "relevant instances e.g. positive and negative examples in a learning problem")); + options.add(new IntegerConfigOption("recursionDepth", + "recursion depth of KB fragment selection", 2)); + options.add(new IntegerConfigOption("predefinedFilter", "the mode of the SPARQL Filter")); + options.add(new IntegerConfigOption("predefinedEndpoint", "the mode of the SPARQL Filter")); + + options.add(new StringSetConfigOption("predList", "list of all ignored roles")); + options.add(new StringSetConfigOption("objList", "list of all ignored objects")); + options.add(new StringSetConfigOption("classList", "list of all ignored classes")); + options.add(new StringConfigOption("format", "N-TRIPLES or KB format", "N-TRIPLES")); + options.add(new BooleanConfigOption("dumpToFile", + "Specifies whether the extracted ontology is written to a file or not.", true)); + options.add(new BooleanConfigOption("useLits", "use Literals in SPARQL query")); + options.add(new BooleanConfigOption("getAllSuperClasses", "If true then all superclasses are retrieved until the most general class (owl:Thing) is reached.", true)); + + options.add(new BooleanConfigOption("learnDomain", "learns the Domain for a Role")); + options.add(new BooleanConfigOption("learnRange", "learns the Range for a Role")); + options.add(new StringConfigOption("role", "role to learn Domain/Range from")); + options.add(new StringConfigOption("blankNodeIdentifier", + "used to identify blanknodes in Tripels")); + + options.add(new StringTupleListConfigOption("example", "example")); + options.add(new StringTupleListConfigOption("replacePredicate", "rule for replacing predicates")); + options.add(new StringTupleListConfigOption("replaceObject", "rule for replacing predicates")); + options.add(new IntegerConfigOption("breakSuperClassRetrievalAfter", "stops a cyclic hierarchy after specified number of classes")); + options.add(new IntegerConfigOption("numberOfInstancesUsedForRoleLearning", "")); + options.add(new BooleanConfigOption("closeAfterRecursion", "gets all classes for all instances")); + + + + return options; + } + + /* + * @see org.dllearner.core.Component#applyConfigEntry(org.dllearner.core.ConfigEntry) + */ + @Override + @SuppressWarnings( { "unchecked" }) + public <T> void applyConfigEntry(ConfigEntry<T> entry) throws InvalidConfigOptionValueException { + String option = entry.getOptionName(); + if (option.equals("url")) { + String s = (String) entry.getValue(); + try { + url = new URL(s); + } catch (MalformedURLException e) { + throw new InvalidConfigOptionValueException(entry.getOption(), entry.getValue(), + "malformed URL " + s); + } + } else if (option.equals("host")) { + host = (String) entry.getValue(); + } else if (option.equals("instances")) { + instances = (Set<String>) entry.getValue(); + } else if (option.equals("recursionDepth")) { + recursionDepth = (Integer) entry.getValue(); + } else if (option.equals("predList")) { + predList = (Set<String>) entry.getValue(); + } else if (option.equals("objList")) { + objList = (Set<String>) entry.getValue(); + //} else if (option.equals("classList")) { + // classList = (Set<String>) entry.getValue(); + } else if (option.equals("predefinedEndpoint")) { + predefinedEndpoint = (Integer) entry.getValue(); + } else if (option.equals("predefinedFilter")) { + predefinedFilter = (Integer) entry.getValue(); + } else if (option.equals("format")) { + format = (String) entry.getValue(); + } else if (option.equals("dumpToFile")) { + dumpToFile = (Boolean) entry.getValue(); + } else if (option.equals("useLits")) { + useLits = (Boolean) entry.getValue(); + } else if (option.equals("getAllSuperClasses")) { + getAllSuperClasses = (Boolean) entry.getValue(); + } else if (option.equals("learnDomain")) { + learnDomain = (Boolean) entry.getValue(); + }else if (option.equals("learnRange")) { + learnRange = (Boolean) entry.getValue(); + } else if (option.equals("role")) { + role = (String) entry.getValue(); + } else if (option.equals("blankNodeIdentifier")) { + blankNodeIdentifier = (String) entry.getValue(); + } else if (option.equals("example")) { + //System.out.println(entry.getValue()); + }else if (option.equals("replacePredicate")) { + replacePredicate = (LinkedList)entry.getValue(); + }else if (option.equals("replaceObject")) { + replaceObject = (LinkedList)entry.getValue(); + }else if (option.equals("breakSuperClassRetrievalAfter")) { + breakSuperClassRetrievalAfter = (Integer) entry.getValue(); + }else if (option.equals("numberOfInstancesUsedForRoleLearning")) { + numberOfInstancesUsedForRoleLearning = (Integer) entry.getValue(); + }else if (option.equals("closeAfterRecursion")) { + closeAfterRecursion = (Boolean) entry.getValue(); + } + + } + + /* + * (non-Javadoc) + * + * @see org.dllearner.core.Component#init() + */ + @Override + public void init() { + System.out.println("SparqlModul: Collecting Ontology"); + // SparqlOntologyCollector oc= + // new SparqlOntologyCollector(Datastructures.setToArray(instances), + // numberOfRecursions, filterMode, + // Datastructures.setToArray(predList),Datastructures.setToArray( + // objList),Datastructures.setToArray(classList),format,url,useLits); + Manager m = new Manager(); + SpecificSparqlEndpoint sse = null; + SparqlQueryType sqt = null; + // get Options for Manipulator + Manipulator man = new Manipulator(blankNodeIdentifier,breakSuperClassRetrievalAfter,replacePredicate,replaceObject); + HashMap<String, String> parameters = new HashMap<String, String>(); + parameters.put("default-graph-uri", "http://dbpedia.org"); + parameters.put("format", "application/sparql-results.xml"); + + // get Options for endpoints + if (predefinedEndpoint >= 1) { + sse = PredefinedEndpoint.getEndpoint(predefinedEndpoint); + } else { + sse = new SpecificSparqlEndpoint(url, host, parameters); + } + + // get Options for Filters + + if (predefinedFilter >= 1) { + sqt = PredefinedFilter.getFilter(predefinedFilter); + + } else { + sqt = new SparqlQueryType("forbid", objList, predList, useLits + ""); + + } + // give everything to the manager + m.useConfiguration(sqt, sse, man, recursionDepth, getAllSuperClasses,closeAfterRecursion); + try { + String ont = ""; + //System.out.println(learnDomain); + // used to learn a domain of a role + if (learnDomain || learnRange) { + Set<String> pos=new HashSet<String>(); + Set<String> neg=new HashSet<String>(); + if(learnDomain){ + pos = m.getDomainInstancesForRole(role); + neg = m.getRangeInstancesForRole(role); + }else if(learnRange){ + neg = m.getDomainInstancesForRole(role); + pos = m.getRangeInstancesForRole(role); + } + //choose 30 + + + Set<String> tmp=new HashSet<String>(); + for(String one:pos){ + tmp.add(one); + if(tmp.size()>=numberOfInstancesUsedForRoleLearning)break; + } + pos=tmp; + System.out.println("Instances used: "+pos.size()); + + tmp=new HashSet<String>(); + for(String one:neg){ + tmp.add(one); + if(tmp.size()>=numberOfInstancesUsedForRoleLearning)break; + } + neg=tmp; + + instances=new HashSet<String>(); + instances.addAll(pos); + + instances.addAll(neg); + + for(String one:pos){ + System.out.println("+\""+one+"\""); + } + for(String one:neg){ + System.out.println("-\""+one+"\""); + } + + /*Random r= new Random(); + + + Object[] arr=instances.toArray(); + while(instances.size()>=30){ + + }*/ + // add the role to the filter(a solution is always EXISTS + // role.TOP) + m.addPredicateFilter(role); + //System.out.println(instances); + // THIS is a workaround + + } + // the actual extraction is started here + ont = m.extract(instances); + System.out.println("Number of cached SPARQL queries: "+m.getConfiguration().numberOfCachedSparqlQueries); + System.out.println("Number of uncached SPARQL queries: "+m.getConfiguration().numberOfUncachedSparqlQueries); + + System.out.println("Finished collecting Fragment"); + + if (dumpToFile) { + String filename = System.currentTimeMillis() + ".nt"; + String basedir = "cache" + File.separator; + try { + if (!new File(basedir).exists()) + new File(basedir).mkdir(); + + FileWriter fw = new FileWriter(new File(basedir + filename), true); + fw.write(ont); + fw.flush(); + fw.close(); + + dumpFile = (new File(basedir + filename)).toURI().toURL(); + } catch (Exception e) { + e.printStackTrace(); + } + } + if (format.equals("KB")) { + try { + //kb = KBParser.parseKBFile(new StringReader(ont)); + kb=KBParser.parseKBFile(dumpFile); + } catch (Exception e) { + e.printStackTrace(); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + System.out.println("SparqlModul: ****Finished"); + } + + /* + * (non-Javadoc) + * + * @see org.dllearner.core.KnowledgeSource#toDIG() + */ + @Override + public String toDIG(URI kbURI) { + if (format.equals("N-TRIPLES")) + return JenaOWLDIGConverter.getTellsString(dumpFile, OntologyFormat.N_TRIPLES, kbURI); + else + return DIGConverter.getDIGString(kb, kbURI).toString(); + } + + /* + * (non-Javadoc) + * + * @see org.dllearner.core.KnowledgeSource#export(java.io.File, + * org.dllearner.core.OntologyFormat) + */ + @Override + public void export(File file, OntologyFormat format) throws OntologyFormatUnsupportedException { + // currently no export functions implemented, so we just throw an + // exception + throw new OntologyFormatUnsupportedException("export", format); + } + + public URL getURL() { + return url; + } + + public String[] getOntArray() { + return ontArray; + } + + public void calculateSubjects(String label, int limit) { + System.out.println("SparqlModul: Collecting Subjects"); + SparqlOntologyCollector oc = new SparqlOntologyCollector(url); + try { + subjects = oc.getSubjectsFromLabel(label, limit); + } catch (IOException e) { + subjects = new String[1]; + subjects[0] = "[Error]Sparql Endpoint could not be reached."; + } + System.out.println("SparqlModul: ****Finished"); + } + + public void calculateTriples(String subject) { + System.out.println("SparqlModul: Collecting Triples"); + SparqlOntologyCollector oc = new SparqlOntologyCollector(url); + try { + triples = oc.collectTriples(subject); + } catch (IOException e) { + triples = new String[1]; + triples[0] = "[Error]Sparql Endpoint could not be reached."; + } + System.out.println("SparqlModul: ****Finished"); + } + + public void calculateConceptSubjects(String concept) { + System.out.println("SparqlModul: Collecting Subjects"); + SparqlOntologyCollector oc = new SparqlOntologyCollector(url); + try { + conceptSubjects = oc.getSubjectsFromConcept(concept); + } catch (IOException e) { + conceptSubjects = new String[1]; + conceptSubjects[0] = "[Error]Sparql Endpoint could not be reached."; + } + System.out.println("SparqlModul: ****Finished"); + } + + public boolean subjectThreadIsRunning() { + return subjectThreadRunning; + } + + public void setSubjectThreadRunning(boolean bool) { + subjectThreadRunning = bool; + } + + public boolean triplesThreadIsRunning() { + return triplesThreadRunning; + } + + public void setTriplesThreadRunning(boolean bool) { + triplesThreadRunning = bool; + } + + public boolean conceptThreadIsRunning() { + return conceptThreadRunning; + } + + public void setConceptThreadRunning(boolean bool) { + conceptThreadRunning = bool; + } + + public String[] getSubjects() { + return subjects; + } + + public Thread getSubjectThread() { + return subjectThread; + } + + public void setSubjectThread(Thread subjectThread) { + this.subjectThread = subjectThread; + } + + public Thread getTriplesThread() { + return triplesThread; + } + + public void setTriplesThread(Thread triplesThread) { + this.triplesThread = triplesThread; + } + + public Thread getConceptThread() { + return conceptThread; + } + + public void setConceptThread(Thread conceptThread) { + this.conceptThread = conceptThread; + } + + public String[] getTriples() { + return triples; + } + + public String[] getConceptSubjects() { + return conceptSubjects; + } +} Deleted: trunk/src/dl-learner/org/dllearner/kb/SparqlEndpointRestructured.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/SparqlEndpointRestructured.java 2008-01-13 10:22:16 UTC (rev 368) +++ trunk/src/dl-learner/org/dllearner/kb/SparqlEndpointRestructured.java 2008-01-14 08:56:17 UTC (rev 369) @@ -1,509 +0,0 @@ -/** - * Copyright (C) 2007, Jens Lehmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.dllearner.kb; - -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URI; -import java.net.URL; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.Set; - -import org.dllearner.core.KnowledgeSource; -import org.dllearner.core.OntologyFormat; -import org.dllearner.core.OntologyFormatUnsupportedException; -import org.dllearner.core.config.BooleanConfigOption; -import org.dllearner.core.config.ConfigEntry; -import org.dllearner.core.config.ConfigOption; -import org.dllearner.core.config.IntegerConfigOption; -import org.dllearner.core.config.InvalidConfigOptionValueException; -import org.dllearner.core.config.StringConfigOption; -import org.dllearner.core.config.StringSetConfigOption; -import org.dllearner.core.config.StringTupleListConfigOption; -import org.dllearner.core.dl.KB; -import org.dllearner.kb.sparql.Manager; -import org.dllearner.kb.sparql.Manipulator; -import org.dllearner.kb.sparql.PredefinedEndpoint; -import org.dllearner.kb.sparql.PredefinedFilter; -import org.dllearner.kb.sparql.SparqlQueryType; -import org.dllearner.kb.sparql.SpecificSparqlEndpoint; -import org.dllearner.parser.KBParser; -import org.dllearner.reasoning.DIGConverter; -import org.dllearner.reasoning.JenaOWLDIGConverter; -import org.dllearner.utilities.StringTuple; - -/** - * Represents a SPARQL Endpoint. - * - * @author Jens Lehmann - * @author Sebastian Knappe - * @author Sebastian Hellmann - */ -public class SparqlEndpointRestructured extends KnowledgeSource { - - // ConfigOptions - private URL url; - String host; - private Set<String> instances=new HashSet<String>();; - private URL dumpFile; - private int recursionDepth = 1; - private int predefinedFilter = 0; - private int predefinedEndpoint = 0; - private Set<String> predList=new HashSet<String>(); - private Set<String> objList=new HashSet<String>(); - private Set<String> classList; - private String format = "N-TRIPLES"; - private boolean dumpToFile = true; - private boolean useLits = false; - private boolean getAllSuperClasses = true; - private boolean closeAfterRecursion = true; - private int breakSuperClassRetrievalAfter = 200; - - private boolean learnDomain = false; - private boolean learnRange = false; - private int numberOfInstancesUsedForRoleLearning=40; - private String role=""; - private String blankNodeIdentifier = "bnode"; - - LinkedList<StringTuple> URIParameters = new LinkedList<StringTuple>(); - LinkedList<StringTuple> replacePredicate = new LinkedList<StringTuple>(); - LinkedList<StringTuple> replaceObject = new LinkedList<StringTuple>(); - - /** - * Holds the results of the calculateSubjects method - */ - private String[] subjects; - - /** - * Holds the results of the calculateTriples method - */ - private String[] triples; - - /** - * Holds the results of the calculateConceptSubjects method - */ - private String[] conceptSubjects; - - /** - * if a method is running this becomes true - */ - private boolean subjectThreadRunning = false; - - private boolean triplesThreadRunning = false; - - private boolean conceptThreadRunning = false; - - /** - * the Thread that is running a method - */ - private Thread subjectThread; - - private Thread triplesThread; - - private Thread conceptThread; - - // received ontology as array, used if format=Array(an element of the - // array consists of the subject, predicate and object separated by '<' - private String[] ontArray; - - // received ontology as KB, the internal format - private KB kb; - - public static String getName() { - return "SPARQL Endpoint Restructured"; - } - - /** - * sets the ConfigOptions for this KnowledgeSource - * - * @return - */ - public static Collection<ConfigOption<?>> createConfigOptions() { - Collection<ConfigOption<?>> options = new LinkedList<ConfigOption<?>>(); - options.add(new StringConfigOption("url", "URL of SPARQL Endpoint")); - options.add(new StringConfigOption("host", "host of SPARQL Endpoint")); - options.add(new StringSetConfigOption("instances", - "relevant instances e.g. positive and negative examples in a learning problem")); - options.add(new IntegerConfigOption("recursionDepth", - "recursion depth of KB fragment selection", 2)); - options.add(new IntegerConfigOption("predefinedFilter", "the mode of the SPARQL Filter")); - options.add(new IntegerConfigOption("predefinedEndpoint", "the mode of the SPARQL Filter")); - - options.add(new StringSetConfigOption("predList", "list of all ignored roles")); - options.add(new StringSetConfigOption("objList", "list of all ignored objects")); - options.add(new StringSetConfigOption("classList", "list of all ignored classes")); - options.add(new StringConfigOption("format", "N-TRIPLES or KB format", "N-TRIPLES")); - options.add(new BooleanConfigOption("dumpToFile", - "Specifies whether the extracted ontology is written to a file or not.", true)); - options.add(new BooleanConfigOption("useLits", "use Literals in SPARQL query")); - options.add(new BooleanConfigOption("getAllSuperClasses", "If true then all superclasses are retrieved until the most general class (owl:Thing) is reached.", true)); - - options.add(new BooleanConfigOption("learnDomain", "learns the Domain for a Role")); - options.add(new BooleanConfigOption("learnRange", "learns the Range for a Role")); - options.add(new StringConfigOption("role", "role to learn Domain/Range from")); - options.add(new StringConfigOption("blankNodeIdentifier", - "used to identify blanknodes in Tripels")); - - options.add(new StringTupleListConfigOption("example", "example")); - options.add(new StringTupleListConfigOption("replacePredicate", "rule for replacing predicates")); - options.add(new StringTupleListConfigOption("replaceObject", "rule for replacing predicates")); - options.add(new IntegerConfigOption("breakSuperClassRetrievalAfter", "stops a cyclic hierarchy after specified number of classes")); - options.add(new IntegerConfigOption("numberOfInstancesUsedForRoleLearning", "")); - options.add(new BooleanConfigOption("closeAfterRecursion", "gets all classes for all instances")); - - - - return options; - } - - /* - * @see org.dllearner.core.Component#applyConfigEntry(org.dllearner.core.ConfigEntry) - */ - @Override - @SuppressWarnings( { "unchecked" }) - public <T> void applyConfigEntry(ConfigEntry<T> entry) throws InvalidConfigOptionValueException { - String option = entry.getOptionName(); - if (option.equals("url")) { - String s = (String) entry.getValue(); - try { - url = new URL(s); - } catch (MalformedURLException e) { - throw new InvalidConfigOptionValueException(entry.getOption(), entry.getValue(), - "malformed URL " + s); - } - } else if (option.equals("host")) { - host = (String) entry.getValue(); - } else if (option.equals("instances")) { - instances = (Set<String>) entry.getValue(); - } else if (option.equals("recursionDepth")) { - recursionDepth = (Integer) entry.getValue(); - } else if (option.equals("predList")) { - predList = (Set<String>) entry.getValue(); - } else if (option.equals("objList")) { - objList = (Set<String>) entry.getValue(); - } else if (option.equals("classList")) { - classList = (Set<String>) entry.getValue(); - } else if (option.equals("predefinedEndpoint")) { - predefinedEndpoint = (Integer) entry.getValue(); - } else if (option.equals("predefinedFilter")) { - predefinedFilter = (Integer) entry.getValue(); - } else if (option.equals("format")) { - format = (String) entry.getValue(); - } else if (option.equals("dumpToFile")) { - dumpToFile = (Boolean) entry.getValue(); - } else if (option.equals("useLits")) { - useLits = (Boolean) entry.getValue(); - } else if (option.equals("getAllSuperClasses")) { - getAllSuperClasses = (Boolean) entry.getValue(); - } else if (option.equals("learnDomain")) { - learnDomain = (Boolean) entry.getValue(); - }else if (option.equals("learnRange")) { - learnRange = (Boolean) entry.getValue(); - } else if (option.equals("role")) { - role = (String) entry.getValue(); - } else if (option.equals("blankNodeIdentifier")) { - blankNodeIdentifier = (String) entry.getValue(); - } else if (option.equals("example")) { - //System.out.println(entry.getValue()); - }else if (option.equals("replacePredicate")) { - replacePredicate = (LinkedList)entry.getValue(); - }else if (option.equals("replaceObject")) { - replaceObject = (LinkedList)entry.getValue(); - }else if (option.equals("breakSuperClassRetrievalAfter")) { - breakSuperClassRetrievalAfter = (Integer) entry.getValue(); - }else if (option.equals("numberOfInstancesUsedForRoleLearning")) { - numberOfInstancesUsedForRoleLearning = (Integer) entry.getValue(); - }else if (option.equals("closeAfterRecursion")) { - closeAfterRecursion = (Boolean) entry.getValue(); - } - - } - - /* - * (non-Javadoc) - * - * @see org.dllearner.core.Component#init() - */ - @Override - public void init() { - System.out.println("SparqlModul: Collecting Ontology"); - // SparqlOntologyCollector oc= - // new SparqlOntologyCollector(Datastructures.setToArray(instances), - // numberOfRecursions, filterMode, - // Datastructures.setToArray(predList),Datastructures.setToArray( - // objList),Datastructures.setToArray(classList),format,url,useLits); - Manager m = new Manager(); - SpecificSparqlEndpoint sse = null; - SparqlQueryType sqt = null; - // get Options for Manipulator - Manipulator man = new Manipulator(blankNodeIdentifier,breakSuperClassRetrievalAfter,replacePredicate,replaceObject); - HashMap<String, String> parameters = new HashMap<String, String>(); - parameters.put("default-graph-uri", "http://dbpedia.org"); - parameters.put("format", "application/sparql-results.xml"); - - // get Options for endpoints - if (predefinedEndpoint >= 1) { - sse = PredefinedEndpoint.getEndpoint(predefinedEndpoint); - } else { - sse = new SpecificSparqlEndpoint(url, host, parameters); - } - - // get Options for Filters - - if (predefinedFilter >= 1) { - sqt = PredefinedFilter.getFilter(predefinedFilter); - - } else { - sqt = new SparqlQueryType("forbid", objList, predList, useLits + ""); - - } - // give everything to the manager - m.useConfiguration(sqt, sse, man, recursionDepth, getAllSuperClasses,closeAfterRecursion); - try { - String ont = ""; - //System.out.println(learnDomain); - // used to learn a domain of a role - if (learnDomain || learnRange) { - Set<String> pos=new HashSet<String>(); - Set<String> neg=new HashSet<String>(); - if(learnDomain){ - pos = m.getDomainInstancesForRole(role); - neg = m.getRangeInstancesForRole(role); - }else if(learnRange){ - neg = m.getDomainInstancesForRole(role); - pos = m.getRangeInstancesForRole(role); - } - //choose 30 - - - Set<String> tmp=new HashSet<String>(); - for(String one:pos){ - tmp.add(one); - if(tmp.size()>=numberOfInstancesUsedForRoleLearning)break; - } - pos=tmp; - System.out.println("Instances used: "+pos.size()); - - tmp=new HashSet<String>(); - for(String one:neg){ - tmp.add(one); - if(tmp.size()>=numberOfInstancesUsedForRoleLearning)break; - } - neg=tmp; - - instances=new HashSet<String>(); - instances.addAll(pos); - - instances.addAll(neg); - - for(String one:pos){ - System.out.println("+\""+one+"\""); - } - for(String one:neg){ - System.out.println("-\""+one+"\""); - } - - /*Random r= new Random(); - - - Object[] arr=instances.toArray(); - while(instances.size()>=30){ - - }*/ - // add the role to the filter(a solution is always EXISTS - // role.TOP) - m.addPredicateFilter(role); - //System.out.println(instances); - // THIS is a workaround - - } - // the actual extraction is started here - ont = m.extract(instances); - System.out.println("Number of cached SPARQL queries: "+m.getConfiguration().numberOfCachedSparqlQueries); - System.out.println("Number of uncached SPARQL queries: "+m.getConfiguration().numberOfUncachedSparqlQueries); - - System.out.println("Finished collecting Fragment"); - - if (dumpToFile) { - String filename = System.currentTimeMillis() + ".nt"; - String basedir = "cache" + File.separator; - try { - if (!new File(basedir).exists()) - new File(basedir).mkdir(); - - FileWriter fw = new FileWriter(new File(basedir + filename), true); - fw.write(ont); - fw.flush(); - fw.close(); - - dumpFile = (new File(basedir + filename)).toURI().toURL(); - } catch (Exception e) { - e.printStackTrace(); - } - } - if (format.equals("KB")) { - try { - //kb = KBParser.parseKBFile(new StringReader(ont)); - kb=KBParser.parseKBFile(dumpFile); - } catch (Exception e) { - e.printStackTrace(); - } - } - } catch (Exception e) { - e.printStackTrace(); - } - System.out.println("SparqlModul: ****Finished"); - } - - /* - * (non-Javadoc) - * - * @see org.dllearner.core.KnowledgeSource#toDIG() - */ - @Override - public String toDIG(URI kbURI) { - if (format.equals("N-TRIPLES")) - return JenaOWLDIGConverter.getTellsString(dumpFile, OntologyFormat.N_TRIPLES, kbURI); - else - return DIGConverter.getDIGString(kb, kbURI).toString(); - } - - /* - * (non-Javadoc) - * - * @see org.dllearner.core.KnowledgeSource#export(java.io.File, - * org.dllearner.core.OntologyFormat) - */ - @Override - public void export(File file, OntologyFormat format) throws OntologyFormatUnsupportedException { - // currently no export functions implemented, so we just throw an - // exception - throw new OntologyFormatUnsupportedException("export", format); - } - - public URL getURL() { - return url; - } - - public String[] getOntArray() { - return ontArray; - } - - public void calculateSubjects(String label, int limit) { - System.out.println("SparqlModul: Collecting Subjects"); - SparqlOntologyCollector oc = new SparqlOntologyCollector(url); - try { - subjects = oc.getSubjectsFromLabel(label, limit); - } catch (IOException e) { - subjects = new String[1]; - subjects[0] = "[Error]Sparql Endpoint could not be reached."; - } - System.out.println("SparqlModul: ****Finished"); - } - - public void calculateTriples(String subject) { - System.out.println("SparqlModul: Collecting Triples"); - SparqlOntologyCollector oc = new SparqlOntologyCollector(url); - try { - triples = oc.collectTriples(subject); - } catch (IOException e) { - triples = new String[1]; - triples[0] = "[Error]Sparql Endpoint could not be reached."; - } - System.out.println("SparqlModul: ****Finished"); - } - - public void calculateConceptSubjects(String concept) { - System.out.println("SparqlModul: Collecting Subjects"); - SparqlOntologyCollector oc = new SparqlOntologyCollector(url); - try { - conceptSubjects = oc.getSubjectsFromConcept(concept); - } catch (IOException e) { - conceptSubjects = new String[1]; - conceptSubjects[0] = "[Error]Sparql Endpoint could not be reached."; - } - System.out.println("SparqlModul: ****Finished"); - } - - public boolean subjectThreadIsRunning() { - return subjectThreadRunning; - } - - public void setSubjectThreadRunning(boolean bool) { - subjectThreadRunning = bool; - } - - public boolean triplesThreadIsRunning() { - return triplesThreadRunning; - } - - public void setTriplesThreadRunning(boolean bool) { - triplesThreadRunning = bool; - } - - public boolean conceptThreadIsRunning() { - return conceptThreadRunning; - } - - public void setConceptThreadRunning(boolean bool) { - conceptThreadRunning = bool; - } - - public String[] getSubjects() { - return subjects; - } - - public Thread getSubjectThread() { - return subjectThread; - } - - public void setSubjectThread(Thread subjectThread) { - this.subjectThread = subjectThread; - } - - public Thread getTriplesThread() { - return triplesThread; - } - - public void setTriplesThread(Thread triplesThread) { - this.triplesThread = triplesThread; - } - - public Thread getConceptThread() { - return conceptThread; - } - - public void setConceptThread(Thread conceptThread) { - this.conceptThread = conceptThread; - } - - public String[] getTriples() { - return triples; - } - - public String[] getConceptSubjects() { - return conceptSubjects; - } -} Deleted: trunk/src/dl-learner/org/dllearner/kb/SparqlFilter.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/SparqlFilter.java 2008-01-13 10:22:16 UTC (rev 368) +++ trunk/src/dl-learner/org/dllearner/kb/SparqlFilter.java 2008-01-14 08:56:17 UTC (rev 369) @@ -1,119 +0,0 @@ -/** - * Copyright (C) 2007, Sebastian Hellmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.dllearner.kb; - -/** - * - * - * encapsulates all the options - * see the documentation for more help - * - * @author Sebastian Hellmann - * @author Sebastian Knappe - * - */ -public class SparqlFilter { - public int mode=0; - // 0 yago, 1 only cat, 2 skos+cat - String[] PredFilter=null; - String[] ObjFilter=null; - boolean useLiterals=false; - - - String[] yagoPredFilterDefault={ - "http://www.w3.org/2004/02/skos/core", - "http://xmlns.com/foaf/0.1/", - "http://dbpedia.org/property/wikipage-", - "http://www.w3.org/2002/07/owl#sameAs", - "http://dbpedia.org/property/reference" }; - String[] yagoObjFilterDefault={ - "http://dbpedia.org/resource/Category:Articles_", - "http://dbpedia.org/resource/Category:Wikipedia_", - "http://xmlns.com/foaf/0.1/", - "http://dbpedia.org/resource/Category", - "http://dbpedia.org/resource/Template", - "http://upload.wikimedia.org/wikipedia/commons"}; - - String[] onlyCatPredFilterDefault={ - "http://www.w3.org/2004/02/skos/core", - "http://xmlns.com/foaf/0.1/", - "http://dbpedia.org/property/wikipage-", - "http://www.w3.org/2002/07/owl#sameAs", - "http://dbpedia.org/property/reference" }; - String[] onlyCatObjFilterDefault={ - "http://dbpedia.org/resource/Category:Articles_", - "http://dbpedia.org/resource/Category:Wikipedia_", - "http://xmlns.com/foaf/0.1/", - "http://dbpedia.org/class/yago", - "http://dbpedia.org/resource/Template", - "http://upload.wikimedia.org/wikipedia/commons"}; - - String[] skosPredFilterDefault={ - "http://www.w3.org/2004/02/skos/core#narrower", - "http://xmlns.com/foaf/0.1/", - "http://dbpedia.org/property/wikipage-", - "http://www.w3.org/2002/07/owl#sameAs", - "http://dbpedia.org/property/reference" }; - String[] skosObjFilterDefault={ - "http://dbpedia.org/resource/Category:Articles_", - "http://dbpedia.org/resource/Category:Wikipedia_", - "http://xmlns.com/foaf/0.1/", - "http://dbpedia.org/class/yago", - "http://dbpedia.org/resource/Template", - "http://upload.wikimedia.org/wikipedia/commons"}; - - public SparqlFilter(int mode, String[] pred, String[] obj) { - if (mode==-1 && (pred==null || obj==null)) - {mode=0;} - this.mode=mode; - - switch (mode){ - case 0: //yago - ObjFilter=yagoObjFilterDefault; - PredFilter=yagoPredFilterDefault; - break; - case 1: // only Categories - ObjFilter=onlyCatObjFilterDefault; - PredFilter=onlyCatPredFilterDefault; - break; - case 2: // there are some other changes to, which are made directly in other functions - ObjFilter=skosObjFilterDefault; - PredFilter=skosPredFilterDefault; - break; - default: - ObjFilter=obj; - PredFilter=pred; - break; - } - } - - public SparqlFilter(int mode, String[] pred, String[] obj,boolean uselits) throws Exception{ - this(mode,pred,obj); - this.useLiterals=uselits; - } - - public String[] getObjFilter(){ - return this.ObjFilter; - } - - public String[] getPredFilter(){ - return this.PredFilter; - } -} \ No newline at end of file Deleted: trunk/src/dl-learner/org/dllearner/kb/SparqlOntologyCollector.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/SparqlOntologyCollector.java 2008-01-13 10:22:16 UTC (rev 368) +++ trunk/src/dl-learner/org/dllearner/kb/SparqlOntologyCollector.java 2008-01-14 08:56:17 UTC (rev 369) @@ -1,509 +0,0 @@ -/** - * Copyright (C) 2007, Sebastian Hellmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.dllearner.kb; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.net.HttpURLConnection; -import java.net.URL; -import java.net.URLEncoder; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Vector; - - -/** - * This class collects the ontology from dbpedia, - * everything is saved in hashsets, so the doublettes are taken care of - * - * - * @author Sebastia... [truncated message content] |
From: <jen...@us...> - 2008-01-13 10:22:21
|
Revision: 368 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=368&view=rev Author: jenslehmann Date: 2008-01-13 02:22:16 -0800 (Sun, 13 Jan 2008) Log Message: ----------- extended ToDo list and minor improvements Modified Paths: -------------- trunk/src/dbpedia-navigator/ajaxfunctions.php trunk/src/dbpedia-navigator/default.css trunk/src/dbpedia-navigator/index.php Modified: trunk/src/dbpedia-navigator/ajaxfunctions.php =================================================================== --- trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-01-11 17:01:00 UTC (rev 367) +++ trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-01-13 10:22:16 UTC (rev 368) @@ -83,10 +83,19 @@ if(isset($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type'])) $content .= '<p>classes: '.formatClassArray($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type']).'</p>'; - // filter out uninteresting properties + if(isset($triples['http://dbpedia.org/property/reference'])) { + $content .= '<p>references: <ul>'; + foreach($triples['http://dbpedia.org/property/reference'] as $reference) + $content .= '<li><a href="'.$reference.'">'.$reference.'</a></li>'; + $content .= '</ul></p>'; + } + + // filter out uninteresting properties and properties which + // have already been displayed unset($triples['http://xmlns.com/foaf/0.1/page']); unset($triples['http://xmlns.com/foaf/0.1/depiction']); - unset($triples['http://dbpedia.org/property/abstract']); + unset($triples['http://dbpedia.org/property/abstract']); + unset($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type']); // display the remaining properties as list which can be used for further navigation Modified: trunk/src/dbpedia-navigator/default.css =================================================================== --- trunk/src/dbpedia-navigator/default.css 2008-01-11 17:01:00 UTC (rev 367) +++ trunk/src/dbpedia-navigator/default.css 2008-01-13 10:22:16 UTC (rev 368) @@ -374,4 +374,9 @@ #footer { clear: both; text-align: center; +} + +#todo { + padding: 15px; + margin: 10px; } \ No newline at end of file Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-01-11 17:01:00 UTC (rev 367) +++ trunk/src/dbpedia-navigator/index.php 2008-01-13 10:22:16 UTC (rev 368) @@ -182,19 +182,64 @@ echo '><img src="images/valid-css.png" alt="valid CSS" /></a></div>'."\n"; ?> </div> - <p><a href='rebuild.php'>rebuild [restart session and redownload WSDL file (for debugging)]</a></p> - <p> -ToDo: -<ul> - <li>get learning process working (with new SPARQL component)</li> - <li>get local DBpedia SPARQL endpoint working</li> - <li>many queries work correctly on the server, but yield to response in the interface (seems to be rather random)</li> - <li>fix sometimes occurring PHP errors and warnings</li> - <li>would be interesting to somehow view the Wikipedia article (without the left navigation part, + <p><a href='rebuild.php'>rebuild [restart session and redownload WSDL file (for debugging)]</a></p> +</div> + +<div id="todo"> +<b>ToDo:</b> +<ul style="float:left"> + <li>Get learning process working (with new SPARQL component).</li> + <li>Get local DBpedia SPARQL endpoint working (next DBpedia release expected at the endof January and then every + two months, so it would be nice to have a script based partly automated or at least documented solution for + creating a DBpedia mirror).</li> + <li>Improve stability: Fix sometimes occurring PHP errors and warnings (check PHP error log).</li> + <li>Currently there are three SPARQL query methods: for labels, subjects, and article. These should + probably be replaced by a single web service method which allows to execute a SPARQL query. This will + greatly simplify the DL-Learner code while making the PHP code only slightly more complex. Such a method + also makes much more sense as a web service method, because other applications will need different SPARQL + queries. Similar to the learn method, there should be a threaded and a non-threaded version of the SPARQL + query method. This allows not to have the overhead of creating a separate thread for simple SPARQL queries + (especially since we assume that the DBpedia SPARQL endpoint is local).</li> + <li>Automatically learn concepts whenever an example has been added (and there is at least one + positive example present).</li> + <li>Show n (for example 5) instead of 1 best concept.</li> + <li>For each result, display a "+" which shows more information about the concept in an overlay box, e.g. its + Description Logic or OWL syntax, its classification accuracy on the examples, and which + examples it classifies (in-)correctly.</li> + <li>Move the "Learned Concepts" box above the main box in the center.</li> + <li>Remove the "Subjects from Concept" box and instead change the learned concepts to links (clicking + on a link shows instances of the concept).</li> + <li>Create a small number of test cases (e.g. 3), which can be used to verify that DBpedia Navigator is + working in typical scenarios (in particular cases where concepts with length greater one are learned).</li> + <li>Display "server call" in progress (or "n server calls in progress") in the top right corner + of the screen whenever AJAX queries are executed.</li> + <li>Allow to disable caching functionality (in Settings.php).</li> + <li>Fix the rebuild.php script such that PHP replaces the cached WSDL file by the new one.</li> + <li>Make DBpedia Navigator RESTful, e.g. URLs $base/showArticle/$URL for displaying an article; + $base/search/$phrase for searching; $base/listInstances/$complexClass for listing the instances of + a learned. Maybe session variables (in particuar the selected positive and negative examples) can + also be given, e.g. $base/search/$phrase?positives=[$URL1,$URL2,$URL3]&negatives=[$URL4]. The supported + URI design should be briefly documented (e.g. on a dbpedia.org wiki page). A good URI design allows + easier external access (just give someone a link instead of saying exactly which actions have to be done to + get to a state), simplifies debugging the application, and may be of use for creating further + features.</li> + <li>Improve search functionality [we will probably get feedback from Georgi in February].</li> + <li>[maybe] Display a tag cloud similar to <a href="http://dbpedia.org/search/">DBpedia search</a>.</li> + <li>Get a nice DBpedia Navigator logo (preferrably in SVG format) [currently in contact with Matt, but not + sure he has time to help].</li> + <li>[maybe] Instead of only allowing a search as entry point to the application, also display + a navigatable class tree.</li> + <li>[if possible] When expensive SPARQL queries or learning problems have been posed, there should be + some way to abandon these if the user has already switched to doing something else. Example: The user + has added 3 positive and 1 negative examples. This is executed as a learning problem, but has no solution (so + DL-Learner would run forever unless we pose some internal time limit). The user adds another negative example a + second later, so instead of letting the previous learning problem run for a long time (and needing much resources), + it should be stopped by DBpedia Navigator.</li> + <li>[if possible] Find an easy way to validate HTML/JS in AJAX applications.</li> + <li>[maybe] Would be interesting to somehow view the Wikipedia article (without the left navigation part, tabs etc.) as an overlay, because the Wikipedia article will almost always be a human-friendlier - description of an object compared to the extracted one</li> + description of an object compared to the extracted one.</li> </ul> -</p> </div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-01-11 17:01:08
|
Revision: 367 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=367&view=rev Author: jenslehmann Date: 2008-01-11 09:01:00 -0800 (Fri, 11 Jan 2008) Log Message: ----------- basic learning in DBpedia Navigator working again Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/Settings.php trunk/src/dbpedia-navigator/ajaxfunctions.php trunk/src/dbpedia-navigator/index.php trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java Added Paths: ----------- trunk/src/dbpedia-navigator/rebuild.php Removed Paths: ------------- trunk/src/dbpedia-navigator/clearsession.php Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-01-11 11:45:18 UTC (rev 366) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-01-11 17:01:00 UTC (rev 367) @@ -35,7 +35,7 @@ $id=$this->client->generateID(); $ksID=$this->client->addKnowledgeSource($id,"sparql",$this->DBPediaUrl); return array(0 => $id, 1 => $ksID); - } + } function test() { @@ -47,12 +47,11 @@ { $this->client->applyConfigEntryInt($this->id, $this->ksID, "recursionDepth", 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->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"); if(empty($negExamples)) @@ -64,8 +63,8 @@ $this->client->setNegativeExamples($this->id, $negExamples); $this->client->setLearningAlgorithm($this->id, "refinement"); - $start = microtime(true); - + $start = microtime(true); + $this->client->initAll($this->id); $threaded=true; Modified: trunk/src/dbpedia-navigator/Settings.php =================================================================== --- trunk/src/dbpedia-navigator/Settings.php 2008-01-11 11:45:18 UTC (rev 366) +++ trunk/src/dbpedia-navigator/Settings.php 2008-01-11 17:01:00 UTC (rev 367) @@ -1,11 +1,41 @@ <?php +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +/** + * DBpedia navigator settings. + * + * @author Sebastian Knappe + * @author Jens Lehmann + */ +class Settings{ -class Settings{ 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 $dbpediauri='http://dbpedia.openlinksw.com:8890/sparql'; + // public DBpedia mirror + // public $dbpediauri='http://dbpedia2.openlinksw.com:8890/isparql'; + public $sparqlttl=60; } Modified: trunk/src/dbpedia-navigator/ajaxfunctions.php =================================================================== --- trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-01-11 11:45:18 UTC (rev 366) +++ trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-01-11 17:01:00 UTC (rev 367) @@ -81,7 +81,7 @@ // display a list of classes if(isset($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type'])) - $content .= '<p>Classes: '.array_to_comma($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type']).'</p>'; + $content .= '<p>classes: '.formatClassArray($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type']).'</p>'; // filter out uninteresting properties unset($triples['http://xmlns.com/foaf/0.1/page']); @@ -273,10 +273,34 @@ return $table; } -function array_to_comma_separated_list($ar) { +function formatClassArray($ar) { + $string = formatClass($ar[0]); + for($i=1; $i<count($ar); $i++) { + $string .= ', ' . formatClass($ar[$i]); + } + return $string; +} + +// format a class nicely, i.e. link to it and possibly display +// it in a better way +function formatClass($className) { + $yagoPrefix = 'http://dbpedia.org/class/yago/'; + if(substr($className,0,30)==$yagoPrefix) { + return '<a href="'.$className.'">'.substr($className,30).'</a>'; + // DBpedia is Linked Data, so it makes always sense to link it + // ToDo: instead of linking to other pages, the resource should better + // be openened within DBpedia Navigator + } else if(substr($className,0,14)=='http://dbpedia') { + return '<a href="'.$className.'">'.$className.'</a>'; + } else { + return $className; + } +} + +function arrayToCommaSseparatedList($ar) { $string = $ar[0]; for($i=1; $i<count($ar); $i++) { - $string .= $ar[$i] . ', '; + $string .= ', ' . $ar[$i]; } return $string; } Deleted: trunk/src/dbpedia-navigator/clearsession.php =================================================================== --- trunk/src/dbpedia-navigator/clearsession.php 2008-01-11 11:45:18 UTC (rev 366) +++ trunk/src/dbpedia-navigator/clearsession.php 2008-01-11 17:01:00 UTC (rev 367) @@ -1,13 +0,0 @@ -<?php -session_start(); - -session_unset(); -ob_start(); -require_once 'pear/HTTP_Request.php'; -require_once 'DLLearnerConnection.php'; -require_once 'Settings.php'; -$settings=new Settings(); -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/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-01-11 11:45:18 UTC (rev 366) +++ trunk/src/dbpedia-navigator/index.php 2008-01-11 17:01:00 UTC (rev 367) @@ -147,13 +147,13 @@ <div id="rightSidebar"> <div class="box"> - <div class="boxtitlewithbutton" id="positivesboxtitle">search relevant <input type="button" value="Clear" class="button" onclick="xajax_clearPositives();return false;" /></div> + <div class="boxtitlewithbutton" id="positivesboxtitle">search relevant <img src="images/remove.png" onclick="xajax_clearPositives()" /> </div> <div class="boxcontent" id="Positives"> </div> <!-- boxcontent --> </div> <!-- box --> <div class="box"> - <div class="boxtitlewithbutton" id="negativesboxtitle">not relevant <input type="button" value="Clear" class="button" onclick="xajax_clearNegatives();return false;" /></div> + <div class="boxtitlewithbutton" id="negativesboxtitle">not relevant <img src="images/remove.png" onclick="xajax_clearNegatives()" /> </div> <div class="boxcontent" id="Negatives"> </div> <!-- boxcontent --> </div> <!-- box --> @@ -182,7 +182,7 @@ echo '><img src="images/valid-css.png" alt="valid CSS" /></a></div>'."\n"; ?> </div> - <p><a href='clearsession.php'>restart session and redownload WSDL file (for debugging)</a></p> + <p><a href='rebuild.php'>rebuild [restart session and redownload WSDL file (for debugging)]</a></p> <p> ToDo: <ul> Copied: trunk/src/dbpedia-navigator/rebuild.php (from rev 363, trunk/src/dbpedia-navigator/clearsession.php) =================================================================== --- trunk/src/dbpedia-navigator/rebuild.php (rev 0) +++ trunk/src/dbpedia-navigator/rebuild.php 2008-01-11 17:01:00 UTC (rev 367) @@ -0,0 +1,27 @@ +<?php +session_start(); + +session_unset(); +ob_start(); +require_once 'pear/HTTP_Request.php'; +require_once 'DLLearnerConnection.php'; +require_once 'Settings.php'; +$settings=new Settings(); + +// download new WSDL file +DLLearnerConnection::loadWSDLfiles($settings->wsdluri); + +// we need to make sure that PHP really uses the new WSDL file +// and does not cache, so we disable the cache and load it +ini_set("soap.wsdl_cache_enabled","0"); +$sc=new DLLearnerConnection($settings->dbpediauri,$settings->wsdluri); +//$sc->getIDs(); +// TODO: does not work; +// maybe try to set ttl of cache to 1 second, +// wait for 1 second and then redirect to start page + +// redirect to index page +$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/dl-learner/org/dllearner/server/DLLearnerWS.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2008-01-11 11:45:18 UTC (rev 366) +++ trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2008-01-11 17:01:00 UTC (rev 367) @@ -32,6 +32,7 @@ import javax.jws.WebService; import javax.jws.soap.SOAPBinding; +import org.dllearner.Info; import org.dllearner.algorithms.refinement.ROLearner; import org.dllearner.core.Component; import org.dllearner.core.ComponentManager; @@ -92,6 +93,15 @@ } /** + * Returns the DL-Learner version this web service is based on. + * @return DL-Learner-Build. + */ + @WebMethod + public String getBuild() { + return Info.build; + } + + /** * Generates a unique ID for the client and initialises a session. * Using the ID the client can call the other web service methods. * Two calls to this method are guaranteed to return different results. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-01-11 11:45:23
|
Revision: 366 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=366&view=rev Author: jenslehmann Date: 2008-01-11 03:45:18 -0800 (Fri, 11 Jan 2008) Log Message: ----------- improved article display (intermediate commit due to dead DBpedia SPARQL endpoint) Modified Paths: -------------- trunk/src/dbpedia-navigator/ajaxfunctions.php trunk/src/dbpedia-navigator/index.php Modified: trunk/src/dbpedia-navigator/ajaxfunctions.php =================================================================== --- trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-01-11 09:23:49 UTC (rev 365) +++ trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-01-11 11:45:18 UTC (rev 366) @@ -50,14 +50,15 @@ $settings=new Settings(); $sc=new DLLearnerConnection($settings->dbpediauri,$settings->wsdluri,$_SESSION['id'],$_SESSION['ksID']); $triples=$sc->getTriples($settings->sparqlttl,$subject); - $content=""; + $content="";$contentbuttons=""; if (count($triples)==1) - { + { + // ToDo: find out why this was treated in a special way by Sebastian $content.=substr($triples,7); } - else if (count($triples)==0) + else if (count($triples)==0) { $content.="Did not find an article with that name."; - else { + } else { // goal: display the data in a nice (DBpedia specific way), maybe similar to // dbpedia.org/search @@ -77,12 +78,16 @@ if(isset($triples['http://xmlns.com/foaf/0.1/page'])) $content .= '<p><img src="images/wikipedia_favicon.png" alt"Wikipedia" /> <a href="'.$triples['http://xmlns.com/foaf/0.1/page'][0].'">view Wikipedia article</a>, '; $content .= '<a href="'.$subject.'">view DBpedia resource description</a></p>'; - + // display a list of classes + if(isset($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type'])) + $content .= '<p>Classes: '.array_to_comma($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type']).'</p>'; // filter out uninteresting properties - // unset - + unset($triples['http://xmlns.com/foaf/0.1/page']); + unset($triples['http://xmlns.com/foaf/0.1/depiction']); + unset($triples['http://dbpedia.org/property/abstract']); + // display the remaining properties as list which can be used for further navigation $content .= '<br/><br/><br/><br/><br/><br/>'.get_triple_table($triples); @@ -249,7 +254,10 @@ return $objResponse; } -// helper function +/////////////////////// +// Helper Functions. // +/////////////////////// + function get_triple_table($triples) { $table = '<table border="1"><tr><td>predicate</td><td>object</td></tr>'; @@ -264,5 +272,13 @@ $table .= '</table>'; return $table; } + +function array_to_comma_separated_list($ar) { + $string = $ar[0]; + for($i=1; $i<count($ar); $i++) { + $string .= $ar[$i] . ', '; + } + return $string; +} ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-01-11 09:23:49 UTC (rev 365) +++ trunk/src/dbpedia-navigator/index.php 2008-01-11 11:45:18 UTC (rev 366) @@ -118,8 +118,8 @@ <a href="http://dl-learner.org">DL-Learner</a><br /> <a href="http//dbpedia.org">DBpedia</a><br/> <a href="http://virtuoso.openlinksw.com/wiki/main/">OpenLink Virtuoso</a><br /> - ... and implemented by <a href="http://jens-lehmann.org">Jens Lehmann</a> at - the <a href="http:/aksw.org">AKSW</a> research group (University of Leipzig).</p> + ... and implemented by <a href="http://jens-lehmann.org">Jens Lehmann</a> and + Sebastian Knappe at the <a href="http:/aksw.org">AKSW</a> research group (University of Leipzig).</p> <a href="http://www.w3.org/2004/OWL/"><img src="images/sw-owl-green.png" alt="OWL logo" /></a> <a href="http://www.w3.org/2001/sw/DataAccess/"><img src="images/sw-sparql-green.png" alt="SPARQL logo"/></a> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-01-11 09:23:52
|
Revision: 365 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=365&view=rev Author: jenslehmann Date: 2008-01-11 01:23:49 -0800 (Fri, 11 Jan 2008) Log Message: ----------- fixed some smaller problems Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/ajaxfunctions.php trunk/src/dl-learner/org/dllearner/core/ReasoningService.java trunk/src/dl-learner/org/dllearner/kb/SparqlOntologyCollector.java Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-01-10 18:52:03 UTC (rev 364) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-01-11 09:23:49 UTC (rev 365) @@ -55,18 +55,18 @@ $this->client->applyConfigEntryBoolean($this->id, $this->ksID, "dumpToFile", true); $this->client->setReasoner($this->id, "dig"); - if(!isset($negExamples)) + if(empty($negExamples)) $this->client->setLearningProblem($this->id, "posOnlyDefinition"); else $this->client->setLearningProblem($this->id, "posNegDefinition"); $this->client->setPositiveExamples($this->id, $posExamples); - if(isset($negExamples)) + if(!empty($negExamples)) $this->client->setNegativeExamples($this->id, $negExamples); $this->client->setLearningAlgorithm($this->id, "refinement"); $start = microtime(true); - $this->client->init($this->id); + $this->client->initAll($this->id); $threaded=true; Modified: trunk/src/dbpedia-navigator/ajaxfunctions.php =================================================================== --- trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-01-10 18:52:03 UTC (rev 364) +++ trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-01-11 09:23:49 UTC (rev 365) @@ -187,8 +187,11 @@ require_once("DLLearnerConnection.php"); $settings=new Settings(); $sc=new DLLearnerConnection($settings->dbpediauri,$settings->wsdluri,$_SESSION['id'],$_SESSION['ksID']); - - $concept=$sc->getConceptFromExamples($settings->sparqlttl,$_SESSION['positive'],$_SESSION['negative']); + + if(isset($_SESSION['negative'])) + $concept=$sc->getConceptFromExamples($settings->sparqlttl,$_SESSION['positive'],$_SESSION['negative']); + else + $concept=$sc->getConceptFromExamples($settings->sparqlttl,$_SESSION['positive'], array()); $_SESSION['lastLearnedConcept']=$concept; if (strlen(substr (strrchr ($concept, "/"), 1))>0) $concept=urldecode(substr (strrchr ($concept, "/"), 1)); } Modified: trunk/src/dl-learner/org/dllearner/core/ReasoningService.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/ReasoningService.java 2008-01-10 18:52:03 UTC (rev 364) +++ trunk/src/dl-learner/org/dllearner/core/ReasoningService.java 2008-01-11 09:23:49 UTC (rev 365) @@ -21,6 +21,7 @@ package org.dllearner.core; import java.io.File; +import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; @@ -79,25 +80,22 @@ // private SortedSet<Concept> retrievalsSet = new TreeSet<Concept>(new ConceptComparator()); - // Caching f�r allgemeinere/speziellere atomare Konzepte => wird innerhalb der Reasoner gemacht - // private Map<Concept,Set<Concept>> moreGeneralConcepts = new HashMap<Concept,Set<Concept>>(); - // private Map<Concept,Set<Concept>> moreSpecialConcepts = new HashMap<Concept,Set<Concept>>(); - private Reasoner reasoner; - // note that you must not modify the underlying knowledge base of - // a reasoning service (if you do, you have to create a new reasoning - // service object) + /** + * Constructs a reasoning service object. Note that you must not + * modify the underlying knowledge base of a reasoning service + * (if you do, you have to create a new reasoning service object). + * Further note, that the initialisation is lazy, e.g. you can + * feed the constructor with a non-initialised reasoner component. + * However, of course you need to make sure that the resoner component + * is initialised before the first reasoner query. + * + * @param reasoner + */ public ReasoningService(ReasonerComponent reasoner) { this.reasoner = reasoner; - // list view: the following two lines are commented out, because otherwise the ReasonerComponent - // already has to be initialised when a ReasoningService instance is created; this is problematic - // e.g. for the web service interface, which does not expose the ReasoningService - // (because it is not a component itself) - // atomicConceptsList = new LinkedList<AtomicConcept>(getAtomicConcepts()); - // atomicRolesList = new LinkedList<AtomicRole>(getAtomicRoles()); - resetStatistics(); } @@ -430,12 +428,14 @@ } public List<AtomicConcept> getAtomicConceptsList() { - // not working, see message in constructor + if(atomicConceptsList == null) + atomicConceptsList = new LinkedList<AtomicConcept>(getAtomicConcepts()); return atomicConceptsList; } public List<AtomicRole> getAtomicRolesList() { - // not working, see message in constructor + if(atomicRolesList == null) + atomicRolesList = new LinkedList<AtomicRole>(getAtomicRoles()); return atomicRolesList; } Modified: trunk/src/dl-learner/org/dllearner/kb/SparqlOntologyCollector.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/SparqlOntologyCollector.java 2008-01-10 18:52:03 UTC (rev 364) +++ trunk/src/dl-learner/org/dllearner/kb/SparqlOntologyCollector.java 2008-01-11 09:23:49 UTC (rev 365) @@ -46,7 +46,7 @@ public class SparqlOntologyCollector { boolean print_flag=false; - SparqlQueryMaker q; + SparqlQueryMaker queryMaker; SparqlCache cache; URL url; SparqlFilter sf; @@ -89,7 +89,7 @@ this.subjectList=subjectList; this.numberOfRecursions=numberOfRecursions; this.format=format; - this.q=new SparqlQueryMaker(); + this.queryMaker=new SparqlQueryMaker(); this.cache=new SparqlCache("cache"); if(defClasses!=null && defClasses.length>0 ){ this.defaultClasses=defClasses; @@ -107,7 +107,7 @@ public SparqlOntologyCollector(URL url) { - this.q=new SparqlQueryMaker(); + this.queryMaker=new SparqlQueryMaker(); this.cache=new SparqlCache("cache"); this.url=url; } @@ -130,7 +130,7 @@ public String[] collectTriples(String subject) throws IOException{ System.out.println("Searching for Article: "+subject); - String sparql=q.makeArticleQuery(subject); + String sparql=queryMaker.makeArticleQuery(subject); String fromCache=cache.get(subject, sparql); String xml; // if not in cache get it from dbpedia @@ -180,7 +180,7 @@ public String[] getSubjectsFromLabel(String label, int limit) throws IOException{ System.out.println("Searching for Label: "+label); - String sparql=q.makeLabelQuery(label,limit); + String sparql=queryMaker.makeLabelQuery(label,limit); String FromCache=cache.get(label, sparql); String xml; // if not in cache get it from dbpedia @@ -200,7 +200,7 @@ public String[] getSubjectsFromConcept(String concept) throws IOException { System.out.println("Searching for Subjects of type: "+concept); - String sparql=q.makeConceptQuery(concept); + String sparql=queryMaker.makeConceptQuery(concept); String FromCache=cache.get(concept, sparql); String xml; // if not in cache get it from dbpedia @@ -240,7 +240,7 @@ return; else {NumberofRecursions--;} - String sparql=q.makeQueryFilter(StartingSubject,this.sf); + String sparql=queryMaker.makeQueryFilter(StartingSubject,this.sf); // checks cache String FromCache=cache.get(StartingSubject, sparql); String xml; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-01-10 18:52:54
|
Revision: 364 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=364&view=rev Author: jenslehmann Date: 2008-01-10 10:52:03 -0800 (Thu, 10 Jan 2008) Log Message: ----------- - small fix for Tilos problem - removed two warnings Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/core/ReasoningService.java trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java trunk/src/dl-learner/org/dllearner/kb/sparql/ClassNode.java Modified: trunk/src/dl-learner/org/dllearner/core/ReasoningService.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/ReasoningService.java 2008-01-10 16:49:25 UTC (rev 363) +++ trunk/src/dl-learner/org/dllearner/core/ReasoningService.java 2008-01-10 18:52:03 UTC (rev 364) @@ -21,7 +21,6 @@ package org.dllearner.core; import java.io.File; -import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; Modified: trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java 2008-01-10 16:49:25 UTC (rev 363) +++ trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java 2008-01-10 18:52:03 UTC (rev 364) @@ -59,7 +59,7 @@ private List<Individual> individuals; private Config config; - ReasonerPanel(Config config) { + ReasonerPanel(final Config config) { super(new BorderLayout()); this.config = config; @@ -91,8 +91,8 @@ int[] selectedIndices = digList.getSelectedIndices(); for(int i : selectedIndices) exampleSet.add(individuals.get(i).toString()); - //config.setExampleSet(exampleSet); //error - //System.out.println("digList: " + config.getExampleSet() ); //error + config.setExampleSet(exampleSet); //error + System.out.println("digList: " + config.getExampleSet() ); //error } }); Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/ClassNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/ClassNode.java 2008-01-10 16:49:25 UTC (rev 363) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/ClassNode.java 2008-01-10 18:52:03 UTC (rev 364) @@ -104,7 +104,7 @@ return s; } - + @Override public int compareTo(Node n){ return super.compareTo(n); // This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ton...@us...> - 2008-01-10 16:49:34
|
Revision: 363 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=363&view=rev Author: tonytacker Date: 2008-01-10 08:49:25 -0800 (Thu, 10 Jan 2008) Log Message: ----------- lines 94 and 95 in ReasonerPanel.java produce errors Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/gui/KnowledgeSourcePanel.java trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java trunk/src/dl-learner/org/dllearner/gui/LearningProblemPanel.java trunk/src/dl-learner/org/dllearner/gui/OutputPanel.java trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java trunk/src/dl-learner/org/dllearner/gui/StartGUI.java Modified: trunk/src/dl-learner/org/dllearner/gui/KnowledgeSourcePanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/KnowledgeSourcePanel.java 2008-01-10 16:30:32 UTC (rev 362) +++ trunk/src/dl-learner/org/dllearner/gui/KnowledgeSourcePanel.java 2008-01-10 16:49:25 UTC (rev 363) @@ -49,13 +49,16 @@ private JFileChooser fc; private JButton openButton; private JTextField fileDisplay; - private String[] kbBoxItems = StartGUI.myconfig.getKBBoxItems(); + private String[] kbBoxItems = {"Pleae select a type", "KBFile", "OWLFile", "SparqleEndpoint"}; private JComboBox cb = new JComboBox(kbBoxItems); private JPanel openPanel = new JPanel(); - - KnowledgeSourcePanel() { + private Config config; + + KnowledgeSourcePanel(Config config) { super(new BorderLayout()); + this.config = config; + fc = new JFileChooser(new File("examples/")); openButton = new JButton("Open File"); openButton.addActionListener(this); @@ -80,12 +83,12 @@ if (e.getSource() == openButton) { int returnVal = fc.showOpenDialog(KnowledgeSourcePanel.this); if (returnVal == JFileChooser.APPROVE_OPTION) { - StartGUI.myconfig.setFile(fc.getSelectedFile()); //save variable - fileDisplay.setText(StartGUI.myconfig.getFile().toString()); + config.setFile(fc.getSelectedFile()); //save variable + fileDisplay.setText(config.getFile().toString()); //System.out.println("Init KnowledgeSource after loading file ... show over output"); //System.out.println("test: " + StartGUI.myconfig.getFile().toURI().toString()); - StartGUI.myconfig.getComponentManager().applyConfigEntry(StartGUI.myconfig.getKnowledgeSource(), "url", StartGUI.myconfig.getFile().toURI().toString()); - StartGUI.myconfig.getKnowledgeSource().init(); + config.getComponentManager().applyConfigEntry(config.getKnowledgeSource(), "url", config.getFile().toURI().toString()); + config.getKnowledgeSource().init(); } return; } @@ -107,7 +110,7 @@ openPanel.add(fileDisplay); openPanel.add(openButton); openPanel.repaint(); - StartGUI.myconfig.setKnowledgeSource(StartGUI.myconfig.getComponentManager().knowledgeSource(OWLFile.class)); + config.setKnowledgeSource(config.getComponentManager().knowledgeSource(OWLFile.class)); } // choose SPARCLE class if (cb.getSelectedItem().toString() == kbBoxItems[3]) { Modified: trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java 2008-01-10 16:30:32 UTC (rev 362) +++ trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java 2008-01-10 16:49:25 UTC (rev 363) @@ -44,9 +44,13 @@ private JPanel laPanel = new JPanel(); private JButton laButton; - LearningAlgorithmPanel() { + private Config config; + + LearningAlgorithmPanel(Config config) { super(new BorderLayout()); + this.config = config; + laButton = new JButton("Use ROLearner"); laButton.addActionListener(this); @@ -56,9 +60,9 @@ public void actionPerformed(ActionEvent e) { if (e.getSource() == laButton) { - if (StartGUI.myconfig.getStatus(6)) { - StartGUI.myconfig.setLearningAlgorithm(StartGUI.myconfig.getComponentManager().learningAlgorithm(ROLearner.class, StartGUI.myconfig.getLearningProblem(), StartGUI.myconfig.getReasoningService())); - StartGUI.myconfig.getLearningAlgorithm().init(); + if (config.getStatus(6)) { + config.setLearningAlgorithm(config.getComponentManager().learningAlgorithm(ROLearner.class, config.getLearningProblem(), config.getReasoningService())); + config.getLearningAlgorithm().init(); } } } Modified: trunk/src/dl-learner/org/dllearner/gui/LearningProblemPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/LearningProblemPanel.java 2008-01-10 16:30:32 UTC (rev 362) +++ trunk/src/dl-learner/org/dllearner/gui/LearningProblemPanel.java 2008-01-10 16:49:25 UTC (rev 363) @@ -42,9 +42,13 @@ private JPanel lpPanel = new JPanel(); private JButton lpButton; - LearningProblemPanel() { + private Config config; + + LearningProblemPanel(Config config) { super(new BorderLayout()); + this.config = config; + lpButton = new JButton("Use PosOnlyDefinitionLP"); lpButton.addActionListener(this); @@ -54,11 +58,11 @@ public void actionPerformed(ActionEvent e) { if (e.getSource() == lpButton) { - if (StartGUI.myconfig.getStatus(5)) { - System.out.println(StartGUI.myconfig.getExampleSet()); - StartGUI.myconfig.setLearningProblem(StartGUI.myconfig.getComponentManager().learningProblem(PosOnlyDefinitionLP.class, StartGUI.myconfig.getReasoningService())); - StartGUI.myconfig.getComponentManager().applyConfigEntry(StartGUI.myconfig.getLearningProblem(), "positiveExamples", StartGUI.myconfig.getExampleSet()); - StartGUI.myconfig.getLearningProblem().init(); + if (config.getStatus(5)) { + System.out.println(config.getExampleSet()); + config.setLearningProblem(config.getComponentManager().learningProblem(PosOnlyDefinitionLP.class, config.getReasoningService())); + config.getComponentManager().applyConfigEntry(config.getLearningProblem(), "positiveExamples", config.getExampleSet()); + config.getLearningProblem().init(); } } } Modified: trunk/src/dl-learner/org/dllearner/gui/OutputPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/OutputPanel.java 2008-01-10 16:30:32 UTC (rev 362) +++ trunk/src/dl-learner/org/dllearner/gui/OutputPanel.java 2008-01-10 16:49:25 UTC (rev 363) @@ -42,10 +42,13 @@ private JButton showButton; private JButton runButton; private JTextArea infoArea; + private Config config; - OutputPanel() { + OutputPanel(Config config) { super(new BorderLayout()); + this.config = config; + showButton = new JButton("Show Variables"); showButton.addActionListener(this); @@ -68,26 +71,26 @@ public void actionPerformed(ActionEvent e) { if (e.getSource() == showButton) { infoArea.setText(""); - if (StartGUI.myconfig.getStatus(2)) { // file is selected and exist? - infoArea.append("SourceClass: " + StartGUI.myconfig.getKnowledgeSource().toString() + "\n"); - infoArea.append("FILE: " + StartGUI.myconfig.getFile() + "\n"); + if (config.getStatus(2)) { // file is selected and exist? + infoArea.append("SourceClass: " + config.getKnowledgeSource().toString() + "\n"); + infoArea.append("FILE: " + config.getFile() + "\n"); } - if (StartGUI.myconfig.getStatus(3)) { // Reasoner is set - infoArea.append("Reasoner: " + StartGUI.myconfig.getReasoner() + "\n"); + if (config.getStatus(3)) { // Reasoner is set + infoArea.append("Reasoner: " + config.getReasoner() + "\n"); } - if (StartGUI.myconfig.getStatus(4)) { // ReasoningServic is set - infoArea.append("ReasoningService: " + StartGUI.myconfig.getReasoningService() + "\n"); + if (config.getStatus(4)) { // ReasoningServic is set + infoArea.append("ReasoningService: " + config.getReasoningService() + "\n"); } if (false) { for (int i = 0; i<8; i++) { // show status-vars - infoArea.append("i: " + StartGUI.myconfig.getStatus(i) + "\n"); + infoArea.append("i: " + config.getStatus(i) + "\n"); } } } if (e.getSource() == runButton) { - if (StartGUI.myconfig.getStatus(6)) { - StartGUI.myconfig.getLearningAlgorithm().start(); - Concept solution = StartGUI.myconfig.getLearningAlgorithm().getBestSolution(); + if (config.getStatus(6)) { + config.getLearningAlgorithm().start(); + Concept solution = config.getLearningAlgorithm().getBestSolution(); infoArea.setText(solution.toString()); } } Modified: trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java 2008-01-10 16:30:32 UTC (rev 362) +++ trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java 2008-01-10 16:49:25 UTC (rev 363) @@ -57,10 +57,13 @@ private JButton digButton; private JList digList = new JList(); private List<Individual> individuals; + private Config config; - ReasonerPanel() { + ReasonerPanel(Config config) { super(new BorderLayout()); + this.config = config; + digButton = new JButton("Use DIG by default"); digButton.addActionListener(this); @@ -76,7 +79,8 @@ centerPanel.add(listScroller); add(centerPanel, BorderLayout.CENTER); - + + digList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent evt) { if (evt.getValueIsAdjusting()) @@ -87,25 +91,41 @@ int[] selectedIndices = digList.getSelectedIndices(); for(int i : selectedIndices) exampleSet.add(individuals.get(i).toString()); - StartGUI.myconfig.setExampleSet(exampleSet); - System.out.println("digList: " + StartGUI.myconfig.getExampleSet() ); + //config.setExampleSet(exampleSet); //error + //System.out.println("digList: " + config.getExampleSet() ); //error } }); + } - + + public void valueChanged(ListSelectionEvent evt) { + System.out.println("s"); + if (evt.getValueIsAdjusting()) + return; + System.out.println("Selected from " + evt.getFirstIndex() + " to " + evt.getLastIndex()); + // detect which examples have been selected + Set<String> exampleSet = new HashSet<String>(); + int[] selectedIndices = digList.getSelectedIndices(); + for(int i : selectedIndices) + exampleSet.add(individuals.get(i).toString()); + //StartGUI.myconfig.setExampleSet(exampleSet); + //System.out.println("digList: " + config.getExampleSet() ); + } + + public void actionPerformed(ActionEvent e) { if (e.getSource() == digButton) { // set reasoner - StartGUI.myconfig.setReasoner(StartGUI.myconfig.getComponentManager().reasoner(DIGReasoner.class, StartGUI.myconfig.getKnowledgeSource())); + config.setReasoner(config.getComponentManager().reasoner(DIGReasoner.class, config.getKnowledgeSource())); //System.out.println(StartGUI.myconfig.getKnowledgeSource()); - StartGUI.myconfig.getReasoner().init(); + config.getReasoner().init(); //System.out.println(StartGUI.myconfig.getReasoner()); // set ReasoningService - StartGUI.myconfig.setReasoningService(StartGUI.myconfig.getComponentManager().reasoningService(StartGUI.myconfig.getReasoner())); + config.setReasoningService(config.getComponentManager().reasoningService(config.getReasoner())); // get list from ReasoningService - Set<Individual> individualsSet = StartGUI.myconfig.getReasoningService().getIndividuals(); + Set<Individual> individualsSet = config.getReasoningService().getIndividuals(); //System.out.println("IndividualsSet: " + individualsSet); individuals = new LinkedList<Individual>(individualsSet); //System.out.println("individuals: " + individuals); Modified: trunk/src/dl-learner/org/dllearner/gui/StartGUI.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/StartGUI.java 2008-01-10 16:30:32 UTC (rev 362) +++ trunk/src/dl-learner/org/dllearner/gui/StartGUI.java 2008-01-10 16:49:25 UTC (rev 363) @@ -35,7 +35,7 @@ protected static StartGUI myrun; - protected static Config myconfig = new Config(); + //protected static Config myconfig = new Config(); public JTabbedPane tabPane = new JTabbedPane(); @@ -44,17 +44,18 @@ private JPanel tab3 = new JPanel(); private JPanel tab4 = new JPanel(); private JPanel tab5 = new JPanel(); - + public StartGUI() { + Config config = new Config(); this.setTitle("DL-Learner GUI"); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setLocationByPlatform(true); this.setSize(640, 480); - tab1.add(new KnowledgeSourcePanel()); - tab2.add(new ReasonerPanel()); - tab3.add(new LearningProblemPanel()); - tab4.add(new LearningAlgorithmPanel()); - tab5.add(new OutputPanel()); + tab1.add(new KnowledgeSourcePanel(config)); + tab2.add(new ReasonerPanel(config)); + tab3.add(new LearningProblemPanel(config)); + tab4.add(new LearningAlgorithmPanel(config)); + tab5.add(new OutputPanel(config)); tabPane.addTab("Knowledge Source", tab1); tabPane.addTab("Reasoner", tab2); tabPane.addTab("Learning Problem", tab3); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-01-10 16:34:02
|
Revision: 362 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=362&view=rev Author: jenslehmann Date: 2008-01-10 08:30:32 -0800 (Thu, 10 Jan 2008) Log Message: ----------- - enabled lazy ReasoningService initialisation - fixed some learning bugs in DBpedia Navigator (learning still not working) Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/ajaxfunctions.php trunk/src/dl-learner/org/dllearner/core/ReasoningService.java trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java trunk/src/php-client/testnew.php Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-01-10 09:12:48 UTC (rev 361) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-01-10 16:30:32 UTC (rev 362) @@ -1,11 +1,23 @@ <?php +/** + * Encapsulates all functions, which require communication with DL-Learner. + * + * @author Jens Lehmann + * @author Sebastian Knappe + */ class DLLearnerConnection { private $DBPediaUrl; private $DLLearnerUri; + + // private $client; + + // ID given to this client by the web service private $id; + + // ID of the DBpedia knowledge source private $ksID; function DLLearnerConnection($DBPediaUrl,$DLLearnerUri,$id=0,$ksID=0) @@ -33,9 +45,9 @@ function getConceptFromExamples($ttl,$posExamples,$negExamples) { - $this->client->applyConfigEntryInt($this->id, $this->ksID, "numberOfRecursions", 2); + $this->client->applyConfigEntryInt($this->id, $this->ksID, "recursionDepth", 2); $this->client->applyConfigEntryStringArray($this->id, $this->ksID, "instances", array_merge($posExamples,$negExamples)); - $this->client->applyConfigEntryInt($this->id, $this->ksID, "filterMode", 0); + // $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()); @@ -43,9 +55,13 @@ $this->client->applyConfigEntryBoolean($this->id, $this->ksID, "dumpToFile", true); $this->client->setReasoner($this->id, "dig"); - $this->client->setLearningProblem($this->id, "posNegDefinition"); + if(!isset($negExamples)) + $this->client->setLearningProblem($this->id, "posOnlyDefinition"); + else + $this->client->setLearningProblem($this->id, "posNegDefinition"); $this->client->setPositiveExamples($this->id, $posExamples); - $this->client->setNegativeExamples($this->id, $negExamples); + if(isset($negExamples)) + $this->client->setNegativeExamples($this->id, $negExamples); $this->client->setLearningAlgorithm($this->id, "refinement"); $start = microtime(true); Modified: trunk/src/dbpedia-navigator/ajaxfunctions.php =================================================================== --- trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-01-10 09:12:48 UTC (rev 361) +++ trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-01-10 16:30:32 UTC (rev 362) @@ -181,7 +181,7 @@ function learnConcept() { - if (isset($_SESSION['positive'])&&isset($_SESSION['negative'])) + if (isset($_SESSION['positive'])) { require_once("Settings.php"); require_once("DLLearnerConnection.php"); @@ -192,7 +192,7 @@ $_SESSION['lastLearnedConcept']=$concept; if (strlen(substr (strrchr ($concept, "/"), 1))>0) $concept=urldecode(substr (strrchr ($concept, "/"), 1)); } - else $concept="You must choose at least one<br/> positive and one negative example."; + else $concept="You must choose at least one<br/> positive example."; $objResponse = new xajaxResponse(); $objResponse->assign("conceptcontent", "innerHTML", $concept); Modified: trunk/src/dl-learner/org/dllearner/core/ReasoningService.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/ReasoningService.java 2008-01-10 09:12:48 UTC (rev 361) +++ trunk/src/dl-learner/org/dllearner/core/ReasoningService.java 2008-01-10 16:30:32 UTC (rev 362) @@ -92,9 +92,12 @@ public ReasoningService(ReasonerComponent reasoner) { this.reasoner = reasoner; - // list view - atomicConceptsList = new LinkedList<AtomicConcept>(getAtomicConcepts()); - atomicRolesList = new LinkedList<AtomicRole>(getAtomicRoles()); + // list view: the following two lines are commented out, because otherwise the ReasonerComponent + // already has to be initialised when a ReasoningService instance is created; this is problematic + // e.g. for the web service interface, which does not expose the ReasoningService + // (because it is not a component itself) + // atomicConceptsList = new LinkedList<AtomicConcept>(getAtomicConcepts()); + // atomicRolesList = new LinkedList<AtomicRole>(getAtomicRoles()); resetStatistics(); } @@ -428,10 +431,12 @@ } public List<AtomicConcept> getAtomicConceptsList() { + // not working, see message in constructor return atomicConceptsList; } public List<AtomicRole> getAtomicRolesList() { + // not working, see message in constructor return atomicRolesList; } Modified: trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2008-01-10 09:12:48 UTC (rev 361) +++ trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2008-01-10 16:30:32 UTC (rev 362) @@ -239,7 +239,7 @@ * @param id Session ID. */ @WebMethod - public void init(int id) throws ClientNotKnownException { + public void initAll(int id) throws ClientNotKnownException { ClientState state = getState(id); for(KnowledgeSource ks : state.getKnowledgeSources()) ks.init(); @@ -249,6 +249,20 @@ } /** + * Initialise the specified component. + * @param id Session-ID. + * @param componentID Component-ID. + * @throws ClientNotKnownException Thrown if the client ID is nor registered. + * @throws UnknownComponentException Thrown if the component is unknown. + */ + @WebMethod + public void init(int id, int componentID) throws ClientNotKnownException, UnknownComponentException { + ClientState state = getState(id); + Component component = state.getComponent(componentID); + component.init(); + } + + /** * Starts the learning algorithm and returns the best concept found. This * method will block until learning is completed. * Modified: trunk/src/php-client/testnew.php =================================================================== --- trunk/src/php-client/testnew.php 2008-01-10 09:12:48 UTC (rev 361) +++ trunk/src/php-client/testnew.php 2008-01-10 16:30:32 UTC (rev 362) @@ -6,6 +6,7 @@ $wsdluri="http://localhost:8181/services?wsdl"; $ontology="file:/home/jl/promotion/dl-learner-svn/trunk/examples/father.owl"; +// $ontology="file:/home/jl/programmierung/eclipse_workspace/DL-Learner-SVN/examples/father.owl"; $posExamples = array('http://example.com/father#stefan', 'http://example.com/father#markus', @@ -53,7 +54,7 @@ $start = microtime(true); -$client->init($id); +$client->initAll($id); $learn_start = microtime(true); $init = $learn_start - $start; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ku...@us...> - 2008-01-10 09:12:53
|
Revision: 361 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=361&view=rev Author: kurzum Date: 2008-01-10 01:12:48 -0800 (Thu, 10 Jan 2008) Log Message: ----------- ESWC examples after sections Added Paths: ----------- trunk/examples/ESWC_final/ trunk/examples/ESWC_final/difference/ trunk/examples/ESWC_final/difference/DifferenceDBPediaYAGO_angela_vs_hillary.conf trunk/examples/ESWC_final/difference/DifferenceDBPediaYAGO_angela_vs_hillary_ignoredConcepts.conf trunk/examples/ESWC_final/difference/DifferenceDBPediaYAGO_hillary_vs_angela.conf trunk/examples/ESWC_final/difference/DifferenceDBPediaYAGO_hillary_vs_angela_ignoredConcepts.conf trunk/examples/ESWC_final/hierarchy/ trunk/examples/ESWC_final/hierarchy/Hierarchy0DBPediaYAGOChanBrit_monarch.conf trunk/examples/ESWC_final/hierarchy/Hierarchy1DBPediaYAGOChanBrit_pred_Knight.conf trunk/examples/ESWC_final/navigation/ trunk/examples/ESWC_final/navigation/Navigation0DBPediaYAGOAristotle.conf trunk/examples/ESWC_final/navigation/Navigation1DBPediaYAGOAristotle.conf trunk/examples/ESWC_final/navigation/Navigation2DBPediaYAGOAristotle.conf trunk/examples/ESWC_final/roles/ trunk/examples/ESWC_final/roles/Roles_fixed_DBPedia_monarch_domain_yago.conf trunk/examples/ESWC_final/roles/Roles_fixed_DBPedia_monarch_range_yago.conf trunk/examples/ESWC_final/roles/Roles_fixed_DBPedia_placeOfBirth_domain_yago.conf trunk/examples/ESWC_final/roles/Roles_fixed_DBPedia_placeOfBirth_range_yago.conf trunk/examples/ESWC_final/roles/Roles_generic_DBpedia_monarch_domain_yago.conf trunk/examples/ESWC_final/roles/Roles_generic_DBpedia_monarch_range_yago.conf trunk/examples/ESWC_final/roles/Roles_generic_DBpedia_placeOfBirth_domain_yago.conf trunk/examples/ESWC_final/roles/Roles_generic_DBpedia_placeOfBirth_range_yago.conf Added: trunk/examples/ESWC_final/difference/DifferenceDBPediaYAGO_angela_vs_hillary.conf =================================================================== --- trunk/examples/ESWC_final/difference/DifferenceDBPediaYAGO_angela_vs_hillary.conf (rev 0) +++ trunk/examples/ESWC_final/difference/DifferenceDBPediaYAGO_angela_vs_hillary.conf 2008-01-10 09:12:48 UTC (rev 361) @@ -0,0 +1,42 @@ +/** + + * Solutions: +http://dbpedia.org/class/yago/Communicator109610660 (length 1, depth 1) + http://dbpedia.org/class/yago/Scientist110560637 (length 1, depth 1) + + + Direct classes from DBPedia: + dbpedia:class/yago/Person100007846 [http] + dbpedia:class/yago/Head110162991 [http] + dbpedia:class/yago/Woman110787470 [http] + dbpedia:class/yago/Leader109623038 [http] + dbpedia:class/yago/Scientist110560637 [http] + dbpedia:class/yago/Chancellor109906986 [http] +dbpedia:class/yago/Politician110451263 [http] + +*/ + + + +// recursion depth of extraction algorithm +sparql2.recursionDepth = 1; + + +//predefined filter (1 = YAGO based learning) +// 2 = SKOS, more Options are needed then though. replacePredicate, breakSuperClassRetrievalAfter +sparql2.predefinedFilter = 1; + +// use DBpedia endpoint +import("http://dbpedia.openlinksw.com:8890/sparql","SPARQL2"); + +// the set of objects as starting point for fragment selection +// (should be identical to the set of examples) +sparql2.instances = { + "http://dbpedia.org/resource/Angela_Merkel", + "http://dbpedia.org/resource/Hillary_Rodham_Clinton" +}; + + +/** examples **/ ++"http://dbpedia.org/resource/Angela_Merkel" +-"http://dbpedia.org/resource/Hillary_Rodham_Clinton" Added: trunk/examples/ESWC_final/difference/DifferenceDBPediaYAGO_angela_vs_hillary_ignoredConcepts.conf =================================================================== --- trunk/examples/ESWC_final/difference/DifferenceDBPediaYAGO_angela_vs_hillary_ignoredConcepts.conf (rev 0) +++ trunk/examples/ESWC_final/difference/DifferenceDBPediaYAGO_angela_vs_hillary_ignoredConcepts.conf 2008-01-10 09:12:48 UTC (rev 361) @@ -0,0 +1,58 @@ +/** + + * Solutions: +http://dbpedia.org/class/yago/Communicator109610660 (length 1, depth 1) + http://dbpedia.org/class/yago/Scientist110560637 (length 1, depth 1) + plus all ignored Concepts + + EXISTS http://dbpedia.org/property/birthDate.TOP (length 3, depth 2) + EXISTS http://dbpedia.org/property/birthPlace.TOP (length 3, depth 2) + EXISTS http://dbpedia.org/property/languagesspoken.TOP (length 3, depth 2) + EXISTS http://dbpedia.org/property/occupation.TOP (length 3, depth 2) + EXISTS http://dbpedia.org/property/order.TOP (length 3, depth 2) + EXISTS http://dbpedia.org/property/predecessor.TOP (length 3, depth 2) + EXISTS http://dbpedia.org/property/termStart.TOP (length 3, depth 2) + + Direct classes from DBPedia: + dbpedia:class/yago/Person100007846 [http] + dbpedia:class/yago/Head110162991 [http] + dbpedia:class/yago/Woman110787470 [http] + dbpedia:class/yago/Leader109623038 [http] + dbpedia:class/yago/Scientist110560637 [http] + dbpedia:class/yago/Chancellor109906986 [http] +dbpedia:class/yago/Politician110451263 [http] + +*/ + refinement.ignoredConcepts = { + "http://dbpedia.org/class/yago/Communicator109610660", + "http://dbpedia.org/class/yago/Negotiator110351874", + "http://dbpedia.org/class/yago/Representative110522035", + "http://dbpedia.org/class/yago/Scientist110560637", + "http://dbpedia.org/class/yago/HeadOfState110164747", + "http://dbpedia.org/class/yago/Chancellor109906986", + "http://dbpedia.org/class/yago/Head110162991" + }; + + +// recursion depth of extraction algorithm +sparql2.recursionDepth = 1; + + +//predefined filter (1 = YAGO based learning) +// 2 = SKOS, more Options are needed then though. replacePredicate, breakSuperClassRetrievalAfter +sparql2.predefinedFilter = 1; + +// use DBpedia endpoint +import("http://dbpedia.openlinksw.com:8890/sparql","SPARQL2"); + +// the set of objects as starting point for fragment selection +// (should be identical to the set of examples) +sparql2.instances = { + "http://dbpedia.org/resource/Angela_Merkel", + "http://dbpedia.org/resource/Hillary_Rodham_Clinton" +}; + + +/** examples **/ ++"http://dbpedia.org/resource/Angela_Merkel" +-"http://dbpedia.org/resource/Hillary_Rodham_Clinton" Added: trunk/examples/ESWC_final/difference/DifferenceDBPediaYAGO_hillary_vs_angela.conf =================================================================== --- trunk/examples/ESWC_final/difference/DifferenceDBPediaYAGO_hillary_vs_angela.conf (rev 0) +++ trunk/examples/ESWC_final/difference/DifferenceDBPediaYAGO_hillary_vs_angela.conf 2008-01-10 09:12:48 UTC (rev 361) @@ -0,0 +1,31 @@ +/** + + * Solutions: +http://dbpedia.org/class/yago/Achiever109762821 (length 1, depth 1) + http://dbpedia.org/class/yago/Intellectual109621545 (length 1, depth 1) + */ + + + +// recursion depth of extraction algorithm +sparql2.recursionDepth = 1; + +//predefined filter (1 = YAGO based learning) +// 2 = SKOS, more Options are needed then though. replacePredicate, breakSuperClassRetrievalAfter +sparql2.predefinedFilter = 1; + + +// use DBpedia endpoint +import("http://dbpedia.openlinksw.com:8890/sparql","SPARQL2"); + +// the set of objects as starting point for fragment selection +// (should be identical to the set of examples) +sparql2.instances = { + "http://dbpedia.org/resource/Angela_Merkel", + "http://dbpedia.org/resource/Hillary_Rodham_Clinton" +}; + + +/** examples **/ ++"http://dbpedia.org/resource/Hillary_Rodham_Clinton" +-"http://dbpedia.org/resource/Angela_Merkel" Added: trunk/examples/ESWC_final/difference/DifferenceDBPediaYAGO_hillary_vs_angela_ignoredConcepts.conf =================================================================== --- trunk/examples/ESWC_final/difference/DifferenceDBPediaYAGO_hillary_vs_angela_ignoredConcepts.conf (rev 0) +++ trunk/examples/ESWC_final/difference/DifferenceDBPediaYAGO_hillary_vs_angela_ignoredConcepts.conf 2008-01-10 09:12:48 UTC (rev 361) @@ -0,0 +1,70 @@ +/** + + * Solutions: +http://dbpedia.org/class/yago/Achiever109762821 (length 1, depth 1) + http://dbpedia.org/class/yago/Intellectual109621545 (length 1, depth 1) +plus all ignored Concepts + + EXISTS http://dbpedia.org/property/almaMater.TOP (length 3, depth 2) + EXISTS http://dbpedia.org/property/alongside.TOP (length 3, depth 2) + EXISTS http://dbpedia.org/property/before.TOP (length 3, depth 2) + EXISTS http://dbpedia.org/property/candidate.TOP (length 3, depth 2) + EXISTS http://dbpedia.org/property/children.TOP (length 3, depth 2) + EXISTS http://dbpedia.org/property/dateOfBirth.TOP (length 3, depth 2) + EXISTS http://dbpedia.org/property/height.TOP (length 3, depth 2) + EXISTS http://dbpedia.org/property/lawSchool.TOP (length 3, depth 2) + EXISTS http://dbpedia.org/property/office.TOP (length 3, depth 2) + EXISTS http://dbpedia.org/property/preceded.TOP (length 3, depth 2) + EXISTS http://dbpedia.org/property/profession.TOP (length 3, depth 2) + EXISTS http://dbpedia.org/property/state.TOP (length 3, depth 2) + EXISTS http://dbpedia.org/property/succeeded.TOP (length 3, depth 2) + + Direct classes from DBPedia: + dbpedia:class/yago/Person100007846 [http] + dbpedia:class/yago/Entity100001740 [http] + dbpedia:class/yago/Academician109759069 [http] + dbpedia:class/yago/Lawyer110249950 [http] + dbpedia:class/yago/Alumnus109786338 [http] + dbpedia:class/yago/Woman110787470 [http] + dbpedia:class/yago/FirstLady110092880 [http] + dbpedia:class/yago/Politician110451263 [http] + dbpedia:class/yago/Senator110578471 [http] + + */ +refinement.ignoredConcepts = { +"http://dbpedia.org/class/yago/Intellectual109621545", +"http://dbpedia.org/class/yago/Achiever109762821", +"http://dbpedia.org/class/yago/FirstLady110092880", +"http://dbpedia.org/class/yago/Scholar110557854", +"http://dbpedia.org/class/yago/Alumnus109786338", +"http://dbpedia.org/class/yago/Lawgiver110249270", +"http://dbpedia.org/class/yago/Legislator110253995", +"http://dbpedia.org/class/yago/Senator110578471", +"http://dbpedia.org/class/yago/Professional110480253", +"http://dbpedia.org/class/yago/Educator110045713", +"http://dbpedia.org/class/yago/Lawyer110249950", +"http://dbpedia.org/class/yago/Academician109759069"}; + + +// recursion depth of extraction algorithm +sparql2.recursionDepth = 1; + +//predefined filter (1 = YAGO based learning) +// 2 = SKOS, more Options are needed then though. replacePredicate, breakSuperClassRetrievalAfter +sparql2.predefinedFilter = 1; + + +// use DBpedia endpoint +import("http://dbpedia.openlinksw.com:8890/sparql","SPARQL2"); + +// the set of objects as starting point for fragment selection +// (should be identical to the set of examples) +sparql2.instances = { + "http://dbpedia.org/resource/Angela_Merkel", + "http://dbpedia.org/resource/Hillary_Rodham_Clinton" +}; + + +/** examples **/ ++"http://dbpedia.org/resource/Hillary_Rodham_Clinton" +-"http://dbpedia.org/resource/Angela_Merkel" Added: trunk/examples/ESWC_final/hierarchy/Hierarchy0DBPediaYAGOChanBrit_monarch.conf =================================================================== --- trunk/examples/ESWC_final/hierarchy/Hierarchy0DBPediaYAGOChanBrit_monarch.conf (rev 0) +++ trunk/examples/ESWC_final/hierarchy/Hierarchy0DBPediaYAGOChanBrit_monarch.conf 2008-01-10 09:12:48 UTC (rev 361) @@ -0,0 +1,65 @@ + /* + + solutions: + EXISTS http://dbpedia.org/property/monarch.TOP (length 3, depth 2) + horizontal expansion: 1 to 3 + size of candidate set: 26 + properness tests (reasoner/short concept/too weak list): 101/0/0 + concept tests (reasoner/too weak list/overly general list/redundant concepts): 95/0/6/0 + Algorithm terminated succesfully. + number of instance checks: 722 (114 multiple) + instance check reasoning time: 1s 551ms ( 2ms per instance check) + subsumption hierarchy queries: 30 + (complex) subsumption checks: 101 (14 multiple) + subsumption reasoning time: 107ms ( 1ms per subsumption check) + overall reasoning time: 1s 658ms (97,394% of overall runtime) + overall algorithm runtime: 1s 702ms + + */ + +// SPARQL options + +import("http://dbpedia.openlinksw.com:8890/sparql","SPARQL2"); + + +refinement.useAllConstructor = false; +//refinement.useExistsConstructor = true; +refinement.useNegation = false; + +// SPARQL options +//necessary: +sparql2.recursionDepth = 1; + + +//predefined filter (1 = YAGO based learning) +// 2 = SKOS, more Options are needed then though. replacePredicate, breakSuperClassRetrievalAfter +sparql2.predefinedFilter = 1; + + +import("http://dbpedia.openlinksw.com:8890/sparql","SPARQL2"); + +sparql2.instances={"http://dbpedia.org/resource/Tony_Blair" +,"http://dbpedia.org/resource/Margaret_Thatcher" +,"http://dbpedia.org/resource/John_Major" + +,"http://dbpedia.org/resource/James_Callaghan" + +,"http://dbpedia.org/resource/Gerhard_Schr%C3%B6der" +,"http://dbpedia.org/resource/Helmut_Kohl" +,"http://dbpedia.org/resource/Jacques_Chirac" + +}; + + + + +/** examples **/ ++"http://dbpedia.org/resource/Tony_Blair" ++"http://dbpedia.org/resource/Margaret_Thatcher" ++"http://dbpedia.org/resource/John_Major" + ++"http://dbpedia.org/resource/James_Callaghan" + +-"http://dbpedia.org/resource/Gerhard_Schr%C3%B6der" +-"http://dbpedia.org/resource/Helmut_Kohl" +-"http://dbpedia.org/resource/Jacques_Chirac" Added: trunk/examples/ESWC_final/hierarchy/Hierarchy1DBPediaYAGOChanBrit_pred_Knight.conf =================================================================== --- trunk/examples/ESWC_final/hierarchy/Hierarchy1DBPediaYAGOChanBrit_pred_Knight.conf (rev 0) +++ trunk/examples/ESWC_final/hierarchy/Hierarchy1DBPediaYAGOChanBrit_pred_Knight.conf 2008-01-10 09:12:48 UTC (rev 361) @@ -0,0 +1,62 @@ + /* + + + + + */ + +// SPARQL options + +import("http://dbpedia.openlinksw.com:8890/sparql","SPARQL2"); + +refinement.heuristic = flexible; + +refinement.useAllConstructor = false; +//refinement.useExistsConstructor = true; +refinement.useNegation = false; + +// SPARQL options +//necessary: +sparql2.recursionDepth = 1; + + +//predefined filter (1 = YAGO based learning) +// 2 = SKOS, more Options are needed then though. replacePredicate, breakSuperClassRetrievalAfter +sparql2.predefinedFilter = 1; + + +import("http://dbpedia.openlinksw.com:8890/sparql","SPARQL2"); + +sparql2.instances = { +"http://dbpedia.org/resource/Tony_Blair" +,"http://dbpedia.org/resource/Margaret_Thatcher" +,"http://dbpedia.org/resource/John_Major" + + +,"http://dbpedia.org/resource/Harold_Macmillan" +,"http://dbpedia.org/resource/Alec_Douglas-Home" +,"http://dbpedia.org/resource/Liaquat_Ali_Khan" + +,"http://dbpedia.org/resource/Gerhard_Schr%C3%B6der" +,"http://dbpedia.org/resource/Helmut_Kohl" +,"http://dbpedia.org/resource/Jacques_Chirac" + +}; + + + +/** examples **/ ++"http://dbpedia.org/resource/Tony_Blair" ++"http://dbpedia.org/resource/Margaret_Thatcher" ++"http://dbpedia.org/resource/John_Major" + + ++"http://dbpedia.org/resource/Harold_Macmillan" ++"http://dbpedia.org/resource/Alec_Douglas-Home" +-"http://dbpedia.org/resource/Liaquat_Ali_Khan" + +-"http://dbpedia.org/resource/Gerhard_Schr%C3%B6der" +-"http://dbpedia.org/resource/Helmut_Kohl" +-"http://dbpedia.org/resource/Jacques_Chirac" + + Added: trunk/examples/ESWC_final/navigation/Navigation0DBPediaYAGOAristotle.conf =================================================================== --- trunk/examples/ESWC_final/navigation/Navigation0DBPediaYAGOAristotle.conf (rev 0) +++ trunk/examples/ESWC_final/navigation/Navigation0DBPediaYAGOAristotle.conf 2008-01-10 09:12:48 UTC (rev 361) @@ -0,0 +1,51 @@ +/** + * Some people from Greece. + * +solutions: + http://dbpedia.org/class/yago/Mathematician110301261 (length 1, depth 1) +horizontal expansion: 0 to 1 +size of candidate set: 12 +properness tests (reasoner/short concept/too weak list): 20/0/0 +concept tests (reasoner/too weak list/overly general list/redundant concepts): 20/0/0/0 +Algorithm terminated succesfully. +number of instance checks: 82 (31 multiple) +instance check reasoning time: 132ms ( 1ms per instance check) +subsumption hierarchy queries: 11 +(complex) subsumption checks: 20 (9 multiple) +subsumption reasoning time: 33ms ( 1ms per subsumption check) +overall reasoning time: 165ms (88,67% of overall runtime) +overall algorithm runtime: 186ms + + */ + +// SPARQL options +sparql2.recursionDepth = 1; + +//predefined filter (1 = YAGO based learning) +// 2 = SKOS, more Options are needed then though. replacePredicate, breakSuperClassRetrievalAfter +sparql2.predefinedFilter = 1; + + +import("http://dbpedia.openlinksw.com:8890/sparql","SPARQL2"); + +sparql2.instances = { + "http://dbpedia.org/resource/Pythagoras", + "http://dbpedia.org/resource/Philolaus", + "http://dbpedia.org/resource/Archytas", + + "http://dbpedia.org/resource/Zeno_of_Elea", + "http://dbpedia.org/resource/Plato", + "http://dbpedia.org/resource/Socrates" + + +}; + ++"http://dbpedia.org/resource/Pythagoras" ++"http://dbpedia.org/resource/Philolaus" ++"http://dbpedia.org/resource/Archytas" + + +-"http://dbpedia.org/resource/Zeno_of_Elea" +-"http://dbpedia.org/resource/Plato" +-"http://dbpedia.org/resource/Socrates" + Added: trunk/examples/ESWC_final/navigation/Navigation1DBPediaYAGOAristotle.conf =================================================================== --- trunk/examples/ESWC_final/navigation/Navigation1DBPediaYAGOAristotle.conf (rev 0) +++ trunk/examples/ESWC_final/navigation/Navigation1DBPediaYAGOAristotle.conf 2008-01-10 09:12:48 UTC (rev 361) @@ -0,0 +1,55 @@ +/** + * Some people from Greece. + * +solutions: + (http://dbpedia.org/class/yago/Theorist110706812 OR (http://dbpedia.org/class/yago/Mathematician110301261 AND http://dbpedia.org/class/yago/Physicist110428004)) (length 5, depth 3) +horizontal expansion: 3 to 5 +size of candidate set: 1648 +properness tests (reasoner/short concept/too weak list): 9059/1/884 +concept tests (reasoner/too weak list/overly general list/redundant concepts): 2240/884/1286/3926 +Algorithm terminated succesfully. +number of instance checks: 8164 (2601 multiple) +instance check reasoning time: 15s 461ms ( 1ms per instance check) +subsumption hierarchy queries: 8776 +(complex) subsumption checks: 9059 (3132 multiple) +subsumption reasoning time: 13s 388ms ( 1ms per subsumption check) +overall reasoning time: 28s 850ms (94,717% of overall runtime) +overall algorithm runtime: 30s 459ms + + */ + +// SPARQL options +sparql2.recursionDepth = 1; + +//predefined filter (1 = YAGO based learning) +// 2 = SKOS, more Options are needed then though. replacePredicate, breakSuperClassRetrievalAfter +sparql2.predefinedFilter = 1; + + +import("http://dbpedia.openlinksw.com:8890/sparql","SPARQL2"); + +sparql2.instances = { + "http://dbpedia.org/resource/Pythagoras", + "http://dbpedia.org/resource/Philolaus", + "http://dbpedia.org/resource/Archytas", + + + "http://dbpedia.org/resource/Socrates", + "http://dbpedia.org/resource/Plato", + "http://dbpedia.org/resource/Zeno_of_Elea", + "http://dbpedia.org/resource/Democritus" + +}; + ++"http://dbpedia.org/resource/Pythagoras" ++"http://dbpedia.org/resource/Philolaus" ++"http://dbpedia.org/resource/Archytas" + + +-"http://dbpedia.org/resource/Socrates" +-"http://dbpedia.org/resource/Plato" +-"http://dbpedia.org/resource/Zeno_of_Elea" +-"http://dbpedia.org/resource/Democritus" + + + Added: trunk/examples/ESWC_final/navigation/Navigation2DBPediaYAGOAristotle.conf =================================================================== --- trunk/examples/ESWC_final/navigation/Navigation2DBPediaYAGOAristotle.conf (rev 0) +++ trunk/examples/ESWC_final/navigation/Navigation2DBPediaYAGOAristotle.conf 2008-01-10 09:12:48 UTC (rev 361) @@ -0,0 +1,55 @@ +/** + * Some people from Greece. + * + * Possible Solution: + * (http://dbpedia.org/class/yago/Theorist110706812 OR (http://dbpedia.org/class/yago/Mathematician110301261 AND http://dbpedia.org/class/yago/Physicist110428004)) + * + */ + +// SPARQL options +sparql2.recursionDepth = 1; + +//predefined filter (1 = YAGO based learning) +// 2 = SKOS, more Options are needed then though. replacePredicate, breakSuperClassRetrievalAfter +sparql2.predefinedFilter = 1; + + +import("http://dbpedia.openlinksw.com:8890/sparql","SPARQL2"); + +sparql2.instances = { + + "http://dbpedia.org/resource/Archytas", + "http://dbpedia.org/resource/Pythagoras", + "http://dbpedia.org/resource/Philolaus", + + "http://dbpedia.org/resource/Democritus", + "http://dbpedia.org/resource/Zeno_of_Elea", + "http://dbpedia.org/resource/Plato", + + "http://dbpedia.org/resource/Socrates", + "http://dbpedia.org/resource/Aristoxenus" +}; + ++"http://dbpedia.org/resource/Archytas" +/*//Archytas (Greek: ????ta?; 428 BC +347 BC) was an Ancient Greek philosopher, +mathematician, astronomer, statesman, and strategist.*/ + ++"http://dbpedia.org/resource/Pythagoras" +/*//Pythagoras of Samos (Greek: ???a???a?; +between 580 and 572 BC between 500 and 490 BC) +was an Ionian (Greek) philosopher[1] and founder +of the religious movement called Pythagoreanism. +He is often revered as a great mathematician, mystic and scientist;*/ ++"http://dbpedia.org/resource/Philolaus" +/*//Philolaus (ca. 480 BC ca. 385 BC, Greek: +F????a??) was a Greek Pythagorean and Presocratic.*/ + + +-"http://dbpedia.org/resource/Democritus" +-"http://dbpedia.org/resource/Zeno_of_Elea" +-"http://dbpedia.org/resource/Plato" + +-"http://dbpedia.org/resource/Socrates" +-"http://dbpedia.org/resource/Aristoxenus" + Added: trunk/examples/ESWC_final/roles/Roles_fixed_DBPedia_monarch_domain_yago.conf =================================================================== --- trunk/examples/ESWC_final/roles/Roles_fixed_DBPedia_monarch_domain_yago.conf (rev 0) +++ trunk/examples/ESWC_final/roles/Roles_fixed_DBPedia_monarch_domain_yago.conf 2008-01-10 09:12:48 UTC (rev 361) @@ -0,0 +1,64 @@ +/** + * + * solutions: + * + */ + +// refinement.heuristic=flexible; + +refinement.useAllConstructor = false; +refinement.useExistsConstructor = false; +refinement.useNegation = false; + +sparql2.recursionDepth = 1; + +// 1= yago +sparql2.predefinedFilter=1; + +// use DBpedia endpoint +import("http://dbpedia.openlinksw.com:8890/sparql","SPARQL2"); + + +//***********ROLE SPECIFIC + +/*refinement.ignoredConcepts = { +"http://dbpedia.org/class/yago/Entity100001740", +"http://dbpedia.org/class/yago/PhysicalEntity100001930", +"http://dbpedia.org/class/yago/Object100002684", +"http://dbpedia.org/class/yago/CausalAgent100007347", +"http://dbpedia.org/class/yago/Whole100003553", +"http://dbpedia.org/class/yago/LivingThing100004258", +"http://dbpedia.org/class/yago/Organism100004475" +};*/ +//sparql2.numberOfInstancesUsedForRoleLearning=5; +//not needed for roles +sparql2.instances = { +"http://dbpedia.org/resource/Khawaja_Nazimuddin" +,"http://dbpedia.org/resource/Harold_Macmillan" +,"http://dbpedia.org/resource/Maati_Bouabid" +,"http://dbpedia.org/resource/Charles_Watson-Wentworth%2C_2nd_Marquess_of_Rockingham" +,"http://dbpedia.org/resource/Helen_Clark" +,"http://dbpedia.org/resource/Oscar_I_of_Sweden" +,"http://dbpedia.org/resource/George_VI_of_the_United_Kingdom" +,"http://dbpedia.org/resource/Edward_VII_of_the_United_Kingdom" +,"http://dbpedia.org/resource/Victoria_of_the_United_Kingdom" +,"http://dbpedia.org/resource/Abdullah_II_of_Jordan" + +}; + +//sparql2.role = "http://dbpedia.org/property/monarch"; +//sparql2.learnDomain=true; +//sparql2.learnRange=false; + + +/** examples */ ++"http://dbpedia.org/resource/Khawaja_Nazimuddin" ++"http://dbpedia.org/resource/Harold_Macmillan" ++"http://dbpedia.org/resource/Maati_Bouabid" ++"http://dbpedia.org/resource/Charles_Watson-Wentworth%2C_2nd_Marquess_of_Rockingham" ++"http://dbpedia.org/resource/Helen_Clark" +-"http://dbpedia.org/resource/Oscar_I_of_Sweden" +-"http://dbpedia.org/resource/George_VI_of_the_United_Kingdom" +-"http://dbpedia.org/resource/Edward_VII_of_the_United_Kingdom" +-"http://dbpedia.org/resource/Victoria_of_the_United_Kingdom" +-"http://dbpedia.org/resource/Abdullah_II_of_Jordan" Added: trunk/examples/ESWC_final/roles/Roles_fixed_DBPedia_monarch_range_yago.conf =================================================================== --- trunk/examples/ESWC_final/roles/Roles_fixed_DBPedia_monarch_range_yago.conf (rev 0) +++ trunk/examples/ESWC_final/roles/Roles_fixed_DBPedia_monarch_range_yago.conf 2008-01-10 09:12:48 UTC (rev 361) @@ -0,0 +1,61 @@ +/** + * + * solutions: + * + */ + //refinement.heuristic=flexible; + +refinement.useAllConstructor = false; +refinement.useExistsConstructor = false; +refinement.useNegation = false; + + +// recursion depth of extraction algorithm +sparql2.recursionDepth = 1; + + +//1=yago +sparql2.predefinedFilter=1; + +// use DBpedia endpoint +import("http://dbpedia.openlinksw.com:8890/sparql","SPARQL2"); + +//***********ROLE SPECIFIC + +/*refinement.ignoredConcepts = { +"http://dbpedia.org/class/yago/Ruler110541229", +"http://dbpedia.org/class/yago/Sovereign110628644" +}; +*/ + +//sparql2.numberOfInstancesUsedForRoleLearning=5; +//not needed for roles +sparql2.instances = { +"http://dbpedia.org/resource/Oscar_I_of_Sweden" +,"http://dbpedia.org/resource/George_VI_of_the_United_Kingdom" +,"http://dbpedia.org/resource/Edward_VII_of_the_United_Kingdom" +,"http://dbpedia.org/resource/Victoria_of_the_United_Kingdom" +,"http://dbpedia.org/resource/Abdullah_II_of_Jordan" +,"http://dbpedia.org/resource/Khawaja_Nazimuddin" +,"http://dbpedia.org/resource/Harold_Macmillan" +,"http://dbpedia.org/resource/Maati_Bouabid" +,"http://dbpedia.org/resource/Charles_Watson-Wentworth%2C_2nd_Marquess_of_Rockingham" +,"http://dbpedia.org/resource/Helen_Clark" +}; + +//sparql2.role = "http://dbpedia.org/property/monarch"; +//sparql2.learnDomain=false; +//sparql2.learnRange=true; + + +/** examples **/ ++"http://dbpedia.org/resource/Oscar_I_of_Sweden" ++"http://dbpedia.org/resource/George_VI_of_the_United_Kingdom" ++"http://dbpedia.org/resource/Edward_VII_of_the_United_Kingdom" ++"http://dbpedia.org/resource/Victoria_of_the_United_Kingdom" ++"http://dbpedia.org/resource/Abdullah_II_of_Jordan" +-"http://dbpedia.org/resource/Khawaja_Nazimuddin" +-"http://dbpedia.org/resource/Harold_Macmillan" +-"http://dbpedia.org/resource/Maati_Bouabid" +-"http://dbpedia.org/resource/Charles_Watson-Wentworth%2C_2nd_Marquess_of_Rockingham" +-"http://dbpedia.org/resource/Helen_Clark" \ No newline at end of file Added: trunk/examples/ESWC_final/roles/Roles_fixed_DBPedia_placeOfBirth_domain_yago.conf =================================================================== --- trunk/examples/ESWC_final/roles/Roles_fixed_DBPedia_placeOfBirth_domain_yago.conf (rev 0) +++ trunk/examples/ESWC_final/roles/Roles_fixed_DBPedia_placeOfBirth_domain_yago.conf 2008-01-10 09:12:48 UTC (rev 361) @@ -0,0 +1,62 @@ +/** + * + * solutions: + * + */ + +refinement.heuristic=flexible; + +refinement.useAllConstructor = false; +refinement.useExistsConstructor = false; +refinement.useNegation = false; + +sparql2.recursionDepth = 1; + +// 1= yago +sparql2.predefinedFilter=1; + +// use DBpedia endpoint +import("http://dbpedia.openlinksw.com:8890/sparql","SPARQL2"); + + +//***********ROLE SPECIFIC + +/*refinement.ignoredConcepts = { +"http://dbpedia.org/class/yago/Entity100001740", +"http://dbpedia.org/class/yago/PhysicalEntity100001930", +"http://dbpedia.org/class/yago/Object100002684", +"http://dbpedia.org/class/yago/CausalAgent100007347", +"http://dbpedia.org/class/yago/Whole100003553", +"http://dbpedia.org/class/yago/LivingThing100004258", +"http://dbpedia.org/class/yago/Organism100004475" +};*/ +//sparql2.numberOfInstancesUsedForRoleLearning=5; +//not needed for roles +sparql2.instances = { +"http://dbpedia.org/resource/Wayne_Allard" +,"http://dbpedia.org/resource/Aurelian" +,"http://dbpedia.org/resource/W%C5%82adys%C5%82aw_Anders" +,"http://dbpedia.org/resource/Walter_Adams_%28economist%29" +,"http://dbpedia.org/resource/Hank_Azaria" +,"http://dbpedia.org/resource/Kiev" +,"http://dbpedia.org/resource/Helensburgh" +,"http://dbpedia.org/resource/Roman_Dacia" +,"http://dbpedia.org/resource/Jordan" +,"http://dbpedia.org/resource/Oldenburg"}; + +//sparql2.role = "http://dbpedia.org/property/placeOfBirth"; +//sparql2.learnDomain=true; +//sparql2.learnRange=false; + + +/** examples */ ++"http://dbpedia.org/resource/Wayne_Allard" ++"http://dbpedia.org/resource/Aurelian" ++"http://dbpedia.org/resource/W%C5%82adys%C5%82aw_Anders" ++"http://dbpedia.org/resource/Walter_Adams_%28economist%29" ++"http://dbpedia.org/resource/Hank_Azaria" +-"http://dbpedia.org/resource/Kiev" +-"http://dbpedia.org/resource/Helensburgh" +-"http://dbpedia.org/resource/Roman_Dacia" +-"http://dbpedia.org/resource/Jordan" +-"http://dbpedia.org/resource/Oldenburg" \ No newline at end of file Added: trunk/examples/ESWC_final/roles/Roles_fixed_DBPedia_placeOfBirth_range_yago.conf =================================================================== --- trunk/examples/ESWC_final/roles/Roles_fixed_DBPedia_placeOfBirth_range_yago.conf (rev 0) +++ trunk/examples/ESWC_final/roles/Roles_fixed_DBPedia_placeOfBirth_range_yago.conf 2008-01-10 09:12:48 UTC (rev 361) @@ -0,0 +1,60 @@ +/** + * + * solutions: + * + */ + //refinement.heuristic=flexible; + +refinement.useAllConstructor = false; +refinement.useExistsConstructor = false; +refinement.useNegation = false; + + +// recursion depth of extraction algorithm +sparql2.recursionDepth = 1; + + +//1=yago +sparql2.predefinedFilter=1; + +// use DBpedia endpoint +import("http://dbpedia.openlinksw.com:8890/sparql","SPARQL2"); + +//***********ROLE SPECIFIC + +/*refinement.ignoredConcepts = { +"http://dbpedia.org/class/yago/Abstraction100002137" +};*/ + +//sparql2.numberOfInstancesUsedForRoleLearning=5; +//not needed for roles +sparql2.instances = { +"http://dbpedia.org/resource/Kiev" +,"http://dbpedia.org/resource/Helensburgh" +,"http://dbpedia.org/resource/Roman_Dacia" +,"http://dbpedia.org/resource/Jordan" +,"http://dbpedia.org/resource/Oldenburg" +,"http://dbpedia.org/resource/Wayne_Allard" +,"http://dbpedia.org/resource/Aurelian" +,"http://dbpedia.org/resource/W%C5%82adys%C5%82aw_Anders" +,"http://dbpedia.org/resource/Walter_Adams_%28economist%29" +,"http://dbpedia.org/resource/Hank_Azaria" + +}; + +//sparql2.role = "http://dbpedia.org/property/placeOfBirth"; +//sparql2.learnDomain=false; +//sparql2.learnRange=true; + + +/** examples **/ ++"http://dbpedia.org/resource/Kiev" ++"http://dbpedia.org/resource/Helensburgh" ++"http://dbpedia.org/resource/Roman_Dacia" ++"http://dbpedia.org/resource/Jordan" ++"http://dbpedia.org/resource/Oldenburg" +-"http://dbpedia.org/resource/Wayne_Allard" +-"http://dbpedia.org/resource/Aurelian" +-"http://dbpedia.org/resource/W%C5%82adys%C5%82aw_Anders" +-"http://dbpedia.org/resource/Walter_Adams_%28economist%29" +-"http://dbpedia.org/resource/Hank_Azaria" \ No newline at end of file Added: trunk/examples/ESWC_final/roles/Roles_generic_DBpedia_monarch_domain_yago.conf =================================================================== --- trunk/examples/ESWC_final/roles/Roles_generic_DBpedia_monarch_domain_yago.conf (rev 0) +++ trunk/examples/ESWC_final/roles/Roles_generic_DBpedia_monarch_domain_yago.conf 2008-01-10 09:12:48 UTC (rev 361) @@ -0,0 +1,52 @@ +/** + * + * solutions: + * + */ + +// refinement.heuristic=flexible; + +refinement.useAllConstructor = false; +refinement.useExistsConstructor = false; +refinement.useNegation = false; + +sparql2.recursionDepth = 1; + +// 1= yago +sparql2.predefinedFilter=1; + +// use DBpedia endpoint +import("http://dbpedia.openlinksw.com:8890/sparql","SPARQL2"); + + +//***********ROLE SPECIFIC + +/*refinement.ignoredConcepts = { +"http://dbpedia.org/class/yago/Entity100001740", +"http://dbpedia.org/class/yago/PhysicalEntity100001930", +"http://dbpedia.org/class/yago/Object100002684", +"http://dbpedia.org/class/yago/CausalAgent100007347", +"http://dbpedia.org/class/yago/Whole100003553", +"http://dbpedia.org/class/yago/LivingThing100004258", +"http://dbpedia.org/class/yago/Organism100004475" +};*/ +sparql2.numberOfInstancesUsedForRoleLearning=5; +//not needed for roles +sparql2.instances = {""}; + +sparql2.role = "http://dbpedia.org/property/monarch"; +sparql2.learnDomain=true; +sparql2.learnRange=false; + + +/** examples */ ++"http://dbpedia.org/resource/Khawaja_Nazimuddin" ++"http://dbpedia.org/resource/Harold_Macmillan" ++"http://dbpedia.org/resource/Maati_Bouabid" ++"http://dbpedia.org/resource/Charles_Watson-Wentworth%2C_2nd_Marquess_of_Rockingham" ++"http://dbpedia.org/resource/Helen_Clark" +-"http://dbpedia.org/resource/Oscar_I_of_Sweden" +-"http://dbpedia.org/resource/George_VI_of_the_United_Kingdom" +-"http://dbpedia.org/resource/Edward_VII_of_the_United_Kingdom" +-"http://dbpedia.org/resource/Victoria_of_the_United_Kingdom" +-"http://dbpedia.org/resource/Abdullah_II_of_Jordan" Added: trunk/examples/ESWC_final/roles/Roles_generic_DBpedia_monarch_range_yago.conf =================================================================== --- trunk/examples/ESWC_final/roles/Roles_generic_DBpedia_monarch_range_yago.conf (rev 0) +++ trunk/examples/ESWC_final/roles/Roles_generic_DBpedia_monarch_range_yago.conf 2008-01-10 09:12:48 UTC (rev 361) @@ -0,0 +1,50 @@ +/** + * + * solutions: + * + */ + //refinement.heuristic=flexible; + +refinement.useAllConstructor = false; +refinement.useExistsConstructor = false; +refinement.useNegation = false; + + +// recursion depth of extraction algorithm +sparql2.recursionDepth = 1; + + +//1=yago +sparql2.predefinedFilter=1; + +// use DBpedia endpoint +import("http://dbpedia.openlinksw.com:8890/sparql","SPARQL2"); + +//***********ROLE SPECIFIC + +/*refinement.ignoredConcepts = { +"http://dbpedia.org/class/yago/Ruler110541229", +"http://dbpedia.org/class/yago/Sovereign110628644" +}; +*/ + +sparql2.numberOfInstancesUsedForRoleLearning=5; +//not needed for roles +sparql2.instances = {""}; + +sparql2.role = "http://dbpedia.org/property/monarch"; +sparql2.learnDomain=false; +sparql2.learnRange=true; + + +/** examples **/ ++"http://dbpedia.org/resource/Oscar_I_of_Sweden" ++"http://dbpedia.org/resource/George_VI_of_the_United_Kingdom" ++"http://dbpedia.org/resource/Edward_VII_of_the_United_Kingdom" ++"http://dbpedia.org/resource/Victoria_of_the_United_Kingdom" ++"http://dbpedia.org/resource/Abdullah_II_of_Jordan" +-"http://dbpedia.org/resource/Khawaja_Nazimuddin" +-"http://dbpedia.org/resource/Harold_Macmillan" +-"http://dbpedia.org/resource/Maati_Bouabid" +-"http://dbpedia.org/resource/Charles_Watson-Wentworth%2C_2nd_Marquess_of_Rockingham" +-"http://dbpedia.org/resource/Helen_Clark" \ No newline at end of file Added: trunk/examples/ESWC_final/roles/Roles_generic_DBpedia_placeOfBirth_domain_yago.conf =================================================================== --- trunk/examples/ESWC_final/roles/Roles_generic_DBpedia_placeOfBirth_domain_yago.conf (rev 0) +++ trunk/examples/ESWC_final/roles/Roles_generic_DBpedia_placeOfBirth_domain_yago.conf 2008-01-10 09:12:48 UTC (rev 361) @@ -0,0 +1,52 @@ +/** + * + * solutions: + * + */ + +refinement.heuristic=flexible; + +refinement.useAllConstructor = false; +refinement.useExistsConstructor = false; +refinement.useNegation = false; + +sparql2.recursionDepth = 1; + +// 1= yago +sparql2.predefinedFilter=1; + +// use DBpedia endpoint +import("http://dbpedia.openlinksw.com:8890/sparql","SPARQL2"); + + +//***********ROLE SPECIFIC + +/*refinement.ignoredConcepts = { +"http://dbpedia.org/class/yago/Entity100001740", +"http://dbpedia.org/class/yago/PhysicalEntity100001930", +"http://dbpedia.org/class/yago/Object100002684", +"http://dbpedia.org/class/yago/CausalAgent100007347", +"http://dbpedia.org/class/yago/Whole100003553", +"http://dbpedia.org/class/yago/LivingThing100004258", +"http://dbpedia.org/class/yago/Organism100004475" +};*/ +sparql2.numberOfInstancesUsedForRoleLearning=5; +//not needed for roles +sparql2.instances = {""}; + +sparql2.role = "http://dbpedia.org/property/placeOfBirth"; +sparql2.learnDomain=true; +sparql2.learnRange=false; + + +/** examples */ ++"http://dbpedia.org/resource/Wayne_Allard" ++"http://dbpedia.org/resource/Aurelian" ++"http://dbpedia.org/resource/W%C5%82adys%C5%82aw_Anders" ++"http://dbpedia.org/resource/Walter_Adams_%28economist%29" ++"http://dbpedia.org/resource/Hank_Azaria" +-"http://dbpedia.org/resource/Kiev" +-"http://dbpedia.org/resource/Helensburgh" +-"http://dbpedia.org/resource/Roman_Dacia" +-"http://dbpedia.org/resource/Jordan" +-"http://dbpedia.org/resource/Oldenburg" \ No newline at end of file Added: trunk/examples/ESWC_final/roles/Roles_generic_DBpedia_placeOfBirth_range_yago.conf =================================================================== --- trunk/examples/ESWC_final/roles/Roles_generic_DBpedia_placeOfBirth_range_yago.conf (rev 0) +++ trunk/examples/ESWC_final/roles/Roles_generic_DBpedia_placeOfBirth_range_yago.conf 2008-01-10 09:12:48 UTC (rev 361) @@ -0,0 +1,48 @@ +/** + * + * solutions: + * + */ + //refinement.heuristic=flexible; + + refinement.useAllConstructor = false; + refinement.useExistsConstructor = false; +refinement.useNegation = false; + + +// recursion depth of extraction algorithm +sparql2.recursionDepth = 1; + + +//1=yago +sparql2.predefinedFilter=1; + +// use DBpedia endpoint +import("http://dbpedia.openlinksw.com:8890/sparql","SPARQL2"); + +//***********ROLE SPECIFIC + +refinement.ignoredConcepts = { +"http://dbpedia.org/class/yago/Abstraction100002137" +}; + +sparql2.numberOfInstancesUsedForRoleLearning=5; +//not needed for roles +sparql2.instances = {""}; + +sparql2.role = "http://dbpedia.org/property/placeOfBirth"; +sparql2.learnDomain=false; +sparql2.learnRange=true; + + +/** examples **/ ++"http://dbpedia.org/resource/Kiev" ++"http://dbpedia.org/resource/Helensburgh" ++"http://dbpedia.org/resource/Roman_Dacia" ++"http://dbpedia.org/resource/Jordan" ++"http://dbpedia.org/resource/Oldenburg" +-"http://dbpedia.org/resource/Wayne_Allard" +-"http://dbpedia.org/resource/Aurelian" +-"http://dbpedia.org/resource/W%C5%82adys%C5%82aw_Anders" +-"http://dbpedia.org/resource/Walter_Adams_%28economist%29" +-"http://dbpedia.org/resource/Hank_Azaria" \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ku...@us...> - 2008-01-10 09:08:07
|
Revision: 360 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=360&view=rev Author: kurzum Date: 2008-01-10 01:08:04 -0800 (Thu, 10 Jan 2008) Log Message: ----------- latest changes forgot to commit Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/kb/sparql/ClassNode.java trunk/src/dl-learner/org/dllearner/kb/sparql/Configuration.java trunk/src/dl-learner/org/dllearner/kb/sparql/ExtractionAlgorithm.java trunk/src/dl-learner/org/dllearner/kb/sparql/Manager.java trunk/src/dl-learner/org/dllearner/kb/sparql/TypedSparqlQuery.java trunk/src/dl-learner/org/dllearner/kb/sparql/TypedSparqlQueryClasses.java Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/ClassNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/ClassNode.java 2008-01-10 09:07:30 UTC (rev 359) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/ClassNode.java 2008-01-10 09:08:04 UTC (rev 360) @@ -104,7 +104,7 @@ return s; } - @Override + public int compareTo(Node n){ return super.compareTo(n); // Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/Configuration.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/Configuration.java 2008-01-10 09:07:30 UTC (rev 359) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/Configuration.java 2008-01-10 09:08:04 UTC (rev 360) @@ -37,23 +37,27 @@ // the following needs to be moved to // class extraction algorithm or manipulator private int recursiondepth = 2; - private boolean getAllBackground = true; + private boolean getAllSuperClasses = true; + private boolean closeAfterRecursion = true; + public int numberOfUncachedSparqlQueries=0; + public int numberOfCachedSparqlQueries=0; public Configuration(SpecificSparqlEndpoint specificSparqlEndpoint, SparqlQueryType sparqlQueryType, Manipulator manipulator, int recursiondepth, - boolean getAllBackground) { + boolean getAllSuperClasses, boolean closeAfterRecursion) { this.specificSparqlEndpoint = specificSparqlEndpoint; this.sparqlQueryType = sparqlQueryType; this.manipulator = manipulator; this.recursiondepth = recursiondepth; - this.getAllBackground = getAllBackground; + this.getAllSuperClasses = getAllSuperClasses; + this.closeAfterRecursion=closeAfterRecursion; } public Configuration changeQueryType(SparqlQueryType sqt) { // TODO must clone here return new Configuration(this.specificSparqlEndpoint, sqt, this.manipulator, - this.recursiondepth, this.getAllBackground); + this.recursiondepth, this.getAllSuperClasses,this.closeAfterRecursion); } @@ -69,12 +73,22 @@ return sparqlQueryType; } - public boolean isGetAllBackground() { - return getAllBackground; + public boolean isGetAllSuperClasses() { + return getAllSuperClasses; } + public boolean isCloseAfterRecursion() { + return closeAfterRecursion; + } public int getRecursiondepth() { return recursiondepth; } + + public void increaseNumberOfuncachedSparqlQueries(){ + numberOfUncachedSparqlQueries++; + } + public void increaseNumberOfCachedSparqlQueries(){ + numberOfCachedSparqlQueries++; + } } Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/ExtractionAlgorithm.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/ExtractionAlgorithm.java 2008-01-10 09:07:30 UTC (rev 359) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/ExtractionAlgorithm.java 2008-01-10 09:08:04 UTC (rev 360) @@ -32,17 +32,17 @@ private Configuration configuration; private Manipulator manipulator; - private int recursionDepth = 2; - private boolean getAllBackground = true; - private boolean closeAfterRecursion = true; + private int recursionDepth = 1; + //private boolean getAllSuperClasses = true; + //private boolean closeAfterRecursion = true; private boolean print_flag=false; public ExtractionAlgorithm(Configuration Configuration) { this.configuration = Configuration; this.manipulator = Configuration.getManipulator(); this.recursionDepth = Configuration.getRecursiondepth(); - this.getAllBackground = Configuration.isGetAllBackground(); - + //this.getAllSuperClasses = Configuration.isGetAllSuperClasses(); + //this.closeAfterRecursion=Configuration.isCloseAfterRecursion(); } public Node getFirstNode(URI u) { @@ -87,13 +87,13 @@ v = tmp; System.out.println("Recursion counter: " + x + " with " + v.size() + " Nodes remaining, needed: " - +(System.currentTimeMillis()-time)); + +(System.currentTimeMillis()-time)+"ms"); time=System.currentTimeMillis(); } HashSet<String> hadAlready=new HashSet<String>(); // gets All Class Nodes and expands them further - if (this.getAllBackground) { + if (this.configuration.isGetAllSuperClasses()) { //Set<Node> classes = new TreeSet<Node>(); Vector<Node> classes = new Vector<Node>(); @@ -107,9 +107,9 @@ } } - System.out.println(instances.size()); + //System.out.println(instances.size()); TypedSparqlQueryClasses tsqc=new TypedSparqlQueryClasses(configuration); - if(closeAfterRecursion){ + if(this.configuration.isCloseAfterRecursion()){ while (instances.size() > 0) { p("Getting classes for remaining instances: " + instances.size()); Node next = instances.remove(0); @@ -134,7 +134,7 @@ tmp=next.expand(tsp, manipulator); classes.addAll(tmp); tmp=new Vector<Node>(); - if(i % 50==0)System.out.println("got "+i+" extra classes, max: "+manipulator.breakSuperClassRetrievalAfter); + //if(i % 50==0)System.out.println("got "+i+" extra classes, max: "+manipulator.breakSuperClassRetrievalAfter); i++; if (i>=manipulator.breakSuperClassRetrievalAfter){break;} } Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/Manager.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/Manager.java 2008-01-10 09:07:30 UTC (rev 359) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/Manager.java 2008-01-10 09:08:04 UTC (rev 360) @@ -41,10 +41,10 @@ public void useConfiguration(SparqlQueryType SparqlQueryType, SpecificSparqlEndpoint SparqlEndpoint, Manipulator manipulator, int recursiondepth, - boolean getAllBackground) { + boolean getAllSuperClasses,boolean closeAfterRecursion) { this.configuration = new Configuration(SparqlEndpoint, SparqlQueryType, manipulator, - recursiondepth, getAllBackground); + recursiondepth, getAllSuperClasses, closeAfterRecursion); this.typedSparqlQuery = new TypedSparqlQuery(configuration); this.extractionAlgorithm = new ExtractionAlgorithm(configuration); @@ -117,6 +117,7 @@ nt.append((String) arr[i]+"\n"); if(i%1000==0)System.out.println(i+" of "+arr.length+" triples done"); } + System.out.println(arr.length+" of "+arr.length+" triples done"); /* String tmp=""; while ( ret.size() > 0) { @@ -136,5 +137,9 @@ this.configuration.getSparqlQueryType().addPredicateFilter(str); } + + public Configuration getConfiguration(){ + return configuration; + } } \ No newline at end of file Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/TypedSparqlQuery.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/TypedSparqlQuery.java 2008-01-10 09:07:30 UTC (rev 359) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/TypedSparqlQuery.java 2008-01-10 09:08:04 UTC (rev 360) @@ -97,6 +97,7 @@ String xml = null; // if not in cache get it from EndPoint if (FromCache == null) { + configuration.increaseNumberOfuncachedSparqlQueries(); try { xml = sendAndReceiveSPARQL(sparql); } catch (IOException e) { @@ -110,6 +111,7 @@ } //System.out.print("\n"); } else { + configuration.increaseNumberOfCachedSparqlQueries(); xml = FromCache; //System.out.println("FROM CACHE"); } Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/TypedSparqlQueryClasses.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/TypedSparqlQueryClasses.java 2008-01-10 09:07:30 UTC (rev 359) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/TypedSparqlQueryClasses.java 2008-01-10 09:08:04 UTC (rev 360) @@ -81,6 +81,7 @@ String xml = null; // if not in cache get it from EndPoint if (FromCache == null) { + configuration.increaseNumberOfuncachedSparqlQueries(); try { xml = sendAndReceiveSPARQL(sparql); } catch (IOException e) { @@ -94,6 +95,7 @@ } //System.out.print("\n"); } else { + configuration.increaseNumberOfCachedSparqlQueries(); xml = FromCache; //System.out.println("FROM CACHE"); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ku...@us...> - 2008-01-10 09:07:32
|
Revision: 359 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=359&view=rev Author: kurzum Date: 2008-01-10 01:07:30 -0800 (Thu, 10 Jan 2008) Log Message: ----------- latest changes Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/kb/SparqlEndpointRestructured.java Modified: trunk/src/dl-learner/org/dllearner/kb/SparqlEndpointRestructured.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/SparqlEndpointRestructured.java 2008-01-09 21:00:23 UTC (rev 358) +++ trunk/src/dl-learner/org/dllearner/kb/SparqlEndpointRestructured.java 2008-01-10 09:07:30 UTC (rev 359) @@ -68,7 +68,7 @@ String host; private Set<String> instances=new HashSet<String>();; private URL dumpFile; - private int recursionDepth = 2; + private int recursionDepth = 1; private int predefinedFilter = 0; private int predefinedEndpoint = 0; private Set<String> predList=new HashSet<String>(); @@ -78,6 +78,7 @@ private boolean dumpToFile = true; private boolean useLits = false; private boolean getAllSuperClasses = true; + private boolean closeAfterRecursion = true; private int breakSuperClassRetrievalAfter = 200; private boolean learnDomain = false; @@ -170,9 +171,10 @@ options.add(new StringTupleListConfigOption("replaceObject", "rule for replacing predicates")); options.add(new IntegerConfigOption("breakSuperClassRetrievalAfter", "stops a cyclic hierarchy after specified number of classes")); options.add(new IntegerConfigOption("numberOfInstancesUsedForRoleLearning", "")); - + options.add(new BooleanConfigOption("closeAfterRecursion", "gets all classes for all instances")); + return options; } @@ -224,7 +226,7 @@ } else if (option.equals("blankNodeIdentifier")) { blankNodeIdentifier = (String) entry.getValue(); } else if (option.equals("example")) { - System.out.println(entry.getValue()); + //System.out.println(entry.getValue()); }else if (option.equals("replacePredicate")) { replacePredicate = (LinkedList)entry.getValue(); }else if (option.equals("replaceObject")) { @@ -233,7 +235,9 @@ breakSuperClassRetrievalAfter = (Integer) entry.getValue(); }else if (option.equals("numberOfInstancesUsedForRoleLearning")) { numberOfInstancesUsedForRoleLearning = (Integer) entry.getValue(); - } + }else if (option.equals("closeAfterRecursion")) { + closeAfterRecursion = (Boolean) entry.getValue(); + } } @@ -276,10 +280,10 @@ } // give everything to the manager - m.useConfiguration(sqt, sse, man, recursionDepth, getAllSuperClasses); + m.useConfiguration(sqt, sse, man, recursionDepth, getAllSuperClasses,closeAfterRecursion); try { String ont = ""; - System.out.println(learnDomain); + //System.out.println(learnDomain); // used to learn a domain of a role if (learnDomain || learnRange) { Set<String> pos=new HashSet<String>(); @@ -337,6 +341,9 @@ } // the actual extraction is started here ont = m.extract(instances); + System.out.println("Number of cached SPARQL queries: "+m.getConfiguration().numberOfCachedSparqlQueries); + System.out.println("Number of uncached SPARQL queries: "+m.getConfiguration().numberOfUncachedSparqlQueries); + System.out.println("Finished collecting Fragment"); if (dumpToFile) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ton...@us...> - 2008-01-09 21:00:30
|
Revision: 358 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=358&view=rev Author: tonytacker Date: 2008-01-09 13:00:23 -0800 (Wed, 09 Jan 2008) Log Message: ----------- now it runs with owl-files, you have to choose every tab from left to right and use all buttons Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/gui/Config.java trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java trunk/src/dl-learner/org/dllearner/gui/LearningProblemPanel.java trunk/src/dl-learner/org/dllearner/gui/OutputPanel.java trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java Modified: trunk/src/dl-learner/org/dllearner/gui/Config.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/Config.java 2008-01-09 17:55:25 UTC (rev 357) +++ trunk/src/dl-learner/org/dllearner/gui/Config.java 2008-01-09 21:00:23 UTC (rev 358) @@ -21,13 +21,15 @@ */ import java.io.File; -import java.util.List; +import java.util.HashSet; +import java.util.Set; import org.dllearner.core.ComponentManager; import org.dllearner.core.KnowledgeSource; +import org.dllearner.core.LearningAlgorithm; +import org.dllearner.core.LearningProblem; import org.dllearner.core.ReasonerComponent; import org.dllearner.core.ReasoningService; -import org.dllearner.core.dl.Individual; /** * config @@ -44,8 +46,10 @@ private File selectedFile; private ReasonerComponent reasoner; private ReasoningService rs; - private List<Individual> individuals; private String[] kbBoxItems = {"Pleae select a type", "KBFile", "OWLFile", "SparqleEndpoint"}; + private Set<String> exampleSet = new HashSet<String>(); + private LearningProblem lp; + private LearningAlgorithm la; /** * status should show witch variables are set @@ -53,6 +57,9 @@ * status[1] ... KnowledgeSource * status[2] ... File or URL * status[3] ... Resoner + * status[4] ... ReasoningService + * status[5] ... ExampleSet + * status[6] ... LearningProblem */ protected static boolean[] status = new boolean[8]; @@ -99,14 +106,6 @@ rs = input; } - protected List<Individual> getListIndividuals () { - return individuals; - } - - protected void setListIndividuals (List<Individual> input) { - individuals = input; - } - protected String[] getKBBoxItems() { return kbBoxItems; } @@ -120,4 +119,32 @@ source = input; } + protected void setExampleSet(Set<String> input) { + status[5] = true; + exampleSet = input; + } + + protected Set<String> getExampleSet () { + return exampleSet; + } + + protected void setLearningProblem (LearningProblem input) { + status[6] = true; + lp = input; + } + + protected LearningProblem getLearningProblem () { + return lp; + } + + protected void setLearningAlgorithm (LearningAlgorithm input) { + status[6] = true; + la = input; + } + + protected LearningAlgorithm getLearningAlgorithm () { + return la; + } + + } Modified: trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java 2008-01-09 17:55:25 UTC (rev 357) +++ trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java 2008-01-09 21:00:23 UTC (rev 358) @@ -22,6 +22,14 @@ import javax.swing.*; +import org.dllearner.algorithms.refinement.ROLearner; + +import java.awt.BorderLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + + + /** * LearningAlgorithmPanel * @@ -29,11 +37,29 @@ * */ -public class LearningAlgorithmPanel extends JPanel { +public class LearningAlgorithmPanel extends JPanel implements ActionListener { private static final long serialVersionUID = 8721490771860452959L; + + private JPanel laPanel = new JPanel(); + private JButton laButton; + + LearningAlgorithmPanel() { + super(new BorderLayout()); - LearningAlgorithmPanel() { + laButton = new JButton("Use ROLearner"); + laButton.addActionListener(this); + laPanel.add(laButton); + add(laPanel, BorderLayout.PAGE_START); } + + public void actionPerformed(ActionEvent e) { + if (e.getSource() == laButton) { + if (StartGUI.myconfig.getStatus(6)) { + StartGUI.myconfig.setLearningAlgorithm(StartGUI.myconfig.getComponentManager().learningAlgorithm(ROLearner.class, StartGUI.myconfig.getLearningProblem(), StartGUI.myconfig.getReasoningService())); + StartGUI.myconfig.getLearningAlgorithm().init(); + } + } + } } Modified: trunk/src/dl-learner/org/dllearner/gui/LearningProblemPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/LearningProblemPanel.java 2008-01-09 17:55:25 UTC (rev 357) +++ trunk/src/dl-learner/org/dllearner/gui/LearningProblemPanel.java 2008-01-09 21:00:23 UTC (rev 358) @@ -20,8 +20,14 @@ * */ +import java.awt.BorderLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + import javax.swing.*; +import org.dllearner.learningproblems.PosOnlyDefinitionLP; + /** * LearningProblemPanel * @@ -29,11 +35,32 @@ * */ -public class LearningProblemPanel extends JPanel { +public class LearningProblemPanel extends JPanel implements ActionListener { private static final long serialVersionUID = -3819627680918930203L; + private JPanel lpPanel = new JPanel(); + private JButton lpButton; + LearningProblemPanel() { + super(new BorderLayout()); + + lpButton = new JButton("Use PosOnlyDefinitionLP"); + lpButton.addActionListener(this); + lpPanel.add(lpButton); + add(lpPanel, BorderLayout.PAGE_START); } + + public void actionPerformed(ActionEvent e) { + if (e.getSource() == lpButton) { + if (StartGUI.myconfig.getStatus(5)) { + System.out.println(StartGUI.myconfig.getExampleSet()); + StartGUI.myconfig.setLearningProblem(StartGUI.myconfig.getComponentManager().learningProblem(PosOnlyDefinitionLP.class, StartGUI.myconfig.getReasoningService())); + StartGUI.myconfig.getComponentManager().applyConfigEntry(StartGUI.myconfig.getLearningProblem(), "positiveExamples", StartGUI.myconfig.getExampleSet()); + StartGUI.myconfig.getLearningProblem().init(); + } + } + } + } Modified: trunk/src/dl-learner/org/dllearner/gui/OutputPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/OutputPanel.java 2008-01-09 17:55:25 UTC (rev 357) +++ trunk/src/dl-learner/org/dllearner/gui/OutputPanel.java 2008-01-09 21:00:23 UTC (rev 358) @@ -26,6 +26,8 @@ import javax.swing.*; +import org.dllearner.core.dl.Concept; + /** * OutputPanel * @@ -38,6 +40,7 @@ private static final long serialVersionUID = 1643304576470046636L; private JButton showButton; + private JButton runButton; private JTextArea infoArea; OutputPanel() { @@ -45,11 +48,16 @@ showButton = new JButton("Show Variables"); showButton.addActionListener(this); + + runButton = new JButton("Run"); + runButton.addActionListener(this); + infoArea = new JTextArea(20, 50); JScrollPane infoScroll = new JScrollPane(infoArea); JPanel showPanel = new JPanel(); showPanel.add(showButton); + showPanel.add(runButton); JPanel infoPanel = new JPanel(); infoPanel.add(infoScroll); @@ -76,5 +84,12 @@ } } } + if (e.getSource() == runButton) { + if (StartGUI.myconfig.getStatus(6)) { + StartGUI.myconfig.getLearningAlgorithm().start(); + Concept solution = StartGUI.myconfig.getLearningAlgorithm().getBestSolution(); + infoArea.setText(solution.toString()); + } + } } } Modified: trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java 2008-01-09 17:55:25 UTC (rev 357) +++ trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java 2008-01-09 21:00:23 UTC (rev 358) @@ -24,11 +24,13 @@ import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Set; import javax.swing.*; +import javax.swing.event.*; import org.dllearner.core.dl.Individual; import org.dllearner.reasoning.DIGReasoner; @@ -68,13 +70,27 @@ digList.setVisibleRowCount(-1); JScrollPane listScroller = new JScrollPane(digList); listScroller.setPreferredSize(new Dimension(550, 350)); - + digPanel.add(digButton); add(digPanel, BorderLayout.PAGE_START); centerPanel.add(listScroller); add(centerPanel, BorderLayout.CENTER); + digList.addListSelectionListener(new ListSelectionListener() { + public void valueChanged(ListSelectionEvent evt) { + if (evt.getValueIsAdjusting()) + return; + //System.out.println("Selected from " + evt.getFirstIndex() + " to " + evt.getLastIndex()); + // detect which examples have been selected + Set<String> exampleSet = new HashSet<String>(); + int[] selectedIndices = digList.getSelectedIndices(); + for(int i : selectedIndices) + exampleSet.add(individuals.get(i).toString()); + StartGUI.myconfig.setExampleSet(exampleSet); + System.out.println("digList: " + StartGUI.myconfig.getExampleSet() ); + } + }); } public void actionPerformed(ActionEvent e) { @@ -96,15 +112,16 @@ // make list DefaultListModel listModel = new DefaultListModel(); - for(Individual ind : individuals) { + for(Individual ind : individuals) listModel.addElement(ind); - } - //System.out.println("listModel: " + listModel); + digList.setModel(listModel); + // graphic digList.setModel(listModel); StartGUI.myrun.renew(); + //return; } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-01-09 17:55:29
|
Revision: 357 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=357&view=rev Author: jenslehmann Date: 2008-01-09 09:55:25 -0800 (Wed, 09 Jan 2008) Log Message: ----------- fixed bug which caused some triples not to appear Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/ajaxfunctions.php trunk/src/dbpedia-navigator/default.css trunk/src/dbpedia-navigator/index.php trunk/src/dl-learner/org/dllearner/kb/SparqlOntologyCollector.java Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-01-09 16:32:14 UTC (rev 356) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-01-09 17:55:25 UTC (rev 357) @@ -103,8 +103,12 @@ $ret=array(); foreach ($array as $element) { - $items=preg_split("[<]",$element,-1, PREG_SPLIT_NO_EMPTY); - $ret[$items[0]]=$items[1]; + $items=preg_split("[<]",$element,-1, PREG_SPLIT_NO_EMPTY); + + // each property can occur multiple times (!) + // bug: $ret[$items[0]]=$items[1]; + + $ret[$items[0]][] = $items[1]; } return $ret; } Modified: trunk/src/dbpedia-navigator/ajaxfunctions.php =================================================================== --- trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-01-09 16:32:14 UTC (rev 356) +++ trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-01-09 17:55:25 UTC (rev 357) @@ -68,14 +68,14 @@ // display a picture if there is one if(isset($triples['http://xmlns.com/foaf/0.1/depiction'])) - $content.='<img src="'.$triples['http://xmlns.com/foaf/0.1/depiction'].'" alt="Picture of '.$subject_nice.'" style="float:right; max-width:200px;" \>'; + $content.='<img src="'.$triples['http://xmlns.com/foaf/0.1/depiction'][0].'" alt="Picture of '.$subject_nice.'" style="float:right; max-width:200px;" \>'; // add short description in english - $content.="<h3>Short Description</h3><p>".urldecode($triples['http://dbpedia.org/property/abstract'])."</p>"; + $content.="<h4>Short Description</h4><p>".urldecode($triples['http://dbpedia.org/property/abstract'][0])."</p>"; // give the link to the corresponding Wikipedia article if(isset($triples['http://xmlns.com/foaf/0.1/page'])) - $content .= '<p><img src="images/wikipedia_favicon.png" alt"Wikipedia" /> <a href="'.$triples['http://xmlns.com/foaf/0.1/page'].'">view Wikipedia article</a>, '; + $content .= '<p><img src="images/wikipedia_favicon.png" alt"Wikipedia" /> <a href="'.$triples['http://xmlns.com/foaf/0.1/page'][0].'">view Wikipedia article</a>, '; $content .= '<a href="'.$subject.'">view DBpedia resource description</a></p>'; // display a list of classes @@ -248,9 +248,15 @@ // helper function function get_triple_table($triples) { + $table = '<table border="1"><tr><td>predicate</td><td>object</td></tr>'; foreach($triples as $predicate=>$object) { - $table .= '<tr><td>'.$predicate.'</td><td>'.$object.'</td></tr>'; + $table .= '<tr><td>'.$predicate.'</td>'; + $table .= '<td><ul>'; + foreach($object as $element) { + $table .= '<li>'.$element.'</li>'; + } + $table .= '</ul></td>'; } $table .= '</table>'; return $table; Modified: trunk/src/dbpedia-navigator/default.css =================================================================== --- trunk/src/dbpedia-navigator/default.css 2008-01-09 16:32:14 UTC (rev 356) +++ trunk/src/dbpedia-navigator/default.css 2008-01-09 17:55:25 UTC (rev 357) @@ -12,7 +12,7 @@ } html { - font: 80%/1.2 "Lucida Grande", Helvetica, Arial, sans-serif; + font: 85%/1.2 "Lucida Grande", Helvetica, Arial, sans-serif; } p { @@ -367,7 +367,8 @@ } #ArticleTitle { - font-size: 110%; + font-size: 150%; + color:black; } #footer { Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-01-09 16:32:14 UTC (rev 356) +++ trunk/src/dbpedia-navigator/index.php 2008-01-09 17:55:25 UTC (rev 357) @@ -12,6 +12,12 @@ $ids=$sc->getIDs(); $_SESSION['id']=$ids[0]; $_SESSION['ksID']=$ids[1]; + +// debugging code +// echo '<pre>'; +// $sc=new DLLearnerConnection($settings->dbpediauri,$settings->wsdluri,$_SESSION['id'],$_SESSION['ksID']); +// print_r($sc->getTriples($settings->sparqlttl,'http://dbpedia.org/resource/Dog')); +// echo '</pre>'; require("ajax.php"); @@ -184,6 +190,9 @@ <li>get local DBpedia SPARQL endpoint working</li> <li>many queries work correctly on the server, but yield to response in the interface (seems to be rather random)</li> <li>fix sometimes occurring PHP errors and warnings</li> + <li>would be interesting to somehow view the Wikipedia article (without the left navigation part, + tabs etc.) as an overlay, because the Wikipedia article will almost always be a human-friendlier + description of an object compared to the extracted one</li> </ul> </p> </div> Modified: trunk/src/dl-learner/org/dllearner/kb/SparqlOntologyCollector.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/SparqlOntologyCollector.java 2008-01-09 16:32:14 UTC (rev 356) +++ trunk/src/dl-learner/org/dllearner/kb/SparqlOntologyCollector.java 2008-01-09 17:55:25 UTC (rev 357) @@ -47,7 +47,7 @@ boolean print_flag=false; SparqlQueryMaker q; - SparqlCache c; + SparqlCache cache; URL url; SparqlFilter sf; String[] subjectList; @@ -90,7 +90,7 @@ this.numberOfRecursions=numberOfRecursions; this.format=format; this.q=new SparqlQueryMaker(); - this.c=new SparqlCache("cache"); + this.cache=new SparqlCache("cache"); if(defClasses!=null && defClasses.length>0 ){ this.defaultClasses=defClasses; } @@ -108,7 +108,7 @@ public SparqlOntologyCollector(URL url) { this.q=new SparqlQueryMaker(); - this.c=new SparqlCache("cache"); + this.cache=new SparqlCache("cache"); this.url=url; } @@ -131,16 +131,16 @@ public String[] collectTriples(String subject) throws IOException{ System.out.println("Searching for Article: "+subject); String sparql=q.makeArticleQuery(subject); - String FromCache=c.get(subject, sparql); + String fromCache=cache.get(subject, sparql); String xml; // if not in cache get it from dbpedia - if(FromCache==null){ + if(fromCache==null){ xml=sendAndReceive(sparql); - c.put(subject, xml, sparql); + cache.put(subject, xml, sparql); System.out.print("\n"); } else{ - xml=FromCache; + xml=fromCache; System.out.println("FROM CACHE"); } @@ -181,12 +181,12 @@ public String[] getSubjectsFromLabel(String label, int limit) throws IOException{ System.out.println("Searching for Label: "+label); String sparql=q.makeLabelQuery(label,limit); - String FromCache=c.get(label, sparql); + String FromCache=cache.get(label, sparql); String xml; // if not in cache get it from dbpedia if(FromCache==null){ xml=sendAndReceive(sparql); - c.put(label, xml, sparql); + cache.put(label, xml, sparql); System.out.print("\n"); } else{ @@ -201,12 +201,12 @@ { System.out.println("Searching for Subjects of type: "+concept); String sparql=q.makeConceptQuery(concept); - String FromCache=c.get(concept, sparql); + String FromCache=cache.get(concept, sparql); String xml; // if not in cache get it from dbpedia if(FromCache==null){ xml=sendAndReceive(sparql); - c.put(concept, xml, sparql); + cache.put(concept, xml, sparql); System.out.print("\n"); } else{ @@ -242,12 +242,12 @@ String sparql=q.makeQueryFilter(StartingSubject,this.sf); // checks cache - String FromCache=c.get(StartingSubject, sparql); + String FromCache=cache.get(StartingSubject, sparql); String xml; // if not in cache get it from dbpedia if(FromCache==null){ xml=sendAndReceive(sparql); - c.put(StartingSubject, xml, sparql); + cache.put(StartingSubject, xml, sparql); System.out.print("\n"); } else{ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-01-09 16:32:38
|
Revision: 356 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=356&view=rev Author: jenslehmann Date: 2008-01-09 08:32:14 -0800 (Wed, 09 Jan 2008) Log Message: ----------- - various userinterface improvements - started article display Modified Paths: -------------- trunk/src/dbpedia-navigator/ajaxfunctions.php trunk/src/dbpedia-navigator/default.css trunk/src/dbpedia-navigator/index.php Added Paths: ----------- trunk/src/dbpedia-navigator/images/green-plus.png trunk/src/dbpedia-navigator/images/red-minus.png trunk/src/dbpedia-navigator/images/remove.png trunk/src/dbpedia-navigator/images/wikipedia_favicon.ico trunk/src/dbpedia-navigator/images/wikipedia_favicon.png Modified: trunk/src/dbpedia-navigator/ajaxfunctions.php =================================================================== --- trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-01-09 13:42:40 UTC (rev 355) +++ trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-01-09 16:32:14 UTC (rev 356) @@ -55,13 +55,40 @@ { $content.=substr($triples,7); } - else if (count($triples)==0) $content.="Article not found."; - else { - $content=""; - $content.="<img src=\"".$triples['http://xmlns.com/foaf/0.1/depiction']."\" alt=\"Picture of ".str_replace("_"," ",urldecode(substr (strrchr ($subject, "/"), 1)))."\" width=\"50\"/ style=\"float:left\">"; - $content.="<div>".urldecode($triples['http://dbpedia.org/property/abstract'])."</div>"; + else if (count($triples)==0) + $content.="Did not find an article with that name."; + else { + + // goal: display the data in a nice (DBpedia specific way), maybe similar to + // dbpedia.org/search + + $content=""; + // replace by label(?) + $subject_nice = str_replace("_"," ",urldecode(substr (strrchr ($subject, "/"), 1))); + + // display a picture if there is one + if(isset($triples['http://xmlns.com/foaf/0.1/depiction'])) + $content.='<img src="'.$triples['http://xmlns.com/foaf/0.1/depiction'].'" alt="Picture of '.$subject_nice.'" style="float:right; max-width:200px;" \>'; + + // add short description in english + $content.="<h3>Short Description</h3><p>".urldecode($triples['http://dbpedia.org/property/abstract'])."</p>"; + + // give the link to the corresponding Wikipedia article + if(isset($triples['http://xmlns.com/foaf/0.1/page'])) + $content .= '<p><img src="images/wikipedia_favicon.png" alt"Wikipedia" /> <a href="'.$triples['http://xmlns.com/foaf/0.1/page'].'">view Wikipedia article</a>, '; + $content .= '<a href="'.$subject.'">view DBpedia resource description</a></p>'; + + // display a list of classes + + // filter out uninteresting properties + // unset + + // display the remaining properties as list which can be used for further navigation + + $content .= '<br/><br/><br/><br/><br/><br/>'.get_triple_table($triples); - $contentbuttons="<input type=\"button\" value=\"Positive\" class=\"button\" onclick=\"xajax_addPositive('".$subject."');return false;\" /> <input type=\"button\" value=\"Negative\" class=\"button\" onclick=\"xajax_addNegative('".$subject."');return false;\" />"; + // $contentbuttons="<input type=\"button\" value=\"Positive\" class=\"button\" onclick=\"xajax_addPositive('".$subject."');return false;\" /> <input type=\"button\" value=\"Negative\" class=\"button\" onclick=\"xajax_addNegative('".$subject."');return false;\" />"; + $contentbuttons='<img src="images/green-plus.png" alt="positive example" onclick="xajax_addPositive(\''.$subject.'\')" /> <img src="images/red-minus.png" alt="negative example" onclick="xajax_addNegative(\''.$subject.'\') />'; } //store article in session, to navigate between last 5 articles quickly @@ -218,5 +245,15 @@ $objResponse->call('xajax_getsubjects',$keyword); return $objResponse; } + +// helper function +function get_triple_table($triples) { + $table = '<table border="1"><tr><td>predicate</td><td>object</td></tr>'; + foreach($triples as $predicate=>$object) { + $table .= '<tr><td>'.$predicate.'</td><td>'.$object.'</td></tr>'; + } + $table .= '</table>'; + return $table; +} ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/default.css =================================================================== --- trunk/src/dbpedia-navigator/default.css 2008-01-09 13:42:40 UTC (rev 355) +++ trunk/src/dbpedia-navigator/default.css 2008-01-09 16:32:14 UTC (rev 356) @@ -356,6 +356,20 @@ border: none; } +#positivesboxtitle { + /*color: black;*/ + background-color: lightgreen; +} + +#negativesboxtitle { + /*color: black;*/ + background-color: #ee6666; +} + +#ArticleTitle { + font-size: 110%; +} + #footer { clear: both; text-align: center; Added: trunk/src/dbpedia-navigator/images/green-plus.png =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/green-plus.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/red-minus.png =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/red-minus.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/remove.png =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/remove.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/wikipedia_favicon.ico =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/wikipedia_favicon.ico ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/wikipedia_favicon.png =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/wikipedia_favicon.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-01-09 13:42:40 UTC (rev 355) +++ trunk/src/dbpedia-navigator/index.php 2008-01-09 16:32:14 UTC (rev 356) @@ -63,7 +63,7 @@ </head> <body> -<h1>DBPedia Navigator</h1> +<h1>DBpedia Navigator</h1> <div id="layer" style="display:none"> <div id="layerContent" style="display:none"></div> </div> @@ -74,10 +74,12 @@ <div class="box"> <div class="boxtitle">Search DBpedia</div> <div class="boxcontent" id="search"> - <!-- Search:<br/> --> + <!-- Search:<br/> --> + <form onSubmit="xajax_searchAndShowArticle(document.getElementById('label').value);return false;"> <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=""/> --> + <input type="button" value="Search" class="button" onclick="xajax_searchAndShowArticle(document.getElementById('label').value);return false;" /> + <!-- <input type="button" value="Fulltext" class="button" onclick=""/> --> + </form> </div> <!-- boxcontent --> </div> <!-- box --> @@ -123,9 +125,14 @@ <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="boxtitlewithbutton"><table border="0" class="titletable"><tr><td class="left" id="ArticleTitle">Welcome</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="articlecontent" style="display:block"> + <br /><br /> + Welcome to the DBpedia Navigator interface! DBpedia Navigator allows you to search DBpedia + and uses the background knowledge in DBpedia to suggest possible interesting navigation + links. + </div> <div id="loadingArticle" style="display:none"><img src="ajax-loader.gif" alt="Loading..."/></div> </div> <!-- boxcontent --> </div> <!-- box --> @@ -134,19 +141,19 @@ <div id="rightSidebar"> <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="boxtitlewithbutton" id="positivesboxtitle">search relevant <input type="button" value="Clear" class="button" onclick="xajax_clearPositives();return false;" /></div> <div class="boxcontent" id="Positives"> </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="boxtitlewithbutton" id="negativesboxtitle">not relevant <input type="button" value="Clear" class="button" onclick="xajax_clearNegatives();return false;" /></div> <div class="boxcontent" id="Negatives"> </div> <!-- boxcontent --> </div> <!-- box --> <div class="box"> - <div class="boxtitle">Last Articles</div> + <div class="boxtitle">Articles Last Viewed</div> <div class="boxcontent" id="lastarticles"> </div> <!-- boxcontent --> </div> <!-- box --> @@ -169,8 +176,19 @@ echo '><img src="images/valid-css.png" alt="valid CSS" /></a></div>'."\n"; ?> </div> - <p><a href='clearsession.php'>restart session and redownload WSDL file (for debugging)</a></p> -</div> + <p><a href='clearsession.php'>restart session and redownload WSDL file (for debugging)</a></p> + <p> +ToDo: +<ul> + <li>get learning process working (with new SPARQL component)</li> + <li>get local DBpedia SPARQL endpoint working</li> + <li>many queries work correctly on the server, but yield to response in the interface (seems to be rather random)</li> + <li>fix sometimes occurring PHP errors and warnings</li> +</ul> +</p> +</div> + + </body> </html> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-01-09 13:42:43
|
Revision: 355 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=355&view=rev Author: jenslehmann Date: 2008-01-09 05:42:40 -0800 (Wed, 09 Jan 2008) Log Message: ----------- layout change from absolute to relative layout, added footer, added technology buttons Modified Paths: -------------- trunk/src/dbpedia-navigator/default.css trunk/src/dbpedia-navigator/index.php Added Paths: ----------- trunk/src/dbpedia-navigator/images/sw-owl-green.png trunk/src/dbpedia-navigator/images/sw-sparql-green.png Modified: trunk/src/dbpedia-navigator/default.css =================================================================== --- trunk/src/dbpedia-navigator/default.css 2008-01-09 11:25:03 UTC (rev 354) +++ trunk/src/dbpedia-navigator/default.css 2008-01-09 13:42:40 UTC (rev 355) @@ -10,11 +10,11 @@ margin: 0; padding: 0; } - + html { font: 80%/1.2 "Lucida Grande", Helvetica, Arial, sans-serif; } - + p { margin: 8px 0; } @@ -32,15 +32,21 @@ */ #wrapper { - position: relative; - max-width: 100%; - padding: 15px; + /*position: relative;*/ + max-width: 100%; + padding: 1%; +/* padding: 15px; */ /* margin: 15px;*/ } #content { - margin: 0 19em; - overflow: hidden; + /*margin: 0 19em; + overflow: hidden;*/ + /*width: 10%;*/ + width: 60%; + float: left; + margin-left: 3px; + margin-right: 3px; /* border-left: 1px solid #bbb; border-right: 1px solid #bbb; padding: 0 5px;*/ @@ -53,15 +59,20 @@ * (3) positioning the content div is more straightforward. */ #leftSidebar { - position: absolute; - width: 18em; + /* position: absolute; */ + width: 18%; + min-width: 150px; + float: left; } #rightSidebar { - position: absolute; - width: 18em; - top: 15px; - right: 15px; + /* position: absolute; */ + /*float: right;*/ + width: 18%; + min-width: 150px; + float: left; + /*top: 15px; + right: 15px;*/ } #clear { @@ -335,4 +346,17 @@ #label { margin-bottom: 0.1em; +} + +#article { + min-height: 500px; +} + +#credits { + border: none; +} + +#footer { + clear: both; + text-align: center; } \ No newline at end of file Added: trunk/src/dbpedia-navigator/images/sw-owl-green.png =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/sw-owl-green.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/sw-sparql-green.png =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/sw-sparql-green.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-01-09 11:25:03 UTC (rev 354) +++ trunk/src/dbpedia-navigator/index.php 2008-01-09 13:42:40 UTC (rev 355) @@ -62,12 +62,12 @@ </script> </head> <body> - -<p><a href='clearsession.php'>start from scratch</a></p> + <h1>DBPedia Navigator</h1> <div id="layer" style="display:none"> <div id="layerContent" style="display:none"></div> -</div> +</div> + <div id="wrapper"> <div id="leftSidebar"> @@ -105,16 +105,19 @@ </div> <!-- boxcontent --> </div> <!-- box --> - <div id="validation"> - <?php - $uri = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; + <div class="box" id="credits"> + <p>DBpedia Navigator is powered by ... <br /> + <a href="http://dl-learner.org">DL-Learner</a><br /> + <a href="http//dbpedia.org">DBpedia</a><br/> + <a href="http://virtuoso.openlinksw.com/wiki/main/">OpenLink Virtuoso</a><br /> + ... and implemented by <a href="http://jens-lehmann.org">Jens Lehmann</a> at + the <a href="http:/aksw.org">AKSW</a> research group (University of Leipzig).</p> - 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> + <a href="http://www.w3.org/2004/OWL/"><img src="images/sw-owl-green.png" alt="OWL logo" /></a> + <a href="http://www.w3.org/2001/sw/DataAccess/"><img src="images/sw-sparql-green.png" alt="SPARQL logo"/></a> + </div> + + </div><!-- END leftSidebar --> @@ -150,11 +153,24 @@ </div><!-- rightSidebar --> - <!-- <div id="clear"></div> --> - - + <!-- <div id="clear"></div> --> -</div><!-- wrapper --> +</div><!-- wrapper --> +<div id="footer"> + <p>Licensed under the GNU General Public License (GPL) 3 as part of the DL-Learner open source + project.<br />Copyright © Jens Lehmann 2007-2008 </p> + <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> + <p><a href='clearsession.php'>restart session and redownload WSDL file (for debugging)</a></p> +</div> </body> </html> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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. |
From: <jen...@us...> - 2008-01-09 09:37:12
|
Revision: 353 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=353&view=rev Author: jenslehmann Date: 2008-01-09 01:37:00 -0800 (Wed, 09 Jan 2008) Log Message: ----------- fixed all CSS and HTML validation errors on index page Modified Paths: -------------- trunk/src/dbpedia-navigator/default.css trunk/src/dbpedia-navigator/index.php Modified: trunk/src/dbpedia-navigator/default.css =================================================================== --- trunk/src/dbpedia-navigator/default.css 2008-01-09 09:26:20 UTC (rev 352) +++ trunk/src/dbpedia-navigator/default.css 2008-01-09 09:37:00 UTC (rev 353) @@ -156,10 +156,6 @@ display: block; } -/*.box select { - width: 250px; /* TODO remove absolute size */ -}*/ - .box input { width: auto; } Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-01-09 09:26:20 UTC (rev 352) +++ trunk/src/dbpedia-navigator/index.php 2008-01-09 09:37:00 UTC (rev 353) @@ -70,8 +70,9 @@ <div class="boxtitle">Search</div> <div class="boxcontent" id="search"> Search:<br/> - <input type="textfield" 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=""/> + <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 --> @@ -99,7 +100,7 @@ </div> <!-- boxcontent --> </div> <!-- box --> -<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> +<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"> @@ -111,7 +112,7 @@ </div> <!-- boxcontent --> </div> <!-- box --> -<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> +<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"> @@ -133,7 +134,7 @@ </div> <!-- boxcontent --> </div> <!-- box --> -<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> +<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> @@ -141,10 +142,10 @@ $uri = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; -echo '<a href="http://validator.w3.org/check?uri='.$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>'."\n"; +echo '><img src="images/valid-css.png" alt="valid CSS" /></a></div>'."\n"; ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |