From: <sk...@us...> - 2008-09-24 08:45:26
|
Revision: 1247 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1247&view=rev Author: sknappe Date: 2008-09-24 08:45:14 +0000 (Wed, 24 Sep 2008) Log Message: ----------- some changes when stopping algorithm Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/Settings.php trunk/src/dbpedia-navigator/ajax_get_article.php trunk/src/dbpedia-navigator/ajax_learn_concepts.php trunk/src/dbpedia-navigator/index.php trunk/src/dbpedia-navigator/js/ajax.js trunk/src/dbpedia-navigator/js/navigator.js Added Paths: ----------- trunk/src/dbpedia-navigator/images/spinner.gif Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-09-24 08:09:38 UTC (rev 1246) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-09-24 08:45:14 UTC (rev 1247) @@ -70,7 +70,15 @@ $start = microtime(true); $this->client->initAll($this->id); - + + //look, if algorithm was stopped + $file=fopen("./temp/".$this->id.".temp","r"); + $run=fgets($file); + fclose($file); + if ($run=="false"){ + return array(); + } + $threaded=true; if($threaded == false) { @@ -102,12 +110,13 @@ fclose($file); if ($run=="false"){ $this->client->stop($this->id); - throw new Exception("Learning stopped"); + return json_decode($this->client->getCurrentlyBestEvaluatedDescriptions($this->id,3),true); } } while($seconds<$this->learnttl&&$running); - $this->client->stop($this->id); + if ($running) $this->client->stop($this->id); } + //return $concepts->item; return json_decode($this->client->getCurrentlyBestEvaluatedDescriptions($this->id,3),true); } @@ -170,7 +179,7 @@ return $result; } - $seconds = $i * $sleeptime; + $microseconds = $i * $sleeptime; $i++; //look, if algorithm was stopped $file=fopen("./temp/".$this->id.".temp","r"); @@ -180,7 +189,7 @@ $this->client->stopSparqlThread($this->id,$queryID); throw new Exception("Query stopped"); } - } while($seconds<$this->ttl); + } while($microseconds<$this->ttl); $this->client->stopSparqlThread($this->id,$queryID); } Modified: trunk/src/dbpedia-navigator/Settings.php =================================================================== --- trunk/src/dbpedia-navigator/Settings.php 2008-09-24 08:09:38 UTC (rev 1246) +++ trunk/src/dbpedia-navigator/Settings.php 2008-09-24 08:45:14 UTC (rev 1247) @@ -37,7 +37,7 @@ // public $dbpediauri='http://dbpedia2.openlinksw.com:8890/isparql'; // in mikrosekunden public $sparqlttl=60000000; - public $learnttl=60000000; + public $learnttl=10; public $language="en"; Modified: trunk/src/dbpedia-navigator/ajax_get_article.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_article.php 2008-09-24 08:09:38 UTC (rev 1246) +++ trunk/src/dbpedia-navigator/ajax_get_article.php 2008-09-24 08:45:14 UTC (rev 1247) @@ -265,10 +265,10 @@ if (isset($triples['http://dbpedia.org/property/imagesize'])) unset($triples['http://dbpedia.org/property/imagesize']); if (isset($triples['http://dbpedia.org/property/id'])) unset($triples['http://dbpedia.org/property/id']); if (isset($triples['http://dbpedia.org/property/issue'])) unset($triples['http://dbpedia.org/property/issue']); - if (isset($triples['http://dbpedia.org/property/hips'][0]['type']=='uri')) unset($triples['http://dbpedia.org/property/hips']); - if (isset($triples['http://dbpedia.org/property/weight'][0]['type']=='uri')) unset($triples['http://dbpedia.org/property/weight']); - if (isset($triples['http://dbpedia.org/property/waist'][0]['type']=='uri')) unset($triples['http://dbpedia.org/property/waist']); - if (isset($triples['http://dbpedia.org/property/height'][0]['type']=='uri')) unset($triples['http://dbpedia.org/property/height']); + if (isset($triples['http://dbpedia.org/property/hips'])&&$triples['http://dbpedia.org/property/hips'][0]['type']=='uri') unset($triples['http://dbpedia.org/property/hips']); + if (isset($triples['http://dbpedia.org/property/weight'])&&$triples['http://dbpedia.org/property/weight'][0]['type']=='uri') unset($triples['http://dbpedia.org/property/weight']); + if (isset($triples['http://dbpedia.org/property/waist'])&&$triples['http://dbpedia.org/property/waist'][0]['type']=='uri') unset($triples['http://dbpedia.org/property/waist']); + if (isset($triples['http://dbpedia.org/property/height'])&&$triples['http://dbpedia.org/property/height'][0]['type']=='uri') unset($triples['http://dbpedia.org/property/height']); if (isset($triples['http://www.geonames.org/ontology#featureCode'])) unset($triples['http://www.geonames.org/ontology#featureCode']); if (isset($triples['http://www.geonames.org/ontology#featureClass'])) unset($triples['http://www.geonames.org/ontology#featureClass']); if (isset($triples['http://dbpedia.org/property/dmozProperty'])) unset($triples['http://dbpedia.org/property/dmozProperty']); @@ -328,8 +328,7 @@ } catch (Exception $e) { - $content=$e->getMessage(); - $artTitle="Article not found"; + $content="-"; } } else { Modified: trunk/src/dbpedia-navigator/ajax_learn_concepts.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-09-24 08:09:38 UTC (rev 1246) +++ trunk/src/dbpedia-navigator/ajax_learn_concepts.php 2008-09-24 08:45:14 UTC (rev 1247) @@ -1,4 +1,6 @@ <?php + ini_set('max_execution_time',200); + include('helper_functions.php'); session_start(); Property changes on: trunk/src/dbpedia-navigator/images/spinner.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-09-24 08:09:38 UTC (rev 1246) +++ trunk/src/dbpedia-navigator/index.php 2008-09-24 08:45:14 UTC (rev 1247) @@ -55,7 +55,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;font-weight:bold;color:#ff0000;">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><span id="DatabaseLoading" style="display:none;font-weight:bold;color:#ff0000;">Database Call... <a href=""><img src="images/spinner.gif"/></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-09-24 08:09:38 UTC (rev 1246) +++ trunk/src/dbpedia-navigator/js/ajax.js 2008-09-24 08:45:14 UTC (rev 1247) @@ -1,5 +1,6 @@ function search_it(param) { + setDatabaseRunning(true); if (document.all){ //IE var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); @@ -22,6 +23,9 @@ document.getElementById('SearchResultBox').style.display='block'; } } + if (XhrObj.readyState == 4){ + setDatabaseRunning(false); + } } XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); @@ -44,23 +48,26 @@ XhrObj.onreadystatechange = function() { + if (XhrObj.readyState == 4) + setRunning(false); 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[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'; - learnConcept(); - } + if (response[0]!='-'){ + 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]; + 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'; + learnConcept(); + } + } + } } XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); @@ -69,6 +76,7 @@ function get_class(param) { + setDatabaseRunning(true); if (document.all){ //IE var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); @@ -89,6 +97,8 @@ document.getElementById('lastclasses').innerHTML=response[2]; document.getElementById('LastClassesBox').style.display='block'; } + if (XhrObj.readyState == 4) + setDatabaseRunning(false); } XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); @@ -114,6 +124,7 @@ var response = XhrObj.responseText.split('$$$'); document.getElementById('Positives').innerHTML=response[0]; document.getElementById('Negatives').innerHTML=response[1]; + learnConcept(); } } @@ -140,6 +151,7 @@ var response = XhrObj.responseText.split('$$$'); document.getElementById('Positives').innerHTML=response[0]; document.getElementById('Negatives').innerHTML=response[1]; + learnConcept(); } } @@ -188,6 +200,7 @@ { if (XhrObj.readyState == 4 && XhrObj.status == 200){ document.getElementById('Negatives').innerHTML = XhrObj.responseText; + learnConcept(); } } @@ -214,6 +227,7 @@ var response = XhrObj.responseText.split('$$$'); document.getElementById('Positives').innerHTML=response[0]; document.getElementById('Negatives').innerHTML=response[1]; + learnConcept(); } } @@ -240,6 +254,7 @@ var response = XhrObj.responseText.split('$$$'); document.getElementById('Positives').innerHTML=response[0]; document.getElementById('Negatives').innerHTML=response[1]; + learnConcept(); } } @@ -263,12 +278,14 @@ XhrObj.onreadystatechange = function() { + if (XhrObj.readyState == 4){ + setRunning(false); + } if (XhrObj.readyState == 4 && XhrObj.status == 200){ if (XhrObj.responseText!='-'){ document.getElementById('conceptlink').innerHTML=XhrObj.responseText; document.getElementById('ConceptBox').style.display='block'; } - setRunning(false); } } @@ -292,6 +309,7 @@ XhrObj.onreadystatechange = function() { if (XhrObj.readyState == 4 && XhrObj.status == 200){ + setRunning(false); } } @@ -331,6 +349,7 @@ function getSubjectsFromCategory(param) { + setDatabaseRunning(true); if (document.all){ //IE var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); @@ -353,6 +372,8 @@ document.getElementById('SearchResultBox').style.display='block'; } } + if (XhrObj.readyState == 4) + setDatabaseRunning(false); } XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); Modified: trunk/src/dbpedia-navigator/js/navigator.js =================================================================== --- trunk/src/dbpedia-navigator/js/navigator.js 2008-09-24 08:09:38 UTC (rev 1246) +++ trunk/src/dbpedia-navigator/js/navigator.js 2008-09-24 08:45:14 UTC (rev 1247) @@ -3,6 +3,12 @@ if (running) document.getElementById('Loading').style.display='inline'; else document.getElementById('Loading').style.display='none'; } + +function setDatabaseRunning(running) +{ + if (running) document.getElementById('DatabaseLoading').style.display='inline'; + else document.getElementById('DatabaseLoading').style.display='none'; +} function loadGoogleMap(Lat,Lng,Label) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |