From: <jen...@us...> - 2008-01-11 09:23:52
|
Revision: 365 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=365&view=rev Author: jenslehmann Date: 2008-01-11 01:23:49 -0800 (Fri, 11 Jan 2008) Log Message: ----------- fixed some smaller problems Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/ajaxfunctions.php trunk/src/dl-learner/org/dllearner/core/ReasoningService.java trunk/src/dl-learner/org/dllearner/kb/SparqlOntologyCollector.java Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-01-10 18:52:03 UTC (rev 364) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-01-11 09:23:49 UTC (rev 365) @@ -55,18 +55,18 @@ $this->client->applyConfigEntryBoolean($this->id, $this->ksID, "dumpToFile", true); $this->client->setReasoner($this->id, "dig"); - if(!isset($negExamples)) + if(empty($negExamples)) $this->client->setLearningProblem($this->id, "posOnlyDefinition"); else $this->client->setLearningProblem($this->id, "posNegDefinition"); $this->client->setPositiveExamples($this->id, $posExamples); - if(isset($negExamples)) + if(!empty($negExamples)) $this->client->setNegativeExamples($this->id, $negExamples); $this->client->setLearningAlgorithm($this->id, "refinement"); $start = microtime(true); - $this->client->init($this->id); + $this->client->initAll($this->id); $threaded=true; Modified: trunk/src/dbpedia-navigator/ajaxfunctions.php =================================================================== --- trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-01-10 18:52:03 UTC (rev 364) +++ trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-01-11 09:23:49 UTC (rev 365) @@ -187,8 +187,11 @@ require_once("DLLearnerConnection.php"); $settings=new Settings(); $sc=new DLLearnerConnection($settings->dbpediauri,$settings->wsdluri,$_SESSION['id'],$_SESSION['ksID']); - - $concept=$sc->getConceptFromExamples($settings->sparqlttl,$_SESSION['positive'],$_SESSION['negative']); + + if(isset($_SESSION['negative'])) + $concept=$sc->getConceptFromExamples($settings->sparqlttl,$_SESSION['positive'],$_SESSION['negative']); + else + $concept=$sc->getConceptFromExamples($settings->sparqlttl,$_SESSION['positive'], array()); $_SESSION['lastLearnedConcept']=$concept; if (strlen(substr (strrchr ($concept, "/"), 1))>0) $concept=urldecode(substr (strrchr ($concept, "/"), 1)); } Modified: trunk/src/dl-learner/org/dllearner/core/ReasoningService.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/ReasoningService.java 2008-01-10 18:52:03 UTC (rev 364) +++ trunk/src/dl-learner/org/dllearner/core/ReasoningService.java 2008-01-11 09:23:49 UTC (rev 365) @@ -21,6 +21,7 @@ package org.dllearner.core; import java.io.File; +import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; @@ -79,25 +80,22 @@ // private SortedSet<Concept> retrievalsSet = new TreeSet<Concept>(new ConceptComparator()); - // Caching f�r allgemeinere/speziellere atomare Konzepte => wird innerhalb der Reasoner gemacht - // private Map<Concept,Set<Concept>> moreGeneralConcepts = new HashMap<Concept,Set<Concept>>(); - // private Map<Concept,Set<Concept>> moreSpecialConcepts = new HashMap<Concept,Set<Concept>>(); - private Reasoner reasoner; - // note that you must not modify the underlying knowledge base of - // a reasoning service (if you do, you have to create a new reasoning - // service object) + /** + * Constructs a reasoning service object. Note that you must not + * modify the underlying knowledge base of a reasoning service + * (if you do, you have to create a new reasoning service object). + * Further note, that the initialisation is lazy, e.g. you can + * feed the constructor with a non-initialised reasoner component. + * However, of course you need to make sure that the resoner component + * is initialised before the first reasoner query. + * + * @param reasoner + */ public ReasoningService(ReasonerComponent reasoner) { this.reasoner = reasoner; - // list view: the following two lines are commented out, because otherwise the ReasonerComponent - // already has to be initialised when a ReasoningService instance is created; this is problematic - // e.g. for the web service interface, which does not expose the ReasoningService - // (because it is not a component itself) - // atomicConceptsList = new LinkedList<AtomicConcept>(getAtomicConcepts()); - // atomicRolesList = new LinkedList<AtomicRole>(getAtomicRoles()); - resetStatistics(); } @@ -430,12 +428,14 @@ } public List<AtomicConcept> getAtomicConceptsList() { - // not working, see message in constructor + if(atomicConceptsList == null) + atomicConceptsList = new LinkedList<AtomicConcept>(getAtomicConcepts()); return atomicConceptsList; } public List<AtomicRole> getAtomicRolesList() { - // not working, see message in constructor + if(atomicRolesList == null) + atomicRolesList = new LinkedList<AtomicRole>(getAtomicRoles()); return atomicRolesList; } Modified: trunk/src/dl-learner/org/dllearner/kb/SparqlOntologyCollector.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/SparqlOntologyCollector.java 2008-01-10 18:52:03 UTC (rev 364) +++ trunk/src/dl-learner/org/dllearner/kb/SparqlOntologyCollector.java 2008-01-11 09:23:49 UTC (rev 365) @@ -46,7 +46,7 @@ public class SparqlOntologyCollector { boolean print_flag=false; - SparqlQueryMaker q; + SparqlQueryMaker queryMaker; SparqlCache cache; URL url; SparqlFilter sf; @@ -89,7 +89,7 @@ this.subjectList=subjectList; this.numberOfRecursions=numberOfRecursions; this.format=format; - this.q=new SparqlQueryMaker(); + this.queryMaker=new SparqlQueryMaker(); this.cache=new SparqlCache("cache"); if(defClasses!=null && defClasses.length>0 ){ this.defaultClasses=defClasses; @@ -107,7 +107,7 @@ public SparqlOntologyCollector(URL url) { - this.q=new SparqlQueryMaker(); + this.queryMaker=new SparqlQueryMaker(); this.cache=new SparqlCache("cache"); this.url=url; } @@ -130,7 +130,7 @@ public String[] collectTriples(String subject) throws IOException{ System.out.println("Searching for Article: "+subject); - String sparql=q.makeArticleQuery(subject); + String sparql=queryMaker.makeArticleQuery(subject); String fromCache=cache.get(subject, sparql); String xml; // if not in cache get it from dbpedia @@ -180,7 +180,7 @@ public String[] getSubjectsFromLabel(String label, int limit) throws IOException{ System.out.println("Searching for Label: "+label); - String sparql=q.makeLabelQuery(label,limit); + String sparql=queryMaker.makeLabelQuery(label,limit); String FromCache=cache.get(label, sparql); String xml; // if not in cache get it from dbpedia @@ -200,7 +200,7 @@ public String[] getSubjectsFromConcept(String concept) throws IOException { System.out.println("Searching for Subjects of type: "+concept); - String sparql=q.makeConceptQuery(concept); + String sparql=queryMaker.makeConceptQuery(concept); String FromCache=cache.get(concept, sparql); String xml; // if not in cache get it from dbpedia @@ -240,7 +240,7 @@ return; else {NumberofRecursions--;} - String sparql=q.makeQueryFilter(StartingSubject,this.sf); + String sparql=queryMaker.makeQueryFilter(StartingSubject,this.sf); // checks cache String FromCache=cache.get(StartingSubject, sparql); String xml; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |