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