From: <sk...@us...> - 2008-02-05 15:59:49
|
Revision: 497 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=497&view=rev Author: sknappe Date: 2008-02-05 07:59:48 -0800 (Tue, 05 Feb 2008) Log Message: ----------- now everything is in one function, no session variables needed anymore Modified Paths: -------------- trunk/src/dbpedia-navigator/ajax.php trunk/src/dbpedia-navigator/ajaxfunctions.php trunk/src/dbpedia-navigator/index.php Modified: trunk/src/dbpedia-navigator/ajax.php =================================================================== --- trunk/src/dbpedia-navigator/ajax.php 2008-02-05 15:39:08 UTC (rev 496) +++ trunk/src/dbpedia-navigator/ajax.php 2008-02-05 15:59:48 UTC (rev 497) @@ -4,35 +4,28 @@ $xajax = new xajax("ajaxfunctions.php?sid=$sid"); $xajax->configureMany(array('debug'=>true)); -$xajax->register(XAJAX_FUNCTION, 'showSubjects', array( + +$xajax->register(XAJAX_FUNCTION, 'getsubjects', array( 'onResponseDelay' => 'showLoading', 'beforeResponseProcessing' => 'hideLoading' )); -$xajax->registerFunction('getarticle'); -$xajax->registerFunction('toPositive'); -$xajax->registerFunction('toNegative'); -$xajax->registerFunction('clearPositives'); -$xajax->registerFunction('clearNegatives'); -$xajax->registerFunction('showInterests'); -$xajax->registerFunction('getAndShowArticle'); -$xajax->registerFunction('learnConcept'); -$xajax->registerFunction('getSubjectsFromConcept'); -$xajax->registerFunction('getAndShowSubjects'); -$xajax->registerFunction('getsubjects'); -$xajax->register(XAJAX_FUNCTION,'showArticle', array( +$xajax->register(XAJAX_FUNCTION,'getarticle', array( 'onResponseDelay' => 'showLoading', 'beforeResponseProcessing' => 'hideLoading' )); -$xajax->registerFunction('removePosInterest'); -$xajax->registerFunction('removeNegInterest'); -$xajax->register(XAJAX_FUNCTION,'showConcept', array( +$xajax->register(XAJAX_FUNCTION,'learnConcept', array( 'onResponseDelay' => 'showLoading', 'beforeResponseProcessing' => 'hideLoading' )); -$xajax->registerFunction('learnAndShowConcept'); -$xajax->register(XAJAX_FUNCTION,'showSubjectsFromConcept', array( +$xajax->register(XAJAX_FUNCTION,'getSubjectsFromConcept', array( 'onResponseDelay' => 'showLoading', 'beforeResponseProcessing' => 'hideLoading' )); -$xajax->registerFunction('getAndShowSubjectsFromConcept'); + $xajax->registerFunction('toPositive'); +$xajax->registerFunction('toNegative'); +$xajax->registerFunction('clearPositives'); +$xajax->registerFunction('clearNegatives'); +$xajax->registerFunction('showInterests'); +$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-02-05 15:39:08 UTC (rev 496) +++ trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-02-05 15:59:48 UTC (rev 497) @@ -21,29 +21,17 @@ foreach ($subjects as $subject) { - $content.="<a href=\"\" onclick=\"xajax_getAndShowArticle('".urldecode(str_replace("_"," ",substr (strrchr ($subject, "/"), 1)))."',-2);return false;\">".urldecode(str_replace("_"," ",substr (strrchr ($subject, "/"), 1)))."</a><br/>"; + $content.="<a href=\"\" onclick=\"xajax_getarticle('".urldecode(str_replace("_"," ",substr (strrchr ($subject, "/"), 1)))."',-2);return false;\">".urldecode(str_replace("_"," ",substr (strrchr ($subject, "/"), 1)))."</a><br/>"; } } catch (Exception $e){ $content=$e->getMessage(); } - $_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 article is in session, get it out of the session @@ -143,7 +131,7 @@ //BUILD SEARCHRESULT if ($fromCache==-1) - $searchResult.="<a href=\"\" onclick=\"xajax_getAndShowSubjects('".$subject."');return false;\">Show more Results</a>"; + $searchResult.="<a href=\"\" onclick=\"xajax_getsubjects('".$subject."');return false;\">Show more Results</a>"; } catch (Exception $e) { $content=$e->getMessage(); @@ -160,49 +148,20 @@ if (isset($_SESSION['articles'])){ foreach ($_SESSION['articles'] as $key => $value) { - $lastArticles.="<a href=\"\" onclick=\"xajax_getAndShowArticle('',".$key.");return false;\">".$value['subject']."</a><br/>"; + $lastArticles.="<a href=\"\" onclick=\"xajax_getarticle('',".$key.");return false;\">".$value['subject']."</a><br/>"; } } - //put whole site content into session - $_SESSION['artContent']=$content; - $_SESSION['artTitle']=$artTitle; - $_SESSION['artLast']=$lastArticles; - $_SESSION['artSubjects']=$searchResult; - $objResponse = new xajaxResponse(); + $objResponse->assign("articlecontent", "innerHTML", $content); + $objResponse->assign("ArticleTitle","innerHTML",$artTitle); + $objResponse->assign("lastarticles","innerHTML",$lastArticles); + $objResponse->assign("searchcontent", "innerHTML", $searchResult); + + $objResponse->call('xajax_showInterests'); return $objResponse; } -function showArticle() -{ - 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']); - 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']); - unset($_SESSION['artSubjects']); - - $objResponse->call('xajax_showInterests'); - return $objResponse; -} - -function getAndShowArticle($subject,$fromCache) -{ - $objResponse = new xajaxResponse(); - $objResponse->call('xajax_getarticle',$subject,$fromCache); - $objResponse->call('xajax_showArticle'); - return $objResponse; -} - function toPositive($subject) { unset($_SESSION['negative'][$subject]); @@ -315,15 +274,14 @@ $_SESSION['lastLearnedConcept']=$concepts; $concept.="<table border=0>\n"; foreach ($concepts as $con){ - $concept.="<tr><td><a href=\"\" onclick=\"xajax_getAndShowSubjectsFromConcept('".$con."');return false;\" />".$con."</a></td></tr>"; + $concept.="<tr><td><a href=\"\" onclick=\"xajax_getSubjectsFromConcept('".$con."');return false;\" />".$con."</a></td></tr>"; } $concept.="</table>"; } else $concept="You must choose at least one positive example."; - $_SESSION['conceptcontent']=$concept; - $objResponse = new xajaxResponse(); + $objResponse->assign("conceptlink", "innerHTML", $concept); return $objResponse; } @@ -336,65 +294,17 @@ $subjects=$sc->getSubjectsFromConcept($concept); foreach ($subjects as $subject) { - $content.="<a href=\"\" onclick=\"xajax_getAndShowArticle('".urldecode(str_replace("_"," ",substr (strrchr ($subject, "/"), 1)))."',-2);return false;\">".urldecode(str_replace("_"," ",substr (strrchr ($subject, "/"), 1)))."</a><br/>"; + $content.="<a href=\"\" onclick=\"xajax_getarticle('".urldecode(str_replace("_"," ",substr (strrchr ($subject, "/"), 1)))."',-2);return false;\">".urldecode(str_replace("_"," ",substr (strrchr ($subject, "/"), 1)))."</a><br/>"; } } catch (Exception $e){ $content=$e->getMessage(); } - $_SESSION['conceptsubjectcontent']=$content; $objResponse = new xajaxResponse(); + $objResponse->assign("searchcontent", "innerHTML", $content); return $objResponse; } -function getAndShowSubjects($keyword) -{ - $objResponse = new xajaxResponse(); - $objResponse->call('xajax_getsubjects',$keyword); - $objResponse->call('xajax_showSubjects'); - return $objResponse; -} - -function learnAndShowConcept() -{ - $objResponse = new xajaxResponse(); - $objResponse->call('xajax_learnConcept'); - $objResponse->call('xajax_showConcept'); - return $objResponse; -} - -function showConcept() -{ - while (!isset($_SESSION['conceptcontent'])){ - sleep(0.5); - } - - $objResponse = new xajaxResponse(); - $objResponse->assign("conceptlink", "innerHTML", $_SESSION['conceptcontent']); - unset($_SESSION['conceptcontent']); - return $objResponse; -} - -function getAndShowSubjectsFromConcept($concept) -{ - $objResponse = new xajaxResponse(); - $objResponse->call('xajax_getSubjectsFromConcept',$concept); - $objResponse->call('xajax_showSubjectsFromConcept'); - return $objResponse; -} - -function showSubjectsFromConcept() -{ - while (!isset($_SESSION['conceptsubjectcontent'])){ - sleep(0.5); - } - - $objResponse = new xajaxResponse(); - $objResponse->assign("searchcontent", "innerHTML", $_SESSION['conceptsubjectcontent']); - unset($_SESSION['conceptsubjectcontent']); - return $objResponse; -} - /////////////////////// // Helper Functions. // /////////////////////// Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-02-05 15:39:08 UTC (rev 496) +++ trunk/src/dbpedia-navigator/index.php 2008-02-05 15:59:48 UTC (rev 497) @@ -42,7 +42,7 @@ <body> <!-- <h1>DBpedia Navigator</h1> --> -<div><img src="images/dbpedia_navigator.png" alt="DBpedia Navigator" style="padding:5px" /> <input type="button" value="Learn" class="button" onclick="xajax_learnAndShowConcept();return false;" /> <span id="conceptlink"></span><span id="Loading" style="display:none">Loading...</span></div> +<div><img src="images/dbpedia_navigator.png" alt="DBpedia Navigator" style="padding:5px" /> <input type="button" value="Learn" class="button" onclick="xajax_learnConcept();return false;" /> <span id="conceptlink"></span><span id="Loading" style="display:none">Loading...</span></div> <div id="layer" style="display:none"> <div id="layerContent" style="display:none"></div> </div> @@ -54,9 +54,9 @@ <div class="boxtitle">Search DBpedia</div> <div class="boxcontent" id="search"> <!-- Search:<br/> --> - <form onSubmit="xajax_getAndShowArticle(document.getElementById('label').value,-1);return false;"> + <form onSubmit="xajax_getarticle(document.getElementById('label').value,-1);return false;"> <input type="text" name="label" id="label" /><br/> - <input type="button" value="Search" class="button" onclick="xajax_getAndShowArticle(document.getElementById('label').value,-1);return false;" /> + <input type="button" value="Search" class="button" onclick="xajax_getarticle(document.getElementById('label').value,-1);return false;" /> <!-- <input type="button" value="Fulltext" class="button" onclick=""/> --> </form> </div> <!-- boxcontent --> @@ -66,7 +66,6 @@ <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 --> @@ -96,7 +95,6 @@ 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 --> </div><!-- content --> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-02-06 14:46:52
|
Revision: 499 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=499&view=rev Author: sknappe Date: 2008-02-06 06:46:49 -0800 (Wed, 06 Feb 2008) Log Message: ----------- You now have the chance to abort the current server call Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/ajax.php trunk/src/dbpedia-navigator/ajaxfunctions.php trunk/src/dbpedia-navigator/index.php Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-02-06 14:41:42 UTC (rev 498) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-02-06 14:46:49 UTC (rev 499) @@ -85,6 +85,15 @@ $seconds = $i * $sleeptime; $i++; + + //look, if algorithm was stopped + $file=fopen($this->id.".temp","r"); + $run=fgets($file); + fclose($file); + if ($run=="false"){ + $this->client->stop($this->id); + throw new Exception("Learning stopped"); + } } while($seconds<$this->ttl&&$running); $this->client->stop($this->id); @@ -115,7 +124,6 @@ $running=true; $i = 1; $sleeptime = 1; - do { // sleep a while sleep($sleeptime); @@ -129,6 +137,14 @@ $seconds = $i * $sleeptime; $i++; + //look, if algorithm was stopped + $file=fopen($this->id.".temp","r"); + $run=fgets($file); + fclose($file); + if ($run=="false"){ + $this->client->stopSparqlQuery($id,$queryID); + throw new Exception("Query stopped"); + } } while($seconds<$this->ttl); $this->client->stopSparqlQuery($id,$queryID); } Modified: trunk/src/dbpedia-navigator/ajax.php =================================================================== --- trunk/src/dbpedia-navigator/ajax.php 2008-02-06 14:41:42 UTC (rev 498) +++ trunk/src/dbpedia-navigator/ajax.php 2008-02-06 14:46:49 UTC (rev 499) @@ -28,4 +28,5 @@ $xajax->registerFunction('showInterests'); $xajax->registerFunction('removePosInterest'); $xajax->registerFunction('removeNegInterest'); +$xajax->registerFunction('stopServerCall'); ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/ajaxfunctions.php =================================================================== --- trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-02-06 14:41:42 UTC (rev 498) +++ trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-02-06 14:46:49 UTC (rev 499) @@ -1,22 +1,26 @@ <?php ini_set('max_execution_time',200); -$sid = $_GET['sid']; -session_id($sid); -session_start(); require("ajax.php"); $xajax->processRequest(); function getsubjects($label) { - require_once("DLLearnerConnection.php"); + $sid = $_GET['sid']; + session_id($sid); + session_start(); + $id=$_SESSION['id']; + $ksID=$_SESSION['ksID']; + session_write_close(); + setRunning($id,"true"); + //initialise content $content=""; try{ - $sc=new DLLearnerConnection($_SESSION['id'],$_SESSION['ksID']); - - + require_once("DLLearnerConnection.php"); + $sc=new DLLearnerConnection($id,$ksID); + $subjects=$sc->getSubjects($label); foreach ($subjects as $subject) @@ -34,9 +38,18 @@ function getarticle($subject,$fromCache) { + $sid = $_GET['sid']; + session_id($sid); + session_start(); + $articles=$_SESSION['articles']; + $id=$_SESSION['id']; + $ksID=$_SESSION['ksID']; + session_write_close(); + setRunning($id,"true"); + //if article is in session, get it out of the session - if (isset($_SESSION['articles'])){ - foreach ($_SESSION['articles'] as $key => $value) + if (isset($articles)){ + foreach ($articles as $key => $value) { if ($value['subject']==$subject){ $fromCache=$key; @@ -59,7 +72,7 @@ //if there are errors see catch block try{ require_once("DLLearnerConnection.php"); - $sc=new DLLearnerConnection($_SESSION['id'],$_SESSION['ksID']); + $sc=new DLLearnerConnection($id,$ksID); $triples=$sc->getTriples($subject); //BUILD ARTICLE @@ -68,7 +81,7 @@ // 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'][0].'" 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.'" style="float:right; max-width:200px;" \>'; // add short description in english $content.="<h4>Short Description</h4><p>".urldecode($triples['http://dbpedia.org/property/abstract'][0])."</p>"; @@ -131,7 +144,8 @@ //BUILD SEARCHRESULT if ($fromCache==-1) - $searchResult.="<a href=\"\" onclick=\"xajax_getsubjects('".$subject."');return false;\">Show more Results</a>"; + $searchResult.="<a href=\"\" onclick=\"xajax_getsubjects('".$subject."');return false;\">Show more Results</a>"; + } catch (Exception $e) { $content=$e->getMessage(); @@ -164,6 +178,9 @@ function toPositive($subject) { + $sid = $_GET['sid']; + session_id($sid); + session_start(); unset($_SESSION['negative'][$subject]); if (!isset($_SESSION['positive'])){ $array=array($subject => $subject); @@ -182,6 +199,9 @@ function toNegative($subject) { + $sid = $_GET['sid']; + session_id($sid); + session_start(); unset($_SESSION['positive'][$subject]); if (!isset($_SESSION['negative'])){ $array=array($subject => $subject); @@ -200,6 +220,9 @@ function clearPositives() { + $sid = $_GET['sid']; + session_id($sid); + session_start(); unset($_SESSION['positive']); $objResponse = new xajaxResponse(); @@ -209,6 +232,9 @@ function clearNegatives() { + $sid = $_GET['sid']; + session_id($sid); + session_start(); unset($_SESSION['negative']); $objResponse = new xajaxResponse(); @@ -218,6 +244,9 @@ function showInterests() { + $sid = $_GET['sid']; + session_id($sid); + session_start(); //add Positives and Negatives to Interests $posInterests=""; if (isset($_SESSION['positive'])) foreach($_SESSION['positive'] as $pos){ @@ -236,6 +265,9 @@ function removePosInterest($subject) { + $sid = $_GET['sid']; + session_id($sid); + session_start(); unset($_SESSION['positive'][$subject]); $objResponse = new xajaxResponse(); @@ -245,6 +277,9 @@ function removeNegInterest($subject) { + $sid = $_GET['sid']; + session_id($sid); + session_start(); unset($_SESSION['negative'][$subject]); $objResponse = new xajaxResponse(); @@ -254,29 +289,40 @@ function learnConcept() { + $sid = $_GET['sid']; + session_id($sid); + session_start(); + + $positives=$_SESSION['positive']; + $negatives=$_SESSION['negative']; + $id=$_SESSION['id']; + $ksID=$_SESSION['ksID']; + session_write_close(); + setRunning($id,"true"); $concept=""; - if (isset($_SESSION['positive'])) + if (isset($positives)) { $posArray=array(); - foreach ($_SESSION['positive'] as $pos) + foreach ($positives as $pos) $posArray[]=$pos; $negArray=array(); - if (isset($_SESSION['negative'])) - foreach ($_SESSION['negative'] as $neg) + if (isset($negatives)) + foreach ($negatives as $neg) $negArray[]=$neg; require_once("DLLearnerConnection.php"); - $sc=new DLLearnerConnection($_SESSION['id'],$_SESSION['ksID']); - - - $concepts=$sc->getConceptFromExamples($posArray,$negArray); - - $_SESSION['lastLearnedConcept']=$concepts; - $concept.="<table border=0>\n"; - foreach ($concepts as $con){ - $concept.="<tr><td><a href=\"\" onclick=\"xajax_getSubjectsFromConcept('".$con."');return false;\" />".$con."</a></td></tr>"; + $sc=new DLLearnerConnection($id, $ksID); + try{ + $concepts=$sc->getConceptFromExamples($posArray,$negArray); + + $concept.="<table border=0>\n"; + foreach ($concepts as $con){ + $concept.="<tr><td><a href=\"\" onclick=\"xajax_getSubjectsFromConcept('".$con."');return false;\" />".$con."</a></td></tr>"; + } + $concept.="</table>"; + } catch(Exception $e){ + $concept.=$e->getMessage(); } - $concept.="</table>"; } else $concept="You must choose at least one positive example."; @@ -287,10 +333,18 @@ function getSubjectsFromConcept($concept) { + $sid = $_GET['sid']; + session_id($sid); + session_start(); + $id=$_SESSION['id']; + $ksID=$_SESSION['ksID']; + session_write_stop(); + setRunning("true"); + $content=""; try{ require_once("DLLearnerConnection.php"); - $sc=new DLLearnerConnection($_SESSION['id'],$_SESSION['ksID']); + $sc=new DLLearnerConnection($id,$ksID); $subjects=$sc->getSubjectsFromConcept($concept); foreach ($subjects as $subject) { @@ -305,9 +359,29 @@ return $objResponse; } +function stopServerCall() +{ + $sid = $_GET['sid']; + session_id($sid); + session_start(); + $id=$_SESSION['id']; + session_write_close(); + setRunning($id,"false"); + $objResponse=new xajaxResponse(); + //$objResponse->append("searchcontent", "innerHTML", "Stop"); + return $objResponse; +} + /////////////////////// // Helper Functions. // /////////////////////// + +function setRunning($id,$running) +{ + $file=fopen($id.".temp","w"); + fwrite($file, $running); + fclose($file); +} function get_triple_table($triples) { Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-02-06 14:41:42 UTC (rev 498) +++ trunk/src/dbpedia-navigator/index.php 2008-02-06 14:46:49 UTC (rev 499) @@ -42,7 +42,7 @@ <body> <!-- <h1>DBpedia Navigator</h1> --> -<div><img src="images/dbpedia_navigator.png" alt="DBpedia Navigator" style="padding:5px" /> <input type="button" value="Learn" class="button" onclick="xajax_learnConcept();return false;" /> <span id="conceptlink"></span><span id="Loading" style="display:none">Loading...</span></div> +<div><img src="images/dbpedia_navigator.png" alt="DBpedia Navigator" style="padding:5px" /> <input type="button" value="Learn" class="button" onclick="xajax_learnConcept();return false;" /> <span id="conceptlink"></span><span id="Loading" style="display:none">Server Call... <input type="button" value="Stop" class="button" onclick="xajax_stopServerCall();return false;" /></span></div> <div id="layer" style="display:none"> <div id="layerContent" style="display:none"></div> </div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-02-06 15:24:13
|
Revision: 501 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=501&view=rev Author: sknappe Date: 2008-02-06 07:24:06 -0800 (Wed, 06 Feb 2008) Log Message: ----------- changed the design a bit 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-02-06 14:47:37 UTC (rev 500) +++ trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-02-06 15:24:06 UTC (rev 501) @@ -118,7 +118,7 @@ //BUILD ARTICLE TITLE $artTitle=$triples['http://www.w3.org/2000/01/rdf-schema#label'][0]; - + session_start(); //store article in session, to navigate between last 5 articles quickly $contentArray=array('content' => $content,'subject' => $artTitle); if (!isset($_SESSION['nextArticle'])){ @@ -153,6 +153,7 @@ } } else { + session_start(); //Article is in session $content=$_SESSION['articles'][$fromCache]['content']; $artTitle=$_SESSION['articles'][$fromCache]['subject']; Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-02-06 14:47:37 UTC (rev 500) +++ trunk/src/dbpedia-navigator/index.php 2008-02-06 15:24:06 UTC (rev 501) @@ -42,7 +42,7 @@ <body> <!-- <h1>DBpedia Navigator</h1> --> -<div><img src="images/dbpedia_navigator.png" alt="DBpedia Navigator" style="padding:5px" /> <input type="button" value="Learn" class="button" onclick="xajax_learnConcept();return false;" /> <span id="conceptlink"></span><span id="Loading" style="display:none">Server Call... <input type="button" value="Stop" class="button" onclick="xajax_stopServerCall();return false;" /></span></div> +<div><table border="0" width="100%"><tr><td width="35%"><img src="images/dbpedia_navigator.png" alt="DBpedia Navigator" style="padding:5px" /></td><td width="50%"><span id="conceptlink"></span></td><td width="15%"><span id="Loading" style="display:none">Server Call... <img src="images/remove.png" onclick="xajax_stopServerCall();return false;" /></span></td></tr></table></div> <div id="layer" style="display:none"> <div id="layerContent" style="display:none"></div> </div> @@ -81,7 +81,7 @@ <a href="http://www.w3.org/2001/sw/DataAccess/"><img src="images/sw-sparql-green.png" alt="SPARQL logo"/></a> </div> - + <input type="button" value="Learn" class="button" onclick="xajax_learnConcept();return false;" /> </div><!-- END leftSidebar --> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-02-06 17:54:28
|
Revision: 507 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=507&view=rev Author: sknappe Date: 2008-02-06 09:54:26 -0800 (Wed, 06 Feb 2008) Log Message: ----------- bugfix 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-02-06 17:37:47 UTC (rev 506) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-02-06 17:54:26 UTC (rev 507) @@ -106,7 +106,7 @@ $query="SELECT ?pred ?obj ". "WHERE {<http://dbpedia.org/resource/".str_replace(' ','_',$label)."> ?pred ?obj}"; $result=$this->getSparqlResult($query); - if (!isset($result->item)) throw new Exception("Your query brought no result."); + if (!isset($result->item)) throw new Exception("Your query brought no result. The Label-Search is started."); $ret=array(); foreach ($result->item as $results){ $value=$results->item[1]; Modified: trunk/src/dbpedia-navigator/ajaxfunctions.php =================================================================== --- trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-02-06 17:37:47 UTC (rev 506) +++ trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-02-06 17:54:26 UTC (rev 507) @@ -64,6 +64,8 @@ $lastArticles=""; $artTitle=""; + $objResponse = new xajaxResponse(); + //get the article //if $fromCache is -2, no new SearchResults should be processed //if $fromCache is -1, everything is normal @@ -114,8 +116,10 @@ $content .= '<br/><br/><br/><br/><br/><br/>'.get_triple_table($triples); + //BUILD SEARCHRESULT + if ($fromCache==-1) + $searchResult.="<a href=\"\" onclick=\"xajax_getsubjects('".$subject."');return false;\">Show more Results</a>"; - //BUILD ARTICLE TITLE $artTitle=$triples['http://www.w3.org/2000/01/rdf-schema#label'][0]; session_start(); @@ -144,7 +148,8 @@ } catch (Exception $e) { $content=$e->getMessage(); - $artTitle="Fehler"; + $artTitle="No Result"; + $objResponse->call('xajax_getsubjects',$subject); } } else { @@ -154,10 +159,6 @@ $artTitle=$_SESSION['articles'][$fromCache]['subject']; } - //BUILD SEARCHRESULT - if ($fromCache==-1) - $searchResult.="<a href=\"\" onclick=\"xajax_getsubjects('".$subject."');return false;\">Show more Results</a>"; - //Build lastArticles if (isset($_SESSION['articles'])){ foreach ($_SESSION['articles'] as $key => $value) @@ -166,7 +167,7 @@ } } - $objResponse = new xajaxResponse(); + $objResponse->assign("articlecontent", "innerHTML", $content); $objResponse->assign("ArticleTitle","innerHTML",$artTitle); $objResponse->assign("lastarticles","innerHTML",$lastArticles); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-02-07 16:14:17
|
Revision: 512 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=512&view=rev Author: sknappe Date: 2008-02-07 08:14:08 -0800 (Thu, 07 Feb 2008) Log Message: ----------- added basic REST component Modified Paths: -------------- trunk/src/dbpedia-navigator/index.php Added Paths: ----------- trunk/src/dbpedia-navigator/.htaccess Added: trunk/src/dbpedia-navigator/.htaccess =================================================================== --- trunk/src/dbpedia-navigator/.htaccess (rev 0) +++ trunk/src/dbpedia-navigator/.htaccess 2008-02-07 16:14:08 UTC (rev 512) @@ -0,0 +1,7 @@ +RewriteEngine On +Options +FollowSymlinks +RewriteBase /dbpedia-navigator/ + +# Rule Fuer die Module +RewriteCond %{REQUEST_FILENAME} !-f +RewriteRule ^(.*)$ index.php?resource=$1 \ No newline at end of file Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-02-07 11:43:21 UTC (rev 511) +++ trunk/src/dbpedia-navigator/index.php 2008-02-07 16:14:08 UTC (rev 512) @@ -39,7 +39,7 @@ }; </script> </head> - <body> + <body <?php if (isset($_GET['resource'])) print "onLoad=\"xajax_getarticle('".$_GET['resource']."',-1);return false;\">";unset($_GET['resource']);?>> <!-- <h1>DBpedia Navigator</h1> --> <div><table border="0" width="100%"><tr><td width="35%"><img src="images/dbpedia_navigator.png" alt="DBpedia Navigator" style="padding:5px" /></td><td width="50%"><span id="conceptlink"></span></td><td width="15%"><span id="Loading" style="display:none">Server Call... <img src="images/remove.png" onclick="xajax_stopServerCall();return false;" /></span></td></tr></table></div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-02-07 16:21:25
|
Revision: 513 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=513&view=rev Author: sknappe Date: 2008-02-07 08:21:07 -0800 (Thu, 07 Feb 2008) Log Message: ----------- .temp Files go now in a temp folder Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/ajaxfunctions.php Added Paths: ----------- trunk/src/dbpedia-navigator/temp/ Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-02-07 16:14:08 UTC (rev 512) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-02-07 16:21:07 UTC (rev 513) @@ -87,7 +87,7 @@ $i++; //look, if algorithm was stopped - $file=fopen($this->id.".temp","r"); + $file=fopen("./temp/".$this->id.".temp","r"); $run=fgets($file); fclose($file); if ($run=="false"){ @@ -138,7 +138,7 @@ $seconds = $i * $sleeptime; $i++; //look, if algorithm was stopped - $file=fopen($this->id.".temp","r"); + $file=fopen("./temp/".$this->id.".temp","r"); $run=fgets($file); fclose($file); if ($run=="false"){ Modified: trunk/src/dbpedia-navigator/ajaxfunctions.php =================================================================== --- trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-02-07 16:14:08 UTC (rev 512) +++ trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-02-07 16:21:07 UTC (rev 513) @@ -389,7 +389,7 @@ function setRunning($id,$running) { - $file=fopen($id.".temp","w"); + $file=fopen("./temp/".$id.".temp","w"); fwrite($file, $running); fclose($file); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-02-07 18:33:36
|
Revision: 516 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=516&view=rev Author: jenslehmann Date: 2008-02-07 10:33:32 -0800 (Thu, 07 Feb 2008) Log Message: ----------- - added .htaccess and temp folder to svn ignore - .htaccess is not in htaccess.dist and has to be configured locally (in particular the rewrite base) Added Paths: ----------- trunk/src/dbpedia-navigator/htaccess.dist Removed Paths: ------------- trunk/src/dbpedia-navigator/.htaccess Property Changed: ---------------- trunk/src/dbpedia-navigator/ Property changes on: trunk/src/dbpedia-navigator ___________________________________________________________________ Name: svn:ignore - main.wsdl def0.xsd def1.xsd + temp .htaccess main.wsdl def0.xsd def1.xsd Deleted: trunk/src/dbpedia-navigator/.htaccess =================================================================== --- trunk/src/dbpedia-navigator/.htaccess 2008-02-07 17:36:33 UTC (rev 515) +++ trunk/src/dbpedia-navigator/.htaccess 2008-02-07 18:33:32 UTC (rev 516) @@ -1,7 +0,0 @@ -RewriteEngine On -Options +FollowSymlinks -RewriteBase /dbpedia-navigator/ - -# Rule Fuer die Module -RewriteCond %{REQUEST_FILENAME} !-f -RewriteRule ^(.*)$ index.php?resource=$1 \ No newline at end of file Copied: trunk/src/dbpedia-navigator/htaccess.dist (from rev 515, trunk/src/dbpedia-navigator/.htaccess) =================================================================== --- trunk/src/dbpedia-navigator/htaccess.dist (rev 0) +++ trunk/src/dbpedia-navigator/htaccess.dist 2008-02-07 18:33:32 UTC (rev 516) @@ -0,0 +1,7 @@ +RewriteEngine On +Options +FollowSymlinks +RewriteBase /dbpedia-navigator/ + +# Rule Fuer die Module +RewriteCond %{REQUEST_FILENAME} !-f +RewriteRule ^(.*)$ index.php?resource=$1 \ 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-02-07 19:06:46
|
Revision: 519 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=519&view=rev Author: sknappe Date: 2008-02-07 11:06:40 -0800 (Thu, 07 Feb 2008) Log Message: ----------- now it is possible to look for dbpedia-navigator/resource/Leipzig for example 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/.htaccess-dist Copied: trunk/src/dbpedia-navigator/.htaccess-dist (from rev 512, trunk/src/dbpedia-navigator/.htaccess) =================================================================== --- trunk/src/dbpedia-navigator/.htaccess-dist (rev 0) +++ trunk/src/dbpedia-navigator/.htaccess-dist 2008-02-07 19:06:40 UTC (rev 519) @@ -0,0 +1,8 @@ +RewriteEngine On +Options +FollowSymlinks +RewriteBase /dbpedia-navigator/ + +# Rule Fuer die Module +RewriteCond %{REQUEST_FILENAME} !-f +RewriteCond %{REQUEST_FILENAME} !-d +RewriteRule ^([^/]+)/([^/]+)$ index.php?$1=$2&path=../ \ No newline at end of file Modified: trunk/src/dbpedia-navigator/ajax.php =================================================================== --- trunk/src/dbpedia-navigator/ajax.php 2008-02-07 18:52:41 UTC (rev 518) +++ trunk/src/dbpedia-navigator/ajax.php 2008-02-07 19:06:40 UTC (rev 519) @@ -1,8 +1,10 @@ <?php require_once ("xajax/xajax_core/xajax.inc.php"); $sid = session_id(); +if (isset($_GET['path'])) $path=$_GET['path']; +else $path=""; -$xajax = new xajax("ajaxfunctions.php?sid=$sid"); +$xajax = new xajax($path."ajaxfunctions.php?sid=$sid&path=".$path); $xajax->configureMany(array('debug'=>true)); $xajax->register(XAJAX_FUNCTION, 'getsubjects', array( @@ -25,7 +27,6 @@ $xajax->registerFunction('toNegative'); $xajax->registerFunction('clearPositives'); $xajax->registerFunction('clearNegatives'); -$xajax->registerFunction('showInterests'); $xajax->registerFunction('removePosInterest'); $xajax->registerFunction('removeNegInterest'); $xajax->registerFunction('stopServerCall'); Modified: trunk/src/dbpedia-navigator/ajaxfunctions.php =================================================================== --- trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-02-07 18:52:41 UTC (rev 518) +++ trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-02-07 19:06:40 UTC (rev 519) @@ -180,11 +180,11 @@ //add Positives and Negatives to Interests $posInterests=""; if (isset($_SESSION['positive'])) foreach($_SESSION['positive'] as $pos){ - $posInterests.=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=\"Delete\"/></a><br/>"; + $posInterests.=urldecode(substr (strrchr ($pos, "/"), 1))." <a href=\"\" onclick=\"xajax_toNegative('".$pos."');return false;\"><img src=\"".$_GET['path']."images/minus.jpg\" alt=\"Minus\"/></a> <a href=\"\" onclick=\"xajax_removePosInterest('".$pos."');return false;\"><img src=\"".$_GET['path']."images/remove.png\" alt=\"Delete\"/></a><br/>"; } $negInterests=""; if (isset($_SESSION['negative'])) foreach($_SESSION['negative'] as $neg){ - $negInterests.=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('".$neg."');return false;\"><img src=\"images/remove.png\" alt=\"Delete\"/></a><br/>"; + $negInterests.=urldecode(substr (strrchr ($neg, "/"), 1))." <a href=\"\" onclick=\"xajax_toPositive('".$neg."');return false;\"><img src=\"".$_GET['path']."images/plus.jpg\" alt=\"Plus\"/></a> <a href=\"\" onclick=\"xajax_removeNegInterest('".$neg."');return false;\"><img src=\"".$_GET['path']."images/remove.png\" alt=\"Delete\"/></a><br/>"; } $objResponse->assign("articlecontent", "innerHTML", $content); @@ -212,8 +212,19 @@ $_SESSION['positive']=$array; } + //add Positives and Negatives to Interests + $posInterests=""; + if (isset($_SESSION['positive'])) foreach($_SESSION['positive'] as $pos){ + $posInterests.=urldecode(substr (strrchr ($pos, "/"), 1))." <a href=\"\" onclick=\"xajax_toNegative('".$pos."');return false;\"><img src=\"".$_GET['path']."images/minus.jpg\" alt=\"Minus\"/></a> <a href=\"\" onclick=\"xajax_removePosInterest('".$pos."');return false;\"><img src=\"".$_GET['path']."images/remove.png\" alt=\"Delete\"/></a><br/>"; + } + $negInterests=""; + if (isset($_SESSION['negative'])) foreach($_SESSION['negative'] as $neg){ + $negInterests.=urldecode(substr (strrchr ($neg, "/"), 1))." <a href=\"\" onclick=\"xajax_toPositive('".$neg."');return false;\"><img src=\"".$_GET['path']."images/plus.jpg\" alt=\"Plus\"/></a> <a href=\"\" onclick=\"xajax_removeNegInterest('".$neg."');return false;\"><img src=\"".$_GET['path']."images/remove.png\" alt=\"Delete\"/></a><br/>"; + } + $objResponse = new xajaxResponse(); - $objResponse->call('xajax_showInterests'); + $objResponse->assign('Positives','innerHTML',$posInterests); + $objResponse->assign('Negatives','innerHTML',$negInterests); return $objResponse; } @@ -233,8 +244,19 @@ $_SESSION['negative']=$array; } + //add Positives and Negatives to Interests + $posInterests=""; + if (isset($_SESSION['positive'])) foreach($_SESSION['positive'] as $pos){ + $posInterests.=urldecode(substr (strrchr ($pos, "/"), 1))." <a href=\"\" onclick=\"xajax_toNegative('".$pos."');return false;\"><img src=\"".$_GET['path']."images/minus.jpg\" alt=\"Minus\"/></a> <a href=\"\" onclick=\"xajax_removePosInterest('".$pos."');return false;\"><img src=\"".$_GET['path']."images/remove.png\" alt=\"Delete\"/></a><br/>"; + } + $negInterests=""; + if (isset($_SESSION['negative'])) foreach($_SESSION['negative'] as $neg){ + $negInterests.=urldecode(substr (strrchr ($neg, "/"), 1))." <a href=\"\" onclick=\"xajax_toPositive('".$neg."');return false;\"><img src=\"".$_GET['path']."images/plus.jpg\" alt=\"Plus\"/></a> <a href=\"\" onclick=\"xajax_removeNegInterest('".$neg."');return false;\"><img src=\"".$_GET['path']."images/remove.png\" alt=\"Delete\"/></a><br/>"; + } + $objResponse = new xajaxResponse(); - $objResponse->call('xajax_showInterests'); + $objResponse->assign('Positives','innerHTML',$posInterests); + $objResponse->assign('Negatives','innerHTML',$negInterests); return $objResponse; } @@ -377,6 +399,7 @@ function setRunning($id,$running) { + if(!is_dir("temp")) mkdir("temp"); $file=fopen("./temp/".$id.".temp","w"); fwrite($file, $running); fclose($file); Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-02-07 18:52:41 UTC (rev 518) +++ trunk/src/dbpedia-navigator/index.php 2008-02-07 19:06:40 UTC (rev 519) @@ -10,6 +10,9 @@ $ids=$sc->getIDs(); $_SESSION['id']=$ids[0]; $_SESSION['ksID']=$ids[1]; + +if (isset($_GET['path'])) $path=$_GET['path']; +else $path=""; // debugging code // echo '<pre>'; @@ -28,8 +31,8 @@ <head> <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/'); ?> + <link rel="stylesheet" href="<?php print $path;?>default.css"/> + <?php $xajax->printJavascript($path.'xajax/'); ?> <script type="text/javascript"> showLoading = function() { xajax.$('Loading').style.display='inline'; @@ -39,10 +42,10 @@ }; </script> </head> - <body <?php if (isset($_GET['resource'])) print "onLoad=\"xajax_getarticle('".$_GET['resource']."',-1);return false;\">";unset($_GET['resource']);?>> + <body <?php if (isset($_GET['resource'])) print "onLoad=\"xajax_getarticle('".$_GET['resource']."',-1);return false;\"";unset($_GET['resource']);?>> <!-- <h1>DBpedia Navigator</h1> --> -<div><table border="0" width="100%"><tr><td width="35%"><img src="images/dbpedia_navigator.png" alt="DBpedia Navigator" style="padding:5px" /></td><td width="50%"><span id="conceptlink"></span></td><td width="15%"><span id="Loading" style="display:none">Server Call... <img src="images/remove.png" onclick="xajax_stopServerCall();return false;" /></span></td></tr></table></div> +<div><table border="0" width="100%"><tr><td width="35%"><img src="<?php print $path;?>images/dbpedia_navigator.png" alt="DBpedia Navigator" style="padding:5px" /></td><td width="50%"><span id="conceptlink"></span></td><td width="15%"><span id="Loading" style="display:none">Server Call... <img src="<?php print $path;?>images/remove.png" onclick="xajax_stopServerCall();return false;" /></span></td></tr></table></div> <div id="layer" style="display:none"> <div id="layerContent" style="display:none"></div> </div> @@ -77,8 +80,8 @@ ... 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> + <a href="http://www.w3.org/2004/OWL/"><img src="<?php print $path;?>images/sw-owl-green.png" alt="OWL logo" /></a> + <a href="http://www.w3.org/2001/sw/DataAccess/"><img src="<?php print $path;?>images/sw-sparql-green.png" alt="SPARQL logo"/></a> </div> <input type="button" value="Learn" class="button" onclick="xajax_learnConcept();return false;" /> @@ -132,12 +135,12 @@ $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 '><img src="'.$path.'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"; + echo '><img src="'.$path.'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><a href='<?php print $path;?>rebuild.php'>rebuild [restart session and redownload WSDL file (for debugging)]</a></p> </div> <div id="todo"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-02-07 19:12:50
|
Revision: 520 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=520&view=rev Author: sknappe Date: 2008-02-07 11:12:48 -0800 (Thu, 07 Feb 2008) Log Message: ----------- changed htaccess a bit Modified Paths: -------------- trunk/src/dbpedia-navigator/htaccess.dist Removed Paths: ------------- trunk/src/dbpedia-navigator/.htaccess-dist Deleted: trunk/src/dbpedia-navigator/.htaccess-dist =================================================================== --- trunk/src/dbpedia-navigator/.htaccess-dist 2008-02-07 19:06:40 UTC (rev 519) +++ trunk/src/dbpedia-navigator/.htaccess-dist 2008-02-07 19:12:48 UTC (rev 520) @@ -1,8 +0,0 @@ -RewriteEngine On -Options +FollowSymlinks -RewriteBase /dbpedia-navigator/ - -# Rule Fuer die Module -RewriteCond %{REQUEST_FILENAME} !-f -RewriteCond %{REQUEST_FILENAME} !-d -RewriteRule ^([^/]+)/([^/]+)$ index.php?$1=$2&path=../ \ No newline at end of file Modified: trunk/src/dbpedia-navigator/htaccess.dist =================================================================== --- trunk/src/dbpedia-navigator/htaccess.dist 2008-02-07 19:06:40 UTC (rev 519) +++ trunk/src/dbpedia-navigator/htaccess.dist 2008-02-07 19:12:48 UTC (rev 520) @@ -4,4 +4,6 @@ # Rule Fuer die Module RewriteCond %{REQUEST_FILENAME} !-f -RewriteRule ^(.*)$ index.php?resource=$1 \ No newline at end of file +RewriteCond %{REQUEST_FILENAME} !-d +RewriteRule ^([^/]+)/([^/]+)$ index.php?$1=$2&path=../ +RewriteRule ^(.*)\.(js|ico|gif|jpg|png|css|php)$ index.php \ 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-02-13 14:27:19
|
Revision: 568 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=568&view=rev Author: sknappe Date: 2008-02-13 06:27:13 -0800 (Wed, 13 Feb 2008) Log Message: ----------- detailed concept shown (not very much information yet) 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-02-13 14:23:04 UTC (rev 567) +++ trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-02-13 14:27:13 UTC (rev 568) @@ -321,6 +321,7 @@ session_write_close(); setRunning($id,"true"); $concept=""; + $conceptinformation=""; if (isset($positives)) { $posArray=array(); @@ -337,8 +338,12 @@ $concepts=$sc->getConceptFromExamples($posArray,$negArray); $concept.="<table border=0>\n"; + $i=1; foreach ($concepts as $con){ - $concept.="<tr><td><a href=\"\" onclick=\"xajax_getSubjectsFromConcept('".$con."');return false;\" />".$con."</a></td></tr>"; + $concept.="<tr><td><a href=\"\" onclick=\"xajax_getSubjectsFromConcept('".$con."');return false;\" onMouseOver=\"showdiv('div".$i."');showdiv('ConceptBox');\" onMouseOut=\"hidediv('div".$i."');hidediv('ConceptBox');\" />".$con."</a></td></tr>"; + //put information about concepts in divs + $conceptinformation.="<div id=\"div".$i."\">".$con."</div>"; + $i++; } $concept.="</table>"; } catch(Exception $e){ @@ -349,6 +354,7 @@ $objResponse = new xajaxResponse(); $objResponse->assign("conceptlink", "innerHTML", $concept); + $objResponse->assign("ConceptInformation", "innerHTML", $conceptinformation); return $objResponse; } Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-02-13 14:23:04 UTC (rev 567) +++ trunk/src/dbpedia-navigator/index.php 2008-02-13 14:27:13 UTC (rev 568) @@ -42,6 +42,14 @@ xajax.$('SearchResultBox').style.display = 'block'; xajax.$('LastArticlesBox').style.display = 'block'; }; + + function showdiv(id){ + document.getElementById(id).style.display='block'; + } + + function hidediv(id) { + document.getElementById(id).style.display='none'; + } </script> </head> <body <?php if (isset($_GET['resource'])) print "onLoad=\"xajax_getarticle('".$_GET['resource']."',-1);return false;\"";unset($_GET['resource']);?>> @@ -154,16 +162,8 @@ 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> @@ -206,6 +206,10 @@ </ul> </div> + <div class="box" id="ConceptBox" style="position:absolute;top:0px;right:20px;opacity:0.90;display:none;z-index:5;"> + <div class="boxtitle">Detailed Concept Information</div> + <div class="boxcontent" id="ConceptInformation"></div> + </div> </body> </html> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-02-15 10:14:25
|
Revision: 575 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=575&view=rev Author: sknappe Date: 2008-02-15 02:14:14 -0800 (Fri, 15 Feb 2008) Log Message: ----------- some changes to concept details Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/ajaxfunctions.php trunk/src/dbpedia-navigator/index.php Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-02-14 16:47:52 UTC (rev 574) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-02-15 10:14:14 UTC (rev 575) @@ -100,6 +100,21 @@ } return $concepts->item; } + + function getConceptDepth() + { + return $this->client->getConceptDepth($this->id,3)->item; + } + + function getConceptArity() + { + return $this->client->getConceptArity($this->id,3)->item; + } + + function getConceptLength($concept) + { + return $this->client->getConceptLength($concept); + } function getTriples($label) { Modified: trunk/src/dbpedia-navigator/ajaxfunctions.php =================================================================== --- trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-02-14 16:47:52 UTC (rev 574) +++ trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-02-15 10:14:14 UTC (rev 575) @@ -291,8 +291,19 @@ session_start(); unset($_SESSION['positive'][$subject]); + //add Positives and Negatives to Interests + $posInterests=""; + if (isset($_SESSION['positive'])) foreach($_SESSION['positive'] as $pos){ + $posInterests.=urldecode(substr (strrchr ($pos, "/"), 1))." <a href=\"\" onclick=\"xajax_toNegative('".$pos."');return false;\"><img src=\"".$_GET['path']."images/minus.jpg\" alt=\"Minus\"/></a> <a href=\"\" onclick=\"xajax_removePosInterest('".$pos."');return false;\"><img src=\"".$_GET['path']."images/remove.png\" alt=\"Delete\"/></a><br/>"; + } + $negInterests=""; + if (isset($_SESSION['negative'])) foreach($_SESSION['negative'] as $neg){ + $negInterests.=urldecode(substr (strrchr ($neg, "/"), 1))." <a href=\"\" onclick=\"xajax_toPositive('".$neg."');return false;\"><img src=\"".$_GET['path']."images/plus.jpg\" alt=\"Plus\"/></a> <a href=\"\" onclick=\"xajax_removeNegInterest('".$neg."');return false;\"><img src=\"".$_GET['path']."images/remove.png\" alt=\"Delete\"/></a><br/>"; + } + $objResponse = new xajaxResponse(); - $objResponse->call('xajax_showInterests'); + $objResponse->assign('Positives','innerHTML',$posInterests); + $objResponse->assign('Negatives','innerHTML',$negInterests); return $objResponse; } @@ -303,8 +314,19 @@ session_start(); unset($_SESSION['negative'][$subject]); + //add Positives and Negatives to Interests + $posInterests=""; + if (isset($_SESSION['positive'])) foreach($_SESSION['positive'] as $pos){ + $posInterests.=urldecode(substr (strrchr ($pos, "/"), 1))." <a href=\"\" onclick=\"xajax_toNegative('".$pos."');return false;\"><img src=\"".$_GET['path']."images/minus.jpg\" alt=\"Minus\"/></a> <a href=\"\" onclick=\"xajax_removePosInterest('".$pos."');return false;\"><img src=\"".$_GET['path']."images/remove.png\" alt=\"Delete\"/></a><br/>"; + } + $negInterests=""; + if (isset($_SESSION['negative'])) foreach($_SESSION['negative'] as $neg){ + $negInterests.=urldecode(substr (strrchr ($neg, "/"), 1))." <a href=\"\" onclick=\"xajax_toPositive('".$neg."');return false;\"><img src=\"".$_GET['path']."images/plus.jpg\" alt=\"Plus\"/></a> <a href=\"\" onclick=\"xajax_removeNegInterest('".$neg."');return false;\"><img src=\"".$_GET['path']."images/remove.png\" alt=\"Delete\"/></a><br/>"; + } + $objResponse = new xajaxResponse(); - $objResponse->call('xajax_showInterests'); + $objResponse->assign('Positives','innerHTML',$posInterests); + $objResponse->assign('Negatives','innerHTML',$negInterests); return $objResponse; } @@ -335,14 +357,16 @@ require_once("DLLearnerConnection.php"); $sc=new DLLearnerConnection($id, $ksID); try{ - $concepts=$sc->getConceptFromExamples($posArray,$negArray); + $concepts=$sc->getConceptFromExamples($posArray,$negArray); + $conceptDepth=$sc->getConceptDepth(); + $conceptArity=$sc->getConceptArity(); $concept.="<table border=0>\n"; $i=1; foreach ($concepts as $con){ $concept.="<tr><td><a href=\"\" onclick=\"xajax_getSubjectsFromConcept('".$con."');return false;\" onMouseOver=\"showdiv('div".$i."');showdiv('ConceptBox');\" onMouseOut=\"hidediv('div".$i."');hidediv('ConceptBox');\" />".$con."</a></td></tr>"; //put information about concepts in divs - $conceptinformation.="<div id=\"div".$i."\" style=\"display:none\">".$con."</div>"; + $conceptinformation.="<div id=\"div".$i."\" style=\"display:none\">Concept Depth: ".$conceptDepth[$i-1]."<br/>Concept Arity: ".$conceptArity[$i-1]."<br/>Concept Length: ".$sc->getConceptLength($con)."</div>"; $i++; } $concept.="</table>"; Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-02-14 16:47:52 UTC (rev 574) +++ trunk/src/dbpedia-navigator/index.php 2008-02-15 10:14:14 UTC (rev 575) @@ -206,7 +206,7 @@ </ul> </div> - <div class="box" id="ConceptBox" style="position:absolute;top:0px;right:20px;opacity:0.90;display:none;z-index:5;"> + <div class="box" id="ConceptBox" style="position:absolute;top:15px;right:15px;width:18%;opacity:0.90;display:none;z-index:5;"> <div class="boxtitle">Detailed Concept Information</div> <div class="boxcontent" id="ConceptInformation"></div> </div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-02-16 12:41:35
|
Revision: 580 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=580&view=rev Author: sknappe Date: 2008-02-16 04:41:30 -0800 (Sat, 16 Feb 2008) Log Message: ----------- JSON is now used Google Maps added redirection is shown Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/Settings.php trunk/src/dbpedia-navigator/ajaxfunctions.php trunk/src/dbpedia-navigator/default.css trunk/src/dbpedia-navigator/index.php Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-02-15 16:56:37 UTC (rev 579) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-02-16 12:41:30 UTC (rev 580) @@ -120,13 +120,12 @@ { $query="SELECT ?pred ?obj ". "WHERE {{<http://dbpedia.org/resource/".str_replace(' ','_',$label)."> ?pred ?obj}UNION{<http://dbpedia.org/resource/".str_replace(' ','_',$label)."> <http://dbpedia.org/property/redirect> ?Conc.?Conc ?pred ?obj}}"; - $result=$this->getSparqlResult($query); - if (!isset($result->item)) throw new Exception("Your query brought no result. The Label-Search is started."); + $result=json_decode($this->getSparqlResult($query),true); + if (count($result['results']['bindings'])==0) throw new Exception("Your query brought no result. The Label-Search is started."); $ret=array(); - foreach ($result->item as $results){ - $value=$results->item[1]; - if (strpos($value,"@".$this->lang)==(strlen($value)-strlen("@".$this->lang))) $ret[$results->item[0]][]=substr($value,0,strlen($value)-strlen("@".$this->lang)); - if (strpos($value,"@")!=(strlen($value)-strlen($this->lang)-1)) $ret[$results->item[0]][]=$value; + foreach ($result['results']['bindings'] as $results){ + $value=$results['obj']; + if (!(isset($value['xml:lang'])&&($value['xml:lang']!=$this->lang))) $ret[$results['pred']['value']][]=$value['value']; } return $ret; @@ -146,7 +145,7 @@ $running=$this->client->isSparqlQueryRunning($this->id,$queryID); if (!$running){ - $result=$this->client->getAsStringArray($this->id,$queryID); + $result=$this->client->getAsJSON($this->id,$queryID); return $result; } @@ -163,17 +162,17 @@ } while($seconds<$this->ttl); $this->client->stopSparqlQuery($id,$queryID); } - + function getSubjects($label) { $query="SELECT DISTINCT ?subject\n". "WHERE { ?subject <http://www.w3.org/2000/01/rdf-schema#label> ?object. ?object bif:contains '\"".$label."\"'@en}\n". "LIMIT 10"; - $result=$this->getSparqlResult($query); - if (!$result->item) throw new Exception("Your query brought no result."); + $result=json_decode($this->getSparqlResult($query),true); + if (count($result['results']['bindings'])==0) throw new Exception("Your query brought no result."); $ret=array(); - foreach ($result->item as $results){ - $ret[]=$results->item[0]; + foreach ($result['results']['bindings'] as $results){ + $ret[]=$results['subject']['value']; } return $ret; } @@ -183,11 +182,11 @@ $query="SELECT DISTINCT ?subject\n". "WHERE { ?subject a <".$concept.">}\n". "LIMIT 10"; - $result=$this->getSparqlResult($query); - if (!$result->item) throw new Exception("Your query brought no result."); + $result=json_decode($this->getSparqlResult($query),true); + if (count($result['results']['bindings'])==0) throw new Exception("Your query brought no result."); $ret=array(); - foreach ($result->item as $results){ - $ret[]=$results->item[0]; + foreach ($result['results']['bindings'] as $results){ + $ret[]=$results['subject']['value']; } return $ret; } @@ -265,9 +264,9 @@ } } /* -require_once("DLLearnerConnection.php"); $sc=new DLLearnerConnection(); $ids=$sc->getIDs(); $sc=new DLLearnerConnection($ids[0],$ids[1]); -$triples=$sc->getConceptFromExamples(array("http://dbpedia.org/resource/Angela_Merkel"),array("http://dbpedia.org/resource/Joschka_Fischer"));*/ +$triples=$sc->getSubjects("Angela Merkel"); +var_dump($triples);*/ ?> Modified: trunk/src/dbpedia-navigator/Settings.php =================================================================== --- trunk/src/dbpedia-navigator/Settings.php 2008-02-15 16:56:37 UTC (rev 579) +++ trunk/src/dbpedia-navigator/Settings.php 2008-02-16 12:41:30 UTC (rev 580) @@ -37,8 +37,10 @@ // public $dbpediauri='http://dbpedia2.openlinksw.com:8890/isparql'; public $sparqlttl=60; - //not yet used + public $language="en"; + + public $googleMapsKey="ABQIAAAAWwHG9WuZ8hxFSPjRX2-D-hSOxlJeL3USfakgDtFzmQkGhQTW0xTFM1Yr38ho8qREnjt-6oLs37o4xg"; } ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/ajaxfunctions.php =================================================================== --- trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-02-15 16:56:37 UTC (rev 579) +++ trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-02-16 12:41:30 UTC (rev 580) @@ -49,6 +49,7 @@ //get first Letter of label big $subject=ucfirst($subject); + $uri="http://dbpedia.org/resource/".str_replace(' ','_',$subject); //if article is in session, get it out of the session if (isset($articles)){ @@ -87,14 +88,17 @@ // 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'][0].'" alt="Picture of '.$subject.'" style="float:right; max-width:200px;" \>'; - + + //display where it was redirected from, if it was redirected + if (isset($triples['http://dbpedia.org/property/redirect'])) $content.="<span id=\"redirectedFrom\">redirected from '$subject'</span>"; + // add short description in english $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="'.$_GET['path'].'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>'; + $content .= '<a href="'.$uri.'">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'])) @@ -107,7 +111,11 @@ $content .= '</ul></p>'; } + if (isset($triples['http://www.w3.org/2003/01/geo/wgs84_pos#long'])&&isset($triples['http://www.w3.org/2003/01/geo/wgs84_pos#lat'])){ + $content.="<br/><a href=\"\" onClick=\"loadGoogleMap(".$triples['http://www.w3.org/2003/01/geo/wgs84_pos#lat'][0].",".$triples['http://www.w3.org/2003/01/geo/wgs84_pos#long'][0].");return false;\">a map of the location</a><div id=\"map\" style=\"width: 500px; height: 300px;display:none;\"></div>"; + } + // filter out uninteresting properties and properties which // have already been displayed unset($triples['http://xmlns.com/foaf/0.1/page']); @@ -190,7 +198,7 @@ $objResponse->assign("articlecontent", "innerHTML", $content); $objResponse->assign("ArticleTitle","innerHTML",$artTitle); $objResponse->assign("lastarticles","innerHTML",$lastArticles); - $objResponse->assign("searchcontent", "innerHTML", $searchResult); + if ($searchResult!="") $objResponse->assign("searchcontent", "innerHTML", $searchResult); $objResponse->assign('Positives','innerHTML',$posInterests); $objResponse->assign('Negatives','innerHTML',$negInterests); return $objResponse; Modified: trunk/src/dbpedia-navigator/default.css =================================================================== --- trunk/src/dbpedia-navigator/default.css 2008-02-15 16:56:37 UTC (rev 579) +++ trunk/src/dbpedia-navigator/default.css 2008-02-16 12:41:30 UTC (rev 580) @@ -80,14 +80,6 @@ right: 15px;*/ } -#clear { - clear: both; -} - -#validation { - padding: 0.5em; -} - /* * sidebar content (boxes) */ @@ -384,4 +376,9 @@ #todo { padding: 15px; margin: 10px; +} + +#redirectedFrom { + color: #666; + font-size: 85%; } \ No newline at end of file Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-02-15 16:56:37 UTC (rev 579) +++ trunk/src/dbpedia-navigator/index.php 2008-02-16 12:41:30 UTC (rev 580) @@ -13,13 +13,10 @@ if (isset($_GET['path'])) $path=$_GET['path']; else $path=""; - -// 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_once 'Settings.php'; +$settings=new Settings(); + require("ajax.php"); echo '<?xml version="1.0" encoding="UTF-8"?>'; @@ -33,6 +30,8 @@ <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> <link rel="stylesheet" href="<?php print $path;?>default.css"/> <?php $xajax->printJavascript($path.'xajax/'); ?> + <script src="http://maps.google.com/maps?file=api&v=2&key=<?php print $settings->googleMapsKey;?>" + type="text/javascript"></script> <script type="text/javascript"> showLoading = function() { xajax.$('Loading').style.display='inline'; @@ -49,7 +48,18 @@ function hidediv(id) { document.getElementById(id).style.display='none'; - } + } + + function loadGoogleMap(Lat,Lng) { + document.getElementById("map").style.display='block'; + if (GBrowserIsCompatible()) { + // Create and Center a Map + var map = new GMap2(document.getElementById("map")); + map.setCenter(new GLatLng(Lat, Lng), 10); + map.addControl(new GLargeMapControl()); + map.addControl(new GMapTypeControl()); + } + } </script> </head> <body <?php if (isset($_GET['resource'])) print "onLoad=\"xajax_getarticle('".$_GET['resource']."',-1);return false;\"";unset($_GET['resource']);?>> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-02-16 13:45:36
|
Revision: 582 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=582&view=rev Author: sknappe Date: 2008-02-16 05:45:26 -0800 (Sat, 16 Feb 2008) Log Message: ----------- added an icon for the google maps refreshing a site should now be no problem (search not perfect yet) 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/mobmaps_googlemapsicon.jpg Modified: trunk/src/dbpedia-navigator/ajaxfunctions.php =================================================================== --- trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-02-16 12:44:28 UTC (rev 581) +++ trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-02-16 13:45:26 UTC (rev 582) @@ -97,7 +97,7 @@ // give the link to the corresponding Wikipedia article if(isset($triples['http://xmlns.com/foaf/0.1/page'])) - $content .= '<p><img src="'.$_GET['path'].'images/wikipedia_favicon.png" alt"Wikipedia" /> <a href="'.$triples['http://xmlns.com/foaf/0.1/page'][0].'">view Wikipedia article</a>, '; + $content .= '<p><img src="'.$_GET['path'].'images/wikipedia_favicon.png" alt="Wikipedia" /> <a href="'.$triples['http://xmlns.com/foaf/0.1/page'][0].'">view Wikipedia article</a>, '; $content .= '<a href="'.$uri.'">view DBpedia resource description</a></p>'; // display a list of classes @@ -110,9 +110,9 @@ $content .= '<li><a href="'.$reference.'">'.$reference.'</a></li>'; $content .= '</ul></p>'; } - + //display a Google Map if Geo-koordinates are available if (isset($triples['http://www.w3.org/2003/01/geo/wgs84_pos#long'])&&isset($triples['http://www.w3.org/2003/01/geo/wgs84_pos#lat'])){ - $content.="<br/><a href=\"\" onClick=\"loadGoogleMap(".$triples['http://www.w3.org/2003/01/geo/wgs84_pos#lat'][0].",".$triples['http://www.w3.org/2003/01/geo/wgs84_pos#long'][0].");return false;\">a map of the location</a><div id=\"map\" style=\"width: 500px; height: 300px;display:none;\"></div>"; + $content.="<br/><img src=\"".$_GET['path']."images/mobmaps_googlemapsicon.jpg\" alt=\"Google Maps\" style=\"max-width:30px;\" /> <a href=\"\" onClick=\"loadGoogleMap(".$triples['http://www.w3.org/2003/01/geo/wgs84_pos#lat'][0].",".$triples['http://www.w3.org/2003/01/geo/wgs84_pos#long'][0].");return false;\">a map of the location</a><div id=\"map\" style=\"width: 500px; height: 300px;display:none;\"></div>"; } Modified: trunk/src/dbpedia-navigator/default.css =================================================================== --- trunk/src/dbpedia-navigator/default.css 2008-02-16 12:44:28 UTC (rev 581) +++ trunk/src/dbpedia-navigator/default.css 2008-02-16 13:45:26 UTC (rev 582) @@ -45,8 +45,8 @@ } #content { - /*margin: 0 19em; - overflow: hidden;*/ + /*margin: 0 19em;*/ + overflow: hidden; /*width: 10%;*/ width: 60%; float: left; Added: trunk/src/dbpedia-navigator/images/mobmaps_googlemapsicon.jpg =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/mobmaps_googlemapsicon.jpg ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-02-16 12:44:28 UTC (rev 581) +++ trunk/src/dbpedia-navigator/index.php 2008-02-16 13:45:26 UTC (rev 582) @@ -17,6 +17,16 @@ require_once 'Settings.php'; $settings=new Settings(); +//what happens onLoad +$onload=""; +if (isset($_GET['resource'])){ + $onLoad.="onLoad=\"xajax_getarticle('".$_GET['resource']."',-1);return false;\""; + unset($_GET['resource']); +} +else if (isset($_SESSION['currentArticle'])){ + $onLoad.="onLoad=\"xajax_getarticle('',".$_SESSION['currentArticle'].");return false;\""; +} + require("ajax.php"); echo '<?xml version="1.0" encoding="UTF-8"?>'; @@ -55,14 +65,14 @@ if (GBrowserIsCompatible()) { // Create and Center a Map var map = new GMap2(document.getElementById("map")); - map.setCenter(new GLatLng(Lat, Lng), 10); + map.setCenter(new GLatLng(Lat, Lng), 12); map.addControl(new GLargeMapControl()); map.addControl(new GMapTypeControl()); } } </script> </head> - <body <?php if (isset($_GET['resource'])) print "onLoad=\"xajax_getarticle('".$_GET['resource']."',-1);return false;\"";unset($_GET['resource']);?>> + <body <?php print $onLoad;?>> <!-- <h1>DBpedia Navigator</h1> --> <div><table border="0" width="100%"><tr><td width="35%"><img src="<?php print $path;?>images/dbpedia_navigator.png" alt="DBpedia Navigator" style="padding:5px" /></td><td width="50%"><span id="conceptlink"></span></td><td width="15%"><span id="Loading" style="display:none">Server Call... <img src="<?php print $path;?>images/remove.png" onclick="xajax_stopServerCall();return false;" /></span></td></tr></table></div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-02-16 14:10:14
|
Revision: 583 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=583&view=rev Author: sknappe Date: 2008-02-16 06:10:01 -0800 (Sat, 16 Feb 2008) Log Message: ----------- added a marker on the google map 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-02-16 13:45:26 UTC (rev 582) +++ trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-02-16 14:10:01 UTC (rev 583) @@ -112,7 +112,7 @@ } //display a Google Map if Geo-koordinates are available if (isset($triples['http://www.w3.org/2003/01/geo/wgs84_pos#long'])&&isset($triples['http://www.w3.org/2003/01/geo/wgs84_pos#lat'])){ - $content.="<br/><img src=\"".$_GET['path']."images/mobmaps_googlemapsicon.jpg\" alt=\"Google Maps\" style=\"max-width:30px;\" /> <a href=\"\" onClick=\"loadGoogleMap(".$triples['http://www.w3.org/2003/01/geo/wgs84_pos#lat'][0].",".$triples['http://www.w3.org/2003/01/geo/wgs84_pos#long'][0].");return false;\">a map of the location</a><div id=\"map\" style=\"width: 500px; height: 300px;display:none;\"></div>"; + $content.="<br/><img src=\"".$_GET['path']."images/mobmaps_googlemapsicon.jpg\" alt=\"Google Maps\" style=\"max-width:30px;\" /> <a href=\"\" onClick=\"loadGoogleMap(".$triples['http://www.w3.org/2003/01/geo/wgs84_pos#lat'][0].",".$triples['http://www.w3.org/2003/01/geo/wgs84_pos#long'][0].",'".$triples['http://www.w3.org/2000/01/rdf-schema#label'][0]."');return false;\">a map of the location</a><div id=\"map\" style=\"width: 500px; height: 300px;display:none;\"></div>"; } Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-02-16 13:45:26 UTC (rev 582) +++ trunk/src/dbpedia-navigator/index.php 2008-02-16 14:10:01 UTC (rev 583) @@ -60,7 +60,7 @@ document.getElementById(id).style.display='none'; } - function loadGoogleMap(Lat,Lng) { + function loadGoogleMap(Lat,Lng,Label) { document.getElementById("map").style.display='block'; if (GBrowserIsCompatible()) { // Create and Center a Map @@ -68,8 +68,13 @@ map.setCenter(new GLatLng(Lat, Lng), 12); map.addControl(new GLargeMapControl()); map.addControl(new GMapTypeControl()); + var marker=new GMarker(new GLatLng(Lat, Lng)); + GEvent.addListener(marker, "click", function() { + marker.openInfoWindowHtml(Label); + }); + map.addOverlay(marker); } - } + } </script> </head> <body <?php print $onLoad;?>> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-02-17 10:11:54
|
Revision: 587 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=587&view=rev Author: sknappe Date: 2008-02-17 02:11:48 -0800 (Sun, 17 Feb 2008) Log Message: ----------- changed the map and map link a bit, link now toggles the map 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-02-17 10:08:08 UTC (rev 586) +++ trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-02-17 10:11:48 UTC (rev 587) @@ -110,9 +110,10 @@ $content .= '<li><a href="'.$reference.'">'.$reference.'</a></li>'; $content .= '</ul></p>'; } + //display a Google Map if Geo-koordinates are available if (isset($triples['http://www.w3.org/2003/01/geo/wgs84_pos#long'])&&isset($triples['http://www.w3.org/2003/01/geo/wgs84_pos#lat'])){ - $content.="<br/><img src=\"".$_GET['path']."images/mobmaps_googlemapsicon.jpg\" alt=\"Google Maps\" style=\"max-width:30px;\" /> <a href=\"\" onClick=\"loadGoogleMap(".$triples['http://www.w3.org/2003/01/geo/wgs84_pos#lat'][0].",".$triples['http://www.w3.org/2003/01/geo/wgs84_pos#long'][0].",'".$triples['http://www.w3.org/2000/01/rdf-schema#label'][0]."');return false;\">a map of the location</a><div id=\"map\" style=\"width: 500px; height: 300px;display:none;\"></div>"; + $content.="<br/><img src=\"".$_GET['path']."images/mobmaps_googlemapsicon.jpg\" alt=\"Google Maps\" style=\"max-width:30px;\" /> <a href=\"\" onClick=\"loadGoogleMap(".$triples['http://www.w3.org/2003/01/geo/wgs84_pos#lat'][0].",".$triples['http://www.w3.org/2003/01/geo/wgs84_pos#long'][0].",'".$triples['http://www.w3.org/2000/01/rdf-schema#label'][0]."');return false;\">Toggle a map of the location</a><br/><br/><div id=\"map\" style=\"width: 500px; height: 300px;display:none;\"></div>"; } Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-02-17 10:08:08 UTC (rev 586) +++ trunk/src/dbpedia-navigator/index.php 2008-02-17 10:11:48 UTC (rev 587) @@ -61,19 +61,24 @@ } function loadGoogleMap(Lat,Lng,Label) { - document.getElementById("map").style.display='block'; - if (GBrowserIsCompatible()) { - // Create and Center a Map - var map = new GMap2(document.getElementById("map")); - map.setCenter(new GLatLng(Lat, Lng), 12); - map.addControl(new GLargeMapControl()); - map.addControl(new GMapTypeControl()); - var marker=new GMarker(new GLatLng(Lat, Lng)); - GEvent.addListener(marker, "click", function() { - marker.openInfoWindowHtml(Label); - }); - map.addOverlay(marker); - } + if (document.getElementById("map").style.display=="none"){ + document.getElementById("map").style.display='block'; + if (GBrowserIsCompatible()) { + // Create and Center a Map + var map = new GMap2(document.getElementById("map")); + map.setCenter(new GLatLng(Lat, Lng), 12); + map.addControl(new GLargeMapControl()); + map.addControl(new GMapTypeControl()); + var marker=new GMarker(new GLatLng(Lat, Lng)); + GEvent.addListener(marker, "click", function() { + marker.openInfoWindowHtml(Label); + }); + map.addOverlay(marker); + } + } + else { + document.getElementById("map").style.display='none'; + } } </script> </head> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-02-18 15:35:55
|
Revision: 603 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=603&view=rev Author: sknappe Date: 2008-02-18 07:35:03 -0800 (Mon, 18 Feb 2008) Log Message: ----------- changed the look of an article a bit Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/ajaxfunctions.php Added Paths: ----------- trunk/src/dbpedia-navigator/images/flickr.jpg Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-02-18 14:50:24 UTC (rev 602) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-02-18 15:35:03 UTC (rev 603) @@ -125,7 +125,7 @@ $ret=array(); foreach ($result['results']['bindings'] as $results){ $value=$results['obj']; - if (!(isset($value['xml:lang'])&&($value['xml:lang']!=$this->lang))) $ret[$results['pred']['value']][]=$value['value']; + if (!(isset($value['xml:lang'])&&($value['xml:lang']!=$this->lang))) $ret[$results['pred']['value']][]=$value; } return $ret; Modified: trunk/src/dbpedia-navigator/ajaxfunctions.php =================================================================== --- trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-02-18 14:50:24 UTC (rev 602) +++ trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-02-18 15:35:03 UTC (rev 603) @@ -87,17 +87,21 @@ // 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'][0].'" alt="Picture of '.$subject.'" style="float:right; max-width:200px;" \>'; + $content.='<img src="'.$triples['http://xmlns.com/foaf/0.1/depiction'][0]['value'].'" alt="Picture of '.$subject.'" style="float:right; max-width:200px;" \>'; //display where it was redirected from, if it was redirected - if (isset($triples['http://dbpedia.org/property/redirect'])) $content.="<span id=\"redirectedFrom\">redirected from '$subject'</span>"; + $redirect=""; + if (isset($triples['http://dbpedia.org/property/redirect'])){ + $content.="<span id=\"redirectedFrom\">redirected from '$subject'</span>"; + $redirect=$triples['http://dbpedia.org/property/redirect'][0]['value']; + } // add short description in english - $content.="<h4>Short Description</h4><p>".urldecode($triples['http://dbpedia.org/property/abstract'][0])."</p>"; + $content.="<h4>Short Description</h4><p>".urldecode($triples['http://dbpedia.org/property/abstract'][0]['value'])."</p>"; // give the link to the corresponding Wikipedia article if(isset($triples['http://xmlns.com/foaf/0.1/page'])) - $content .= '<p><img src="'.$_GET['path'].'images/wikipedia_favicon.png" alt="Wikipedia" /> <a href="'.$triples['http://xmlns.com/foaf/0.1/page'][0].'">view Wikipedia article</a>, '; + $content .= '<p><img src="'.$_GET['path'].'images/wikipedia_favicon.png" alt="Wikipedia" /> <a href="'.$triples['http://xmlns.com/foaf/0.1/page'][0]['value'].'">view Wikipedia article</a>, '; $content .= '<a href="'.$uri.'">view DBpedia resource description</a></p>'; // display a list of classes @@ -107,33 +111,52 @@ 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 .= '<li><a href="'.$reference['value'].'">'.$reference['value'].'</a></li>'; $content .= '</ul></p>'; } //display a Google Map if Geo-koordinates are available if (isset($triples['http://www.w3.org/2003/01/geo/wgs84_pos#long'])&&isset($triples['http://www.w3.org/2003/01/geo/wgs84_pos#lat'])){ - $content.="<br/><img src=\"".$_GET['path']."images/mobmaps_googlemapsicon.jpg\" alt=\"Google Maps\" style=\"max-width:30px;\" /> <a href=\"\" onClick=\"loadGoogleMap(".$triples['http://www.w3.org/2003/01/geo/wgs84_pos#lat'][0].",".$triples['http://www.w3.org/2003/01/geo/wgs84_pos#long'][0].",'".$triples['http://www.w3.org/2000/01/rdf-schema#label'][0]."');return false;\">Toggle a map of the location</a><br/><br/><div id=\"map\" style=\"width: 500px; height: 300px;display:none;\"></div>"; + $content.="<br/><img src=\"".$_GET['path']."images/mobmaps_googlemapsicon.jpg\" alt=\"Google Maps\" style=\"max-width:25px;\" /> <a href=\"\" onClick=\"loadGoogleMap(".$triples['http://www.w3.org/2003/01/geo/wgs84_pos#lat'][0]['value'].",".$triples['http://www.w3.org/2003/01/geo/wgs84_pos#long'][0]['value'].",'".$triples['http://www.w3.org/2000/01/rdf-schema#label'][0]['value']."');return false;\">Toggle a map of the location</a><br/><br/><div id=\"map\" style=\"width: 500px; height: 300px;display:none;\"></div>"; } + //display photo collection, if there is one + if (isset($triples['http://dbpedia.org/property/hasPhotoCollection'])){ + $content.="<br/><img src=\"".$_GET['path']."images/flickr.jpg\" alt=\"Flickr\" style=\"max-width:25px;\" /> <a href=\"".$triples['http://dbpedia.org/property/hasPhotoCollection'][0]['value']."\">view a photo collection</a><br/>"; + } + //skos-subjects + if (isset($triples['http://www.w3.org/2004/02/skos/core#subject'])){ + $content .= '<br/><p>skos subjects: <ul>'; + foreach($triples['http://www.w3.org/2004/02/skos/core#subject'] as $skos) + $content .= '<li><a href="'.$skos['value'].'">'.$skos['value'].'</a></li>'; + $content .= '</ul></p>'; + } + + //BUILD ARTICLE TITLE + $artTitle=$triples['http://www.w3.org/2000/01/rdf-schema#label'][0]['value']; + // 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://www.w3.org/1999/02/22-rdf-syntax-ns#type']); + unset($triples['http://dbpedia.org/property/redirect']); + unset($triples['http://dbpedia.org/property/reference']); + unset($triples['http://www.w3.org/2003/01/geo/wgs84_pos#long']); + unset($triples['http://www.w3.org/2003/01/geo/wgs84_pos#lat']); + unset($triples['http://dbpedia.org/property/hasPhotoCollection']); + unset($triples['http://www.w3.org/2004/02/skos/core#subject']); + unset($triples['http://www.w3.org/2000/01/rdf-schema#label']); // 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/>'.get_triple_table($triples); //BUILD SEARCHRESULT if ($fromCache==-1) $searchResult.="<a href=\"\" onclick=\"xajax_getsubjects('".$subject."');return false;\">Show more Results</a>"; - //BUILD ARTICLE TITLE - $artTitle=$triples['http://www.w3.org/2000/01/rdf-schema#label'][0]; //Restart the Session session_start(); @@ -151,15 +174,15 @@ //Add Positives to Session if (!isset($_SESSION['positive'])){ - if (isset($triples['http://dbpedia.org/property/redirect'])){ - $array=array($triples['http://dbpedia.org/property/redirect'][0] => $triples['http://dbpedia.org/property/redirect'][0]); + if ($redirect!=""){ + $array=array($redirect => $redirect); } else $array=array("http://dbpedia.org/resource/".str_replace(" ","_",$subject) => "http://dbpedia.org/resource/".str_replace(" ","_",$subject)); $_SESSION['positive']=$array; } else{ $array=$_SESSION['positive']; - if (isset($triples['http://dbpedia.org/property/redirect'])) $array[$triples['http://dbpedia.org/property/redirect'][0]] = $triples['http://dbpedia.org/property/redirect'][0]; + if ($redirect!="") $array[$redirect] = $redirect; else $array["http://dbpedia.org/resource/".str_replace(" ","_",$subject)]="http://dbpedia.org/resource/".str_replace(" ","_",$subject); $_SESSION['positive']=$array; } @@ -446,23 +469,57 @@ 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>'; + $table = '<table border="0"><tr><td>predicate</td><td>object</td></tr>'; + $i=1; + foreach($triples as $predicate=>$object) { + if ($i>0) $backgroundcolor="eee"; + else $backgroundcolor="ffffff"; + $table .= '<tr style="background-color:#'.$backgroundcolor.';"><td><a href="'.$predicate.'">'.nicePredicate($predicate).'</a></td>'; $table .= '<td><ul>'; foreach($object as $element) { - $table .= '<li>'.$element.'</li>'; + if ($element['type']=="uri") $table .= '<li><a href="'.$element['value'].'">'.$element['value'].'</a></li>'; + else $table .= '<li>'.$element['value'].'</li>'; } - $table .= '</ul></td>'; + $table .= '</ul></td>'; + $i*=-1; } $table .= '</table>'; return $table; +} + +function nicePredicate($predicate) +{ + if (strripos ($predicate, "#")>strripos ($predicate, "/")){ + $namespace=substr ($predicate,0,strripos ($predicate, "#")); + $name=substr ($predicate,strripos ($predicate, "#")+1); + } + else{ + $namespace=substr ($predicate,0,strripos ($predicate, "/")); + $name=substr ($predicate,strripos ($predicate, "/")+1); + } + + switch ($namespace){ + case "http://www.w3.org/2000/01/rdf-schema": $namespace="rdfs"; + break; + case "http://www.w3.org/2002/07/owl": $namespace="owl"; + break; + case "http://xmlns.com/foaf/0.1": $namespace="foaf"; + break; + case "http://dbpedia.org/property": $namespace="p"; + break; + case "http://www.w3.org/2003/01/geo/wgs84_pos": $namespace="geo"; + break; + case "http://www.w3.org/2004/02/skos/core": $namespace="skos"; + break; + } + + return $namespace.':'.$name; } function formatClassArray($ar) { $string = formatClass($ar[0]); for($i=1; $i<count($ar); $i++) { - $string .= ', ' . formatClass($ar[$i]); + $string .= ', ' . formatClass($ar[$i]['value']); } return $string; } Added: trunk/src/dbpedia-navigator/images/flickr.jpg =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/flickr.jpg ___________________________________________________________________ Name: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-02-27 12:05:23
|
Revision: 651 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=651&view=rev Author: sknappe Date: 2008-02-27 04:03:57 -0800 (Wed, 27 Feb 2008) Log Message: ----------- implemented a new tree menu (not yet finished) Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/ajaxfunctions.php trunk/src/dbpedia-navigator/index.php Added Paths: ----------- trunk/src/dbpedia-navigator/images/csh_bluebooks/ trunk/src/dbpedia-navigator/images/csh_bluebooks/Thumbs.db trunk/src/dbpedia-navigator/images/csh_bluebooks/blank.gif trunk/src/dbpedia-navigator/images/csh_bluebooks/book.gif trunk/src/dbpedia-navigator/images/csh_bluebooks/book_titel.gif trunk/src/dbpedia-navigator/images/csh_bluebooks/but_cut.gif trunk/src/dbpedia-navigator/images/csh_bluebooks/folderClosed.gif trunk/src/dbpedia-navigator/images/csh_bluebooks/folderOpen.gif trunk/src/dbpedia-navigator/images/csh_bluebooks/iconCheckAll.gif trunk/src/dbpedia-navigator/images/csh_bluebooks/iconCheckDis.gif trunk/src/dbpedia-navigator/images/csh_bluebooks/iconCheckGray.gif trunk/src/dbpedia-navigator/images/csh_bluebooks/iconChecked.gif trunk/src/dbpedia-navigator/images/csh_bluebooks/iconSafe.gif trunk/src/dbpedia-navigator/images/csh_bluebooks/iconText.gif trunk/src/dbpedia-navigator/images/csh_bluebooks/iconUncheckAll.gif trunk/src/dbpedia-navigator/images/csh_bluebooks/iconUncheckDis.gif trunk/src/dbpedia-navigator/images/csh_bluebooks/leaf.gif trunk/src/dbpedia-navigator/images/csh_bluebooks/line1.gif trunk/src/dbpedia-navigator/images/csh_bluebooks/line1_rtl.gif trunk/src/dbpedia-navigator/images/csh_bluebooks/line2.gif trunk/src/dbpedia-navigator/images/csh_bluebooks/line2_rtl.gif trunk/src/dbpedia-navigator/images/csh_bluebooks/line3.gif trunk/src/dbpedia-navigator/images/csh_bluebooks/line3_rtl.gif trunk/src/dbpedia-navigator/images/csh_bluebooks/line4.gif trunk/src/dbpedia-navigator/images/csh_bluebooks/line4_rtl.gif trunk/src/dbpedia-navigator/images/csh_bluebooks/lock.gif trunk/src/dbpedia-navigator/images/csh_bluebooks/minus.gif trunk/src/dbpedia-navigator/images/csh_bluebooks/minus2.gif trunk/src/dbpedia-navigator/images/csh_bluebooks/minus2_rtl.gif trunk/src/dbpedia-navigator/images/csh_bluebooks/minus3.gif trunk/src/dbpedia-navigator/images/csh_bluebooks/minus3_rtl.gif trunk/src/dbpedia-navigator/images/csh_bluebooks/minus4.gif trunk/src/dbpedia-navigator/images/csh_bluebooks/minus4_rtl.gif trunk/src/dbpedia-navigator/images/csh_bluebooks/minus5.gif trunk/src/dbpedia-navigator/images/csh_bluebooks/minus5_rtl.gif trunk/src/dbpedia-navigator/images/csh_bluebooks/plus.gif trunk/src/dbpedia-navigator/images/csh_bluebooks/plus2.gif trunk/src/dbpedia-navigator/images/csh_bluebooks/plus2_rtl.gif trunk/src/dbpedia-navigator/images/csh_bluebooks/plus3.gif trunk/src/dbpedia-navigator/images/csh_bluebooks/plus3_rtl.gif trunk/src/dbpedia-navigator/images/csh_bluebooks/plus4.gif trunk/src/dbpedia-navigator/images/csh_bluebooks/plus4_rtl.gif trunk/src/dbpedia-navigator/images/csh_bluebooks/plus5.gif trunk/src/dbpedia-navigator/images/csh_bluebooks/plus5_rtl.gif trunk/src/dbpedia-navigator/images/csh_bluebooks/radio_off.gif trunk/src/dbpedia-navigator/images/csh_bluebooks/radio_on.gif trunk/src/dbpedia-navigator/images/csh_bluebooks/tombs.gif trunk/src/dbpedia-navigator/processTreeMenu.php trunk/src/dbpedia-navigator/treemenu/ trunk/src/dbpedia-navigator/treemenu/dhtmlxcommon.js trunk/src/dbpedia-navigator/treemenu/dhtmlxtree.css trunk/src/dbpedia-navigator/treemenu/dhtmlxtree.js Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-02-27 11:39:21 UTC (rev 650) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-02-27 12:03:57 UTC (rev 651) @@ -137,7 +137,7 @@ $queryID=$this->client->sparqlQueryThreaded($this->id,$this->ksID,$query); $running=true; $i = 1; - $sleeptime = 1; + $sleeptime = 0.5; do { // sleep a while sleep($sleeptime); @@ -180,8 +180,7 @@ function getSubjectsFromConcept($concept) { $query="SELECT DISTINCT ?subject\n". - "WHERE { ?subject a <".$concept.">}\n". - "LIMIT 10"; + "WHERE { ?subject a <".$concept.">}\n"; $result=json_decode($this->getSparqlResult($query),true); if (count($result['results']['bindings'])==0) throw new Exception("Your query brought no result."); $ret=array(); @@ -191,6 +190,19 @@ return $ret; } + function getYagoSubCategories($category) + { + $query="SELECT DISTINCT ?subject\n". + "WHERE { ?subject <http://www.w3.org/2000/01/rdf-schema#subClassOf> <".$category.">}\n"; + $result=json_decode($this->getSparqlResult($query),true); + if (count($result['results']['bindings'])==0) throw new Exception("Your query brought no result."); + $ret=array(); + foreach ($result['results']['bindings'] as $results){ + $ret[]=$results['subject']['value']; + } + return $ret; + } + public function loadWSDLfiles($wsdluri){ $main=DLLearnerConnection::getwsdl($wsdluri); $other=DLLearnerConnection::getOtherWSDL($main); Modified: trunk/src/dbpedia-navigator/ajaxfunctions.php =================================================================== --- trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-02-27 11:39:21 UTC (rev 650) +++ trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-02-27 12:03:57 UTC (rev 651) @@ -430,16 +430,14 @@ require_once("DLLearnerConnection.php"); $sc=new DLLearnerConnection($id,$ksID); $subjects=$sc->getSubjectsFromConcept($concept); - foreach ($subjects as $subject) - { - $content.="<a href=\"\" onclick=\"xajax_getarticle('".urldecode(str_replace("_"," ",substr (strrchr ($subject, "/"), 1)))."',-2);return false;\">".urldecode(str_replace("_"," ",substr (strrchr ($subject, "/"), 1)))."</a><br/>"; - } + $content.=getResultsTable($subjects); } catch (Exception $e){ $content=$e->getMessage(); } $objResponse = new xajaxResponse(); - $objResponse->assign("searchcontent", "innerHTML", $content); + $objResponse->assign("articlecontent", "innerHTML", $content); + $objResponse->assign("ArticleTitle", "innerHTML", "Search Results"); return $objResponse; } @@ -459,6 +457,37 @@ // Helper Functions. // /////////////////////// +function getResultsTable($results) +{ + $ret="<p>Your search brought ".count($results)." results.</p><br/>"; + $i=0; + $display="block"; + while($i*30<count($results)) + { + $ret.="<div id='results".$i."' style='display:".$display."'>Seite ".($i+1)."<br/><br/>"; + for ($j=0;($j<30)&&(($i*30+$j)<count($results));$j++) + { + $result=$results[$i*30+$j]; + $ret.=" <a href=\"\" onclick=\"xajax_getarticle('".urldecode(str_replace("_"," ",substr (strrchr ($result, "/"), 1)))."',-2);return false;\">".urldecode(str_replace("_"," ",substr (strrchr ($result, "/"), 1)))."</a><br/>"; + } + $ret.="</div>"; + $i++; + $display="none"; + } + $ret.="<br/><p style='width:100%;text-align:center;'>"; + for ($k=0;$k<$i;$k++){ + $ret.="<a href=\"\" onClick=\"showdiv('results".($k)."');"; + for ($l=0;$l<$i;$l++) + { + if ($l!=$k) $ret.="hidediv('results".$l."');"; + } + $ret.="return false;\">".($k+1)."</a>"; + if ($k!=($i-1)) $ret.=" | "; + } + $ret.="</p>"; + return $ret; +} + function setRunning($id,$running) { if(!is_dir("temp")) mkdir("temp"); @@ -517,7 +546,7 @@ } function formatClassArray($ar) { - $string = formatClass($ar[0]); + $string = formatClass($ar[0]['value']); for($i=1; $i<count($ar); $i++) { $string .= ', ' . formatClass($ar[$i]['value']); } Added: trunk/src/dbpedia-navigator/images/csh_bluebooks/Thumbs.db =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/csh_bluebooks/Thumbs.db ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/csh_bluebooks/blank.gif =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/csh_bluebooks/blank.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/csh_bluebooks/book.gif =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/csh_bluebooks/book.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/csh_bluebooks/book_titel.gif =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/csh_bluebooks/book_titel.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/csh_bluebooks/but_cut.gif =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/csh_bluebooks/but_cut.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/csh_bluebooks/folderClosed.gif =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/csh_bluebooks/folderClosed.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/csh_bluebooks/folderOpen.gif =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/csh_bluebooks/folderOpen.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/csh_bluebooks/iconCheckAll.gif =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/csh_bluebooks/iconCheckAll.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/csh_bluebooks/iconCheckDis.gif =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/csh_bluebooks/iconCheckDis.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/csh_bluebooks/iconCheckGray.gif =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/csh_bluebooks/iconCheckGray.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/csh_bluebooks/iconChecked.gif =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/csh_bluebooks/iconChecked.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/csh_bluebooks/iconSafe.gif =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/csh_bluebooks/iconSafe.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/csh_bluebooks/iconText.gif =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/csh_bluebooks/iconText.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/csh_bluebooks/iconUncheckAll.gif =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/csh_bluebooks/iconUncheckAll.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/csh_bluebooks/iconUncheckDis.gif =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/csh_bluebooks/iconUncheckDis.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/csh_bluebooks/leaf.gif =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/csh_bluebooks/leaf.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/csh_bluebooks/line1.gif =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/csh_bluebooks/line1.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/csh_bluebooks/line1_rtl.gif =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/csh_bluebooks/line1_rtl.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/csh_bluebooks/line2.gif =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/csh_bluebooks/line2.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/csh_bluebooks/line2_rtl.gif =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/csh_bluebooks/line2_rtl.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/csh_bluebooks/line3.gif =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/csh_bluebooks/line3.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/csh_bluebooks/line3_rtl.gif =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/csh_bluebooks/line3_rtl.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/csh_bluebooks/line4.gif =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/csh_bluebooks/line4.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/csh_bluebooks/line4_rtl.gif =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/csh_bluebooks/line4_rtl.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/csh_bluebooks/lock.gif =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/csh_bluebooks/lock.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/csh_bluebooks/minus.gif =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/csh_bluebooks/minus.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/csh_bluebooks/minus2.gif =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/csh_bluebooks/minus2.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/csh_bluebooks/minus2_rtl.gif =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/csh_bluebooks/minus2_rtl.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/csh_bluebooks/minus3.gif =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/csh_bluebooks/minus3.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/csh_bluebooks/minus3_rtl.gif =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/csh_bluebooks/minus3_rtl.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/csh_bluebooks/minus4.gif =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/csh_bluebooks/minus4.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/csh_bluebooks/minus4_rtl.gif =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/csh_bluebooks/minus4_rtl.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/csh_bluebooks/minus5.gif =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/csh_bluebooks/minus5.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/csh_bluebooks/minus5_rtl.gif =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/csh_bluebooks/minus5_rtl.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/csh_bluebooks/plus.gif =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/csh_bluebooks/plus.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/csh_bluebooks/plus2.gif =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/csh_bluebooks/plus2.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/csh_bluebooks/plus2_rtl.gif =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/csh_bluebooks/plus2_rtl.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/csh_bluebooks/plus3.gif =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/csh_bluebooks/plus3.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/csh_bluebooks/plus3_rtl.gif =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/csh_bluebooks/plus3_rtl.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/csh_bluebooks/plus4.gif =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/csh_bluebooks/plus4.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/csh_bluebooks/plus4_rtl.gif =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/csh_bluebooks/plus4_rtl.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/csh_bluebooks/plus5.gif =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/csh_bluebooks/plus5.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/csh_bluebooks/plus5_rtl.gif =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/csh_bluebooks/plus5_rtl.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/csh_bluebooks/radio_off.gif =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/csh_bluebooks/radio_off.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/csh_bluebooks/radio_on.gif =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/csh_bluebooks/radio_on.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dbpedia-navigator/images/csh_bluebooks/tombs.gif =================================================================== (Binary files differ) Property changes on: trunk/src/dbpedia-navigator/images/csh_bluebooks/tombs.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-02-27 11:39:21 UTC (rev 650) +++ trunk/src/dbpedia-navigator/index.php 2008-02-27 12:03:57 UTC (rev 651) @@ -18,14 +18,15 @@ $settings=new Settings(); //what happens onLoad -$onload=""; +$onLoad="onLoad=\""; if (isset($_GET['resource'])){ - $onLoad.="onLoad=\"xajax_getarticle('".$_GET['resource']."',-1);return false;\""; + $onLoad.="xajax_getarticle('".$_GET['resource']."',-1);"; unset($_GET['resource']); } else if (isset($_SESSION['currentArticle'])){ - $onLoad.="onLoad=\"xajax_getarticle('',".$_SESSION['currentArticle'].");return false;\""; + $onLoad.="xajax_getarticle('',".$_SESSION['currentArticle'].");"; } +$onLoad.="\""; require("ajax.php"); @@ -39,10 +40,13 @@ <title>DBpedia Navigator</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> <link rel="stylesheet" href="<?php print $path;?>default.css"/> + <link rel="stylesheet" type="text/css" href="<?php print $path;?>treemenu/dhtmlxtree.css"> <?php $xajax->printJavascript($path.'xajax/'); ?> <script src="http://maps.google.com/maps?file=api&v=2&key=<?php print $settings->googleMapsKey;?>" type="text/javascript"></script> - <script type="text/javascript"> + <script src="<?php print $path;?>treemenu/dhtmlxcommon.js"></script> + <script src="<?php print $path;?>treemenu/dhtmlxtree.js"></script> + <script type="text/javascript"> showLoading = function() { xajax.$('Loading').style.display='inline'; }; @@ -111,6 +115,20 @@ <div id="searchcontent" style="display:block"></div> </div> <!-- boxcontent --> </div> <!-- box --> + + <div class="box" id="NavigationBox"> + <div class="boxtitle">Navigate</div> + <div class="boxcontent"> + <div id="treeboxbox_tree" style="width:250; height:218;background-color:#f5f5f5;border :1px solid Silver;; overflow:auto;"> + <script> + tree=new dhtmlXTreeObject("treeboxbox_tree","100%","100%",0); + tree.setImagePath("<?php print $path;?>images/csh_bluebooks/"); + tree.setXMLAutoLoading("processTreeMenu.php"); + tree.loadXML("processTreeMenu.php?id=0"); + </script> + </div> + </div> <!-- boxcontent --> + </div> <!-- box --> <div class="box" id="credits"> <p>DBpedia Navigator is powered by ... <br /> Added: trunk/src/dbpedia-navigator/processTreeMenu.php =================================================================== --- trunk/src/dbpedia-navigator/processTreeMenu.php (rev 0) +++ trunk/src/dbpedia-navigator/processTreeMenu.php 2008-02-27 12:03:57 UTC (rev 651) @@ -0,0 +1,21 @@ +<?php header("Content-type:text/xml"); print("<?xml version=\"1.0\"?>"); +if (isset($_GET["id"])) + $url_var=$_GET["id"]; +else + $url_var=0; + + + +print("<tree id='".$url_var."'>"); + if (!$url_var) print("<item child=\"1\" id=\"http://dbpedia.org/class/yago/Entity100001740\" text=\"Entity\"><userdata name='ud_block'>ud_data</userdata></item>"); + else{ + require_once("DLLearnerConnection.php"); + $sc=new DLLearnerConnection(); + $ids=$sc->getIDs(); + $sc=new DLLearnerConnection($ids[0],$ids[1]); + $categories=$sc->getYagoSubCategories($url_var); + foreach ($categories as $category) + print("<item child=\"1\" id=\"".$category."\" text=\"".substr (strrchr ($category, "/"), 1)."\"><userdata name='ud_block'>ud_data</userdata></item>"); + } +print("</tree>"); +?> Added: trunk/src/dbpedia-navigator/treemenu/dhtmlxcommon.js =================================================================== --- trunk/src/dbpedia-navigator/treemenu/dhtmlxcommon.js (rev 0) +++ trunk/src/dbpedia-navigator/treemenu/dhtmlxcommon.js 2008-02-27 12:03:57 UTC (rev 651) @@ -0,0 +1,51 @@ +//v.1.6 build 71114 + +/* +Copyright DHTMLX LTD. http://www.dhtmlx.com +You allowed to use this component or parts of it under GPL terms +To use it on other terms or get Professional edition of the component please contact us at sa...@dh... +*/ + +function dtmlXMLLoaderObject(funcObject, dhtmlObject,async,rSeed){this.xmlDoc="";if (typeof(async)!= "undefined") + this.async = async;else this.async = true;this.onloadAction=funcObject||null;this.mainObject=dhtmlObject||null;this.waitCall=null;this.rSeed=rSeed||false;return this};dtmlXMLLoaderObject.prototype.waitLoadFunction=function(dhtmlObject){var once=true;this.check=function (){if ((dhtmlObject)&&(dhtmlObject.onloadAction!=null)){if ((!dhtmlObject.xmlDoc.readyState)||(dhtmlObject.xmlDoc.readyState == 4)){if (!once)return;once=false;dhtmlObject.onloadAction(dhtmlObject.mainObject,null,null,null,dhtmlObject);if (dhtmlObject.waitCall){dhtmlObject.waitCall();dhtmlObject.waitCall=null}}}};return this.check};dtmlXMLLoaderObject.prototype.getXMLTopNode=function(tagName,oldObj){if (this.xmlDoc.responseXML){var temp=this.xmlDoc.responseXML.getElementsByTagName(tagName);var z=temp[0]}else + var z=this.xmlDoc.documentElement;if (z){this._retry=false;return z};if ((_isIE)&&(!this._retry)){var xmlString=this.xmlDoc.responseText;var oldObj=this.xmlDoc;this._retry=true;this.xmlDoc = new ActiveXObject("Microsoft.XMLDOM");this.xmlDoc.async=false;this.xmlDoc["loadXM"+"L"](xmlString);return this.getXMLTopNode(tagName,oldObj)};dhtmlxError.throwError("LoadXML","Incorrect XML",[(oldObj||this.xmlDoc),this.mainObject]);return document.createElement("DIV")};dtmlXMLLoaderObject.prototype.loadXMLString=function(xmlString){if (_isKHTML){var z=document.createElement('div');z.innerHTML = xmlString;this.xmlDoc=z;z.responseXML=z}else + {try + {var parser = new DOMParser();this.xmlDoc = parser.parseFromString(xmlString,"text/xml")}catch(e){this.xmlDoc = new ActiveXObject("Microsoft.XMLDOM");this.xmlDoc.async=this.async;this.xmlDoc["loadXM"+"L"](xmlString)}};this.onloadAction(this.mainObject,null,null,null,this);if (this.waitCall){this.waitCall();this.waitCall=null}};dtmlXMLLoaderObject.prototype.loadXML=function(filePath,postMode,postVars,rpc){if (this.rSeed)filePath+=((filePath.indexOf("?")!=-1)?"&":"?")+"a_dhx_rSeed="+(new Date()).valueOf();this.filePath=filePath;if ((!_isIE)&&(window.XMLHttpRequest)) + this.xmlDoc = new XMLHttpRequest();else{if (document.implementation && document.implementation.createDocument){this.xmlDoc = document.implementation.createDocument("", "", null);this.xmlDoc.onload = new this.waitLoadFunction(this);this.xmlDoc.load(filePath);return}else + this.xmlDoc = new ActiveXObject("Microsoft.XMLHTTP")};this.xmlDoc.open(postMode?"POST":"GET",filePath,this.async);if (rpc){this.xmlDoc.setRequestHeader("User-Agent", "dhtmlxRPC v0.1 (" + navigator.userAgent + ")");this.xmlDoc.setRequestHeader("Content-type", "text/xml")}else + if (postMode)this.xmlDoc.setRequestHeader('Content-type','application/x-www-form-urlencoded');this.xmlDoc.onreadystatechange=new this.waitLoadFunction(this);this.xmlDoc.send(null||postVars)};dtmlXMLLoaderObject.prototype.destructor=function(){this.onloadAction=null;this.mainObject=null;this.xmlDoc=null;return null};function callerFunction(funcObject,dhtmlObject){this.handler=function(e){if (!e)e=window.event;funcObject(e,dhtmlObject);return true};return this.handler};function getAbsoluteLeft(htmlObject){var xPos = htmlObject.offsetLeft;var temp = htmlObject.offsetParent;while (temp != null){xPos += temp.offsetLeft;temp = temp.offsetParent};return xPos};function getAbsoluteTop(htmlObject) {var yPos = htmlObject.offsetTop;var temp = htmlObject.offsetParent;while (temp != null){yPos += temp.offsetTop;temp = temp.offsetParent};return yPos};function convertStringToBoolean(inputString){if (typeof(inputString)=="string") inputString=inputString.toLowerCase();switch(inputString){case "1": + case "true": + case "yes": + case "y": + case 1: + case true: + return true;break;default: return false}};function getUrlSymbol(str){if(str.indexOf("?")!=-1) + return "&" + else + return "?" + };function dhtmlDragAndDropObject(){if (window.dhtmlDragAndDrop)return window.dhtmlDragAndDrop;this.lastLanding=0;this.dragNode=0;this.dragStartNode=0;this.dragStartObject=0;this.tempDOMU=null;this.tempDOMM=null;this.waitDrag=0;window.dhtmlDragAndDrop=this;return this};dhtmlDragAndDropObject.prototype.removeDraggableItem=function(htmlNode){htmlNode.onmousedown=null;htmlNode.dragStarter=null;htmlNode.dragLanding=null};dhtmlDragAndDropObject.prototype.addDraggableItem=function(htmlNode,dhtmlObject){htmlNode.onmousedown=this.preCreateDragCopy;htmlNode.dragStarter=dhtmlObject;this.addDragLanding(htmlNode,dhtmlObject)};dhtmlDragAndDropObject.prototype.addDragLanding=function(htmlNode,dhtmlObject){htmlNode.dragLanding=dhtmlObject};dhtmlDragAndDropObject.prototype.preCreateDragCopy=function(e) + {if (window.dhtmlDragAndDrop.waitDrag){window.dhtmlDragAndDrop.waitDrag=0;document.body.onmouseup=window.dhtmlDragAndDrop.tempDOMU;document.body.onmousemove=window.dhtmlDragAndDrop.tempDOMM;return false};window.dhtmlDragAndDrop.waitDrag=1;window.dhtmlDragAndDrop.tempDOMU=document.body.onmouseup;window.dhtmlDragAndDrop.tempDOMM=document.body.onmousemove;window.dhtmlDragAndDrop.dragStartNode=this;window.dhtmlDragAndDrop.dragStartObject=this.dragStarter;document.body.onmouseup=window.dhtmlDragAndDrop.preCreateDragCopy;document.body.onmousemove=window.dhtmlDragAndDrop.callDrag;if ((e)&&(e.preventDefault)) {e.preventDefault();return false};return false};dhtmlDragAndDropObject.prototype.callDrag=function(e){if (!e)e=window.event;dragger=window.dhtmlDragAndDrop;if ((e.button==0)&&(_isIE)) return dragger.stopDrag();if (!dragger.dragNode){dragger.dragNode=dragger.dragStartObject._createDragNode(dragger.dragStartNode,e);if (!dragger.dragNode)return dragger.stopDrag();dragger.gldragNode=dragger.dragNode;document.body.appendChild(dragger.dragNode);document.body.onmouseup=dragger.stopDrag;dragger.waitDrag=0;dragger.dragNode.pWindow=window;dragger.initFrameRoute()};if (dragger.dragNode.parentNode!=window.document.body){var grd=dragger.gldragNode;if (dragger.gldragNode.old)grd=dragger.gldragNode.old;grd.parentNode.removeChild(grd);var oldBody=dragger.dragNode.pWindow;if (_isIE){var div=document.createElement("Div");div.innerHTML=dragger.dragNode.outerHTML;dragger.dragNode=div.childNodes[0]}else dragger.dragNode=dragger.dragNode.cloneNode(true);dragger.dragNode.pWindow=window;dragger.gldragNode.old=dragger.dragNode;document.body.appendChild(dragger.dragNode);oldBody.dhtmlDragAndDrop.dragNode=dragger.dragNode};dragger.dragNode.style.left=e.clientX+15+(dragger.fx?dragger.fx*(-1):0)+(document.body.scrollLeft||document.documentElement.scrollLeft)+"px";dragger.dragNode.style.top=e.clientY+3+(dragger.fy?dragger.fy*(-1):0)+(document.body.scrollTop||document.documentElement.scrollTop)+"px";if (!e.srcElement)var z=e.target;else z=e.srcElement;dragger.checkLanding(z,e)};dhtmlDragAndDropObject.prototype.calculateFramePosition=function(n){if (window.name){var el =parent.frames[window.name].frameElement.offsetParent;var fx=0;var fy=0;while (el){fx += el.offsetLeft;fy += el.offsetTop;el = el.offsetParent};if ((parent.dhtmlDragAndDrop)) {var ls=parent.dhtmlDragAndDrop.calculateFramePosition(1);fx+=ls.split('_')[0]*1;fy+=ls.split('_')[1]*1};if (n)return fx+"_"+fy;else this.fx=fx;this.fy=fy};return "0_0"};dhtmlDragAndDropObject.prototype.checkLanding=function(htmlObject,e){if ((htmlObject)&&(htmlObject.dragLanding)) {if (this.lastLanding)this.lastLanding.dragLanding._dragOut(this.lastLanding);this.lastLanding=htmlObject;this.lastLanding=this.lastLanding.dragLanding._dragIn(this.lastLanding,this.dragStartNode,e.clientX, e.clientY,e);this.lastLanding_scr=(_isIE?e.srcElement:e.target)}else {if ((htmlObject)&&(htmlObject.tagName!="BODY")) this.checkLanding(htmlObject.parentNode,e);else {if (this.lastLanding)this.lastLanding.dragLanding._dragOut(this.lastLanding,e.clientX, e.clientY,e);this.lastLanding=0;if (this._onNotFound)this._onNotFound()}}};dhtmlDragAndDropObject.prototype.stopDrag=function(e,mode){dragger=window.dhtmlDragAndDrop;if (!mode){dragger.stopFrameRoute();var temp=dragger.lastLanding;dragger.lastLanding=null;if (temp)temp.dragLanding._drag(dragger.dragStartNode,dragger.dragStartObject,temp,(_isIE?event.srcElement:e.target))};dragger.lastLanding=null;if ((dragger.dragNode)&&(dragger.dragNode.parentNode==document.body)) dragger.dragNode.parentNode.removeChild(dragger.dragNode);dragger.dragNode=0;dragger.gldragNode=0;dragger.fx=0;dragger.fy=0;dragger.dragStartNode=0;dragger.dragStartObject=0;document.body.onmouseup=dragger.tempDOMU;document.body.onmousemove=dragger.tempDOMM;dragger.tempDOMU=null;dragger.tempDOMM=null;dragger.waitDrag=0};dhtmlDragAndDropObject.prototype.stopFrameRoute=function(win){if (win)window.dhtmlDragAndDrop.stopDrag(1,1);for (var i=0;i<window.frames.length;i++)if ((window.frames[i]!=win)&&(window.frames[i].dhtmlDragAndDrop)) + window.frames[i].dhtmlDragAndDrop.stopFrameRoute(window);if ((parent.dhtmlDragAndDrop)&&(parent!=window)&&(parent!=win)) + parent.dhtmlDragAndDrop.stopFrameRoute(window)};dhtmlDragAndDropObject.prototype.initFrameRoute=function(win,mode){if (win){window.dhtmlDragAndDrop.preCreateDragCopy();window.dhtmlDragAndDrop.dragStartNode=win.dhtmlDragAndDrop.dragStartNode;window.dhtmlDragAndDrop.dragStartObject=win.dhtmlDragAndDrop.dragStartObject;window.dhtmlDragAndDrop.dragNode=win.dhtmlDragAndDrop.dragNode;window.dhtmlDragAndDrop.gldragNode=win.dhtmlDragAndDrop.dragNode;window.document.body.onmouseup=window.dhtmlDragAndDrop.stopDrag;window.waitDrag=0;if (((!_isIE)&&(mode))&&((!_isFF)||(_FFrv<1.8))) + window.dhtmlDragAndDrop.calculateFramePosition()};if ((parent.dhtmlDragAndDrop)&&(parent!=window)&&(parent!=win)) + parent.dhtmlDragAndDrop.initFrameRoute(window);for (var i=0;i<window.frames.length;i++)if ((window.frames[i]!=win)&&(window.frames[i].dhtmlDragAndDrop)) + window.frames[i].dhtmlDragAndDrop.initFrameRoute(window,((!win||mode)?1:0))};var _isFF=false;var _isIE=false;var _isOpera=false;var _isKHTML=false;var _isMacOS=false;if (navigator.userAgent.indexOf('Macintosh')!= -1) _isMacOS=true;if ((navigator.userAgent.indexOf('Safari')!= -1)||(navigator.userAgent.indexOf('Konqueror')!= -1)) + _isKHTML=true;else if (navigator.userAgent.indexOf('Opera')!= -1){_isOpera=true;_OperaRv=parseFloat(navigator.userAgent.substr(navigator.userAgent.indexOf('Opera')+6,3))}else if(navigator.appName.indexOf("Microsoft")!=-1) + _isIE=true;else {_isFF=true;var _FFrv=parseFloat(navigator.userAgent.split("rv:")[1]) + };function isIE(){if(navigator.appName.indexOf("Microsoft")!=-1) + if (navigator.userAgent.indexOf('Opera')== -1) + return true;return false};dtmlXMLLoaderObject.prototype.doXPath = function(xpathExp,docObj){if ((_isOpera)||(_isKHTML)) return this.doXPathOpera(xpathExp,docObj);if(_isIE){if(!docObj)if(!this.xmlDoc.nodeName)docObj = this.xmlDoc.responseXML + else + docObj = this.xmlDoc;return docObj.selectNodes(xpathExp)}else{var nodeObj = docObj;if(!docObj){if(!this.xmlDoc.nodeName){docObj = this.xmlDoc.responseXML + }else{docObj = this.xmlDoc}};if(docObj.nodeName.indexOf("document")!=-1){nodeObj = docObj}else{nodeObj = docObj;docObj = docObj.ownerDocument};var rowsCol = new Array();var col = docObj.evaluate(xpathExp, nodeObj, null, XPathResult.ANY_TYPE,null);var thisColMemb = col.iterateNext();while (thisColMemb){rowsCol[rowsCol.length] = thisColMemb;thisColMemb = col.iterateNext()};return rowsCol}};function _dhtmlxError(type,name,params){if (!this.catches)this.catches=new Array();return this};_dhtmlxError.prototype.catchError=function(type,func_name){this.catches[type]=func_name};_dhtmlxError.prototype.throwError=function(type,name,params){if (this.catches[type])return this.catches[type](type,name,params);if (this.catches["ALL"])return this.catches["ALL"](type,name,params);alert("Error type: " + arguments[0]+"\nDescription: " + arguments[1] );return null};window.dhtmlxError=new _dhtmlxError();dtmlXMLLoaderObject.prototype.doXPathOpera = function(xpathExp,docObj){var z=xpathExp.replace(/[\/]+/gi,"/").split('/');var obj=null;var i=1;if (!z.length)return [];if (z[0]==".")obj=[docObj];else if (z[0]==""){obj=this.xmlDoc.responseXML.getElementsByTagName(z[i].replace(/\[[^\]]*\]/g,""));i++}else return [];for (i;i<z.length;i++)obj=this._getAllNamedChilds(obj,z[i]);if (z[i-1].indexOf("[")!=-1) + obj=this._filterXPath(obj,z[i-1]);return obj};dtmlXMLLoaderObject.prototype._filterXPath = function(a,b){var c=new Array();var b=b.replace(/[^\[]*\[\@/g,"").replace(/[\[\]\@]*/g,"");for (var i=0;i<a.length;i++)if (a[i].getAttribute(b)) + c[c.length]=a[i];return c};dtmlXMLLoaderObject.prototype._getAllNamedChilds = function(a,b){var c=new Array();if (_isKHTML)b=b.toUpperCase();for (var i=0;i<a.length;i++)for (var j=0;j<a[i].childNodes.length;j++){if (_isKHTML){if (a[i].childNodes[j].tagName && a[i].childNodes[j].tagName.toUpperCase()==b) + c[c.length]=a[i].childNodes[j]}else + if (a[i].childNodes[j].tagName==b)c[c.length]=a[i].childNodes[j]};return c};function dhtmlXHeir(a,b){for (c in b)if (typeof(b[c])=="function") a[c]=b[c];return a};function dhtmlxEvent(el,event,handler){if (el.addEventListener)el.addEventListener(event,handler,false);else if (el.attachEvent)el.attachEvent("on"+event,handler)}; +//v.1.6 build 71114 + +/* +Copyright DHTMLX LTD. http://www.dhtmlx.com +You allowed to use this component or parts of it under GPL terms +To use it on other terms or get Professional edition of the component please contact us at sa...@dh... +*/ \ No newline at end of file Added: trunk/src/dbpedia-navigator/treemenu/dhtmlxtree.css =================================================================== --- trunk/src/dbpedia-navigator/treemenu/dhtmlxtree.css (rev 0) +++ trunk/src/dbpedia-navigator/treemenu/dhtmlxtree.css 2008-02-27 12:03:57 UTC (rev 651) @@ -0,0 +1,61 @@ +.defaultTreeTable{ + margin : 0px; + padding : 0px; + border : 0px; +} +.containerTableStyle { overflow : auto; position:relative; top:0; font-size : 12px;} +.containerTableStyleRTL span { direction: rtl; unicode-bidi: bidi-override; } +.containerTableStyleRTL { direction: rtl; overflow : auto; position:relative; top:0; font-size : 12px;} +.standartTreeRow{ font-family : Verdana, Geneva, Arial, Helvetica, sans-serif; font-size : 12px; -moz-user-select: none; } +.selectedTreeRow{ background-color : navy; color:white; font-family : Verdana, Geneva, Arial, Helvetica, sans-serif; font-size : 12px; -moz-user-select: none; } +.dragAndDropRow{ background-color : navy; color:white; } +.standartTreeRow_lor{ text-decoration:underline; background-color : #FFFFF0; font-family : Verdana, Geneva, Arial, Helvetica, sans-serif; font-size : 12px; -moz-user-select: none; } +.selectedTreeRow_lor{ text-decoration:underline; background-color : navy; color:white; font-family : Verdana, Geneva, Arial, Helvetica, sans-serif; font-size : 12px; -moz-user-select: none; } + +.standartTreeImage{ width:18px; height:18px; overflow:hidden; border:0; padding:0; margin:0; +font-size:1px; } +.hiddenRow { width:1px; overflow:hidden; } +.dragSpanDiv,.dragSpanDiv td{ font-size : 12px; background-color:white; } + + +.selectionBox{ +background-color: #FFFFCC; +} +.selectionBar { + top:0; + background-color: Black; + position:absolute; + overflow:hidden; + height: 2px; + z-index : 11; +} + +.intreeeditRow{ + width:100%; font-size:8pt; height:16px; border:1px solid silver; padding:0; margin:0; + -moz-user-select: text; +} +.dhx_tree_textSign{ + font-size:8pt; + font-family:monospace; + width:21px; + color:black; + padding:0px; + margin:0px; + cursor:pointer; + text-align: center; +} +.dhx_tree_opacity{ + opacity:0; + -moz-opacity:0; + filter:alpha(opacity=0); +} +.dhx_bg_img_fix{ +width:18px; +height:18px; +background-repeat: no-repeat; +background-position: center; +background-position-x: center; +background-position-y: center; +} + + Added: trunk/src/dbpedia-navigator/treemenu/dhtmlxtree.js =================================================================== --- trunk/src/dbpedia-navigator/treemenu/dhtmlxtree.js (rev 0) +++ trunk/src/dbpedia-navigator/treemenu/dhtmlxtree.js 2008-02-27 12:03:57 UTC (rev 651) @@ -0,0 +1,188 @@ +//v.1.6 build 71114 + +/* +Copyright DHTMLX LTD. http://www.dhtmlx.com +You allowed to use this component or parts of it under GPL terms +To use it on other terms or get Professional edition of the component please contact us at sa...@dh... +*/ + + +function xmlPointer(data){this.d=data};xmlPointer.prototype={text:function(){if (!_isFF)return this.d.xml;var x = new XMLSerializer();return x.serializeToString(this.d)}, + get:function(name){return this.d.getAttribute(name)}, + exists:function(){return !!this.d }, + content:function(){return this.d.firstChild?this.d.firstChild.data:""}, + each:function(name,f,t,i){var a=this.d.childNodes;var c=new xmlPointer();if (a.length)for (i=i||0;i<a.length;i++)if (a[i].tagName==name){c.d=a[i];if(f.apply(t,[c,i])==-1) return}}, + get_all:function(){var a={};var b=this.d.attributes;for (var i=0;i<b.length;i++)a[b[i].name]=b[i].value;return a}, + sub:function(name){var a=this.d.childNodes;var c=new xmlPointer();if (a.length)for (var i=0;i<a.length;i++)if (a[i].tagName==name){c.d=a[i];return c}}, + up:function(name){return new xmlPointer(this.d.parentNode)}, + set:function(name,val){this.d.setAttribute(name,val)}, + clone:function(name){return new xmlPointer(this.d)}, + sub_exists:function(name){var a=this.d.childNodes;if (a.length)for (var i=0;i<a.length;i++)if (a[i].tagName==name)return true;return false}, + through:function(name,rule,v,f,t){var a=this.d.childNodes;if (a.length)for (var i=0;i<a.length;i++){if (a[i].tagName==name && a[i].getAttribute(rule)!=null && a[i].getAttribute(rule)!="" && (!v || a[i].getAttribute(rule)==v )) {var c=new xmlPointer(a[i]);f.apply(t,[c,i])};var w=this.d;this.d=a[i];this.through(name,rule,v,f,t);this.d=w}}};function dhtmlXTreeObject(htmlObject, width, height, rootId){if (_isIE)try {document.execCommand("BackgroundImageCache", false, true)}catch (e){};if (typeof(htmlObject)!="object") + this.parentObject=document.getElementById(htmlObject);else + this.parentObject=htmlObject;this._itim_dg=true;this.dlmtr=",";this.dropLower=false;this.enableIEImageFix();this.xmlstate=0;this.mytype="tree";this.smcheck=true;this.width=width;this.height=height;this.rootId=rootId;this.childCalc=null;this.def_img_x="18px";this.def_img_y="18px";this.def_line_img_x="18px";this.def_line_img_y="18px";this._dragged=new Array();this._selected=new Array();this.style_pointer="pointer";if (_isIE)this.style_pointer="hand";this._aimgs=true;this.htmlcA=" [";this.htmlcB="]";this.lWin=window;this.cMenu=0;this.mlitems=0;this.dadmode=0;this.slowParse=false;this.autoScroll=true;this.hfMode=0;this.nodeCut=new Array();this.XMLsource=0;this.XMLloadingWarning=0;this._idpull={};this._pullSize=0;this.treeLinesOn=true;this.tscheck=false;this.timgen=true;this.dpcpy=false;this._ld_id=null;this._oie_onXLE=[];this.imPath="treeGfx/";this.checkArray=new Array("iconUncheckAll.gif","iconCheckAll.gif","iconCheckGray.gif","iconUncheckDis.gif","iconCheckDis.gif","iconCheckDis.gif");this.radioArray=new Array("radio_off.gif","radio_on.gif","radio_on.gif","radio_off.gif","radio_on.gif","radio_on.gif");this.lineArray=new Array("line2.gif","line3.gif","line4.gif","blank.gif","blank.gif","line1.gif");this.minusArray=new Array("minus2.gif","minus3.gif","minus4.gif","minus.gif","minus5.gif");this.plusArray=new Array("plus2.gif","plus3.gif","plus4.gif","plus.gif","plus5.gif");this.imageArray=new Array("leaf.gif","folderOpen.gif","folderClosed.gif");this.cutImg= new Array(0,0,0);this.cutImage="but_cut.gif";this.dragger= new dhtmlDragAndDropObject();this.htmlNode=new dhtmlXTreeItemObject(this.rootId,"",0,this);this.htmlNode.htmlNode.childNodes[0].childNodes[0].style.display="none";this.htmlNode.htmlNode.childNodes[0].childNodes[0].childNodes[0].className="hiddenRow";this.allTree=this._createSelf();this.allTree.appendChild(this.htmlNode.htmlNode);if(_isFF)this.allTree.childNodes[0].width="100%";var self=this;this.allTree.onselectstart=new Function("return false;");if (_isMacOS)this.allTree.oncontextmenu = function(e){return self._doContClick(e||window.event)};this.allTree.onmousedown = function(e){return self._doContClick(e||window.event)};this.XMLLoader=new dtmlXMLLoaderObject(this._parseXMLTree,this,true,this.no_cashe);if (_isIE)this.preventIECashing(true);if (window.addEventListener)window.addEventListener("unload",function(){try{self.destructor()}catch(e){}},false);if (window.attachEvent)window.attachEvent("onunload",function(){try{self.destructor()}catch(e){}});this.dhx_Event();this._onEventSet={onMouseIn:function(){this.ehlt=true},onMouseOut:function(){this.ehlt=true},onSelect:function(){this._onSSCF=true}};return this};dhtmlXTreeObject.prototype.setDataMode=function(mode){this._datamode=mode};dhtmlXTreeObject.prototype._doContClick=function(ev){if (ev.button!=2){if(this._acMenu)this.cMenu._contextEnd();return true};var el=(_isIE?ev.srcElement:ev.target);while ((el)&&(el.tagName!="BODY")) {if (el.parentObject)break;el=el.parentNode};if ((!el)||(!el.parentObject)) return true;var obj=el.parentObject;this._acMenu=(obj.cMenu||this.cMenu);if (this._acMenu){el.contextMenuId=obj.id;el.contextMenu=this._acMenu;el.a=this._acMenu._contextStart;if (_isIE)ev.srcElement.oncontextmenu = function(){event.cancelBubble=true;return false};el.a(el,ev);el.a=null;ev.cancelBubble=true;return false};return true};dhtmlXTreeObject.prototype.enableIEImageFix=function(mode){if (!mode){this._getImg=function(id){return document.createElement((id==this.rootId)?"div":"img")};this._setSrc=function(a,b){a.src=b};this._getSrc=function(a){return a.src}}else {this._getImg=function(){var z=document.createElement("DIV");z.innerHTML=" ";z.className="dhx_bg_img_fix";return z};this._setSrc=function(a,b){a.style.backgroundImage="url("+b+")"};this._getSrc=function(a){var z=a.style.backgroundImage;return z.substr(4,z.length-5)}}};dhtmlXTreeObject.prototype.destructor=function(){for (var a in this._idpull){var z=this._idpull[a];if (!z)continue;z.parentObject=null;z.treeNod=null;z.childNodes=null;z.span=null;z.tr.nodem=null;z.tr=null;z.htmlNode.objBelong=null;z.htmlNode=null;this._idpull[a]=null};this.allTree.innerHTML="";this.XMLLoader.destructor();for(var a in this){this[a]=null}};function cObject(){return this};cObject.prototype= new Object;cObject.prototype.clone = function () {function _dummy(){};_dummy.prototype=this;return new _dummy()};function dhtmlXTreeItemObject(itemId,itemText,parentObject,treeObject,actionHandler,mode){this.htmlNode="";this.acolor="";this.scolor="";this.tr=0;this.childsCount=0;this.tempDOMM=0;this.tempDOMU=0;this.dragSpan=0;this.dragMove=0;this.span=0;this.closeble=1;this.childNodes=new Array();this.userData=new cObject();this.checkstate=0;this.treeNod=treeObject;this.label=itemText;this.parentObject=parentObject;this.actionHandler=actionHandler;this.images=new Array(treeObject.imageArray[0],treeObject.imageArray[1],treeObject.imageArray[2]);this.id=treeObject._globalIdStorageAdd(itemId,this);if (this.treeNod.checkBoxOff )this.htmlNode=this.treeNod._createItem(1,this,mode);else this.htmlNode=this.treeNod._createItem(0,this,mode);this.htmlNode.objBelong=this;return this};dhtmlXTreeObject.prototype._globalIdStorageAdd=function(itemId,itemObject){if (this._globalIdStorageFind(itemId,1,1)) {itemId=itemId +"_"+(new Date()).valueOf();return this._globalIdStorageAdd(itemId,itemObject)};this._idpull[itemId]=itemObject;this._pullSize++;return itemId};dhtmlXTreeObject.prototype._globalIdStorageSub=function(itemId){if (this._idpull[itemId]){this._unselectItem(this._idpull[itemId]);this._idpull[itemId]=null;this._pullSize--};if ((this._locker)&&(this._locker[itemId])) this._locker[itemId]=false};dhtmlXTreeObject.prototype._globalIdStorageFind=function(itemId,skipXMLSearch,skipParsing,isreparse){var z=this._idpull[itemId] + if (z){return z};return null};dhtmlXTreeObject.prototype._escape=function(str){switch(this.utfesc){case "none": + return str;break;case "utf8": + return encodeURI(str);break;default: + return escape(str);break}};dhtmlXTreeObject.prototype._drawNewTr=function(htmlObject,node) + {var tr =document.createElement('tr');var td1=document.createElement('td');var td2=document.createElement('td');td1.appendChild(document.createTextNode(" "));td2.colSpan=3;td2.appendChild(htmlObject);tr.appendChild(td1);tr.appendChild(td2);return tr};dhtmlXTreeObject.prototype.loadXMLString=function(xmlString,afterCall){var that=this;if (!this.parsCount)this.callEvent("onXLS",[that,null]);this.xmlstate=1;if (afterCall)this.XMLLoader.waitCall=afterCall;this.XMLLoader.loadXMLString(xmlString)};dhtmlXTreeObject.prototype.loadXML=function(file,afterCall){if (this._datamode && this._datamode!="xml")return this["load"+this._datamode.toUpperCase()](file,afterCall);var that=this;if (!this.parsCount)this.callEvent("onXLS",[that,this._ld_id]);this._ld_id=null;this.xmlstate=1;this.XMLLoader=new dtmlXMLLoaderObject(this._parseXMLTree,this,true,this.no_cashe);if (afterCall)this.XMLLoader.waitCall=afterCall;this.XMLLoader.loadXML(file)};dhtmlXTreeObject.prototype._attachChildNode=function(parentObject,itemId,itemText,itemActionHandler,image1,image2,image3,optionStr,childs,beforeNode,afterNode){if (beforeNode && beforeNode.parentObject)parentObject=beforeNode.parentObject;if (((parentObject.XMLload==0)&&(this.XMLsource))&&(!this.XMLloadingWarning)) + {parentObject.XMLload=1;this._loadDynXML(parentObject.id)};var Count=parentObject.childsCount;var Nodes=parentObject.childNodes;if (afterNode){if (afterNode.tr.previousSibling.previousSibling){beforeNode=afterNode.tr.previousSibling.nodem}else + optionStr=optionStr.replace("TOP","")+",TOP"};if (beforeNode){var ik,jk;for (ik=0;ik<Count;ik++)if (Nodes[ik]==beforeNode){for (jk=Count;jk!=ik;jk--)Nodes[1+jk]=Nodes[jk];break};ik++;Count=ik};if (optionStr){var tempStr=optionStr.split(",");for (var i=0;i<tempStr.length;i++){switch(tempStr[i]) + {case "TOP": if (parentObject.childsCount>0){beforeNode=new Object;beforeNode.tr=parentObject.childNodes[0].tr.previousSibling};parentObject._has_top=true;for (ik=Count;ik>0;ik--)Nodes[ik]=Nodes[ik-1];Count=0;break}}};var n;if (!(n=this._idpull[itemId])|| n.span!=-1){n=Nodes[Count]=new dhtmlXTreeItemObject(itemId,itemText,parentObject,this,null,1);itemId = Nodes[Count].id;parentObject.childsCount++};if(!n.htmlNode){n.label=itemText;n.htmlNode=this._createItem((this.checkBoxOff?1:0),n);n.htmlNode.objBelong=n};if(image1)n.images[0]=image1;if(image2)n.images[1]=image2;if(image3)n.images[2]=image3;var tr=this._drawNewTr(n.htmlNode);if ((this.XMLloadingWarning)||(this._hAdI)) + n.htmlNode.parentNode.parentNode.style.display="none";if ((beforeNode)&&(beforeNode.tr.nextSibling)) + parentObject.htmlNode.childNodes[0].insertBefore(tr,beforeNode.tr.nextSibling);else + if (this.parsingOn==parentObject.id){this.parsedArray[this.parsedArray.length]=tr}else + parentObject.htmlNode.childNodes[0].appendChild(tr);if ((beforeNode)&&(!beforeNode.span)) beforeNode=null;if (this.XMLsource)if ((childs)&&(childs!=0)) n.XMLload=0;else n.XMLload=1;n.tr=tr;tr.nodem=n;if (parentObject.itemId==0)tr.childNodes[0].className="hiddenRow";if ((parentObject._r_logic)||(this._frbtr)) + this._setSrc(n.htmlNode.childNodes[0].childNodes[0].childNodes[1].childNodes[0],this.imPath+this.radioArray[0]);if (optionStr){var tempStr=optionStr.split(",");for (var i=0;i<tempStr.length;i++){switch(tempStr[i]) + {case "SELECT": this.selectItem(itemId,false);break;case "CALL": this.selectItem(itemId,true);break;case "CHILD": n.XMLload=0;break;case "CHECKED": + if (this.XMLloadingWarning)this.setCheckList+=this.dlmtr+itemId;else + this.setCheck(itemId,1);break;case "HCHECKED": + this._setCheck(n,"unsure");break;case "OPEN": n.openMe=1;break}}};if (!this.XMLloadingWarning){if ((this._getOpenState(parentObject)<0)&&(!this._hAdI)) this.openItem(parentObject.id);if (beforeNode){this._correctPlus(beforeNode);this._correctLine(beforeNode)};this._correctPlus(parentObject);this._correctLine(parentObject);this._correctPlus(n);if (parentObject.childsCount>=2){this._correctPlus(Nodes[parentObject.childsCount-2]);this._correctLine(Nodes[parentObject.childsCount-2])};if (parentObject.childsCount!=2)this._correctPlus(Nodes[0]);if (this.tscheck)this._correctCheckStates(parentObject);if (this._onradh){if (this.xmlstate==1){var old=this.onXLE;this.onXLE=function(id){this._onradh(itemId);if (old)old(id)}}else + this._onradh(itemId)}};return n};dhtmlXTreeObject.prototype.insertNewItem=function(parentId,itemId,itemText,itemActionHandler,image1,image2,image3,optionStr,children){var parentObject=this._globalIdStorageFind(parentId);if (!parentObject)return (-1);var nodez=this._attachChildNode(parentObject,itemId,itemText,itemActionHandler,image1,image2,image3,optionStr,children);return nodez};dhtmlXTreeObject.prototype.insertNewChild=function(parentId,itemId,itemText,itemActionHandler,image1,image2,image3,optionStr,children){return this.insertNewItem(parentId,itemId,itemText,itemActionHandler,image1,image2,image3,optionStr,children)};dhtmlXTreeObject.prototype._parseXMLTree=function(a,b,c,d,xml){var p=new xmlPointer(xml.getXMLTopNode("tree"));a._parse(p);a._p=p};dhtmlXTreeObject.prototype._parseItem=function(c,temp,preNode,befNode){var id;if (this._srnd && (!this._idpull[id=c.get("id")] || !this._idpull[id].span)) + {this._addItemSRND(temp.id,id,c);return};var a=c.get_all();if ((typeof(this.waitUpdateXML)=="object")&&(!this.waitUpdateXML[a.id])){this._parse(c,a.id,1);return};var zST=[];if (a.select)zST.push("SELECT");if (a.top)zST.push("TOP");if (a.call)nodeAskingCall=a.id;if (a.checked==-1)zST.push("HCHECKED");else if (a.checked)zST.push("CHECKED");if (a.open)zST.push("OPEN");if (this.waitUpdateXML){if (this._globalIdStorageFind(a.id)) + var newNode=this.updateItem(a.id,a.text,a.im0,a.im1,a.im2,a.checked);else{if (this.npl==0)zST.push("TOP");else preNode=temp.childNodes[this.npl];var newNode=this._attachChildNode(temp,a.id,a.text,0,a.im0,a.im1,a.im2,zST.join(","),a.child,0,preNode);preNode=null}}else + var newNode=this._attachChildNode(temp,a.id,a.text,0,a.im0,a.im1,a.im2,zST.join(","),a.child,(befNode||0),preNode);if (a.tooltip)newNode.span.parentNode.parentNode.title=a.tooltip;if (a.style)if (newNode.span.style.cssText)newNode.span.style.cssText+=(";"+a.style);else + newNode.span.setAttribute("style",newNode.span.getAttribute("style")+";"+a.style);if (a.radio)newNode._r_logic=true;if (a.nocheckbox){newNode.span.parentNode.previousSibling.previousSibling.childNodes[0].style.display='none';newNode.nocheckbox=true};if (a.disabled){if (a.checked!=null)this._setCheck(newNode,convertStringToBoolean(a.checked));this.disableCheckbox(newNode,1)};newNode._acc=a.child||0;if (this.parserExtension)this.parserExtension._parseExtension(node.childNodes[i],this.parserExtension,a.id,parentId);this.setItemColor(newNode,a.aCol,a.sCol);if (a.locked=="1")this._lockItem(newNode,true,true);if ((a.imwidth)||(a.imheight)) this.setIconSize(a.imwidth,a.imheight,newNode);if ((a.closeable=="0")||(a.closeable=="1")) this.setItemCloseable(newNode,a.closeable);var zcall="";if (a.topoffset)this.setItemTopOffset(newNode,a.topoffset);if ((!this.slowParse)||(typeof(this.waitUpdateXML)=="object")){if (c.sub_exists("item")) + zcall=this._parse(c,a.id,1)};if (zcall!="")this.nodeAskingCall=zcall;c.each("userdata",function(u){this.setUserData(c.get("id"),u.get("name"),u.content())},this) + + + };dhtmlXTreeObject.prototype._parse=function(p,parentId,level,start){if (this._srnd && !this.parentObject.offsetHeight){var self=this;return window.setTimeout(function(){self._parse(p,parentId,level,start)},100)};if (!p.exists()) return;this.skipLock=true;this.parsCount=this.parsCount?(this.parsCount+1):1;this.XMLloadingWarning=1;this.nodeAskingCall="";if (!parentId){parentId=p.get("id");if (p.get("radio")) + this.htmlNode._r_logic=true;this.parsingOn=parentId;this.parsedArray=new Array();this.setCheckList=""};var temp=this._globalIdStorageFind(parentId);if (... [truncated message content] |
From: <sk...@us...> - 2008-02-27 13:27:01
|
Revision: 653 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=653&view=rev Author: sknappe Date: 2008-02-27 05:26:57 -0800 (Wed, 27 Feb 2008) Log Message: ----------- some bugfixes and menu changed a bit Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/index.php trunk/src/dbpedia-navigator/processTreeMenu.php Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-02-27 12:32:58 UTC (rev 652) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-02-27 13:26:57 UTC (rev 653) @@ -156,11 +156,11 @@ $run=fgets($file); fclose($file); if ($run=="false"){ - $this->client->stopSparqlQuery($id,$queryID); + $this->client->stopSparqlQuery($this->id,$queryID); throw new Exception("Query stopped"); } } while($seconds<$this->ttl); - $this->client->stopSparqlThread($id,$queryID); + $this->client->stopSparqlThread($this->id,$queryID); } function getSubjects($label) Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-02-27 12:32:58 UTC (rev 652) +++ trunk/src/dbpedia-navigator/index.php 2008-02-27 13:26:57 UTC (rev 653) @@ -127,6 +127,11 @@ tree=new dhtmlXTreeObject("treeboxbox_tree","100%","100%",0); tree.setImagePath("<?php print $path;?>images/csh_bluebooks/"); tree.enableCheckBoxes(1); + tree.setOnClickHandler(doOnClick); + function doOnClick(nodeId){ + var myUrl = tree.getUserData(nodeId,"myurl"); + xajax_getSubjectsFromConcept(myUrl); + } tree.setXMLAutoLoading("processTreeMenu.php"); tree.loadXML("processTreeMenu.php?id=0"); </script> Modified: trunk/src/dbpedia-navigator/processTreeMenu.php =================================================================== --- trunk/src/dbpedia-navigator/processTreeMenu.php 2008-02-27 12:32:58 UTC (rev 652) +++ trunk/src/dbpedia-navigator/processTreeMenu.php 2008-02-27 13:26:57 UTC (rev 653) @@ -15,7 +15,7 @@ $sc=new DLLearnerConnection($ids[0],$ids[1]); $categories=$sc->getYagoSubCategories($url_var); foreach ($categories as $category) - print("<item child=\"1\" id=\"".$category."\" text=\"".substr (strrchr ($category, "/"), 1)."\"><userdata name='ud_block'>ud_data</userdata></item>"); + print("<item child=\"1\" id=\"".$category."\" text=\"".substr (strrchr ($category, "/"), 1)."\"><userdata name=\"myurl\">".$category."</userdata></item>"); } print("</tree>"); ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-02-27 14:10:22
|
Revision: 654 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=654&view=rev Author: sknappe Date: 2008-02-27 06:10:02 -0800 (Wed, 27 Feb 2008) Log Message: ----------- label in menu working Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/processTreeMenu.php Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-02-27 13:26:57 UTC (rev 653) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-02-27 14:10:02 UTC (rev 654) @@ -192,13 +192,16 @@ function getYagoSubCategories($category) { - $query="SELECT DISTINCT ?subject\n". - "WHERE { ?subject <http://www.w3.org/2000/01/rdf-schema#subClassOf> <".$category.">}\n"; + $query="SELECT ?subject ?label\n". + "WHERE { ?subject <http://www.w3.org/2000/01/rdf-schema#subClassOf> <".$category.">.?subject <http://www.w3.org/2000/01/rdf-schema#label> ?label}\n"; $result=json_decode($this->getSparqlResult($query),true); if (count($result['results']['bindings'])==0) throw new Exception("Your query brought no result."); $ret=array(); foreach ($result['results']['bindings'] as $results){ - $ret[]=$results['subject']['value']; + $res=array(); + $res['value']=$results['subject']['value']; + $res['label']=$results['label']['value']; + if (strlen($res['label'])>0) $ret[]=$res; } return $ret; } Modified: trunk/src/dbpedia-navigator/processTreeMenu.php =================================================================== --- trunk/src/dbpedia-navigator/processTreeMenu.php 2008-02-27 13:26:57 UTC (rev 653) +++ trunk/src/dbpedia-navigator/processTreeMenu.php 2008-02-27 14:10:02 UTC (rev 654) @@ -15,7 +15,7 @@ $sc=new DLLearnerConnection($ids[0],$ids[1]); $categories=$sc->getYagoSubCategories($url_var); foreach ($categories as $category) - print("<item child=\"1\" id=\"".$category."\" text=\"".substr (strrchr ($category, "/"), 1)."\"><userdata name=\"myurl\">".$category."</userdata></item>"); + print("<item child=\"1\" id=\"".$category['value']."\" text=\"".$category['label']."\"><userdata name=\"myurl\">".$category."</userdata></item>"); } print("</tree>"); ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-02-27 15:24:55
|
Revision: 656 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=656&view=rev Author: sknappe Date: 2008-02-27 07:24:38 -0800 (Wed, 27 Feb 2008) Log Message: ----------- bugfixes Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/processTreeMenu.php Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-02-27 15:08:19 UTC (rev 655) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-02-27 15:24:38 UTC (rev 656) @@ -192,8 +192,8 @@ function getYagoSubCategories($category) { - $query="SELECT ?subject ?label\n". - "WHERE { ?subject <http://www.w3.org/2000/01/rdf-schema#subClassOf> <".$category.">.?subject <http://www.w3.org/2000/01/rdf-schema#label> ?label}\n"; + $query="SELECT ?subject ?label count(?subclass) as ?numberOfSubclasses\n". + "WHERE { ?subject <http://www.w3.org/2000/01/rdf-schema#subClassOf> <".$category.">.?subject <http://www.w3.org/2000/01/rdf-schema#label> ?label.OPTIONAL {?subclass <http://www.w3.org/2000/01/rdf-schema#subClassOf> ?subject} }"; $result=json_decode($this->getSparqlResult($query),true); if (count($result['results']['bindings'])==0) throw new Exception("Your query brought no result."); $ret=array(); @@ -201,6 +201,7 @@ $res=array(); $res['value']=$results['subject']['value']; $res['label']=$results['label']['value']; + $res['subclasses']=$results['numberOfSubclasses']['value']; if (strlen($res['label'])>0) $ret[]=$res; } return $ret; @@ -282,6 +283,6 @@ $sc=new DLLearnerConnection(); $ids=$sc->getIDs(); $sc=new DLLearnerConnection($ids[0],$ids[1]); -$triples=$sc->getSubjects("Angela Merkel"); +$triples=$sc->getYagoSubCategories("http://dbpedia.org/class/yago/Eliminator109272468"); var_dump($triples);*/ ?> Modified: trunk/src/dbpedia-navigator/processTreeMenu.php =================================================================== --- trunk/src/dbpedia-navigator/processTreeMenu.php 2008-02-27 15:08:19 UTC (rev 655) +++ trunk/src/dbpedia-navigator/processTreeMenu.php 2008-02-27 15:24:38 UTC (rev 656) @@ -14,8 +14,11 @@ $ids=$sc->getIDs(); $sc=new DLLearnerConnection($ids[0],$ids[1]); $categories=$sc->getYagoSubCategories($url_var); - foreach ($categories as $category) - print("<item child=\"1\" id=\"".$category['value']."\" text=\"".$category['label']."\"><userdata name=\"myurl\">".$category."</userdata></item>"); + foreach ($categories as $category){ + if ($category['subclasses']=="0") $child=0; + else $child=1; + print("<item child=\"".$child."\" id=\"".$category['value']."\" text=\"".$category['label']."\"><userdata name=\"myurl\">".$category."</userdata></item>"); + } } print("</tree>"); ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-02-27 15:59:24
|
Revision: 658 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=658&view=rev Author: sknappe Date: 2008-02-27 07:59:18 -0800 (Wed, 27 Feb 2008) Log Message: ----------- get content of the checkboxes of the menu 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-02-27 15:30:42 UTC (rev 657) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-02-27 15:59:18 UTC (rev 658) @@ -283,6 +283,6 @@ $sc=new DLLearnerConnection(); $ids=$sc->getIDs(); $sc=new DLLearnerConnection($ids[0],$ids[1]); -$triples=$sc->getYagoSubCategories("http://dbpedia.org/class/yago/Eliminator109272468"); +$triples=$sc->getSubjects("Leipzig"); var_dump($triples);*/ ?> Modified: trunk/src/dbpedia-navigator/ajaxfunctions.php =================================================================== --- trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-02-27 15:30:42 UTC (rev 657) +++ trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-02-27 15:59:18 UTC (rev 658) @@ -4,7 +4,7 @@ require("ajax.php"); $xajax->processRequest(); -function getsubjects($label) +function getsubjects($label,$list) { $sid = $_GET['sid']; session_id($sid); @@ -15,6 +15,9 @@ setRunning($id,"true"); + //get parts of the list + $checkedInstances=preg_split("[,]",$list); + //initialise content $content=""; try{ @@ -155,7 +158,7 @@ //BUILD SEARCHRESULT if ($fromCache==-1) - $searchResult.="<a href=\"\" onclick=\"xajax_getsubjects('".$subject."');return false;\">Show more Results</a>"; + $searchResult.="<a href=\"\" onclick=\"var list=tree.getAllChecked();xajax_getsubjects('".$subject."',list);return false;\">Show more Results</a>"; //Restart the Session This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-02-28 13:58:04
|
Revision: 661 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=661&view=rev Author: sknappe Date: 2008-02-28 05:57:59 -0800 (Thu, 28 Feb 2008) Log Message: ----------- changed the search Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/ajaxfunctions.php trunk/src/dbpedia-navigator/index.php Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-02-28 13:56:42 UTC (rev 660) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-02-28 13:57:59 UTC (rev 661) @@ -156,24 +156,34 @@ $run=fgets($file); fclose($file); if ($run=="false"){ - $this->client->stopSparqlQuery($this->id,$queryID); + $this->client->stopSparqlThread($this->id,$queryID); throw new Exception("Query stopped"); } } while($seconds<$this->ttl); $this->client->stopSparqlThread($this->id,$queryID); } - function getSubjects($label) + function getSubjects($label,$checkedInstances) { - $query="SELECT DISTINCT ?subject\n". - "WHERE { ?subject <http://www.w3.org/2000/01/rdf-schema#label> ?object. ?object bif:contains '\"".$label."\"'@en}\n". - "LIMIT 10"; - $result=json_decode($this->getSparqlResult($query),true); - if (count($result['results']['bindings'])==0) throw new Exception("Your query brought no result."); + $offset=1; $ret=array(); - foreach ($result['results']['bindings'] as $results){ - $ret[]=$results['subject']['value']; - } + do{ + if (strlen($checkedInstances[0])>0){ + $query="SELECT ?zw\n". + "WHERE {?zw a <".$checkedInstances[0].">.{SELECT ?subject as ?zw\n". + "WHERE { ?subject <http://www.w3.org/2000/01/rdf-schema#label> ?object. ?object bif:contains '\"".$label."\"'@en}\nLimit 100}}"; + }else { + $query="SELECT DISTINCT ?subject\n". + "WHERE { ?subject <http://www.w3.org/2000/01/rdf-schema#label> ?object. ?object bif:contains '\"".$label."\"'@en}". + "LIMIT 1000 OFFSET ".$offset; + } + $result=json_decode($this->getSparqlResult($query),true); + if ((count($result['results']['bindings'])==0)&&($offset==1)) throw new Exception("Your query brought no result."); + foreach ($result['results']['bindings'] as $results){ + $ret[]=$results['subject']['value']; + } + $offset+=1000; + } while(count($result['results']['bindings'])==1000); return $ret; } @@ -283,6 +293,6 @@ $sc=new DLLearnerConnection(); $ids=$sc->getIDs(); $sc=new DLLearnerConnection($ids[0],$ids[1]); -$triples=$sc->getSubjects("Leipzig"); +$triples=$sc->getSubjects("Paris"); var_dump($triples);*/ ?> Modified: trunk/src/dbpedia-navigator/ajaxfunctions.php =================================================================== --- trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-02-28 13:56:42 UTC (rev 660) +++ trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-02-28 13:57:59 UTC (rev 661) @@ -16,7 +16,7 @@ setRunning($id,"true"); //get parts of the list - $checkedInstances=preg_split("[,]",$list); + $checkedInstances=preg_split("[,]",$list,-1,PREG_SPLIT_NO_EMPTY); //initialise content $content=""; @@ -24,18 +24,15 @@ require_once("DLLearnerConnection.php"); $sc=new DLLearnerConnection($id,$ksID); - $subjects=$sc->getSubjects($label); + $subjects=$sc->getSubjects($label,$checkedInstances); - foreach ($subjects as $subject) - { - $content.="<a href=\"\" onclick=\"xajax_getarticle('".urldecode(str_replace("_"," ",substr (strrchr ($subject, "/"), 1)))."',-2);return false;\">".urldecode(str_replace("_"," ",substr (strrchr ($subject, "/"), 1)))."</a><br/>"; - } + $content.=getResultsTable($subjects); } catch (Exception $e){ $content=$e->getMessage(); } $objResponse = new xajaxResponse(); - $objResponse->assign("searchcontent", "innerHTML", $content); + $objResponse->assign("articlecontent", "innerHTML", $content); return $objResponse; } Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-02-28 13:56:42 UTC (rev 660) +++ trunk/src/dbpedia-navigator/index.php 2008-02-28 13:57:59 UTC (rev 661) @@ -103,7 +103,7 @@ <!-- Search:<br/> --> <form onSubmit="xajax_getarticle(document.getElementById('label').value,-1);return false;"> <input type="text" name="label" id="label" /><br/> - <input type="button" value="Search" class="button" onclick="xajax_getarticle(document.getElementById('label').value,-1);return false;" /> + <input type="button" value="Article" class="button" onclick="xajax_getarticle(document.getElementById('label').value,-1);return false;" /> <input type="button" value="Search" class="button" onclick="var list=tree.getAllChecked();xajax_getsubjects(document.getElementById('label').value,list);return false;" /> <!-- <input type="button" value="Fulltext" class="button" onclick=""/> --> </form> </div> <!-- boxcontent --> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-02-28 20:25:43
|
Revision: 664 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=664&view=rev Author: sknappe Date: 2008-02-28 12:25:39 -0800 (Thu, 28 Feb 2008) Log Message: ----------- bugfixes Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/Settings.php trunk/src/dbpedia-navigator/ajaxfunctions.php Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-02-28 20:25:13 UTC (rev 663) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-02-28 20:25:39 UTC (rev 664) @@ -120,7 +120,7 @@ { $query="SELECT ?pred ?obj ". "WHERE {{<http://dbpedia.org/resource/".str_replace(' ','_',$label)."> ?pred ?obj}UNION{<http://dbpedia.org/resource/".str_replace(' ','_',$label)."> <http://dbpedia.org/property/redirect> ?Conc.?Conc ?pred ?obj}}"; - $result=json_decode($this->getSparqlResult($query),true); + $result=json_decode($this->getSparqlResultThreaded($query),true); if (count($result['results']['bindings'])==0) throw new Exception("Your query brought no result. The Label-Search is started."); $ret=array(); foreach ($result['results']['bindings'] as $results){ @@ -131,16 +131,16 @@ return $ret; } - function getSparqlResult($query) + function getSparqlResultThreaded($query) { $this->client->applyConfigEntryStringArray($this->id, $this->ksID, "defaultGraphURIs", array("http://dbpedia.org")); $queryID=$this->client->sparqlQueryThreaded($this->id,$this->ksID,$query); $running=true; $i = 1; - $sleeptime = 0.5; + $sleeptime = 500000; do { // sleep a while - sleep($sleeptime); + usleep($sleeptime); $running=$this->client->isSparqlQueryRunning($this->id,$queryID); @@ -162,29 +162,37 @@ } while($seconds<$this->ttl); $this->client->stopSparqlThread($this->id,$queryID); } + + function getSparqlResult($query) + { + $this->client->applyConfigEntryStringArray($this->id, $this->ksID, "defaultGraphURIs", array("http://dbpedia.org")); + $result=$this->client->sparqlQuery($this->id,$this->ksID,$query); + return $result; + } function getSubjects($label,$checkedInstances) { $offset=1; $ret=array(); do{ - if (strlen($checkedInstances[0])>0){ + if (isset($checkedInstances[0])){ $query="SELECT DISTINCT ?subject\n". "WHERE {?subject a <".$checkedInstances[0].">.{SELECT ?zw as ?subject\n". - "WHERE { ?zw <http://www.w3.org/2000/01/rdf-schema#label> ?object. ?object bif:contains '\"".$label."\"'@en}\n". + "WHERE { ?zw <http://www.w3.org/2000/01/rdf-schema#label> ?object. ?object bif:contains \"".$label."\"@en}\n". "LIMIT 1000 OFFSET ".$offset."}}"; }else { $query="SELECT DISTINCT ?subject\n". - "WHERE { ?subject <http://www.w3.org/2000/01/rdf-schema#label> ?object. ?object bif:contains '\"".$label."\"'@en}". + "WHERE { ?subject <http://www.w3.org/2000/01/rdf-schema#label> ?object. ?object bif:contains \"".$label."\"@en}". "LIMIT 1000 OFFSET ".$offset; } - $result=json_decode($this->getSparqlResult($query),true); - if ((count($result['results']['bindings'])==0)&&($offset==1)) throw new Exception("Your query brought no result."); + $result=json_decode($this->getSparqlResultThreaded($query),true); + $count=count($result['results']['bindings']); + if (($count==0)&&($offset==1)) throw new Exception("Your query brought no result."); foreach ($result['results']['bindings'] as $results){ $ret[]=$results['subject']['value']; } $offset+=1000; - } while(count($result['results']['bindings'])==1000); + } while($count==1000); return $ret; } @@ -192,7 +200,7 @@ { $query="SELECT DISTINCT ?subject\n". "WHERE { ?subject a <".$concept.">}\n"; - $result=json_decode($this->getSparqlResult($query),true); + $result=json_decode($this->getSparqlResultThreaded($query),true); if (count($result['results']['bindings'])==0) throw new Exception("Your query brought no result."); $ret=array(); foreach ($result['results']['bindings'] as $results){ @@ -291,6 +299,7 @@ } } /* +ini_set('default_socket_timeout',200); $sc=new DLLearnerConnection(); $ids=$sc->getIDs(); $sc=new DLLearnerConnection($ids[0],$ids[1]); Modified: trunk/src/dbpedia-navigator/Settings.php =================================================================== --- trunk/src/dbpedia-navigator/Settings.php 2008-02-28 20:25:13 UTC (rev 663) +++ trunk/src/dbpedia-navigator/Settings.php 2008-02-28 20:25:39 UTC (rev 664) @@ -36,7 +36,7 @@ // public DBpedia mirror // public $dbpediauri='http://dbpedia2.openlinksw.com:8890/isparql'; - public $sparqlttl=60; + public $sparqlttl=60000000; public $language="en"; Modified: trunk/src/dbpedia-navigator/ajaxfunctions.php =================================================================== --- trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-02-28 20:25:13 UTC (rev 663) +++ trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-02-28 20:25:39 UTC (rev 664) @@ -153,11 +153,6 @@ // display the remaining properties as list which can be used for further navigation $content .= '<br/><br/><br/>'.get_triple_table($triples); - //BUILD SEARCHRESULT - if ($fromCache==-1) - $searchResult.="<a href=\"\" onclick=\"var list=tree.getAllChecked();xajax_getsubjects('".$subject."',list);return false;\">Show more Results</a>"; - - //Restart the Session session_start(); @@ -222,7 +217,6 @@ $objResponse->assign("articlecontent", "innerHTML", $content); $objResponse->assign("ArticleTitle","innerHTML",$artTitle); $objResponse->assign("lastarticles","innerHTML",$lastArticles); - if ($searchResult!="") $objResponse->assign("searchcontent", "innerHTML", $searchResult); $objResponse->assign('Positives','innerHTML',$posInterests); $objResponse->assign('Negatives','innerHTML',$negInterests); return $objResponse; @@ -468,7 +462,7 @@ for ($j=0;($j<30)&&(($i*30+$j)<count($results));$j++) { $result=$results[$i*30+$j]; - $ret.=" <a href=\"\" onclick=\"xajax_getarticle('".urldecode(str_replace("_"," ",substr (strrchr ($result, "/"), 1)))."',-2);return false;\">".urldecode(str_replace("_"," ",substr (strrchr ($result, "/"), 1)))."</a><br/>"; + $ret.=" <a href=\"\" onclick=\"xajax_getarticle('".urldecode(str_replace("_"," ",substr (strrchr ($result, "/"), 1)))."',-1);return false;\">".urldecode(str_replace("_"," ",substr (strrchr ($result, "/"), 1)))."</a><br/>"; } $ret.="</div>"; $i++; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-02-29 00:06:42
|
Revision: 667 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=667&view=rev Author: sknappe Date: 2008-02-28 16:06:36 -0800 (Thu, 28 Feb 2008) Log Message: ----------- tagcloud, a bit slow at the moment 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-02-28 23:55:17 UTC (rev 666) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-02-29 00:06:36 UTC (rev 667) @@ -174,26 +174,55 @@ { $offset=1; $ret=array(); + $labels=preg_split("[\040]",$label,-1,PREG_SPLIT_NO_EMPTY); + //TODO if instances are checked the offset no longer works do{ if (isset($checkedInstances[0])){ - $query="SELECT DISTINCT ?subject\n". + $query="SELECT DISTINCT ?subject ?cat ?label\n". "WHERE {?subject a <".$checkedInstances[0].">.{SELECT ?zw as ?subject\n". - "WHERE { ?zw <http://www.w3.org/2000/01/rdf-schema#label> ?object. ?object bif:contains \"".$label."\"@en}\n". - "LIMIT 1000 OFFSET ".$offset."}}"; + "WHERE { ?zw <http://www.w3.org/2000/01/rdf-schema#label> ?object. ?object bif:contains '"; + $i=0; + foreach ($labels as $l){ + if ($i==0) $query.="\"".$l."\""; + else $query.=" and \"".$l."\""; + $i=1; + } + $query.="'@en.?subject a ?cat.?cat <http://www.w3.org/2000/01/rdf-schema#label> ?label}\n". + "LIMIT 100 OFFSET ".$offset."}}"; }else { - $query="SELECT DISTINCT ?subject\n". - "WHERE { ?subject <http://www.w3.org/2000/01/rdf-schema#label> ?object. ?object bif:contains \"".$label."\"@en}". - "LIMIT 1000 OFFSET ".$offset; + $query="SELECT DISTINCT ?subject ?cat ?label\n". + "WHERE { ?subject <http://www.w3.org/2000/01/rdf-schema#label> ?object. ?object bif:contains '"; + $i=0; + foreach ($labels as $l){ + if ($i==0) $query.="\"".$l."\""; + else $query.=" and \"".$l."\""; + $i=1; + } + $query.="'@en.?subject a ?cat.?cat <http://www.w3.org/2000/01/rdf-schema#label> ?label}". + "LIMIT 100 OFFSET ".$offset; } $result=json_decode($this->getSparqlResultThreaded($query),true); $count=count($result['results']['bindings']); if (($count==0)&&($offset==1)) throw new Exception("Your query brought no result."); foreach ($result['results']['bindings'] as $results){ - $ret[]=$results['subject']['value']; + $ret[$results['subject']['value']]=$results['subject']['value']; + //tagcloud + if (!isset($tagcloud[$results['cat']['value']])){ + $tagcloud[$results['cat']['value']]=1; + $tagcloudLabel[$results['cat']['value']]=$results['label']['value']; + } + else $tagcloud[$results['cat']['value']]++; + } - $offset+=1000; - } while($count==1000); - return $ret; + $offset+=100; + } while($count==100); + //have to do this, because distinct doesn't work, and i use the key to eliminate doubles + unset($tagcloud['http://www.w3.org/2004/02/skos/core#Concept']); + foreach ($ret as $r) + $return['subjects'][]=$r; + $return['tagcloud']=$tagcloud; + $return['tagcloudlabel']=$tagcloudLabel; + return $return; } function getSubjectsFromConcept($concept) @@ -303,6 +332,6 @@ $sc=new DLLearnerConnection(); $ids=$sc->getIDs(); $sc=new DLLearnerConnection($ids[0],$ids[1]); -$triples=$sc->getSubjects("Paris"); +$triples=$sc->getSubjects("Leipzig"); var_dump($triples);*/ ?> Modified: trunk/src/dbpedia-navigator/ajaxfunctions.php =================================================================== --- trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-02-28 23:55:17 UTC (rev 666) +++ trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-02-29 00:06:36 UTC (rev 667) @@ -26,7 +26,8 @@ $subjects=$sc->getSubjects($label,$checkedInstances); - $content.=getResultsTable($subjects); + $content.=getTagCloud($subjects['tagcloud'],$subjects['tagcloudlabel']); + $content.=getResultsTable($subjects['subjects']); } catch (Exception $e){ $content=$e->getMessage(); } @@ -451,6 +452,27 @@ // Helper Functions. // /////////////////////// +function getTagCloud($tags,$label) +{ + $max=max($tags); + $min=min($tags); + $diff=$max-$min; + $distribution=$diff/3; + + $ret="<p>"; + foreach ($tags as $tag=>$count){ + if ($count==$min) $style="font-size:xx-small;"; + else if ($count==$max) $style="font-size:xx-large;"; + else if ($count>($min+2*$distribution)) $style="font-size:large;"; + else if ($count>($min+$distribution)) $style="font-size:medium;"; + else $style="font-size:small;"; + + $ret.="<a style='".$style."' href='".$tag."'>".$label[$tag]."</a> "; + } + $ret.="</p>"; + return $ret; +} + function getResultsTable($results) { $ret="<p>Your search brought ".count($results)." results.</p><br/>"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-03-04 11:56:53
|
Revision: 683 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=683&view=rev Author: sknappe Date: 2008-03-04 03:56:16 -0800 (Tue, 04 Mar 2008) Log Message: ----------- deactivated getConceptLength 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-03-04 11:50:48 UTC (rev 682) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-03-04 11:56:16 UTC (rev 683) @@ -44,7 +44,7 @@ { $this->client->applyConfigEntryInt($this->id, $this->ksID, "recursionDepth",1); $this->client->applyConfigEntryStringArray($this->id, $this->ksID, "instances", array_merge($posExamples,$negExamples)); - $this->client->applyConfigEntryInt($this->id, $this->ksID, "predefinedFilter", 5); + $this->client->applyConfigEntryInt($this->id, $this->ksID, "predefinedFilter", 1); $this->client->applyConfigEntryInt($this->id, $this->ksID, "predefinedEndpoint", 1); $this->client->setReasoner($this->id, "dig"); Modified: trunk/src/dbpedia-navigator/ajaxfunctions.php =================================================================== --- trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-03-04 11:50:48 UTC (rev 682) +++ trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-03-04 11:56:16 UTC (rev 683) @@ -394,7 +394,7 @@ foreach ($concepts as $con){ $concept.="<tr><td><a href=\"\" onclick=\"xajax_getSubjectsFromConcept('".$con."');return false;\" onMouseOver=\"showdiv('div".$i."');showdiv('ConceptBox');\" onMouseOut=\"hidediv('div".$i."');hidediv('ConceptBox');\" />".$con."</a></td></tr>"; //put information about concepts in divs - $conceptinformation.="<div id=\"div".$i."\" style=\"display:none\">Concept Depth: ".$conceptDepth[$i-1]."<br/>Concept Arity: ".$conceptArity[$i-1]."<br/>Concept Length: ".$sc->getConceptLength($con)."</div>"; + $conceptinformation.="<div id=\"div".$i."\" style=\"display:none\">Concept Depth: ".$conceptDepth[$i-1]."<br/>Concept Arity: ".$conceptArity[$i-1]."</div>"; $i++; } $concept.="</table>"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |