From: <sk...@us...> - 2008-07-05 14:21:14
|
Revision: 998 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=998&view=rev Author: sknappe Date: 2008-07-05 07:21:07 -0700 (Sat, 05 Jul 2008) Log Message: ----------- modified to work with changes in the ws 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-05 14:20:26 UTC (rev 997) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-07-05 14:21:07 UTC (rev 998) @@ -51,10 +51,14 @@ $this->client->applyConfigEntryString($this->id, $this->ksID, "predefinedEndpoint", "DBPEDIA"); $this->client->applyConfigEntryBoolean($this->id, $this->ksID, "useCache", $settings->useCache); $this->client->setReasoner($this->id, "fastInstanceChecker"); - if(empty($negExamples)) + /*if(empty($negExamples)) $this->client->setLearningProblem($this->id, "posOnlyDefinition"); else - $this->client->setLearningProblem($this->id, "posNegDefinition"); + $this->client->setLearningProblem($this->id, "posNegDefinition");*/ + $this->client->setLearningProblem($this->id, "posNegDefinition"); + if(empty($negExamples)){ + $negExamples=$this->client->getNegativeExamples($this->id,$this->ksID,$posExamples,count($posExamples),"http://dbpedia.org/resource/"); + } $this->client->setPositiveExamples($this->id, $posExamples); if(!empty($negExamples)) $this->client->setNegativeExamples($this->id, $negExamples); @@ -82,7 +86,7 @@ sleep($sleeptime); // see what we have learned so far - $concepts=$this->client->getCurrentlyBestConcepts($this->id,3); + $concepts=$this->client->getCurrentlyBestConcepts($this->id,3,"kb"); $running=$this->client->isAlgorithmRunning($this->id); $seconds = $i * $sleeptime; @@ -122,7 +126,7 @@ function getTriples($uri) { $query="SELECT ?pred ?obj ". - "WHERE {{<".$uri."> ?pred ?obj}UNION{<".$uri."> <http://dbpedia.org/property/redirect> ?Conc.?Conc ?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."); $ret=array(); Modified: trunk/src/dbpedia-navigator/ajaxfunctions.php =================================================================== --- trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-07-05 14:20:26 UTC (rev 997) +++ trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-07-05 14:21:07 UTC (rev 998) @@ -220,7 +220,7 @@ $objResponse->assign("lastarticles","innerHTML",$lastArticles); $objResponse->assign('Positives','innerHTML',$posInterests); $objResponse->assign('Negatives','innerHTML',$negInterests); - //$objResponse->call('xajax_learnConcept'); + $objResponse->call('xajax_learnConcept'); return $objResponse; } @@ -392,7 +392,7 @@ $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>"; + $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>"; //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++; @@ -421,7 +421,7 @@ setRunning($id,"true"); - $concept=urldecode($concept); + $concept=html_entity_decode($concept); $content=""; try{ require_once("DLLearnerConnection.php"); @@ -462,7 +462,7 @@ //delete whitespaces at beginning and end $subject=trim($subject); //get first letters big - $subject=ucwords($subject); + $subject=ucfirst($subject); //replace spaces with _ $subject=str_replace(' ','_',$subject); //add the uri @@ -486,7 +486,8 @@ else if ($count>($min+$distribution)) $style="font-size:medium;"; else $style="font-size:small;"; - $ret.='<a style="'.$style.'" href="#" onclick="xajax_getSubjectsFromConcept(\''.$tag.'\');">'.$label[$tag].'</a>'; + $tag_with_entities=htmlentities("\"".$tag."\""); + $ret.='<a style="'.$style.'" href="#" onclick="xajax_getSubjectsFromConcept(\''.$tag_with_entities.'\');">'.$label[$tag].'</a>'; } $ret.="</p>"; return $ret; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |