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