From: <sk...@us...> - 2008-07-17 14:49:59
|
Revision: 1010 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1010&view=rev Author: sknappe Date: 2008-07-17 14:49:00 +0000 (Thu, 17 Jul 2008) Log Message: ----------- commented something 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-07-15 16:44:26 UTC (rev 1009) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-07-17 14:49:00 UTC (rev 1010) @@ -54,8 +54,6 @@ if(empty($negExamples)){ $negExamples=$this->client->getNegativeExamples($this->id,$this->ksID,$posExamples,count($posExamples),"http://dbpedia.org/resource/"); $negExamples=$negExamples->item; - - var_dump($negExamples); } $this->client->applyConfigEntryStringArray($this->id, $this->ksID, "instances", array_merge($posExamples,$negExamples)); $this->client->setReasoner($this->id, "fastInstanceChecker"); @@ -338,11 +336,11 @@ } } - +/* ini_set('default_socket_timeout',200); $sc=new DLLearnerConnection(); $ids=$sc->getIDs(); $sc=new DLLearnerConnection($ids[0],$ids[1]); $triples=$sc->getConceptFromExamples(array('http://dbpedia.org/resource/Leipzig'),array()); -var_dump($triples); +var_dump($triples);*/ ?> Modified: trunk/src/dbpedia-navigator/ajaxfunctions.php =================================================================== --- trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-07-15 16:44:26 UTC (rev 1009) +++ trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-07-17 14:49:00 UTC (rev 1010) @@ -392,9 +392,9 @@ $concept.="<table border=0>\n"; $i=1; foreach ($concepts as $con){ - $concept.="<tr><td><a href=\"\" onclick=\"xajax_getSubjectsFromConcept('".htmlentities($con)."');return false;\" onMouseOver=\"showdiv('div".$i."');showdiv('ConceptBox');\" onMouseOut=\"hidediv('div".$i."');hidediv('ConceptBox');\" />".$con."</a></td></tr>"; + $concept.="<tr><td><a href=\"\" onclick=\"xajax_getSubjectsFromConcept('".urlencode($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]."<br/>Concept Length: ".$sc->getConceptLength($con)."</div>"; $i++; } $concept.="</table>"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-07-21 18:07:44
|
Revision: 1014 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1014&view=rev Author: sknappe Date: 2008-07-21 18:07:39 +0000 (Mon, 21 Jul 2008) Log Message: ----------- Started to work with new ajax mechanism, at the moment only started with article search, more to come soon Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php Added Paths: ----------- trunk/src/dbpedia-navigator/ajax_get_article.php trunk/src/dbpedia-navigator/helper_functions.php trunk/src/dbpedia-navigator/index-new.php Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-07-19 13:37:47 UTC (rev 1013) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-07-21 18:07:39 UTC (rev 1014) @@ -88,7 +88,8 @@ sleep($sleeptime); // see what we have learned so far - $concepts=$this->client->getCurrentlyBestConcepts($this->id,3,"kb"); + //$concepts=$this->client->getCurrentlyBestConcepts($this->id,3,"kb"); + $concepts=$this->client->getCurrentlyBestEvaluatedDescriptions($this->id,3); $running=$this->client->isAlgorithmRunning($this->id); $seconds = $i * $sleeptime; @@ -107,7 +108,8 @@ $this->client->stop($this->id); } - return $concepts->item; + //return $concepts->item; + return $concepts; } function getConceptDepth() Added: trunk/src/dbpedia-navigator/ajax_get_article.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_article.php (rev 0) +++ trunk/src/dbpedia-navigator/ajax_get_article.php 2008-07-21 18:07:39 UTC (rev 1014) @@ -0,0 +1,190 @@ +<?php + include('helper_functions.php'); + + session_start(); + + $subject=$_POST['label']; + $fromCache=$_POST['cache']; + + if (isset($_SESSION['articles'])) $articles=$_SESSION['articles']; + $id=$_SESSION['id']; + $ksID=$_SESSION['ksID']; + session_write_close(); + setRunning($id,"true"); + + //get first Letter of label big + $uri=subjectToURI($subject); + + //if article is in session, get it out of the session + if (isset($articles)){ + foreach ($articles as $key => $value) + { + if ($value['subject']==$subject){ + $fromCache=$key; + break; + } + } + } + + //initialize the content variables + $content=""; + $lastArticles=""; + $artTitle=""; + + //get the article + //if $fromCache is -2, no new SearchResults should be processed + //if $fromCache is -1, everything is normal + //if $fromCache is >=0, the article is taken out of the cache + if ($fromCache<0) { + //if there are errors see catch block + try{ + require_once("DLLearnerConnection.php"); + $sc=new DLLearnerConnection($id,$ksID); + $triples=$sc->getTriples($uri); + + //BUILD ARTICLE + // goal: display the data in a nice (DBpedia specific way), maybe similar to + // dbpedia.org/search + + // 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]['value'].'" alt="Picture of '.$subject.'" style="float:right; max-width:200px;" \>'; + + //display where it was redirected from, if it was redirected + $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]['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]['value'].'">view Wikipedia article</a>, '; + $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'])) + $content .= '<p>classes: '.formatClassArray($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type']).'</p>'; + + 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['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: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/>'.get_triple_table($triples); + + //Restart the Session + session_start(); + + //store article in session, to navigate between last 5 articles quickly + $contentArray=array('content' => $content,'subject' => $artTitle); + if (!isset($_SESSION['nextArticle'])){ + $_SESSION['nextArticle']=0; + $_SESSION['articles']=array(); + } + if ($_SESSION['nextArticle']==5) $_SESSION['nextArticle']=0; + $_SESSION['articles'][$_SESSION['nextArticle']]=$contentArray; + $_SESSION['currentArticle']=$_SESSION['nextArticle']; + $_SESSION['nextArticle']++; + + //Add Positives to Session + if (!isset($_SESSION['positive'])){ + 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 ($redirect!="") $array[$redirect] = $redirect; + else $array["http://dbpedia.org/resource/".str_replace(" ","_",$subject)]="http://dbpedia.org/resource/".str_replace(" ","_",$subject); + $_SESSION['positive']=$array; + } + + } catch (Exception $e) + { + $content=$e->getMessage(); + $artTitle="No Result"; + //$objResponse->call('xajax_getsubjects',$subject); + } + } + else { + session_start(); + //Article is in session + $content=$_SESSION['articles'][$fromCache]['content']; + $artTitle=$_SESSION['articles'][$fromCache]['subject']; + } + + //Build lastArticles + if (isset($_SESSION['articles'])){ + foreach ($_SESSION['articles'] as $key => $value) + { + $lastArticles.="<a href=\"\" onclick=\"xajax_getarticle('',".$key.");return false;\">".$value['subject']."</a><br/>"; + } + } + + //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/>"; + } + + + print $content; + print '$$'; + print $artTitle; + print '$$'; + print $lastArticles; + print '$$'; + print $posInterests; + print '$$'; + print $negInterests; + + //$objResponse->call('xajax_learnConcept'); +?> \ No newline at end of file Added: trunk/src/dbpedia-navigator/helper_functions.php =================================================================== --- trunk/src/dbpedia-navigator/helper_functions.php (rev 0) +++ trunk/src/dbpedia-navigator/helper_functions.php 2008-07-21 18:07:39 UTC (rev 1014) @@ -0,0 +1,160 @@ +<?php +function subjectToURI($subject) +{ + //if the subject is already a URI return it + if (strpos($subject,"http://dbpedia.org/resource/")===0) + return $subject; + //delete whitespaces at beginning and end + $subject=trim($subject); + //get first letters big + $subject=ucfirst($subject); + //replace spaces with _ + $subject=str_replace(' ','_',$subject); + //add the uri + $subject="http://dbpedia.org/resource/".$subject; + + return $subject; +} + +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;"; + + $tag_with_entities=htmlentities("\"".$tag."\""); + $ret.='<a style="'.$style.'" href="#" onclick="xajax_getSubjectsFromConcept(\''.$tag_with_entities.'\');">'.$label[$tag].'</a>'; + } + $ret.="</p>"; + return $ret; +} + +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('".$result."',-1);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"); + $file=fopen("./temp/".$id.".temp","w"); + fwrite($file, $running); + fclose($file); +} + +function get_triple_table($triples) { + + $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) { + if ($element['type']=="uri") $table .= '<li><a href="'.$element['value'].'">'.$element['value'].'</a></li>'; + else $table .= '<li>'.$element['value'].'</li>'; + } + $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]['value']); + for($i=1; $i<count($ar); $i++) { + $string .= ', ' . formatClass($ar[$i]['value']); + } + return $string; +} + +// format a class nicely, i.e. link to it and possibly display +// it in a better way +function formatClass($className) { + $yagoPrefix = 'http://dbpedia.org/class/yago/'; + if(substr($className,0,30)==$yagoPrefix) { + return '<a href="'.$className.'">'.substr($className,30).'</a>'; + // DBpedia is Linked Data, so it makes always sense to link it + // ToDo: instead of linking to other pages, the resource should better + // be openened within DBpedia Navigator + } else if(substr($className,0,14)=='http://dbpedia') { + return '<a href="'.$className.'">'.$className.'</a>'; + } else { + return $className; + } +} + +function arrayToCommaSseparatedList($ar) { + $string = $ar[0]; + for($i=1; $i<count($ar); $i++) { + $string .= ', ' . $ar[$i]; + } + return $string; +} +?> \ No newline at end of file Added: trunk/src/dbpedia-navigator/index-new.php =================================================================== --- trunk/src/dbpedia-navigator/index-new.php (rev 0) +++ trunk/src/dbpedia-navigator/index-new.php 2008-07-21 18:07:39 UTC (rev 1014) @@ -0,0 +1,274 @@ +<?php + +ini_set('error_reporting',E_ALL); +ini_set('max_execution_time',200); +ini_set("soap.wsdl_cache_enabled","1"); + +session_start(); +require_once('DLLearnerConnection.php'); +$sc=new DLLearnerConnection(); +$ids=$sc->getIDs(); +$_SESSION['id']=$ids[0]; +$_SESSION['ksID']=$ids[1]; + +if (isset($_GET['path'])) $path=$_GET['path']; +else $path=""; + +require_once('Settings.php'); +$settings=new Settings(); + +/* +//what happens onLoad +$onLoad="onLoad=\""; +if (isset($_GET['resource'])){ + $onLoad.="xajax_getarticle('".$_GET['resource']."',-1);"; + unset($_GET['resource']); +} +else if (isset($_SESSION['currentArticle'])){ + $onLoad.="xajax_getarticle('',".$_SESSION['currentArticle'].");"; +} +$onLoad.="\""; +*/ + +echo '<?xml version="1.0" encoding="UTF-8"?>'; +?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <title>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"> + <script src="http://maps.google.com/maps?file=api&v=2&key=<?php print $settings->googleMapsKey;?>" + type="text/javascript"></script> + <script src="<?php print $path;?>treemenu/dhtmlxcommon.js"></script> + <script src="<?php print $path;?>treemenu/dhtmlxtree.js"></script> + <script type="text/javascript"> + function showdiv(id){ + document.getElementById(id).style.display='block'; + } + + function hidediv(id) { + document.getElementById(id).style.display='none'; + } + + function loadGoogleMap(Lat,Lng,Label) { + 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'; + } + } + + function get_article(param) + { + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_get_article.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + var response = XhrObj.responseText.split('$$'); + document.getElementById('articlecontent').innerHTML=response[0]; + document.getElementById('ArticleTitle').innerHTML=response[1]; + document.getElementById('lastarticles').innerHTML=response[2]; + document.getElementById('Positives').innerHTML=response[3]; + document.getElementById('Negatives').innerHTML=response[4]; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(param); + } + </script> + </head> + <body> + +<!-- <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> +<div id="layer" style="display:none"> + <div id="layerContent" style="display:none"></div> +</div> + +<div id="wrapper"> + <div id="leftSidebar"> + + <div class="box"> + <div class="boxtitle">Search DBpedia</div> + <div class="boxcontent" id="search"> + <!-- Search:<br/> --> + <form onSubmit="get_article('label='+document.getElementById('label').value+'&cache=-1');return false;"> + <input type="text" name="label" id="label" /><br/> + <input type="button" value="Article" class="button" onclick="get_article('label='+document.getElementById('label').value+'&cache=-1');return false;" /> <input type="button" value="Search" class="button" onclick="var list=tree.getAllChecked();return false;" /> + <!-- <input type="button" value="Fulltext" class="button" onclick=""/> --> + </form> + </div> <!-- boxcontent --> + </div> <!-- box --> + + <div class="box" id="SearchResultBox" style="display:none"> + <div class="boxtitle">Search Results</div> + <div class="boxcontent"> + <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="height:218px;overflow:auto;"> + </div> + </div> <!-- boxcontent --> + </div> <!-- box --> + <script> + 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> + + + <div class="box" id="credits"> + <p>DBpedia Navigator is powered by ... <br /> + <a href="http://dl-learner.org">DL-Learner</a><br /> + <a href="http//dbpedia.org">DBpedia</a><br/> + <a href="http://virtuoso.openlinksw.com/wiki/main/">OpenLink Virtuoso</a><br /> + ... and implemented by <a href="http://jens-lehmann.org">Jens Lehmann</a> 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="<?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> + + </div><!-- END leftSidebar --> + + <div id="content"> + <div class="box"> + <div class="boxtitle" id="ArticleTitle">Welcome</div> + <div class="boxcontent" id="article"> + <div id="articlecontent" style="display:block"> + <br /><br /> + Welcome to the DBpedia Navigator interface! DBpedia Navigator allows you to search DBpedia + and uses the background knowledge in DBpedia to suggest possible interesting navigation + links. + </div> + </div> <!-- boxcontent --> + </div> <!-- box --> + </div><!-- content --> + + <div id="rightSidebar"> + + <div class="box"> + <div class="boxtitlewithbutton" id="positivesboxtitle">search relevant <img src="<?php print $path;?>images/remove.png" onclick="xajax_clearPositives()" /> </div> + <div class="boxcontent" id="Positives"> + </div> <!-- boxcontent --> + </div> <!-- box --> + + <div class="box"> + <div class="boxtitlewithbutton" id="negativesboxtitle">not relevant <img src="<?php print $path;?>images/remove.png" onclick="xajax_clearNegatives()" /> </div> + <div class="boxcontent" id="Negatives"> + </div> <!-- boxcontent --> + </div> <!-- box --> + + <div class="box" id="LastArticlesBox" style="display:none"> + <div class="boxtitle">Articles Last Viewed</div> + <div class="boxcontent" id="lastarticles"> + </div> <!-- boxcontent --> + </div> <!-- box --> + + </div><!-- rightSidebar --> + + <!-- <div id="clear"></div> --> + +</div><!-- wrapper --> +<div id="footer"> + <p>Licensed under the GNU General Public License (GPL) 3 as part of the DL-Learner open source + project.<br />Copyright © Jens Lehmann 2007-2008 </p> + <div id="validation"> + <?php + $uri = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; + + echo '<div><a href="http://validator.w3.org/check?uri='.$uri.'"'; + echo '><img src="'.$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="'.$path.'images/valid-css.png" alt="valid CSS" /></a></div>'."\n"; + ?> + </div> + <p><a href='<?php print $path;?>rebuild.php'>rebuild [restart session and redownload WSDL file (for debugging)]</a></p> +</div> + +<div id="todo"> +<b>ToDo:</b> +<ul style="float:left"> + <li>Get learning component fast.</li> + <li>Get local DBpedia SPARQL endpoint working (next DBpedia release expected at the endof January and then every + two months, so it would be nice to have a script based partly automated or at least documented solution for + creating a DBpedia mirror).</li> + <li>Improve stability: Fix sometimes occurring PHP errors and warnings (check PHP error log).</li> + <li>For each result, display a "+" which shows more information about the concept in an overlay box, e.g. its + Description Logic or OWL syntax, its classification accuracy on the examples, and which + examples it classifies (in-)correctly.</li> + <li>Create a small number of test cases (e.g. 3), which can be used to verify that DBpedia Navigator is + working in typical scenarios (in particular cases where concepts with length greater one are learned).</li> + <li>Allow to disable caching functionality (in Settings.php).</li> + <li>Make DBpedia Navigator RESTful, e.g. URLs $base/showArticle/$URL for displaying an article; + $base/search/$phrase for searching; $base/listInstances/$complexClass for listing the instances of + a learned. Maybe session variables (in particuar the selected positive and negative examples) can + also be given, e.g. $base/search/$phrase?positives=[$URL1,$URL2,$URL3]&negatives=[$URL4]. The supported + URI design should be briefly documented (e.g. on a dbpedia.org wiki page). A good URI design allows + easier external access (just give someone a link instead of saying exactly which actions have to be done to + get to a state), simplifies debugging the application, and may be of use for creating further + features.</li> + <li>Improve search functionality [we will probably get feedback from Georgi in February].</li> + <li>[maybe] Display a tag cloud similar to <a href="http://dbpedia.org/search/">DBpedia search</a>.</li> + <li>[maybe] Instead of only allowing a search as entry point to the application, also display + a navigatable class tree.</li> + <li>[if possible] When expensive SPARQL queries or learning problems have been posed, there should be + some way to abandon these if the user has already switched to doing something else. Example: The user + has added 3 positive and 1 negative examples. This is executed as a learning problem, but has no solution (so + DL-Learner would run forever unless we pose some internal time limit). The user adds another negative example a + second later, so instead of letting the previous learning problem run for a long time (and needing much resources), + it should be stopped by DBpedia Navigator.</li> + <li>[if possible] Find an easy way to validate HTML/JS in AJAX applications.</li> + <li>[maybe] Would be interesting to somehow view the Wikipedia article (without the left navigation part, + tabs etc.) as an overlay, because the Wikipedia article will almost always be a human-friendlier + description of an object compared to the extracted one.</li> +</ul> +</div> + + <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> + + </body> +</html> + \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-08-13 12:54:23
|
Revision: 1062 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1062&view=rev Author: sknappe Date: 2008-08-13 12:54:21 +0000 (Wed, 13 Aug 2008) Log Message: ----------- added search using mysql database, not perfect yet, have to add categories to get tag cloud Modified Paths: -------------- trunk/src/dbpedia-navigator/index-new.php Added Paths: ----------- trunk/src/dbpedia-navigator/ajax_search.php Added: trunk/src/dbpedia-navigator/ajax_search.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_search.php (rev 0) +++ trunk/src/dbpedia-navigator/ajax_search.php 2008-08-13 12:54:21 UTC (rev 1062) @@ -0,0 +1,40 @@ +<?php + include('helper_functions.php'); + + $label=$_POST['label']; + $list=$_POST['list']; + session_start(); + $id=$_SESSION['id']; + $ksID=$_SESSION['ksID']; + session_write_close(); + + setRunning($id,"true"); + + //get parts of the list + $checkedInstances=preg_split("[,]",$list,-1,PREG_SPLIT_NO_EMPTY); + + //initialise content + $content=""; + /*try{ + require_once("DLLearnerConnection.php"); + $sc=new DLLearnerConnection($id,$ksID); + + $subjects=$sc->getSubjects($label,$checkedInstances); + + $content.=getTagCloud($subjects['tagcloud'],$subjects['tagcloudlabel']); + $content.=getResultsTable($subjects['subjects']); + } catch (Exception $e){ + $content=$e->getMessage(); + }*/ + mysql_connect('localhost','navigator','dbpedia'); + mysql_select_db("navigator_db"); + $query="SELECT name, label FROM rank WHERE MATCH (label) AGAINST ('$label') ORDER BY number LIMIT 3"; + $res=mysql_query($query); + while ($result=mysql_fetch_array($res)){ + $content.='<a href="" onclick="get_article(\'label='.$result['name'].'&cache=-1\');return false;">'.$result['label'].'</a><br/>'; + } + + print $content; + print '$$'; + print "Searchresult for ".$label; +?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/index-new.php =================================================================== --- trunk/src/dbpedia-navigator/index-new.php 2008-08-13 07:42:33 UTC (rev 1061) +++ trunk/src/dbpedia-navigator/index-new.php 2008-08-13 12:54:21 UTC (rev 1062) @@ -103,6 +103,32 @@ XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); XhrObj.send(param); } + + function search(param) + { + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_search.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + var response = XhrObj.responseText.split('$$'); + document.getElementById('articlecontent').innerHTML=response[0]; + document.getElementById('ArticleTitle').innerHTML=response[1]; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(param); + } </script> </head> <body> @@ -122,7 +148,7 @@ <!-- Search:<br/> --> <form onSubmit="get_article('label='+document.getElementById('label').value+'&cache=-1');return false;"> <input type="text" name="label" id="label" /><br/> - <input type="button" value="Article" class="button" onclick="get_article('label='+document.getElementById('label').value+'&cache=-1');return false;" /> <input type="button" value="Search" class="button" onclick="var list=tree.getAllChecked();return false;" /> + <input type="button" value="Article" class="button" onclick="get_article('label='+document.getElementById('label').value+'&cache=-1');return false;" /> <input type="button" value="Search" class="button" onclick="var list=tree.getAllChecked();search('label='+document.getElementById('label').value+'&list='+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-08-13 13:12:06
|
Revision: 1064 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1064&view=rev Author: sknappe Date: 2008-08-13 13:12:03 +0000 (Wed, 13 Aug 2008) Log Message: ----------- changed to use search result function in helper_functions Modified Paths: -------------- trunk/src/dbpedia-navigator/ajax_search.php trunk/src/dbpedia-navigator/helper_functions.php Modified: trunk/src/dbpedia-navigator/ajax_search.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_search.php 2008-08-13 12:55:56 UTC (rev 1063) +++ trunk/src/dbpedia-navigator/ajax_search.php 2008-08-13 13:12:03 UTC (rev 1064) @@ -30,9 +30,13 @@ mysql_select_db("navigator_db"); $query="SELECT name, label FROM rank WHERE MATCH (label) AGAINST ('$label') ORDER BY number LIMIT 3"; $res=mysql_query($query); + $names=array(); + $labels=array(); while ($result=mysql_fetch_array($res)){ - $content.='<a href="" onclick="get_article(\'label='.$result['name'].'&cache=-1\');return false;">'.$result['label'].'</a><br/>'; + $labels[]=$result['label']; + $names[]=$result['name']; } + $content.=getResultsTable($names,$labels); print $content; print '$$'; Modified: trunk/src/dbpedia-navigator/helper_functions.php =================================================================== --- trunk/src/dbpedia-navigator/helper_functions.php 2008-08-13 12:55:56 UTC (rev 1063) +++ trunk/src/dbpedia-navigator/helper_functions.php 2008-08-13 13:12:03 UTC (rev 1064) @@ -38,18 +38,19 @@ return $ret; } -function getResultsTable($results) +function getResultsTable($names,$labels) { - $ret="<p>Your search brought ".count($results)." results.</p><br/>"; + $ret="<p>Your search brought ".count($names)." results.</p><br/>"; $i=0; $display="block"; - while($i*30<count($results)) + while($i*30<count($names)) { $ret.="<div id='results".$i."' style='display:".$display."'>Seite ".($i+1)."<br/><br/>"; - for ($j=0;($j<30)&&(($i*30+$j)<count($results));$j++) + for ($j=0;($j<30)&&(($i*30+$j)<count($names));$j++) { - $result=$results[$i*30+$j]; - $ret.=" <a href=\"\" onclick=\"xajax_getarticle('".$result."',-1);return false;\">".urldecode(str_replace("_"," ",substr (strrchr ($result, "/"), 1)))."</a><br/>"; + $name=$names[$i*30+$j]; + $label=$labels[$i*30+$j]; + $ret.=' <a href="" onclick="get_article(\'label='.$name.'&cache=-1\');return false;">'.$label.'</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-08-15 12:03:46
|
Revision: 1083 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1083&view=rev Author: sknappe Date: 2008-08-15 12:03:42 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Added CalculatePageRank to navigator now also categories are put into the database search is now working with tagcloud (when choosing tags you see all articles that are in that category), you can choose how many searchresults you want to have (at the moment 10 or 25 or 50 or 75 or 100) and search results are shown on sites with max 25 searchresults each Modified Paths: -------------- trunk/src/dbpedia-navigator/ajax_search.php trunk/src/dbpedia-navigator/helper_functions.php trunk/src/dbpedia-navigator/index-new.php Added Paths: ----------- trunk/src/dbpedia-navigator/CalculatePageRank.java Copied: trunk/src/dbpedia-navigator/CalculatePageRank.java (from rev 1063, trunk/src/dl-learner/org/dllearner/test/CalculatePageRank.java) =================================================================== --- trunk/src/dbpedia-navigator/CalculatePageRank.java (rev 0) +++ trunk/src/dbpedia-navigator/CalculatePageRank.java 2008-08-15 12:03:42 UTC (rev 1083) @@ -0,0 +1,185 @@ +import java.io.BufferedReader; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.Statement; + +public class CalculatePageRank { + + private final String wikilinks="../pagelinks_en.nt"; + private final String labels="../articles_label_en.nt"; + private final String categories="../yago_en.nt"; + + private void calculateLinks() + { + try{ + Statement stmt; + ResultSet rs; + int number; + + Class.forName("com.mysql.jdbc.Driver"); + + String url = + "jdbc:mysql://localhost:3306/navigator_db"; + + Connection con = DriverManager.getConnection( + url,"navigator", "dbpedia"); + + stmt = con.createStatement(); + BufferedReader in = new BufferedReader(new FileReader(wikilinks)); + + String line; + String[] split; + String name; + int i=0; + while ((line=in.readLine())!=null) + { + split=line.split(" "); + name=split[2].substring(1, split[2].length()-1); + rs=stmt.executeQuery("SELECT number FROM rank WHERE name='"+name+"'"); + if (rs.next()){ + number=rs.getInt(1); + number++; + stmt.executeUpdate("UPDATE rank SET number="+number+" WHERE name='"+name+"'"); + } + else{ + stmt.executeUpdate("INSERT INTO rank (name,number) VALUES ('"+name+"',1)"); + } + if (i%100000==0) System.out.println(i); + i++; + } + + in.close(); + con.close(); + } catch (FileNotFoundException e) + { + System.out.println("File not found"); + } catch (IOException e) + { + System.out.println("IOException"); + } catch (Exception e) + { + e.printStackTrace(); + } + } + + private void addLabels() + { + try{ + Statement stmt; + ResultSet rs; + + Class.forName("com.mysql.jdbc.Driver"); + + String url = + "jdbc:mysql://localhost:3306/navigator_db"; + + Connection con = DriverManager.getConnection( + url,"navigator", "dbpedia"); + + stmt = con.createStatement(); + BufferedReader in = new BufferedReader(new FileReader(labels)); + + String line; + String[] split; + String name; + String label; + int i=0; + while ((line=in.readLine())!=null) + { + split=line.split(">"); + name=split[0].substring(1); + label=split[2].substring(split[2].indexOf("\"")+1, split[2].lastIndexOf("\"")); + rs=stmt.executeQuery("SELECT number FROM rank WHERE name='"+name+"'"); + if (rs.next()){ + stmt.executeUpdate("UPDATE rank SET label=\""+label+"\" WHERE name='"+name+"'"); + } + else{ + stmt.executeUpdate("INSERT INTO rank (name,label) VALUES ('"+name+"',\""+label+"\")"); + } + if (i%100000==0) System.out.println(i); + i++; + } + + in.close(); + con.close(); + } catch (FileNotFoundException e) + { + System.out.println("File not found"); + } catch (IOException e) + { + System.out.println("IOException"); + } catch (Exception e) + { + e.printStackTrace(); + } + } + + private void calculateCategories() + { + try{ + Statement stmt; + + Class.forName("com.mysql.jdbc.Driver"); + + String url = + "jdbc:mysql://localhost:3306/navigator_db"; + + Connection con = DriverManager.getConnection( + url,"navigator", "dbpedia"); + + stmt = con.createStatement(); + BufferedReader in = new BufferedReader(new FileReader(categories)); + + String line; + String[] split; + String name; + String label; + String pred; + int i=0; + while ((line=in.readLine())!=null) + { + split=line.split(">"); + name=split[0].substring(1); + pred=split[1].substring(2); + if (pred.equals("http://www.w3.org/2000/01/rdf-schema#label")) + label=split[2].substring(split[2].indexOf("\"")+1, split[2].lastIndexOf("\"")); + else + label=split[2].substring(2); + if (pred.equals("http://www.w3.org/2000/01/rdf-schema#label")){ + try{ + stmt.executeUpdate("INSERT INTO categories (category,label) VALUES (\""+name+"\",\""+label+"\")"); + }catch(Exception e) + {} + } + else{ + stmt.executeUpdate("UPDATE rank SET category=\""+label+"\" WHERE name=\""+name+"\""); + } + if (i%100000==0) System.out.println(i); + i++; + } + + in.close(); + con.close(); + } catch (FileNotFoundException e) + { + System.out.println("File not found"); + } catch (IOException e) + { + System.out.println("IOException"); + } catch (Exception e) + { + e.printStackTrace(); + } + } + + public static void main(String[] args){ + CalculatePageRank cal=new CalculatePageRank(); + //cal.calculateLinks(); + //cal.addLabels(); + cal.calculateCategories(); + } +} \ No newline at end of file Modified: trunk/src/dbpedia-navigator/ajax_search.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_search.php 2008-08-15 11:43:53 UTC (rev 1082) +++ trunk/src/dbpedia-navigator/ajax_search.php 2008-08-15 12:03:42 UTC (rev 1083) @@ -3,6 +3,7 @@ $label=$_POST['label']; $list=$_POST['list']; + $number=$_POST['number']; session_start(); $id=$_SESSION['id']; $ksID=$_SESSION['ksID']; @@ -15,30 +16,38 @@ //initialise content $content=""; - /*try{ - require_once("DLLearnerConnection.php"); - $sc=new DLLearnerConnection($id,$ksID); - - $subjects=$sc->getSubjects($label,$checkedInstances); - - $content.=getTagCloud($subjects['tagcloud'],$subjects['tagcloudlabel']); - $content.=getResultsTable($subjects['subjects']); - } catch (Exception $e){ - $content=$e->getMessage(); - }*/ + mysql_connect('localhost','navigator','dbpedia'); mysql_select_db("navigator_db"); - $query="SELECT name, label FROM rank WHERE MATCH (label) AGAINST ('$label') ORDER BY number LIMIT 3"; + $query="SELECT name, label, category FROM rank WHERE MATCH (label) AGAINST ('$label') ORDER BY number DESC LIMIT ".$number; $res=mysql_query($query); $names=array(); $labels=array(); + $classes=array(); + $tags=array(); + $catlabels=array(); while ($result=mysql_fetch_array($res)){ $labels[]=$result['label']; $names[]=$result['name']; + if (!isset($result['category'])){ + $result['category']="NoCategory"; + $result2['label']="No Category"; + } + else + { + $query="SELECT label FROM categories WHERE category='".$result['category']."' LIMIT 1"; + $res2=mysql_query($query); + $result2=mysql_fetch_array($res2); + } + $classes[]=$result['category']; + if (!isset($tags[$result['category']])) $tags[$result['category']]=1; + else $tags[$result['category']]++; + if (!isset($catlabels[$result['category']])) $catlabels[$result['category']]=$result2['label']; } - $content.=getResultsTable($names,$labels); + $content.=getTagCloud($tags,$catlabels); + $content.=getResultsTable($names,$labels,$classes,$number); print $content; print '$$'; - print "Searchresult for ".$label; + print "Searchresult for \"".$label."\""; ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/helper_functions.php =================================================================== --- trunk/src/dbpedia-navigator/helper_functions.php 2008-08-15 11:43:53 UTC (rev 1082) +++ trunk/src/dbpedia-navigator/helper_functions.php 2008-08-15 12:03:42 UTC (rev 1083) @@ -18,12 +18,20 @@ function getTagCloud($tags,$label) { + if (isset($tags['NoCategory'])){ + $nc=true; + unset($tags['NoCategory']); + } + else $nc=false; + $max=max($tags); $min=min($tags); $diff=$max-$min; $distribution=$diff/3; $ret="<p>"; + $ret.='<a style="font-size:xx-large;" href="#" onclick="document.getElementById(\'hidden_class\').value=\'all\';show_results(\'all\',document.getElementById(\'hidden_number\').value);">All</a> '; + if ($nc) $ret.='<a style="font-size:xx-small;" href="#" onclick="document.getElementById(\'hidden_class\').value=\'NoCategory\';show_results(\'NoCategory\',document.getElementById(\'hidden_number\').value);">No Category</a> '; foreach ($tags as $tag=>$count){ if ($count==$min) $style="font-size:xx-small;"; else if ($count==$max) $style="font-size:xx-large;"; @@ -31,40 +39,50 @@ else if ($count>($min+$distribution)) $style="font-size:medium;"; else $style="font-size:small;"; - $tag_with_entities=htmlentities("\"".$tag."\""); - $ret.='<a style="'.$style.'" href="#" onclick="xajax_getSubjectsFromConcept(\''.$tag_with_entities.'\');">'.$label[$tag].'</a>'; + //$tag_with_entities=htmlentities("\"".$tag."\""); + $ret.='<a style="'.$style.'" href="#" onclick="document.getElementById(\'hidden_class\').value=\''.$tag.'\';show_results(\''.$tag.'\',document.getElementById(\'hidden_number\').value);">'.$label[$tag].'</a> '; } - $ret.="</p>"; + $ret.="</p><br/>"; return $ret; } -function getResultsTable($names,$labels) +function getResultsTable($names,$labels,$classes,$number) { - $ret="<p>Your search brought ".count($names)." results.</p><br/>"; + $ret="<p>These are your Searchresults. Show best "; + for ($k=10;$k<125;){ + $ret.="<a href=\"#\" onclick=\"var list=tree.getAllChecked();search_it('label='+document.getElementById('label').value+'&list='+list+'&number=".$k."');return false;\""; + if ($k==$number) $ret.=" style=\"text-decoration:none;\""; + else $ret.=" style=\"text-decoration:underline;\""; + $ret.=">".($k)."</a>"; + if ($k!=100) $ret.=" | "; + if($k==10) $k=25; + else $k=$k+25; + } + $ret.="</p><br/>"; $i=0; $display="block"; - while($i*30<count($names)) + $ret.="<div id=\"results\">"; + while($i*25<count($names)) { - $ret.="<div id='results".$i."' style='display:".$display."'>Seite ".($i+1)."<br/><br/>"; - for ($j=0;($j<30)&&(($i*30+$j)<count($names));$j++) + for ($j=0;($j<25)&&(($i*25+$j)<count($names));$j++) { - $name=$names[$i*30+$j]; - $label=$labels[$i*30+$j]; - $ret.=' <a href="" onclick="get_article(\'label='.$name.'&cache=-1\');return false;">'.$label.'</a><br/>'; + $name=$names[$i*25+$j]; + $label=$labels[$i*25+$j]; + $class=$classes[$i*25+$j]; + $ret.='<p style="display:'.$display.'"> '.($i*25+$j+1).'. <a href="" class="'.$class.'" onclick="get_article(\'label='.$name.'&cache=-1\');return false;">'.$label.'</a></p>'; } - $ret.="</div>"; $i++; $display="none"; } - $ret.="<br/><p style='width:100%;text-align:center;'>"; + $ret.='<input type="hidden" id="hidden_class" value="all"/><input type="hidden" id="hidden_number" value="0"/></div><br/><p style="width:100%;text-align:center;" id="sitenumbers">'; 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.="<span>"; + if ($k!=0) $ret.=" | "; + $ret.="<a href=\"#\" onclick=\"document.getElementById('hidden_number').value='".(25*$k)."';show_results(document.getElementById('hidden_class').value,".(25*$k).");\""; + if ($k==0) $ret.=" style=\"text-decoration:none;\""; + else $ret.=" style=\"text-decoration:underline;\""; + $ret.=">".($k+1)."</a>"; + $ret.="</span>"; } $ret.="</p>"; return $ret; Modified: trunk/src/dbpedia-navigator/index-new.php =================================================================== --- trunk/src/dbpedia-navigator/index-new.php 2008-08-15 11:43:53 UTC (rev 1082) +++ trunk/src/dbpedia-navigator/index-new.php 2008-08-15 12:03:42 UTC (rev 1083) @@ -75,7 +75,7 @@ } } - function get_article(param) + function search_it(param) { if (document.all){ //IE @@ -86,7 +86,7 @@ var XhrObj = new XMLHttpRequest(); } - XhrObj.open("POST",'ajax_get_article.php'); + XhrObj.open("POST",'ajax_search.php'); XhrObj.onreadystatechange = function() { @@ -94,9 +94,6 @@ var response = XhrObj.responseText.split('$$'); document.getElementById('articlecontent').innerHTML=response[0]; document.getElementById('ArticleTitle').innerHTML=response[1]; - document.getElementById('lastarticles').innerHTML=response[2]; - document.getElementById('Positives').innerHTML=response[3]; - document.getElementById('Negatives').innerHTML=response[4]; } } @@ -104,7 +101,7 @@ XhrObj.send(param); } - function search(param) + function get_article(param) { if (document.all){ //IE @@ -115,7 +112,7 @@ var XhrObj = new XMLHttpRequest(); } - XhrObj.open("POST",'ajax_search.php'); + XhrObj.open("POST",'ajax_get_article.php'); XhrObj.onreadystatechange = function() { @@ -123,12 +120,43 @@ var response = XhrObj.responseText.split('$$'); document.getElementById('articlecontent').innerHTML=response[0]; document.getElementById('ArticleTitle').innerHTML=response[1]; + document.getElementById('lastarticles').innerHTML=response[2]; + document.getElementById('Positives').innerHTML=response[3]; + document.getElementById('Negatives').innerHTML=response[4]; } } XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); XhrObj.send(param); } + + function show_results(class, number) + { + var links=document.getElementById('results').getElementsByTagName('p'); + var j=0; + for (var i=0;i<links.length;i++){ + if (links[i].getElementsByTagName('a')[0].className==class||class=='all'){ + if ((j+1)>number&&j<(number+25)) links[i].style.display='block'; + else links[i].style.display='none'; + j++; + } + else links[i].style.display='none'; + } + if (j<number){ + show_results(class,0); + return; + } + + var sitenumbers=document.getElementById('sitenumbers').getElementsByTagName('span'); + for (var i=0;i<sitenumbers.length;i++){ + if ((parseInt(sitenumbers[i].getElementsByTagName('a')[0].innerHTML)-1)*25==number) sitenumbers[i].getElementsByTagName('a')[0].style.textDecoration='none'; + else sitenumbers[i].getElementsByTagName('a')[0].style.textDecoration='underline'; + if ((parseInt(sitenumbers[i].getElementsByTagName('a')[0].innerHTML)-1)*25>=j) + sitenumbers[i].style.display='none'; + else + sitenumbers[i].style.display='inline'; + } + } </script> </head> <body> @@ -148,7 +176,7 @@ <!-- Search:<br/> --> <form onSubmit="get_article('label='+document.getElementById('label').value+'&cache=-1');return false;"> <input type="text" name="label" id="label" /><br/> - <input type="button" value="Article" class="button" onclick="get_article('label='+document.getElementById('label').value+'&cache=-1');return false;" /> <input type="button" value="Search" class="button" onclick="var list=tree.getAllChecked();search('label='+document.getElementById('label').value+'&list='+list);return false;" /> + <input type="button" value="Article" class="button" onclick="get_article('label='+document.getElementById('label').value+'&cache=-1');return false;" /> <input type="button" value="Search" class="button" onclick="var list=tree.getAllChecked();search_it('label='+document.getElementById('label').value+'&list='+list+'&number=10');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-08-15 13:06:45
|
Revision: 1085 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1085&view=rev Author: sknappe Date: 2008-08-15 13:06:41 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Added all Functions to manage interests list Modified Paths: -------------- trunk/src/dbpedia-navigator/ajax_get_article.php trunk/src/dbpedia-navigator/helper_functions.php trunk/src/dbpedia-navigator/index-new.php Added Paths: ----------- trunk/src/dbpedia-navigator/ajax_clear_negatives.php trunk/src/dbpedia-navigator/ajax_clear_positives.php trunk/src/dbpedia-navigator/ajax_remove_neg_interest.php trunk/src/dbpedia-navigator/ajax_remove_pos_interest.php trunk/src/dbpedia-navigator/ajax_to_negative.php trunk/src/dbpedia-navigator/ajax_to_positive.php Added: trunk/src/dbpedia-navigator/ajax_clear_negatives.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_clear_negatives.php (rev 0) +++ trunk/src/dbpedia-navigator/ajax_clear_negatives.php 2008-08-15 13:06:41 UTC (rev 1085) @@ -0,0 +1,6 @@ +<?php + session_start(); + unset($_SESSION['negative']); + + print ""; +?> \ No newline at end of file Added: trunk/src/dbpedia-navigator/ajax_clear_positives.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_clear_positives.php (rev 0) +++ trunk/src/dbpedia-navigator/ajax_clear_positives.php 2008-08-15 13:06:41 UTC (rev 1085) @@ -0,0 +1,6 @@ +<?php + session_start(); + unset($_SESSION['positive']); + + print ""; +?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/ajax_get_article.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_article.php 2008-08-15 12:21:00 UTC (rev 1084) +++ trunk/src/dbpedia-navigator/ajax_get_article.php 2008-08-15 13:06:41 UTC (rev 1085) @@ -131,15 +131,15 @@ //Add Positives to Session if (!isset($_SESSION['positive'])){ if ($redirect!=""){ - $array=array($redirect => $redirect); + $array=array($redirect => $artTitle); } - else $array=array("http://dbpedia.org/resource/".str_replace(" ","_",$subject) => "http://dbpedia.org/resource/".str_replace(" ","_",$subject)); + else $array=array($uri => $artTitle); $_SESSION['positive']=$array; } else{ $array=$_SESSION['positive']; - if ($redirect!="") $array[$redirect] = $redirect; - else $array["http://dbpedia.org/resource/".str_replace(" ","_",$subject)]="http://dbpedia.org/resource/".str_replace(" ","_",$subject); + if ($redirect!="") $array[$redirect] = $artTitle; + else $array[$uri]=$artTitle; $_SESSION['positive']=$array; } @@ -166,25 +166,17 @@ } //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/>"; - } - - + $interests=show_Interests($_SESSION); + print $content; print '$$'; print $artTitle; print '$$'; print $lastArticles; print '$$'; - print $posInterests; + print $interests[0]; print '$$'; - print $negInterests; + print $interests[1]; //$objResponse->call('xajax_learnConcept'); ?> \ No newline at end of file Added: trunk/src/dbpedia-navigator/ajax_remove_neg_interest.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_remove_neg_interest.php (rev 0) +++ trunk/src/dbpedia-navigator/ajax_remove_neg_interest.php 2008-08-15 13:06:41 UTC (rev 1085) @@ -0,0 +1,15 @@ +<?php + include('helper_functions.php'); + + $subject=$_POST['subject']; + + session_start(); + unset($_SESSION['negative'][$subject]); + + //add Positives and Negatives to Interests + $interests=show_Interests($_SESSION); + + print $interests[0]; + print '$$'; + print $interests[1]; +?> \ No newline at end of file Added: trunk/src/dbpedia-navigator/ajax_remove_pos_interest.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_remove_pos_interest.php (rev 0) +++ trunk/src/dbpedia-navigator/ajax_remove_pos_interest.php 2008-08-15 13:06:41 UTC (rev 1085) @@ -0,0 +1,15 @@ +<?php + include('helper_functions.php'); + + $subject=$_POST['subject']; + + session_start(); + unset($_SESSION['positive'][$subject]); + + //add Positives and Negatives to Interests + $interests=show_Interests($_SESSION); + + print $interests[0]; + print '$$'; + print $interests[1]; +?> \ No newline at end of file Added: trunk/src/dbpedia-navigator/ajax_to_negative.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_to_negative.php (rev 0) +++ trunk/src/dbpedia-navigator/ajax_to_negative.php 2008-08-15 13:06:41 UTC (rev 1085) @@ -0,0 +1,25 @@ +<?php + include('helper_functions.php'); + + $subject=$_POST['subject']; + $label=$_POST['label']; + + session_start(); + unset($_SESSION['positive'][$subject]); + if (!isset($_SESSION['negative'])){ + $array=array($subject => $label); + $_SESSION['negative']=$array; + } + else{ + $array=$_SESSION['negative']; + $array[$subject]=$label; + $_SESSION['negative']=$array; + } + + //add Positives and Negatives to Interests + $interests=show_Interests($_SESSION); + + print $interests[0]; + print '$$'; + print $interests[1]; +?> \ No newline at end of file Added: trunk/src/dbpedia-navigator/ajax_to_positive.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_to_positive.php (rev 0) +++ trunk/src/dbpedia-navigator/ajax_to_positive.php 2008-08-15 13:06:41 UTC (rev 1085) @@ -0,0 +1,25 @@ +<?php + include('helper_functions.php'); + + $subject=$_POST['subject']; + $label=$_POST['label']; + + session_start(); + unset($_SESSION['negative'][$subject]); + if (!isset($_SESSION['positive'])){ + $array=array($subject => $label); + $_SESSION['positive']=$array; + } + else{ + $array=$_SESSION['positive']; + $array[$subject]=$label; + $_SESSION['positive']=$array; + } + + //add Positives and Negatives to Interests + $interests=show_Interests($_SESSION); + + print $interests[0]; + print '$$'; + print $interests[1]; +?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/helper_functions.php =================================================================== --- trunk/src/dbpedia-navigator/helper_functions.php 2008-08-15 12:21:00 UTC (rev 1084) +++ trunk/src/dbpedia-navigator/helper_functions.php 2008-08-15 13:06:41 UTC (rev 1085) @@ -176,4 +176,18 @@ } return $string; } + +function show_Interests($sess) +{ + if (isset($sess['positive'])) foreach($sess['positive'] as $name=>$lab){ + $ret[0]=$lab." <a href=\"\" onclick=\"toNegative('subject=".$name."&label=".$lab."');return false;\"><img src=\"".$_GET['path']."images/minus.jpg\" alt=\"Minus\"/></a> <a href=\"\" onclick=\"removePosInterest('subject=".$name."');return false;\"><img src=\"".$_GET['path']."images/remove.png\" alt=\"Delete\"/></a><br/>"; + } + else $ret[0]=""; + if (isset($sess['negative'])) foreach($sess['negative'] as $name=>$lab){ + $ret[1]=$lab." <a href=\"\" onclick=\"toPositive('subject=".$name."&label=".$lab."');return false;\"><img src=\"".$_GET['path']."images/plus.jpg\" alt=\"Plus\"/></a> <a href=\"\" onclick=\"removeNegInterest('subject=".$name."');return false;\"><img src=\"".$_GET['path']."images/remove.png\" alt=\"Delete\"/></a><br/>"; + } + else $ret[1]=""; + + return $ret; +} ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/index-new.php =================================================================== --- trunk/src/dbpedia-navigator/index-new.php 2008-08-15 12:21:00 UTC (rev 1084) +++ trunk/src/dbpedia-navigator/index-new.php 2008-08-15 13:06:41 UTC (rev 1085) @@ -157,6 +157,158 @@ sitenumbers[i].style.display='inline'; } } + + function toPositive(param) + { + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_to_positive.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + var response = XhrObj.responseText.split('$$'); + document.getElementById('Positives').innerHTML=response[0]; + document.getElementById('Negatives').innerHTML=response[1]; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(param); + } + + function toNegative(param) + { + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_to_negative.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + var response = XhrObj.responseText.split('$$'); + document.getElementById('Positives').innerHTML=response[0]; + document.getElementById('Negatives').innerHTML=response[1]; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(param); + } + + function clearPositives() + { + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_clear_positives.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + document.getElementById('Positives').innerHTML = XhrObj.responseText; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(); + } + + function clearNegatives() + { + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_clear_negatives.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + document.getElementById('Negatives').innerHTML = XhrObj.responseText; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(); + } + + function removePosInterest(param) + { + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_remove_pos_interest.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + var response = XhrObj.responseText.split('$$'); + document.getElementById('Positives').innerHTML=response[0]; + document.getElementById('Negatives').innerHTML=response[1]; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(param); + } + + function removeNegInterest(param) + { + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_remove_neg_interest.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + var response = XhrObj.responseText.split('$$'); + document.getElementById('Positives').innerHTML=response[0]; + document.getElementById('Negatives').innerHTML=response[1]; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(param); + } </script> </head> <body> @@ -241,13 +393,13 @@ <div id="rightSidebar"> <div class="box"> - <div class="boxtitlewithbutton" id="positivesboxtitle">search relevant <img src="<?php print $path;?>images/remove.png" onclick="xajax_clearPositives()" /> </div> + <div class="boxtitlewithbutton" id="positivesboxtitle">search relevant <a href="#"><img src="<?php print $path;?>images/remove.png" onclick="clearPositives()" /></a> </div> <div class="boxcontent" id="Positives"> </div> <!-- boxcontent --> </div> <!-- box --> <div class="box"> - <div class="boxtitlewithbutton" id="negativesboxtitle">not relevant <img src="<?php print $path;?>images/remove.png" onclick="xajax_clearNegatives()" /> </div> + <div class="boxtitlewithbutton" id="negativesboxtitle">not relevant <a href="#"><img src="<?php print $path;?>images/remove.png" onclick="clearNegatives()" /></a> </div> <div class="boxcontent" id="Negatives"> </div> <!-- boxcontent --> </div> <!-- box --> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-08-15 13:08:40
|
Revision: 1086 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1086&view=rev Author: sknappe Date: 2008-08-15 13:08:36 +0000 (Fri, 15 Aug 2008) Log Message: ----------- renamed old index.php Added Paths: ----------- trunk/src/dbpedia-navigator/index-old.php Removed Paths: ------------- trunk/src/dbpedia-navigator/index.php Copied: trunk/src/dbpedia-navigator/index-old.php (from rev 1061, trunk/src/dbpedia-navigator/index.php) =================================================================== --- trunk/src/dbpedia-navigator/index-old.php (rev 0) +++ trunk/src/dbpedia-navigator/index-old.php 2008-08-15 13:08:36 UTC (rev 1086) @@ -0,0 +1,255 @@ +<?php + +ini_set('error_reporting',E_ALL); +ini_set('max_execution_time',200); +ini_set("soap.wsdl_cache_enabled","1"); + +session_start(); +require_once('DLLearnerConnection.php'); +$sc=new DLLearnerConnection(); +$ids=$sc->getIDs(); +$_SESSION['id']=$ids[0]; +$_SESSION['ksID']=$ids[1]; + +if (isset($_GET['path'])) $path=$_GET['path']; +else $path=""; + +require_once 'Settings.php'; +$settings=new Settings(); + +//what happens onLoad +$onLoad="onLoad=\""; +if (isset($_GET['resource'])){ + $onLoad.="xajax_getarticle('".$_GET['resource']."',-1);"; + unset($_GET['resource']); +} +else if (isset($_SESSION['currentArticle'])){ + $onLoad.="xajax_getarticle('',".$_SESSION['currentArticle'].");"; +} +$onLoad.="\""; + +require("ajax.php"); + +echo '<?xml version="1.0" encoding="UTF-8"?>'; +?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <title>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 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'; + }; + hideLoading = function() { + xajax.$('Loading').style.display = 'none'; + //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'; + } + + function loadGoogleMap(Lat,Lng,Label) { + 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> + <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> +<div id="layer" style="display:none"> + <div id="layerContent" style="display:none"></div> +</div> + +<div id="wrapper"> + <div id="leftSidebar"> + + <div class="box"> + <div class="boxtitle">Search DBpedia</div> + <div class="boxcontent" id="search"> + <!-- 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="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 --> + </div> <!-- box --> + + <div class="box" id="SearchResultBox" style="display:none"> + <div class="boxtitle">Search Results</div> + <div class="boxcontent"> + <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="height:218px;overflow:auto;"> + </div> + </div> <!-- boxcontent --> + </div> <!-- box --> + <script> + 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> + + + <div class="box" id="credits"> + <p>DBpedia Navigator is powered by ... <br /> + <a href="http://dl-learner.org">DL-Learner</a><br /> + <a href="http//dbpedia.org">DBpedia</a><br/> + <a href="http://virtuoso.openlinksw.com/wiki/main/">OpenLink Virtuoso</a><br /> + ... and implemented by <a href="http://jens-lehmann.org">Jens Lehmann</a> 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="<?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> + + </div><!-- END leftSidebar --> + + <div id="content"> + <div class="box"> + <div class="boxtitle" id="ArticleTitle">Welcome</div> + <div class="boxcontent" id="article"> + <div id="articlecontent" style="display:block"> + <br /><br /> + Welcome to the DBpedia Navigator interface! DBpedia Navigator allows you to search DBpedia + and uses the background knowledge in DBpedia to suggest possible interesting navigation + links. + </div> + </div> <!-- boxcontent --> + </div> <!-- box --> + </div><!-- content --> + + <div id="rightSidebar"> + + <div class="box"> + <div class="boxtitlewithbutton" id="positivesboxtitle">search relevant <img src="<?php print $path;?>images/remove.png" onclick="xajax_clearPositives()" /> </div> + <div class="boxcontent" id="Positives"> + </div> <!-- boxcontent --> + </div> <!-- box --> + + <div class="box"> + <div class="boxtitlewithbutton" id="negativesboxtitle">not relevant <img src="<?php print $path;?>images/remove.png" onclick="xajax_clearNegatives()" /> </div> + <div class="boxcontent" id="Negatives"> + </div> <!-- boxcontent --> + </div> <!-- box --> + + <div class="box" id="LastArticlesBox" style="display:none"> + <div class="boxtitle">Articles Last Viewed</div> + <div class="boxcontent" id="lastarticles"> + </div> <!-- boxcontent --> + </div> <!-- box --> + + </div><!-- rightSidebar --> + + <!-- <div id="clear"></div> --> + +</div><!-- wrapper --> +<div id="footer"> + <p>Licensed under the GNU General Public License (GPL) 3 as part of the DL-Learner open source + project.<br />Copyright © Jens Lehmann 2007-2008 </p> + <div id="validation"> + <?php + $uri = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; + + echo '<div><a href="http://validator.w3.org/check?uri='.$uri.'"'; + echo '><img src="'.$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="'.$path.'images/valid-css.png" alt="valid CSS" /></a></div>'."\n"; + ?> + </div> + <p><a href='<?php print $path;?>rebuild.php'>rebuild [restart session and redownload WSDL file (for debugging)]</a></p> +</div> + +<div id="todo"> +<b>ToDo:</b> +<ul style="float:left"> + <li>Get learning component fast.</li> + <li>Get local DBpedia SPARQL endpoint working (next DBpedia release expected at the endof January and then every + two months, so it would be nice to have a script based partly automated or at least documented solution for + creating a DBpedia mirror).</li> + <li>Improve stability: Fix sometimes occurring PHP errors and warnings (check PHP error log).</li> + <li>For each result, display a "+" which shows more information about the concept in an overlay box, e.g. its + Description Logic or OWL syntax, its classification accuracy on the examples, and which + examples it classifies (in-)correctly.</li> + <li>Create a small number of test cases (e.g. 3), which can be used to verify that DBpedia Navigator is + working in typical scenarios (in particular cases where concepts with length greater one are learned).</li> + <li>Allow to disable caching functionality (in Settings.php).</li> + <li>Make DBpedia Navigator RESTful, e.g. URLs $base/showArticle/$URL for displaying an article; + $base/search/$phrase for searching; $base/listInstances/$complexClass for listing the instances of + a learned. Maybe session variables (in particuar the selected positive and negative examples) can + also be given, e.g. $base/search/$phrase?positives=[$URL1,$URL2,$URL3]&negatives=[$URL4]. The supported + URI design should be briefly documented (e.g. on a dbpedia.org wiki page). A good URI design allows + easier external access (just give someone a link instead of saying exactly which actions have to be done to + get to a state), simplifies debugging the application, and may be of use for creating further + features.</li> + <li>Improve search functionality [we will probably get feedback from Georgi in February].</li> + <li>[maybe] Display a tag cloud similar to <a href="http://dbpedia.org/search/">DBpedia search</a>.</li> + <li>[maybe] Instead of only allowing a search as entry point to the application, also display + a navigatable class tree.</li> + <li>[if possible] When expensive SPARQL queries or learning problems have been posed, there should be + some way to abandon these if the user has already switched to doing something else. Example: The user + has added 3 positive and 1 negative examples. This is executed as a learning problem, but has no solution (so + DL-Learner would run forever unless we pose some internal time limit). The user adds another negative example a + second later, so instead of letting the previous learning problem run for a long time (and needing much resources), + it should be stopped by DBpedia Navigator.</li> + <li>[if possible] Find an easy way to validate HTML/JS in AJAX applications.</li> + <li>[maybe] Would be interesting to somehow view the Wikipedia article (without the left navigation part, + tabs etc.) as an overlay, because the Wikipedia article will almost always be a human-friendlier + description of an object compared to the extracted one.</li> +</ul> +</div> + + <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> + + </body> +</html> + \ No newline at end of file Deleted: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-08-15 13:06:41 UTC (rev 1085) +++ trunk/src/dbpedia-navigator/index.php 2008-08-15 13:08:36 UTC (rev 1086) @@ -1,255 +0,0 @@ -<?php - -ini_set('error_reporting',E_ALL); -ini_set('max_execution_time',200); -ini_set("soap.wsdl_cache_enabled","1"); - -session_start(); -require_once('DLLearnerConnection.php'); -$sc=new DLLearnerConnection(); -$ids=$sc->getIDs(); -$_SESSION['id']=$ids[0]; -$_SESSION['ksID']=$ids[1]; - -if (isset($_GET['path'])) $path=$_GET['path']; -else $path=""; - -require_once 'Settings.php'; -$settings=new Settings(); - -//what happens onLoad -$onLoad="onLoad=\""; -if (isset($_GET['resource'])){ - $onLoad.="xajax_getarticle('".$_GET['resource']."',-1);"; - unset($_GET['resource']); -} -else if (isset($_SESSION['currentArticle'])){ - $onLoad.="xajax_getarticle('',".$_SESSION['currentArticle'].");"; -} -$onLoad.="\""; - -require("ajax.php"); - -echo '<?xml version="1.0" encoding="UTF-8"?>'; -?> -<!DOCTYPE html - PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> - <head> - <title>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 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'; - }; - hideLoading = function() { - xajax.$('Loading').style.display = 'none'; - //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'; - } - - function loadGoogleMap(Lat,Lng,Label) { - 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> - <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> -<div id="layer" style="display:none"> - <div id="layerContent" style="display:none"></div> -</div> - -<div id="wrapper"> - <div id="leftSidebar"> - - <div class="box"> - <div class="boxtitle">Search DBpedia</div> - <div class="boxcontent" id="search"> - <!-- 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="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 --> - </div> <!-- box --> - - <div class="box" id="SearchResultBox" style="display:none"> - <div class="boxtitle">Search Results</div> - <div class="boxcontent"> - <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="height:218px;overflow:auto;"> - </div> - </div> <!-- boxcontent --> - </div> <!-- box --> - <script> - 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> - - - <div class="box" id="credits"> - <p>DBpedia Navigator is powered by ... <br /> - <a href="http://dl-learner.org">DL-Learner</a><br /> - <a href="http//dbpedia.org">DBpedia</a><br/> - <a href="http://virtuoso.openlinksw.com/wiki/main/">OpenLink Virtuoso</a><br /> - ... and implemented by <a href="http://jens-lehmann.org">Jens Lehmann</a> 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="<?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> - - </div><!-- END leftSidebar --> - - <div id="content"> - <div class="box"> - <div class="boxtitle" id="ArticleTitle">Welcome</div> - <div class="boxcontent" id="article"> - <div id="articlecontent" style="display:block"> - <br /><br /> - Welcome to the DBpedia Navigator interface! DBpedia Navigator allows you to search DBpedia - and uses the background knowledge in DBpedia to suggest possible interesting navigation - links. - </div> - </div> <!-- boxcontent --> - </div> <!-- box --> - </div><!-- content --> - - <div id="rightSidebar"> - - <div class="box"> - <div class="boxtitlewithbutton" id="positivesboxtitle">search relevant <img src="<?php print $path;?>images/remove.png" onclick="xajax_clearPositives()" /> </div> - <div class="boxcontent" id="Positives"> - </div> <!-- boxcontent --> - </div> <!-- box --> - - <div class="box"> - <div class="boxtitlewithbutton" id="negativesboxtitle">not relevant <img src="<?php print $path;?>images/remove.png" onclick="xajax_clearNegatives()" /> </div> - <div class="boxcontent" id="Negatives"> - </div> <!-- boxcontent --> - </div> <!-- box --> - - <div class="box" id="LastArticlesBox" style="display:none"> - <div class="boxtitle">Articles Last Viewed</div> - <div class="boxcontent" id="lastarticles"> - </div> <!-- boxcontent --> - </div> <!-- box --> - - </div><!-- rightSidebar --> - - <!-- <div id="clear"></div> --> - -</div><!-- wrapper --> -<div id="footer"> - <p>Licensed under the GNU General Public License (GPL) 3 as part of the DL-Learner open source - project.<br />Copyright © Jens Lehmann 2007-2008 </p> - <div id="validation"> - <?php - $uri = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; - - echo '<div><a href="http://validator.w3.org/check?uri='.$uri.'"'; - echo '><img src="'.$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="'.$path.'images/valid-css.png" alt="valid CSS" /></a></div>'."\n"; - ?> - </div> - <p><a href='<?php print $path;?>rebuild.php'>rebuild [restart session and redownload WSDL file (for debugging)]</a></p> -</div> - -<div id="todo"> -<b>ToDo:</b> -<ul style="float:left"> - <li>Get learning component fast.</li> - <li>Get local DBpedia SPARQL endpoint working (next DBpedia release expected at the endof January and then every - two months, so it would be nice to have a script based partly automated or at least documented solution for - creating a DBpedia mirror).</li> - <li>Improve stability: Fix sometimes occurring PHP errors and warnings (check PHP error log).</li> - <li>For each result, display a "+" which shows more information about the concept in an overlay box, e.g. its - Description Logic or OWL syntax, its classification accuracy on the examples, and which - examples it classifies (in-)correctly.</li> - <li>Create a small number of test cases (e.g. 3), which can be used to verify that DBpedia Navigator is - working in typical scenarios (in particular cases where concepts with length greater one are learned).</li> - <li>Allow to disable caching functionality (in Settings.php).</li> - <li>Make DBpedia Navigator RESTful, e.g. URLs $base/showArticle/$URL for displaying an article; - $base/search/$phrase for searching; $base/listInstances/$complexClass for listing the instances of - a learned. Maybe session variables (in particuar the selected positive and negative examples) can - also be given, e.g. $base/search/$phrase?positives=[$URL1,$URL2,$URL3]&negatives=[$URL4]. The supported - URI design should be briefly documented (e.g. on a dbpedia.org wiki page). A good URI design allows - easier external access (just give someone a link instead of saying exactly which actions have to be done to - get to a state), simplifies debugging the application, and may be of use for creating further - features.</li> - <li>Improve search functionality [we will probably get feedback from Georgi in February].</li> - <li>[maybe] Display a tag cloud similar to <a href="http://dbpedia.org/search/">DBpedia search</a>.</li> - <li>[maybe] Instead of only allowing a search as entry point to the application, also display - a navigatable class tree.</li> - <li>[if possible] When expensive SPARQL queries or learning problems have been posed, there should be - some way to abandon these if the user has already switched to doing something else. Example: The user - has added 3 positive and 1 negative examples. This is executed as a learning problem, but has no solution (so - DL-Learner would run forever unless we pose some internal time limit). The user adds another negative example a - second later, so instead of letting the previous learning problem run for a long time (and needing much resources), - it should be stopped by DBpedia Navigator.</li> - <li>[if possible] Find an easy way to validate HTML/JS in AJAX applications.</li> - <li>[maybe] Would be interesting to somehow view the Wikipedia article (without the left navigation part, - tabs etc.) as an overlay, because the Wikipedia article will almost always be a human-friendlier - description of an object compared to the extracted one.</li> -</ul> -</div> - - <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> - - </body> -</html> - \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-08-15 13:09:40
|
Revision: 1087 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1087&view=rev Author: sknappe Date: 2008-08-15 13:09:35 +0000 (Fri, 15 Aug 2008) Log Message: ----------- renamed new index to index.php Added Paths: ----------- trunk/src/dbpedia-navigator/index.php Removed Paths: ------------- trunk/src/dbpedia-navigator/index-new.php Deleted: trunk/src/dbpedia-navigator/index-new.php =================================================================== --- trunk/src/dbpedia-navigator/index-new.php 2008-08-15 13:08:36 UTC (rev 1086) +++ trunk/src/dbpedia-navigator/index-new.php 2008-08-15 13:09:35 UTC (rev 1087) @@ -1,480 +0,0 @@ -<?php - -ini_set('error_reporting',E_ALL); -ini_set('max_execution_time',200); -ini_set("soap.wsdl_cache_enabled","1"); - -session_start(); -require_once('DLLearnerConnection.php'); -$sc=new DLLearnerConnection(); -$ids=$sc->getIDs(); -$_SESSION['id']=$ids[0]; -$_SESSION['ksID']=$ids[1]; - -if (isset($_GET['path'])) $path=$_GET['path']; -else $path=""; - -require_once('Settings.php'); -$settings=new Settings(); - -/* -//what happens onLoad -$onLoad="onLoad=\""; -if (isset($_GET['resource'])){ - $onLoad.="xajax_getarticle('".$_GET['resource']."',-1);"; - unset($_GET['resource']); -} -else if (isset($_SESSION['currentArticle'])){ - $onLoad.="xajax_getarticle('',".$_SESSION['currentArticle'].");"; -} -$onLoad.="\""; -*/ - -echo '<?xml version="1.0" encoding="UTF-8"?>'; -?> -<!DOCTYPE html - PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> - <head> - <title>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"> - <script src="http://maps.google.com/maps?file=api&v=2&key=<?php print $settings->googleMapsKey;?>" - type="text/javascript"></script> - <script src="<?php print $path;?>treemenu/dhtmlxcommon.js"></script> - <script src="<?php print $path;?>treemenu/dhtmlxtree.js"></script> - <script type="text/javascript"> - function showdiv(id){ - document.getElementById(id).style.display='block'; - } - - function hidediv(id) { - document.getElementById(id).style.display='none'; - } - - function loadGoogleMap(Lat,Lng,Label) { - 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'; - } - } - - function search_it(param) - { - if (document.all){ - //IE - var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); - } - else{ - //Mozilla - var XhrObj = new XMLHttpRequest(); - } - - XhrObj.open("POST",'ajax_search.php'); - - XhrObj.onreadystatechange = function() - { - if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); - document.getElementById('articlecontent').innerHTML=response[0]; - document.getElementById('ArticleTitle').innerHTML=response[1]; - } - } - - XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); - XhrObj.send(param); - } - - function get_article(param) - { - if (document.all){ - //IE - var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); - } - else{ - //Mozilla - var XhrObj = new XMLHttpRequest(); - } - - XhrObj.open("POST",'ajax_get_article.php'); - - XhrObj.onreadystatechange = function() - { - if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); - document.getElementById('articlecontent').innerHTML=response[0]; - document.getElementById('ArticleTitle').innerHTML=response[1]; - document.getElementById('lastarticles').innerHTML=response[2]; - document.getElementById('Positives').innerHTML=response[3]; - document.getElementById('Negatives').innerHTML=response[4]; - } - } - - XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); - XhrObj.send(param); - } - - function show_results(class, number) - { - var links=document.getElementById('results').getElementsByTagName('p'); - var j=0; - for (var i=0;i<links.length;i++){ - if (links[i].getElementsByTagName('a')[0].className==class||class=='all'){ - if ((j+1)>number&&j<(number+25)) links[i].style.display='block'; - else links[i].style.display='none'; - j++; - } - else links[i].style.display='none'; - } - if (j<number){ - show_results(class,0); - return; - } - - var sitenumbers=document.getElementById('sitenumbers').getElementsByTagName('span'); - for (var i=0;i<sitenumbers.length;i++){ - if ((parseInt(sitenumbers[i].getElementsByTagName('a')[0].innerHTML)-1)*25==number) sitenumbers[i].getElementsByTagName('a')[0].style.textDecoration='none'; - else sitenumbers[i].getElementsByTagName('a')[0].style.textDecoration='underline'; - if ((parseInt(sitenumbers[i].getElementsByTagName('a')[0].innerHTML)-1)*25>=j) - sitenumbers[i].style.display='none'; - else - sitenumbers[i].style.display='inline'; - } - } - - function toPositive(param) - { - if (document.all){ - //IE - var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); - } - else{ - //Mozilla - var XhrObj = new XMLHttpRequest(); - } - - XhrObj.open("POST",'ajax_to_positive.php'); - - XhrObj.onreadystatechange = function() - { - if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); - document.getElementById('Positives').innerHTML=response[0]; - document.getElementById('Negatives').innerHTML=response[1]; - } - } - - XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); - XhrObj.send(param); - } - - function toNegative(param) - { - if (document.all){ - //IE - var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); - } - else{ - //Mozilla - var XhrObj = new XMLHttpRequest(); - } - - XhrObj.open("POST",'ajax_to_negative.php'); - - XhrObj.onreadystatechange = function() - { - if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); - document.getElementById('Positives').innerHTML=response[0]; - document.getElementById('Negatives').innerHTML=response[1]; - } - } - - XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); - XhrObj.send(param); - } - - function clearPositives() - { - if (document.all){ - //IE - var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); - } - else{ - //Mozilla - var XhrObj = new XMLHttpRequest(); - } - - XhrObj.open("POST",'ajax_clear_positives.php'); - - XhrObj.onreadystatechange = function() - { - if (XhrObj.readyState == 4 && XhrObj.status == 200){ - document.getElementById('Positives').innerHTML = XhrObj.responseText; - } - } - - XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); - XhrObj.send(); - } - - function clearNegatives() - { - if (document.all){ - //IE - var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); - } - else{ - //Mozilla - var XhrObj = new XMLHttpRequest(); - } - - XhrObj.open("POST",'ajax_clear_negatives.php'); - - XhrObj.onreadystatechange = function() - { - if (XhrObj.readyState == 4 && XhrObj.status == 200){ - document.getElementById('Negatives').innerHTML = XhrObj.responseText; - } - } - - XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); - XhrObj.send(); - } - - function removePosInterest(param) - { - if (document.all){ - //IE - var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); - } - else{ - //Mozilla - var XhrObj = new XMLHttpRequest(); - } - - XhrObj.open("POST",'ajax_remove_pos_interest.php'); - - XhrObj.onreadystatechange = function() - { - if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); - document.getElementById('Positives').innerHTML=response[0]; - document.getElementById('Negatives').innerHTML=response[1]; - } - } - - XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); - XhrObj.send(param); - } - - function removeNegInterest(param) - { - if (document.all){ - //IE - var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); - } - else{ - //Mozilla - var XhrObj = new XMLHttpRequest(); - } - - XhrObj.open("POST",'ajax_remove_neg_interest.php'); - - XhrObj.onreadystatechange = function() - { - if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); - document.getElementById('Positives').innerHTML=response[0]; - document.getElementById('Negatives').innerHTML=response[1]; - } - } - - XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); - XhrObj.send(param); - } - </script> - </head> - <body> - -<!-- <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> -<div id="layer" style="display:none"> - <div id="layerContent" style="display:none"></div> -</div> - -<div id="wrapper"> - <div id="leftSidebar"> - - <div class="box"> - <div class="boxtitle">Search DBpedia</div> - <div class="boxcontent" id="search"> - <!-- Search:<br/> --> - <form onSubmit="get_article('label='+document.getElementById('label').value+'&cache=-1');return false;"> - <input type="text" name="label" id="label" /><br/> - <input type="button" value="Article" class="button" onclick="get_article('label='+document.getElementById('label').value+'&cache=-1');return false;" /> <input type="button" value="Search" class="button" onclick="var list=tree.getAllChecked();search_it('label='+document.getElementById('label').value+'&list='+list+'&number=10');return false;" /> - <!-- <input type="button" value="Fulltext" class="button" onclick=""/> --> - </form> - </div> <!-- boxcontent --> - </div> <!-- box --> - - <div class="box" id="SearchResultBox" style="display:none"> - <div class="boxtitle">Search Results</div> - <div class="boxcontent"> - <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="height:218px;overflow:auto;"> - </div> - </div> <!-- boxcontent --> - </div> <!-- box --> - <script> - 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> - - - <div class="box" id="credits"> - <p>DBpedia Navigator is powered by ... <br /> - <a href="http://dl-learner.org">DL-Learner</a><br /> - <a href="http//dbpedia.org">DBpedia</a><br/> - <a href="http://virtuoso.openlinksw.com/wiki/main/">OpenLink Virtuoso</a><br /> - ... and implemented by <a href="http://jens-lehmann.org">Jens Lehmann</a> 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="<?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> - - </div><!-- END leftSidebar --> - - <div id="content"> - <div class="box"> - <div class="boxtitle" id="ArticleTitle">Welcome</div> - <div class="boxcontent" id="article"> - <div id="articlecontent" style="display:block"> - <br /><br /> - Welcome to the DBpedia Navigator interface! DBpedia Navigator allows you to search DBpedia - and uses the background knowledge in DBpedia to suggest possible interesting navigation - links. - </div> - </div> <!-- boxcontent --> - </div> <!-- box --> - </div><!-- content --> - - <div id="rightSidebar"> - - <div class="box"> - <div class="boxtitlewithbutton" id="positivesboxtitle">search relevant <a href="#"><img src="<?php print $path;?>images/remove.png" onclick="clearPositives()" /></a> </div> - <div class="boxcontent" id="Positives"> - </div> <!-- boxcontent --> - </div> <!-- box --> - - <div class="box"> - <div class="boxtitlewithbutton" id="negativesboxtitle">not relevant <a href="#"><img src="<?php print $path;?>images/remove.png" onclick="clearNegatives()" /></a> </div> - <div class="boxcontent" id="Negatives"> - </div> <!-- boxcontent --> - </div> <!-- box --> - - <div class="box" id="LastArticlesBox" style="display:none"> - <div class="boxtitle">Articles Last Viewed</div> - <div class="boxcontent" id="lastarticles"> - </div> <!-- boxcontent --> - </div> <!-- box --> - - </div><!-- rightSidebar --> - - <!-- <div id="clear"></div> --> - -</div><!-- wrapper --> -<div id="footer"> - <p>Licensed under the GNU General Public License (GPL) 3 as part of the DL-Learner open source - project.<br />Copyright © Jens Lehmann 2007-2008 </p> - <div id="validation"> - <?php - $uri = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; - - echo '<div><a href="http://validator.w3.org/check?uri='.$uri.'"'; - echo '><img src="'.$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="'.$path.'images/valid-css.png" alt="valid CSS" /></a></div>'."\n"; - ?> - </div> - <p><a href='<?php print $path;?>rebuild.php'>rebuild [restart session and redownload WSDL file (for debugging)]</a></p> -</div> - -<div id="todo"> -<b>ToDo:</b> -<ul style="float:left"> - <li>Get learning component fast.</li> - <li>Get local DBpedia SPARQL endpoint working (next DBpedia release expected at the endof January and then every - two months, so it would be nice to have a script based partly automated or at least documented solution for - creating a DBpedia mirror).</li> - <li>Improve stability: Fix sometimes occurring PHP errors and warnings (check PHP error log).</li> - <li>For each result, display a "+" which shows more information about the concept in an overlay box, e.g. its - Description Logic or OWL syntax, its classification accuracy on the examples, and which - examples it classifies (in-)correctly.</li> - <li>Create a small number of test cases (e.g. 3), which can be used to verify that DBpedia Navigator is - working in typical scenarios (in particular cases where concepts with length greater one are learned).</li> - <li>Allow to disable caching functionality (in Settings.php).</li> - <li>Make DBpedia Navigator RESTful, e.g. URLs $base/showArticle/$URL for displaying an article; - $base/search/$phrase for searching; $base/listInstances/$complexClass for listing the instances of - a learned. Maybe session variables (in particuar the selected positive and negative examples) can - also be given, e.g. $base/search/$phrase?positives=[$URL1,$URL2,$URL3]&negatives=[$URL4]. The supported - URI design should be briefly documented (e.g. on a dbpedia.org wiki page). A good URI design allows - easier external access (just give someone a link instead of saying exactly which actions have to be done to - get to a state), simplifies debugging the application, and may be of use for creating further - features.</li> - <li>Improve search functionality [we will probably get feedback from Georgi in February].</li> - <li>[maybe] Display a tag cloud similar to <a href="http://dbpedia.org/search/">DBpedia search</a>.</li> - <li>[maybe] Instead of only allowing a search as entry point to the application, also display - a navigatable class tree.</li> - <li>[if possible] When expensive SPARQL queries or learning problems have been posed, there should be - some way to abandon these if the user has already switched to doing something else. Example: The user - has added 3 positive and 1 negative examples. This is executed as a learning problem, but has no solution (so - DL-Learner would run forever unless we pose some internal time limit). The user adds another negative example a - second later, so instead of letting the previous learning problem run for a long time (and needing much resources), - it should be stopped by DBpedia Navigator.</li> - <li>[if possible] Find an easy way to validate HTML/JS in AJAX applications.</li> - <li>[maybe] Would be interesting to somehow view the Wikipedia article (without the left navigation part, - tabs etc.) as an overlay, because the Wikipedia article will almost always be a human-friendlier - description of an object compared to the extracted one.</li> -</ul> -</div> - - <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> - - </body> -</html> - \ No newline at end of file Copied: trunk/src/dbpedia-navigator/index.php (from rev 1085, trunk/src/dbpedia-navigator/index-new.php) =================================================================== --- trunk/src/dbpedia-navigator/index.php (rev 0) +++ trunk/src/dbpedia-navigator/index.php 2008-08-15 13:09:35 UTC (rev 1087) @@ -0,0 +1,480 @@ +<?php + +ini_set('error_reporting',E_ALL); +ini_set('max_execution_time',200); +ini_set("soap.wsdl_cache_enabled","1"); + +session_start(); +require_once('DLLearnerConnection.php'); +$sc=new DLLearnerConnection(); +$ids=$sc->getIDs(); +$_SESSION['id']=$ids[0]; +$_SESSION['ksID']=$ids[1]; + +if (isset($_GET['path'])) $path=$_GET['path']; +else $path=""; + +require_once('Settings.php'); +$settings=new Settings(); + +/* +//what happens onLoad +$onLoad="onLoad=\""; +if (isset($_GET['resource'])){ + $onLoad.="xajax_getarticle('".$_GET['resource']."',-1);"; + unset($_GET['resource']); +} +else if (isset($_SESSION['currentArticle'])){ + $onLoad.="xajax_getarticle('',".$_SESSION['currentArticle'].");"; +} +$onLoad.="\""; +*/ + +echo '<?xml version="1.0" encoding="UTF-8"?>'; +?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <title>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"> + <script src="http://maps.google.com/maps?file=api&v=2&key=<?php print $settings->googleMapsKey;?>" + type="text/javascript"></script> + <script src="<?php print $path;?>treemenu/dhtmlxcommon.js"></script> + <script src="<?php print $path;?>treemenu/dhtmlxtree.js"></script> + <script type="text/javascript"> + function showdiv(id){ + document.getElementById(id).style.display='block'; + } + + function hidediv(id) { + document.getElementById(id).style.display='none'; + } + + function loadGoogleMap(Lat,Lng,Label) { + 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'; + } + } + + function search_it(param) + { + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_search.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + var response = XhrObj.responseText.split('$$'); + document.getElementById('articlecontent').innerHTML=response[0]; + document.getElementById('ArticleTitle').innerHTML=response[1]; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(param); + } + + function get_article(param) + { + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_get_article.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + var response = XhrObj.responseText.split('$$'); + document.getElementById('articlecontent').innerHTML=response[0]; + document.getElementById('ArticleTitle').innerHTML=response[1]; + document.getElementById('lastarticles').innerHTML=response[2]; + document.getElementById('Positives').innerHTML=response[3]; + document.getElementById('Negatives').innerHTML=response[4]; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(param); + } + + function show_results(class, number) + { + var links=document.getElementById('results').getElementsByTagName('p'); + var j=0; + for (var i=0;i<links.length;i++){ + if (links[i].getElementsByTagName('a')[0].className==class||class=='all'){ + if ((j+1)>number&&j<(number+25)) links[i].style.display='block'; + else links[i].style.display='none'; + j++; + } + else links[i].style.display='none'; + } + if (j<number){ + show_results(class,0); + return; + } + + var sitenumbers=document.getElementById('sitenumbers').getElementsByTagName('span'); + for (var i=0;i<sitenumbers.length;i++){ + if ((parseInt(sitenumbers[i].getElementsByTagName('a')[0].innerHTML)-1)*25==number) sitenumbers[i].getElementsByTagName('a')[0].style.textDecoration='none'; + else sitenumbers[i].getElementsByTagName('a')[0].style.textDecoration='underline'; + if ((parseInt(sitenumbers[i].getElementsByTagName('a')[0].innerHTML)-1)*25>=j) + sitenumbers[i].style.display='none'; + else + sitenumbers[i].style.display='inline'; + } + } + + function toPositive(param) + { + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_to_positive.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + var response = XhrObj.responseText.split('$$'); + document.getElementById('Positives').innerHTML=response[0]; + document.getElementById('Negatives').innerHTML=response[1]; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(param); + } + + function toNegative(param) + { + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_to_negative.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + var response = XhrObj.responseText.split('$$'); + document.getElementById('Positives').innerHTML=response[0]; + document.getElementById('Negatives').innerHTML=response[1]; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(param); + } + + function clearPositives() + { + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_clear_positives.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + document.getElementById('Positives').innerHTML = XhrObj.responseText; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(); + } + + function clearNegatives() + { + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_clear_negatives.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + document.getElementById('Negatives').innerHTML = XhrObj.responseText; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(); + } + + function removePosInterest(param) + { + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_remove_pos_interest.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + var response = XhrObj.responseText.split('$$'); + document.getElementById('Positives').innerHTML=response[0]; + document.getElementById('Negatives').innerHTML=response[1]; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(param); + } + + function removeNegInterest(param) + { + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_remove_neg_interest.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + var response = XhrObj.responseText.split('$$'); + document.getElementById('Positives').innerHTML=response[0]; + document.getElementById('Negatives').innerHTML=response[1]; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(param); + } + </script> + </head> + <body> + +<!-- <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> +<div id="layer" style="display:none"> + <div id="layerContent" style="display:none"></div> +</div> + +<div id="wrapper"> + <div id="leftSidebar"> + + <div class="box"> + <div class="boxtitle">Search DBpedia</div> + <div class="boxcontent" id="search"> + <!-- Search:<br/> --> + <form onSubmit="get_article('label='+document.getElementById('label').value+'&cache=-1');return false;"> + <input type="text" name="label" id="label" /><br/> + <input type="button" value="Article" class="button" onclick="get_article('label='+document.getElementById('label').value+'&cache=-1');return false;" /> <input type="button" value="Search" class="button" onclick="var list=tree.getAllChecked();search_it('label='+document.getElementById('label').value+'&list='+list+'&number=10');return false;" /> + <!-- <input type="button" value="Fulltext" class="button" onclick=""/> --> + </form> + </div> <!-- boxcontent --> + </div> <!-- box --> + + <div class="box" id="SearchResultBox" style="display:none"> + <div class="boxtitle">Search Results</div> + <div class="boxcontent"> + <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="height:218px;overflow:auto;"> + </div> + </div> <!-- boxcontent --> + </div> <!-- box --> + <script> + 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> + + + <div class="box" id="credits"> + <p>DBpedia Navigator is powered by ... <br /> + <a href="http://dl-learner.org">DL-Learner</a><br /> + <a href="http//dbpedia.org">DBpedia</a><br/> + <a href="http://virtuoso.openlinksw.com/wiki/main/">OpenLink Virtuoso</a><br /> + ... and implemented by <a href="http://jens-lehmann.org">Jens Lehmann</a> 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="<?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> + + </div><!-- END leftSidebar --> + + <div id="content"> + <div class="box"> + <div class="boxtitle" id="ArticleTitle">Welcome</div> + <div class="boxcontent" id="article"> + <div id="articlecontent" style="display:block"> + <br /><br /> + Welcome to the DBpedia Navigator interface! DBpedia Navigator allows you to search DBpedia + and uses the background knowledge in DBpedia to suggest possible interesting navigation + links. + </div> + </div> <!-- boxcontent --> + </div> <!-- box --> + </div><!-- content --> + + <div id="rightSidebar"> + + <div class="box"> + <div class="boxtitlewithbutton" id="positivesboxtitle">search relevant <a href="#"><img src="<?php print $path;?>images/remove.png" onclick="clearPositives()" /></a> </div> + <div class="boxcontent" id="Positives"> + </div> <!-- boxcontent --> + </div> <!-- box --> + + <div class="box"> + <div class="boxtitlewithbutton" id="negativesboxtitle">not relevant <a href="#"><img src="<?php print $path;?>images/remove.png" onclick="clearNegatives()" /></a> </div> + <div class="boxcontent" id="Negatives"> + </div> <!-- boxcontent --> + </div> <!-- box --> + + <div class="box" id="LastArticlesBox" style="display:none"> + <div class="boxtitle">Articles Last Viewed</div> + <div class="boxcontent" id="lastarticles"> + </div> <!-- boxcontent --> + </div> <!-- box --> + + </div><!-- rightSidebar --> + + <!-- <div id="clear"></div> --> + +</div><!-- wrapper --> +<div id="footer"> + <p>Licensed under the GNU General Public License (GPL) 3 as part of the DL-Learner open source + project.<br />Copyright © Jens Lehmann 2007-2008 </p> + <div id="validation"> + <?php + $uri = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; + + echo '<div><a href="http://validator.w3.org/check?uri='.$uri.'"'; + echo '><img src="'.$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="'.$path.'images/valid-css.png" alt="valid CSS" /></a></div>'."\n"; + ?> + </div> + <p><a href='<?php print $path;?>rebuild.php'>rebuild [restart session and redownload WSDL file (for debugging)]</a></p> +</div> + +<div id="todo"> +<b>ToDo:</b> +<ul style="float:left"> + <li>Get learning component fast.</li> + <li>Get local DBpedia SPARQL endpoint working (next DBpedia release expected at the endof January and then every + two months, so it would be nice to have a script based partly automated or at least documented solution for + creating a DBpedia mirror).</li> + <li>Improve stability: Fix sometimes occurring PHP errors and warnings (check PHP error log).</li> + <li>For each result, display a "+" which shows more information about the concept in an overlay box, e.g. its + Description Logic or OWL syntax, its classification accuracy on the examples, and which + examples it classifies (in-)correctly.</li> + <li>Create a small number of test cases (e.g. 3), which can be used to verify that DBpedia Navigator is + working in typical scenarios (in particular cases where concepts with length greater one are learned).</li> + <li>Allow to disable caching functionality (in Settings.php).</li> + <li>Make DBpedia Navigator RESTful, e.g. URLs $base/showArticle/$URL for displaying an article; + $base/search/$phrase for searching; $base/listInstances/$complexClass for listing the instances of + a learned. Maybe session variables (in particuar the selected positive and negative examples) can + also be given, e.g. $base/search/$phrase?positives=[$URL1,$URL2,$URL3]&negatives=[$URL4]. The supported + URI design should be briefly documented (e.g. on a dbpedia.org wiki page). A good URI design allows + easier external access (just give someone a link instead of saying exactly which actions have to be done to + get to a state), simplifies debugging the application, and may be of use for creating further + features.</li> + <li>Improve search functionality [we will probably get feedback from Georgi in February].</li> + <li>[maybe] Display a tag cloud similar to <a href="http://dbpedia.org/search/">DBpedia search</a>.</li> + <li>[maybe] Instead of only allowing a search as entry point to the application, also display + a navigatable class tree.</li> + <li>[if possible] When expensive SPARQL queries or learning problems have been posed, there should be + some way to abandon these if the user has already switched to doing something else. Example: The user + has added 3 positive and 1 negative examples. This is executed as a learning problem, but has no solution (so + DL-Learner would run forever unless we pose some internal time limit). The user adds another negative example a + second later, so instead of letting the previous learning problem run for a long time (and needing much resources), + it should be stopped by DBpedia Navigator.</li> + <li>[if possible] Find an easy way to validate HTML/JS in AJAX applications.</li> + <li>[maybe] Would be interesting to somehow view the Wikipedia article (without the left navigation part, + tabs etc.) as an overlay, because the Wikipedia article will almost always be a human-friendlier + description of an object compared to the extracted one.</li> +</ul> +</div> + + <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> + + </body> +</html> + \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-08-15 13:21:03
|
Revision: 1088 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1088&view=rev Author: sknappe Date: 2008-08-15 13:20:59 +0000 (Fri, 15 Aug 2008) Log Message: ----------- added wsdl and xsd files Added Paths: ----------- trunk/src/dbpedia-navigator/def0.xsd trunk/src/dbpedia-navigator/def1.xsd trunk/src/dbpedia-navigator/main.wsdl Added: trunk/src/dbpedia-navigator/def0.xsd =================================================================== --- trunk/src/dbpedia-navigator/def0.xsd (rev 0) +++ trunk/src/dbpedia-navigator/def0.xsd 2008-08-15 13:20:59 UTC (rev 1088) @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?><xs:schema xmlns:tns="http://server.dllearner.org/" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://server.dllearner.org/" version="1.0"> + + <xs:element name="ClientNotKnownException" type="tns:ClientNotKnownException"></xs:element> + + <xs:element name="ComponentInitException" type="tns:ComponentInitException"></xs:element> + + <xs:element name="ConfigOptionTypeException" type="tns:ConfigOptionTypeException"></xs:element> + + <xs:element name="LearningProblemUnsupportedException" type="tns:LearningProblemUnsupportedException"></xs:element> + + <xs:element name="ParseException" type="tns:ParseException"></xs:element> + + <xs:element name="SparqlQueryException" type="tns:SparqlQueryException"></xs:element> + + <xs:element name="UnknownComponentException" type="tns:UnknownComponentException"></xs:element> + + <xs:complexType name="ParseException"> + <xs:sequence> + <xs:element name="message" type="xs:string" minOccurs="0"></xs:element> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="ClientNotKnownException"> + <xs:sequence> + <xs:element name="message" type="xs:string" minOccurs="0"></xs:element> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="SparqlQueryException"> + <xs:sequence> + <xs:element name="message" type="xs:string" minOccurs="0"></xs:element> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="UnknownComponentException"> + <xs:sequence> + <xs:element name="message" type="xs:string" minOccurs="0"></xs:element> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="ConfigOptionTypeException"> + <xs:sequence> + <xs:element name="message" type="xs:string" minOccurs="0"></xs:element> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="ComponentInitException"> + <xs:sequence> + <xs:element name="message" type="xs:string" minOccurs="0"></xs:element> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="LearningProblemUnsupportedException"> + <xs:sequence> + <xs:element name="message" type="xs:string" minOccurs="0"></xs:element> + </xs:sequence> + </xs:complexType> +</xs:schema> \ No newline at end of file Added: trunk/src/dbpedia-navigator/def1.xsd =================================================================== --- trunk/src/dbpedia-navigator/def1.xsd (rev 0) +++ trunk/src/dbpedia-navigator/def1.xsd 2008-08-15 13:20:59 UTC (rev 1088) @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://jaxb.dev.java.net/array" version="1.0"> + + <xs:complexType final="#all" name="stringArray"> + <xs:sequence> + <xs:element nillable="true" maxOccurs="unbounded" name="item" type="xs:string" minOccurs="0"></xs:element> + </xs:sequence> + </xs:complexType> + + <xs:complexType final="#all" name="intArray"> + <xs:sequence> + <xs:element nillable="true" maxOccurs="unbounded" name="item" type="xs:int" minOccurs="0"></xs:element> + </xs:sequence> + </xs:complexType> +</xs:schema> \ No newline at end of file Added: trunk/src/dbpedia-navigator/main.wsdl =================================================================== --- trunk/src/dbpedia-navigator/main.wsdl (rev 0) +++ trunk/src/dbpedia-navigator/main.wsdl 2008-08-15 13:20:59 UTC (rev 1088) @@ -0,0 +1,1318 @@ +<?xml version="1.0" encoding="UTF-8"?><definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://server.dllearner.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" targetNamespace="http://server.dllearner.org/" name="DLLearnerWSService"> + <types> + <xsd:schema> + <xsd:import schemaLocation="def0.xsd" namespace="http://server.dllearner.org/"></xsd:import> + </xsd:schema> + <xsd:schema> + <xsd:import schemaLocation="def1.xsd" namespace="http://jaxb.dev.java.net/array"></xsd:import> + </xsd:schema> + </types> + <message name="getBuild"></message> + <message name="getBuildResponse"> + <part name="return" type="xsd:string"></part> + </message> + <message name="generateID"></message> + <message name="generateIDResponse"> + <part name="return" type="xsd:int"></part> + </message> + <message name="getKnowledgeSources"></message> + <message name="getKnowledgeSourcesResponse"> + <part xmlns:ns1="http://jaxb.dev.java.net/array" name="return" type="ns1:stringArray"></part> + </message> + <message name="getReasoners"></message> + <message name="getReasonersResponse"> + <part xmlns:ns2="http://jaxb.dev.java.net/array" name="return" type="ns2:stringArray"></part> + </message> + <message name="getLearningProblems"></message> + <message name="getLearningProblemsResponse"> + <part xmlns:ns3="http://jaxb.dev.java.net/array" name="return" type="ns3:stringArray"></part> + </message> + <message name="getLearningAlgorithms"></message> + <message name="getLearningAlgorithmsResponse"> + <part xmlns:ns4="http://jaxb.dev.java.net/array" name="return" type="ns4:stringArray"></part> + </message> + <message name="getConfigOptions"> + <part name="arg0" type="xsd:string"></part> + <part name="arg1" type="xsd:boolean"></part> + </message> + <message name="getConfigOptionsResponse"> + <part xmlns:ns5="http://jaxb.dev.java.net/array" name="return" type="ns5:stringArray"></part> + </message> + <message name="UnknownComponentException"> + <part element="tns:UnknownComponentException" name="fault"></part> + </message> + <message name="addKnowledgeSource"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:string"></part> + <part name="arg2" type="xsd:string"></part> + </message> + <message name="addKnowledgeSourceResponse"> + <part name="return" type="xsd:int"></part> + </message> + <message name="ClientNotKnownException"> + <part element="tns:ClientNotKnownException" name="fault"></part> + </message> + <message name="removeKnowledgeSource"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + </message> + <message name="removeKnowledgeSourceResponse"></message> + <message name="setReasoner"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:string"></part> + </message> + <message name="setReasonerResponse"> + <part name="return" type="xsd:int"></part> + </message> + <message name="setLearningProblem"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:string"></part> + </message> + <message name="setLearningProblemResponse"> + <part name="return" type="xsd:int"></part> + </message> + <message name="setLearningAlgorithm"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:string"></part> + </message> + <message name="setLearningAlgorithmResponse"> + <part name="return" type="xsd:int"></part> + </message> + <message name="LearningProblemUnsupportedException"> + <part element="tns:LearningProblemUnsupportedException" name="fault"></part> + </message> + <message name="initAll"> + <part name="arg0" type="xsd:int"></part> + </message> + <message name="initAllResponse"></message> + <message name="ComponentInitException"> + <part element="tns:ComponentInitException" name="fault"></part> + </message> + <message name="learn"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:string"></part> + </message> + <message name="learnResponse"> + <part name="return" type="xsd:string"></part> + </message> + <message name="learnDescriptionsEvaluated"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + </message> + <message name="learnDescriptionsEvaluatedResponse"> + <part name="return" type="xsd:string"></part> + </message> + <message name="getCurrentlyBestEvaluatedDescriptions"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + </message> + <message name="getCurrentlyBestEvaluatedDescriptionsResponse"> + <part name="return" type="xsd:string"></part> + </message> + <message name="learnThreaded"> + <part name="arg0" type="xsd:int"></part> + </message> + <message name="learnThreadedResponse"></message> + <message name="getCurrentlyBestConcept"> + <part name="arg0" type="xsd:int"></part> + </message> + <message name="getCurrentlyBestConceptResponse"> + <part name="return" type="xsd:string"></part> + </message> + <message name="getCurrentlyBestConcepts"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + </message> + <message name="getCurrentlyBestConceptsResponse"> + <part xmlns:ns6="http://jaxb.dev.java.net/array" name="return" type="ns6:stringArray"></part> + </message> + <message name="isAlgorithmRunning"> + <part name="arg0" type="xsd:int"></part> + </message> + <message name="isAlgorithmRunningResponse"> + <part name="return" type="xsd:boolean"></part> + </message> + <message name="setPositiveExamples"> + <part name="arg0" type="xsd:int"></part> + <part xmlns:ns7="http://jaxb.dev.java.net/array" name="arg1" type="ns7:stringArray"></part> + </message> + <message name="setPositiveExamplesResponse"></message> + <message name="setNegativeExamples"> + <part name="arg0" type="xsd:int"></part> + <part xmlns:ns8="http://jaxb.dev.java.net/array" name="arg1" type="ns8:stringArray"></part> + </message> + <message name="setNegativeExamplesResponse"></message> + <message name="applyConfigEntryInt"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + <part name="arg3" type="xsd:int"></part> + </message> + <message name="applyConfigEntryIntResponse"></message> + <message name="applyConfigEntryString"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + <part name="arg3" type="xsd:string"></part> + </message> + <message name="applyConfigEntryStringResponse"></message> + <message name="applyConfigEntryStringArray"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + <part xmlns:ns9="http://jaxb.dev.java.net/array" name="arg3" type="ns9:stringArray"></part> + </message> + <message name="applyConfigEntryStringArrayResponse"></message> + <message name="applyConfigEntryBoolean"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + <part name="arg3" type="xsd:boolean"></part> + </message> + <message name="applyConfigEntryBooleanResponse"></message> + <message name="getConfigOptionValueStringArray"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + </message> + <message name="getConfigOptionValueStringArrayResponse"> + <part xmlns:ns10="http://jaxb.dev.java.net/array" name="return" type="ns10:stringArray"></part> + </message> + <message name="ConfigOptionTypeException"> + <part element="tns:ConfigOptionTypeException" name="fault"></part> + </message> + <message name="getConfigOptionValueString"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + </message> + <message name="getConfigOptionValueStringResponse"> + <part name="return" type="xsd:string"></part> + </message> + <message name="getConfigOptionValueDouble"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + </message> + <message name="getConfigOptionValueDoubleResponse"> + <part name="return" type="xsd:double"></part> + </message> + <message name="getConfigOptionValueBoolean"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + </message> + <message name="getConfigOptionValueBooleanResponse"> + <part name="return" type="xsd:boolean"></part> + </message> + <message name="getConfigOptionValueInt"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + </message> + <message name="getConfigOptionValueIntResponse"> + <part name="return" type="xsd:int"></part> + </message> + <message name="getAtomicConcepts"> + <part name="arg0" type="xsd:int"></part> + </message> + <message name="getAtomicConceptsResponse"> + <part xmlns:ns11="http://jaxb.dev.java.net/array" name="return" type="ns11:stringArray"></part> + </message> + <message name="getSubsumptionHierarchy"> + <part name="arg0" type="xsd:int"></part> + </message> + <message name="getSubsumptionHierarchyResponse"> + <part name="return" type="xsd:string"></part> + </message> + <message name="retrieval"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:string"></part> + </message> + <message name="retrievalResponse"> + <part xmlns:ns12="http://jaxb.dev.java.net/array" name="return" type="ns12:stringArray"></part> + </message> + <message name="ParseException"> + <part element="tns:ParseException" name="fault"></part> + </message> + <message name="getConceptLength"> + <part name="arg0" type="xsd:string"></part> + </message> + <message name="getConceptLengthResponse"> + <part name="return" type="xsd:int"></part> + </message> + <message name="getAtomicRoles"> + <part name="arg0" type="xsd:int"></part> + </message> + <message name="getAtomicRolesResponse"> + <part xmlns:ns13="http://jaxb.dev.java.net/array" name="return" type="ns13:stringArray"></part> + </message> + <message name="getInstances"> + <part name="arg0" type="xsd:int"></part> + </message> + <message name="getInstancesResponse"> + <part xmlns:ns14="http://jaxb.dev.java.net/array" name="return" type="ns14:stringArray"></part> + </message> + <message name="getIndividualsForARole"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:string"></part> + </message> + <message name="getIndividualsForARoleResponse"> + <part xmlns:ns15="http://jaxb.dev.java.net/array" name="return" type="ns15:stringArray"></part> + </message> + <message name="getAsJSON"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + </message> + <message name="getAsJSONResponse"> + <part name="return" type="xsd:string"></part> + </message> + <message name="SparqlQueryException"> + <part element="tns:SparqlQueryException" name="fault"></part> + </message> + <message name="getAsXMLString"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + </message> + <message name="getAsXMLStringResponse"> + <part name="return" type="xsd:string"></part> + </message> + <message name="sparqlQueryThreaded"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + </message> + <message name="sparqlQueryThreadedResponse"> + <part name="return" type="xsd:int"></part> + </message> + <message name="sparqlQuery"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + </message> + <message name="sparqlQueryResponse"> + <part name="return" type="xsd:string"></part> + </message> + <message name="isSparqlQueryRunning"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + </message> + <message name="isSparqlQueryRunningResponse"> + <part name="return" type="xsd:boolean"></part> + </message> + <message name="stopSparqlThread"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + </message> + <message name="stopSparqlThreadResponse"></message> + <message name="getConceptDepth"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + </message> + <message name="getConceptDepthResponse"> + <part xmlns:ns16="http://jaxb.dev.java.net/array" name="return" type="ns16:intArray"></part> + </message> + <message name="getConceptArity"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + </message> + <message name="getConceptArityResponse"> + <part xmlns:ns17="http://jaxb.dev.java.net/array" name="return" type="ns17:intArray"></part> + </message> + <message name="SparqlRetrieval"> + <part name="arg0" type="xsd:string"></part> + </message> + <message name="SparqlRetrievalResponse"> + <part name="return" type="xsd:string"></part> + </message> + <message name="getNegativeExamples"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part xmlns:ns18="http://jaxb.dev.java.net/array" name="arg2" type="ns18:stringArray"></part> + <part name="arg3" type="xsd:int"></part> + <part name="arg4" type="xsd:string"></part> + </message> + <message name="getNegativeExamplesResponse"> + <part xmlns:ns19="http://jaxb.dev.java.net/array" name="return" type="ns19:stringArray"></part> + </message> + <message name="init"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + </message> + <message name="initResponse"></message> + <message name="debug"> + <part name="arg0" type="xsd:string"></part> + </message> + <message name="debugResponse"></message> + <message name="stop"> + <part name="arg0" type="xsd:int"></part> + </message> + <message name="stopResponse"></message> + <message name="getComponents"></message> + <message name="getComponentsResponse"> + <part xmlns:ns20="http://jaxb.dev.java.net/array" name="return" type="ns20:stringArray"></part> + </message> + <portType name="DLLearnerWebService"> + <operation name="getBuild" parameterOrder=""> + <input message="tns:getBuild"></input> + <output message="tns:getBuildResponse"></output> + </operation> + <operation name="generateID" parameterOrder=""> + <input message="tns:generateID"></input> + <output message="tns:generateIDResponse"></output> + </operation> + <operation name="getKnowledgeSources" parameterOrder=""> + <input message="tns:getKnowledgeSources"></input> + <output message="tns:getKnowledgeSourcesResponse"></output> + </operation> + <operation name="getReasoners" parameterOrder=""> + <input message="tns:getReasoners"></input> + <output message="tns:getReasonersResponse"></output> + </operation> + <operation name="getLearningProblems" parameterOrder=""> + <input message="tns:getLearningProblems"></input> + <output message="tns:getLearningProblemsResponse"></output> + </operation> + <operation name="getLearningAlgorithms" parameterOrder=""> + <input message="tns:getLearningAlgorithms"></input> + <output message="tns:getLearningAlgorithmsResponse"></output> + </operation> + <operation name="getConfigOptions" parameterOrder="arg0 arg1"> + <input message="tns:getConfigOptions"></input> + <output message="tns:getConfigOptionsResponse"></output> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + </operation> + <operation name="addKnowledgeSource" parameterOrder="arg0 arg1 arg2"> + <input message="tns:addKnowledgeSource"></input> + <output message="tns:addKnowledgeSourceResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + </operation> + <operation name="removeKnowledgeSource" parameterOrder="arg0 arg1"> + <input message="tns:removeKnowledgeSource"></input> + <output message="tns:removeKnowledgeSourceResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="setReasoner" parameterOrder="arg0 arg1"> + <input message="tns:setReasoner"></input> + <output message="tns:setReasonerResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + </operation> + <operation name="setLearningProblem" parameterOrder="arg0 arg1"> + <input message="tns:setLearningProblem"></input> + <output message="tns:setLearningProblemResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + </operation> + <operation name="setLearningAlgorithm" parameterOrder="arg0 arg1"> + <input message="tns:setLearningAlgorithm"></input> + <output message="tns:setLearningAlgorithmResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + <fault message="tns:LearningProblemUnsupportedException" name="LearningProblemUnsupportedException"></fault> + </operation> + <operation name="initAll" parameterOrder="arg0"> + <input message="tns:initAll"></input> + <output message="tns:initAllResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:ComponentInitException" name="ComponentInitException"></fault> + </operation> + <operation name="learn" parameterOrder="arg0 arg1"> + <input message="tns:learn"></input> + <output message="tns:learnResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="learnDescriptionsEvaluated" parameterOrder="arg0 arg1"> + <input message="tns:learnDescriptionsEvaluated"></input> + <output message="tns:learnDescriptionsEvaluatedResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="getCurrentlyBestEvaluatedDescriptions" parameterOrder="arg0 arg1"> + <input message="tns:getCurrentlyBestEvaluatedDescriptions"></input> + <output message="tns:getCurrentlyBestEvaluatedDescriptionsResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="learnThreaded" parameterOrder="arg0"> + <input message="tns:learnThreaded"></input> + <output message="tns:learnThreadedResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="getCurrentlyBestConcept" parameterOrder="arg0"> + <input message="tns:getCurrentlyBestConcept"></input> + <output message="tns:getCurrentlyBestConceptResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="getCurrentlyBestConcepts" parameterOrder="arg0 arg1 arg2"> + <input message="tns:getCurrentlyBestConcepts"></input> + <output message="tns:getCurrentlyBestConceptsResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="isAlgorithmRunning" parameterOrder="arg0"> + <input message="tns:isAlgorithmRunning"></input> + <output message="tns:isAlgorithmRunningResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="setPositiveExamples" parameterOrder="arg0 arg1"> + <input message="tns:setPositiveExamples"></input> + <output message="tns:setPositiveExamplesResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="setNegativeExamples" parameterOrder="arg0 arg1"> + <input message="tns:setNegativeExamples"></input> + <output message="tns:setNegativeExamplesResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="applyConfigEntryInt" parameterOrder="arg0 arg1 arg2 arg3"> + <input message="tns:applyConfigEntryInt"></input> + <output message="tns:applyConfigEntryIntResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + </operation> + <operation name="applyConfigEntryString" parameterOrder="arg0 arg1 arg2 arg3"> + <input message="tns:applyConfigEntryString"></input> + <output message="tns:applyConfigEntryStringResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + </operation> + <operation name="applyConfigEntryStringArray" parameterOrder="arg0 arg1 arg2 arg3"> + <input message="tns:applyConfigEntryStringArray"></input> + <output message="tns:applyConfigEntryStringArrayResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + </operation> + <operation name="applyConfigEntryBoolean" parameterOrder="arg0 arg1 arg2 arg3"> + <input message="tns:applyConfigEntryBoolean"></input> + <output message="tns:applyConfigEntryBooleanResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + </operation> + <operation name="getConfigOptionValueStringArray" parameterOrder="arg0 arg1 arg2"> + <input message="tns:getConfigOptionValueStringArray"></input> + <output message="tns:getConfigOptionValueStringArrayResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + <fault message="tns:ConfigOptionTypeException" name="ConfigOptionTypeException"></fault> + </operation> + <operation name="getConfigOptionValueString" parameterOrder="arg0 arg1 arg2"> + <input message="tns:getConfigOptionValueString"></input> + <output message="tns:getConfigOptionValueStringResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + <fault message="tns:ConfigOptionTypeException" name="ConfigOptionTypeException"></fault> + </operation> + <operation name="getConfigOptionValueDouble" parameterOrder="arg0 arg1 arg2"> + <input message="tns:getConfigOptionValueDouble"></input> + <output message="tns:getConfigOptionValueDoubleResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + <fault message="tns:ConfigOptionTypeException" name="ConfigOptionTypeException"></fault> + </operation> + <operation name="getConfigOptionValueBoolean" parameterOrder="arg0 arg1 arg2"> + <input message="tns:getConfigOptionValueBoolean"></input> + <output message="tns:getConfigOptionValueBooleanResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + <fault message="tns:ConfigOptionTypeException" name="ConfigOptionTypeException"></fault> + </operation> + <operation name="getConfigOptionValueInt" parameterOrder="arg0 arg1 arg2"> + <input message="tns:getConfigOptionValueInt"></input> + <output message="tns:getConfigOptionValueIntResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + <fault message="tns:ConfigOptionTypeException" name="ConfigOptionTypeException"></fault> + </operation> + <operation name="getAtomicConcepts" parameterOrder="arg0"> + <input message="tns:getAtomicConcepts"></input> + <output message="tns:getAtomicConceptsResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="getSubsumptionHierarchy" parameterOrder="arg0"> + <input message="tns:getSubsumptionHierarchy"></input> + <output message="tns:getSubsumptionHierarchyResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="retrieval" parameterOrder="arg0 arg1"> + <input message="tns:retrieval"></input> + <output message="tns:retrievalResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:ParseException" name="ParseException"></fault> + </operation> + <operation name="getConceptLength" parameterOrder="arg0"> + <input message="tns:getConceptLength"></input> + <output message="tns:getConceptLengthResponse"></output> + <fault message="tns:ParseException" name="ParseException"></fault> + </operation> + <operation name="getAtomicRoles" parameterOrder="arg0"> + <input message="tns:getAtomicRoles"></input> + <output message="tns:getAtomicRolesResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="getInstances" parameterOrder="arg0"> + <input message="tns:getInstances"></input> + <output message="tns:getInstancesResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="getIndividualsForARole" parameterOrder="arg0 arg1"> + <input message="tns:getIndividualsForARole"></input> + <output message="tns:getIndividualsForARoleResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="getAsJSON" parameterOrder="arg0 arg1"> + <input message="tns:getAsJSON"></input> + <output message="tns:getAsJSONResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:SparqlQueryException" name="SparqlQueryException"></fault> + </operation> + <operation name="getAsXMLString" parameterOrder="arg0 arg1"> + <input message="tns:getAsXMLString"></input> + <output message="tns:getAsXMLStringResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:SparqlQueryException" name="SparqlQueryException"></fault> + </operation> + <operation name="sparqlQueryThreaded" parameterOrder="arg0 arg1 arg2"> + <input message="tns:sparqlQueryThreaded"></input> + <output message="tns:sparqlQueryThreadedResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="sparqlQuery" parameterOrder="arg0 arg1 arg2"> + <input message="tns:sparqlQuery"></input> + <output message="tns:sparqlQueryResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="isSparqlQueryRunning" parameterOrder="arg0 arg1"> + <input message="tns:isSparqlQueryRunning"></input> + <output message="tns:isSparqlQueryRunningResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="stopSparqlThread" parameterOrder="arg0 arg1"> + <input message="tns:stopSparqlThread"></input> + <output message="tns:stopSparqlThreadResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="getConceptDepth" parameterOrder="arg0 arg1"> + <input message="tns:getConceptDepth"></input> + <output message="tns:getConceptDepthResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="getConceptArity" parameterOrder="arg0 arg1"> + <input message="tns:getConceptArity"></input> + <output message="tns:getConceptArityResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="SparqlRetrieval" parameterOrder="arg0"> + <input message="tns:SparqlRetrieval"></input> + <output message="tns:SparqlRetrievalResponse"></output> + <fault message="tns:ParseException" name="ParseException"></fault> + </operation> + <operation name="getNegativeExamples" parameterOrder="arg0 arg1 arg2 arg3 arg4"> + <input message="tns:getNegativeExamples"></input> + <output message="tns:getNegativeExamplesResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="init" parameterOrder="arg0 arg1"> + <input message="tns:init"></input> + <output message="tns:initResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + <fault message="tns:ComponentInitException" name="ComponentInitException"></fault> + </operation> + <operation name="debug" parameterOrder="arg0"> + <input message="tns:debug"></input> + <output message="tns:debugResponse"></output> + </operation> + <operation name="stop" parameterOrder="arg0"> + <input message="tns:stop"></input> + <output message="tns:stopResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="getComponents" parameterOrder=""> + <input message="tns:getComponents"></input> + <output message="tns:getComponentsResponse"></output> + </operation> + </portType> + <binding name="DLLearnerWebServicePortBinding" type="tns:DLLearnerWebService"> + <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"></soap:binding> + <operation name="getBuild"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + </operation> + <operation name="generateID"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + </operation> + <operation name="getKnowledgeSources"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + </operation> + <operation name="getReasoners"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + </operation> + <operation name="getLearningProblems"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + </operation> + <operation name="getLearningAlgorithms"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + </operation> + <operation name="getConfigOptions"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="addKnowledgeSource"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="removeKnowledgeSource"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="setReasoner"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="setLearningProblem"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="setLearningAlgorithm"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + <fault name="LearningProblemUnsupportedException"> + <soap:fault name="LearningProblemUnsupportedException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="initAll"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="ComponentInitException"> + <soap:fault name="ComponentInitException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="learn"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="learnDescriptionsEvaluated"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getCurrentlyBestEvaluatedDescriptions"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="learnThreaded"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getCurrentlyBestConcept"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getCurrentlyBestConcepts"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="isAlgorithmRunning"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="setPositiveExamples"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="setNegativeExamples"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="applyConfigEntryInt"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="applyConfigEntryString"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="applyConfigEntryStringArray"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="applyConfigEntryBoolean"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getConfigOptionValueStringArray"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + <fault name="ConfigOptionTypeException"> + <soap:fault name="ConfigOptionTypeException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getConfigOptionValueString"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + <fault name="ConfigOptionTypeException"> + <soap:fault name="ConfigOptionTypeException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getConfigOptionValueDouble"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + <fault name="ConfigOptionTypeException"> + <soap:fault name="ConfigOptionTypeException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getConfigOptionValueBoolean"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + <fault name="ConfigOptionTypeException"> + <soap:fault name="ConfigOptionTypeException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getConfigOptionValueInt"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + <fault name="ConfigOptionTypeException"> + <soap:fault name="ConfigOptionTypeException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getAtomicConcepts"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getSubsumptionHierarchy"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="retrieval"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="ParseException"> + <soap:fault name="ParseException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getConceptLength"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ParseException"> + <soap:fault name="ParseException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getAtomicRoles"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getInstances"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getIndividualsForARole"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getAsJSON"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="SparqlQueryException"> + <soap:fault name="SparqlQueryException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getAsXMLString"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="SparqlQueryException"> + <soap:fault name="SparqlQueryException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="sparqlQueryThreaded"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="sparqlQuery"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="isSparqlQueryRunning"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="stopSparqlThread"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:f... [truncated message content] |
From: <sk...@us...> - 2008-08-15 13:33:40
|
Revision: 1089 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1089&view=rev Author: sknappe Date: 2008-08-15 13:33:38 +0000 (Fri, 15 Aug 2008) Log Message: ----------- added learning concepts Modified Paths: -------------- trunk/src/dbpedia-navigator/index.php Added Paths: ----------- trunk/src/dbpedia-navigator/ajax_learn_concepts.php Added: trunk/src/dbpedia-navigator/ajax_learn_concepts.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_learn_concepts.php (rev 0) +++ trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-08-15 13:33:38 UTC (rev 1089) @@ -0,0 +1,47 @@ +<?php + session_start(); + + if (isset($_SESSION['positive'])) $positives=$_SESSION['positive']; + if (isset($_SESSION['negative'])) $negatives=$_SESSION['negative']; + $id=$_SESSION['id']; + $ksID=$_SESSION['ksID']; + session_write_close(); + setRunning($id,"true"); + $concept=""; + $conceptinformation=""; + if (isset($positives)) + { + $posArray=array(); + foreach ($positives as $name=>$lab) + $posArray[]=$name; + $negArray=array(); + if (isset($negatives)) + foreach ($negatives as $name=>$lab) + $negArray[]=$name; + + require_once("DLLearnerConnection.php"); + $sc=new DLLearnerConnection($id, $ksID); + try{ + $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=\"getSubjectsFromConcept('concept=".$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>"; + $i++; + } + $concept.="</table>"; + } catch(Exception $e){ + $concept.=$e->getMessage(); + } + } + else $concept="You must choose at least one positive example."; + + print $concept; + print '$$'; + print $conceptinformation; +?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-08-15 13:20:59 UTC (rev 1088) +++ trunk/src/dbpedia-navigator/index.php 2008-08-15 13:33:38 UTC (rev 1089) @@ -309,6 +309,32 @@ XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); XhrObj.send(param); } + + function learnConcept() + { + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_learn_concepts.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + var response = XhrObj.responseText.split('$$'); + document.getElementById('conceptlink').innerHTML=response[0]; + document.getElementById('ConceptInformation').innerHTML=response[1]; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(); + } </script> </head> <body> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-08-15 13:44:42
|
Revision: 1090 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1090&view=rev Author: sknappe Date: 2008-08-15 13:44:39 +0000 (Fri, 15 Aug 2008) Log Message: ----------- added other functions (stop server call and get subjects from concept) Modified Paths: -------------- trunk/src/dbpedia-navigator/ajax_learn_concepts.php trunk/src/dbpedia-navigator/index.php Added Paths: ----------- trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php trunk/src/dbpedia-navigator/ajax_stop_server_call.php Added: trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php (rev 0) +++ trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php 2008-08-15 13:44:39 UTC (rev 1090) @@ -0,0 +1,27 @@ +<?php + include('helper_functions.php'); + + $concept=$_POST['concept']; + + session_start(); + $id=$_SESSION['id']; + $ksID=$_SESSION['ksID']; + session_write_close(); + + setRunning($id,"true"); + + $concept=html_entity_decode($concept); + $content=""; + try{ + require_once("DLLearnerConnection.php"); + $sc=new DLLearnerConnection($id,$ksID); + $subjects=$sc->getSubjectsFromConcept($concept); + $content.=getResultsTable($subjects); + } catch (Exception $e){ + $content=$e->getMessage(); + } + + print $content; + print '$$'; + print "Instances for Concept ".$concept; +?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/ajax_learn_concepts.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-08-15 13:33:38 UTC (rev 1089) +++ trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-08-15 13:44:39 UTC (rev 1090) @@ -1,4 +1,6 @@ <?php + include('helper_functions.php'); + session_start(); if (isset($_SESSION['positive'])) $positives=$_SESSION['positive']; Added: trunk/src/dbpedia-navigator/ajax_stop_server_call.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_stop_server_call.php (rev 0) +++ trunk/src/dbpedia-navigator/ajax_stop_server_call.php 2008-08-15 13:44:39 UTC (rev 1090) @@ -0,0 +1,8 @@ +<?php + include('helper_functions.php'); + + session_start(); + $id=$_SESSION['id']; + session_write_close(); + setRunning($id,"false"); +?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-08-15 13:33:38 UTC (rev 1089) +++ trunk/src/dbpedia-navigator/index.php 2008-08-15 13:44:39 UTC (rev 1090) @@ -335,6 +335,55 @@ XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); XhrObj.send(); } + + function stopServerCall() + { + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_stop_server_call.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(); + } + + function getSubjectsFromConcept(param) + { + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_get_subjects_from_concept.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + var response = XhrObj.responseText.split('$$'); + document.getElementById('articlecontent').innerHTML=response[0]; + document.getElementById('ArticleTitle').innerHTML=response[1]; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(param); + } </script> </head> <body> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-08-18 15:33:24
|
Revision: 1095 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1095&view=rev Author: sknappe Date: 2008-08-18 15:33:18 +0000 (Mon, 18 Aug 2008) Log Message: ----------- changed look of articel, added some helpful tooltips, added best search results on left side, last articles is working, changed error messages and some other stuff Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/ajax_get_article.php trunk/src/dbpedia-navigator/ajax_search.php trunk/src/dbpedia-navigator/helper_functions.php trunk/src/dbpedia-navigator/index.php Added Paths: ----------- trunk/src/dbpedia-navigator/images/dbpedia-favicon.ico trunk/src/dbpedia-navigator/images/flickr.png trunk/src/dbpedia-navigator/js/ trunk/src/dbpedia-navigator/js/ajax.js Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-08-15 17:55:39 UTC (rev 1094) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-08-18 15:33:18 UTC (rev 1095) @@ -129,10 +129,11 @@ function getTriples($uri) { + //i am filtering the references out at the moment, because they are causing errors with URL with ...&profile=bla, the XMLParser thinks &profile is a HTML-Entitie and misses the ; $query="SELECT ?pred ?obj ". "WHERE {{<".$uri."> ?pred ?obj.Filter(!regex(str(?pred),'http://dbpedia.org/property/reference'))}UNION{<".$uri."> <http://dbpedia.org/property/redirect> ?Conc.?Conc ?pred ?obj.Filter(!regex(str(?pred),'http://dbpedia.org/property/reference'))}}"; $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."); + if (count($result['results']['bindings'])==0) throw new Exception("An article with that name does not exist. The Search is started ..."); $ret=array(); foreach ($result['results']['bindings'] as $results){ $value=$results['obj']; @@ -181,6 +182,8 @@ return $result; } + //at the moment the subject search uses a database, so this function is not needed + /* function getSubjects($label,$checkedInstances) { $offset=1; @@ -235,7 +238,7 @@ $return['tagcloud']=$tagcloud; $return['tagcloudlabel']=$tagcloudLabel; return $return; - } + }*/ function getSubjectsFromConcept($concept) { Modified: trunk/src/dbpedia-navigator/ajax_get_article.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_article.php 2008-08-15 17:55:39 UTC (rev 1094) +++ trunk/src/dbpedia-navigator/ajax_get_article.php 2008-08-18 15:33:18 UTC (rev 1095) @@ -5,6 +5,8 @@ $subject=$_POST['label']; $fromCache=$_POST['cache']; + if (isset($_POST['path'])) $path=$_POST['path']; + else $path=""; if (isset($_SESSION['articles'])) $articles=$_SESSION['articles']; $id=$_SESSION['id']; @@ -19,7 +21,7 @@ if (isset($articles)){ foreach ($articles as $key => $value) { - if ($value['subject']==$subject){ + if ($value['uri']==$uri){ $fromCache=$key; break; } @@ -32,7 +34,6 @@ $artTitle=""; //get the article - //if $fromCache is -2, no new SearchResults should be processed //if $fromCache is -1, everything is normal //if $fromCache is >=0, the article is taken out of the cache if ($fromCache<0) { @@ -48,7 +49,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]['value'].'" 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 '.$triples['http://www.w3.org/2000/01/rdf-schema#label'][0]['value'].'" style="float:right; max-width:200px;" \>'; //display where it was redirected from, if it was redirected $redirect=""; @@ -62,38 +63,47 @@ // 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]['value'].'">view Wikipedia article</a>, '; - $content .= '<a href="'.$uri.'">view DBpedia resource description</a></p>'; - + $content .= '<p><img src="'.$path.'images/wikipedia_favicon.png" alt="Wikipedia" style="max-width:20px;" /> <a href="#" onclick="window.open(\''.getPrintableURL($triples['http://xmlns.com/foaf/0.1/page'][0]['value']).'\',\'Wikiwindow\',\'width=800,height=500,top=50,left=50,scrollbars=yes\');">view Wikipedia article</a>, '; + $content .= '<img src="'.$path.'images/dbpedia-favicon.ico" alt="DBpedia" style="max-width:20px;"/> <a href="#" onclick="window.open(\''.$uri.'\',\'Wikiwindow\',\'width=800,height=500,top=50,left=50,scrollbars=yes\');">view DBpedia resource description</a>'; + //display photo collection, if there is one + if (isset($triples['http://dbpedia.org/property/hasPhotoCollection'])){ + $content.=', <img src="'.$path.'images/flickr.png" alt="Flickr" style="max-width:20px;" /> <a href="#" onclick="window.open(\''.$triples['http://dbpedia.org/property/hasPhotoCollection'][0]['value'].'\',\'Wikiwindow\',\'width=800,height=500,top=50,left=50,scrollbars=yes\');">view photo collection</a></p>'; + } + + $content.='<br/><hr><h4>Classes and Categories</h4><br/>'; + // display a list of classes if(isset($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type'])) - $content .= '<p>classes: '.formatClassArray($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type']).'</p>'; - - if(isset($triples['http://dbpedia.org/property/reference'])) { + $content .= '<p>Yago classes: '.formatClassArray($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type']).'</p>'; + + //skos-subjects + if (isset($triples['http://www.w3.org/2004/02/skos/core#subject'])){ + $content .= '<br/><p>Skos categories: <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>'; + } + + //not used at the moment + /*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['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: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>"; + $content.='<br/><hr><h4>Map of the location</h4><br/>'; + $content.='<div id="map" style="width: 500px; height: 300px;margin-left:30px;"></div>'; + $lat=$triples['http://www.w3.org/2003/01/geo/wgs84_pos#lat'][0]['value']; + $long=$triples['http://www.w3.org/2003/01/geo/wgs84_pos#long'][0]['value']; } - - //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/>"; + else{ + $lat=""; + $long=""; } - //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']; @@ -110,15 +120,18 @@ 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']); + unset($triples['http://www.w3.org/2000/01/rdf-schema#comment']); + $content.='<br/><hr><h4>Remaining Triples</h4><br/>'; + // display the remaining properties as list which can be used for further navigation - $content .= '<br/><br/><br/>'.get_triple_table($triples); + $content .= get_triple_table($triples); //Restart the Session session_start(); //store article in session, to navigate between last 5 articles quickly - $contentArray=array('content' => $content,'subject' => $artTitle); + $contentArray=array('content' => $content,'subject' => $artTitle,'uri' => $uri); if (!isset($_SESSION['nextArticle'])){ $_SESSION['nextArticle']=0; $_SESSION['articles']=array(); @@ -146,8 +159,7 @@ } catch (Exception $e) { $content=$e->getMessage(); - $artTitle="No Result"; - //$objResponse->call('xajax_getsubjects',$subject); + $artTitle="Article not found"; } } else { @@ -161,7 +173,7 @@ if (isset($_SESSION['articles'])){ foreach ($_SESSION['articles'] as $key => $value) { - $lastArticles.="<a href=\"\" onclick=\"xajax_getarticle('',".$key.");return false;\">".$value['subject']."</a><br/>"; + $lastArticles.="<a href=\"\" onclick=\"get_article('label=&cache=".$key."');return false;\">".$value['subject']."</a><br/>"; } } @@ -176,7 +188,11 @@ print '$$'; print $interests[0]; print '$$'; - print $interests[1]; + print $interests[1]; + print '$$'; + print $lat; + print '$$'; + print $long; //$objResponse->call('xajax_learnConcept'); ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/ajax_search.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_search.php 2008-08-15 17:55:39 UTC (rev 1094) +++ trunk/src/dbpedia-navigator/ajax_search.php 2008-08-18 15:33:18 UTC (rev 1095) @@ -21,33 +21,41 @@ mysql_select_db("navigator_db"); $query="SELECT name, label, category FROM rank WHERE MATCH (label) AGAINST ('$label') ORDER BY number DESC LIMIT ".$number; $res=mysql_query($query); - $names=array(); - $labels=array(); - $classes=array(); - $tags=array(); - $catlabels=array(); - while ($result=mysql_fetch_array($res)){ - $labels[]=$result['label']; - $names[]=$result['name']; - if (!isset($result['category'])){ - $result['category']="NoCategory"; - $result2['label']="No Category"; + $bestsearches=""; + if (mysql_num_rows($res)>0){ + $names=array(); + $labels=array(); + $classes=array(); + $tags=array(); + $catlabels=array(); + while ($result=mysql_fetch_array($res)){ + $labels[]=$result['label']; + $names[]=$result['name']; + if (!isset($result['category'])){ + $result['category']="NoCategory"; + $result2['label']="No Category"; + } + else + { + $query="SELECT label FROM categories WHERE category='".$result['category']."' LIMIT 1"; + $res2=mysql_query($query); + $result2=mysql_fetch_array($res2); + } + $classes[]=$result['category']; + if (!isset($tags[$result['category']])) $tags[$result['category']]=1; + else $tags[$result['category']]++; + if (!isset($catlabels[$result['category']])) $catlabels[$result['category']]=$result2['label']; } - else - { - $query="SELECT label FROM categories WHERE category='".$result['category']."' LIMIT 1"; - $res2=mysql_query($query); - $result2=mysql_fetch_array($res2); - } - $classes[]=$result['category']; - if (!isset($tags[$result['category']])) $tags[$result['category']]=1; - else $tags[$result['category']]++; - if (!isset($catlabels[$result['category']])) $catlabels[$result['category']]=$result2['label']; + $content.=getTagCloud($tags,$catlabels); + $content.=getResultsTable($names,$labels,$classes,$number); + $bestsearches=getBestSearches($names,$labels); } - $content.=getTagCloud($tags,$catlabels); - $content.=getResultsTable($names,$labels,$classes,$number); + else + $content.="Your Search brought no results."; print $content; print '$$'; print "Searchresult for \"".$label."\""; + print '$$'; + print $bestsearches; ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/helper_functions.php =================================================================== --- trunk/src/dbpedia-navigator/helper_functions.php 2008-08-15 17:55:39 UTC (rev 1094) +++ trunk/src/dbpedia-navigator/helper_functions.php 2008-08-18 15:33:18 UTC (rev 1095) @@ -88,6 +88,25 @@ return $ret; } +function getBestSearches($names,$labels) +{ + $ret="<div id=\"best-results\">"; + for ($j=0;($j<10)&&$j<count($names);$j++) + { + $name=$names[$j]; + $label=$labels[$j]; + $ret.=' '.($j+1).'. <a href="" onclick="get_article(\'label='.$name.'&cache=-1\');return false;">'.$label.'</a><br/>'; + } + $ret.="</div>"; + return $ret; +} + +function getPrintableURL($url) +{ + $parts=explode('/',$url); + return $parts[0].'//'.$parts[2].'/w/index.php?title='.$parts[4].'&printable=yes'; +} + function setRunning($id,$running) { if(!is_dir("temp")) mkdir("temp"); @@ -106,7 +125,7 @@ $table .= '<tr style="background-color:#'.$backgroundcolor.';"><td><a href="'.$predicate.'">'.nicePredicate($predicate).'</a></td>'; $table .= '<td><ul>'; foreach($object as $element) { - if ($element['type']=="uri") $table .= '<li><a href="'.$element['value'].'">'.$element['value'].'</a></li>'; + if ($element['type']=="uri") $table .= '<li><a href="'.$element['value'].'" target="_blank">'.$element['value'].'</a></li>'; else $table .= '<li>'.$element['value'].'</li>'; } $table .= '</ul></td>'; @@ -146,9 +165,10 @@ } function formatClassArray($ar) { - $string = formatClass($ar[0]['value']); + if ($ar[0]['value']!="http://xmlns.com/foaf/0.1/Person") $string = formatClass($ar[0]['value']); for($i=1; $i<count($ar); $i++) { - $string .= ', ' . formatClass($ar[$i]['value']); + if ($ar[0]['value']!="http://xmlns.com/foaf/0.1/Person"||$i>1) $string .= ', ' . formatClass($ar[$i]['value']); + else $string .= formatClass($ar[$i]['value']); } return $string; } @@ -179,14 +199,15 @@ function show_Interests($sess) { + $ret=array(); + $ret[0]=""; + $ret[1]=""; if (isset($sess['positive'])) foreach($sess['positive'] as $name=>$lab){ - $ret[0]=$lab." <a href=\"\" onclick=\"toNegative('subject=".$name."&label=".$lab."');return false;\"><img src=\"".$_GET['path']."images/minus.jpg\" alt=\"Minus\"/></a> <a href=\"\" onclick=\"removePosInterest('subject=".$name."');return false;\"><img src=\"".$_GET['path']."images/remove.png\" alt=\"Delete\"/></a><br/>"; + $ret[0].=$lab." <a href=\"\" onclick=\"toNegative('subject=".$name."&label=".$lab."');return false;\"><img src=\"".$_GET['path']."images/minus.jpg\" alt=\"Minus\"/></a> <a href=\"\" onclick=\"removePosInterest('subject=".$name."');return false;\"><img src=\"".$_GET['path']."images/remove.png\" alt=\"Delete\"/></a><br/>"; } - else $ret[0]=""; if (isset($sess['negative'])) foreach($sess['negative'] as $name=>$lab){ - $ret[1]=$lab." <a href=\"\" onclick=\"toPositive('subject=".$name."&label=".$lab."');return false;\"><img src=\"".$_GET['path']."images/plus.jpg\" alt=\"Plus\"/></a> <a href=\"\" onclick=\"removeNegInterest('subject=".$name."');return false;\"><img src=\"".$_GET['path']."images/remove.png\" alt=\"Delete\"/></a><br/>"; + $ret[1].=$lab." <a href=\"\" onclick=\"toPositive('subject=".$name."&label=".$lab."');return false;\"><img src=\"".$_GET['path']."images/plus.jpg\" alt=\"Plus\"/></a> <a href=\"\" onclick=\"removeNegInterest('subject=".$name."');return false;\"><img src=\"".$_GET['path']."images/remove.png\" alt=\"Delete\"/></a><br/>"; } - else $ret[1]=""; return $ret; } Property changes on: trunk/src/dbpedia-navigator/images/dbpedia-favicon.ico ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/src/dbpedia-navigator/images/flickr.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-08-15 17:55:39 UTC (rev 1094) +++ trunk/src/dbpedia-navigator/index.php 2008-08-18 15:33:18 UTC (rev 1095) @@ -17,18 +17,18 @@ require_once('Settings.php'); $settings=new Settings(); -/* + //what happens onLoad -$onLoad="onLoad=\""; +$onLoad="onLoad=\"document.getElementById('label').focus();"; if (isset($_GET['resource'])){ - $onLoad.="xajax_getarticle('".$_GET['resource']."',-1);"; + $onLoad.="get_article('label=".$_GET['resource']."&cache=-1');"; unset($_GET['resource']); } else if (isset($_SESSION['currentArticle'])){ - $onLoad.="xajax_getarticle('',".$_SESSION['currentArticle'].");"; + $onLoad.="get_article('label=&cache=".$_SESSION['currentArticle']."');"; } $onLoad.="\""; -*/ + echo '<?xml version="1.0" encoding="UTF-8"?>'; ?> @@ -45,351 +45,31 @@ type="text/javascript"></script> <script src="<?php print $path;?>treemenu/dhtmlxcommon.js"></script> <script src="<?php print $path;?>treemenu/dhtmlxtree.js"></script> + <script src="<?php print $path;?>js/ajax.js"></script> <script type="text/javascript"> - function showdiv(id){ - document.getElementById(id).style.display='block'; - } - - function hidediv(id) { - document.getElementById(id).style.display='none'; - } - + function setRunning(running) + { + if (running) document.getElementById('Loading').style.display='inline'; + else document.getElementById('Loading').style.display='none'; + } + function loadGoogleMap(Lat,Lng,Label) { - 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'; + 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)); + map.addOverlay(marker); } } - - function search_it(param) - { - if (document.all){ - //IE - var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); - } - else{ - //Mozilla - var XhrObj = new XMLHttpRequest(); - } - - XhrObj.open("POST",'ajax_search.php'); - - XhrObj.onreadystatechange = function() - { - if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); - document.getElementById('articlecontent').innerHTML=response[0]; - document.getElementById('ArticleTitle').innerHTML=response[1]; - } - } - - XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); - XhrObj.send(param); - } - - function get_article(param) - { - if (document.all){ - //IE - var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); - } - else{ - //Mozilla - var XhrObj = new XMLHttpRequest(); - } - - XhrObj.open("POST",'ajax_get_article.php'); - - XhrObj.onreadystatechange = function() - { - if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); - document.getElementById('articlecontent').innerHTML=response[0]; - document.getElementById('ArticleTitle').innerHTML=response[1]; - document.getElementById('lastarticles').innerHTML=response[2]; - document.getElementById('Positives').innerHTML=response[3]; - document.getElementById('Negatives').innerHTML=response[4]; - } - } - - XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); - XhrObj.send(param); - } - - function show_results(class, number) - { - var links=document.getElementById('results').getElementsByTagName('p'); - var j=0; - for (var i=0;i<links.length;i++){ - if (links[i].getElementsByTagName('a')[0].className==class||class=='all'){ - if ((j+1)>number&&j<(number+25)) links[i].style.display='block'; - else links[i].style.display='none'; - j++; - } - else links[i].style.display='none'; - } - if (j<number){ - show_results(class,0); - return; - } - - var sitenumbers=document.getElementById('sitenumbers').getElementsByTagName('span'); - for (var i=0;i<sitenumbers.length;i++){ - if ((parseInt(sitenumbers[i].getElementsByTagName('a')[0].innerHTML)-1)*25==number) sitenumbers[i].getElementsByTagName('a')[0].style.textDecoration='none'; - else sitenumbers[i].getElementsByTagName('a')[0].style.textDecoration='underline'; - if ((parseInt(sitenumbers[i].getElementsByTagName('a')[0].innerHTML)-1)*25>=j) - sitenumbers[i].style.display='none'; - else - sitenumbers[i].style.display='inline'; - } - } - - function toPositive(param) - { - if (document.all){ - //IE - var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); - } - else{ - //Mozilla - var XhrObj = new XMLHttpRequest(); - } - - XhrObj.open("POST",'ajax_to_positive.php'); - - XhrObj.onreadystatechange = function() - { - if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); - document.getElementById('Positives').innerHTML=response[0]; - document.getElementById('Negatives').innerHTML=response[1]; - } - } - - XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); - XhrObj.send(param); - } - - function toNegative(param) - { - if (document.all){ - //IE - var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); - } - else{ - //Mozilla - var XhrObj = new XMLHttpRequest(); - } - - XhrObj.open("POST",'ajax_to_negative.php'); - - XhrObj.onreadystatechange = function() - { - if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); - document.getElementById('Positives').innerHTML=response[0]; - document.getElementById('Negatives').innerHTML=response[1]; - } - } - - XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); - XhrObj.send(param); - } - - function clearPositives() - { - if (document.all){ - //IE - var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); - } - else{ - //Mozilla - var XhrObj = new XMLHttpRequest(); - } - - XhrObj.open("POST",'ajax_clear_positives.php'); - - XhrObj.onreadystatechange = function() - { - if (XhrObj.readyState == 4 && XhrObj.status == 200){ - document.getElementById('Positives').innerHTML = XhrObj.responseText; - } - } - - XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); - XhrObj.send(); - } - - function clearNegatives() - { - if (document.all){ - //IE - var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); - } - else{ - //Mozilla - var XhrObj = new XMLHttpRequest(); - } - - XhrObj.open("POST",'ajax_clear_negatives.php'); - - XhrObj.onreadystatechange = function() - { - if (XhrObj.readyState == 4 && XhrObj.status == 200){ - document.getElementById('Negatives').innerHTML = XhrObj.responseText; - } - } - - XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); - XhrObj.send(); - } - - function removePosInterest(param) - { - if (document.all){ - //IE - var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); - } - else{ - //Mozilla - var XhrObj = new XMLHttpRequest(); - } - - XhrObj.open("POST",'ajax_remove_pos_interest.php'); - - XhrObj.onreadystatechange = function() - { - if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); - document.getElementById('Positives').innerHTML=response[0]; - document.getElementById('Negatives').innerHTML=response[1]; - } - } - - XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); - XhrObj.send(param); - } - - function removeNegInterest(param) - { - if (document.all){ - //IE - var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); - } - else{ - //Mozilla - var XhrObj = new XMLHttpRequest(); - } - - XhrObj.open("POST",'ajax_remove_neg_interest.php'); - - XhrObj.onreadystatechange = function() - { - if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); - document.getElementById('Positives').innerHTML=response[0]; - document.getElementById('Negatives').innerHTML=response[1]; - } - } - - XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); - XhrObj.send(param); - } - - function learnConcept() - { - if (document.all){ - //IE - var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); - } - else{ - //Mozilla - var XhrObj = new XMLHttpRequest(); - } - - XhrObj.open("POST",'ajax_learn_concepts.php'); - - XhrObj.onreadystatechange = function() - { - if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); - document.getElementById('conceptlink').innerHTML=response[0]; - document.getElementById('ConceptInformation').innerHTML=response[1]; - } - } - - XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); - XhrObj.send(); - } - - function stopServerCall() - { - if (document.all){ - //IE - var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); - } - else{ - //Mozilla - var XhrObj = new XMLHttpRequest(); - } - - XhrObj.open("POST",'ajax_stop_server_call.php'); - - XhrObj.onreadystatechange = function() - { - if (XhrObj.readyState == 4 && XhrObj.status == 200){ - } - } - - XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); - XhrObj.send(); - } - - function getSubjectsFromConcept(param) - { - if (document.all){ - //IE - var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); - } - else{ - //Mozilla - var XhrObj = new XMLHttpRequest(); - } - - XhrObj.open("POST",'ajax_get_subjects_from_concept.php'); - - XhrObj.onreadystatechange = function() - { - if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); - document.getElementById('articlecontent').innerHTML=response[0]; - document.getElementById('ArticleTitle').innerHTML=response[1]; - } - } - - XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); - XhrObj.send(param); - } </script> </head> - <body> + <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> +<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... <a href=""><img src="<?php print $path;?>images/remove.png" onclick="stopServerCall();return false;" /></a></span></td></tr></table></div> <div id="layer" style="display:none"> <div id="layerContent" style="display:none"></div> </div> @@ -398,26 +78,26 @@ <div id="leftSidebar"> <div class="box"> - <div class="boxtitle">Search DBpedia</div> + <div class="boxtitle" style="cursor:help;" title="Show an article or search for several articles in the DBpedia database.">Search DBpedia</div> <div class="boxcontent" id="search"> <!-- Search:<br/> --> - <form onSubmit="get_article('label='+document.getElementById('label').value+'&cache=-1');return false;"> - <input type="text" name="label" id="label" /><br/> - <input type="button" value="Article" class="button" onclick="get_article('label='+document.getElementById('label').value+'&cache=-1');return false;" /> <input type="button" value="Search" class="button" onclick="var list=tree.getAllChecked();search_it('label='+document.getElementById('label').value+'&list='+list+'&number=10');return false;" /> + <form onsubmit="get_article('label='+document.getElementById('label').value+'&cache=-1');return false;"> + <input type="text" name="label" id="label"/><br/> + <input type="button" value="Article" class="button" onclick="get_article('label='+document.getElementById('label').value+'&cache=-1');return false;" title="Search an article with that name."/> <input type="button" value="Search" class="button" onclick="var list=tree.getAllChecked();search_it('label='+document.getElementById('label').value+'&list='+list+'&number=10');return false;" title="Search a number of articles related to that name."/> <!-- <input type="button" value="Fulltext" class="button" onclick=""/> --> </form> </div> <!-- boxcontent --> </div> <!-- box --> <div class="box" id="SearchResultBox" style="display:none"> - <div class="boxtitle">Search Results</div> + <div class="boxtitle" style="cursor:help;" title="The best 10 Search Results are shown here.">Search Results</div> <div class="boxcontent"> <div id="searchcontent" style="display:block"></div> </div> <!-- boxcontent --> </div> <!-- box --> <div class="box" id="NavigationBox"> - <div class="boxtitle">Navigate</div> + <div class="boxtitle" style="cursor:help;" title="Navigate through the Class hierarchy and show instances of that class.">Navigate</div> <div class="boxcontent"> <div id="treeboxbox_tree" style="height:218px;overflow:auto;"> </div> @@ -430,8 +110,12 @@ tree.setOnClickHandler(doOnClick); function doOnClick(nodeId){ var myUrl = tree.getUserData(nodeId,"myurl"); - xajax_getSubjectsFromConcept(myUrl); + getSubjectsFromConcept('concept='+myUrl); } + function myErrorHandler(type, desc, erData){ + alert('An error occured while trying to navigate through Class Tree.\nPlease try again later.'); + } + dhtmlxError.catchError("ALL",myErrorHandler); tree.setXMLAutoLoading("processTreeMenu.php"); tree.loadXML("processTreeMenu.php?id=0"); </script> @@ -549,7 +233,7 @@ <div class="boxtitle">Detailed Concept Information</div> <div class="boxcontent" id="ConceptInformation"></div> </div> - + </body> </html> \ No newline at end of file Added: trunk/src/dbpedia-navigator/js/ajax.js =================================================================== --- trunk/src/dbpedia-navigator/js/ajax.js (rev 0) +++ trunk/src/dbpedia-navigator/js/ajax.js 2008-08-18 15:33:18 UTC (rev 1095) @@ -0,0 +1,322 @@ +function search_it(param) +{ + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_search.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + var response = XhrObj.responseText.split('$$'); + document.getElementById('articlecontent').innerHTML=response[0]; + document.getElementById('ArticleTitle').innerHTML=response[1]; + if (response[2].length>0){ + document.getElementById('searchcontent').innerHTML=response[2]; + document.getElementById('SearchResultBox').style.display='block'; + } + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(param); +} + +function get_article(param) +{ + setRunning(true); + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_get_article.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + var response = XhrObj.responseText.split('$$'); + document.getElementById('articlecontent').innerHTML=response[0]; + document.getElementById('ArticleTitle').innerHTML=response[1]; + document.getElementById('lastarticles').innerHTML=response[2]; + document.getElementById('Positives').innerHTML=response[3]; + document.getElementById('Negatives').innerHTML=response[4]; + setRunning(false); + if (response[1]=='Article not found'){ + setTimeout("var list=tree.getAllChecked();search_it('label='+document.getElementById('label').value+'&list='+list+'&number=10')",2000); + } + else + document.getElementById('LastArticlesBox').style.display='block'; + } + if (response[5].length>0&&response[6].length>0) + loadGoogleMap(response[5],response[6],''+response[1]); + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(param); +} + +function show_results(class, number) +{ + var links=document.getElementById('results').getElementsByTagName('p'); + var j=0; + for (var i=0;i<links.length;i++){ + if (links[i].getElementsByTagName('a')[0].className==class||class=='all'){ + if ((j+1)>number&&j<(number+25)) links[i].style.display='block'; + else links[i].style.display='none'; + j++; + } + else links[i].style.display='none'; + } + if (j<number){ + show_results(class,0); + return; + } + + var sitenumbers=document.getElementById('sitenumbers').getElementsByTagName('span'); + for (var i=0;i<sitenumbers.length;i++){ + if ((parseInt(sitenumbers[i].getElementsByTagName('a')[0].innerHTML)-1)*25==number) sitenumbers[i].getElementsByTagName('a')[0].style.textDecoration='none'; + else sitenumbers[i].getElementsByTagName('a')[0].style.textDecoration='underline'; + if ((parseInt(sitenumbers[i].getElementsByTagName('a')[0].innerHTML)-1)*25>=j) + sitenumbers[i].style.display='none'; + else + sitenumbers[i].style.display='inline'; + } +} + +function toPositive(param) +{ + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_to_positive.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + var response = XhrObj.responseText.split('$$'); + document.getElementById('Positives').innerHTML=response[0]; + document.getElementById('Negatives').innerHTML=response[1]; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(param); +} + +function toNegative(param) +{ + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_to_negative.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + var response = XhrObj.responseText.split('$$'); + document.getElementById('Positives').innerHTML=response[0]; + document.getElementById('Negatives').innerHTML=response[1]; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(param); +} + + function clearPositives() + { + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_clear_positives.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + document.getElementById('Positives').innerHTML = XhrObj.responseText; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(); + } + + function clearNegatives() + { + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_clear_negatives.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + document.getElementById('Negatives').innerHTML = XhrObj.responseText; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(); + } + + function removePosInterest(param) + { + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_remove_pos_interest.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + var response = XhrObj.responseText.split('$$'); + document.getElementById('Positives').innerHTML=response[0]; + document.getElementById('Negatives').innerHTML=response[1]; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(param); + } + + function removeNegInterest(param) + { + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_remove_neg_interest.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + var response = XhrObj.responseText.split('$$'); + document.getElementById('Positives').innerHTML=response[0]; + document.getElementById('Negatives').innerHTML=response[1]; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(param); + } + + function learnConcept() + { + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_learn_concepts.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + var response = XhrObj.responseText.split('$$'); + document.getElementById('conceptlink').innerHTML=response[0]; + document.getElementById('ConceptInformation').innerHTML=response[1]; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(); + } + + function stopServerCall() + { + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_stop_server_call.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(); + } + + function getSubjectsFromConcept(param) + { + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_get_subjects_from_concept.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + var response = XhrObj.responseText.split('$$'); + document.getElementById('articlecontent').innerHTML=response[0]; + document.getElementById('ArticleTitle').innerHTML=response[1]; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(param); + } \ 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-08-19 14:28:32
|
Revision: 1100 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1100&view=rev Author: sknappe Date: 2008-08-19 14:28:27 +0000 (Tue, 19 Aug 2008) Log Message: ----------- category search is now working (you can search instances of a yago class from the navigate tree or from the classes that are displayed in an articel) using the database (its fast), fixed some minor things (unicode decoding, etc.) Modified Paths: -------------- trunk/src/dbpedia-navigator/ajax_get_article.php trunk/src/dbpedia-navigator/ajax_search.php trunk/src/dbpedia-navigator/helper_functions.php trunk/src/dbpedia-navigator/index.php trunk/src/dbpedia-navigator/js/ajax.js trunk/src/dbpedia-navigator/processTreeMenu.php Added Paths: ----------- trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php Removed Paths: ------------- trunk/src/dbpedia-navigator/CalculatePageRank.java Deleted: trunk/src/dbpedia-navigator/CalculatePageRank.java =================================================================== --- trunk/src/dbpedia-navigator/CalculatePageRank.java 2008-08-19 14:20:39 UTC (rev 1099) +++ trunk/src/dbpedia-navigator/CalculatePageRank.java 2008-08-19 14:28:27 UTC (rev 1100) @@ -1,185 +0,0 @@ -import java.io.BufferedReader; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.IOException; -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.Statement; - -public class CalculatePageRank { - - private final String wikilinks="../pagelinks_en.nt"; - private final String labels="../articles_label_en.nt"; - private final String categories="../yago_en.nt"; - - private void calculateLinks() - { - try{ - Statement stmt; - ResultSet rs; - int number; - - Class.forName("com.mysql.jdbc.Driver"); - - String url = - "jdbc:mysql://localhost:3306/navigator_db"; - - Connection con = DriverManager.getConnection( - url,"navigator", "dbpedia"); - - stmt = con.createStatement(); - BufferedReader in = new BufferedReader(new FileReader(wikilinks)); - - String line; - String[] split; - String name; - int i=0; - while ((line=in.readLine())!=null) - { - split=line.split(" "); - name=split[2].substring(1, split[2].length()-1); - rs=stmt.executeQuery("SELECT number FROM rank WHERE name='"+name+"'"); - if (rs.next()){ - number=rs.getInt(1); - number++; - stmt.executeUpdate("UPDATE rank SET number="+number+" WHERE name='"+name+"'"); - } - else{ - stmt.executeUpdate("INSERT INTO rank (name,number) VALUES ('"+name+"',1)"); - } - if (i%100000==0) System.out.println(i); - i++; - } - - in.close(); - con.close(); - } catch (FileNotFoundException e) - { - System.out.println("File not found"); - } catch (IOException e) - { - System.out.println("IOException"); - } catch (Exception e) - { - e.printStackTrace(); - } - } - - private void addLabels() - { - try{ - Statement stmt; - ResultSet rs; - - Class.forName("com.mysql.jdbc.Driver"); - - String url = - "jdbc:mysql://localhost:3306/navigator_db"; - - Connection con = DriverManager.getConnection( - url,"navigator", "dbpedia"); - - stmt = con.createStatement(); - BufferedReader in = new BufferedReader(new FileReader(labels)); - - String line; - String[] split; - String name; - String label; - int i=0; - while ((line=in.readLine())!=null) - { - split=line.split(">"); - name=split[0].substring(1); - label=split[2].substring(split[2].indexOf("\"")+1, split[2].lastIndexOf("\"")); - rs=stmt.executeQuery("SELECT number FROM rank WHERE name='"+name+"'"); - if (rs.next()){ - stmt.executeUpdate("UPDATE rank SET label=\""+label+"\" WHERE name='"+name+"'"); - } - else{ - stmt.executeUpdate("INSERT INTO rank (name,label) VALUES ('"+name+"',\""+label+"\")"); - } - if (i%100000==0) System.out.println(i); - i++; - } - - in.close(); - con.close(); - } catch (FileNotFoundException e) - { - System.out.println("File not found"); - } catch (IOException e) - { - System.out.println("IOException"); - } catch (Exception e) - { - e.printStackTrace(); - } - } - - private void calculateCategories() - { - try{ - Statement stmt; - - Class.forName("com.mysql.jdbc.Driver"); - - String url = - "jdbc:mysql://localhost:3306/navigator_db"; - - Connection con = DriverManager.getConnection( - url,"navigator", "dbpedia"); - - stmt = con.createStatement(); - BufferedReader in = new BufferedReader(new FileReader(categories)); - - String line; - String[] split; - String name; - String label; - String pred; - int i=0; - while ((line=in.readLine())!=null) - { - split=line.split(">"); - name=split[0].substring(1); - pred=split[1].substring(2); - if (pred.equals("http://www.w3.org/2000/01/rdf-schema#label")) - label=split[2].substring(split[2].indexOf("\"")+1, split[2].lastIndexOf("\"")); - else - label=split[2].substring(2); - if (pred.equals("http://www.w3.org/2000/01/rdf-schema#label")){ - try{ - stmt.executeUpdate("INSERT INTO categories (category,label) VALUES (\""+name+"\",\""+label+"\")"); - }catch(Exception e) - {} - } - else{ - stmt.executeUpdate("UPDATE rank SET category=\""+label+"\" WHERE name=\""+name+"\""); - } - if (i%100000==0) System.out.println(i); - i++; - } - - in.close(); - con.close(); - } catch (FileNotFoundException e) - { - System.out.println("File not found"); - } catch (IOException e) - { - System.out.println("IOException"); - } catch (Exception e) - { - e.printStackTrace(); - } - } - - public static void main(String[] args){ - CalculatePageRank cal=new CalculatePageRank(); - //cal.calculateLinks(); - //cal.addLabels(); - cal.calculateCategories(); - } -} \ No newline at end of file Modified: trunk/src/dbpedia-navigator/ajax_get_article.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_article.php 2008-08-19 14:20:39 UTC (rev 1099) +++ trunk/src/dbpedia-navigator/ajax_get_article.php 2008-08-19 14:28:27 UTC (rev 1100) @@ -47,9 +47,15 @@ // goal: display the data in a nice (DBpedia specific way), maybe similar to // dbpedia.org/search + //BUILD ARTICLE TITLE + if (strlen($triples['http://www.w3.org/2000/01/rdf-schema#label'][0]['value'])>0) + $artTitle=$triples['http://www.w3.org/2000/01/rdf-schema#label'][0]['value']; + else + $artTitle=urldecode(str_replace("_"," ",substr (strrchr ($url, "/"), 1))); + // display a picture if there is one if(isset($triples['http://xmlns.com/foaf/0.1/depiction'])) - $content.='<img src="'.$triples['http://xmlns.com/foaf/0.1/depiction'][0]['value'].'" alt="Picture of '.$triples['http://www.w3.org/2000/01/rdf-schema#label'][0]['value'].'" style="float:right; max-width:200px;" \>'; + $content.='<img src="'.$triples['http://xmlns.com/foaf/0.1/depiction'][0]['value'].'" alt="Picture of '.$artTitle.'" style="float:right; max-width:200px;" \>'; //display where it was redirected from, if it was redirected $redirect=""; @@ -104,9 +110,38 @@ $long=""; } - //BUILD ARTICLE TITLE - $artTitle=$triples['http://www.w3.org/2000/01/rdf-schema#label'][0]['value']; + //display only one birthdate + $birthdates=array("http://dbpedia.org/property/dateOfBirth","http://dbpedia.org/property/birth"); + $date=false; + foreach ($birthdates as $dates){ + if ($date) unset($triples[$dates]); + if (isset($triples[$dates])&&!$date) $date=true; + } + //display foreign wiki pages + $languages=array('Deutsch'=>'http://dbpedia.org/property/wikipage-de' + ,'Espa%C3%B1ol'=>'http://dbpedia.org/property/wikipage-es' + ,'suomi'=>'http://dbpedia.org/property/wikipage-fi' + ,'Fran%C3%A7ais'=>'http://dbpedia.org/property/wikipage-fr' + ,'Italiano'=>'http://dbpedia.org/property/wikipage-it' + ,'%E6%97%A5%E6%9C%AC%E8%AA%9E'=>'http://dbpedia.org/property/wikipage-ja' + ,'Nederlands'=>'http://dbpedia.org/property/wikipage-nl' + ,'%E2%80%AANorsk (bokm%C3%A5l)'=>'http://dbpedia.org/property/wikipage-no' + ,'Polski'=>'http://dbpedia.org/property/wikipage-pl' + ,'Portugu%C3%AAs'=>'http://dbpedia.org/property/wikipage-pt' + ,'%D0%A0%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B9'=>'http://dbpedia.org/property/wikipage-ru' + ,'Svenska'=>'http://dbpedia.org/property/wikipage-sv' + ,'%E4%B8%AD%E6%96%87'=>'http://dbpedia.org/property/wikipage-zh'); + + $pages=""; + foreach ($languages as $key=>$value){ + if (isset($triples[$value])){ + $pages.='<tr><td>'.urldecode($key).': </td><td><a href="'.$triples[$value][0]['value'].'" target="_blank">'.urldecode($triples[$value][0]['value']).'</a></td></tr>'; + unset($triples[$value]); + } + } + if (strlen($pages)>0) $content.='<br/><hr><h4>Wikipedia articles in different languages</h4><br/><table border="0">'.$pages.'</table>'; + // filter out uninteresting properties and properties which // have already been displayed unset($triples['http://xmlns.com/foaf/0.1/page']); @@ -121,11 +156,21 @@ unset($triples['http://www.w3.org/2004/02/skos/core#subject']); unset($triples['http://www.w3.org/2000/01/rdf-schema#label']); unset($triples['http://www.w3.org/2000/01/rdf-schema#comment']); + unset($triples['http://dbpedia.org/property/latSec']); + unset($triples['http://dbpedia.org/property/lonSec']); + unset($triples['http://dbpedia.org/property/lonDeg']); + unset($triples['http://dbpedia.org/property/latMin']); + unset($triples['http://dbpedia.org/property/lonMin']); + unset($triples['http://dbpedia.org/property/latDeg']); + unset($triples['http://dbpedia.org/property/lonMin']); - $content.='<br/><hr><h4>Remaining Triples</h4><br/>'; - // display the remaining properties as list which can be used for further navigation - $content .= get_triple_table($triples); + if (count($triples)>0){ + $content.='<br/><hr><h4>Remaining Triples</h4><br/>'; + + // display the remaining properties as list which can be used for further navigation + $content .= get_triple_table($triples); + } //Restart the Session session_start(); Added: trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php (rev 0) +++ trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php 2008-08-19 14:28:27 UTC (rev 1100) @@ -0,0 +1,35 @@ +<?php + include('helper_functions.php'); + + $category=$_POST['category']; + $label=$_POST['label']; + $number=$_POST['number']; + + //initialise content + $content=""; + $bestsearches=""; + + mysql_connect('localhost','navigator','dbpedia'); + mysql_select_db("navigator_db"); + $query="SELECT name, label FROM rank WHERE category='$category' ORDER BY number DESC LIMIT ".$number; + $res=mysql_query($query); + $bestsearches=""; + if (mysql_num_rows($res)>0){ + $names=array(); + $labels=array(); + while ($result=mysql_fetch_array($res)){ + $labels[]=$result['label']; + $names[]=$result['name']; + } + $content.=getCategoryResultsTable($names,$labels,$category,$label,$number); + $bestsearches=getBestSearches($names,$labels); + } + else + $content.="Your Search brought no results."; + + print $content; + print '$$'; + print "Searchresult for Category \"".$label."\""; + print '$$'; + print $bestsearches; +?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/ajax_search.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_search.php 2008-08-19 14:20:39 UTC (rev 1099) +++ trunk/src/dbpedia-navigator/ajax_search.php 2008-08-19 14:28:27 UTC (rev 1100) @@ -4,13 +4,7 @@ $label=$_POST['label']; $list=$_POST['list']; $number=$_POST['number']; - session_start(); - $id=$_SESSION['id']; - $ksID=$_SESSION['ksID']; - session_write_close(); - - setRunning($id,"true"); - + //get parts of the list $checkedInstances=preg_split("[,]",$list,-1,PREG_SPLIT_NO_EMPTY); Modified: trunk/src/dbpedia-navigator/helper_functions.php =================================================================== --- trunk/src/dbpedia-navigator/helper_functions.php 2008-08-19 14:20:39 UTC (rev 1099) +++ trunk/src/dbpedia-navigator/helper_functions.php 2008-08-19 14:28:27 UTC (rev 1100) @@ -68,8 +68,9 @@ { $name=$names[$i*25+$j]; $label=$labels[$i*25+$j]; + if (strlen($label)==0) $label=urldecode(str_replace("_"," ",substr (strrchr ($name, "/"), 1))); $class=$classes[$i*25+$j]; - $ret.='<p style="display:'.$display.'"> '.($i*25+$j+1).'. <a href="" class="'.$class.'" onclick="get_article(\'label='.$name.'&cache=-1\');return false;">'.$label.'</a></p>'; + $ret.='<p style="display:'.$display.'"> '.($i*25+$j+1).'. <a href="" class="'.$class.'" onclick="get_article(\'label='.$name.'&cache=-1\');return false;">'.utf8_to_html($label).'</a></p>'; } $i++; $display="none"; @@ -88,6 +89,61 @@ return $ret; } +function utf8_to_html($string) +{ + $string=str_replace("u00C4","Ä",$string); + $string=str_replace("u00D6","Ö",$string); + $string=str_replace("u00DC","Ü",$string); + $string=str_replace("u00E4","ä",$string); + $string=str_replace("u00F6","ö",$string); + $string=str_replace("u00FC","ü",$string); + $string=str_replace("u0161","š",$string); + + return $string; +} + +function getCategoryResultsTable($names,$labels,$category,$catlabel,$number) +{ + $ret="<p>These are your Searchresults. Show best "; + for ($k=10;$k<125;){ + $ret.="<a href=\"#\" onclick=\"getSubjectsFromCategory('category=".$category."&label=".$catlabel."&number=".$k."');return false;\""; + if ($k==$number) $ret.=" style=\"text-decoration:none;\""; + else $ret.=" style=\"text-decoration:underline;\""; + $ret.=">".($k)."</a>"; + if ($k!=100) $ret.=" | "; + if($k==10) $k=25; + else $k=$k+25; + } + $ret.="</p><br/>"; + $i=0; + $display="block"; + $ret.="<div id=\"results\">"; + while($i*25<count($names)) + { + for ($j=0;($j<25)&&(($i*25+$j)<count($names));$j++) + { + $name=$names[$i*25+$j]; + $label=$labels[$i*25+$j]; + if (strlen($label)==0) $label=urldecode(str_replace("_"," ",substr (strrchr ($name, "/"), 1))); + $ret.='<p style="display:'.$display.'"> '.($i*25+$j+1).'. <a class="all" href="" onclick="get_article(\'label='.$name.'&cache=-1\');return false;">'.utf8_to_html($label).'</a></p>'; + } + $i++; + $display="none"; + } + $ret.='<input type="hidden" id="hidden_class" value="all"/><input type="hidden" id="hidden_number" value="0"/></div><br/><p style="width:100%;text-align:center;" id="sitenumbers">'; + for ($k=0;$k<$i;$k++){ + $ret.="<span>"; + if ($k!=0) $ret.=" | "; + $ret.="<a href=\"#\" onclick=\"document.getElementById('hidden_number').value='".(25*$k)."';show_results(document.getElementById('hidden_class').value,".(25*$k).");\""; + if ($k==0) $ret.=" style=\"text-decoration:none;\""; + else $ret.=" style=\"text-decoration:underline;\""; + $ret.=">".($k+1)."</a>"; + $ret.="</span>"; + } + $ret.="</p>"; + return $ret; +} + function getBestSearches($names,$labels) { $ret="<div id=\"best-results\">"; @@ -95,7 +151,8 @@ { $name=$names[$j]; $label=$labels[$j]; - $ret.=' '.($j+1).'. <a href="" onclick="get_article(\'label='.$name.'&cache=-1\');return false;">'.$label.'</a><br/>'; + if (strlen($label)==0) $label=urldecode(str_replace("_"," ",substr (strrchr ($name, "/"), 1))); + $ret.=' '.($j+1).'. <a href="" onclick="get_article(\'label='.$name.'&cache=-1\');return false;">'.utf8_to_html($label).'</a><br/>'; } $ret.="</div>"; return $ret; @@ -117,17 +174,17 @@ function get_triple_table($triples) { - $table = '<table border="0"><tr><td>predicate</td><td>object</td></tr>'; + $table = '<table border="0"><tr><td><b>Predicate</b></td><td><b>Object</b></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 .= '<tr style="background-color:#'.$backgroundcolor.';"><td><a href="'.$predicate.'" target="_blank">'.nicePredicate($predicate).'</a></td>'; $table .= '<td><ul>'; foreach($object as $element) { if ($element['type']=="uri"){ - if (strpos($element['value'],"http://dbpedia.org/resource/")===0&&substr_count($element['value'],"/")==4) $table .= '<li><a href="#" onclick="get_article(\'label='.$element['value'].'&cache=-1\');return false;">'.$element['value'].'</a></li>'; - else $table .= '<li><a href="'.$element['value'].'" target="_blank">'.$element['value'].'</a></li>'; + if (strpos($element['value'],"http://dbpedia.org/resource/")===0&&substr_count($element['value'],"/")==4) $table .= '<li><a href="#" onclick="get_article(\'label='.$element['value'].'&cache=-1\');return false;">'.urldecode($element['value']).'</a></li>'; + else $table .= '<li><a href="'.$element['value'].'" target="_blank">'.urldecode($element['value']).'</a></li>'; } else $table .= '<li>'.$element['value'].'</li>'; } @@ -161,32 +218,41 @@ 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; + case "http://www.georss.org/georss/point": $namespace="georss"; break; } - return $namespace.':'.$name; + //fl\xE4che has strange url + $name=str_replace('fl_percent_C3_percent_A4che','fl%C3%A4che',$name); + return $namespace.':'.urldecode($name); } function formatClassArray($ar) { - if ($ar[0]['value']!="http://xmlns.com/foaf/0.1/Person") $string = formatClass($ar[0]['value']); - for($i=1; $i<count($ar); $i++) { - if ($ar[0]['value']!="http://xmlns.com/foaf/0.1/Person"||$i>1) $string .= ', ' . formatClass($ar[$i]['value']); - else $string .= formatClass($ar[$i]['value']); + mysql_connect('localhost','navigator','dbpedia'); + mysql_select_db("navigator_db"); + $string=""; + for($i=0; $i<count($ar); $i++) { + $query="SELECT label FROM categories WHERE category='".$ar[$i]['value']."' LIMIT 1"; + $res=mysql_query($query); + $result=mysql_fetch_array($res); + if ($ar[$i]['value']!="http://xmlns.com/foaf/0.1/Person"&&strlen($string)>0) $string .= ', ' . formatClass($ar[$i]['value'],$result['label']); + else if ($ar[$i]['value']!="http://xmlns.com/foaf/0.1/Person"&&strlen($string)==0) $string .= formatClass($ar[$i]['value'],$result['label']); } return $string; } // format a class nicely, i.e. link to it and possibly display // it in a better way -function formatClass($className) { +function formatClass($className,$label) { $yagoPrefix = 'http://dbpedia.org/class/yago/'; if(substr($className,0,30)==$yagoPrefix) { - return '<a href="'.$className.'">'.substr($className,30).'</a>'; + return '<a href="#" onclick="getSubjectsFromCategory(\'category='.$className.'&label='.$label.'&number=10\');">'.$label.'</a>'; // DBpedia is Linked Data, so it makes always sense to link it // ToDo: instead of linking to other pages, the resource should better // be openened within DBpedia Navigator } else if(substr($className,0,14)=='http://dbpedia') { - return '<a href="'.$className.'">'.$className.'</a>'; + return '<a href="'.$className.'" target="_blank">'.$className.'</a>'; } else { return $className; } Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-08-19 14:20:39 UTC (rev 1099) +++ trunk/src/dbpedia-navigator/index.php 2008-08-19 14:28:27 UTC (rev 1100) @@ -110,7 +110,8 @@ tree.setOnClickHandler(doOnClick); function doOnClick(nodeId){ var myUrl = tree.getUserData(nodeId,"myurl"); - getSubjectsFromConcept('concept='+myUrl); + var myLabel = tree.getUserData(nodeId,"mylabel"); + getSubjectsFromCategory('category='+myUrl+'&label='+myLabel+'&number=10'); } function myErrorHandler(type, desc, erData){ alert('An error occured while trying to navigate through Class Tree.\nPlease try again later.'); @@ -152,19 +153,19 @@ <div id="rightSidebar"> <div class="box"> - <div class="boxtitlewithbutton" id="positivesboxtitle">search relevant <a href="#"><img src="<?php print $path;?>images/remove.png" onclick="clearPositives()" /></a> </div> + <div class="boxtitlewithbutton" id="positivesboxtitle" style="cursor:help;" title="The shown articles are considered when generating navigation tips.">search relevant <a href="#"><img src="<?php print $path;?>images/remove.png" onclick="clearPositives()" title="Delete all articles of interest."/></a> </div> <div class="boxcontent" id="Positives"> </div> <!-- boxcontent --> </div> <!-- box --> <div class="box"> - <div class="boxtitlewithbutton" id="negativesboxtitle">not relevant <a href="#"><img src="<?php print $path;?>images/remove.png" onclick="clearNegatives()" /></a> </div> + <div class="boxtitlewithbutton" id="negativesboxtitle" style="cursor:help;" title="The shown articles are avoided when generating navigation tips.">not relevant <a href="#"><img src="<?php print $path;?>images/remove.png" onclick="clearNegatives()" title="Delete all avoided articles."/></a> </div> <div class="boxcontent" id="Negatives"> </div> <!-- boxcontent --> </div> <!-- box --> <div class="box" id="LastArticlesBox" style="display:none"> - <div class="boxtitle">Articles Last Viewed</div> + <div class="boxtitle" style="cursor:help;" title="Up to 5 articles, that were last displayed, are shown here.">Articles Last Viewed</div> <div class="boxcontent" id="lastarticles"> </div> <!-- boxcontent --> </div> <!-- box --> Modified: trunk/src/dbpedia-navigator/js/ajax.js =================================================================== --- trunk/src/dbpedia-navigator/js/ajax.js 2008-08-19 14:20:39 UTC (rev 1099) +++ trunk/src/dbpedia-navigator/js/ajax.js 2008-08-19 14:28:27 UTC (rev 1100) @@ -295,28 +295,58 @@ XhrObj.send(); } - function getSubjectsFromConcept(param) - { - if (document.all){ - //IE - var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); - } - else{ - //Mozilla - var XhrObj = new XMLHttpRequest(); - } +function getSubjectsFromConcept(param) +{ + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } - XhrObj.open("POST",'ajax_get_subjects_from_concept.php'); + XhrObj.open("POST",'ajax_get_subjects_from_concept.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + var response = XhrObj.responseText.split('$$'); + document.getElementById('articlecontent').innerHTML=response[0]; + document.getElementById('ArticleTitle').innerHTML=response[1]; + } + } - XhrObj.onreadystatechange = function() - { - if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); - document.getElementById('articlecontent').innerHTML=response[0]; - document.getElementById('ArticleTitle').innerHTML=response[1]; - } + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(param); +} + +function getSubjectsFromCategory(param) +{ + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_get_subjects_from_category.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + var response = XhrObj.responseText.split('$$'); + document.getElementById('articlecontent').innerHTML=response[0]; + document.getElementById('ArticleTitle').innerHTML=response[1]; + if (response[2].length>0){ + document.getElementById('searchcontent').innerHTML=response[2]; + document.getElementById('SearchResultBox').style.display='block'; } + } + } - XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); - XhrObj.send(param); - } \ No newline at end of file + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(param); +} \ No newline at end of file Modified: trunk/src/dbpedia-navigator/processTreeMenu.php =================================================================== --- trunk/src/dbpedia-navigator/processTreeMenu.php 2008-08-19 14:20:39 UTC (rev 1099) +++ trunk/src/dbpedia-navigator/processTreeMenu.php 2008-08-19 14:28:27 UTC (rev 1100) @@ -17,7 +17,7 @@ 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['value']."</userdata></item>"); + print("<item child=\"".$child."\" id=\"".$category['value']."\" text=\"".$category['label']."\"><userdata name=\"myurl\">".$category['value']."</userdata><userdata name=\"mylabel\">".$category['label']."</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-08-20 13:12:59
|
Revision: 1107 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1107&view=rev Author: sknappe Date: 2008-08-20 13:12:53 +0000 (Wed, 20 Aug 2008) Log Message: ----------- corrected mistake with classes (one article can have several classes, had only one class for each article) changed database accordingly(changed database schema and also the Pagerankcalculation) the search now works correct with correct tag cloud, you can search for articles, in articles you can search for instances of the same class like the article or you can show a class view of one of the classes, the article has as type in the class view you can see the class you selected, all father classes and all child classes in select boxes, you can show the class view of these father or child classes or you can show instances of father, child or current class added box last classes, is the same as last articles for classes deleted the navigate box, because I now use the class view, the tree I showed in navigate box couldn't handel 11k classes in one level (Entity has ca. 11k subclasses) and it was too small to work properly with, new class view should be better minor bugfixing Modified Paths: -------------- trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php trunk/src/dbpedia-navigator/ajax_search.php trunk/src/dbpedia-navigator/helper_functions.php trunk/src/dbpedia-navigator/index.php trunk/src/dbpedia-navigator/js/ajax.js trunk/src/dbpedia-navigator/localhost.sql trunk/src/dbpedia-navigator/processTreeMenu.php Added Paths: ----------- trunk/src/dbpedia-navigator/ajax_get_class.php Added: trunk/src/dbpedia-navigator/ajax_get_class.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_class.php (rev 0) +++ trunk/src/dbpedia-navigator/ajax_get_class.php 2008-08-20 13:12:53 UTC (rev 1107) @@ -0,0 +1,117 @@ +<?php + include('helper_functions.php'); + + $class=$_POST['class']; + $fromCache=$_POST['cache']; + if (isset($_POST['path'])) $path=$_POST['path']; + else $path=""; + + session_start(); + if (isset($_SESSION['classes'])) $classes=$_SESSION['classes']; + session_write_close(); + + + //if article is in session, get it out of the session + if (isset($classes)){ + foreach ($classes as $key => $value) + { + if ($value['uri']==$uri){ + $fromCache=$key; + break; + } + } + } + + //initialize the content variables + $content=""; + $lastClasses=""; + $title=""; + + //get the article + //if $fromCache is -1, everything is normal + //if $fromCache is >=0, the article is taken out of the cache + if ($fromCache<0) { + //if there are errors see catch block + try{ + mysql_connect('localhost','navigator','dbpedia'); + mysql_select_db("navigator_db"); + + //build Select box with Child Classes + $query="SELECT child FROM classhierarchy WHERE father='$class'"; + $res=mysql_query($query); + $childClasses=''; + while ($result=mysql_fetch_array($res)){ + $query="SELECT label FROM categories WHERE category='".$result['child']."' LIMIT 1"; + $res2=mysql_query($query); + $result2=mysql_fetch_array($res2); + $identify=urldecode(str_replace("_"," ",substr (strrchr ($result['child'], "/"), 1))); + if ((strlen($identify)+strlen($result2['label']))>100) $identify=substr($identify,0,100-strlen($result2['label'])); + $childClasses.='<option value="'.$result['child'].'">'.utf8_to_html($result2['label']).' ('.$identify.')</option>'; + } + if (strlen($childClasses)>0) + $childClasses='<select size="1" style="width:500px" id="childSelect">'.$childClasses.'</select>'; + + + //build Select box with Father Classes + $query="SELECT father FROM classhierarchy WHERE child='$class'"; + $res=mysql_query($query); + $fatherClasses=''; + while ($result=mysql_fetch_array($res)){ + $query="SELECT label FROM categories WHERE category='".$result['father']."' LIMIT 1"; + $res2=mysql_query($query); + $result2=mysql_fetch_array($res2); + $identify=urldecode(str_replace("_"," ",substr (strrchr ($result['father'], "/"), 1))); + if ((strlen($identify)+strlen($result2['label']))>100) $identify=substr($identify,0,100-strlen($result2['label'])); + $fatherClasses.='<option value="'.$result['father'].'">'.utf8_to_html($result2['label']).' ('.$identify.')</option>'; + } + if (strlen($fatherClasses)>0) + $fatherClasses='<select size="1" style="width:500px" id="fatherSelect">'.$fatherClasses.'</select>'; + + //build Title + $query="SELECT label FROM categories WHERE category='$class' LIMIT 1"; + $res=mysql_query($query); + $result=mysql_fetch_array($res); + $title=$result['label']; + + $content.=getClassView($fatherClasses,$childClasses,$title,$class); + + //Restart the Session + session_start(); + + //store class in session, to navigate between last 5 classes quickly + $contentArray=array('content' => $content,'title' => $title,'uri' => $class); + if (!isset($_SESSION['nextClass'])){ + $_SESSION['nextClass']=0; + $_SESSION['classes']=array(); + } + if ($_SESSION['nextClass']==5) $_SESSION['nextClass']=0; + $_SESSION['classes'][$_SESSION['nextClass']]=$contentArray; + $_SESSION['currentClass']=$_SESSION['nextClass']; + $_SESSION['nextClass']++; + } catch (Exception $e) + { + $content="An error occured while trying to get Class information. Please try again later."; + $title="Class not found"; + } + } + else { + session_start(); + //Article is in session + $content=$_SESSION['classes'][$fromCache]['content']; + $title=$_SESSION['classes'][$fromCache]['title']; + } + + //Build lastClasses + if (isset($_SESSION['classes'])){ + foreach ($_SESSION['classes'] as $key => $value) + { + $lastClasses.="<a href=\"\" onclick=\"get_class('class=&cache=".$key."');return false;\">".$value['title']."</a><br/>"; + } + } + + print $content; + print '$$'; + print "Class: ".$title; + print '$$'; + print $lastClasses; +?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php 2008-08-20 12:13:48 UTC (rev 1106) +++ trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php 2008-08-20 13:12:53 UTC (rev 1107) @@ -11,15 +11,18 @@ mysql_connect('localhost','navigator','dbpedia'); mysql_select_db("navigator_db"); - $query="SELECT name, label FROM rank WHERE category='$category' ORDER BY number DESC LIMIT ".$number; + $query="SELECT name FROM articlecategories WHERE category='$category' ORDER BY number DESC LIMIT ".$number; $res=mysql_query($query); $bestsearches=""; if (mysql_num_rows($res)>0){ $names=array(); $labels=array(); while ($result=mysql_fetch_array($res)){ - $labels[]=$result['label']; - $names[]=$result['name']; + $names[]=$result['name']; + $query="SELECT label FROM rank WHERE name='".$result['name']."' LIMIT 1"; + $res2=mysql_query($query); + $result2=mysql_fetch_array($res2); + $labels[]=$result2['label']; } $content.=getCategoryResultsTable($names,$labels,$category,$label,$number); $bestsearches=getBestSearches($names,$labels); Modified: trunk/src/dbpedia-navigator/ajax_search.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_search.php 2008-08-20 12:13:48 UTC (rev 1106) +++ trunk/src/dbpedia-navigator/ajax_search.php 2008-08-20 13:12:53 UTC (rev 1107) @@ -2,18 +2,14 @@ include('helper_functions.php'); $label=$_POST['label']; - $list=$_POST['list']; $number=$_POST['number']; - //get parts of the list - $checkedInstances=preg_split("[,]",$list,-1,PREG_SPLIT_NO_EMPTY); - //initialise content $content=""; mysql_connect('localhost','navigator','dbpedia'); mysql_select_db("navigator_db"); - $query="SELECT name, label, category FROM rank WHERE MATCH (label) AGAINST ('$label') ORDER BY number DESC LIMIT ".$number; + $query="SELECT name, label FROM rank WHERE MATCH (label) AGAINST ('$label') ORDER BY number DESC LIMIT ".$number; $res=mysql_query($query); $bestsearches=""; if (mysql_num_rows($res)>0){ @@ -25,20 +21,30 @@ while ($result=mysql_fetch_array($res)){ $labels[]=$result['label']; $names[]=$result['name']; - if (!isset($result['category'])){ - $result['category']="NoCategory"; - $result2['label']="No Category"; + $query="SELECT category FROM articlecategories WHERE name='".$result['name']."'"; + $res3=mysql_query($query); + $arr=array(); + while ($result3=mysql_fetch_array($res3)){ + $arr[]=$result3['category']; } + if (count($arr)==0){ + $arr[]="NoCategory"; + if (!isset($tags['NoCategory'])) $tags['NoCategory']=1; + else $tags['NoCategory']++; + if (!isset($catlabels['NoCategory'])) $catlabels['NoCategory']='No Category'; + } else { - $query="SELECT label FROM categories WHERE category='".$result['category']."' LIMIT 1"; - $res2=mysql_query($query); - $result2=mysql_fetch_array($res2); + for ($i=0;$i<count($arr);$i++){ + if (!isset($tags[$arr[$i]])) $tags[$arr[$i]]=1; + else $tags[$arr[$i]]++; + $query="SELECT label FROM categories WHERE category='".$arr[$i]."' LIMIT 1"; + $res2=mysql_query($query); + $result2=mysql_fetch_array($res2); + if (!isset($catlabels[$arr[$i]])) $catlabels[$arr[$i]]=$result2['label']; + } } - $classes[]=$result['category']; - if (!isset($tags[$result['category']])) $tags[$result['category']]=1; - else $tags[$result['category']]++; - if (!isset($catlabels[$result['category']])) $catlabels[$result['category']]=$result2['label']; + $classes[]=$arr; } $content.=getTagCloud($tags,$catlabels); $content.=getResultsTable($names,$labels,$classes,$number); Modified: trunk/src/dbpedia-navigator/helper_functions.php =================================================================== --- trunk/src/dbpedia-navigator/helper_functions.php 2008-08-20 12:13:48 UTC (rev 1106) +++ trunk/src/dbpedia-navigator/helper_functions.php 2008-08-20 13:12:53 UTC (rev 1107) @@ -50,7 +50,7 @@ { $ret="<p>These are your Searchresults. Show best "; for ($k=10;$k<125;){ - $ret.="<a href=\"#\" onclick=\"var list=tree.getAllChecked();search_it('label='+document.getElementById('label').value+'&list='+list+'&number=".$k."');return false;\""; + $ret.="<a href=\"#\" onclick=\"search_it('label='+document.getElementById('label').value+'&number=".$k."');return false;\""; if ($k==$number) $ret.=" style=\"text-decoration:none;\""; else $ret.=" style=\"text-decoration:underline;\""; $ret.=">".($k)."</a>"; @@ -69,7 +69,13 @@ $name=$names[$i*25+$j]; $label=$labels[$i*25+$j]; if (strlen($label)==0) $label=urldecode(str_replace("_"," ",substr (strrchr ($name, "/"), 1))); - $class=$classes[$i*25+$j]; + $class=""; + $k=0; + foreach ($classes[$i*25+$j] as $cl){ + if ($k!=count($classes[$i*25+$j])-1) $class.=$cl.' '; + else $class.=$cl; + $k++; + } $ret.='<p style="display:'.$display.'"> '.($i*25+$j+1).'. <a href="" class="'.$class.'" onclick="get_article(\'label='.$name.'&cache=-1\');return false;">'.utf8_to_html($label).'</a></p>'; } $i++; @@ -231,15 +237,14 @@ function formatClassArray($ar) { mysql_connect('localhost','navigator','dbpedia'); mysql_select_db("navigator_db"); - $string=""; + $string="<ul>"; for($i=0; $i<count($ar); $i++) { $query="SELECT label FROM categories WHERE category='".$ar[$i]['value']."' LIMIT 1"; $res=mysql_query($query); $result=mysql_fetch_array($res); - if ($ar[$i]['value']!="http://xmlns.com/foaf/0.1/Person"&&strlen($string)>0) $string .= ', ' . formatClass($ar[$i]['value'],$result['label']); - else if ($ar[$i]['value']!="http://xmlns.com/foaf/0.1/Person"&&strlen($string)==0) $string .= formatClass($ar[$i]['value'],$result['label']); + if ($ar[$i]['value']!="http://xmlns.com/foaf/0.1/Person") $string .= '<li>' . formatClass($ar[$i]['value'],$result['label']).'</li>'; } - return $string; + return $string."</ul>"; } // format a class nicely, i.e. link to it and possibly display @@ -247,7 +252,7 @@ function formatClass($className,$label) { $yagoPrefix = 'http://dbpedia.org/class/yago/'; if(substr($className,0,30)==$yagoPrefix) { - return '<a href="#" onclick="getSubjectsFromCategory(\'category='.$className.'&label='.$label.'&number=10\');">'.$label.'</a>'; + return $label.' <a href="#" onclick="getSubjectsFromCategory(\'category='.$className.'&label='.$label.'&number=10\');">→ search Instances</a> <a href="#" onclick="get_class(\'class='.$className.'&cache=-1\');">→ show Class in Hierarchy</a>'; // DBpedia is Linked Data, so it makes always sense to link it // ToDo: instead of linking to other pages, the resource should better // be openened within DBpedia Navigator @@ -280,4 +285,47 @@ return $ret; } + +function getClassView($fathers,$childs,$title,$class) +{ + $ret='This is the class view. You can browse through the hierarchy and search for instances of classes.<br/><br/>'; + $childButtons=true; + if (strlen($childs)==0){ + $childs='There are no Child classes'; + $childButtons=false; + } + $fatherButtons=true; + if (strlen($fathers)==0){ + $fathers='There are no Father classes'; + $fatherButtons=false; + } + + $ret.='<table border="0" style="text-align:left;width:100%">'; + $ret.='<tr><td style="width:90%"><b>Father classes</b></td></tr>'; + $ret.='<tr style="height:10px"><td></td></tr>'; + $ret.='<tr><td>'.$fathers.'</td></tr>'; + $ret.='<tr style="height:10px"><td></td></tr>'; + $ret.='<tr><td>'; + if ($fatherButtons) $ret.='<input style="width:70px" type="button" value="Instances" class="button" onclick="getSubjectsFromCategory(\'category=\'+document.getElementById(\'fatherSelect\').options[document.getElementById(\'fatherSelect\').selectedIndex].value+\'&label=\'+document.getElementById(\'fatherSelect\').options[document.getElementById(\'fatherSelect\').selectedIndex].innerHTML+\'&number=10\');" title="Search Instances of Father class."/> <input style="width:70px" type="button" value="Class" class="button" onclick="get_class(\'class=\'+document.getElementById(\'fatherSelect\').options[document.getElementById(\'fatherSelect\').selectedIndex].value+\'&cache=-1\');" title="Show Father class in class view."/>'; + $ret.='</td></tr>'; + $ret.='<tr style="height:20px"><td><hr/></td></tr>'; + $ret.='<tr><td><b>Current class</b></td></tr>'; + $ret.='<tr style="height:10px"><td></td></tr>'; + $ret.='<tr><td><b>'.$title.'</b></td></tr>'; + $ret.='<tr style="height:10px"><td></td></tr>'; + $ret.='<tr><td>'; + $ret.='<input style="width:70px" type="button" value="Instances" class="button" onclick="getSubjectsFromCategory(\'category='.$class.'&label='.$title.'&number=10\');" title="Search Instances of Shown class."/>'; + $ret.='</td></tr>'; + $ret.='<tr style="height:20px"><td><hr/></td></tr>'; + $ret.='<tr><td style="width:30%"><b>Child classes</b></td></tr>'; + $ret.='<tr style="height:10px"><td></td></tr>'; + $ret.='<tr><td>'.$childs.'</td></tr>'; + $ret.='<tr style="height:10px"><td></td></tr>'; + $ret.='<tr><td>'; + if ($childButtons) $ret.='<input style="width:70px" type="button" value="Instances" class="button" onclick="getSubjectsFromCategory(\'category=\'+document.getElementById(\'childSelect\').options[document.getElementById(\'childSelect\').selectedIndex].value+\'&label=\'+document.getElementById(\'childSelect\').options[document.getElementById(\'childSelect\').selectedIndex].innerHTML+\'&number=10\');" title="Search Instances of Child class."/> <input style="width:70px" type="button" value="Class" class="button" onclick="get_class(\'class=\'+document.getElementById(\'childSelect\').options[document.getElementById(\'childSelect\').selectedIndex].value+\'&cache=-1\');" title="Show Child class in class view."/>'; + $ret.='</td></tr>'; + $ret.='</table>'; + + return $ret; +} ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-08-20 12:13:48 UTC (rev 1106) +++ trunk/src/dbpedia-navigator/index.php 2008-08-20 13:12:53 UTC (rev 1107) @@ -43,9 +43,7 @@ <link rel="stylesheet" type="text/css" href="<?php print $path;?>treemenu/dhtmlxtree.css"> <script src="http://maps.google.com/maps?file=api&v=2&key=<?php print $settings->googleMapsKey;?>" type="text/javascript"></script> - <script src="<?php print $path;?>treemenu/dhtmlxcommon.js"></script> - <script src="<?php print $path;?>treemenu/dhtmlxtree.js"></script> - <script src="<?php print $path;?>js/ajax.js"></script> + <script src="<?php print $path;?>js/ajax.js"></script> <script type="text/javascript"> function setRunning(running) { @@ -64,6 +62,51 @@ map.addOverlay(marker); } } + + function show_results(class, number) + { + var links=document.getElementById('results').getElementsByTagName('p'); + var j=0; + var names; + var hasClass; + for (var i=0;i<links.length;i++){ + if (class=='all'){ + if ((j+1)>number&&j<(number+25)) links[i].style.display='block'; + else links[i].style.display='none'; + j++; + } + else{ + names=links[i].getElementsByTagName('a')[0].className.split(' '); + hasClass=false; + for (var k=0;k<names.length;k++){ + if (names[k]==class){ + hasClass=true; + break; + } + } + if (hasClass){ + if ((j+1)>number&&j<(number+25)) links[i].style.display='block'; + else links[i].style.display='none'; + j++; + } + else links[i].style.display='none'; + } + } + if (j<number){ + show_results(class,0); + return; + } + + var sitenumbers=document.getElementById('sitenumbers').getElementsByTagName('span'); + for (var i=0;i<sitenumbers.length;i++){ + if ((parseInt(sitenumbers[i].getElementsByTagName('a')[0].innerHTML)-1)*25==number) sitenumbers[i].getElementsByTagName('a')[0].style.textDecoration='none'; + else sitenumbers[i].getElementsByTagName('a')[0].style.textDecoration='underline'; + if ((parseInt(sitenumbers[i].getElementsByTagName('a')[0].innerHTML)-1)*25>=j) + sitenumbers[i].style.display='none'; + else + sitenumbers[i].style.display='inline'; + } + } </script> </head> <body <?php print $onLoad;?>> @@ -83,7 +126,7 @@ <!-- Search:<br/> --> <form onsubmit="get_article('label='+document.getElementById('label').value+'&cache=-1');return false;"> <input type="text" name="label" id="label"/><br/> - <input type="button" value="Article" class="button" onclick="get_article('label='+document.getElementById('label').value+'&cache=-1');return false;" title="Search an article with that name."/> <input type="button" value="Search" class="button" onclick="var list=tree.getAllChecked();search_it('label='+document.getElementById('label').value+'&list='+list+'&number=10');return false;" title="Search a number of articles related to that name."/> + <input type="button" value="Article" class="button" onclick="get_article('label='+document.getElementById('label').value+'&cache=-1');return false;" title="Search an article with that name."/> <input type="button" value="Search" class="button" onclick="search_it('label='+document.getElementById('label').value+'&number=10');return false;" title="Search a number of articles related to that name."/> <!-- <input type="button" value="Fulltext" class="button" onclick=""/> --> </form> </div> <!-- boxcontent --> @@ -96,32 +139,6 @@ </div> <!-- boxcontent --> </div> <!-- box --> - <div class="box" id="NavigationBox"> - <div class="boxtitle" style="cursor:help;" title="Navigate through the Class hierarchy and show instances of that class.">Navigate</div> - <div class="boxcontent"> - <div id="treeboxbox_tree" style="height:218px;overflow:auto;"> - </div> - </div> <!-- boxcontent --> - </div> <!-- box --> - <script> - 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"); - var myLabel = tree.getUserData(nodeId,"mylabel"); - getSubjectsFromCategory('category='+myUrl+'&label='+myLabel+'&number=10'); - } - function myErrorHandler(type, desc, erData){ - alert('An error occured while trying to navigate through Class Tree.\nPlease try again later.'); - } - dhtmlxError.catchError("ALL",myErrorHandler); - tree.setXMLAutoLoading("processTreeMenu.php"); - tree.loadXML("processTreeMenu.php?id=0"); - </script> - - <div class="box" id="credits"> <p>DBpedia Navigator is powered by ... <br /> <a href="http://dl-learner.org">DL-Learner</a><br /> @@ -169,6 +186,12 @@ <div class="boxcontent" id="lastarticles"> </div> <!-- boxcontent --> </div> <!-- box --> + + <div class="box" id="LastClassesBox" style="display:none"> + <div class="boxtitle" style="cursor:help;" title="Up to 5 classes, that were last displayed, are shown here.">Classes Last Viewed</div> + <div class="boxcontent" id="lastclasses"> + </div> <!-- boxcontent --> + </div> <!-- box --> </div><!-- rightSidebar --> Modified: trunk/src/dbpedia-navigator/js/ajax.js =================================================================== --- trunk/src/dbpedia-navigator/js/ajax.js 2008-08-20 12:13:48 UTC (rev 1106) +++ trunk/src/dbpedia-navigator/js/ajax.js 2008-08-20 13:12:53 UTC (rev 1107) @@ -53,7 +53,7 @@ document.getElementById('Negatives').innerHTML=response[4]; setRunning(false); if (response[1]=='Article not found'){ - setTimeout("var list=tree.getAllChecked();search_it('label='+document.getElementById('label').value+'&list='+list+'&number=10')",2000); + setTimeout("search_it('label='+document.getElementById('label').value+'&number=10')",2000); } else document.getElementById('LastArticlesBox').style.display='block'; @@ -65,33 +65,33 @@ XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); XhrObj.send(param); } - -function show_results(class, number) + +function get_class(param) { - var links=document.getElementById('results').getElementsByTagName('p'); - var j=0; - for (var i=0;i<links.length;i++){ - if (links[i].getElementsByTagName('a')[0].className==class||class=='all'){ - if ((j+1)>number&&j<(number+25)) links[i].style.display='block'; - else links[i].style.display='none'; - j++; - } - else links[i].style.display='none'; + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); } - if (j<number){ - show_results(class,0); - return; + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); } - var sitenumbers=document.getElementById('sitenumbers').getElementsByTagName('span'); - for (var i=0;i<sitenumbers.length;i++){ - if ((parseInt(sitenumbers[i].getElementsByTagName('a')[0].innerHTML)-1)*25==number) sitenumbers[i].getElementsByTagName('a')[0].style.textDecoration='none'; - else sitenumbers[i].getElementsByTagName('a')[0].style.textDecoration='underline'; - if ((parseInt(sitenumbers[i].getElementsByTagName('a')[0].innerHTML)-1)*25>=j) - sitenumbers[i].style.display='none'; - else - sitenumbers[i].style.display='inline'; + XhrObj.open("POST",'ajax_get_class.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + var response = XhrObj.responseText.split('$$'); + document.getElementById('articlecontent').innerHTML=response[0]; + document.getElementById('ArticleTitle').innerHTML=response[1]; + document.getElementById('lastclasses').innerHTML=response[2]; + document.getElementById('LastClassesBox').style.display='block'; + } } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(param); } function toPositive(param) @@ -146,79 +146,79 @@ XhrObj.send(param); } - function clearPositives() - { - if (document.all){ - //IE - var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); - } - else{ - //Mozilla - var XhrObj = new XMLHttpRequest(); - } +function clearPositives() +{ + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } - XhrObj.open("POST",'ajax_clear_positives.php'); + XhrObj.open("POST",'ajax_clear_positives.php'); - XhrObj.onreadystatechange = function() - { - if (XhrObj.readyState == 4 && XhrObj.status == 200){ - document.getElementById('Positives').innerHTML = XhrObj.responseText; - } - } + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + document.getElementById('Positives').innerHTML = XhrObj.responseText; + } + } - XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); - XhrObj.send(); - } + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(); +} - function clearNegatives() - { - if (document.all){ - //IE - var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); - } - else{ - //Mozilla - var XhrObj = new XMLHttpRequest(); - } +function clearNegatives() +{ + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_clear_negatives.php'); - XhrObj.open("POST",'ajax_clear_negatives.php'); - - XhrObj.onreadystatechange = function() - { - if (XhrObj.readyState == 4 && XhrObj.status == 200){ - document.getElementById('Negatives').innerHTML = XhrObj.responseText; - } - } - - XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); - XhrObj.send(); + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + document.getElementById('Negatives').innerHTML = XhrObj.responseText; } + } - function removePosInterest(param) - { - if (document.all){ - //IE - var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); - } - else{ - //Mozilla - var XhrObj = new XMLHttpRequest(); - } + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(); +} + +function removePosInterest(param) +{ + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } - XhrObj.open("POST",'ajax_remove_pos_interest.php'); + XhrObj.open("POST",'ajax_remove_pos_interest.php'); - XhrObj.onreadystatechange = function() - { - if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); - document.getElementById('Positives').innerHTML=response[0]; - document.getElementById('Negatives').innerHTML=response[1]; - } - } + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + var response = XhrObj.responseText.split('$$'); + document.getElementById('Positives').innerHTML=response[0]; + document.getElementById('Negatives').innerHTML=response[1]; + } + } - XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); - XhrObj.send(param); - } + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(param); +} function removeNegInterest(param) { @@ -272,28 +272,28 @@ XhrObj.send(); } - function stopServerCall() - { - if (document.all){ - //IE - var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); - } - else{ - //Mozilla - var XhrObj = new XMLHttpRequest(); - } +function stopServerCall() +{ + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } - XhrObj.open("POST",'ajax_stop_server_call.php'); + XhrObj.open("POST",'ajax_stop_server_call.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + } + } - XhrObj.onreadystatechange = function() - { - if (XhrObj.readyState == 4 && XhrObj.status == 200){ - } - } - - XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); - XhrObj.send(); - } + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(); +} function getSubjectsFromConcept(param) { Modified: trunk/src/dbpedia-navigator/localhost.sql =================================================================== --- trunk/src/dbpedia-navigator/localhost.sql 2008-08-20 12:13:48 UTC (rev 1106) +++ trunk/src/dbpedia-navigator/localhost.sql 2008-08-20 13:12:53 UTC (rev 1107) @@ -1,50 +1,90 @@ --- phpMyAdmin SQL Dump --- version 2.9.1 --- http://www.phpmyadmin.net --- --- Host: localhost --- Erstellungszeit: 15. August 2008 um 15:51 --- Server Version: 5.0.67 --- PHP-Version: 5.2.5 --- --- Datenbank: `navigator_db` --- -CREATE DATABASE `navigator_db` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; -USE `navigator_db`; - --- -------------------------------------------------------- - --- --- Tabellenstruktur für Tabelle `categories` --- - -CREATE TABLE `categories` ( - `category` varchar(330) NOT NULL, - `label` varchar(330) NOT NULL, - PRIMARY KEY (`category`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- --- Daten für Tabelle `categories` --- - - --- -------------------------------------------------------- - --- --- Tabellenstruktur für Tabelle `rank` --- - -CREATE TABLE `rank` ( - `name` varchar(330) NOT NULL, - `number` int(8) NOT NULL default '0', - `label` varchar(330) default NULL, - `category` varchar(330) default NULL, - PRIMARY KEY (`name`), - FULLTEXT KEY `Label` (`label`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- --- Daten für Tabelle `rank` --- - +-- phpMyAdmin SQL Dump +-- version 2.9.1 +-- http://www.phpmyadmin.net +-- +-- Host: localhost +-- Erstellungszeit: 20. August 2008 um 12:05 +-- Server Version: 5.0.67 +-- PHP-Version: 5.2.5 +-- +-- Datenbank: `navigator_db` +-- +CREATE DATABASE `navigator_db` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; +USE `navigator_db`; + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `articlecategories` +-- + +CREATE TABLE `articlecategories` ( + `id` int(11) NOT NULL auto_increment, + `name` varchar(330) NOT NULL, + `category` varchar(330) NOT NULL, + `number` int(8) default '0', + PRIMARY KEY (`id`), + KEY `Category` (`category`), + KEY `Names` (`name`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- +-- Daten für Tabelle `articlecategories` +-- + + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `categories` +-- + +CREATE TABLE `categories` ( + `category` varchar(330) NOT NULL, + `label` varchar(330) NOT NULL, + PRIMARY KEY (`category`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +-- +-- Daten für Tabelle `categories` +-- + + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `classhierarchy` +-- + +CREATE TABLE `classhierarchy` ( + `id` int(11) NOT NULL auto_increment, + `father` varchar(330) NOT NULL, + `child` varchar(330) NOT NULL, + PRIMARY KEY (`id`), + KEY `Father` (`father`), + KEY `Child` (`child`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- +-- Daten für Tabelle `classhierarchy` +-- + + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `rank` +-- + +CREATE TABLE `rank` ( + `name` varchar(330) NOT NULL, + `label` varchar(330) default NULL, + `number` int(8) NOT NULL default '0', + PRIMARY KEY (`name`), + FULLTEXT KEY `Label` (`label`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +-- +-- Daten für Tabelle `rank` +-- + Modified: trunk/src/dbpedia-navigator/processTreeMenu.php =================================================================== --- trunk/src/dbpedia-navigator/processTreeMenu.php 2008-08-20 12:13:48 UTC (rev 1106) +++ trunk/src/dbpedia-navigator/processTreeMenu.php 2008-08-20 13:12:53 UTC (rev 1107) @@ -9,15 +9,24 @@ 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"); + /*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){ - if ($category['subclasses']=="0") $child=0; - else $child=1; - print("<item child=\"".$child."\" id=\"".$category['value']."\" text=\"".$category['label']."\"><userdata name=\"myurl\">".$category['value']."</userdata><userdata name=\"mylabel\">".$category['label']."</userdata></item>"); + $categories=$sc->getYagoSubCategories($url_var);*/ + mysql_connect('localhost','navigator','dbpedia'); + mysql_select_db("navigator_db"); + $query="SELECT name FROM articlecategories WHERE category='$url_var' AND name LIKE 'http://dbpedia.org/class/yago/%' LIMIT 100"; + $res=mysql_query($query); + while ($result=mysql_fetch_array($res)){ + $query="SELECT name FROM articlecategories WHERE category='".$result['name']."' AND name LIKE 'http://dbpedia.org/class/yago/%' LIMIT 1"; + $res2=mysql_query($query); + if (mysql_num_rows($res2)>0) $child=1; + else $child=0; + $query="SELECT label FROM categories WHERE category='".$result['name']."' LIMIT 1"; + $res2=mysql_query($query); + $result2=mysql_fetch_array($res2); + print("<item child=\"".$child."\" id=\"".$result['name']."\" text=\"".$result2['label']."\"><userdata name=\"myurl\">".$result['name']."</userdata><userdata name=\"mylabel\">".$result2['label']."</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-08-20 19:21:25
|
Revision: 1113 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1113&view=rev Author: sknappe Date: 2008-08-20 19:21:18 +0000 (Wed, 20 Aug 2008) Log Message: ----------- REST is now working so far with URLs like dbpedia-navigator/showArticle/Leipzig dbpedia-navigator/search/Leipzig dbpedia-navigator/showClass/CapitalsInAsia dbpedia-navigator/searchInstances/CapitalsInAsia Modified Paths: -------------- trunk/src/dbpedia-navigator/ajax_get_article.php trunk/src/dbpedia-navigator/ajax_get_class.php trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php trunk/src/dbpedia-navigator/helper_functions.php trunk/src/dbpedia-navigator/index.php Added Paths: ----------- trunk/src/dbpedia-navigator/CalculatePageRank.java Added: trunk/src/dbpedia-navigator/CalculatePageRank.java =================================================================== --- trunk/src/dbpedia-navigator/CalculatePageRank.java (rev 0) +++ trunk/src/dbpedia-navigator/CalculatePageRank.java 2008-08-20 19:21:18 UTC (rev 1113) @@ -0,0 +1,231 @@ +package org.dllearner.test; + +import java.io.BufferedReader; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.Statement; + +public class CalculatePageRank { + + private final String wikilinks="../pagelinks_en.nt"; + private final String labels="../articles_label_en.nt"; + private final String categories="../yago_en.nt"; + + private void calculateLinks() + { + try{ + Statement stmt; + ResultSet rs; + int number; + + Class.forName("com.mysql.jdbc.Driver"); + + String url = + "jdbc:mysql://localhost:3306/navigator_db"; + + Connection con = DriverManager.getConnection( + url,"navigator", "dbpedia"); + + stmt = con.createStatement(); + BufferedReader in = new BufferedReader(new FileReader(wikilinks)); + + String line; + String[] split; + String name; + int i=0; + while ((line=in.readLine())!=null) + { + split=line.split(" "); + name=split[2].substring(1, split[2].length()-1); + rs=stmt.executeQuery("SELECT number FROM rank WHERE name='"+name+"'"); + if (rs.next()){ + number=rs.getInt(1); + number++; + stmt.executeUpdate("UPDATE rank SET number="+number+" WHERE name='"+name+"'"); + } + else{ + try{ + stmt.executeUpdate("INSERT INTO rank (name,number) VALUES ('"+name+"',1)"); + }catch(Exception e) + {} + } + if (i%100000==0) System.out.println(i); + i++; + } + + in.close(); + con.close(); + } catch (FileNotFoundException e) + { + System.out.println("File not found"); + } catch (IOException e) + { + System.out.println("IOException"); + } catch (Exception e) + { + e.printStackTrace(); + } + } + + private void addLabels() + { + try{ + Statement stmt; + ResultSet rs; + + Class.forName("com.mysql.jdbc.Driver"); + + String url = + "jdbc:mysql://localhost:3306/navigator_db"; + + Connection con = DriverManager.getConnection( + url,"navigator", "dbpedia"); + + stmt = con.createStatement(); + BufferedReader in = new BufferedReader(new FileReader(labels)); + + String line; + String[] split; + String name; + String label; + int i=0; + while ((line=in.readLine())!=null) + { + split=line.split(">"); + name=split[0].substring(1); + label=split[2].substring(split[2].indexOf("\"")+1, split[2].lastIndexOf("\"")); + rs=stmt.executeQuery("SELECT number FROM rank WHERE name='"+name+"'"); + if (rs.next()){ + stmt.executeUpdate("UPDATE rank SET label=\""+label+"\" WHERE name='"+name+"'"); + } + else{ + try{ + stmt.executeUpdate("INSERT INTO rank (name,label) VALUES ('"+name+"',\""+label+"\")"); + }catch(Exception e) + {} + } + if (i%100000==0) System.out.println(i); + i++; + } + + in.close(); + con.close(); + } catch (FileNotFoundException e) + { + System.out.println("File not found"); + } catch (IOException e) + { + System.out.println("IOException"); + } catch (Exception e) + { + e.printStackTrace(); + } + } + + private void calculateCategories() + { + try{ + Statement stmt; + + Class.forName("com.mysql.jdbc.Driver"); + + String url = + "jdbc:mysql://localhost:3306/navigator_db"; + + Connection con = DriverManager.getConnection( + url,"navigator", "dbpedia"); + + stmt = con.createStatement(); + + stmt.executeUpdate("ALTER TABLE rank DROP COLUMN category"); + + BufferedReader in = new BufferedReader(new FileReader(categories)); + + String line; + String[] split; + String name; + String label; + String pred; + int i=0; + while ((line=in.readLine())!=null) + { + split=line.split(">"); + name=split[0].substring(1); + pred=split[1].substring(2); + if (pred.equals("http://www.w3.org/2000/01/rdf-schema#label")) + label=split[2].substring(split[2].indexOf("\"")+1, split[2].lastIndexOf("\"")); + else + label=split[2].substring(2); + if (pred.equals("http://www.w3.org/2000/01/rdf-schema#label")){ + try{ + stmt.executeUpdate("INSERT INTO categories (category,label) VALUES (\""+name+"\",\""+label+"\")"); + }catch(Exception e) + {} + } + else{ + if (name.startsWith("http://dbpedia.org/resource")){ + try{ + stmt.executeUpdate("INSERT INTO articlecategories (name,category) VALUES ('"+name+"','"+label+"')"); + }catch(Exception e) + {} + }else{ + try{ + stmt.executeUpdate("INSERT INTO classhierarchy (father,child) VALUES ('"+label+"','"+name+"')"); + }catch(Exception e) + {} + } + } + if (i%100000==0) System.out.println(i); + i++; + } + + in.close(); + con.close(); + } catch (FileNotFoundException e) + { + System.out.println("File not found"); + } catch (IOException e) + { + System.out.println("IOException"); + } catch (Exception e) + { + e.printStackTrace(); + } + } + + private void copyNumbers() + { + try{ + Statement stmt; + + Class.forName("com.mysql.jdbc.Driver"); + + String url = + "jdbc:mysql://localhost:3306/navigator_db"; + + Connection con = DriverManager.getConnection( + url,"navigator", "dbpedia"); + + stmt = con.createStatement(); + + stmt.executeUpdate("UPDATE articlecategories SET number=(SELECT number FROM rank WHERE articlecategories.name=rank.name)"); + + con.close(); + } catch (Exception e) + { + e.printStackTrace(); + } + } + + public static void main(String[] args){ + CalculatePageRank cal=new CalculatePageRank(); + cal.calculateLinks(); + cal.addLabels(); + cal.calculateCategories(); + cal.copyNumbers(); + } +} \ No newline at end of file Modified: trunk/src/dbpedia-navigator/ajax_get_article.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_article.php 2008-08-20 17:01:28 UTC (rev 1112) +++ trunk/src/dbpedia-navigator/ajax_get_article.php 2008-08-20 19:21:18 UTC (rev 1113) @@ -5,9 +5,7 @@ $subject=$_POST['label']; $fromCache=$_POST['cache']; - if (isset($_POST['path'])) $path=$_POST['path']; - else $path=""; - + if (isset($_SESSION['articles'])) $articles=$_SESSION['articles']; $id=$_SESSION['id']; $ksID=$_SESSION['ksID']; @@ -32,6 +30,8 @@ $content=""; $lastArticles=""; $artTitle=""; + $lat=""; + $long=""; //get the article //if $fromCache is -1, everything is normal @@ -69,11 +69,11 @@ // give the link to the corresponding Wikipedia article if(isset($triples['http://xmlns.com/foaf/0.1/page'])) - $content .= '<p><img src="'.$path.'images/wikipedia_favicon.png" alt="Wikipedia" style="max-width:20px;" /> <a href="#" onclick="window.open(\''.getPrintableURL($triples['http://xmlns.com/foaf/0.1/page'][0]['value']).'\',\'Wikiwindow\',\'width=800,height=500,top=50,left=50,scrollbars=yes\');">view Wikipedia article</a>, '; - $content .= '<img src="'.$path.'images/dbpedia-favicon.ico" alt="DBpedia" style="max-width:20px;"/> <a href="#" onclick="window.open(\''.$uri.'\',\'Wikiwindow\',\'width=800,height=500,top=50,left=50,scrollbars=yes\');">view DBpedia resource description</a>'; + $content .= '<p><img src="images/wikipedia_favicon.png" alt="Wikipedia" style="max-width:20px;" /> <a href="#" onclick="window.open(\''.getPrintableURL($triples['http://xmlns.com/foaf/0.1/page'][0]['value']).'\',\'Wikiwindow\',\'width=800,height=500,top=50,left=50,scrollbars=yes\');">view Wikipedia article</a>, '; + $content .= '<img src="images/dbpedia-favicon.ico" alt="DBpedia" style="max-width:20px;"/> <a href="#" onclick="window.open(\''.$uri.'\',\'Wikiwindow\',\'width=800,height=500,top=50,left=50,scrollbars=yes\');">view DBpedia resource description</a>'; //display photo collection, if there is one if (isset($triples['http://dbpedia.org/property/hasPhotoCollection'])){ - $content.=', <img src="'.$path.'images/flickr.png" alt="Flickr" style="max-width:20px;" /> <a href="#" onclick="window.open(\''.$triples['http://dbpedia.org/property/hasPhotoCollection'][0]['value'].'\',\'Wikiwindow\',\'width=800,height=500,top=50,left=50,scrollbars=yes\');">view photo collection</a></p>'; + $content.=', <img src="images/flickr.png" alt="Flickr" style="max-width:20px;" /> <a href="#" onclick="window.open(\''.$triples['http://dbpedia.org/property/hasPhotoCollection'][0]['value'].'\',\'Wikiwindow\',\'width=800,height=500,top=50,left=50,scrollbars=yes\');">view photo collection</a></p>'; } $content.='<br/><hr><h4>Classes and Categories</h4><br/>'; Modified: trunk/src/dbpedia-navigator/ajax_get_class.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_class.php 2008-08-20 17:01:28 UTC (rev 1112) +++ trunk/src/dbpedia-navigator/ajax_get_class.php 2008-08-20 19:21:18 UTC (rev 1113) @@ -3,9 +3,7 @@ $class=$_POST['class']; $fromCache=$_POST['cache']; - if (isset($_POST['path'])) $path=$_POST['path']; - else $path=""; - + session_start(); if (isset($_SESSION['classes'])) $classes=$_SESSION['classes']; session_write_close(); @@ -15,7 +13,7 @@ if (isset($classes)){ foreach ($classes as $key => $value) { - if ($value['uri']==$uri){ + if ($value['uri']==$class){ $fromCache=$key; break; } Modified: trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php 2008-08-20 17:01:28 UTC (rev 1112) +++ trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php 2008-08-20 19:21:18 UTC (rev 1113) @@ -2,7 +2,6 @@ include('helper_functions.php'); $category=$_POST['category']; - $label=$_POST['label']; $number=$_POST['number']; //initialise content @@ -11,6 +10,13 @@ mysql_connect('localhost','navigator','dbpedia'); mysql_select_db("navigator_db"); + + //get label of the category + $query="SELECT label FROM categories WHERE category='$category' LIMIT 1"; + $res=mysql_query($query); + $result=mysql_fetch_array($res); + $label=$result['label']; + $query="SELECT name FROM articlecategories WHERE category='$category' ORDER BY number DESC LIMIT ".$number; $res=mysql_query($query); $bestsearches=""; @@ -24,7 +30,7 @@ $result2=mysql_fetch_array($res2); $labels[]=$result2['label']; } - $content.=getCategoryResultsTable($names,$labels,$category,$label,$number); + $content.=getCategoryResultsTable($names,$labels,$category,$number); $bestsearches=getBestSearches($names,$labels); } else Modified: trunk/src/dbpedia-navigator/helper_functions.php =================================================================== --- trunk/src/dbpedia-navigator/helper_functions.php 2008-08-20 17:01:28 UTC (rev 1112) +++ trunk/src/dbpedia-navigator/helper_functions.php 2008-08-20 19:21:18 UTC (rev 1113) @@ -108,11 +108,11 @@ return $string; } -function getCategoryResultsTable($names,$labels,$category,$catlabel,$number) +function getCategoryResultsTable($names,$labels,$category,$number) { $ret="<p>These are your Searchresults. Show best "; for ($k=10;$k<125;){ - $ret.="<a href=\"#\" onclick=\"getSubjectsFromCategory('category=".$category."&label=".$catlabel."&number=".$k."');return false;\""; + $ret.="<a href=\"#\" onclick=\"getSubjectsFromCategory('category=".$category."&number=".$k."');return false;\""; if ($k==$number) $ret.=" style=\"text-decoration:none;\""; else $ret.=" style=\"text-decoration:underline;\""; $ret.=">".($k)."</a>"; @@ -252,7 +252,7 @@ function formatClass($className,$label) { $yagoPrefix = 'http://dbpedia.org/class/yago/'; if(substr($className,0,30)==$yagoPrefix) { - return $label.' <a href="#" onclick="getSubjectsFromCategory(\'category='.$className.'&label='.$label.'&number=10\');">→ search Instances</a> <a href="#" onclick="get_class(\'class='.$className.'&cache=-1\');">→ show Class in Hierarchy</a>'; + return $label.' <a href="#" onclick="getSubjectsFromCategory(\'category='.$className.'&number=10\');">→ search Instances</a> <a href="#" onclick="get_class(\'class='.$className.'&cache=-1\');">→ show Class in Hierarchy</a>'; // DBpedia is Linked Data, so it makes always sense to link it // ToDo: instead of linking to other pages, the resource should better // be openened within DBpedia Navigator @@ -277,10 +277,10 @@ $ret[0]=""; $ret[1]=""; if (isset($sess['positive'])) foreach($sess['positive'] as $name=>$lab){ - $ret[0].=$lab." <a href=\"\" onclick=\"toNegative('subject=".$name."&label=".$lab."');return false;\"><img src=\"".$_GET['path']."images/minus.jpg\" alt=\"Minus\"/></a> <a href=\"\" onclick=\"removePosInterest('subject=".$name."');return false;\"><img src=\"".$_GET['path']."images/remove.png\" alt=\"Delete\"/></a><br/>"; + $ret[0].=$lab." <a href=\"\" onclick=\"toNegative('subject=".$name."&label=".$lab."');return false;\"><img src=\"images/minus.jpg\" alt=\"Minus\"/></a> <a href=\"\" onclick=\"removePosInterest('subject=".$name."');return false;\"><img src=\"images/remove.png\" alt=\"Delete\"/></a><br/>"; } if (isset($sess['negative'])) foreach($sess['negative'] as $name=>$lab){ - $ret[1].=$lab." <a href=\"\" onclick=\"toPositive('subject=".$name."&label=".$lab."');return false;\"><img src=\"".$_GET['path']."images/plus.jpg\" alt=\"Plus\"/></a> <a href=\"\" onclick=\"removeNegInterest('subject=".$name."');return false;\"><img src=\"".$_GET['path']."images/remove.png\" alt=\"Delete\"/></a><br/>"; + $ret[1].=$lab." <a href=\"\" onclick=\"toPositive('subject=".$name."&label=".$lab."');return false;\"><img src=\"images/plus.jpg\" alt=\"Plus\"/></a> <a href=\"\" onclick=\"removeNegInterest('subject=".$name."');return false;\"><img src=\"images/remove.png\" alt=\"Delete\"/></a><br/>"; } return $ret; @@ -306,7 +306,7 @@ $ret.='<tr><td>'.$fathers.'</td></tr>'; $ret.='<tr style="height:10px"><td></td></tr>'; $ret.='<tr><td>'; - if ($fatherButtons) $ret.='<input style="width:70px" type="button" value="Instances" class="button" onclick="getSubjectsFromCategory(\'category=\'+document.getElementById(\'fatherSelect\').options[document.getElementById(\'fatherSelect\').selectedIndex].value+\'&label=\'+document.getElementById(\'fatherSelect\').options[document.getElementById(\'fatherSelect\').selectedIndex].innerHTML+\'&number=10\');" title="Search Instances of Father class."/> <input style="width:70px" type="button" value="Class" class="button" onclick="get_class(\'class=\'+document.getElementById(\'fatherSelect\').options[document.getElementById(\'fatherSelect\').selectedIndex].value+\'&cache=-1\');" title="Show Father class in class view."/>'; + if ($fatherButtons) $ret.='<input style="width:70px" type="button" value="Instances" class="button" onclick="getSubjectsFromCategory(\'category=\'+document.getElementById(\'fatherSelect\').options[document.getElementById(\'fatherSelect\').selectedIndex].value+\'&number=10\');" title="Search Instances of Father class."/> <input style="width:70px" type="button" value="Class" class="button" onclick="get_class(\'class=\'+document.getElementById(\'fatherSelect\').options[document.getElementById(\'fatherSelect\').selectedIndex].value+\'&cache=-1\');" title="Show Father class in class view."/>'; $ret.='</td></tr>'; $ret.='<tr style="height:20px"><td><hr/></td></tr>'; $ret.='<tr><td><b>Current class</b></td></tr>'; @@ -314,7 +314,7 @@ $ret.='<tr><td><b>'.$title.'</b></td></tr>'; $ret.='<tr style="height:10px"><td></td></tr>'; $ret.='<tr><td>'; - $ret.='<input style="width:70px" type="button" value="Instances" class="button" onclick="getSubjectsFromCategory(\'category='.$class.'&label='.$title.'&number=10\');" title="Search Instances of Shown class."/>'; + $ret.='<input style="width:70px" type="button" value="Instances" class="button" onclick="getSubjectsFromCategory(\'category='.$class.'&number=10\');" title="Search Instances of Shown class."/>'; $ret.='</td></tr>'; $ret.='<tr style="height:20px"><td><hr/></td></tr>'; $ret.='<tr><td style="width:30%"><b>Child classes</b></td></tr>'; @@ -322,7 +322,7 @@ $ret.='<tr><td>'.$childs.'</td></tr>'; $ret.='<tr style="height:10px"><td></td></tr>'; $ret.='<tr><td>'; - if ($childButtons) $ret.='<input style="width:70px" type="button" value="Instances" class="button" onclick="getSubjectsFromCategory(\'category=\'+document.getElementById(\'childSelect\').options[document.getElementById(\'childSelect\').selectedIndex].value+\'&label=\'+document.getElementById(\'childSelect\').options[document.getElementById(\'childSelect\').selectedIndex].innerHTML+\'&number=10\');" title="Search Instances of Child class."/> <input style="width:70px" type="button" value="Class" class="button" onclick="get_class(\'class=\'+document.getElementById(\'childSelect\').options[document.getElementById(\'childSelect\').selectedIndex].value+\'&cache=-1\');" title="Show Child class in class view."/>'; + if ($childButtons) $ret.='<input style="width:70px" type="button" value="Instances" class="button" onclick="getSubjectsFromCategory(\'category=\'+document.getElementById(\'childSelect\').options[document.getElementById(\'childSelect\').selectedIndex].value+\'&number=10\');" title="Search Instances of Child class."/> <input style="width:70px" type="button" value="Class" class="button" onclick="get_class(\'class=\'+document.getElementById(\'childSelect\').options[document.getElementById(\'childSelect\').selectedIndex].value+\'&cache=-1\');" title="Show Child class in class view."/>'; $ret.='</td></tr>'; $ret.='</table>'; Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-08-20 17:01:28 UTC (rev 1112) +++ trunk/src/dbpedia-navigator/index.php 2008-08-20 19:21:18 UTC (rev 1113) @@ -11,19 +11,15 @@ $_SESSION['id']=$ids[0]; $_SESSION['ksID']=$ids[1]; -if (isset($_GET['path'])) $path=$_GET['path']; -else $path=""; - require_once('Settings.php'); $settings=new Settings(); - //what happens onLoad $onLoad="onLoad=\"document.getElementById('label').focus();"; -if (isset($_GET['resource'])){ - $onLoad.="get_article('label=".$_GET['resource']."&cache=-1');"; - unset($_GET['resource']); -} +if (isset($_GET['showArticle'])) $onLoad.="get_article('label=".$_GET['showArticle']."&cache=-1');"; +else if (isset($_GET['search'])) $onLoad.="search_it('label=".$_GET['search']."&number=10');"; +else if (isset($_GET['showClass'])) $onLoad.="get_class('class=http://dbpedia.org/class/yago/".$_GET['showClass']."&cache=-1');"; +else if (isset($_GET['searchInstances'])) $onLoad.="getSubjectsFromCategory('category=http://dbpedia.org/class/yago/".$_GET['searchInstances']."&number=10');"; else if (isset($_SESSION['currentArticle'])){ $onLoad.="get_article('label=&cache=".$_SESSION['currentArticle']."');"; } @@ -39,11 +35,10 @@ <head> <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"> + <link rel="stylesheet" href="css/default.css"/> <script src="http://maps.google.com/maps?file=api&v=2&key=<?php print $settings->googleMapsKey;?>" type="text/javascript"></script> - <script src="<?php print $path;?>js/ajax.js"></script> + <script src="js/ajax.js"></script> <script type="text/javascript"> function setRunning(running) { @@ -112,7 +107,7 @@ <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... <a href=""><img src="<?php print $path;?>images/remove.png" onclick="stopServerCall();return false;" /></a></span></td></tr></table></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... <a href=""><img src="images/remove.png" onclick="stopServerCall();return false;" /></a></span></td></tr></table></div> <div id="layer" style="display:none"> <div id="layerContent" style="display:none"></div> </div> @@ -147,8 +142,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="<?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> + <a href="http://www.w3.org/2004/OWL/"><img src="images/sw-owl-green.png" alt="OWL logo" /></a> + <a href="http://www.w3.org/2001/sw/DataAccess/"><img src="images/sw-sparql-green.png" alt="SPARQL logo"/></a> </div> </div><!-- END leftSidebar --> @@ -170,13 +165,13 @@ <div id="rightSidebar"> <div class="box"> - <div class="boxtitlewithbutton" id="positivesboxtitle" style="cursor:help;" title="The shown articles are considered when generating navigation tips.">search relevant <a href="#"><img src="<?php print $path;?>images/remove.png" onclick="clearPositives()" title="Delete all articles of interest."/></a> </div> + <div class="boxtitlewithbutton" id="positivesboxtitle" style="cursor:help;" title="The shown articles are considered when generating navigation tips.">search relevant <a href="#"><img src="images/remove.png" onclick="clearPositives()" title="Delete all articles of interest."/></a> </div> <div class="boxcontent" id="Positives"> </div> <!-- boxcontent --> </div> <!-- box --> <div class="box"> - <div class="boxtitlewithbutton" id="negativesboxtitle" style="cursor:help;" title="The shown articles are avoided when generating navigation tips.">not relevant <a href="#"><img src="<?php print $path;?>images/remove.png" onclick="clearNegatives()" title="Delete all avoided articles."/></a> </div> + <div class="boxtitlewithbutton" id="negativesboxtitle" style="cursor:help;" title="The shown articles are avoided when generating navigation tips.">not relevant <a href="#"><img src="images/remove.png" onclick="clearNegatives()" title="Delete all avoided articles."/></a> </div> <div class="boxcontent" id="Negatives"> </div> <!-- boxcontent --> </div> <!-- box --> @@ -206,12 +201,12 @@ $uri = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; echo '<div><a href="http://validator.w3.org/check?uri='.$uri.'"'; - echo '><img src="'.$path.'images/valid-xhtml10.png" alt="valid XHTML 1.0" /></a>'."\n"; + echo '><img src="images/valid-xhtml10.png" alt="valid XHTML 1.0" /></a>'."\n"; echo '<a href="http://jigsaw.w3.org/css-validator/validator?uri='.$uri.'"'; - echo '><img src="'.$path.'images/valid-css.png" alt="valid CSS" /></a></div>'."\n"; + echo '><img src="images/valid-css.png" alt="valid CSS" /></a></div>'."\n"; ?> </div> - <p><a href='<?php print $path;?>rebuild.php'>rebuild [restart session and redownload WSDL file (for debugging)]</a></p> + <p><a href='rebuild.php'>rebuild [restart session and redownload WSDL file (for debugging)]</a></p> </div> <div id="todo"> @@ -227,7 +222,6 @@ examples it classifies (in-)correctly.</li> <li>Create a small number of test cases (e.g. 3), which can be used to verify that DBpedia Navigator is working in typical scenarios (in particular cases where concepts with length greater one are learned).</li> - <li>Allow to disable caching functionality (in Settings.php).</li> <li>Make DBpedia Navigator RESTful, e.g. URLs $base/showArticle/$URL for displaying an article; $base/search/$phrase for searching; $base/listInstances/$complexClass for listing the instances of a learned. Maybe session variables (in particuar the selected positive and negative examples) can @@ -236,20 +230,13 @@ easier external access (just give someone a link instead of saying exactly which actions have to be done to get to a state), simplifies debugging the application, and may be of use for creating further features.</li> - <li>Improve search functionality [we will probably get feedback from Georgi in February].</li> - <li>[maybe] Display a tag cloud similar to <a href="http://dbpedia.org/search/">DBpedia search</a>.</li> - <li>[maybe] Instead of only allowing a search as entry point to the application, also display - a navigatable class tree.</li> <li>[if possible] When expensive SPARQL queries or learning problems have been posed, there should be some way to abandon these if the user has already switched to doing something else. Example: The user has added 3 positive and 1 negative examples. This is executed as a learning problem, but has no solution (so DL-Learner would run forever unless we pose some internal time limit). The user adds another negative example a second later, so instead of letting the previous learning problem run for a long time (and needing much resources), it should be stopped by DBpedia Navigator.</li> - <li>[if possible] Find an easy way to validate HTML/JS in AJAX applications.</li> - <li>[maybe] Would be interesting to somehow view the Wikipedia article (without the left navigation part, - tabs etc.) as an overlay, because the Wikipedia article will almost always be a human-friendlier - description of an object compared to the extracted one.</li> + <li>[if possible] Find an easy way to validate HTML/JS in AJAX applications.</li> </ul> </div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-08-21 08:20:06
|
Revision: 1116 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1116&view=rev Author: sknappe Date: 2008-08-21 08:19:58 +0000 (Thu, 21 Aug 2008) Log Message: ----------- REST now also works with URLs like: http://localhost/dbpedia-navigator/searchInstances/CitiesInSaxony?positives=[http://dbpedia.org/resource/Leipzig] You can generate an URL via a button at the bottom Modified Paths: -------------- trunk/src/dbpedia-navigator/ajax_get_article.php trunk/src/dbpedia-navigator/ajax_get_class.php trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php trunk/src/dbpedia-navigator/ajax_search.php trunk/src/dbpedia-navigator/index.php trunk/src/dbpedia-navigator/js/ajax.js Added Paths: ----------- trunk/src/dbpedia-navigator/ajax_generate_URL.php trunk/src/dbpedia-navigator/ajax_set_positives_and_negatives.php trunk/src/dbpedia-navigator/css/ trunk/src/dbpedia-navigator/css/default.css Removed Paths: ------------- trunk/src/dbpedia-navigator/default.css Added: trunk/src/dbpedia-navigator/ajax_generate_URL.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_generate_URL.php (rev 0) +++ trunk/src/dbpedia-navigator/ajax_generate_URL.php 2008-08-21 08:19:58 UTC (rev 1116) @@ -0,0 +1,29 @@ +<?php + session_start(); + $positives=$_SESSION['positive']; + $negatives=$_SESSION['negative']; + + $pos=""; + $i=1; + if (isset($_SESSION['positive'])) foreach ($positives as $key=>$value){ + if ($i<count($positives)) $pos.=$key.']['; + else $pos.=$key; + $i++; + } + if (strlen($pos)>0) $pos='positives=['.$pos.']'; + $neg=""; + $i=1; + if (isset($_SESSION['negative'])) foreach ($negatives as $key=>$value){ + if ($i<count($negatives)) $neg.=$key.']['; + else $neg.=$key; + $i++; + } + if (strlen($neg)>0) $neg='negatives=['.$neg.']'; + + if (strlen($pos)>0||strlen($neg)>0) $interests='?'.$pos.$neg; + else $interests=""; + + $url='http://'.$_SERVER['HTTP_HOST'].'/dbpedia-navigator/'.$_SESSION['lastAction'].$interests; + + print $url.'<br/><br/>'; +?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/ajax_get_article.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_article.php 2008-08-20 20:05:10 UTC (rev 1115) +++ trunk/src/dbpedia-navigator/ajax_get_article.php 2008-08-21 08:19:58 UTC (rev 1116) @@ -9,6 +9,11 @@ if (isset($_SESSION['articles'])) $articles=$_SESSION['articles']; $id=$_SESSION['id']; $ksID=$_SESSION['ksID']; + + //write last action into session + if (strpos($subject,"http://dbpedia.org/resource/")===0) $actionuri=substr (strrchr ($subject, "/"), 1); + else $actionuri=urlencode($subject); + $_SESSION['lastAction']='showArticle/'.$actionuri; session_write_close(); setRunning($id,"true"); Modified: trunk/src/dbpedia-navigator/ajax_get_class.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_class.php 2008-08-20 20:05:10 UTC (rev 1115) +++ trunk/src/dbpedia-navigator/ajax_get_class.php 2008-08-21 08:19:58 UTC (rev 1116) @@ -6,6 +6,9 @@ session_start(); if (isset($_SESSION['classes'])) $classes=$_SESSION['classes']; + //write last action into session + $actionuri=substr (strrchr ($class, "/"), 1); + $_SESSION['lastAction']='showClass/'.$actionuri; session_write_close(); Modified: trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php 2008-08-20 20:05:10 UTC (rev 1115) +++ trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php 2008-08-21 08:19:58 UTC (rev 1116) @@ -3,7 +3,13 @@ $category=$_POST['category']; $number=$_POST['number']; - + + session_start(); + //write last action into session + $actionuri=substr (strrchr ($category, "/"), 1); + $_SESSION['lastAction']='searchInstances/'.$actionuri; + session_write_close(); + //initialise content $content=""; $bestsearches=""; Modified: trunk/src/dbpedia-navigator/ajax_search.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_search.php 2008-08-20 20:05:10 UTC (rev 1115) +++ trunk/src/dbpedia-navigator/ajax_search.php 2008-08-21 08:19:58 UTC (rev 1116) @@ -1,9 +1,14 @@ <?php include('helper_functions.php'); - $label=$_POST['label']; + $label=urldecode($_POST['label']); $number=$_POST['number']; - + + session_start(); + //write last action into session + $_SESSION['lastAction']='search/'.urlencode($label); + session_write_close(); + //initialise content $content=""; Added: trunk/src/dbpedia-navigator/ajax_set_positives_and_negatives.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_set_positives_and_negatives.php (rev 0) +++ trunk/src/dbpedia-navigator/ajax_set_positives_and_negatives.php 2008-08-21 08:19:58 UTC (rev 1116) @@ -0,0 +1,42 @@ +<?php + include('helper_functions.php'); + + $positives=$_POST['positives']; + $negatives=$_POST['negatives']; + + if (strlen($positives)>0) $positives=explode('][',substr($positives,1,strlen($positives)-2)); + else $positives=array(); + if (strlen($negatives)>0) $negatives=explode('][',substr($negatives,1,strlen($negatives)-2)); + else $negatives=array(); + + mysql_connect('localhost','navigator','dbpedia'); + mysql_select_db("navigator_db"); + + $ptemp=array(); + foreach ($positives as $pos){ + $query="SELECT label FROM rank WHERE name='$pos' LIMIT 1"; + $res=mysql_query($query); + $result=mysql_fetch_array($res); + $ptemp[$pos]=$result['label']; + } + + $ntemp=array(); + foreach ($negatives as $neg){ + $query="SELECT label FROM rank WHERE name='$neg' LIMIT 1"; + $res=mysql_query($query); + $result=mysql_fetch_array($res); + $ntemp[$neg]=$result['label']; + } + + session_start(); + + $_SESSION['positive']=$ptemp; + $_SESSION['negative']=$ntemp; + + //add Positives and Negatives to Interests + $interests=show_Interests($_SESSION); + + print $interests[0]; + print '$$'; + print $interests[1]; +?> \ No newline at end of file Copied: trunk/src/dbpedia-navigator/css/default.css (from rev 1115, trunk/src/dbpedia-navigator/default.css) =================================================================== --- trunk/src/dbpedia-navigator/css/default.css (rev 0) +++ trunk/src/dbpedia-navigator/css/default.css 2008-08-21 08:19:58 UTC (rev 1116) @@ -0,0 +1,384 @@ +/** + * Main DBpedia Navigator Style Sheet. + * + * @author: Norman Heino + * @author: Jens Lehmann + */ + +/* remove browser specific margins */ +* { + margin: 0; + padding: 0; +} + +html { + font: 85%/1.2 "Lucida Grande", Helvetica, Arial, sans-serif; +} + +p { + margin: 8px 0; +} + +h1 { + margin: 0.2em; +} + +h2 { + margin: 0.1em; +} + +/* + * Main site structure + */ + +#Loading { + color: #666; + font-size: 85%; +} + +#wrapper { + /*position: relative;*/ + max-width: 100%; + padding: 1%; +/* padding: 15px; */ +/* margin: 15px;*/ +} + +#content { + /*margin: 0 19em;*/ + overflow: hidden; + /*width: 10%;*/ + width: 60%; + float: left; + margin-left: 3px; + margin-right: 3px; +/* border-left: 1px solid #bbb; + border-right: 1px solid #bbb; + padding: 0 5px;*/ +} + +/* + * Side bars are positioned absolutely due to several reasons: + * (1)Internet Explorer has problems displaying float elements, + * (2) the content's position in html is irrelevant, + * (3) positioning the content div is more straightforward. + */ +#leftSidebar { + /* position: absolute; */ + width: 18%; + min-width: 150px; + float: left; +} + +#rightSidebar { + /* position: absolute; */ + /*float: right;*/ + width: 18%; + min-width: 150px; + float: left; + /*top: 15px; + right: 15px;*/ +} + +/* + * sidebar content (boxes) + */ + +.box { + color: #666; + margin-bottom: 20px; + border: 1px solid #bbb; + font-size: 85%; +} + +/*.box td { + font-size: 100%; +}*/ + +.box .boxtitle { + color: #666; + background-color: #eee; + padding: 3px 0.4em; + font-weight: bold; + white-space: nowrap; +} + +.box .boxtitle .boxtitle_string { + width: 80%; + overflow: hidden; +/* display: none;*/ +} + +.box .boxcontent { + padding: 0.6em; + border-top: 1px solid #bbb; +} + +/* restrict content of certain boxes */ +.box#predicates .boxcontent, +.box#classes .boxcontent { + overflow: hidden; +} + +.box p { + margin: 0 2px 4px 0; +} + +.box ul, .box ol { + margin: 0px; +/* padding-left: 15px;*/ + list-style-position: inside; +} + +.box ul.no_bullet, .box ul.no_bullet { + list-style-type: none; +} + +.box ul li.horizontal, .box ol li.horizontal, +.box ul.horizontal, .box ol.horizontal { + display: inline; +} + +.box a.title_switch { + position: absolute; + right: 0.5em; + margin: auto 0; + color: #666; + border: 1px solid #bbb; + width: 1em; + height: 1em; + background-color: #fff; + text-align: center; +} + +.box a.title_switch:hover { + color: #02a; + text-decoration: none; + background-color: #eee; +} + +.box hr { + margin: 0.5em 0; + border: none; + border-top: 1px dotted #bbb; + height: 0; +} + +.box#classes .boxcontent a { + display: block; +} + +.box input { + width: auto; +} + +.box td input { + width: 100%; +} + +.box img.rating { + position: relative; + top: 1px; +} + +.hidden { + display: none; +} + + +/* + * Links + */ + +a, a:link, a:visited { + color: #02a; + text-decoration: none; + /* cursor: pointer; */ +} + +a:hover { + text-decoration: underline; +} + + +/* + * Tabs + */ + +/* all the tabs */ +.tabs { + float: left; + width: 100%; + background: #fff url("../images/tabs_back.png") repeat-x bottom; +} + +.tabs ul { + list-style: none; +} + +.tabs li { + float: left; + margin-right: 1px; +} + +.tabs a { + display: block; + margin-top: 1px; + padding: 0.35em 1.35em; + background-image: url("../images/tab_back.png"); + background-repeat: repeat-x; + background-color: #cbcbcb; + border: 1px solid #bbb; +} + +.tabs a:hover { + background: #fff; + text-decoration: none; +} + +.tabs a.current { + background: #fff; + border-bottom: 1px solid #fff; +} + +/* horizontal line underneath the tabs */ +#tab-line { + height: 1em; + clear: both; +} + +#instances { + float: right; +} + +.selected { + background-color: #bde; /*#b4d5fe;*/ +} + +.button { + border: solid black 1px; + padding: 0px 1px; + background-color: #eee; +} + +img { + border: none; +} + +/* + * Layer + */ +#layer { + width: 100%; + height: 100%; + position: absolute; + background-image: url("../images/black_50.png"); + background-repeat: repeat; + z-index: 98; +} + +#layerContent { + margin-top: 100px; + margin: auto; + width: 500px; + height: 300px; + background-color: #ffb; + border: 2px solid #bbb; + z-index: 99; +} + +/* + * Buttons + */ +input.button { + border: 1px solid #bbb; + color: #666; + background-color: #eee; + padding: 3px 0.4em; + font-weight: bold; + white-space: nowrap; + font-size: 85%; +} + +input.button:hover { + border-left:1px solid #ffffff; + border-top:1px solid #ffffff; + border-right:1px solid #848484; + border-bottom:1px solid #848484; +} + +.titletable{ + width:100%; + color: #666; + background-color: #eee; + padding: 0.1em 0.4em; + font-weight: bold; + font-size: 100%; + white-space: nowrap; +} + +.titletable input.button{ + width:auto; +} + +.titletable td.left{ + text-align:left; +} + +.titletable td.right{ + text-align:right; +} + +.box .boxtitlewithbutton { + color: #666; + background-color: #eee; + padding: 0em 0.4em; + font-weight: bold; + white-space: nowrap; +} + +#search { + text-align:center; +} + +#label { + margin-bottom: 0.1em; +} + +#article { + min-height: 500px; +} + +#credits { + border: none; +} + +#positivesboxtitle { + /*color: black;*/ + background-color: lightgreen; +} + +#negativesboxtitle { + /*color: black;*/ + background-color: #ee6666; +} + +#ArticleTitle { + font-size: 150%; + color:black; +} + +#footer { + clear: both; + text-align: center; +} + +#todo { + padding: 15px; + margin: 10px; +} + +#redirectedFrom { + color: #666; + font-size: 85%; +} \ No newline at end of file Deleted: trunk/src/dbpedia-navigator/default.css =================================================================== --- trunk/src/dbpedia-navigator/default.css 2008-08-20 20:05:10 UTC (rev 1115) +++ trunk/src/dbpedia-navigator/default.css 2008-08-21 08:19:58 UTC (rev 1116) @@ -1,384 +0,0 @@ -/** - * Main DBpedia Navigator Style Sheet. - * - * @author: Norman Heino - * @author: Jens Lehmann - */ - -/* remove browser specific margins */ -* { - margin: 0; - padding: 0; -} - -html { - font: 85%/1.2 "Lucida Grande", Helvetica, Arial, sans-serif; -} - -p { - margin: 8px 0; -} - -h1 { - margin: 0.2em; -} - -h2 { - margin: 0.1em; -} - -/* - * Main site structure - */ - -#Loading { - color: #666; - font-size: 85%; -} - -#wrapper { - /*position: relative;*/ - max-width: 100%; - padding: 1%; -/* padding: 15px; */ -/* margin: 15px;*/ -} - -#content { - /*margin: 0 19em;*/ - overflow: hidden; - /*width: 10%;*/ - width: 60%; - float: left; - margin-left: 3px; - margin-right: 3px; -/* border-left: 1px solid #bbb; - border-right: 1px solid #bbb; - padding: 0 5px;*/ -} - -/* - * Side bars are positioned absolutely due to several reasons: - * (1)Internet Explorer has problems displaying float elements, - * (2) the content's position in html is irrelevant, - * (3) positioning the content div is more straightforward. - */ -#leftSidebar { - /* position: absolute; */ - width: 18%; - min-width: 150px; - float: left; -} - -#rightSidebar { - /* position: absolute; */ - /*float: right;*/ - width: 18%; - min-width: 150px; - float: left; - /*top: 15px; - right: 15px;*/ -} - -/* - * sidebar content (boxes) - */ - -.box { - color: #666; - margin-bottom: 20px; - border: 1px solid #bbb; - font-size: 85%; -} - -/*.box td { - font-size: 100%; -}*/ - -.box .boxtitle { - color: #666; - background-color: #eee; - padding: 3px 0.4em; - font-weight: bold; - white-space: nowrap; -} - -.box .boxtitle .boxtitle_string { - width: 80%; - overflow: hidden; -/* display: none;*/ -} - -.box .boxcontent { - padding: 0.6em; - border-top: 1px solid #bbb; -} - -/* restrict content of certain boxes */ -.box#predicates .boxcontent, -.box#classes .boxcontent { - overflow: hidden; -} - -.box p { - margin: 0 2px 4px 0; -} - -.box ul, .box ol { - margin: 0px; -/* padding-left: 15px;*/ - list-style-position: inside; -} - -.box ul.no_bullet, .box ul.no_bullet { - list-style-type: none; -} - -.box ul li.horizontal, .box ol li.horizontal, -.box ul.horizontal, .box ol.horizontal { - display: inline; -} - -.box a.title_switch { - position: absolute; - right: 0.5em; - margin: auto 0; - color: #666; - border: 1px solid #bbb; - width: 1em; - height: 1em; - background-color: #fff; - text-align: center; -} - -.box a.title_switch:hover { - color: #02a; - text-decoration: none; - background-color: #eee; -} - -.box hr { - margin: 0.5em 0; - border: none; - border-top: 1px dotted #bbb; - height: 0; -} - -.box#classes .boxcontent a { - display: block; -} - -.box input { - width: auto; -} - -.box td input { - width: 100%; -} - -.box img.rating { - position: relative; - top: 1px; -} - -.hidden { - display: none; -} - - -/* - * Links - */ - -a, a:link, a:visited { - color: #02a; - text-decoration: none; - /* cursor: pointer; */ -} - -a:hover { - text-decoration: underline; -} - - -/* - * Tabs - */ - -/* all the tabs */ -.tabs { - float: left; - width: 100%; - background: #fff url("../images/tabs_back.png") repeat-x bottom; -} - -.tabs ul { - list-style: none; -} - -.tabs li { - float: left; - margin-right: 1px; -} - -.tabs a { - display: block; - margin-top: 1px; - padding: 0.35em 1.35em; - background-image: url("../images/tab_back.png"); - background-repeat: repeat-x; - background-color: #cbcbcb; - border: 1px solid #bbb; -} - -.tabs a:hover { - background: #fff; - text-decoration: none; -} - -.tabs a.current { - background: #fff; - border-bottom: 1px solid #fff; -} - -/* horizontal line underneath the tabs */ -#tab-line { - height: 1em; - clear: both; -} - -#instances { - float: right; -} - -.selected { - background-color: #bde; /*#b4d5fe;*/ -} - -.button { - border: solid black 1px; - padding: 0px 1px; - background-color: #eee; -} - -img { - border: none; -} - -/* - * Layer - */ -#layer { - width: 100%; - height: 100%; - position: absolute; - background-image: url("../images/black_50.png"); - background-repeat: repeat; - z-index: 98; -} - -#layerContent { - margin-top: 100px; - margin: auto; - width: 500px; - height: 300px; - background-color: #ffb; - border: 2px solid #bbb; - z-index: 99; -} - -/* - * Buttons - */ -input.button { - border: 1px solid #bbb; - color: #666; - background-color: #eee; - padding: 3px 0.4em; - font-weight: bold; - white-space: nowrap; - font-size: 85%; -} - -input.button:hover { - border-left:1px solid #ffffff; - border-top:1px solid #ffffff; - border-right:1px solid #848484; - border-bottom:1px solid #848484; -} - -.titletable{ - width:100%; - color: #666; - background-color: #eee; - padding: 0.1em 0.4em; - font-weight: bold; - font-size: 100%; - white-space: nowrap; -} - -.titletable input.button{ - width:auto; -} - -.titletable td.left{ - text-align:left; -} - -.titletable td.right{ - text-align:right; -} - -.box .boxtitlewithbutton { - color: #666; - background-color: #eee; - padding: 0em 0.4em; - font-weight: bold; - white-space: nowrap; -} - -#search { - text-align:center; -} - -#label { - margin-bottom: 0.1em; -} - -#article { - min-height: 500px; -} - -#credits { - border: none; -} - -#positivesboxtitle { - /*color: black;*/ - background-color: lightgreen; -} - -#negativesboxtitle { - /*color: black;*/ - background-color: #ee6666; -} - -#ArticleTitle { - font-size: 150%; - color:black; -} - -#footer { - clear: both; - text-align: center; -} - -#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-08-20 20:05:10 UTC (rev 1115) +++ trunk/src/dbpedia-navigator/index.php 2008-08-21 08:19:58 UTC (rev 1116) @@ -16,6 +16,7 @@ //what happens onLoad $onLoad="onLoad=\"document.getElementById('label').focus();"; +if (isset($_GET['positives'])||isset($_GET['negatives'])) $onLoad.="setPositivesAndNegatives('positives=".$_GET['positives']."&negatives=".$_GET['negatives']."');"; if (isset($_GET['showArticle'])) $onLoad.="get_article('label=".$_GET['showArticle']."&cache=-1');"; else if (isset($_GET['search'])) $onLoad.="search_it('label=".$_GET['search']."&number=10');"; else if (isset($_GET['showClass'])) $onLoad.="get_class('class=http://dbpedia.org/class/yago/".$_GET['showClass']."&cache=-1');"; @@ -23,6 +24,7 @@ else if (isset($_SESSION['currentArticle'])){ $onLoad.="get_article('label=&cache=".$_SESSION['currentArticle']."');"; } + $onLoad.="\""; @@ -194,7 +196,9 @@ </div><!-- wrapper --> <div id="footer"> - <p>Licensed under the GNU General Public License (GPL) 3 as part of the DL-Learner open source + <div id="generatedURL"></div> + <input type="button" class="button" value="generate URL" onclick="generateURL();"/> + <p>Licensed under the GNU General Public License (GPL) 3 as part of the DL-Learner open source project.<br />Copyright © Jens Lehmann 2007-2008 </p> <div id="validation"> <?php Modified: trunk/src/dbpedia-navigator/js/ajax.js =================================================================== --- trunk/src/dbpedia-navigator/js/ajax.js 2008-08-20 20:05:10 UTC (rev 1115) +++ trunk/src/dbpedia-navigator/js/ajax.js 2008-08-21 08:19:58 UTC (rev 1116) @@ -220,57 +220,57 @@ XhrObj.send(param); } - function removeNegInterest(param) - { - if (document.all){ - //IE - var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); - } - else{ - //Mozilla - var XhrObj = new XMLHttpRequest(); - } +function removeNegInterest(param) +{ + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } - XhrObj.open("POST",'ajax_remove_neg_interest.php'); + XhrObj.open("POST",'ajax_remove_neg_interest.php'); - XhrObj.onreadystatechange = function() - { - if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); - document.getElementById('Positives').innerHTML=response[0]; - document.getElementById('Negatives').innerHTML=response[1]; - } - } + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + var response = XhrObj.responseText.split('$$'); + document.getElementById('Positives').innerHTML=response[0]; + document.getElementById('Negatives').innerHTML=response[1]; + } + } - XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); - XhrObj.send(param); + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(param); +} + +function learnConcept() +{ + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_learn_concepts.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + var response = XhrObj.responseText.split('$$'); + document.getElementById('conceptlink').innerHTML=response[0]; + document.getElementById('ConceptInformation').innerHTML=response[1]; } - - function learnConcept() - { - if (document.all){ - //IE - var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); - } - else{ - //Mozilla - var XhrObj = new XMLHttpRequest(); - } + } - XhrObj.open("POST",'ajax_learn_concepts.php'); - - XhrObj.onreadystatechange = function() - { - if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); - document.getElementById('conceptlink').innerHTML=response[0]; - document.getElementById('ConceptInformation').innerHTML=response[1]; - } - } - - XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); - XhrObj.send(); - } + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(); +} function stopServerCall() { @@ -349,4 +349,54 @@ XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); XhrObj.send(param); +} + +function setPositivesAndNegatives(param) +{ + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_set_positives_and_negatives.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + var response = XhrObj.responseText.split('$$'); + document.getElementById('Positives').innerHTML=response[0]; + document.getElementById('Negatives').innerHTML=response[1]; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(param); +} + +function generateURL() +{ + if (document.all){ + //IE + var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + else{ + //Mozilla + var XhrObj = new XMLHttpRequest(); + } + + XhrObj.open("POST",'ajax_generate_URL.php'); + + XhrObj.onreadystatechange = function() + { + if (XhrObj.readyState == 4 && XhrObj.status == 200){ + document.getElementById('generatedURL').innerHTML=XhrObj.responseText; + } + } + + XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); + XhrObj.send(); } \ 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-08-21 10:48:30
|
Revision: 1117 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1117&view=rev Author: sknappe Date: 2008-08-21 10:48:27 +0000 (Thu, 21 Aug 2008) Log Message: ----------- changed learning and concept display a bit, not final yet Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/ajax_get_article.php trunk/src/dbpedia-navigator/ajax_learn_concepts.php trunk/src/dbpedia-navigator/css/default.css trunk/src/dbpedia-navigator/index.php trunk/src/dbpedia-navigator/js/ajax.js Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-08-21 08:19:58 UTC (rev 1116) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-08-21 10:48:27 UTC (rev 1117) @@ -109,7 +109,7 @@ $this->client->stop($this->id); } //return $concepts->item; - return $concepts; + return json_decode($concepts,true); } function getConceptDepth() Modified: trunk/src/dbpedia-navigator/ajax_get_article.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_article.php 2008-08-21 08:19:58 UTC (rev 1116) +++ trunk/src/dbpedia-navigator/ajax_get_article.php 2008-08-21 10:48:27 UTC (rev 1117) @@ -168,6 +168,7 @@ unset($triples['http://dbpedia.org/property/lonMin']); unset($triples['http://dbpedia.org/property/latDeg']); unset($triples['http://dbpedia.org/property/lonMin']); + unset($triples['http://www.georss.org/georss/point']); if (count($triples)>0){ @@ -243,6 +244,4 @@ print $lat; print '$$'; print $long; - - //$objResponse->call('xajax_learnConcept'); ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/ajax_learn_concepts.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-08-21 08:19:58 UTC (rev 1116) +++ trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-08-21 10:48:27 UTC (rev 1117) @@ -25,16 +25,9 @@ $sc=new DLLearnerConnection($id, $ksID); try{ $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=\"getSubjectsFromConcept('concept=".$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>"; - $i++; + $concept.="<tr><td><a href=\"\" onclick=\"getSubjectsFromConcept('concept=".$con['descriptionManchesterSyntax']."');return false;\" />".$con['descriptionManchesterSyntax']."</a> (Accuracy: ".(floatVal($con['accuracy'])*100)."%)</td></tr>"; } $concept.="</table>"; } catch(Exception $e){ @@ -44,6 +37,4 @@ else $concept="You must choose at least one positive example."; print $concept; - print '$$'; - print $conceptinformation; ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/css/default.css =================================================================== --- trunk/src/dbpedia-navigator/css/default.css 2008-08-21 08:19:58 UTC (rev 1116) +++ trunk/src/dbpedia-navigator/css/default.css 2008-08-21 10:48:27 UTC (rev 1117) @@ -48,7 +48,7 @@ /*margin: 0 19em;*/ overflow: hidden; /*width: 10%;*/ - width: 60%; + width: 63%; float: left; margin-left: 3px; margin-right: 3px; Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-08-21 08:19:58 UTC (rev 1116) +++ trunk/src/dbpedia-navigator/index.php 2008-08-21 10:48:27 UTC (rev 1117) @@ -109,7 +109,15 @@ <body <?php print $onLoad;?>> <!-- <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... <a href=""><img src="images/remove.png" onclick="stopServerCall();return false;" /></a></span></td></tr></table></div> +<div><table border="0" width="100%"><tr><td width="30%"><img src="images/dbpedia_navigator.png" alt="DBpedia Navigator" style="padding:5px" /></td> +<td width="49%"> + <div class="box" id="ConceptBox" style="display:none"> + <div class="boxtitle" style="cursor:help;" title="Browsing suggestions considering search relevant and not relevant articles.">Navigation Suggestions</div> + <div class="boxcontent"> + <div id="conceptlink" style="display:block"></div> + </div> <!-- boxcontent --> + </div> <!-- box --> +</td><td width="19%"><span id="Loading" style="display:none">Server Call... <a href=""><img src="images/remove.png" onclick="stopServerCall();return false;" /></a></span></td></tr></table></div> <div id="layer" style="display:none"> <div id="layerContent" style="display:none"></div> </div> @@ -244,11 +252,6 @@ </ul> </div> - <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> - </body> </html> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/js/ajax.js =================================================================== --- trunk/src/dbpedia-navigator/js/ajax.js 2008-08-21 08:19:58 UTC (rev 1116) +++ trunk/src/dbpedia-navigator/js/ajax.js 2008-08-21 10:48:27 UTC (rev 1117) @@ -52,14 +52,15 @@ document.getElementById('Positives').innerHTML=response[3]; document.getElementById('Negatives').innerHTML=response[4]; setRunning(false); + if (response[5].length>0&&response[6].length>0) + loadGoogleMap(response[5],response[6],''+response[1]); if (response[1]=='Article not found'){ setTimeout("search_it('label='+document.getElementById('label').value+'&number=10')",2000); } else document.getElementById('LastArticlesBox').style.display='block'; + setTimeout('setRunning(true);learnConcept();',1000); } - if (response[5].length>0&&response[6].length>0) - loadGoogleMap(response[5],response[6],''+response[1]); } XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); @@ -264,7 +265,8 @@ if (XhrObj.readyState == 4 && XhrObj.status == 200){ var response = XhrObj.responseText.split('$$'); document.getElementById('conceptlink').innerHTML=response[0]; - document.getElementById('ConceptInformation').innerHTML=response[1]; + document.getElementById('ConceptBox').style.display='block'; + setRunning(false); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-08-21 16:50:48
|
Revision: 1123 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1123&view=rev Author: sknappe Date: 2008-08-21 16:50:44 +0000 (Thu, 21 Aug 2008) Log Message: ----------- Changed some things, when displaying learned concepts, accuracy is shown and natural language concepts are shown, some bugfixing Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/Settings.php trunk/src/dbpedia-navigator/ajax_learn_concepts.php trunk/src/dbpedia-navigator/index.php trunk/src/dbpedia-navigator/js/ajax.js Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-08-21 16:34:10 UTC (rev 1122) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-08-21 16:50:44 UTC (rev 1123) @@ -10,6 +10,7 @@ { private $DBPediaUrl; private $ttl; + private $learnttl; private $lang; // private $client; @@ -26,6 +27,7 @@ require_once("Settings.php"); $settings=new Settings(); $this->ttl=$settings->sparqlttl; + $this->learnttl=$settings->learnttl; $this->lang=$settings->language; $this->DBPediaUrl=$settings->dbpediauri; $this->client=new SoapClient("main.wsdl",array('features' => SOAP_SINGLE_ELEMENT_ARRAYS)); @@ -89,7 +91,6 @@ // see what we have learned so far //$concepts=$this->client->getCurrentlyBestConcepts($this->id,3,"kb"); - $concepts=$this->client->getCurrentlyBestEvaluatedDescriptions($this->id,3); $running=$this->client->isAlgorithmRunning($this->id); $seconds = $i * $sleeptime; @@ -104,12 +105,12 @@ $this->client->stop($this->id); throw new Exception("Learning stopped"); } - } while($seconds<$this->ttl&&$running); + } while($seconds<$this->learnttl&&$running); $this->client->stop($this->id); } //return $concepts->item; - return json_decode($concepts,true); + return json_decode($this->client->getCurrentlyBestEvaluatedDescriptions($this->id,3),true); } function getConceptDepth() Modified: trunk/src/dbpedia-navigator/Settings.php =================================================================== --- trunk/src/dbpedia-navigator/Settings.php 2008-08-21 16:34:10 UTC (rev 1122) +++ trunk/src/dbpedia-navigator/Settings.php 2008-08-21 16:50:44 UTC (rev 1123) @@ -37,6 +37,7 @@ // public $dbpediauri='http://dbpedia2.openlinksw.com:8890/isparql'; // in mikrosekunden public $sparqlttl=60000000; + public $learnttl=30000000; public $language="en"; Modified: trunk/src/dbpedia-navigator/ajax_learn_concepts.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-08-21 16:34:10 UTC (rev 1122) +++ trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-08-21 16:50:44 UTC (rev 1123) @@ -25,16 +25,20 @@ $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=\"getSubjectsFromConcept('concept=".$con['descriptionManchesterSyntax']."');return false;\" />".$con['descriptionManchesterSyntax']."</a> (Accuracy: ".(floatVal($con['accuracy'])*100)."%)</td></tr>"; + if (count($concepts)>0){ + $concept.="<table border=0>\n"; + $concept.="<tr><td>You could also be interested in articles matching these descriptions:</td></tr>"; + foreach ($concepts as $con){ + $concept.="<tr><td><a href=\"\" onclick=\"getSubjectsFromConcept('concept=".$con['descriptionManchesterSyntax']."');return false;\" />".$con['NaturalLanguage']."</a> (Accuracy: ".(floatVal($con['accuracy'])*100)."%)</td></tr>"; + } + $concept.="</table>"; } - $concept.="</table>"; + else $concept="-"; } catch(Exception $e){ $concept.=$e->getMessage(); } } - else $concept="You must choose at least one positive example."; + else $concept="-"; print $concept; ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-08-21 16:34:10 UTC (rev 1122) +++ trunk/src/dbpedia-navigator/index.php 2008-08-21 16:50:44 UTC (rev 1123) @@ -117,7 +117,7 @@ <div id="conceptlink" style="display:block"></div> </div> <!-- boxcontent --> </div> <!-- box --> -</td><td width="19%"><span id="Loading" style="display:none">Server Call... <a href=""><img src="images/remove.png" onclick="stopServerCall();return false;" /></a></span></td></tr></table></div> +</td><td width="19%" style="text-align:center"><span id="Loading" style="display:none">Server Call... <a href=""><img src="images/remove.png" onclick="stopServerCall();return false;" /></a></span></td></tr></table></div> <div id="layer" style="display:none"> <div id="layerContent" style="display:none"></div> </div> Modified: trunk/src/dbpedia-navigator/js/ajax.js =================================================================== --- trunk/src/dbpedia-navigator/js/ajax.js 2008-08-21 16:34:10 UTC (rev 1122) +++ trunk/src/dbpedia-navigator/js/ajax.js 2008-08-21 16:50:44 UTC (rev 1123) @@ -9,7 +9,7 @@ var XhrObj = new XMLHttpRequest(); } - XhrObj.open("POST",'ajax_search.php'); + XhrObj.open("POST",'ajax_search.php',true); XhrObj.onreadystatechange = function() { @@ -40,7 +40,7 @@ var XhrObj = new XMLHttpRequest(); } - XhrObj.open("POST",'ajax_get_article.php'); + XhrObj.open("POST",'ajax_get_article.php',true); XhrObj.onreadystatechange = function() { @@ -59,7 +59,7 @@ } else document.getElementById('LastArticlesBox').style.display='block'; - setTimeout('setRunning(true);learnConcept();',1000); + learnConcept(); } } @@ -78,7 +78,7 @@ var XhrObj = new XMLHttpRequest(); } - XhrObj.open("POST",'ajax_get_class.php'); + XhrObj.open("POST",'ajax_get_class.php',true); XhrObj.onreadystatechange = function() { @@ -106,7 +106,7 @@ var XhrObj = new XMLHttpRequest(); } - XhrObj.open("POST",'ajax_to_positive.php'); + XhrObj.open("POST",'ajax_to_positive.php',true); XhrObj.onreadystatechange = function() { @@ -132,7 +132,7 @@ var XhrObj = new XMLHttpRequest(); } - XhrObj.open("POST",'ajax_to_negative.php'); + XhrObj.open("POST",'ajax_to_negative.php',true); XhrObj.onreadystatechange = function() { @@ -158,7 +158,7 @@ var XhrObj = new XMLHttpRequest(); } - XhrObj.open("POST",'ajax_clear_positives.php'); + XhrObj.open("POST",'ajax_clear_positives.php',true); XhrObj.onreadystatechange = function() { @@ -182,7 +182,7 @@ var XhrObj = new XMLHttpRequest(); } - XhrObj.open("POST",'ajax_clear_negatives.php'); + XhrObj.open("POST",'ajax_clear_negatives.php',true); XhrObj.onreadystatechange = function() { @@ -206,7 +206,7 @@ var XhrObj = new XMLHttpRequest(); } - XhrObj.open("POST",'ajax_remove_pos_interest.php'); + XhrObj.open("POST",'ajax_remove_pos_interest.php',true); XhrObj.onreadystatechange = function() { @@ -232,7 +232,7 @@ var XhrObj = new XMLHttpRequest(); } - XhrObj.open("POST",'ajax_remove_neg_interest.php'); + XhrObj.open("POST",'ajax_remove_neg_interest.php',true); XhrObj.onreadystatechange = function() { @@ -249,6 +249,7 @@ function learnConcept() { + setRunning(true); if (document.all){ //IE var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); @@ -258,14 +259,15 @@ var XhrObj = new XMLHttpRequest(); } - XhrObj.open("POST",'ajax_learn_concepts.php'); + XhrObj.open("POST",'ajax_learn_concepts.php',true); XhrObj.onreadystatechange = function() { if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); - document.getElementById('conceptlink').innerHTML=response[0]; - document.getElementById('ConceptBox').style.display='block'; + if (XhrObj.responseText!='-'){ + document.getElementById('conceptlink').innerHTML=XhrObj.responseText; + document.getElementById('ConceptBox').style.display='block'; + } setRunning(false); } } @@ -285,7 +287,7 @@ var XhrObj = new XMLHttpRequest(); } - XhrObj.open("POST",'ajax_stop_server_call.php'); + XhrObj.open("POST",'ajax_stop_server_call.php',true); XhrObj.onreadystatechange = function() { @@ -308,7 +310,7 @@ var XhrObj = new XMLHttpRequest(); } - XhrObj.open("POST",'ajax_get_subjects_from_concept.php'); + XhrObj.open("POST",'ajax_get_subjects_from_concept.php',true); XhrObj.onreadystatechange = function() { @@ -334,7 +336,7 @@ var XhrObj = new XMLHttpRequest(); } - XhrObj.open("POST",'ajax_get_subjects_from_category.php'); + XhrObj.open("POST",'ajax_get_subjects_from_category.php',true); XhrObj.onreadystatechange = function() { @@ -364,7 +366,7 @@ var XhrObj = new XMLHttpRequest(); } - XhrObj.open("POST",'ajax_set_positives_and_negatives.php'); + XhrObj.open("POST",'ajax_set_positives_and_negatives.php',true); XhrObj.onreadystatechange = function() { @@ -390,7 +392,7 @@ var XhrObj = new XMLHttpRequest(); } - XhrObj.open("POST",'ajax_generate_URL.php'); + XhrObj.open("POST",'ajax_generate_URL.php',true); XhrObj.onreadystatechange = function() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-08-28 06:02:08
|
Revision: 1134 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1134&view=rev Author: sknappe Date: 2008-08-28 06:02:05 +0000 (Thu, 28 Aug 2008) Log Message: ----------- deleted all unneccessary files and made mysql server configurable in settings.php Modified Paths: -------------- trunk/src/dbpedia-navigator/Settings.php trunk/src/dbpedia-navigator/ajax_get_class.php trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php trunk/src/dbpedia-navigator/ajax_learn_concepts.php trunk/src/dbpedia-navigator/ajax_search.php trunk/src/dbpedia-navigator/ajax_set_positives_and_negatives.php trunk/src/dbpedia-navigator/helper_functions.php Removed Paths: ------------- trunk/src/dbpedia-navigator/processTreeMenu.php trunk/src/dbpedia-navigator/treemenu/ trunk/src/dbpedia-navigator/xajax/ Modified: trunk/src/dbpedia-navigator/Settings.php =================================================================== --- trunk/src/dbpedia-navigator/Settings.php 2008-08-25 16:46:15 UTC (rev 1133) +++ trunk/src/dbpedia-navigator/Settings.php 2008-08-28 06:02:05 UTC (rev 1134) @@ -47,6 +47,13 @@ //public $googleMapsKey="ABQIAAAAWwHG9WuZ8hxFSPjRX2-D-hRHWRcfpxRnIG10qrJMLnZO-_MKjRRpu2rZj8etMweqJES04ZL_eht1iQ"; public $useCache=true; + + //the server, where the mysql databank is located + public $mysqlServer='localhost'; + //the user, that has rights to access the navigator databank + public $mysqlUser='navigator'; + //the password of that user + public $mysqlPass='dbpedia'; } ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/ajax_get_class.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_class.php 2008-08-25 16:46:15 UTC (rev 1133) +++ trunk/src/dbpedia-navigator/ajax_get_class.php 2008-08-28 06:02:05 UTC (rev 1134) @@ -1,5 +1,6 @@ <?php include('helper_functions.php'); + include('Settings.php'); $class=$_POST['class']; $fromCache=$_POST['cache']; @@ -34,7 +35,7 @@ if ($fromCache<0) { //if there are errors see catch block try{ - mysql_connect('localhost','navigator','dbpedia'); + mysql_connect($mysqlServer,$mysqlUser,$mysqlPass); mysql_select_db("navigator_db"); //build Select box with Child Classes Modified: trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php 2008-08-25 16:46:15 UTC (rev 1133) +++ trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php 2008-08-28 06:02:05 UTC (rev 1134) @@ -14,7 +14,7 @@ $content=""; $bestsearches=""; - mysql_connect('localhost','navigator','dbpedia'); + mysql_connect($mysqlServer,$mysqlUser,$mysqlPass); mysql_select_db("navigator_db"); //get label of the category Modified: trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php 2008-08-25 16:46:15 UTC (rev 1133) +++ trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php 2008-08-28 06:02:05 UTC (rev 1134) @@ -11,17 +11,20 @@ setRunning($id,"true"); $concept=html_entity_decode($concept); + + $test=preg_match("/^http://dbpedia.org/class/yago/[^/]+$/",$concept); + $content=""; - try{ + /*try{ require_once("DLLearnerConnection.php"); $sc=new DLLearnerConnection($id,$ksID); $subjects=$sc->getSubjectsFromConcept($concept); $content.=getResultsTable($subjects); } catch (Exception $e){ $content=$e->getMessage(); - } + }*/ - print $content; + print $test."ho"; print '$$'; print "Instances for Concept ".$concept; ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/ajax_learn_concepts.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-08-25 16:46:15 UTC (rev 1133) +++ trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-08-28 06:02:05 UTC (rev 1134) @@ -29,7 +29,7 @@ $concept.="<table border=0>\n"; $concept.="<tr><td>You could also be interested in articles matching these descriptions:</td></tr>"; foreach ($concepts as $con){ - $concept.="<tr><td><a href=\"\" onclick=\"getSubjectsFromConcept('concept=".$con['descriptionManchesterSyntax']."');return false;\" />".$con['NaturalLanguage']."</a> (Accuracy: ".(floatVal($con['accuracy'])*100)."%)</td></tr>"; + $concept.="<tr><td><a href=\"\" onclick=\"getSubjectsFromConcept('concept=".htmlentities($con['descriptionManchesterSyntax'])."');return false;\" />".$con['NaturalLanguage']."</a> (Accuracy: ".(floatVal($con['accuracy'])*100)."%)</td></tr>"; } $concept.="</table>"; } Modified: trunk/src/dbpedia-navigator/ajax_search.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_search.php 2008-08-25 16:46:15 UTC (rev 1133) +++ trunk/src/dbpedia-navigator/ajax_search.php 2008-08-28 06:02:05 UTC (rev 1134) @@ -12,7 +12,7 @@ //initialise content $content=""; - mysql_connect('localhost','navigator','dbpedia'); + mysql_connect($mysqlServer,$mysqlUser,$mysqlPass); mysql_select_db("navigator_db"); $query="SELECT name, label FROM rank WHERE MATCH (label) AGAINST ('$label') ORDER BY number DESC LIMIT ".$number; $res=mysql_query($query); Modified: trunk/src/dbpedia-navigator/ajax_set_positives_and_negatives.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_set_positives_and_negatives.php 2008-08-25 16:46:15 UTC (rev 1133) +++ trunk/src/dbpedia-navigator/ajax_set_positives_and_negatives.php 2008-08-28 06:02:05 UTC (rev 1134) @@ -9,7 +9,7 @@ if (strlen($negatives)>0) $negatives=explode('][',substr($negatives,1,strlen($negatives)-2)); else $negatives=array(); - mysql_connect('localhost','navigator','dbpedia'); + mysql_connect($mysqlServer,$mysqlUser,$mysqlPass); mysql_select_db("navigator_db"); $ptemp=array(); Modified: trunk/src/dbpedia-navigator/helper_functions.php =================================================================== --- trunk/src/dbpedia-navigator/helper_functions.php 2008-08-25 16:46:15 UTC (rev 1133) +++ trunk/src/dbpedia-navigator/helper_functions.php 2008-08-28 06:02:05 UTC (rev 1134) @@ -235,7 +235,7 @@ } function formatClassArray($ar) { - mysql_connect('localhost','navigator','dbpedia'); + mysql_connect($mysqlServer,$mysqlUser,$mysqlPass); mysql_select_db("navigator_db"); $string="<ul>"; for($i=0; $i<count($ar); $i++) { Deleted: trunk/src/dbpedia-navigator/processTreeMenu.php =================================================================== --- trunk/src/dbpedia-navigator/processTreeMenu.php 2008-08-25 16:46:15 UTC (rev 1133) +++ trunk/src/dbpedia-navigator/processTreeMenu.php 2008-08-28 06:02:05 UTC (rev 1134) @@ -1,33 +0,0 @@ -<?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);*/ - mysql_connect('localhost','navigator','dbpedia'); - mysql_select_db("navigator_db"); - $query="SELECT name FROM articlecategories WHERE category='$url_var' AND name LIKE 'http://dbpedia.org/class/yago/%' LIMIT 100"; - $res=mysql_query($query); - while ($result=mysql_fetch_array($res)){ - $query="SELECT name FROM articlecategories WHERE category='".$result['name']."' AND name LIKE 'http://dbpedia.org/class/yago/%' LIMIT 1"; - $res2=mysql_query($query); - if (mysql_num_rows($res2)>0) $child=1; - else $child=0; - $query="SELECT label FROM categories WHERE category='".$result['name']."' LIMIT 1"; - $res2=mysql_query($query); - $result2=mysql_fetch_array($res2); - print("<item child=\"".$child."\" id=\"".$result['name']."\" text=\"".$result2['label']."\"><userdata name=\"myurl\">".$result['name']."</userdata><userdata name=\"mylabel\">".$result2['label']."</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-09-15 07:43:36
|
Revision: 1204 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1204&view=rev Author: sknappe Date: 2008-09-15 07:43:31 +0000 (Mon, 15 Sep 2008) Log Message: ----------- changed the database connection, now use a class to connect to the database, this should make the connection more generic, other databases than mysql could be used, at the moment only support for mysql Modified Paths: -------------- trunk/src/dbpedia-navigator/Settings.php trunk/src/dbpedia-navigator/ajax_get_class.php trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php trunk/src/dbpedia-navigator/ajax_learn_concepts.php trunk/src/dbpedia-navigator/ajax_search.php trunk/src/dbpedia-navigator/ajax_set_positives_and_negatives.php trunk/src/dbpedia-navigator/helper_functions.php Removed Paths: ------------- trunk/src/dbpedia-navigator/images/csh_bluebooks/ Modified: trunk/src/dbpedia-navigator/Settings.php =================================================================== --- trunk/src/dbpedia-navigator/Settings.php 2008-09-14 19:13:22 UTC (rev 1203) +++ trunk/src/dbpedia-navigator/Settings.php 2008-09-15 07:43:31 UTC (rev 1204) @@ -37,7 +37,7 @@ // public $dbpediauri='http://dbpedia2.openlinksw.com:8890/isparql'; // in mikrosekunden public $sparqlttl=60000000; - public $learnttl=30000000; + public $learnttl=60000000; public $language="en"; @@ -48,12 +48,16 @@ public $useCache=true; + //the type of database server + public $database_type='mysql'; //the server, where the mysql databank is located - public $mysqlServer='localhost'; + public $database_server='localhost'; //the user, that has rights to access the navigator databank - public $mysqlUser='navigator'; + public $database_user='navigator'; //the password of that user - public $mysqlPass='dbpedia'; + public $database_pass='dbpedia'; + //the name of the used database + public $database_name='navigator_db'; } ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/ajax_get_class.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_class.php 2008-09-14 19:13:22 UTC (rev 1203) +++ trunk/src/dbpedia-navigator/ajax_get_class.php 2008-09-15 07:43:31 UTC (rev 1204) @@ -1,6 +1,7 @@ <?php - include('helper_functions.php'); - include('Settings.php'); + include_once('Settings.php'); + include_once('DatabaseConnection.php'); + include_once('helper_functions.php'); $class=$_POST['class']; $fromCache=$_POST['cache']; @@ -35,17 +36,20 @@ if ($fromCache<0) { //if there are errors see catch block try{ - mysql_connect($mysqlServer,$mysqlUser,$mysqlPass); - mysql_select_db("navigator_db"); + //connect to the database + $settings=new Settings(); + $databaseConnection=new DatabaseConnection($settings->database_type); + $databaseConnection->connect($settings->database_server,$settings->database_user,$settings->database_pass); + $databaseConnection->select_database($settings->database_name); //build Select box with Child Classes $query="SELECT child FROM classhierarchy WHERE father='$class'"; - $res=mysql_query($query); + $res=$databaseConnection->query($query); $childClasses=''; - while ($result=mysql_fetch_array($res)){ + while ($result=$databaseConnection->nextEntry($res)){ $query="SELECT label FROM categories WHERE category='".$result['child']."' LIMIT 1"; - $res2=mysql_query($query); - $result2=mysql_fetch_array($res2); + $res2=$databaseConnection->query($query); + $result2=$databaseConnection->nextEntry($res2); $identify=urldecode(str_replace("_"," ",substr (strrchr ($result['child'], "/"), 1))); if ((strlen($identify)+strlen($result2['label']))>100) $identify=substr($identify,0,100-strlen($result2['label'])); $childClasses.='<option value="'.$result['child'].'">'.utf8_to_html($result2['label']).' ('.$identify.')</option>'; @@ -56,12 +60,12 @@ //build Select box with Father Classes $query="SELECT father FROM classhierarchy WHERE child='$class'"; - $res=mysql_query($query); + $res=$databaseConnection->query($query); $fatherClasses=''; - while ($result=mysql_fetch_array($res)){ + while ($result=$databaseConnection->nextEntry($res)){ $query="SELECT label FROM categories WHERE category='".$result['father']."' LIMIT 1"; - $res2=mysql_query($query); - $result2=mysql_fetch_array($res2); + $res2=$databaseConnection->query($query); + $result2=$databaseConnection->nextEntry($res2); $identify=urldecode(str_replace("_"," ",substr (strrchr ($result['father'], "/"), 1))); if ((strlen($identify)+strlen($result2['label']))>100) $identify=substr($identify,0,100-strlen($result2['label'])); $fatherClasses.='<option value="'.$result['father'].'">'.utf8_to_html($result2['label']).' ('.$identify.')</option>'; @@ -71,8 +75,8 @@ //build Title $query="SELECT label FROM categories WHERE category='$class' LIMIT 1"; - $res=mysql_query($query); - $result=mysql_fetch_array($res); + $res=$databaseConnection->query($query); + $result=$databaseConnection->nextEntry($res); $title=$result['label']; $content.=getClassView($fatherClasses,$childClasses,$title,$class); Modified: trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php 2008-09-14 19:13:22 UTC (rev 1203) +++ trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php 2008-09-15 07:43:31 UTC (rev 1204) @@ -1,5 +1,7 @@ <?php - include('helper_functions.php'); + include_once('helper_functions.php'); + include_once('Settings.php'); + include_once('DatabaseConnection.php'); $category=$_POST['category']; $number=$_POST['number']; @@ -14,26 +16,29 @@ $content=""; $bestsearches=""; - mysql_connect($mysqlServer,$mysqlUser,$mysqlPass); - mysql_select_db("navigator_db"); + //connect to the database + $settings=new Settings(); + $databaseConnection=new DatabaseConnection($settings->database_type); + $databaseConnection->connect($settings->database_server,$settings->database_user,$settings->database_pass); + $databaseConnection->select_database($settings->database_name); //get label of the category $query="SELECT label FROM categories WHERE category='$category' LIMIT 1"; - $res=mysql_query($query); - $result=mysql_fetch_array($res); + $res=$databaseConnection->query($query); + $result=$databaseConnection->nextEntry($res); $label=$result['label']; $query="SELECT name FROM articlecategories WHERE category='$category' ORDER BY number DESC LIMIT ".$number; - $res=mysql_query($query); + $res=$databaseConnection->query($query); $bestsearches=""; - if (mysql_num_rows($res)>0){ + if ($databaseConnection->numberOfEntries($res)>0){ $names=array(); $labels=array(); - while ($result=mysql_fetch_array($res)){ + while ($result=$databaseConnection->nextEntry($res)){ $names[]=$result['name']; $query="SELECT label FROM rank WHERE name='".$result['name']."' LIMIT 1"; - $res2=mysql_query($query); - $result2=mysql_fetch_array($res2); + $res2=$databaseConnection->query($query); + $result2=$databaseConnection->nextEntry($res2); $labels[]=$result2['label']; } $content.=getCategoryResultsTable($names,$labels,$category,$number); Modified: trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php 2008-09-14 19:13:22 UTC (rev 1203) +++ trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php 2008-09-15 07:43:31 UTC (rev 1204) @@ -1,7 +1,8 @@ <?php include('helper_functions.php'); - $concept=$_POST['concept']; + $manchester=$_POST['manchester']; + $kb=$_POST['kb']; session_start(); $id=$_SESSION['id']; @@ -12,8 +13,11 @@ $concept=html_entity_decode($concept); - $test=preg_match("/^http://dbpedia.org/class/yago/[^/]+$/",$concept); + $test=preg_match("/(http:\/\/dbpedia\.org\/class\/yago\/[^\040]+(\040)*(AND|OR)*)+/",$manchester); + if ($test){ + + } $content=""; /*try{ require_once("DLLearnerConnection.php"); Modified: trunk/src/dbpedia-navigator/ajax_learn_concepts.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-09-14 19:13:22 UTC (rev 1203) +++ trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-09-15 07:43:31 UTC (rev 1204) @@ -29,7 +29,7 @@ $concept.="<table border=0>\n"; $concept.="<tr><td>You could also be interested in articles matching these descriptions:</td></tr>"; foreach ($concepts as $con){ - $concept.="<tr><td><a href=\"\" onclick=\"getSubjectsFromConcept('concept=".htmlentities($con['descriptionManchesterSyntax'])."');return false;\" />".$con['NaturalLanguage']."</a> (Accuracy: ".(floatVal($con['accuracy'])*100)."%)</td></tr>"; + $concept.="<tr><td><a href=\"\" onclick=\"getSubjectsFromConcept('manchester=".htmlentities($con['descriptionManchesterSyntax'])."&kb=".htmlentities($con['descriptionKBSyntax'])."');return false;\" />".$con['NaturalLanguage']."</a> (Accuracy: ".(floatVal($con['accuracy'])*100)."%)</td></tr>"; } $concept.="</table>"; } Modified: trunk/src/dbpedia-navigator/ajax_search.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_search.php 2008-09-14 19:13:22 UTC (rev 1203) +++ trunk/src/dbpedia-navigator/ajax_search.php 2008-09-15 07:43:31 UTC (rev 1204) @@ -1,5 +1,7 @@ <?php - include('helper_functions.php'); + include_once('helper_functions.php'); + include_once('Settings.php'); + include_once('DatabaseConnection.php'); $label=urldecode($_POST['label']); $number=$_POST['number']; @@ -12,24 +14,28 @@ //initialise content $content=""; - mysql_connect($mysqlServer,$mysqlUser,$mysqlPass); - mysql_select_db("navigator_db"); + //connect to the database + $settings=new Settings(); + $databaseConnection=new DatabaseConnection($settings->database_type); + $databaseConnection->connect($settings->database_server,$settings->database_user,$settings->database_pass); + $databaseConnection->select_database($settings->database_name); + $query="SELECT name, label FROM rank WHERE MATCH (label) AGAINST ('$label') ORDER BY number DESC LIMIT ".$number; - $res=mysql_query($query); + $res=$databaseConnection->query($query); $bestsearches=""; - if (mysql_num_rows($res)>0){ + if ($databaseConnection->numberOfEntries($res)>0){ $names=array(); $labels=array(); $classes=array(); $tags=array(); $catlabels=array(); - while ($result=mysql_fetch_array($res)){ + while ($result=$databaseConnection->nextEntry($res)){ $labels[]=$result['label']; $names[]=$result['name']; $query="SELECT category FROM articlecategories WHERE name='".$result['name']."'"; - $res3=mysql_query($query); + $res3=$databaseConnection->query($query); $arr=array(); - while ($result3=mysql_fetch_array($res3)){ + while ($result3=$databaseConnection->nextEntry($res3)){ $arr[]=$result3['category']; } if (count($arr)==0){ @@ -44,8 +50,8 @@ if (!isset($tags[$arr[$i]])) $tags[$arr[$i]]=1; else $tags[$arr[$i]]++; $query="SELECT label FROM categories WHERE category='".$arr[$i]."' LIMIT 1"; - $res2=mysql_query($query); - $result2=mysql_fetch_array($res2); + $res2=$databaseConnection->query($query); + $result2=$databaseConnection->nextEntry($res2); if (!isset($catlabels[$arr[$i]])) $catlabels[$arr[$i]]=$result2['label']; } } Modified: trunk/src/dbpedia-navigator/ajax_set_positives_and_negatives.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_set_positives_and_negatives.php 2008-09-14 19:13:22 UTC (rev 1203) +++ trunk/src/dbpedia-navigator/ajax_set_positives_and_negatives.php 2008-09-15 07:43:31 UTC (rev 1204) @@ -1,5 +1,7 @@ <?php - include('helper_functions.php'); + include_once('helper_functions.php'); + include_once('Settings.php'); + include_once('DatabaseConnection.php'); $positives=$_POST['positives']; $negatives=$_POST['negatives']; @@ -9,22 +11,25 @@ if (strlen($negatives)>0) $negatives=explode('][',substr($negatives,1,strlen($negatives)-2)); else $negatives=array(); - mysql_connect($mysqlServer,$mysqlUser,$mysqlPass); - mysql_select_db("navigator_db"); + //connect to the database + $settings=new Settings(); + $databaseConnection=new DatabaseConnection($settings->database_type); + $databaseConnection->connect($settings->database_server,$settings->database_user,$settings->database_pass); + $databaseConnection->select_database($settings->database_name); $ptemp=array(); foreach ($positives as $pos){ $query="SELECT label FROM rank WHERE name='$pos' LIMIT 1"; - $res=mysql_query($query); - $result=mysql_fetch_array($res); + $res=$databaseConnection->query($query); + $result=$databaseConnection->nextEntry($res); $ptemp[$pos]=$result['label']; } $ntemp=array(); foreach ($negatives as $neg){ $query="SELECT label FROM rank WHERE name='$neg' LIMIT 1"; - $res=mysql_query($query); - $result=mysql_fetch_array($res); + $res=$databaseConnection->query($query); + $result=$databaseConnection->nextEntry($res); $ntemp[$neg]=$result['label']; } Modified: trunk/src/dbpedia-navigator/helper_functions.php =================================================================== --- trunk/src/dbpedia-navigator/helper_functions.php 2008-09-14 19:13:22 UTC (rev 1203) +++ trunk/src/dbpedia-navigator/helper_functions.php 2008-09-15 07:43:31 UTC (rev 1204) @@ -235,13 +235,19 @@ } function formatClassArray($ar) { - mysql_connect($mysqlServer,$mysqlUser,$mysqlPass); - mysql_select_db("navigator_db"); + include_once('Settings.php'); + include_once('DatabaseConnection.php'); + //connect to the database + $settings=new Settings(); + $databaseConnection=new DatabaseConnection($settings->database_type); + $databaseConnection->connect($settings->database_server,$settings->database_user,$settings->database_pass); + $databaseConnection->select_database($settings->database_name); + $string="<ul>"; for($i=0; $i<count($ar); $i++) { $query="SELECT label FROM categories WHERE category='".$ar[$i]['value']."' LIMIT 1"; - $res=mysql_query($query); - $result=mysql_fetch_array($res); + $res=$databaseConnection->query($query); + $result=$databaseConnection->nextEntry($res); if ($ar[$i]['value']!="http://xmlns.com/foaf/0.1/Person") $string .= '<li>' . formatClass($ar[$i]['value'],$result['label']).'</li>'; } return $string."</ul>"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-09-15 07:59:23
|
Revision: 1208 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1208&view=rev Author: sknappe Date: 2008-09-15 07:59:19 +0000 (Mon, 15 Sep 2008) Log Message: ----------- put all javascript functions into js files Modified Paths: -------------- trunk/src/dbpedia-navigator/index.php Added Paths: ----------- trunk/src/dbpedia-navigator/DatabaseConnection.php trunk/src/dbpedia-navigator/js/navigator.js Added: trunk/src/dbpedia-navigator/DatabaseConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DatabaseConnection.php (rev 0) +++ trunk/src/dbpedia-navigator/DatabaseConnection.php 2008-09-15 07:59:19 UTC (rev 1208) @@ -0,0 +1,42 @@ +<?php + +//handles connection to the database, at the moment only supports mysql-Database +class DatabaseConnection{ + + var $type; + + function DatabaseConnection($type){ + $this->type=$type; + } + + function connect($server,$user,$pass){ + if ($this->type=='mysql'){ + mysql_connect($server,$user,$pass); + } + } + + function select_database($database){ + if ($this->type=='mysql'){ + mysql_select_db($database); + } + } + + function query($query){ + if ($this->type=='mysql'){ + return mysql_query($query); + } + } + + function nextEntry($result){ + if ($this->type=='mysql'){ + return mysql_fetch_array($result); + } + } + + function numberOfEntries($result){ + if ($this->type=='mysql'){ + return mysql_num_rows($result); + } + } +} +?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-09-15 07:55:05 UTC (rev 1207) +++ trunk/src/dbpedia-navigator/index.php 2008-09-15 07:59:19 UTC (rev 1208) @@ -41,70 +41,7 @@ <script src="http://maps.google.com/maps?file=api&v=2&key=<?php print $settings->googleMapsKey;?>" type="text/javascript"></script> <script src="js/ajax.js"></script> - <script type="text/javascript"> - function setRunning(running) - { - if (running) document.getElementById('Loading').style.display='inline'; - else document.getElementById('Loading').style.display='none'; - } - - function loadGoogleMap(Lat,Lng,Label) { - 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)); - map.addOverlay(marker); - } - } - - function show_results(class, number) - { - var links=document.getElementById('results').getElementsByTagName('p'); - var j=0; - var names; - var hasClass; - for (var i=0;i<links.length;i++){ - if (class=='all'){ - if ((j+1)>number&&j<(number+25)) links[i].style.display='block'; - else links[i].style.display='none'; - j++; - } - else{ - names=links[i].getElementsByTagName('a')[0].className.split(' '); - hasClass=false; - for (var k=0;k<names.length;k++){ - if (names[k]==class){ - hasClass=true; - break; - } - } - if (hasClass){ - if ((j+1)>number&&j<(number+25)) links[i].style.display='block'; - else links[i].style.display='none'; - j++; - } - else links[i].style.display='none'; - } - } - if (j<number){ - show_results(class,0); - return; - } - - var sitenumbers=document.getElementById('sitenumbers').getElementsByTagName('span'); - for (var i=0;i<sitenumbers.length;i++){ - if ((parseInt(sitenumbers[i].getElementsByTagName('a')[0].innerHTML)-1)*25==number) sitenumbers[i].getElementsByTagName('a')[0].style.textDecoration='none'; - else sitenumbers[i].getElementsByTagName('a')[0].style.textDecoration='underline'; - if ((parseInt(sitenumbers[i].getElementsByTagName('a')[0].innerHTML)-1)*25>=j) - sitenumbers[i].style.display='none'; - else - sitenumbers[i].style.display='inline'; - } - } - </script> + <script src="js/navigator.js"></script> </head> <body <?php print $onLoad;?>> Added: trunk/src/dbpedia-navigator/js/navigator.js =================================================================== --- trunk/src/dbpedia-navigator/js/navigator.js (rev 0) +++ trunk/src/dbpedia-navigator/js/navigator.js 2008-09-15 07:59:19 UTC (rev 1208) @@ -0,0 +1,63 @@ +function setRunning(running) +{ + if (running) document.getElementById('Loading').style.display='inline'; + else document.getElementById('Loading').style.display='none'; +} + +function loadGoogleMap(Lat,Lng,Label) +{ + 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)); + map.addOverlay(marker); + } +} + +function show_results(class, number) +{ + var links=document.getElementById('results').getElementsByTagName('p'); + var j=0; + var names; + var hasClass; + for (var i=0;i<links.length;i++){ + if (class=='all'){ + if ((j+1)>number&&j<(number+25)) links[i].style.display='block'; + else links[i].style.display='none'; + j++; + } + else{ + names=links[i].getElementsByTagName('a')[0].className.split(' '); + hasClass=false; + for (var k=0;k<names.length;k++){ + if (names[k]==class){ + hasClass=true; + break; + } + } + if (hasClass){ + if ((j+1)>number&&j<(number+25)) links[i].style.display='block'; + else links[i].style.display='none'; + j++; + } + else links[i].style.display='none'; + } + } + if (j<number){ + show_results(class,0); + return; + } + + var sitenumbers=document.getElementById('sitenumbers').getElementsByTagName('span'); + for (var i=0;i<sitenumbers.length;i++){ + if ((parseInt(sitenumbers[i].getElementsByTagName('a')[0].innerHTML)-1)*25==number) sitenumbers[i].getElementsByTagName('a')[0].style.textDecoration='none'; + else sitenumbers[i].getElementsByTagName('a')[0].style.textDecoration='underline'; + if ((parseInt(sitenumbers[i].getElementsByTagName('a')[0].innerHTML)-1)*25>=j) + sitenumbers[i].style.display='none'; + else + sitenumbers[i].style.display='inline'; + } +} \ 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-09-16 00:09:56
|
Revision: 1216 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1216&view=rev Author: sknappe Date: 2008-09-16 07:09:53 +0000 (Tue, 16 Sep 2008) Log Message: ----------- changed some files to work with the new way natural language description is called and put old files into a folder Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/ajax_learn_concepts.php Added Paths: ----------- trunk/src/dbpedia-navigator/database.sql trunk/src/dbpedia-navigator/old/ trunk/src/dbpedia-navigator/old/NaturalConcepts.php trunk/src/dbpedia-navigator/old/ajax.php trunk/src/dbpedia-navigator/old/ajaxfunctions.php trunk/src/dbpedia-navigator/old/index-old.php Removed Paths: ------------- trunk/src/dbpedia-navigator/NaturalConcepts.php trunk/src/dbpedia-navigator/ajax.php trunk/src/dbpedia-navigator/ajaxfunctions.php trunk/src/dbpedia-navigator/index-old.php trunk/src/dbpedia-navigator/localhost.sql Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-09-16 07:08:33 UTC (rev 1215) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-09-16 07:09:53 UTC (rev 1216) @@ -113,6 +113,11 @@ return json_decode($this->client->getCurrentlyBestEvaluatedDescriptions($this->id,3),true); } + function getNaturalDescription($concept) + { + return $this->client->getNaturalDescription($concept); + } + function getConceptDepth() { return $this->client->getConceptDepth($this->id,3)->item; Deleted: trunk/src/dbpedia-navigator/NaturalConcepts.php =================================================================== --- trunk/src/dbpedia-navigator/NaturalConcepts.php 2008-09-16 07:08:33 UTC (rev 1215) +++ trunk/src/dbpedia-navigator/NaturalConcepts.php 2008-09-16 07:09:53 UTC (rev 1216) @@ -1,121 +0,0 @@ -<?php - -class NaturalConcepts -{ - private $concept; - - function NaturalConcepts($conc){ - $this->concept=$conc; - } - - function getNaturalConcept(){ - $identifiedConcepts=$this->identifyConcepts(); - $labels=$this->getLabels($identifiedConcepts); - return $identifiedConcepts; - } - - function identifyConcepts() - { - $temp=$this->concept; - $ret=array(); - $offset=0; - while (true){ - $nextpos=strpos($temp,"http",$offset); - if (!$nextpos) break; - $nextend=preg_match("/\040|.TOP|.BOTTOM|.EXISTS|.ALL|.\(/",$temp,$treffer,PREG_OFFSET_CAPTURE,$nextpos); - if (!$nextend){ - $uri=substr($temp,$nextpos,strlen($temp)-$nextpos); - $ret[]=$uri; - break; - } - $uri=substr($temp,$nextpos,$treffer[0][1]-$nextpos); - $ret[]=$uri; - $offset=$treffer[0][1]; - } - - return $ret; - } - - function getLabels($conc) - { - $query="SELECT DISTINCT "; - for ($i=0;$i<count($conc)-1;$i++) - $query.="?obj".$i.", "; - $query.="?obj".$i."\n"; - $query.="WHERE {\n"; - foreach ($conc as $key=>$con){ - $query.="<".$con."> <http://www.w3.org/2000/01/rdf-schema#label> ?obj".$key.".\n"; - } - $query.="}"; - print $query; - return $query; - } - - function getSparqlQuery() - { - $temp=$this->concept; - $andOrParts=$this->getAndOrParts($temp); - print_r($andOrParts); - } - - function getAndOrParts($temp) - { - $split=preg_split("/(OR)|(AND)/",$temp,-1,PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY); - $bracket=0; - $arr=array(); - $temppart=""; - foreach ($split as $part){ - $part=trim($part); - if (strpos($part,"(")===0){ - $bracket+=substr_count($part,"("); - } - if ($bracket>0){ - if (($part=="AND")||($part=="OR")) $temppart.=" ".$part." "; - else $temppart.=$part; - } - else{ - if ((!strpos($part,"AND"))&&(!strpos($part,"OR"))) $arr[]=$part; - else $arr[]=$this->getAndOrParts($part); - } - if ((strrpos($part,')')==(strlen($part)-1))&&($bracket>0)){ - $bracket-=substr_count($part,")"); - if ($bracket==0){ - if ((!strpos($temppart,"AND"))&&(!strpos($temppart,"OR"))) $arr[]=substr($temppart,1,strlen($temppart)-2); - else $arr[]=$this->getAndOrParts(substr($temppart,1,strlen($temppart)-2)); - $temppart=""; - } - } - } - return $arr; - } - - function isExistsConstruct($construct) - { - if (!(strpos($construct,"EXISTS")===0)) return false; - $split=preg_split("/(EXISTS \".*\")\./",$construct,-1,PREG_SPLIT_NO_EMPTY); - $afterdot=$split[0]; - print $afterdot; - $bracket=0; - $offset=0; - do{ - $nextBracketOn=strpos($afterdot,"(",$offset); - $nextBracketOff=strpos($afterdot,")",$offset); - print "On: ".$nextBracketOn+1; - print "Off: ".$nextBracketOff+1; - $min=min($nextBracketOn,$nextBracketOff); - print $min+1; - if ($nextBracketOn==$min) $bracket++; - if ($nextBracketOff==$min) $bracket--; - $offset=$min; - } while(($bracket>0)||($offset>=strlen($afterdot)-1)); - print ($offset); - return true; - } -} - -//$conc="(EXISTS http://dbpedia.org/property/website.(http://dbpedia.org/resource/Berlin AND http://dbpedia.org/resource/Berlin) OR (http://dbpedia.org/resource/Berlin AND http://dbpedia.org/resource/Berlin)) OR http://dbpedia.org/resource/Berlin"; -$conc="EXISTS \"http://dbpedia.org/property/website\".(http://dbpedia.org/resource/Berlin AND http://dbpedia.org/resource/Berlin)"; -$nc=new NaturalConcepts($conc); -$ic=$nc->isExistsConstruct($conc); -//print_r($ic); -?> \ No newline at end of file Deleted: trunk/src/dbpedia-navigator/ajax.php =================================================================== --- trunk/src/dbpedia-navigator/ajax.php 2008-09-16 07:08:33 UTC (rev 1215) +++ trunk/src/dbpedia-navigator/ajax.php 2008-09-16 07:09:53 UTC (rev 1216) @@ -1,33 +0,0 @@ -<?php -require_once ("xajax/xajax_core/xajax.inc.php"); -$sid = session_id(); -if (isset($_GET['path'])) $path=$_GET['path']; -else $path=""; - -$xajax = new xajax($path."ajaxfunctions.php?sid=$sid&path=".$path); -$xajax->configureMany(array('debug'=>true)); - -$xajax->register(XAJAX_FUNCTION, 'getsubjects', array( - 'onResponseDelay' => 'showLoading', - 'beforeResponseProcessing' => 'hideLoading' - )); -$xajax->register(XAJAX_FUNCTION,'getarticle', array( - 'onResponseDelay' => 'showLoading', - 'beforeResponseProcessing' => 'hideLoading' - )); -$xajax->register(XAJAX_FUNCTION,'learnConcept', array( - 'onResponseDelay' => 'showLoading', - 'beforeResponseProcessing' => 'hideLoading' - )); -$xajax->register(XAJAX_FUNCTION,'getSubjectsFromConcept', array( - 'onResponseDelay' => 'showLoading', - 'beforeResponseProcessing' => 'hideLoading' - )); - $xajax->registerFunction('toPositive'); -$xajax->registerFunction('toNegative'); -$xajax->registerFunction('clearPositives'); -$xajax->registerFunction('clearNegatives'); -$xajax->registerFunction('removePosInterest'); -$xajax->registerFunction('removeNegInterest'); -$xajax->registerFunction('stopServerCall'); -?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/ajax_learn_concepts.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-09-16 07:08:33 UTC (rev 1215) +++ trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-09-16 07:09:53 UTC (rev 1216) @@ -29,7 +29,8 @@ $concept.="<table border=0>\n"; $concept.="<tr><td>You could also be interested in articles matching these descriptions:</td></tr>"; foreach ($concepts as $con){ - $concept.="<tr><td><a href=\"\" onclick=\"getSubjectsFromConcept('manchester=".htmlentities($con['descriptionManchesterSyntax'])."&kb=".htmlentities($con['descriptionKBSyntax'])."');return false;\" />".$con['NaturalLanguage']."</a> (Accuracy: ".(floatVal($con['accuracy'])*100)."%)</td></tr>"; + $label=$sc->getNaturalDescription($con['descriptionKBSyntax']); + $concept.="<tr><td><a href=\"\" onclick=\"getSubjectsFromConcept('manchester=".htmlentities($con['descriptionManchesterSyntax'])."&kb=".htmlentities($con['descriptionKBSyntax'])."');return false;\" />".$label."</a> (Accuracy: ".(floatVal($con['accuracy'])*100)."%)</td></tr>"; } $concept.="</table>"; } Deleted: trunk/src/dbpedia-navigator/ajaxfunctions.php =================================================================== --- trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-09-16 07:08:33 UTC (rev 1215) +++ trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-09-16 07:09:53 UTC (rev 1216) @@ -1,616 +0,0 @@ -<?php -ini_set('max_execution_time',200); - -require("ajax.php"); -$xajax->processRequest(); - -function getsubjects($label,$list) -{ - $sid = $_GET['sid']; - session_id($sid); - session_start(); - $id=$_SESSION['id']; - $ksID=$_SESSION['ksID']; - session_write_close(); - - setRunning($id,"true"); - - //get parts of the list - $checkedInstances=preg_split("[,]",$list,-1,PREG_SPLIT_NO_EMPTY); - - //initialise content - $content=""; - try{ - require_once("DLLearnerConnection.php"); - $sc=new DLLearnerConnection($id,$ksID); - - $subjects=$sc->getSubjects($label,$checkedInstances); - - $content.=getTagCloud($subjects['tagcloud'],$subjects['tagcloudlabel']); - $content.=getResultsTable($subjects['subjects']); - } catch (Exception $e){ - $content=$e->getMessage(); - } - - $objResponse = new xajaxResponse(); - $objResponse->assign("articlecontent", "innerHTML", $content); - $objResponse->assign("ArticleTitle","innerHTML","Searchresult for ".$label); - return $objResponse; -} - -function getarticle($subject,$fromCache) -{ - $sid = $_GET['sid']; - session_id($sid); - session_start(); - if (isset($_SESSION['articles'])) $articles=$_SESSION['articles']; - $id=$_SESSION['id']; - $ksID=$_SESSION['ksID']; - session_write_close(); - setRunning($id,"true"); - - //get first Letter of label big - $uri=subjectToURI($subject); - - //if article is in session, get it out of the session - if (isset($articles)){ - foreach ($articles as $key => $value) - { - if ($value['subject']==$subject){ - $fromCache=$key; - break; - } - } - } - - //initialize the content variables - $content=""; - $searchResult=""; - $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 - //if $fromCache is >=0, the article is taken out of the cache - if ($fromCache<0) { - //if there are errors see catch block - try{ - require_once("DLLearnerConnection.php"); - $sc=new DLLearnerConnection($id,$ksID); - $triples=$sc->getTriples($uri); - - //BUILD ARTICLE - // goal: display the data in a nice (DBpedia specific way), maybe similar to - // dbpedia.org/search - - // 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]['value'].'" alt="Picture of '.$subject.'" style="float:right; max-width:200px;" \>'; - - //display where it was redirected from, if it was redirected - $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]['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]['value'].'">view Wikipedia article</a>, '; - $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'])) - $content .= '<p>classes: '.formatClassArray($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type']).'</p>'; - - 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['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: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/>'.get_triple_table($triples); - - //Restart the Session - session_start(); - - //store article in session, to navigate between last 5 articles quickly - $contentArray=array('content' => $content,'subject' => $artTitle); - if (!isset($_SESSION['nextArticle'])){ - $_SESSION['nextArticle']=0; - $_SESSION['articles']=array(); - } - if ($_SESSION['nextArticle']==5) $_SESSION['nextArticle']=0; - $_SESSION['articles'][$_SESSION['nextArticle']]=$contentArray; - $_SESSION['currentArticle']=$_SESSION['nextArticle']; - $_SESSION['nextArticle']++; - - //Add Positives to Session - if (!isset($_SESSION['positive'])){ - 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 ($redirect!="") $array[$redirect] = $redirect; - else $array["http://dbpedia.org/resource/".str_replace(" ","_",$subject)]="http://dbpedia.org/resource/".str_replace(" ","_",$subject); - $_SESSION['positive']=$array; - } - - } catch (Exception $e) - { - $content=$e->getMessage(); - $artTitle="No Result"; - $objResponse->call('xajax_getsubjects',$subject); - } - } - else { - session_start(); - //Article is in session - $content=$_SESSION['articles'][$fromCache]['content']; - $artTitle=$_SESSION['articles'][$fromCache]['subject']; - } - - //Build lastArticles - if (isset($_SESSION['articles'])){ - foreach ($_SESSION['articles'] as $key => $value) - { - $lastArticles.="<a href=\"\" onclick=\"xajax_getarticle('',".$key.");return false;\">".$value['subject']."</a><br/>"; - } - } - - //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->assign("articlecontent", "innerHTML", $content); - $objResponse->assign("ArticleTitle","innerHTML",$artTitle); - $objResponse->assign("lastarticles","innerHTML",$lastArticles); - $objResponse->assign('Positives','innerHTML',$posInterests); - $objResponse->assign('Negatives','innerHTML',$negInterests); - $objResponse->call('xajax_learnConcept'); - return $objResponse; -} - -function toPositive($subject) -{ - $sid = $_GET['sid']; - session_id($sid); - session_start(); - unset($_SESSION['negative'][$subject]); - if (!isset($_SESSION['positive'])){ - $array=array($subject => $subject); - $_SESSION['positive']=$array; - } - else{ - $array=$_SESSION['positive']; - $array[$subject]=$subject; - $_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->assign('Positives','innerHTML',$posInterests); - $objResponse->assign('Negatives','innerHTML',$negInterests); - return $objResponse; -} - -function toNegative($subject) -{ - $sid = $_GET['sid']; - session_id($sid); - session_start(); - unset($_SESSION['positive'][$subject]); - if (!isset($_SESSION['negative'])){ - $array=array($subject => $subject); - $_SESSION['negative']=$array; - } - else{ - $array=$_SESSION['negative']; - $array[$subject]=$subject; - $_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->assign('Positives','innerHTML',$posInterests); - $objResponse->assign('Negatives','innerHTML',$negInterests); - return $objResponse; -} - -function clearPositives() -{ - $sid = $_GET['sid']; - session_id($sid); - session_start(); - unset($_SESSION['positive']); - - $objResponse = new xajaxResponse(); - $objResponse->assign("Positives", "innerHTML", ""); - return $objResponse; -} - -function clearNegatives() -{ - $sid = $_GET['sid']; - session_id($sid); - session_start(); - unset($_SESSION['negative']); - - $objResponse = new xajaxResponse(); - $objResponse->assign("Negatives", "innerHTML", ""); - return $objResponse; -} - -function removePosInterest($subject) -{ - $sid = $_GET['sid']; - session_id($sid); - 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->assign('Positives','innerHTML',$posInterests); - $objResponse->assign('Negatives','innerHTML',$negInterests); - return $objResponse; -} - -function removeNegInterest($subject) -{ - $sid = $_GET['sid']; - session_id($sid); - 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->assign('Positives','innerHTML',$posInterests); - $objResponse->assign('Negatives','innerHTML',$negInterests); - return $objResponse; -} - -function learnConcept() -{ - $sid = $_GET['sid']; - session_id($sid); - session_start(); - - if (isset($_SESSION['positive'])) $positives=$_SESSION['positive']; - if (isset($_SESSION['negative'])) $negatives=$_SESSION['negative']; - $id=$_SESSION['id']; - $ksID=$_SESSION['ksID']; - session_write_close(); - setRunning($id,"true"); - $concept=""; - $conceptinformation=""; - if (isset($positives)) - { - $posArray=array(); - foreach ($positives as $pos) - $posArray[]=$pos; - $negArray=array(); - if (isset($negatives)) - foreach ($negatives as $neg) - $negArray[]=$neg; - - require_once("DLLearnerConnection.php"); - $sc=new DLLearnerConnection($id, $ksID); - try{ - $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('".urlencode($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>"; - $i++; - } - $concept.="</table>"; - } catch(Exception $e){ - $concept.=$e->getMessage(); - } - } - else $concept="You must choose at least one positive example."; - - $objResponse = new xajaxResponse(); - $objResponse->assign("conceptlink", "innerHTML", $concept); - $objResponse->assign("ConceptInformation", "innerHTML", $conceptinformation); - return $objResponse; -} - -function getSubjectsFromConcept($concept) -{ - $sid = $_GET['sid']; - session_id($sid); - session_start(); - $id=$_SESSION['id']; - $ksID=$_SESSION['ksID']; - session_write_close(); - - setRunning($id,"true"); - - $concept=html_entity_decode($concept); - $content=""; - try{ - require_once("DLLearnerConnection.php"); - $sc=new DLLearnerConnection($id,$ksID); - $subjects=$sc->getSubjectsFromConcept($concept); - $content.=getResultsTable($subjects); - } catch (Exception $e){ - $content=$e->getMessage(); - } - - $objResponse = new xajaxResponse(); - $objResponse->assign("articlecontent", "innerHTML", $content); - $objResponse->assign("ArticleTitle", "innerHTML", "Search Results"); - return $objResponse; -} - -function stopServerCall() -{ - $sid = $_GET['sid']; - session_id($sid); - session_start(); - $id=$_SESSION['id']; - session_write_close(); - setRunning($id,"false"); - $objResponse=new xajaxResponse(); - return $objResponse; -} - -/////////////////////// -// Helper Functions. // -/////////////////////// - -function subjectToURI($subject) -{ - //if the subject is already a URI return it - if (strpos($subject,"http://dbpedia.org/resource/")===0) - return $subject; - //delete whitespaces at beginning and end - $subject=trim($subject); - //get first letters big - $subject=ucfirst($subject); - //replace spaces with _ - $subject=str_replace(' ','_',$subject); - //add the uri - $subject="http://dbpedia.org/resource/".$subject; - - return $subject; -} - -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;"; - - $tag_with_entities=htmlentities("\"".$tag."\""); - $ret.='<a style="'.$style.'" href="#" onclick="xajax_getSubjectsFromConcept(\''.$tag_with_entities.'\');">'.$label[$tag].'</a>'; - } - $ret.="</p>"; - return $ret; -} - -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('".$result."',-1);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"); - $file=fopen("./temp/".$id.".temp","w"); - fwrite($file, $running); - fclose($file); -} - -function get_triple_table($triples) { - - $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) { - if ($element['type']=="uri") $table .= '<li><a href="'.$element['value'].'">'.$element['value'].'</a></li>'; - else $table .= '<li>'.$element['value'].'</li>'; - } - $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]['value']); - for($i=1; $i<count($ar); $i++) { - $string .= ', ' . formatClass($ar[$i]['value']); - } - return $string; -} - -// format a class nicely, i.e. link to it and possibly display -// it in a better way -function formatClass($className) { - $yagoPrefix = 'http://dbpedia.org/class/yago/'; - if(substr($className,0,30)==$yagoPrefix) { - return '<a href="'.$className.'">'.substr($className,30).'</a>'; - // DBpedia is Linked Data, so it makes always sense to link it - // ToDo: instead of linking to other pages, the resource should better - // be openened within DBpedia Navigator - } else if(substr($className,0,14)=='http://dbpedia') { - return '<a href="'.$className.'">'.$className.'</a>'; - } else { - return $className; - } -} - -function arrayToCommaSseparatedList($ar) { - $string = $ar[0]; - for($i=1; $i<count($ar); $i++) { - $string .= ', ' . $ar[$i]; - } - return $string; -} - -?> \ No newline at end of file Copied: trunk/src/dbpedia-navigator/database.sql (from rev 1124, trunk/src/dbpedia-navigator/localhost.sql) =================================================================== --- trunk/src/dbpedia-navigator/database.sql (rev 0) +++ trunk/src/dbpedia-navigator/database.sql 2008-09-16 07:09:53 UTC (rev 1216) @@ -0,0 +1,90 @@ +-- phpMyAdmin SQL Dump +-- version 2.9.1 +-- http://www.phpmyadmin.net +-- +-- Host: localhost +-- Erstellungszeit: 20. August 2008 um 12:05 +-- Server Version: 5.0.67 +-- PHP-Version: 5.2.5 +-- +-- Datenbank: `navigator_db` +-- +CREATE DATABASE `navigator_db` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; +USE `navigator_db`; + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `articlecategories` +-- + +CREATE TABLE `articlecategories` ( + `id` int(11) NOT NULL auto_increment, + `name` varchar(330) NOT NULL, + `category` varchar(330) NOT NULL, + `number` int(8) default '0', + PRIMARY KEY (`id`), + KEY `Category` (`category`), + KEY `Names` (`name`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- +-- Daten für Tabelle `articlecategories` +-- + + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `categories` +-- + +CREATE TABLE `categories` ( + `category` varchar(330) NOT NULL, + `label` varchar(330) NOT NULL, + PRIMARY KEY (`category`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +-- +-- Daten für Tabelle `categories` +-- + + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `classhierarchy` +-- + +CREATE TABLE `classhierarchy` ( + `id` int(11) NOT NULL auto_increment, + `father` varchar(330) NOT NULL, + `child` varchar(330) NOT NULL, + PRIMARY KEY (`id`), + KEY `Father` (`father`), + KEY `Child` (`child`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- +-- Daten für Tabelle `classhierarchy` +-- + + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `rank` +-- + +CREATE TABLE `rank` ( + `name` varchar(330) NOT NULL, + `label` varchar(330) default NULL, + `number` int(8) NOT NULL default '0', + PRIMARY KEY (`name`), + FULLTEXT KEY `Label` (`label`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +-- +-- Daten für Tabelle `rank` +-- + Deleted: trunk/src/dbpedia-navigator/index-old.php =================================================================== --- trunk/src/dbpedia-navigator/index-old.php 2008-09-16 07:08:33 UTC (rev 1215) +++ trunk/src/dbpedia-navigator/index-old.php 2008-09-16 07:09:53 UTC (rev 1216) @@ -1,255 +0,0 @@ -<?php - -ini_set('error_reporting',E_ALL); -ini_set('max_execution_time',200); -ini_set("soap.wsdl_cache_enabled","1"); - -session_start(); -require_once('DLLearnerConnection.php'); -$sc=new DLLearnerConnection(); -$ids=$sc->getIDs(); -$_SESSION['id']=$ids[0]; -$_SESSION['ksID']=$ids[1]; - -if (isset($_GET['path'])) $path=$_GET['path']; -else $path=""; - -require_once 'Settings.php'; -$settings=new Settings(); - -//what happens onLoad -$onLoad="onLoad=\""; -if (isset($_GET['resource'])){ - $onLoad.="xajax_getarticle('".$_GET['resource']."',-1);"; - unset($_GET['resource']); -} -else if (isset($_SESSION['currentArticle'])){ - $onLoad.="xajax_getarticle('',".$_SESSION['currentArticle'].");"; -} -$onLoad.="\""; - -require("ajax.php"); - -echo '<?xml version="1.0" encoding="UTF-8"?>'; -?> -<!DOCTYPE html - PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> - <head> - <title>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 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'; - }; - hideLoading = function() { - xajax.$('Loading').style.display = 'none'; - //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'; - } - - function loadGoogleMap(Lat,Lng,Label) { - 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> - <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> -<div id="layer" style="display:none"> - <div id="layerContent" style="display:none"></div> -</div> - -<div id="wrapper"> - <div id="leftSidebar"> - - <div class="box"> - <div class="boxtitle">Search DBpedia</div> - <div class="boxcontent" id="search"> - <!-- 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="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 --> - </div> <!-- box --> - - <div class="box" id="SearchResultBox" style="display:none"> - <div class="boxtitle">Search Results</div> - <div class="boxcontent"> - <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="height:218px;overflow:auto;"> - </div> - </div> <!-- boxcontent --> - </div> <!-- box --> - <script> - 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> - - - <div class="box" id="credits"> - <p>DBpedia Navigator is powered by ... <br /> - <a href="http://dl-learner.org">DL-Learner</a><br /> - <a href="http//dbpedia.org">DBpedia</a><br/> - <a href="http://virtuoso.openlinksw.com/wiki/main/">OpenLink Virtuoso</a><br /> - ... and implemented by <a href="http://jens-lehmann.org">Jens Lehmann</a> 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="<?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> - - </div><!-- END leftSidebar --> - - <div id="content"> - <div class="box"> - <div class="boxtitle" id="ArticleTitle">Welcome</div> - <div class="boxcontent" id="article"> - <div id="articlecontent" style="display:block"> - <br /><br /> - Welcome to the DBpedia Navigator interface! DBpedia Navigator allows you to search DBpedia - and uses the background knowledge in DBpedia to suggest possible interesting navigation - links. - </div> - </div> <!-- boxcontent --> - </div> <!-- box --> - </div><!-- content --> - - <div id="rightSidebar"> - - <div class="box"> - <div class="boxtitlewithbutton" id="positivesboxtitle">search relevant <img src="<?php print $path;?>images/remove.png" onclick="xajax_clearPositives()" /> </div> - <div class="boxcontent" id="Positives"> - </div> <!-- boxcontent --> - </div> <!-- box --> - - <div class="box"> - <div class="boxtitlewithbutton" id="negativesboxtitle">not relevant <img src="<?php print $path;?>images/remove.png" onclick="xajax_clearNegatives()" /> </div> - <div class="boxcontent" id="Negatives"> - </div> <!-- boxcontent --> - </div> <!-- box --> - - <div class="box" id="LastArticlesBox" style="display:none"> - <div class="boxtitle">Articles Last Viewed</div> - <div class="boxcontent" id="lastarticles"> - </div> <!-- boxcontent --> - </div> <!-- box --> - - </div><!-- rightSidebar --> - - <!-- <div id="clear"></div> --> - -</div><!-- wrapper --> -<div id="footer"> - <p>Licensed under the GNU General Public License (GPL) 3 as part of the DL-Learner open source - project.<br />Copyright © Jens Lehmann 2007-2008 </p> - <div id="validation"> - <?php - $uri = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; - - echo '<div><a href="http://validator.w3.org/check?uri='.$uri.'"'; - echo '><img src="'.$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="'.$path.'images/valid-css.png" alt="valid CSS" /></a></div>'."\n"; - ?> - </div> - <p><a href='<?php print $path;?>rebuild.php'>rebuild [restart session and redownload WSDL file (for debugging)]</a></p> -</div> - -<div id="todo"> -<b>ToDo:</b> -<ul style="float:left"> - <li>Get learning component fast.</li> - <li>Get local DBpedia SPARQL endpoint working (next DBpedia release expected at the endof January and then every - two months, so it would be nice to have a script based partly automated or at least documented solution for - creating a DBpedia mirror).</li> - <li>Improve stability: Fix sometimes occurring PHP errors and warnings (check PHP error log).</li> - <li>For each result, display a "+" which shows more information about the concept in an overlay box, e.g. its - Description Logic or OWL syntax, its classification accuracy on the examples, and which - examples it classifies (in-)correctly.</li> - <li>Create a small number of test cases (e.g. 3), which can be used to verify that DBpedia Navigator is - working in typical scenarios (in particular cases where concepts with length greater one are learned).</li> - <li>Allow to disable caching functionality (in Settings.php).</li> - <li>Make DBpedia Navigator RESTful, e.g. URLs $base/showArticle/$URL for displaying an article; - $base/search/$phrase for searching; $base/listInstances/$complexClass for listing the instances of - a learned. Maybe session variables (in particuar the selected positive and negative examples) can - also be given, e.g. $base/search/$phrase?positives=[$URL1,$URL2,$URL3]&negatives=[$URL4]. The supported - URI design should be briefly documented (e.g. on a dbpedia.org wiki page). A good URI design allows - easier external access (just give someone a link instead of saying exactly which actions have to be done to - get to a state), simplifies debugging the application, and may be of use for creating further - features.</li> - <li>Improve search functionality [we will probably get feedback from Georgi in February].</li> - <li>[maybe] Display a tag cloud similar to <a href="http://dbpedia.org/search/">DBpedia search</a>.</li> - <li>[maybe] Instead of only allowing a search as entry point to the application, also display - a navigatable class tree.</li> - <li>[if possible] When expensive SPARQL queries or learning problems have been posed, there should be - some way to abandon these if the user has already switched to doing something else. Example: The user - has added 3 positive and 1 negative examples. This is executed as a learning problem, but has no solution (so - DL-Learner would run forever unless we pose some internal time limit). The user adds another negative example a - second later, so instead of letting the previous learning problem run for a long time (and needing much resources), - it should be stopped by DBpedia Navigator.</li> - <li>[if possible] Find an easy way to validate HTML/JS in AJAX applications.</li> - <li>[maybe] Would be interesting to somehow view the Wikipedia article (without the left navigation part, - tabs etc.) as an overlay, because the Wikipedia article will almost always be a human-friendlier - description of an object compared to the extracted one.</li> -</ul> -</div> - - <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> - - </body> -</html> - \ No newline at end of file Deleted: trunk/src/dbpedia-navigator/localhost.sql =================================================================== --- trunk/src/dbpedia-navigator/localhost.sql 2008-09-16 07:08:33 UTC (rev 1215) +++ trunk/src/dbpedia-navigator/localhost.sql 2008-09-16 07:09:53 UTC (rev 1216) @@ -1,90 +0,0 @@ --- phpMyAdmin SQL Dump --- version 2.9.1 --- http://www.phpmyadmin.net --- --- Host: localhost --- Erstellungszeit: 20. August 2008 um 12:05 --- Server Version: 5.0.67 --- PHP-Version: 5.2.5 --- --- Datenbank: `navigator_db` --- -CREATE DATABASE `navigator_db` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; -USE `navigator_db`; - --- -------------------------------------------------------- - --- --- Tabellenstruktur für Tabelle `articlecategories` --- - -CREATE TABLE `articlecategories` ( - `id` int(11) NOT NULL auto_increment, - `name` varchar(330) NOT NULL, - `category` varchar(330) NOT NULL, - `number` int(8) default '0', - PRIMARY KEY (`id`), - KEY `Category` (`category`), - KEY `Names` (`name`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; - --- --- Daten für Tabelle `articlecategories` --- - - --- -------------------------------------------------------- - --- --- Tabellenstruktur für Tabelle `categories` --- - -CREATE TABLE `categories` ( - `category` varchar(330) NOT NULL, - `label` varchar(330) NOT NULL, - PRIMARY KEY (`category`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- --- Daten für Tabelle `categories` --- - - --- -------------------------------------------------------- - --- --- Tabellenstruktur für Tabelle `classhierarchy` --- - -CREATE TABLE `classhierarchy` ( - `id` int(11) NOT NULL auto_increment, - `father` varchar(330) NOT NULL, - `child` varchar(330) NOT NULL, - PRIMARY KEY (`id`), - KEY `Father` (`father`), - KEY `Child` (`child`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; - --- --- Daten für Tabelle `classhierarchy` --- - - --- -------------------------------------------------------- - --- --- Tabellenstruktur für Tabelle `rank` --- - -CREATE TABLE `rank` ( - `name` varchar(330) NOT NULL, - `label` varchar(330) default NULL, - `number` int(8) NOT NULL default '0', - PRIMARY KEY (`name`), - FULLTEXT KEY `Label` (`label`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- --- Daten für Tabelle `rank` --- - Copied: trunk/src/dbpedia-navigator/old/NaturalConcepts.php (from rev 1124, trunk/src/dbpedia-navigator/NaturalConcepts.php) =================================================================== --- trunk/src/dbpedia-navigator/old/NaturalConcepts.php (rev 0) +++ trunk/src/dbpedia-navigator/old/NaturalConcepts.php 2008-09-16 07:09:53 UTC (rev 1216) @@ -0,0 +1,121 @@ +<?php + +class NaturalConcepts +{ + private $concept; + + function NaturalConcepts($conc){ + $this->concept=$conc; + } + + function getNaturalConcept(){ + $identifiedConcepts=$this->identifyConcepts(); + $labels=$this->getLabels($identifiedConcepts); + return $identifiedConcepts; + } + + function identifyConcepts() + { + $temp=$this->concept; + $ret=array(); + $offset=0; + while (true){ + $nextpos=strpos($temp,"http",$offset); + if (!$nextpos) break; + $nextend=preg_match("/\040|.TOP|.BOTTOM|.EXISTS|.ALL|.\(/",$temp,$treffer,PREG_OFFSET_CAPTURE,$nextpos); + if (!$nextend){ + $uri=substr($temp,$nextpos,strlen($temp)-$nextpos); + $ret[]=$uri; + break; + } + $uri=substr($temp,$nextpos,$treffer[0][1]-$nextpos); + $ret[]=$uri; + $offset=$treffer[0][1]; + } + + return $ret; + } + + function getLabels($conc) + { + $query="SELECT DISTINCT "; + for ($i=0;$i<count($conc)-1;$i++) + $query.="?obj".$i.", "; + $query.="?obj".$i."\n"; + $query.="WHERE {\n"; + foreach ($conc as $key=>$con){ + $query.="<".$con."> <http://www.w3.org/2000/01/rdf-schema#label> ?obj".$key.".\n"; + } + $query.="}"; + print $query; + return $query; + } + + function getSparqlQuery() + { + $temp=$this->concept; + $andOrParts=$this->getAndOrParts($temp); + print_r($andOrParts); + } + + function getAndOrParts($temp) + { + $split=preg_split("/(OR)|(AND)/",$temp,-1,PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY); + $bracket=0; + $arr=array(); + $temppart=""; + foreach ($split as $part){ + $part=trim($part); + if (strpos($part,"(")===0){ + $bracket+=substr_count($part,"("); + } + if ($bracket>0){ + if (($part=="AND")||($part=="OR")) $temppart.=" ".$part." "; + else $temppart.=$part; + } + else{ + if ((!strpos($part,"AND"))&&(!strpos($part,"OR"))) $arr[]=$part; + else $arr[]=$this->getAndOrParts($part); + } + if ((strrpos($part,')')==(strlen($part)-1))&&($bracket>0)){ + $bracket-=substr_count($part,")"); + if ($bracket==0){ + if ((!strpos($temppart,"AND"))&&(!strpos($temppart,"OR"))) $arr[]=substr($temppart,1,strlen($temppart)-2); + else $arr[]=$this->getAndOrParts(substr($temppart,1,strlen($temppart)-2)); + $temppart=""; + } + } + } + return $arr; + } + + function isExistsConstruct($construct) + { + if (!(strpos($construct,"EXISTS")===0)) return false; + $split=preg_split("/(EXISTS \".*\")\./",$construct,-1,PREG_SPLIT_NO_EMPTY); + $afterdot=$split[0]; + print $afterdot; + $bracket=0; + $offset=0; + do{ + $nextBracketOn=strpos($afterdot,"(",$offset); + $nextBracketOff=strpos($afterdot,")",$offset); + print "On: ".$nextBracketOn+1; + print "Off: ".$nextBracketOff+1; + $min=min($nextBracketOn,$nextBracketOff); + print $min+1; + if ($nextBracketOn==$min) $bracket++; + if ($nextBracketOff==$min) $bracket--; + $offset=$min; + } while(($bracket>0)||($offset>=strlen($afterdot)-1)); + print ($offset); + return true; + } +} + +//$conc="(EXISTS http://dbpedia.org/property/website.(http://dbpedia.org/resource/Berlin AND http://dbpedia.org/resource/Berlin) OR (http://dbpedia.org/resource/Berlin AND http://dbpedia.org/resource/Berlin)) OR http://dbpedia.org/resource/Berlin"; +$conc="EXISTS \"http://dbpedia.org/property/website\".(http://dbpedia.org/resource/Berlin AND http://dbpedia.org/resource/Berlin)"; +$nc=new NaturalConcepts($conc); +$ic=$nc->isExistsConstruct($conc); +//print_r($ic); +?> \ No newline at end of file Copied: trunk/src/dbpedia-navigator/old/ajax.php (from rev 1124, trunk/src/dbpedia-navigator/ajax.php) =================================================================== --- trunk/src/dbpedia-navigator/old/ajax.php (rev 0) +++ trunk/src/dbpedia-navigator/old/ajax.php 2008-09-16 07:09:53 UTC (rev 1216) @@ -0,0 +1,33 @@ +<?php +require_once ("xajax/xajax_core/xajax.inc.php"); +$sid = session_id(); +if (isset($_GET['path'])) $path=$_GET['path']; +else $path=""; + +$xajax = new xajax($path."ajaxfunctions.php?sid=$sid&path=".$path); +$xajax->configureMany(array('debug'=>true)); + +$xajax->register(XAJAX_FUNCTION, 'getsubjects', array( + 'onResponseDelay' => 'showLoading', + 'beforeResponseProcessing' => 'hideLoading' + )); +$xajax->register(XAJAX_FUNCTION,'getarticle', array( + 'onResponseDelay' => 'showLoading', + 'beforeResponseProcessing' => 'hideLoading' + )); +$xajax->register(XAJAX_FUNCTION,'learnConcept', array( + 'onResponseDelay' => 'showLoading', + 'beforeResponseProcessing' => 'hideLoading' + )); +$xajax->register(XAJAX_FUNCTION,'getSubjectsFromConcept', array( + 'onResponseDelay' => 'showLoading', + 'beforeResponseProcessing' => 'hideLoading' + )); + $xajax->registerFunction('toPositive'); +$xajax->registerFunction('toNegative'); +$xajax->registerFunction('clearPositives'); +$xajax->registerFunction('clearNegatives'); +$xajax->registerFunction('removePosInterest'); +$xajax->registerFunction('removeNegInterest'); +$xajax->registerFunction('stopServerCall'); +?> \ No newline at end of file Copied: trunk/src/dbpedia-navigator/old/ajaxfunctions.php (from rev 1124, trunk/src/dbpedia-navigator/ajaxfunctions.php) =================================================================== --- trunk/src/dbpedia-navigator/old/ajaxfunctions.php (rev 0) +++ trunk/src/dbpedia-navigator/old/ajaxfunctions.php 2008-09-16 07:09:53 UTC (rev 1216) @@ -0,0 +1,616 @@ +<?php +ini_set('max_execution_time',200); + +require("ajax.php"); +$xajax->processRequest(); + +function getsubjects($label,$list) +{ + $sid = $_GET['sid']; + session_id($sid); + session_start(); + $id=$_SESSION['id']; + $ksID=$_SESSION['ksID']; + session_write_close(); + + setRunning($id,"true"); + + //get parts of the list + $checkedInstances=preg_split("[,]",$list,-1,PREG_SPLIT_NO_EMPTY); + + //initialise content + $content=""; + try{ + require_once("DLLearnerConnection.php"); + $sc=new DLLearnerConnection($id,$ksID); + + $subjects=$sc->getSubjects($label,$checkedInstances); + + $content.=getTagCloud($subjects['tagcloud'],$subjects['tagcloudlabel']); + $content.=getResultsTable($subjects['subjects']); + } catch (Exception $e){ + $content=$e->getMessage(); + } + + $objResponse = new xajaxResponse(); + $objResponse->assign("articlecontent", "innerHTML", $content); + $objResponse->assign("ArticleTitle","innerHTML","Searchresult for ".$label); + return $objResponse; +} + +function getarticle($subject,$fromCache) +{ + $sid = $_GET['sid']; + session_id($sid); + session_start(); + if (isset($_SESSION['articles'])) $articles=$_SESSION['articles']; + $id=$_SESSION['id']; + $ksID=$_SESSION['ksID']; + session_write_close(); + setRunning($id,"true"); + + //get first Letter of label big + $uri=subjectToURI($subject); + + //if article is in session, get it out of the session + if (isset($articles)){ + foreach ($articles as $key => $value) + { + if ($value['subject']==$subject){ + $fromCache=$key; + break; + } + } + } + + //initialize the content variables + $content=""; + $searchResult=""; + $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 + //if $fromCache is >=0, the article is taken out of the cache + if ($fromCache<0) { + //if there are errors see catch block + try{ + require_once("DLLearnerConnection.php"); + $sc=new DLLearnerConnection($id,$ksID); + $triples=$sc->getTriples($uri); + + //BUILD ARTICLE + // goal: display the data in a nice (DBpedia specific way), maybe similar to + // dbpedia.org/search + + // 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]['value'].'" alt="Picture of '.$subject.'" style="float:right; max-width:200px;" \>'; + + //display where it was redirected from, if it was redirected + $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]['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]['value'].'">view Wikipedia article</a>, '; + $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'])) + $content .= '<p>classes: '.formatClassArray($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type']).'</p>'; + + 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['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: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']); + ... [truncated message content] |
From: <sk...@us...> - 2008-09-16 00:19:04
|
Revision: 1217 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1217&view=rev Author: sknappe Date: 2008-09-16 07:19:01 +0000 (Tue, 16 Sep 2008) Log Message: ----------- wsdl changed Modified Paths: -------------- trunk/src/dbpedia-navigator/def0.xsd trunk/src/dbpedia-navigator/main.wsdl Modified: trunk/src/dbpedia-navigator/def0.xsd =================================================================== --- trunk/src/dbpedia-navigator/def0.xsd 2008-09-16 07:09:53 UTC (rev 1216) +++ trunk/src/dbpedia-navigator/def0.xsd 2008-09-16 07:19:01 UTC (rev 1217) @@ -8,6 +8,8 @@ <xs:element name="LearningProblemUnsupportedException" type="tns:LearningProblemUnsupportedException"></xs:element> + <xs:element name="MalformedURLException" type="tns:MalformedURLException"></xs:element> + <xs:element name="ParseException" type="tns:ParseException"></xs:element> <xs:element name="SparqlQueryException" type="tns:SparqlQueryException"></xs:element> @@ -55,4 +57,10 @@ <xs:element name="message" type="xs:string" minOccurs="0"></xs:element> </xs:sequence> </xs:complexType> + + <xs:complexType name="MalformedURLException"> + <xs:sequence> + <xs:element name="message" type="xs:string" minOccurs="0"></xs:element> + </xs:sequence> + </xs:complexType> </xs:schema> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/main.wsdl =================================================================== --- trunk/src/dbpedia-navigator/main.wsdl 2008-09-16 07:09:53 UTC (rev 1216) +++ trunk/src/dbpedia-navigator/main.wsdl 2008-09-16 07:19:01 UTC (rev 1217) @@ -52,6 +52,9 @@ <message name="ClientNotKnownException"> <part element="tns:ClientNotKnownException" name="fault"></part> </message> + <message name="MalformedURLException"> + <part element="tns:MalformedURLException" name="fault"></part> + </message> <message name="removeKnowledgeSource"> <part name="arg0" type="xsd:int"></part> <part name="arg1" type="xsd:int"></part> @@ -157,6 +160,13 @@ <part name="arg3" type="xsd:string"></part> </message> <message name="applyConfigEntryStringResponse"></message> + <message name="applyConfigEntryURL"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + <part name="arg3" type="xsd:string"></part> + </message> + <message name="applyConfigEntryURLResponse"></message> <message name="applyConfigEntryStringArray"> <part name="arg0" type="xsd:int"></part> <part name="arg1" type="xsd:int"></part> @@ -190,6 +200,14 @@ <message name="getConfigOptionValueStringResponse"> <part name="return" type="xsd:string"></part> </message> + <message name="getConfigOptionValueURL"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + </message> + <message name="getConfigOptionValueURLResponse"> + <part name="return" type="xsd:string"></part> + </message> <message name="getConfigOptionValueDouble"> <part name="arg0" type="xsd:int"></part> <part name="arg1" type="xsd:int"></part> @@ -326,6 +344,12 @@ <message name="SparqlRetrievalResponse"> <part name="return" type="xsd:string"></part> </message> + <message name="getNaturalDescription"> + <part name="arg0" type="xsd:string"></part> + </message> + <message name="getNaturalDescriptionResponse"> + <part name="return" type="xsd:string"></part> + </message> <message name="getNegativeExamples"> <part name="arg0" type="xsd:int"></part> <part name="arg1" type="xsd:int"></part> @@ -388,6 +412,7 @@ <output message="tns:addKnowledgeSourceResponse"></output> <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + <fault message="tns:MalformedURLException" name="MalformedURLException"></fault> </operation> <operation name="removeKnowledgeSource" parameterOrder="arg0 arg1"> <input message="tns:removeKnowledgeSource"></input> @@ -476,6 +501,13 @@ <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> </operation> + <operation name="applyConfigEntryURL" parameterOrder="arg0 arg1 arg2 arg3"> + <input message="tns:applyConfigEntryURL"></input> + <output message="tns:applyConfigEntryURLResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + <fault message="tns:MalformedURLException" name="MalformedURLException"></fault> + </operation> <operation name="applyConfigEntryStringArray" parameterOrder="arg0 arg1 arg2 arg3"> <input message="tns:applyConfigEntryStringArray"></input> <output message="tns:applyConfigEntryStringArrayResponse"></output> @@ -502,6 +534,13 @@ <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> <fault message="tns:ConfigOptionTypeException" name="ConfigOptionTypeException"></fault> </operation> + <operation name="getConfigOptionValueURL" parameterOrder="arg0 arg1 arg2"> + <input message="tns:getConfigOptionValueURL"></input> + <output message="tns:getConfigOptionValueURLResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + <fault message="tns:ConfigOptionTypeException" name="ConfigOptionTypeException"></fault> + </operation> <operation name="getConfigOptionValueDouble" parameterOrder="arg0 arg1 arg2"> <input message="tns:getConfigOptionValueDouble"></input> <output message="tns:getConfigOptionValueDoubleResponse"></output> @@ -606,6 +645,11 @@ <output message="tns:SparqlRetrievalResponse"></output> <fault message="tns:ParseException" name="ParseException"></fault> </operation> + <operation name="getNaturalDescription" parameterOrder="arg0"> + <input message="tns:getNaturalDescription"></input> + <output message="tns:getNaturalDescriptionResponse"></output> + <fault message="tns:ParseException" name="ParseException"></fault> + </operation> <operation name="getNegativeExamples" parameterOrder="arg0 arg1 arg2 arg3 arg4"> <input message="tns:getNegativeExamples"></input> <output message="tns:getNegativeExamplesResponse"></output> @@ -714,6 +758,9 @@ <fault name="UnknownComponentException"> <soap:fault name="UnknownComponentException" use="literal"></soap:fault> </fault> + <fault name="MalformedURLException"> + <soap:fault name="MalformedURLException" use="literal"></soap:fault> + </fault> </operation> <operation name="removeKnowledgeSource"> <soap:operation soapAction=""></soap:operation> @@ -928,6 +975,24 @@ <soap:fault name="UnknownComponentException" use="literal"></soap:fault> </fault> </operation> + <operation name="applyConfigEntryURL"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + <fault name="MalformedURLException"> + <soap:fault name="MalformedURLException" use="literal"></soap:fault> + </fault> + </operation> <operation name="applyConfigEntryStringArray"> <soap:operation soapAction=""></soap:operation> <input> @@ -994,6 +1059,24 @@ <soap:fault name="ConfigOptionTypeException" use="literal"></soap:fault> </fault> </operation> + <operation name="getConfigOptionValueURL"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + <fault name="ConfigOptionTypeException"> + <soap:fault name="ConfigOptionTypeException" use="literal"></soap:fault> + </fault> + </operation> <operation name="getConfigOptionValueDouble"> <soap:operation soapAction=""></soap:operation> <input> @@ -1249,6 +1332,18 @@ <soap:fault name="ParseException" use="literal"></soap:fault> </fault> </operation> + <operation name="getNaturalDescription"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ParseException"> + <soap:fault name="ParseException" use="literal"></soap:fault> + </fault> + </operation> <operation name="getNegativeExamples"> <soap:operation soapAction=""></soap:operation> <input> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-09-16 03:18:53
|
Revision: 1218 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1218&view=rev Author: sknappe Date: 2008-09-16 10:18:49 +0000 (Tue, 16 Sep 2008) Log Message: ----------- had to change the separation symbol between texts and also changed the way instances of concepts for some special concepts are found, cant test now, because I only get bad concepts Modified Paths: -------------- trunk/src/dbpedia-navigator/ajax_get_article.php trunk/src/dbpedia-navigator/ajax_get_class.php trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php trunk/src/dbpedia-navigator/ajax_learn_concepts.php trunk/src/dbpedia-navigator/ajax_remove_neg_interest.php trunk/src/dbpedia-navigator/ajax_remove_pos_interest.php trunk/src/dbpedia-navigator/ajax_search.php trunk/src/dbpedia-navigator/ajax_set_positives_and_negatives.php trunk/src/dbpedia-navigator/ajax_to_negative.php trunk/src/dbpedia-navigator/ajax_to_positive.php trunk/src/dbpedia-navigator/helper_functions.php trunk/src/dbpedia-navigator/js/ajax.js Modified: trunk/src/dbpedia-navigator/ajax_get_article.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_article.php 2008-09-16 07:19:01 UTC (rev 1217) +++ trunk/src/dbpedia-navigator/ajax_get_article.php 2008-09-16 10:18:49 UTC (rev 1218) @@ -232,16 +232,16 @@ $interests=show_Interests($_SESSION); print $content; - print '$$'; + print '$$$'; print $artTitle; - print '$$'; + print '$$$'; print $lastArticles; - print '$$'; + print '$$$'; print $interests[0]; - print '$$'; + print '$$$'; print $interests[1]; - print '$$'; + print '$$$'; print $lat; - print '$$'; + print '$$$'; print $long; ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/ajax_get_class.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_class.php 2008-09-16 07:19:01 UTC (rev 1217) +++ trunk/src/dbpedia-navigator/ajax_get_class.php 2008-09-16 10:18:49 UTC (rev 1218) @@ -116,8 +116,8 @@ } print $content; - print '$$'; + print '$$$'; print "Class: ".$title; - print '$$'; + print '$$$'; print $lastClasses; ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php 2008-09-16 07:19:01 UTC (rev 1217) +++ trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php 2008-09-16 10:18:49 UTC (rev 1218) @@ -48,8 +48,8 @@ $content.="Your Search brought no results."; print $content; - print '$$'; + print '$$$'; print "Searchresult for Category \"".$label."\""; - print '$$'; + print '$$$'; print $bestsearches; ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php 2008-09-16 07:19:01 UTC (rev 1217) +++ trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php 2008-09-16 10:18:49 UTC (rev 1218) @@ -1,8 +1,12 @@ <?php - include('helper_functions.php'); + include_once('helper_functions.php'); + include_once('Settings.php'); + include_once('DatabaseConnection.php'); - $manchester=$_POST['manchester']; - $kb=$_POST['kb']; + $manchester=html_entity_decode($_POST['manchester']); + $kb=html_entity_decode($_POST['kb']); + $number=$_POST['number']; + $label=$_POST['label']; session_start(); $id=$_SESSION['id']; @@ -13,12 +17,57 @@ $concept=html_entity_decode($concept); - $test=preg_match("/(http:\/\/dbpedia\.org\/class\/yago\/[^\040]+(\040)*(AND|OR)*)+/",$manchester); + $test=preg_match("/^([\(]*http:\/\/dbpedia\.org\/class\/yago\/[^\040]+[\)]*(\040(AND|OR)\040)?)+$/",$such); + $content=""; if ($test){ + preg_match_all("/http:\/\/dbpedia\.org\/class\/yago\/[^\040()]+/",$such,$treffer,PREG_OFFSET_CAPTURE); + + $final=''; + $i=1; + $pos=0; + foreach ($treffer[0] as $tref){ + $final.=substr($such,$pos,$tref[1]-$pos); + $final.='cat'.$i.'.category=\''.substr($such,$tref[1],strlen($tref[0])).'\''; + $i++; + $pos=$tref[1]+strlen($tref[0]); + } + $final.=substr($such,$pos); + $temp='SELECT cat1.name FROM '; + for ($j=0;$j<$i-1;$j++) + if ($j!=$i-2) $temp.='articlecategories as cat'.($j+1).','; + else $temp.='articlecategories as cat'.($j+1); + $temp.=' WHERE '; + for ($j=1;$j<$i-1;$j++) + $temp.='cat'.$j.'.name=cat'.($j+1).'.name AND '; + $query=$temp.'('.$final.') LIMIT '.$number; + + //connect to the database + $settings=new Settings(); + $databaseConnection=new DatabaseConnection($settings->database_type); + $databaseConnection->connect($settings->database_server,$settings->database_user,$settings->database_pass); + $databaseConnection->select_database($settings->database_name); + + $res=$databaseConnection->query($query); + $bestsearches=""; + if ($databaseConnection->numberOfEntries($res)>0){ + $names=array(); + $labels=array(); + while ($result=$databaseConnection->nextEntry($res)){ + $names[]=$result['name']; + $query="SELECT label FROM rank WHERE name='".$result['name']."' LIMIT 1"; + $res2=$databaseConnection->query($query); + $result2=$databaseConnection->nextEntry($res2); + $labels[]=$result2['label']; + } + $content.=getConceptResultsTable($names,$labels,htmlentities($manchester),htmlentities($kb),$label,$number); + $bestsearches=getBestSearches($names,$labels); + } + else + $content.="Your Search brought no results."; } - $content=""; + else{ /*try{ require_once("DLLearnerConnection.php"); $sc=new DLLearnerConnection($id,$ksID); @@ -27,8 +76,11 @@ } catch (Exception $e){ $content=$e->getMessage(); }*/ + } - print $test."ho"; - print '$$'; - print "Instances for Concept ".$concept; + print $content; + print '$$$'; + print "Instances for Concept \"".$label."\""; + print '$$$'; + print $bestsearches; ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/ajax_learn_concepts.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-09-16 07:19:01 UTC (rev 1217) +++ trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-09-16 10:18:49 UTC (rev 1218) @@ -30,7 +30,7 @@ $concept.="<tr><td>You could also be interested in articles matching these descriptions:</td></tr>"; foreach ($concepts as $con){ $label=$sc->getNaturalDescription($con['descriptionKBSyntax']); - $concept.="<tr><td><a href=\"\" onclick=\"getSubjectsFromConcept('manchester=".htmlentities($con['descriptionManchesterSyntax'])."&kb=".htmlentities($con['descriptionKBSyntax'])."');return false;\" />".$label."</a> (Accuracy: ".(floatVal($con['accuracy'])*100)."%)</td></tr>"; + $concept.="<tr><td><a href=\"\" onclick=\"getSubjectsFromConcept('manchester=".htmlentities($con['descriptionManchesterSyntax'])."&kb=".htmlentities($con['descriptionKBSyntax'])."&label=".$label."number=10');return false;\" />".$label."</a> (Accuracy: ".(floatVal($con['accuracy'])*100)."%)</td></tr>"; } $concept.="</table>"; } Modified: trunk/src/dbpedia-navigator/ajax_remove_neg_interest.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_remove_neg_interest.php 2008-09-16 07:19:01 UTC (rev 1217) +++ trunk/src/dbpedia-navigator/ajax_remove_neg_interest.php 2008-09-16 10:18:49 UTC (rev 1218) @@ -10,6 +10,6 @@ $interests=show_Interests($_SESSION); print $interests[0]; - print '$$'; + print '$$$'; print $interests[1]; ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/ajax_remove_pos_interest.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_remove_pos_interest.php 2008-09-16 07:19:01 UTC (rev 1217) +++ trunk/src/dbpedia-navigator/ajax_remove_pos_interest.php 2008-09-16 10:18:49 UTC (rev 1218) @@ -10,6 +10,6 @@ $interests=show_Interests($_SESSION); print $interests[0]; - print '$$'; + print '$$$'; print $interests[1]; ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/ajax_search.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_search.php 2008-09-16 07:19:01 UTC (rev 1217) +++ trunk/src/dbpedia-navigator/ajax_search.php 2008-09-16 10:18:49 UTC (rev 1218) @@ -65,8 +65,8 @@ $content.="Your Search brought no results."; print $content; - print '$$'; + print '$$$'; print "Searchresult for \"".$label."\""; - print '$$'; + print '$$$'; print $bestsearches; ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/ajax_set_positives_and_negatives.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_set_positives_and_negatives.php 2008-09-16 07:19:01 UTC (rev 1217) +++ trunk/src/dbpedia-navigator/ajax_set_positives_and_negatives.php 2008-09-16 10:18:49 UTC (rev 1218) @@ -42,6 +42,6 @@ $interests=show_Interests($_SESSION); print $interests[0]; - print '$$'; + print '$$$'; print $interests[1]; ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/ajax_to_negative.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_to_negative.php 2008-09-16 07:19:01 UTC (rev 1217) +++ trunk/src/dbpedia-navigator/ajax_to_negative.php 2008-09-16 10:18:49 UTC (rev 1218) @@ -20,6 +20,6 @@ $interests=show_Interests($_SESSION); print $interests[0]; - print '$$'; + print '$$$'; print $interests[1]; ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/ajax_to_positive.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_to_positive.php 2008-09-16 07:19:01 UTC (rev 1217) +++ trunk/src/dbpedia-navigator/ajax_to_positive.php 2008-09-16 10:18:49 UTC (rev 1218) @@ -20,6 +20,6 @@ $interests=show_Interests($_SESSION); print $interests[0]; - print '$$'; + print '$$$'; print $interests[1]; ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/helper_functions.php =================================================================== --- trunk/src/dbpedia-navigator/helper_functions.php 2008-09-16 07:19:01 UTC (rev 1217) +++ trunk/src/dbpedia-navigator/helper_functions.php 2008-09-16 10:18:49 UTC (rev 1218) @@ -150,6 +150,48 @@ return $ret; } +function getConceptResultsTable($names,$labels,$manchester,$kb,$label,$number) +{ + $ret="<p>These are your results. Show best "; + for ($k=10;$k<125;){ + $ret.="<a href=\"#\" onclick=\"getSubjectsFromConcept('manchester=".$manchester."&kb=".$kb."&label=".$label."number=".$k."');return false;\""; + if ($k==$number) $ret.=" style=\"text-decoration:none;\""; + else $ret.=" style=\"text-decoration:underline;\""; + $ret.=">".($k)."</a>"; + if ($k!=100) $ret.=" | "; + if($k==10) $k=25; + else $k=$k+25; + } + $ret.="</p><br/>"; + $i=0; + $display="block"; + $ret.="<div id=\"results\">"; + while($i*25<count($names)) + { + for ($j=0;($j<25)&&(($i*25+$j)<count($names));$j++) + { + $name=$names[$i*25+$j]; + $label=$labels[$i*25+$j]; + if (strlen($label)==0) $label=urldecode(str_replace("_"," ",substr (strrchr ($name, "/"), 1))); + $ret.='<p style="display:'.$display.'"> '.($i*25+$j+1).'. <a class="all" href="" onclick="get_article(\'label='.$name.'&cache=-1\');return false;">'.utf8_to_html($label).'</a></p>'; + } + $i++; + $display="none"; + } + $ret.='<input type="hidden" id="hidden_class" value="all"/><input type="hidden" id="hidden_number" value="0"/></div><br/><p style="width:100%;text-align:center;" id="sitenumbers">'; + for ($k=0;$k<$i;$k++){ + $ret.="<span>"; + if ($k!=0) $ret.=" | "; + $ret.="<a href=\"#\" onclick=\"document.getElementById('hidden_number').value='".(25*$k)."';show_results(document.getElementById('hidden_class').value,".(25*$k).");\""; + if ($k==0) $ret.=" style=\"text-decoration:none;\""; + else $ret.=" style=\"text-decoration:underline;\""; + $ret.=">".($k+1)."</a>"; + $ret.="</span>"; + } + $ret.="</p>"; + return $ret; +} + function getBestSearches($names,$labels) { $ret="<div id=\"best-results\">"; Modified: trunk/src/dbpedia-navigator/js/ajax.js =================================================================== --- trunk/src/dbpedia-navigator/js/ajax.js 2008-09-16 07:19:01 UTC (rev 1217) +++ trunk/src/dbpedia-navigator/js/ajax.js 2008-09-16 10:18:49 UTC (rev 1218) @@ -14,7 +14,7 @@ XhrObj.onreadystatechange = function() { if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); + var response = XhrObj.responseText.split('$$$'); document.getElementById('articlecontent').innerHTML=response[0]; document.getElementById('ArticleTitle').innerHTML=response[1]; if (response[2].length>0){ @@ -45,7 +45,7 @@ XhrObj.onreadystatechange = function() { if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); + var response = XhrObj.responseText.split('$$$'); document.getElementById('articlecontent').innerHTML=response[0]; document.getElementById('ArticleTitle').innerHTML=response[1]; document.getElementById('lastarticles').innerHTML=response[2]; @@ -83,7 +83,7 @@ XhrObj.onreadystatechange = function() { if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); + var response = XhrObj.responseText.split('$$$'); document.getElementById('articlecontent').innerHTML=response[0]; document.getElementById('ArticleTitle').innerHTML=response[1]; document.getElementById('lastclasses').innerHTML=response[2]; @@ -111,7 +111,7 @@ XhrObj.onreadystatechange = function() { if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); + var response = XhrObj.responseText.split('$$$'); document.getElementById('Positives').innerHTML=response[0]; document.getElementById('Negatives').innerHTML=response[1]; } @@ -137,7 +137,7 @@ XhrObj.onreadystatechange = function() { if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); + var response = XhrObj.responseText.split('$$$'); document.getElementById('Positives').innerHTML=response[0]; document.getElementById('Negatives').innerHTML=response[1]; } @@ -211,7 +211,7 @@ XhrObj.onreadystatechange = function() { if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); + var response = XhrObj.responseText.split('$$$'); document.getElementById('Positives').innerHTML=response[0]; document.getElementById('Negatives').innerHTML=response[1]; } @@ -237,7 +237,7 @@ XhrObj.onreadystatechange = function() { if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); + var response = XhrObj.responseText.split('$$$'); document.getElementById('Positives').innerHTML=response[0]; document.getElementById('Negatives').innerHTML=response[1]; } @@ -315,9 +315,13 @@ XhrObj.onreadystatechange = function() { if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); + var response = XhrObj.responseText.split('$$$'); document.getElementById('articlecontent').innerHTML=response[0]; document.getElementById('ArticleTitle').innerHTML=response[1]; + if (response[2].length>0){ + document.getElementById('searchcontent').innerHTML=response[2]; + document.getElementById('SearchResultBox').style.display='block'; + } } } @@ -341,7 +345,7 @@ XhrObj.onreadystatechange = function() { if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); + var response = XhrObj.responseText.split('$$$'); document.getElementById('articlecontent').innerHTML=response[0]; document.getElementById('ArticleTitle').innerHTML=response[1]; if (response[2].length>0){ @@ -371,7 +375,7 @@ XhrObj.onreadystatechange = function() { if (XhrObj.readyState == 4 && XhrObj.status == 200){ - var response = XhrObj.responseText.split('$$'); + var response = XhrObj.responseText.split('$$$'); document.getElementById('Positives').innerHTML=response[0]; document.getElementById('Negatives').innerHTML=response[1]; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-09-17 02:38:30
|
Revision: 1227 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1227&view=rev Author: sknappe Date: 2008-09-17 09:38:27 +0000 (Wed, 17 Sep 2008) Log Message: ----------- Made some changes with the layout and also with getting instances from concepts ("easy" concepts of the form http://... AND http://.. OR http://... are processed with help of the database, changed the algorithm a bit, so that not only the yago class itself is tested for instances but also the subclasses, have to test that further) Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php trunk/src/dbpedia-navigator/ajax_learn_concepts.php trunk/src/dbpedia-navigator/helper_functions.php trunk/src/dbpedia-navigator/index.php Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-09-17 09:34:42 UTC (rev 1226) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-09-17 09:38:27 UTC (rev 1227) @@ -49,7 +49,6 @@ $this->client->applyConfigEntryInt($this->id, $this->ksID, "recursionDepth",1); $this->client->applyConfigEntryString($this->id, $this->ksID, "predefinedFilter", "DBPEDIA-NAVIGATOR"); - //$this->client->applyConfigEntryBoolean($this->id, $this->ksID, "useLits", true); $this->client->applyConfigEntryString($this->id, $this->ksID, "predefinedEndpoint", "DBPEDIA"); $this->client->applyConfigEntryString($this->id, $this->ksID, "predefinedManipulator", "DBPEDIA-NAVIGATOR"); $this->client->applyConfigEntryBoolean($this->id, $this->ksID, "useCache", $settings->useCache); @@ -66,8 +65,8 @@ $this->client->setPositiveExamples($this->id, $posExamples); if(!empty($negExamples)) $this->client->setNegativeExamples($this->id, $negExamples); - $this->client->setLearningAlgorithm($this->id, "dbpediaNavigationSuggestor"); - + $algorithmID=$this->client->setLearningAlgorithm($this->id, "dbpediaNavigationSuggestor"); + $this->client->applyConfigEntryBoolean($this->id, $algorithmID, "forceRefinementLengthIncrease", true); $start = microtime(true); $this->client->initAll($this->id); Modified: trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php 2008-09-17 09:34:42 UTC (rev 1226) +++ trunk/src/dbpedia-navigator/ajax_get_subjects_from_category.php 2008-09-17 09:38:27 UTC (rev 1227) @@ -49,7 +49,7 @@ print $content; print '$$$'; - print "Searchresult for Category \"".$label."\""; + print "Instances of Class \"".$label."\""; print '$$$'; print $bestsearches; ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php 2008-09-17 09:34:42 UTC (rev 1226) +++ trunk/src/dbpedia-navigator/ajax_get_subjects_from_concept.php 2008-09-17 09:38:27 UTC (rev 1227) @@ -15,24 +15,34 @@ setRunning($id,"true"); - $concept=html_entity_decode($concept); + $test=preg_match("/^([\(]*http:\/\/dbpedia\.org\/class\/yago\/[^\040]+[\)]*(\040(AND|OR)\040)?)+$/",$manchester); - $test=preg_match("/^([\(]*http:\/\/dbpedia\.org\/class\/yago\/[^\040]+[\)]*(\040(AND|OR)\040)?)+$/",$such); - $content=""; if ($test){ - preg_match_all("/http:\/\/dbpedia\.org\/class\/yago\/[^\040()]+/",$such,$treffer,PREG_OFFSET_CAPTURE); + //connect to the database + $settings=new Settings(); + $databaseConnection=new DatabaseConnection($settings->database_type); + $databaseConnection->connect($settings->database_server,$settings->database_user,$settings->database_pass); + $databaseConnection->select_database($settings->database_name); + + preg_match_all("/http:\/\/dbpedia\.org\/class\/yago\/[^\040()]+/",$manchester,$treffer,PREG_OFFSET_CAPTURE); $final=''; $i=1; $pos=0; foreach ($treffer[0] as $tref){ - $final.=substr($such,$pos,$tref[1]-$pos); - $final.='cat'.$i.'.category=\''.substr($such,$tref[1],strlen($tref[0])).'\''; + $final.=substr($manchester,$pos,$tref[1]-$pos).'('; + $category=substr($manchester,$tref[1],strlen($tref[0])); + $query='SELECT child FROM classhierarchy WHERE father=\''.$category.'\''; + $res=$databaseConnection->query($query); + while ($result=$databaseConnection->nextEntry($res)){ + $final.='cat'.$i.'.category=\''.$result['child'].'\' OR '; + } + $final.='cat'.$i.'.category=\''.$category.'\')'; $i++; $pos=$tref[1]+strlen($tref[0]); } - $final.=substr($such,$pos); + $final.=substr($manchester,$pos); $temp='SELECT cat1.name FROM '; for ($j=0;$j<$i-1;$j++) if ($j!=$i-2) $temp.='articlecategories as cat'.($j+1).','; @@ -43,12 +53,6 @@ $query=$temp.'('.$final.') LIMIT '.$number; - //connect to the database - $settings=new Settings(); - $databaseConnection=new DatabaseConnection($settings->database_type); - $databaseConnection->connect($settings->database_server,$settings->database_user,$settings->database_pass); - $databaseConnection->select_database($settings->database_name); - $res=$databaseConnection->query($query); $bestsearches=""; if ($databaseConnection->numberOfEntries($res)>0){ Modified: trunk/src/dbpedia-navigator/ajax_learn_concepts.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-09-17 09:34:42 UTC (rev 1226) +++ trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-09-17 09:38:27 UTC (rev 1227) @@ -30,7 +30,7 @@ $concept.="<tr><td>You could also be interested in articles matching these descriptions:</td></tr>"; foreach ($concepts as $con){ $label=$sc->getNaturalDescription($con['descriptionKBSyntax']); - $concept.="<tr><td><a href=\"\" onclick=\"getSubjectsFromConcept('manchester=".htmlentities($con['descriptionManchesterSyntax'])."&kb=".htmlentities($con['descriptionKBSyntax'])."&label=".$label."number=10');return false;\" />".$label."</a> (Accuracy: ".(floatVal($con['accuracy'])*100)."%)</td></tr>"; + $concept.="<tr><td><a href=\"\" onclick=\"getSubjectsFromConcept('manchester=".htmlentities($con['descriptionManchesterSyntax'])."&kb=".htmlentities($con['descriptionKBSyntax'])."&label=".$label."&number=10');return false;\" />".$label."</a> (Accuracy: ".(floatVal($con['accuracy'])*100)."%)</td></tr>"; } $concept.="</table>"; } Modified: trunk/src/dbpedia-navigator/helper_functions.php =================================================================== --- trunk/src/dbpedia-navigator/helper_functions.php 2008-09-17 09:34:42 UTC (rev 1226) +++ trunk/src/dbpedia-navigator/helper_functions.php 2008-09-17 09:38:27 UTC (rev 1227) @@ -349,7 +349,7 @@ } $ret.='<table border="0" style="text-align:left;width:100%">'; - $ret.='<tr><td style="width:90%"><b>Father classes</b></td></tr>'; + $ret.='<tr><td style="width:90%;font-size:14px;"><b>Father classes</b></td></tr>'; $ret.='<tr style="height:10px"><td></td></tr>'; $ret.='<tr><td>'.$fathers.'</td></tr>'; $ret.='<tr style="height:10px"><td></td></tr>'; @@ -357,7 +357,7 @@ if ($fatherButtons) $ret.='<input style="width:70px" type="button" value="Instances" class="button" onclick="getSubjectsFromCategory(\'category=\'+document.getElementById(\'fatherSelect\').options[document.getElementById(\'fatherSelect\').selectedIndex].value+\'&number=10\');" title="Search Instances of Father class."/> <input style="width:70px" type="button" value="Class" class="button" onclick="get_class(\'class=\'+document.getElementById(\'fatherSelect\').options[document.getElementById(\'fatherSelect\').selectedIndex].value+\'&cache=-1\');" title="Show Father class in class view."/>'; $ret.='</td></tr>'; $ret.='<tr style="height:20px"><td><hr/></td></tr>'; - $ret.='<tr><td><b>Current class</b></td></tr>'; + $ret.='<tr><td style="font-size:14px;"><b>Current class</b></td></tr>'; $ret.='<tr style="height:10px"><td></td></tr>'; $ret.='<tr><td><b>'.$title.'</b></td></tr>'; $ret.='<tr style="height:10px"><td></td></tr>'; @@ -365,7 +365,7 @@ $ret.='<input style="width:70px" type="button" value="Instances" class="button" onclick="getSubjectsFromCategory(\'category='.$class.'&number=10\');" title="Search Instances of Shown class."/>'; $ret.='</td></tr>'; $ret.='<tr style="height:20px"><td><hr/></td></tr>'; - $ret.='<tr><td style="width:30%"><b>Child classes</b></td></tr>'; + $ret.='<tr><td style="width:30%;font-size:14px;"><b>Child classes</b></td></tr>'; $ret.='<tr style="height:10px"><td></td></tr>'; $ret.='<tr><td>'.$childs.'</td></tr>'; $ret.='<tr style="height:10px"><td></td></tr>'; Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-09-17 09:34:42 UTC (rev 1226) +++ trunk/src/dbpedia-navigator/index.php 2008-09-17 09:38:27 UTC (rev 1227) @@ -54,7 +54,7 @@ <div id="conceptlink" style="display:block"></div> </div> <!-- boxcontent --> </div> <!-- box --> -</td><td width="19%" style="text-align:center"><span id="Loading" style="display:none">Server Call... <a href=""><img src="images/remove.png" onclick="stopServerCall();return false;" /></a></span></td></tr></table></div> +</td><td width="19%" style="text-align:center"><span id="Loading" style="display:none;font-weight:bold;color:#ff0000;">Server Call... <a href=""><img src="images/remove.png" onclick="stopServerCall();return false;" /></a></span></td></tr></table></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. |