From: <ku...@us...> - 2008-01-10 09:08:07
|
Revision: 360 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=360&view=rev Author: kurzum Date: 2008-01-10 01:08:04 -0800 (Thu, 10 Jan 2008) Log Message: ----------- latest changes forgot to commit Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/kb/sparql/ClassNode.java trunk/src/dl-learner/org/dllearner/kb/sparql/Configuration.java trunk/src/dl-learner/org/dllearner/kb/sparql/ExtractionAlgorithm.java trunk/src/dl-learner/org/dllearner/kb/sparql/Manager.java trunk/src/dl-learner/org/dllearner/kb/sparql/TypedSparqlQuery.java trunk/src/dl-learner/org/dllearner/kb/sparql/TypedSparqlQueryClasses.java Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/ClassNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/ClassNode.java 2008-01-10 09:07:30 UTC (rev 359) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/ClassNode.java 2008-01-10 09:08:04 UTC (rev 360) @@ -104,7 +104,7 @@ return s; } - @Override + public int compareTo(Node n){ return super.compareTo(n); // Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/Configuration.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/Configuration.java 2008-01-10 09:07:30 UTC (rev 359) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/Configuration.java 2008-01-10 09:08:04 UTC (rev 360) @@ -37,23 +37,27 @@ // the following needs to be moved to // class extraction algorithm or manipulator private int recursiondepth = 2; - private boolean getAllBackground = true; + private boolean getAllSuperClasses = true; + private boolean closeAfterRecursion = true; + public int numberOfUncachedSparqlQueries=0; + public int numberOfCachedSparqlQueries=0; public Configuration(SpecificSparqlEndpoint specificSparqlEndpoint, SparqlQueryType sparqlQueryType, Manipulator manipulator, int recursiondepth, - boolean getAllBackground) { + boolean getAllSuperClasses, boolean closeAfterRecursion) { this.specificSparqlEndpoint = specificSparqlEndpoint; this.sparqlQueryType = sparqlQueryType; this.manipulator = manipulator; this.recursiondepth = recursiondepth; - this.getAllBackground = getAllBackground; + this.getAllSuperClasses = getAllSuperClasses; + this.closeAfterRecursion=closeAfterRecursion; } public Configuration changeQueryType(SparqlQueryType sqt) { // TODO must clone here return new Configuration(this.specificSparqlEndpoint, sqt, this.manipulator, - this.recursiondepth, this.getAllBackground); + this.recursiondepth, this.getAllSuperClasses,this.closeAfterRecursion); } @@ -69,12 +73,22 @@ return sparqlQueryType; } - public boolean isGetAllBackground() { - return getAllBackground; + public boolean isGetAllSuperClasses() { + return getAllSuperClasses; } + public boolean isCloseAfterRecursion() { + return closeAfterRecursion; + } public int getRecursiondepth() { return recursiondepth; } + + public void increaseNumberOfuncachedSparqlQueries(){ + numberOfUncachedSparqlQueries++; + } + public void increaseNumberOfCachedSparqlQueries(){ + numberOfCachedSparqlQueries++; + } } Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/ExtractionAlgorithm.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/ExtractionAlgorithm.java 2008-01-10 09:07:30 UTC (rev 359) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/ExtractionAlgorithm.java 2008-01-10 09:08:04 UTC (rev 360) @@ -32,17 +32,17 @@ private Configuration configuration; private Manipulator manipulator; - private int recursionDepth = 2; - private boolean getAllBackground = true; - private boolean closeAfterRecursion = true; + private int recursionDepth = 1; + //private boolean getAllSuperClasses = true; + //private boolean closeAfterRecursion = true; private boolean print_flag=false; public ExtractionAlgorithm(Configuration Configuration) { this.configuration = Configuration; this.manipulator = Configuration.getManipulator(); this.recursionDepth = Configuration.getRecursiondepth(); - this.getAllBackground = Configuration.isGetAllBackground(); - + //this.getAllSuperClasses = Configuration.isGetAllSuperClasses(); + //this.closeAfterRecursion=Configuration.isCloseAfterRecursion(); } public Node getFirstNode(URI u) { @@ -87,13 +87,13 @@ v = tmp; System.out.println("Recursion counter: " + x + " with " + v.size() + " Nodes remaining, needed: " - +(System.currentTimeMillis()-time)); + +(System.currentTimeMillis()-time)+"ms"); time=System.currentTimeMillis(); } HashSet<String> hadAlready=new HashSet<String>(); // gets All Class Nodes and expands them further - if (this.getAllBackground) { + if (this.configuration.isGetAllSuperClasses()) { //Set<Node> classes = new TreeSet<Node>(); Vector<Node> classes = new Vector<Node>(); @@ -107,9 +107,9 @@ } } - System.out.println(instances.size()); + //System.out.println(instances.size()); TypedSparqlQueryClasses tsqc=new TypedSparqlQueryClasses(configuration); - if(closeAfterRecursion){ + if(this.configuration.isCloseAfterRecursion()){ while (instances.size() > 0) { p("Getting classes for remaining instances: " + instances.size()); Node next = instances.remove(0); @@ -134,7 +134,7 @@ tmp=next.expand(tsp, manipulator); classes.addAll(tmp); tmp=new Vector<Node>(); - if(i % 50==0)System.out.println("got "+i+" extra classes, max: "+manipulator.breakSuperClassRetrievalAfter); + //if(i % 50==0)System.out.println("got "+i+" extra classes, max: "+manipulator.breakSuperClassRetrievalAfter); i++; if (i>=manipulator.breakSuperClassRetrievalAfter){break;} } Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/Manager.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/Manager.java 2008-01-10 09:07:30 UTC (rev 359) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/Manager.java 2008-01-10 09:08:04 UTC (rev 360) @@ -41,10 +41,10 @@ public void useConfiguration(SparqlQueryType SparqlQueryType, SpecificSparqlEndpoint SparqlEndpoint, Manipulator manipulator, int recursiondepth, - boolean getAllBackground) { + boolean getAllSuperClasses,boolean closeAfterRecursion) { this.configuration = new Configuration(SparqlEndpoint, SparqlQueryType, manipulator, - recursiondepth, getAllBackground); + recursiondepth, getAllSuperClasses, closeAfterRecursion); this.typedSparqlQuery = new TypedSparqlQuery(configuration); this.extractionAlgorithm = new ExtractionAlgorithm(configuration); @@ -117,6 +117,7 @@ nt.append((String) arr[i]+"\n"); if(i%1000==0)System.out.println(i+" of "+arr.length+" triples done"); } + System.out.println(arr.length+" of "+arr.length+" triples done"); /* String tmp=""; while ( ret.size() > 0) { @@ -136,5 +137,9 @@ this.configuration.getSparqlQueryType().addPredicateFilter(str); } + + public Configuration getConfiguration(){ + return configuration; + } } \ No newline at end of file Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/TypedSparqlQuery.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/TypedSparqlQuery.java 2008-01-10 09:07:30 UTC (rev 359) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/TypedSparqlQuery.java 2008-01-10 09:08:04 UTC (rev 360) @@ -97,6 +97,7 @@ String xml = null; // if not in cache get it from EndPoint if (FromCache == null) { + configuration.increaseNumberOfuncachedSparqlQueries(); try { xml = sendAndReceiveSPARQL(sparql); } catch (IOException e) { @@ -110,6 +111,7 @@ } //System.out.print("\n"); } else { + configuration.increaseNumberOfCachedSparqlQueries(); xml = FromCache; //System.out.println("FROM CACHE"); } Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/TypedSparqlQueryClasses.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/TypedSparqlQueryClasses.java 2008-01-10 09:07:30 UTC (rev 359) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/TypedSparqlQueryClasses.java 2008-01-10 09:08:04 UTC (rev 360) @@ -81,6 +81,7 @@ String xml = null; // if not in cache get it from EndPoint if (FromCache == null) { + configuration.increaseNumberOfuncachedSparqlQueries(); try { xml = sendAndReceiveSPARQL(sparql); } catch (IOException e) { @@ -94,6 +95,7 @@ } //System.out.print("\n"); } else { + configuration.increaseNumberOfCachedSparqlQueries(); xml = FromCache; //System.out.println("FROM CACHE"); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |