From: <sk...@us...> - 2007-11-20 08:42:34
|
Revision: 284 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=284&view=rev Author: sknappe Date: 2007-11-20 00:42:28 -0800 (Tue, 20 Nov 2007) Log Message: ----------- deleted old files Modified Paths: -------------- trunk/src/dbpedia-navigator/Ajax-Test/SparqlConnection.php trunk/src/dbpedia-navigator/Ajax-Test/ajax.php trunk/src/dbpedia-navigator/Ajax-Test/ajaxfunctions.php trunk/src/dbpedia-navigator/Ajax-Test/index.php Removed Paths: ------------- trunk/src/dbpedia-navigator/Settings.php trunk/src/dbpedia-navigator/SparqlConnection.php trunk/src/dbpedia-navigator/default.css trunk/src/dbpedia-navigator/index.php trunk/src/dbpedia-navigator/master.php trunk/src/dbpedia-navigator/pear/ Modified: trunk/src/dbpedia-navigator/Ajax-Test/SparqlConnection.php =================================================================== --- trunk/src/dbpedia-navigator/Ajax-Test/SparqlConnection.php 2007-11-12 15:19:23 UTC (rev 283) +++ trunk/src/dbpedia-navigator/Ajax-Test/SparqlConnection.php 2007-11-20 08:42:28 UTC (rev 284) @@ -8,16 +8,29 @@ private $id; private $ksID; - function SparqlConnection($DBPediaUrl,$DLLearnerUri) + 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=$this->client->generateID(); - $this->ksID = $this->client->addKnowledgeSource($this->id, "sparql", $this->DBPediaUrl); + $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); @@ -104,9 +117,9 @@ return array(); } - function getSubjects($ttl,$label='Leipzig',$limit=5) + function getSubjects($ttl,$label) { - $options=array("subjects",$label,$limit); + $options=array("subjects",$label,15); $this->client->startThread($this->id,$this->ksID,$options); $i = 1; $sleeptime = 1; @@ -155,70 +168,7 @@ return array(); } - /*public function testSoapTime() - { - $start = microtime(true); - $this->id=$this->client->generateID(); - $test=$this->client->debug("Test"); - $time=microtime(true)-$start; - return "Word: ".$test." got from SOAP in: ".$time; - }*/ - - public function startSearchAndShowArticle($keyword) - { - //TODO work on $keyword to get white space out - //TODO change article get function - $options=array("triples","http://dbpedia.org/resource/".$keyword); - $this->client->startThread($this->id,$this->ksID,$options); - - $options=array("subjects",$keyword,15); - $this->client->startThread($this->id,$this->ksID,$options); - } - - public function checkSearch($stop) - { - $this->client=new SoapClient("main.wsdl"); - if ($stop){ - $this->client->stopSparqlThread($this->id,$this->ksID,"subjects"); - return; - } - - // 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; - } - return NULL; - } - - public function checkShowArticle($stop) - { - $this->client=new SoapClient("main.wsdl"); - if ($stop){ - $this->client->stopSparqlThread($this->id,$this->ksID,"triples"); - return; - } - - 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; - } - return NULL; - } - public function loadWSDLfiles($wsdluri){ - ini_set("soap.wsdl_cache_enabled","0"); - $main=SparqlConnection::getwsdl($wsdluri); $other=SparqlConnection::getOtherWSDL($main); $newMain=SparqlConnection::changeWSDL($main); Modified: trunk/src/dbpedia-navigator/Ajax-Test/ajax.php =================================================================== --- trunk/src/dbpedia-navigator/Ajax-Test/ajax.php 2007-11-12 15:19:23 UTC (rev 283) +++ trunk/src/dbpedia-navigator/Ajax-Test/ajax.php 2007-11-20 08:42:28 UTC (rev 284) @@ -7,10 +7,7 @@ 'onResponseDelay' => 'showLoadingSubjects', 'beforeResponseProcessing' => 'hideLoadingSubjects' )); -$xajax->register(XAJAX_FUNCTION, 'getarticle', array( - 'onResponseDelay' => 'showLoadingArticle', - 'beforeResponseProcessing' => 'hideLoadingArticle' - )); +$xajax->registerFunction('getarticle'); $xajax->registerFunction('addPositive'); $xajax->registerFunction('addNegative'); $xajax->registerFunction('clearPositives'); @@ -24,9 +21,4 @@ 'beforeResponseProcessing' => 'hideLoadingConceptSubjects' )); $xajax->registerFunction('searchAndShowArticle'); -$xajax->register(XAJAX_FUNCTION, 'showThisSearchResult', array( - 'onResponseDelay' => 'showLoadingSubjects', - 'beforeResponseProcessing' => 'hideLoadingSubjects' - )); -$xajax->registerFunction('showThisArticle'); ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/Ajax-Test/ajaxfunctions.php =================================================================== --- trunk/src/dbpedia-navigator/Ajax-Test/ajaxfunctions.php 2007-11-12 15:19:23 UTC (rev 283) +++ trunk/src/dbpedia-navigator/Ajax-Test/ajaxfunctions.php 2007-11-20 08:42:28 UTC (rev 284) @@ -7,25 +7,25 @@ require("ajax.php"); $xajax->processRequest(); -function getsubjects($label, $limit) +function getsubjects($label) { - include_once("Settings.php"); + require_once("Settings.php"); require_once("SparqlConnection.php"); $settings=new Settings(); - $sc=new SparqlConnection($settings->dbpediauri,$settings->wsdluri); + $sc=new SparqlConnection($settings->dbpediauri,$settings->wsdluri,$_SESSION['id'],$_SESSION['ksID']); $content=""; - $subjects=$sc->getSubjects($settings->sparqlttl,$label,$limit); + $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."');return false;\">".urldecode(substr (strrchr ($subjects, "/"), 1))."</a><br/>"; + else $content.="<a href=\"\" onclick=\"xajax_getarticle('".$subjects."',-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."');return false;\">".urldecode(substr (strrchr ($subject, "/"), 1))."</a><br/>"; + $content.="<a href=\"\" onclick=\"xajax_getarticle('".$subject."',-1);return false;\">".str_replace("_"," ",urldecode(substr (strrchr ($subject, "/"), 1)))."</a><br/>"; } } @@ -34,30 +34,65 @@ return $objResponse; } -function getarticle($subject) +function getarticle($subject,$fromCache) { - include_once("Settings.php"); - require_once("SparqlConnection.php"); - $settings=new Settings(); - $sc=new SparqlConnection($settings->dbpediauri,$settings->wsdluri); - $triples=$sc->getTriples($settings->sparqlttl,$subject); - $content=""; - if (count($triples)==1) - { - $content.=substr($triples,7); - } - else if (count($triples)==0) $content.="Article not found."; - else { + if (isset($_SESSION['articles'])) + foreach ($_SESSION['articles'] as $key => $value) + { + if ($value['subject']==$subject){ + $fromCache=$key; + break; + } + } + if ($fromCache==-1) { + require_once("Settings.php"); + require_once("SparqlConnection.php"); + $settings=new Settings(); + $sc=new SparqlConnection($settings->dbpediauri,$settings->wsdluri,$_SESSION['id'],$_SESSION['ksID']); + $triples=$sc->getTriples($settings->sparqlttl,$subject); $content=""; - $content.="<img src=\"".$triples['http://xmlns.com/foaf/0.1/depiction']."\" alt=\"Picture of ".urldecode(substr (strrchr ($subject, "/"), 1))."\" width=\"50\"/ style=\"float:left\">"; - $content.="<div>".urldecode($triples['http://dbpedia.org/property/abstract'])."</div>"; + if (count($triples)==1) + { + $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>"; + + $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;\" />"; + //store article in session, to navigate between last 5 articles quickly + $contentArray=array('content' => $content,'contentbuttons' => $contentbuttons, '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']; + $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/>"; + } + + //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; } @@ -73,7 +108,7 @@ $_SESSION['positive']=$array; } - $content=urldecode(substr (strrchr ($subject, "/"), 1))."<br/>"; + $content=str_replace("_"," ",urldecode(substr (strrchr ($subject, "/"), 1)))."<br/>"; $objResponse = new xajaxResponse(); $objResponse->append("Positives", "innerHTML", $content); @@ -92,7 +127,7 @@ $_SESSION['negative']=$array; } - $content=urldecode(substr (strrchr ($subject, "/"), 1))."<br/>"; + $content=str_replace("_"," ",urldecode(substr (strrchr ($subject, "/"), 1)))."<br/>"; $objResponse = new xajaxResponse(); $objResponse->append("Negatives", "innerHTML", $content); @@ -124,7 +159,7 @@ require_once("Settings.php"); require_once("SparqlConnection.php"); $settings=new Settings(); - $sc=new SparqlConnection($settings->dbpediauri,$settings->wsdluri); + $sc=new SparqlConnection($settings->dbpediauri,$settings->wsdluri,$_SESSION['id'],$_SESSION['ksID']); $concept=$sc->getConceptFromExamples($settings->sparqlttl,$_SESSION['positive'],$_SESSION['negative']); $_SESSION['lastLearnedConcept']=$concept; @@ -142,7 +177,7 @@ require_once("Settings.php"); require_once("SparqlConnection.php"); $settings=new Settings(); - $sc=new SparqlConnection($settings->dbpediauri,$settings->wsdluri); + $sc=new SparqlConnection($settings->dbpediauri,$settings->wsdluri,$_SESSION['id'],$_SESSION['ksID']); $content=""; if (isset($_SESSION['lastLearnedConcept'])) @@ -151,13 +186,13 @@ if (count($subjects)==1) { if (strpos($subjects,"[Error]")===0) $content.=substr($subjects,7); - else $content.="<a href=\"\" onclick=\"xajax_getarticle('".$subjects."');return false;\">".urldecode(substr (strrchr ($subjects, "/"), 1))."</a><br/>"; + else $content.="<a href=\"\" onclick=\"xajax_getarticle('".$subjects."');return false;\">".str_replace("_"," ",urldecode(substr (strrchr ($subjects, "/"), 1)))."</a><br/>"; } else if (count($subjects)==0) $content.="No examples for concept found in time."; else { foreach ($subjects as $subject) { - $content.="<a href=\"\" onclick=\"xajax_getarticle('".$subject."');return false;\">".urldecode(substr (strrchr ($subject, "/"), 1))."</a><br/>"; + $content.="<a href=\"\" onclick=\"xajax_getarticle('".$subject."');return false;\">".str_replace("_"," ",urldecode(substr (strrchr ($subject, "/"), 1)))."</a><br/>"; } } } @@ -174,111 +209,14 @@ require_once("SparqlConnection.php"); $settings=new Settings(); - $sc=new SparqlConnection($settings->dbpediauri,$settings->wsdluri); + $sc=new SparqlConnection($settings->dbpediauri,$settings->wsdluri,$_SESSION['id'],$_SESSION['ksID']); $content=""; - $sc->startSearchAndShowArticle($keyword); $objResponse = new xajaxResponse(); - $objResponse->call('xajax_showThisArticle', urlencode(serialize($sc)),"http://dbpedia.org/resource/".$keyword); - $objResponse->call('xajax_showThisSearchResult', urlencode(serialize($sc))); + $objResponse->call('xajax_getarticle', "http://dbpedia.org/resource/".str_replace(" ","_",$keyword),-1); + $objResponse->call('xajax_getsubjects',$keyword); return $objResponse; } -function showThisSearchResult($sc) -{ - require_once("Settings.php"); - require_once("SparqlConnection.php"); - $settings=new Settings(); - $sc=unserialize(urldecode($sc)); - $objResponse = new xajaxResponse(); - $i = 1; - $sleeptime = 1; - $searchComplete=false; - do { - if (!$searchComplete) $searchResult=$sc->checkSearch(false); - if (!is_null($searchResult)){ - $searchComplete=true; - break; - } - - $seconds = $i * $sleeptime; - $i++; - - // sleep a while - sleep($sleeptime); - } while ($seconds<$settings->sparqlttl); - - if (!$searchComplete){ - $sc->checkSearch(true); - $objResponse->assign("searchcontent","innerHtml","No search result found in time."); - } - - $content=""; - if (count($searchResult)==1) - { - if (strpos($searchResult,"[Error]")===0) $content.=substr($searchResult,7); - else $content.="<a href=\"\" onclick=\"xajax_getarticle('".$searchResult."');return false;\">".urldecode(substr (strrchr ($searchResult, "/"), 1))."</a><br/>"; - } - else if (count($searchResult)==0) $content.="No search result found in time."; - else{ - foreach ($searchResult as $result) - { - $content.="<a href=\"\" onclick=\"xajax_getarticle('".$result."');return false;\">".urldecode(substr (strrchr ($result, "/"), 1))."</a><br/>"; - } - } - - - $objResponse->assign("searchcontent", "innerHTML", $content); - return $objResponse; -} - -function showThisArticle($sc,$subject) -{ - require_once("Settings.php"); - require_once("SparqlConnection.php"); - $settings=new Settings(); - $sc=unserialize(urldecode($sc)); - $i = 1; - $sleeptime = 1; - $showArticleComplete=false; - do { - if (!$showArticleComplete) $article=$sc->checkShowArticle(false); - if (!is_null($article)){ - $showArticleComplete=true; - break; - } - - $seconds = $i * $sleeptime; - $i++; - - // sleep a while - sleep($sleeptime); - } while ($seconds<$settings->sparqlttl); - - $content=""; - if (!$showArticleComplete){ - $sc->checkShowArticle(true); - } - - - if (count($article)==1) - { - $content.=substr($article,7); - } - else if (count($article)==0) $content.="Article not found."; - else { - $content=""; - $content.="<img src=\"".$article['http://xmlns.com/foaf/0.1/depiction']."\" alt=\"Picture of ".urldecode(substr (strrchr ($subject, "/"), 1))."\" width=\"50\"/ style=\"float:left\">"; - $content.="<div>".urldecode($article['http://dbpedia.org/property/abstract'])."</div>"; - - $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;\" />"; - } - - $objResponse = new xajaxResponse(); - $objResponse->assign("articlecontent", "innerHTML", $content); - $objResponse->assign("contentbuttons", "innerHTML", $contentbuttons); - return $objResponse; -} - ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/Ajax-Test/index.php =================================================================== --- trunk/src/dbpedia-navigator/Ajax-Test/index.php 2007-11-12 15:19:23 UTC (rev 283) +++ trunk/src/dbpedia-navigator/Ajax-Test/index.php 2007-11-20 08:42:28 UTC (rev 284) @@ -1,7 +1,15 @@ <?php ini_set('error_reporting',E_ALL); ini_set('max_execution_time',200); +ini_set("soap.wsdl_cache_enabled","1"); session_start(); +require_once('Settings.php'); +require_once('SparqlConnection.php'); +$settings=new Settings(); +$sc=new SparqlConnection($settings->dbpediauri,$settings->wsdluri); +$ids=$sc->getIDs(); +$_SESSION['id']=$ids[0]; +$_SESSION['ksID']=$ids[1]; echo "<a href='clearsession.php'>start from scratch</a>"; @@ -94,7 +102,7 @@ <div id="content"> <div class="box"> - <div class="boxtitlewithbutton"><table border="0" class="titletable"><tr><td class="left">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">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> @@ -117,6 +125,12 @@ </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> Deleted: trunk/src/dbpedia-navigator/Settings.php =================================================================== --- trunk/src/dbpedia-navigator/Settings.php 2007-11-12 15:19:23 UTC (rev 283) +++ trunk/src/dbpedia-navigator/Settings.php 2007-11-20 08:42:28 UTC (rev 284) @@ -1,7 +0,0 @@ -<?php - -class Settings{ - public $wsdluri="http://localhost:8181/services?wsdl"; - public $dbpediauri="http://dbpedia.openlinksw.com:8890/sparql"; -} -?> \ No newline at end of file Deleted: trunk/src/dbpedia-navigator/SparqlConnection.php =================================================================== --- trunk/src/dbpedia-navigator/SparqlConnection.php 2007-11-12 15:19:23 UTC (rev 283) +++ trunk/src/dbpedia-navigator/SparqlConnection.php 2007-11-20 08:42:28 UTC (rev 284) @@ -1,195 +0,0 @@ -<?php - -require_once 'pear/HTTP_Request.php'; - -class SparqlConnection -{ - private $DBPediaUrl; - private $DLLearnerUri; - private $client; - - function SparqlConnection($DBPediaUrl,$DLLearnerUri) - { - ini_set("soap.wsdl_cache_enabled","0"); - ini_set('default_socket_timeout',200); - $this->DBPediaUrl=$DBPediaUrl; - $this->DLLearnerUri=$DLLearnerUri; - $this->loadWSDLfiles($DLLearnerUri); - $this->client=new SoapClient("main.wsdl"); - } - - function getConceptFromExamples($posExamples,$negExamples) - { - $id=$this->client->generateID(); - - $ksID = $this->client->addKnowledgeSource($id, "sparql", $this->DBPediaUrl); - $this->client->applyConfigEntryInt($id, $ksID, "numberOfRecursions", 2); - $this->client->applyConfigEntryStringArray($id, $ksID, "instances", array_merge($posExamples,$negExamples)); - $this->client->applyConfigEntryInt($id, $ksID, "filterMode", 0); - $this->client->applyConfigEntryStringArray($id, $ksID, "predList", array()); - $this->client->applyConfigEntryStringArray($id, $ksID, "objList", array()); - $this->client->applyConfigEntryStringArray($id, $ksID, "classList", array()); - $this->client->applyConfigEntryString($id, $ksID, "format", "KB"); - $this->client->applyConfigEntryBoolean($id, $ksID, "dumpToFile", true); - - $this->client->setReasoner($id, "dig"); - $this->client->setLearningProblem($id, "posNegDefinition"); - $this->client->setPositiveExamples($id, $posExamples); - $this->client->setNegativeExamples($id, $negExamples); - $this->client->setLearningAlgorithm($id, "refinement"); - - $start = microtime(true); - - $this->client->init($id); - - $learn_start = microtime(true); - $init = $learn_start - $start; - echo 'components initialised in '.$init.' seconds<br />'; - - $threaded=true; - - if($threaded == false) { - - $concept = $this->client->learn($id); - - $learn = microtime(true) - $learn_start; - echo 'concept learned in '.$learn.' seconds<br />'; - - echo 'result: '.$concept; - - } else { - - $this->client->learnThreaded($id); - - $i = 1; - $sleeptime = 1; - - do { - // sleep a while - sleep($sleeptime); - - // see what we have learned so far - $concept=$this->client->getCurrentlyBestConcept($id); - $running=$this->client->isAlgorithmRunning($id); - - $seconds = $i * $sleeptime; - - echo 'result after '.$seconds.' seconds of sleep: '.$concept.'<br />'; - - $i++; - } while($running); - - echo 'algorithm finished'; - } - return $concept; - } - - function getTriples($individual) - { - $id=$this->client->generateID(); - - $ksID = $this->client->addKnowledgeSource($id, "sparql", $this->DBPediaUrl); - $this->client->applyConfigEntryInt($id, $ksID, "numberOfRecursions", 1); - $this->client->applyConfigEntryStringArray($id, $ksID, "instances", array($individual)); - $this->client->applyConfigEntryInt($id, $ksID, "filterMode", -1); - $this->client->applyConfigEntryStringArray($id, $ksID, "predList", array()); - $this->client->applyConfigEntryStringArray($id, $ksID, "objList", array()); - $this->client->applyConfigEntryStringArray($id, $ksID, "classList", array()); - $this->client->applyConfigEntryString($id, $ksID, "format", "Array"); - $this->client->applyConfigEntryBoolean($id, $ksID, "dumpToFile", false); - $this->client->applyConfigEntryBoolean($id,$ksID,"useLits",true); - - $object=$this->client->getTriples($id,$ksID); - $array=$object->item; - $ret=array(); - foreach ($array as $element) - { - $items=preg_split("[<]",$element,-1, PREG_SPLIT_NO_EMPTY); - $ret[]=$items; - } - - return $ret; - } - - function getSubjects($label,$limit) - { - $id=$this->client->generateID(); - - $ksID = $this->client->addKnowledgeSource($id, "sparql", $this->DBPediaUrl); - $object=$this->client->getSubjects($id,$ksID,$label,$limit); - return $object->item; - } - - private function loadWSDLfiles($wsdluri){ - $main=$this->getwsdl($wsdluri); - $other=$this->getOtherWSDL($main); - $newMain=$this->changeWSDL($main); - $this->writeToFile("main.wsdl",$newMain); - $x=0; - foreach ($other as $o){ - $this->writeToFile("def".($x++).".xsd",$this->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/default.css =================================================================== --- trunk/src/dbpedia-navigator/default.css 2007-11-12 15:19:23 UTC (rev 283) +++ trunk/src/dbpedia-navigator/default.css 2007-11-20 08:42:28 UTC (rev 284) @@ -1,453 +0,0 @@ -/** - * default.css - * main Ontowiki style sheet - * @author: Norman Heino - * @version: $Id: default.css 751 2007-02-14 19:20:17Z nheino $ - */ - -/* remove browser specific margins */ -* { - margin: 0; - padding: 0; -} - -html { - font: 80%/1.2 "Lucida Grande", Helvetica, Arial, sans-serif; -} - -p { - margin: 8px 0; -} - -h2 { - margin: 0.5em 0 0.1em 0; -/* background-color: #eee;*/ - font-size: 110%; -} - - -/* - * Main site structure - */ - -#wrapper { - position: relative; - max-width: 100%; - padding: 15px; -/* margin: 15px;*/ -} - -#content { - margin: 0 19em; - overflow: hidden; -/* border-left: 1px solid #bbb; - border-right: 1px solid #bbb; - padding: 0 5px;*/ -} - -/* - * Side bars are positioned absolutely due to several reasons: - * (1)Internet Explorer has problems displaying float elements, - * (2) the content's position in html is irrelevant, - * (3) positioning the content div is more straightforward. - */ -#leftSidebar { - position: absolute; - width: 18em; -} - -#rightSidebar { - position: absolute; - width: 18em; - top: 15px; - right: 15px; -} - -#clear { - clear: both; -} - - -/* - * sidebar content (boxes) - */ - -.box { - color: #666; - margin-bottom: 20px; - border: 1px solid #bbb; - font-size: 85%; -} - -/*.box td { - font-size: 100%; -}*/ - -.box .boxtitle { - color: #666; - background-color: #eee; - padding: 3px 0.4em; - font-weight: bold; - white-space: nowrap; -} - -.box .boxtitle .boxtitle_string { - width: 80%; - overflow: hidden; -/* display: none;*/ -} - -.box .boxcontent { - padding: 0.6em; - border-top: 1px solid #bbb; -} - -/* restrict content of certain boxes */ -.box#predicates .boxcontent, -.box#classes .boxcontent { - overflow: hidden; -} - -.box p { - margin: 0 2px 4px 0; -} - -.box ul, .box ol { - margin: 0px; -/* padding-left: 15px;*/ - list-style-position: inside; -} - -.box ul.no_bullet, .box ul.no_bullet { - list-style-type: none; -} - -.box ul li.horizontal, .box ol li.horizontal, -.box ul.horizontal, .box ol.horizontal { - display: inline; -} - -.box a.title_switch { - position: absolute; - right: 0.5em; - margin: auto 0; - color: #666; - border: 1px solid #bbb; - width: 1em; - height: 1em; - background-color: #fff; - text-align: center; -} - -.box a.title_switch:hover { - color: #02a; - text-decoration: none; - background-color: #eee; -} - -.box hr { - margin: 0.5em 0; - border: none; - border-top: 1px dotted #bbb; - height: 0; -} - -.box#classes .boxcontent a { - display: block; -} - -/*.box select { - width: 250px; /* TODO remove absolute size */ -}*/ - -.box input { - width: auto; -} - -.box td input { - width: 100%; -} - -.box img.rating { - position: relative; - top: 1px; -} - -.hidden { - display: none; -} - - -/* - * Links - */ - -a, a:link, a:visited { - color: #02a; - text-decoration: none; - cursor: pointer; -} - -a:hover { - text-decoration: underline; -} - - -/* - * Tabs - */ - -/* all the tabs */ -.tabs { - float: left; - width: 100%; - background: #fff url("../images/tabs_back.png") repeat-x bottom; -} - -.tabs ul { - list-style: none; -} - -.tabs li { - float: left; - margin-right: 1px; -} - -.tabs a { - display: block; - margin-top: 1px; - padding: 0.35em 1.35em; - background-image: url("../images/tab_back.png"); - background-repeat: repeat-x; - background-color: #cbcbcb; - border: 1px solid #bbb; -} - -.tabs a:hover { - background: #fff; - text-decoration: none; -} - -.tabs a.current { - background: #fff; - border-bottom: 1px solid #fff; -} - -/* horizontal line underneath the tabs */ -#tab-line { - height: 1em; - clear: both; -} - -#instances { - float: right; -} - -.selected { - background-color: #bde; /*#b4d5fe;*/ -} - -.button { - border: solid black 1px; - padding: 0px 1px; - background-color: #eee; -} - -/* - * Tables - */ - -tr.odd { - background-color: #ccc; -} - -tr.even { - background-color: #eee; -} - -table.instanceTable th { - text-align: left; -/* background-color: #eee;*/ -} - -table.instanceTable > tbody > tr > td { - padding-top: 0.5em; -} - -table.instanceTable td.property { - text-align: right; - font-style: italic; - padding-right: 5px; -} - -table.instanceTable ul { - margin: 0px; - padding-left: 20px; -} - -table.instanceTable { - width: 100%; -} - -.searchHighlight { - background-color: orange; -} - -table.tripletable { - width: 100%; - font-size: 90%; -} - -.tripletable td { - padding: 0.4em; -} - -table.blind tr td { - padding-top: 0.4em; -} - -/* - * Instances - */ - -.instance .instance { - margin-left: 13px; - background-color: #ddd; -} -.instance .instance td { - font-size: 90%; -} -.instance .instance .instance { - background-color: #eee; -} - -.instance .instance .instance .instance { - background-color: #fff; -} - -#instanceEdit { - border-spacing: 0px; - width: 100%; -} - -#instanceEdit input, #instanceEdit textarea { -/* width: 250px;*/ - background-color: #fff; - font-size: 95%; - font-family: "Lucida Grande", Helvetica, Arial, sans-serif; - padding: 0.1em 0; -} - -#instanceEdit > tbody > tr > td, #instanceEdit > tr > td { - background-color: #eee; - padding: 5px; - border-bottom: 2px solid #fdfdfd; -} - -/* - * Calendar - */ - -table.calendar { - margin-top: 1em; - width: 100%; - height: 730px; - table-layout: fixed; - font-size: 90%; -} - -.calendar .weekday0 { - background-color: #eee; - padding: 0.4em; -} -.calendar .weekday1 { - background-color: #f5f5f5; - padding: 0.4em; -} -.calendar .weekend0 { - background-color: #ddd; - padding: 0.4em; -} -.calendar .weekend1 { - background-color: #eaeaea; - padding: 0.4em; -} - -#map { - margin-top: 0.5em; - width: 100%; - height: 750px; - font-size: 90%; -} - -#map .instance td { - font-size: 80%; - padding: 0 3px; - border-bottom: 5px solid white; -} - -#superClassPath { - margin-bottom: 0.5em; -} - -img { - border: none; -} - -span.submit { - float: right; - padding-right: 100px; -} - -/* - * Autosuggest box - */ -div.autosuggest { - font-size: 85%; - position: absolute; - background-color: #fff; - border: 1px solid #bbb; -} - -div.autosuggest ul { - list-style-type: none; - list-style-position: inside; - padding-left: 0px; -} - -div.autosuggest ul li.selected { - background-color: #bde; -} - -div.autosuggest ul li { - display: block; - padding: 0.2em; -/* height: 22px;*/ - cursor: pointer; -} - -span.formal { - display: none; -} - -/* - * Layer - */ -#layer { - width: 100%; - height: 100%; - position: absolute; - background-image: url("../images/black_50.png"); - background-repeat: repeat; - z-index: 98; -} - -#layerContent { - margin-top: 100px; - margin: auto; - width: 500px; - height: 300px; - background-color: #ffb; - border: 2px solid #bbb; - z-index: 99; -} Deleted: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2007-11-12 15:19:23 UTC (rev 283) +++ trunk/src/dbpedia-navigator/index.php 2007-11-20 08:42:28 UTC (rev 284) @@ -1,190 +0,0 @@ -<?php - -@session_start(); - -include_once("Settings.php"); -include_once("SparqlConnection.php"); - - ini_set('error_reporting',E_ALL); - ini_set('max_execution_time',200); - -//clear session -echo "<a href='index.php?clearsession=clear'>start from scratch</a>"; -if(isset($_GET['clearsession'])){ - session_unset(); -} - -//initialize variables -$content=""; -$positiveAdd=""; -$negativeAdd=""; - -//initialize the sparql connection -$settings=new Settings(); -$sc=new SparqlConnection($settings->dbpediauri,$settings->wsdluri); - - -//add positives or negatives to session -if (@$_GET['action']=='AddPositive'){ - $_GET=$_SESSION["lastGet"]; - $content=$_SESSION['lastContent']; - if (!isset($_SESSION['positive'])){ - $array=array($_GET['subject']); - $_SESSION['positive']=$array; - } - else{ - $array=$_SESSION['positive']; - $array[]=$_GET['subject']; - $_SESSION['positive']=$array; - } -} -if (@$_GET['action']=='AddNegative'){ - $_GET=$_SESSION["lastGet"]; - $content=$_SESSION['lastContent']; - if (!isset($_SESSION['negative'])){ - $array=array($_GET['subject']); - $_SESSION['negative']=$array; - } - else{ - $array=$_SESSION['negative']; - $array[]=$_GET['subject']; - $_SESSION['negative']=$array; - } -} - -//delete Positives or Negatives from Session -if (@$_GET['action']=='ClearPositive'){ - $_GET=$_SESSION["lastGet"]; - $content=$_SESSION['lastContent']; - unset($_SESSION['positive']); -} -if (@$_GET['action']=='ClearNegative'){ - $_GET=$_SESSION["lastGet"]; - $content=$_SESSION['lastContent']; - unset($_SESSION['negative']); -} - -//learn a concept -if (@$_GET['action']=="GetConcept") -{ - $_GET=$_SESSION["lastGet"]; - $content=$_SESSION['lastContent']; - $conc=$sc->getConceptFromExamples($_SESSION['positive'],$_SESSION['negative']); - $_SESSION['learnedConcept']=$conc; -} - -//Get Search result -if (@$_GET['action']=='Search') -{ - $label=$_GET['search']; - $limit=$_GET['limit']; - $_GET=$_SESSION["lastGet"]; - $content=$_SESSION['lastContent']; - $subjects=$sc->getSubjects($label,$limit); - $_SESSION['lastSubjectSearch']=$subjects; -} - -//SearchBox - $search="<form action=\"index.php\" method=\"GET\">\n". - "<table border=\"0\">\n". - "<tr><tb>Search:<br/></tb></tr>\n". - "<tr><tb><input type=\"textfield\" name=\"search\"><select name=\"limit\" size=\"1\">\n". - "<option>1</option>\n". - "<option selected=\"selected\">5</option>\n". - "<option>10</option>\n". - "<option>15</option>\n". - "</select><br/></tb></tr>\n". - "<tr><tb><input type=\"submit\" name=\"action\" value=\"Search\"><input type=\"submit\" name=\"action\" value=\"Fulltext\"></tb></tr>\n". - "</table>\n". - "</form>\n"; - - -if (isset($_SESSION['learnedConcept'])) $learnedConc="<br/>Last learned Concept: ".$_SESSION['learnedConcept']; -else $learnedConc=""; - -if (isset($_SESSION['lastSubjectSearch'])){ - $search.="<br/>Last Search:<br/><br/>\n"; - $subjects=$_SESSION['lastSubjectSearch']; - foreach ($subjects as $subject){ - $search.="<a href=\"index.php?action=showPage&subject=".$subject."\">".$subject."</a><br/>\n"; - } -} - -//Show Subject Page -if ((@$_GET['action']=="showPage")&&($content==="")) -{ - $triples=$sc->getTriples($_GET['subject']); - foreach ($triples as $triple){ - $content.="Subject: ".urldecode($triple[0])."<br/>Predicate: ".urldecode($triple[1])."<br/>Object: ".urldecode($triple[2])."<br/><br/>\n"; - } -} - -//if an articel is shown, you can add it to Positives or Negatives -if (@$_GET['action']=="showPage") -{ - $positiveAdd="<input type=\"submit\" name=\"action\" value=\"AddPositive\">"; - $negativeAdd="<input type=\"submit\" name=\"action\" value=\"AddNegative\">"; -} - -//add box for adding articles to positive or negative -$examples="<form action=\"index.php\" method=\"GET\">\n". - "Positive:<br/>\n"; -if (!isset($_SESSION['positive'])) $examples.="No positive example picked yet.<br/>\n"; -else{ - $pos=$_SESSION['positive']; - foreach ($pos as $p) - { - $examples.=$p."<br/>\n"; - } -} -$examples.="<br/>".$positiveAdd." <input type=\"submit\" name=\"action\" value=\"ClearPositive\">\n". - "</form>\n"; - -$examples.="<form action=\"index.php\" method=\"GET\">\n". - "<br/>Negative:<br/>\n"; -if (!isset($_SESSION['negative'])) $examples.="No negative example picked yet.<br/>\n"; -else{ - $neg=$_SESSION['negative']; - foreach ($neg as $n) - { - $examples.=$n."<br/>\n"; - } -} -$examples.="<br/>".$negativeAdd." <input type=\"submit\" name=\"action\" value=\"ClearNegative\">\n". - "</form>\n"; - - -//fill concept box -$concept="<form action=\"index.php\" method=\"GET\">\n". - "<input type=\"submit\" name=\"action\" value=\"GetConcept\">\n". - "</form>\n"; -$concept.=$learnedConc; - - -$_SESSION['lastGet']=$_GET; -$_SESSION['lastContent']=$content; -//include master -include("master.php"); - -echo $masterContent; - - -//make a box -function makeBox($title,$content,$toggleBoxContent=true) -{ - if($toggleBoxContent) - { - $click="<a class=\"title_switch\" onclick=\"toggleBoxContent(this);\">\x96</a>"; - } - else{$click="";} - - $ret=" - <div class=\"box\" id=\"ontology\"> - <div class=\"boxtitle\">".$title.$click."</div> - <div class=\"boxcontent\"> - ".$content." - </div> <!-- boxcontent --> - </div> <!-- box -->"; - return $ret; -} -?> \ No newline at end of file Deleted: trunk/src/dbpedia-navigator/master.php =================================================================== --- trunk/src/dbpedia-navigator/master.php 2007-11-12 15:19:23 UTC (rev 283) +++ trunk/src/dbpedia-navigator/master.php 2007-11-20 08:42:28 UTC (rev 284) @@ -1,71 +0,0 @@ -<?php - -$masterContent=" - - -<html> - <head> - <title>DL Learner</title> - <meta http-equiv=\"content-type\" content=\"text/html; charset=ISO-8859-1\"/> - <link rel=\"stylesheet\" href=\"default.css\"/> - </head> - <body> -<script type=\"text/javascript\" src=\"jscript/wz_tooltip.js\"></script> -<script type=\"text/javascript\" src=\"jscript/scripts.js\"></script> -<h3>DBPedia-Navigator-Test</h3> -<div id=\"layer\" style=\"display:none\"><div id=\"layerContent\" style=\"display:none\"></div></div> -<div id=\"wrapper\"> - -<div id=\"leftSidebar\"> - -<div class=\"box\" id=\"search\"> - <div class=\"boxtitle\">Search<a class=\"title_switch\" onclick=\"toggleBoxContent(this);\">\x96</a></div> - <div class=\"boxcontent\"> - ".$search." - </div> <!-- boxcontent --> - -</div> <!-- box --> - -<div class=\"box\" id=\"examples\"> - <div class=\"boxtitle\">Examples<a class=\"title_switch\" onclick=\"toggleBoxContent(this);\">\x96</a></div> - <div class=\"boxcontent\"> - ".$examples." - </div> <!-- boxcontent --> - -</div> <!-- box --> - -<div class=\"box\" id=\"examples\"> - <div class=\"boxtitle\">Concept<a class=\"title_switch\" onclick=\"toggleBoxContent(this);\">\x96</a></div> - <div class=\"boxcontent\"> - ".$concept." - </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><!-- END leftSidebar --> - -<div id=\"content\"> -<div class=\"box\" id=\"search\"> - <div class=\"boxtitle\">Content</div> - <div class=\"boxcontent\"> - ".$content." - </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\"> - -<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><!-- wrapper --> - - </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. |