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. |