You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(120) |
Sep
(36) |
Oct
(116) |
Nov
(17) |
Dec
(44) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(143) |
Feb
(192) |
Mar
(74) |
Apr
(84) |
May
(105) |
Jun
(64) |
Jul
(49) |
Aug
(120) |
Sep
(159) |
Oct
(156) |
Nov
(51) |
Dec
(28) |
2009 |
Jan
(17) |
Feb
(55) |
Mar
(33) |
Apr
(57) |
May
(54) |
Jun
(28) |
Jul
(6) |
Aug
(16) |
Sep
(38) |
Oct
(30) |
Nov
(26) |
Dec
(52) |
2010 |
Jan
(7) |
Feb
(91) |
Mar
(65) |
Apr
(2) |
May
(14) |
Jun
(25) |
Jul
(38) |
Aug
(48) |
Sep
(80) |
Oct
(70) |
Nov
(75) |
Dec
(77) |
2011 |
Jan
(68) |
Feb
(53) |
Mar
(51) |
Apr
(35) |
May
(65) |
Jun
(101) |
Jul
(29) |
Aug
(230) |
Sep
(95) |
Oct
(49) |
Nov
(110) |
Dec
(63) |
2012 |
Jan
(41) |
Feb
(42) |
Mar
(25) |
Apr
(46) |
May
(51) |
Jun
(44) |
Jul
(45) |
Aug
(29) |
Sep
(12) |
Oct
(9) |
Nov
(17) |
Dec
(2) |
2013 |
Jan
(12) |
Feb
(14) |
Mar
(7) |
Apr
(16) |
May
(54) |
Jun
(27) |
Jul
(11) |
Aug
(5) |
Sep
(85) |
Oct
(27) |
Nov
(37) |
Dec
(32) |
2014 |
Jan
(8) |
Feb
(29) |
Mar
(5) |
Apr
(3) |
May
(22) |
Jun
(3) |
Jul
(4) |
Aug
(3) |
Sep
|
Oct
|
Nov
|
Dec
|
From: <ku...@us...> - 2007-12-05 12:51:08
|
Revision: 327 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=327&view=rev Author: kurzum Date: 2007-12-05 04:50:59 -0800 (Wed, 05 Dec 2007) Log Message: ----------- added more solutions Modified Paths: -------------- trunk/examples/sparql/simpleSKOS_angela.conf trunk/examples/sparql/simpleSKOS_gerhard.conf Modified: trunk/examples/sparql/simpleSKOS_angela.conf =================================================================== --- trunk/examples/sparql/simpleSKOS_angela.conf 2007-12-05 12:45:39 UTC (rev 326) +++ trunk/examples/sparql/simpleSKOS_angela.conf 2007-12-05 12:50:59 UTC (rev 327) @@ -2,6 +2,7 @@ * Simple example for using a SPARQL Endpoint as background * knowledge. * Solutions: + with 500 classes http://dbpedia.org/resource/Category:Business (length 1, depth 1) http://dbpedia.org/resource/Category:Business_executives (length 1, depth 1) http://dbpedia.org/resource/Category:Businesspeople (length 1, depth 1) @@ -45,6 +46,43 @@ http://dbpedia.org/resource/Category:Women_by_occupation%7CPolitics (length 1, depth 1) http://dbpedia.org/resource/Category:Women_rulers%7CHeads_of_government%2C_female (length 1, depth 1) +with 200 classes +http://dbpedia.org/resource/Category:Cities_in_Germany (length 1, depth 1) + http://dbpedia.org/resource/Category:City_states (length 1, depth 1) + http://dbpedia.org/resource/Category:Former_countries_in_Europe (length 1, depth 1) + http://dbpedia.org/resource/Category:German_people_by_occupation%7CScientists (length 1, depth 1) + http://dbpedia.org/resource/Category:German_people_by_state%7CHamburg (length 1, depth 1) + http://dbpedia.org/resource/Category:German_politicians_by_party%7CChristian_Democrat (length 1, depth 1) + http://dbpedia.org/resource/Category:German_state_capitals (length 1, depth 1) + http://dbpedia.org/resource/Category:Hanseatic_League (length 1, depth 1) + http://dbpedia.org/resource/Category:Heads_of_government (length 1, depth 1) + http://dbpedia.org/resource/Category:Heads_of_state (length 1, depth 1) + http://dbpedia.org/resource/Category:Lutherans_by_profession%7CPoliticians (length 1, depth 1) + http://dbpedia.org/resource/Category:People_by_city_in_Germany%7CHamburg (length 1, depth 1) + http://dbpedia.org/resource/Category:Political_parties (length 1, depth 1) + http://dbpedia.org/resource/Category:Politicians (length 1, depth 1) + http://dbpedia.org/resource/Category:Protestant_politicians (length 1, depth 1) + http://dbpedia.org/resource/Category:Science_and_technology_in_Germany%7CScientists (length 1, depth 1) + http://dbpedia.org/resource/Category:Scientists_by_nationality (length 1, depth 1) + http://dbpedia.org/resource/Category:Women_by_occupation%7CPolitics (length 1, depth 1) + http://dbpedia.org/resource/Category:Women_rulers%7CHeads_of_government%2C_female (length 1, depth 1) + + +These are the original direct results from dbpedia: +skos:subject [http] :Category:1954_births [http] - +skos:subject [http] :Category:Chancellors_of_Germany [http] - +skos:subject [http] :Category:Current_female_heads_of_government [http] - +skos:subject [http] :Category:Current_national_leaders [http] - +skos:subject [http] :Category:Female_heads_of_government [http] - +skos:subject [http] :Category:German_Christian_Democrat_politicians [http] - +skos:subject [http] :Category:German_Lutherans [http] - +skos:subject [http] :Category:German_scientists [http] - +skos:subject [http] :Category:Leaders_of_political_parties [http] - +skos:subject [http] :Category:Living_people [http] - +skos:subject [http] :Category:Lutheran_politicians [http] - +skos:subject [http] :Category:People_from_Hamburg [http] - +skos:subject [http] :Category:Women_in_politics [http] + */ // recursion depth of extraction algorithm @@ -75,7 +113,7 @@ // because skos is cyclic this stops it // manually after retrieving the specified amount of classes // greatly influences the amount of answers retrieved -sparql2.breakSuperClassRetrievalAfter=300; +sparql2.breakSuperClassRetrievalAfter=200; // use DBpedia endpoint Modified: trunk/examples/sparql/simpleSKOS_gerhard.conf =================================================================== --- trunk/examples/sparql/simpleSKOS_gerhard.conf 2007-12-05 12:45:39 UTC (rev 326) +++ trunk/examples/sparql/simpleSKOS_gerhard.conf 2007-12-05 12:50:59 UTC (rev 327) @@ -46,7 +46,22 @@ http://dbpedia.org/resource/Category:Romanian_society%7CDecorations (length 1, depth 1) http://dbpedia.org/resource/Category:Saxons (length 1, depth 1) http://dbpedia.org/resource/Category:Social_democrats%7CPoliticians_of_the_Social_Democratic_Party_of_Germany (length 1, depth 1) + + + These are the original direct results from dbpedia: + skos:subject [http] :Category:1944_births [http] - + skos:subject [http] :Category:Chancellors_of_Germany [http] - + skos:subject [http] :Category:German_Lutherans [http] - + skos:subject [http] :Category:German_adoptive_parents [http] - + skos:subject [http] :Category:History_of_Lower_Saxony [http] - + skos:subject [http] :Category:Living_people [http] - + skos:subject [http] :Category:People_from_North_Rhine-Westphalia [http] - + skos:subject [http] :Category:Politicians_of_the_Social_Democratic_Party_of_Germany [http] - +skos:subject [http] :Category:Recipients_of_the_Star_of_Romania_Order [http] + */ + + // recursion depth of extraction algorithm sparql2.recursionDepth = 2; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ku...@us...> - 2007-12-05 12:44:59
|
Revision: 325 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=325&view=rev Author: kurzum Date: 2007-12-05 04:44:53 -0800 (Wed, 05 Dec 2007) Log Message: ----------- added option breakSuperClassRetrievalAfter needed for SKOS Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/kb/SparqlEndpointRestructured.java trunk/src/dl-learner/org/dllearner/kb/sparql/ExtractionAlgorithm.java trunk/src/dl-learner/org/dllearner/kb/sparql/Manipulator.java Modified: trunk/src/dl-learner/org/dllearner/kb/SparqlEndpointRestructured.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/SparqlEndpointRestructured.java 2007-12-05 12:24:13 UTC (rev 324) +++ trunk/src/dl-learner/org/dllearner/kb/SparqlEndpointRestructured.java 2007-12-05 12:44:53 UTC (rev 325) @@ -80,6 +80,7 @@ private boolean dumpToFile = true; private boolean useLits = false; private boolean getAllSuperClasses = true; + private int breakSuperClassRetrievalAfter = 500; private boolean learnDomain = false; private String role; @@ -166,8 +167,9 @@ options.add(new StringTupleListConfigOption("example", "example")); options.add(new StringTupleListConfigOption("replacePredicate", "rule for replacing predicates")); options.add(new StringTupleListConfigOption("replaceObject", "rule for replacing predicates")); + options.add(new IntegerConfigOption("breakSuperClassRetrievalAfter", "stops a cyclic hierarchy after specified number of classes")); + - return options; } @@ -222,9 +224,10 @@ replacePredicate = (LinkedList)entry.getValue(); }else if (option.equals("replaceObject")) { replaceObject = (LinkedList)entry.getValue(); - + }else if (option.equals("breakSuperClassRetrievalAfter")) { + breakSuperClassRetrievalAfter = (Integer) entry.getValue(); } - + } /* @@ -244,7 +247,7 @@ SpecificSparqlEndpoint sse = null; SparqlQueryType sqt = null; // get Options for Manipulator - Manipulator man = new Manipulator(blankNodeIdentifier,replacePredicate,replaceObject); + Manipulator man = new Manipulator(blankNodeIdentifier,breakSuperClassRetrievalAfter,replacePredicate,replaceObject); HashMap<String, String> parameters = new HashMap<String, String>(); parameters.put("default-graph-uri", "http://dbpedia.org"); parameters.put("format", "application/sparql-results.xml"); Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/ExtractionAlgorithm.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/ExtractionAlgorithm.java 2007-12-05 12:24:13 UTC (rev 324) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/ExtractionAlgorithm.java 2007-12-05 12:44:53 UTC (rev 325) @@ -94,7 +94,7 @@ Node next = classes.remove(0); System.out.println("Expanding: " + next); classes.addAll(next.expand(tsp, manipulator)); - if (classes.size()>=500){break;} + if (classes.size()>=manipulator.breakSuperClassRetrievalAfter){break;} } } Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/Manipulator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/Manipulator.java 2007-12-05 12:24:13 UTC (rev 324) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/Manipulator.java 2007-12-05 12:44:53 UTC (rev 325) @@ -31,6 +31,7 @@ public String subclass = "http://www.w3.org/2000/01/rdf-schema#subClassOf"; public String type = "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"; public String blankNodeIdentifier = "bnode"; + public int breakSuperClassRetrievalAfter=200; public LinkedList<StringTuple> replacePredicate; public LinkedList<StringTuple> replaceObject; @@ -44,7 +45,7 @@ "http://dbpedia.org/resource/Category:", "http://dbpedia.org/resource/Template:", "http://www.w3.org/2004/02/skos/core", "http://dbpedia.org/class/" }; - public Manipulator(String blankNodeIdentifier,LinkedList<StringTuple> replacePredicate,LinkedList<StringTuple> replaceObject) { + public Manipulator(String blankNodeIdentifier,int breakSuperClassRetrievalAfter,LinkedList<StringTuple> replacePredicate,LinkedList<StringTuple> replaceObject) { this.blankNodeIdentifier = blankNodeIdentifier; this.replaceObject=replaceObject; this.replacePredicate=replacePredicate; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ku...@us...> - 2007-12-05 12:24:18
|
Revision: 324 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=324&view=rev Author: kurzum Date: 2007-12-05 04:24:13 -0800 (Wed, 05 Dec 2007) Log Message: ----------- added a break for skos after 500 classes, because they are cyclic Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/kb/sparql/ExtractionAlgorithm.java trunk/src/dl-learner/org/dllearner/kb/sparql/PredefinedEndpoint.java trunk/src/dl-learner/org/dllearner/kb/sparql/PredefinedFilter.java Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/ExtractionAlgorithm.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/ExtractionAlgorithm.java 2007-12-04 18:02:06 UTC (rev 323) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/ExtractionAlgorithm.java 2007-12-05 12:24:13 UTC (rev 324) @@ -94,6 +94,7 @@ Node next = classes.remove(0); System.out.println("Expanding: " + next); classes.addAll(next.expand(tsp, manipulator)); + if (classes.size()>=500){break;} } } Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/PredefinedEndpoint.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/PredefinedEndpoint.java 2007-12-04 18:02:06 UTC (rev 323) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/PredefinedEndpoint.java 2007-12-05 12:24:13 UTC (rev 324) @@ -31,6 +31,10 @@ return dbpediaEndpoint(); case 2: return localJoseki(); + case 3: + return worldFactBook(); + case 4: + return govTrack(); } return null; } @@ -60,4 +64,29 @@ } return new SpecificSparqlEndpoint(u, "localost", m); } + public static SpecificSparqlEndpoint worldFactBook() { + URL u = null; + HashMap<String, String> m = new HashMap<String, String>(); + // m.put("default-graph-uri", "http://dbpedia.org"); + // m.put("format", "application/sparql-results.xml"); + try { + u = new URL("http://www4.wiwiss.fu-berlin.de/factbook/sparql"); + } catch (Exception e) { + e.printStackTrace(); + } + return new SpecificSparqlEndpoint(u, "www4.wiwiss.fu-berlin.de", m); + } + public static SpecificSparqlEndpoint govTrack() { + URL u = null; + HashMap<String, String> m = new HashMap<String, String>(); + // m.put("default-graph-uri", "http://dbpedia.org"); + // m.put("format", "application/sparql-results.xml"); + try { + u = new URL("http://www.rdfabout.com/sparql"); + } catch (Exception e) { + e.printStackTrace(); + } + return new SpecificSparqlEndpoint(u, "www.rdfabout.com", m); + } + } Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/PredefinedFilter.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/PredefinedFilter.java 2007-12-04 18:02:06 UTC (rev 323) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/PredefinedFilter.java 2007-12-05 12:24:13 UTC (rev 324) @@ -31,7 +31,7 @@ case 1: return YagoFilter(); case 2: - return CategoriesOnly(); + return SKOS(); } return null; } @@ -64,15 +64,16 @@ return new SparqlQueryType("forbid", obj, pred, "false"); } - public static SparqlQueryType CategoriesOnly(){ + public static SparqlQueryType SKOS(){ Set<String> pred = new HashSet<String>(); - pred.add("http://www.w3.org/2004/02/skos/core"); + //pred.add("http://www.w3.org/2004/02/skos/core"); pred.add("http://www.w3.org/2002/07/owl#sameAs"); pred.add("http://xmlns.com/foaf/0.1/"); pred.add("http://dbpedia.org/property/reference"); pred.add("http://dbpedia.org/property/website"); pred.add("http://dbpedia.org/property/wikipage"); + pred.add("http://www.w3.org/2004/02/skos/core#narrower"); pred.add("http://dbpedia.org/property/wikiPageUsesTemplate"); Set<String> obj = new HashSet<String>(); @@ -85,8 +86,8 @@ obj.add("http://www.geonames.org"); obj.add("http://www.w3.org/2006/03/wn/wn20/instances/synset"); obj.add("http://www4.wiwiss.fu-berlin.de/flickrwrappr"); - obj.add("http://www.w3.org/2004/02/skos/core"); + obj.add("http://dbpedia.org/class/yago"); obj.add("http://dbpedia.org/resource/Template"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2007-12-04 18:02:15
|
Revision: 323 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=323&view=rev Author: jenslehmann Date: 2007-12-04 10:02:06 -0800 (Tue, 04 Dec 2007) Log Message: ----------- cleaned up Aristotle example Modified Paths: -------------- trunk/examples/sparql/Aristotle.conf trunk/examples/sparql/simple.conf Modified: trunk/examples/sparql/Aristotle.conf =================================================================== --- trunk/examples/sparql/Aristotle.conf 2007-12-04 17:08:42 UTC (rev 322) +++ trunk/examples/sparql/Aristotle.conf 2007-12-04 18:02:06 UTC (rev 323) @@ -1,62 +1,33 @@ -// reasoner settings -reasoner = dig; -//digReasonerURL = "http://localhost:8081"; -//useRetrievalForClassification = false; -//refinement.useDIGMultiInstanceChecks = twoChecks; +/** + * Some people from Greece. + * + * Possible Solution: + * Theorist OR (Mathematician AND Physicist) + * + */ -// algorithm settings -algorithm = refinement; -//refinement.horizontalExpansionFactor = 0.6; -//refinement.quiet = false; -//refinement.useTooWeakList = true; - -// search tree protocol -//refinement.writeSearchTree = false; -//refinement.searchTreeFile = "Aristotle_searchTree.txt"; - -// control output -cli.checkSatisfiability = true; -cli.showIndividuals = false; -cli.showConcepts = false; -cli.showRoles = true; -cli.showSubsumptionHierarchy = false; - - - // SPARQL options -sparql2.numberOfRecursions = 2; -sparql2.getAllBackground=true; -sparql2.format = "N-TRIPLES"; -sparql2.dumpToFile = true; -sparql2.instances = { - "http://dbpedia.org/resource/Democritus", - "http://dbpedia.org/resource/Zeno_of_Elea", - "http://dbpedia.org/resource/Plato", - "http://dbpedia.org/resource/Socrates", - "http://dbpedia.org/resource/Archytas", - "http://dbpedia.org/resource/Pythagoras", - "http://dbpedia.org/resource/Philolaus"}; +sparql2.recursionDepth = 2; -//predefined Endpoint overrides host and it doesn't matter what the string in import below looks like -// 0 means nothing -// 1 means dbpedia -// 2 means localhost:2020 default joseki -sparql2.predefinedEndpoint=1; - - -//predefined filter overrides predList and ObjList +//predefined filter (1 = YAGO based learning) sparql2.predefinedFilter = 1; -//filtermode 1 and above uses a predefined setting -// 0 means nothing (manual configuration) -// 1 means only yago classes import("http://dbpedia.openlinksw.com:8890/sparql","SPARQL2"); -/** examples **/ +sparql2.instances = { + "http://dbpedia.org/resource/Democritus", + "http://dbpedia.org/resource/Zeno_of_Elea", + "http://dbpedia.org/resource/Plato", + "http://dbpedia.org/resource/Socrates", + "http://dbpedia.org/resource/Archytas", + "http://dbpedia.org/resource/Pythagoras", + "http://dbpedia.org/resource/Philolaus" +}; + +"http://dbpedia.org/resource/Pythagoras" +"http://dbpedia.org/resource/Philolaus" +"http://dbpedia.org/resource/Archytas" -"http://dbpedia.org/resource/Socrates" -"http://dbpedia.org/resource/Plato" -"http://dbpedia.org/resource/Zeno_of_Elea" --"http://dbpedia.org/resource/Democritus" \ No newline at end of file +-"http://dbpedia.org/resource/Democritus" Modified: trunk/examples/sparql/simple.conf =================================================================== --- trunk/examples/sparql/simple.conf 2007-12-04 17:08:42 UTC (rev 322) +++ trunk/examples/sparql/simple.conf 2007-12-04 18:02:06 UTC (rev 323) @@ -44,8 +44,6 @@ "http://dbpedia.org/resource/Gerhard_Schr%C3%B6der" }; -sparql2.example = [(a,b),(c,d)]; - /** examples **/ +"http://dbpedia.org/resource/Angela_Merkel" -"http://dbpedia.org/resource/Gerhard_Schr%C3%B6der" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ku...@us...> - 2007-12-04 17:08:51
|
Revision: 322 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=322&view=rev Author: kurzum Date: 2007-12-04 09:08:42 -0800 (Tue, 04 Dec 2007) Log Message: ----------- commented everything with a few lines, implemented replacement of skos, example will follow Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/kb/SparqlEndpointRestructured.java 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/InstanceNode.java trunk/src/dl-learner/org/dllearner/kb/sparql/Manager.java trunk/src/dl-learner/org/dllearner/kb/sparql/Manipulator.java trunk/src/dl-learner/org/dllearner/kb/sparql/PredefinedFilter.java trunk/src/dl-learner/org/dllearner/kb/sparql/PropertyNode.java trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryMaker.java trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryType.java trunk/src/dl-learner/org/dllearner/kb/sparql/TypedSparqlQuery.java trunk/src/dl-learner/org/dllearner/utilities/StringTuple.java Modified: trunk/src/dl-learner/org/dllearner/kb/SparqlEndpointRestructured.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/SparqlEndpointRestructured.java 2007-12-03 22:06:30 UTC (rev 321) +++ trunk/src/dl-learner/org/dllearner/kb/SparqlEndpointRestructured.java 2007-12-04 17:08:42 UTC (rev 322) @@ -26,8 +26,10 @@ import java.net.MalformedURLException; import java.net.URI; import java.net.URL; +import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; +import java.util.HashSet; import java.util.LinkedList; import java.util.Set; @@ -52,6 +54,7 @@ import org.dllearner.parser.KBParser; import org.dllearner.reasoning.DIGConverter; import org.dllearner.reasoning.JenaOWLDIGConverter; +import org.dllearner.utilities.StringTuple; /** * Represents a SPARQL Endpoint. @@ -65,13 +68,13 @@ // ConfigOptions private URL url; String host; - private Set<String> instances; + private Set<String> instances=new HashSet<String>();; private URL dumpFile; private int recursionDepth = 2; private int predefinedFilter = 0; private int predefinedEndpoint = 0; - private Set<String> predList; - private Set<String> objList; + private Set<String> predList=new HashSet<String>(); + private Set<String> objList=new HashSet<String>(); private Set<String> classList; private String format = "N-TRIPLES"; private boolean dumpToFile = true; @@ -81,6 +84,10 @@ private boolean learnDomain = false; private String role; private String blankNodeIdentifier = "bnode"; + + LinkedList<StringTuple> URIParameters = new LinkedList<StringTuple>(); + LinkedList<StringTuple> replacePredicate = new LinkedList<StringTuple>(); + LinkedList<StringTuple> replaceObject = new LinkedList<StringTuple>(); /** * Holds the results of the calculateSubjects method @@ -157,7 +164,10 @@ "used to identify blanknodes in Tripels")); options.add(new StringTupleListConfigOption("example", "example")); + options.add(new StringTupleListConfigOption("replacePredicate", "rule for replacing predicates")); + options.add(new StringTupleListConfigOption("replaceObject", "rule for replacing predicates")); + return options; } @@ -208,6 +218,11 @@ blankNodeIdentifier = (String) entry.getValue(); } else if (option.equals("example")) { System.out.println(entry.getValue()); + }else if (option.equals("replacePredicate")) { + replacePredicate = (LinkedList)entry.getValue(); + }else if (option.equals("replaceObject")) { + replaceObject = (LinkedList)entry.getValue(); + } } @@ -229,7 +244,7 @@ SpecificSparqlEndpoint sse = null; SparqlQueryType sqt = null; // get Options for Manipulator - Manipulator man = new Manipulator(blankNodeIdentifier); + Manipulator man = new Manipulator(blankNodeIdentifier,replacePredicate,replaceObject); HashMap<String, String> parameters = new HashMap<String, String>(); parameters.put("default-graph-uri", "http://dbpedia.org"); parameters.put("format", "application/sparql-results.xml"); @@ -242,11 +257,13 @@ } // get Options for Filters + System.out.println("aaa"+predefinedFilter); if (predefinedFilter >= 1) { sqt = PredefinedFilter.getFilter(predefinedFilter); } else { sqt = new SparqlQueryType("forbid", objList, predList, useLits + ""); + System.out.println(sqt); } // give everything to the manager m.useConfiguration(sqt, sse, man, recursionDepth, getAllSuperClasses); @@ -255,10 +272,14 @@ // used to learn a domain of a role if (learnDomain) { instances = m.getDomainInstancesForRole(role); - // ad the role to the filter(a solution is always EXISTS + // add the role to the filter(a solution is always EXISTS // role.TOP) m.addPredicateFilter(role); - System.out.println(instances); + //System.out.println(instances); + // THIS is a workaround + for(String one:instances){ + System.out.println("+\""+one+"\""); + } } // the actual extraction is started here ont = m.extract(instances); Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/ClassNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/ClassNode.java 2007-12-03 22:06:30 UTC (rev 321) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/ClassNode.java 2007-12-04 17:08:42 UTC (rev 322) @@ -36,26 +36,33 @@ this.type = "class"; } + //expands all directly connected nodes @Override public Vector<Node> expand(TypedSparqlQuery tsq, Manipulator m) { Set<StringTuple> s = tsq.query(this.uri); + // see manipulator s = m.check(s, this); Vector<Node> Nodes = new Vector<Node>(); - // Manipulation + Iterator<StringTuple> it = s.iterator(); while (it.hasNext()) { StringTuple t = (StringTuple) it.next(); try { + // substitute rdf:type with owl:subclassof if (t.a.equals(m.type) || t.a.equals(m.subclass)) { ClassNode tmp = new ClassNode(new URI(t.b)); properties.add(new PropertyNode(new URI(m.subclass), this, tmp)); Nodes.add(tmp); } else { + // further expansion stops here + // Nodes.add(tmp); is missing on purpose ClassNode tmp = new ClassNode(new URI(t.b)); properties.add(new PropertyNode(new URI(t.a), this, tmp)); // System.out.println(m.blankNodeIdentifier); // System.out.println("XXXXX"+t.b); + + // if o is a blank node expand further if (t.b.startsWith(m.blankNodeIdentifier)) { tmp.expand(tsq, m); System.out.println(m.blankNodeIdentifier); @@ -72,6 +79,7 @@ return Nodes; } + // gets the types for properties recursively @Override public Vector<Node> expandProperties(TypedSparqlQuery tsq, Manipulator m) { // TODO return type doesn't make sense Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/Configuration.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/Configuration.java 2007-12-03 22:06:30 UTC (rev 321) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/Configuration.java 2007-12-04 17:08:42 UTC (rev 322) @@ -21,9 +21,17 @@ //stores all configuration settings public class Configuration { + + /* + * this class colects all configuration information + * see the other classes, which are used as attributes here + * */ + private SpecificSparqlEndpoint specificSparqlEndpoint; private SparqlQueryType sparqlQueryType; private Manipulator manipulator; + // the following needs to be moved to + // class extraction algorithm or manipulator private int recursiondepth = 2; private boolean getAllBackground = true; Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/ExtractionAlgorithm.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/ExtractionAlgorithm.java 2007-12-03 22:06:30 UTC (rev 321) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/ExtractionAlgorithm.java 2007-12-04 17:08:42 UTC (rev 322) @@ -50,6 +50,11 @@ return v; } + /*most important function + expands one example + cave: the recursion is not a recursion anymore, + it was transformed to an iteration + */ public Node expandNode(URI u, TypedSparqlQuery tsp) { Node n = getFirstNode(u); Vector<Node> v = new Vector<Node>(); @@ -64,6 +69,9 @@ Node tmpNode = v.remove(0); System.out.println("Expanding " + tmpNode); // System.out.println(this.Manipulator); + + // these are the new not expanded nodes + // the others are saved in connection with the original node Vector<Node> tmpVec = tmpNode.expand(tsp, manipulator); tmp.addAll(tmpVec); @@ -72,6 +80,8 @@ System.out .println("Recursion counter: " + x + " with " + v.size() + " Nodes remaining"); } + + // gets All Class Nodes and expands them further if (this.getAllBackground) { Vector<Node> classes = new Vector<Node>(); for (Node one : v) { Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/InstanceNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/InstanceNode.java 2007-12-03 22:06:30 UTC (rev 321) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/InstanceNode.java 2007-12-04 17:08:42 UTC (rev 322) @@ -40,11 +40,12 @@ } + //expands all directly connected nodes @Override public Vector<Node> expand(TypedSparqlQuery tsq, Manipulator m) { Set<StringTuple> s = tsq.query(uri); - // Manipulation + // see Manipulator m.check(s, this); // System.out.println("fffffff"+m); Vector<Node> Nodes = new Vector<Node>(); @@ -52,7 +53,8 @@ Iterator<StringTuple> it = s.iterator(); while (it.hasNext()) { StringTuple t = (StringTuple) it.next(); - + // basically : if p is rdf:type then o is a class + // else it is an instance try { if (t.a.equals(m.type)) { ClassNode tmp = new ClassNode(new URI(t.b)); @@ -74,6 +76,7 @@ return Nodes; } + // gets the types for properties recursively @Override public Vector<Node> expandProperties(TypedSparqlQuery tsq, Manipulator m) { for (PropertyNode one : properties) { Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/Manager.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/Manager.java 2007-12-03 22:06:30 UTC (rev 321) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/Manager.java 2007-12-04 17:08:42 UTC (rev 322) @@ -40,6 +40,7 @@ recursiondepth, getAllBackground); this.typedSparqlQuery = new TypedSparqlQuery(configuration); this.extractionAlgorithm = new ExtractionAlgorithm(configuration); + } public Set<String> getDomainInstancesForRole(String role) { @@ -76,6 +77,7 @@ // this.TypedSparqlQuery.query(uri); // System.out.println(ExtractionAlgorithm.getFirstNode(uri)); System.out.println("Start extracting"); + Node n = extractionAlgorithm.expandNode(uri, typedSparqlQuery); Set<String> s = n.toNTriple(); String nt = ""; Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/Manipulator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/Manipulator.java 2007-12-03 22:06:30 UTC (rev 321) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/Manipulator.java 2007-12-04 17:08:42 UTC (rev 322) @@ -21,6 +21,7 @@ import java.util.HashSet; import java.util.Iterator; +import java.util.LinkedList; import java.util.Set; import org.dllearner.utilities.StringTuple; @@ -30,6 +31,8 @@ public String subclass = "http://www.w3.org/2000/01/rdf-schema#subClassOf"; public String type = "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"; public String blankNodeIdentifier = "bnode"; + public LinkedList<StringTuple> replacePredicate; + public LinkedList<StringTuple> replaceObject; String objectProperty = "http://www.w3.org/2002/07/owl#ObjectProperty"; String classns = "http://www.w3.org/2002/07/owl#Class"; @@ -41,20 +44,27 @@ "http://dbpedia.org/resource/Category:", "http://dbpedia.org/resource/Template:", "http://www.w3.org/2004/02/skos/core", "http://dbpedia.org/class/" }; - public Manipulator(String blankNodeIdentifier) { + public Manipulator(String blankNodeIdentifier,LinkedList<StringTuple> replacePredicate,LinkedList<StringTuple> replaceObject) { this.blankNodeIdentifier = blankNodeIdentifier; + this.replaceObject=replaceObject; + this.replacePredicate=replacePredicate; + Set<String> classproperties = new HashSet<String>(); classproperties.add(subclass); } + // TODO user defined rules missing public Set<StringTuple> check(Set<StringTuple> s, Node node) { Set<StringTuple> toRemove = new HashSet<StringTuple>(); Iterator<StringTuple> it = s.iterator(); while (it.hasNext()) { StringTuple t = (StringTuple) it.next(); - // System.out.println(t); - // all classes with owl:type class + replacePredicate(t); + replaceObject(t); + + // remove <rdf:type, owl:class> + // this is done to avoid transformation to owl:subclassof if (t.a.equals(type) && t.b.equals(classns) && node instanceof ClassNode) { toRemove.add(t); } @@ -64,7 +74,7 @@ toRemove.add(t); } - // all instances with owl:type thing + // remove all instances with owl:type thing if (t.a.equals(type) && t.b.equals(thing) && node instanceof InstanceNode) { toRemove.add(t); } @@ -74,5 +84,20 @@ return s; } + + private void replacePredicate(StringTuple t){ + for(StringTuple rep:replacePredicate){ + if(rep.a.equals(t.a)){ + t.a=rep.b; + } + } + } + private void replaceObject(StringTuple t){ + for(StringTuple rep:replaceObject){ + if(rep.a.equals(t.a)){ + t.a=rep.b; + } + } + } } Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/PredefinedFilter.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/PredefinedFilter.java 2007-12-03 22:06:30 UTC (rev 321) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/PredefinedFilter.java 2007-12-04 17:08:42 UTC (rev 322) @@ -46,10 +46,13 @@ pred.add("http://dbpedia.org/property/reference"); pred.add("http://dbpedia.org/property/website"); pred.add("http://dbpedia.org/property/wikipage"); + pred.add("http://dbpedia.org/property/wikiPageUsesTemplate"); + Set<String> obj = new HashSet<String>(); obj.add("http://dbpedia.org/resource/Category:Wikipedia_"); obj.add("http://dbpedia.org/resource/Category:Articles_"); + obj.add("http://dbpedia.org/resource/Template"); obj.add("http://xmlns.com/foaf/0.1/"); obj.add("http://upload.wikimedia.org/wikipedia/commons"); obj.add("http://upload.wikimedia.org/wikipedia"); @@ -70,10 +73,11 @@ pred.add("http://dbpedia.org/property/reference"); pred.add("http://dbpedia.org/property/website"); pred.add("http://dbpedia.org/property/wikipage"); + pred.add("http://dbpedia.org/property/wikiPageUsesTemplate"); Set<String> obj = new HashSet<String>(); - obj.add("http://dbpedia.org/resource/Category:Wikipedia_"); - obj.add("http://dbpedia.org/resource/Category:Articles_"); + //obj.add("http://dbpedia.org/resource/Category:Wikipedia_"); + //obj.add("http://dbpedia.org/resource/Category:Articles_"); obj.add("http://xmlns.com/foaf/0.1/"); obj.add("http://upload.wikimedia.org/wikipedia/commons"); obj.add("http://upload.wikimedia.org/wikipedia"); Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/PropertyNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/PropertyNode.java 2007-12-03 22:06:30 UTC (rev 321) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/PropertyNode.java 2007-12-04 17:08:42 UTC (rev 322) @@ -29,8 +29,10 @@ public class PropertyNode extends Node { + // the a and b part of a property private Node a; private Node b; + // specialtypes like owl:symmetricproperty private Set<String> specialTypes; public PropertyNode(URI u) { @@ -68,6 +70,8 @@ } return Nodes; } + + // gets the types for properties recursively @Override public Vector<Node> expandProperties(TypedSparqlQuery tsq, Manipulator m) { b.expandProperties(tsq, m); Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryMaker.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryMaker.java 2007-12-03 22:06:30 UTC (rev 321) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryMaker.java 2007-12-04 17:08:42 UTC (rev 322) @@ -22,6 +22,12 @@ // can assemble sparql queries public class SparqlQueryMaker { + /* can make queries for subject, predicate, object + * according to the filter settings + * object not yet implemented + * + * */ + private SparqlQueryType sparqlQueryType; public SparqlQueryMaker(SparqlQueryType SparqlQueryType) { Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryType.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryType.java 2007-12-03 22:06:30 UTC (rev 321) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryType.java 2007-12-04 17:08:42 UTC (rev 322) @@ -24,6 +24,8 @@ // is used to set the filter: configuration public class SparqlQueryType { // TODO make sets out of them + + private String mode = "forbid"; private String[] objectfilterlist = { "http://dbpedia.org/resource/Category:Articles_", "http://dbpedia.org/resource/Category:Wikipedia_", "http://xmlns.com/foaf/0.1/", Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/TypedSparqlQuery.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/TypedSparqlQuery.java 2007-12-03 22:06:30 UTC (rev 321) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/TypedSparqlQuery.java 2007-12-04 17:08:42 UTC (rev 322) @@ -48,7 +48,7 @@ this.sparqlQueryMaker = new SparqlQueryMaker(Configuration.getSparqlQueryType()); this.cache = new Cache("cache"); } - + // standard query get a tupels (p,o) for subject s public Set<StringTuple> query(URI u) { // getQuery @@ -57,6 +57,7 @@ } + // query get a tupels (s,o) for role p public Set<StringTuple> getTupelsForRole(URI u) { // getQuery @@ -68,6 +69,8 @@ } + + // uses a cache private Set<StringTuple> cachedSparql(URI u, String sparql, String a, String b) { // check cache String FromCache = cache.get(u.toString(), sparql); Modified: trunk/src/dl-learner/org/dllearner/utilities/StringTuple.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/StringTuple.java 2007-12-03 22:06:30 UTC (rev 321) +++ trunk/src/dl-learner/org/dllearner/utilities/StringTuple.java 2007-12-04 17:08:42 UTC (rev 322) @@ -21,7 +21,7 @@ /** * A container which can hold two Strings, mainly used as a helper. - * + * Also used as pre form, if you want to create triple, that have the same subject * @author Sebastian Hellmann */ public class StringTuple { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2007-12-03 22:06:34
|
Revision: 321 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=321&view=rev Author: jenslehmann Date: 2007-12-03 14:06:30 -0800 (Mon, 03 Dec 2007) Log Message: ----------- finished tuple list support syntax: component.option = [(a1,b1),(a2,b2),...] Modified Paths: -------------- trunk/examples/sparql/simple.conf trunk/src/dl-learner/org/dllearner/parser/ConfParser.java trunk/src/dl-learner/org/dllearner/parser/ConfParserConstants.java trunk/src/dl-learner/org/dllearner/parser/ConfParserTokenManager.java trunk/src/dl-learner/org/dllearner/parser/conf.jj Modified: trunk/examples/sparql/simple.conf =================================================================== --- trunk/examples/sparql/simple.conf 2007-12-03 21:48:52 UTC (rev 320) +++ trunk/examples/sparql/simple.conf 2007-12-03 22:06:30 UTC (rev 321) @@ -44,7 +44,7 @@ "http://dbpedia.org/resource/Gerhard_Schr%C3%B6der" }; -// sparql2.example = [(a,b),(c,d)]; +sparql2.example = [(a,b),(c,d)]; /** examples **/ +"http://dbpedia.org/resource/Angela_Merkel" Modified: trunk/src/dl-learner/org/dllearner/parser/ConfParser.java =================================================================== --- trunk/src/dl-learner/org/dllearner/parser/ConfParser.java 2007-12-03 21:48:52 UTC (rev 320) +++ trunk/src/dl-learner/org/dllearner/parser/ConfParser.java 2007-12-03 22:06:30 UTC (rev 321) @@ -277,7 +277,7 @@ jj_la1[8] = jj_gen; if (jj_2_7(2147483647)) { jj_consume_token(26); - jj_consume_token(27); + jj_consume_token(31); isSet=true; } else { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -303,7 +303,7 @@ throw new ParseException(); } values.add(tmp); - jj_consume_token(28); + jj_consume_token(29); } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case STRING: @@ -318,19 +318,19 @@ throw new ParseException(); } values.add(tmp); - jj_consume_token(27); + jj_consume_token(31); isSet=true; break; default: jj_la1[9] = jj_gen; if (jj_2_8(2147483647)) { - jj_consume_token(31); + jj_consume_token(27); jj_consume_token(32); isList=true; } else { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case 31: - jj_consume_token(31); + case 27: + jj_consume_token(27); label_3: while (true) { if (jj_2_6(6)) { @@ -338,7 +338,7 @@ } else { break label_3; } - jj_consume_token(29); + jj_consume_token(28); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case STRING: tmp = String(); @@ -351,7 +351,7 @@ jj_consume_token(-1); throw new ParseException(); } - jj_consume_token(28); + jj_consume_token(29); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case STRING: tmp2 = String(); @@ -366,9 +366,9 @@ } jj_consume_token(30); tuples.add(new StringTuple(tmp,tmp2)); - jj_consume_token(28); + jj_consume_token(29); } - jj_consume_token(29); + jj_consume_token(28); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case STRING: tmp = String(); @@ -381,7 +381,7 @@ jj_consume_token(-1); throw new ParseException(); } - jj_consume_token(28); + jj_consume_token(29); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case STRING: tmp2 = String(); @@ -418,6 +418,8 @@ else if(isSet) confOption = new ConfFileOption(option,subOption,values); + else if(isList) + confOption = new ConfFileOption(option,subOption,tuples); else confOption = new ConfFileOption(option,subOption,value); } else { @@ -429,6 +431,8 @@ else if(isSet) confOption = new ConfFileOption(option,values); + else if(isList) + confOption = new ConfFileOption(option,tuples); else confOption = new ConfFileOption(option,value); } @@ -442,20 +446,20 @@ String s, s1, s2; List<String> list = new LinkedList<String>(); s1 = Id(); - jj_consume_token(29); + jj_consume_token(28); s2 = String(); list.add(s2); label_4: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case 28: + case 29: ; break; default: jj_la1[11] = jj_gen; break label_4; } - jj_consume_token(28); + jj_consume_token(29); s = String(); list.add(s); } @@ -584,64 +588,24 @@ finally { jj_save(7, xla); } } - final private boolean jj_3R_19() { - if (jj_3R_13()) return true; - return false; - } - - final private boolean jj_3_6() { - if (jj_scan_token(29)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_17()) { - jj_scanpos = xsp; - if (jj_3R_18()) return true; - } - if (jj_scan_token(28)) return true; - xsp = jj_scanpos; - if (jj_3R_19()) { - jj_scanpos = xsp; - if (jj_3R_20()) return true; - } - if (jj_scan_token(30)) return true; - if (jj_scan_token(28)) return true; - return false; - } - final private boolean jj_3_5() { Token xsp; xsp = jj_scanpos; - if (jj_3R_15()) { + if (jj_3R_13()) { jj_scanpos = xsp; - if (jj_3R_16()) return true; + if (jj_3R_14()) return true; } - if (jj_scan_token(28)) return true; + if (jj_scan_token(29)) return true; return false; } - final private boolean jj_3R_26() { - if (jj_3R_13()) return true; - return false; - } - - final private boolean jj_3R_23() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_26()) { - jj_scanpos = xsp; - if (jj_3R_27()) return true; - } - if (jj_scan_token(28)) return true; - return false; - } - - final private boolean jj_3R_21() { + final private boolean jj_3R_19() { if (jj_scan_token(NUMBER)) return true; return false; } final private boolean jj_3R_10() { - if (jj_3R_13()) return true; + if (jj_3R_11()) return true; return false; } @@ -651,7 +615,7 @@ return false; } - final private boolean jj_3R_18() { + final private boolean jj_3R_16() { if (jj_3R_5()) return true; return false; } @@ -666,51 +630,30 @@ return false; } - final private boolean jj_3R_12() { - if (jj_scan_token(26)) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_23()) { jj_scanpos = xsp; break; } - } - xsp = jj_scanpos; - if (jj_3R_24()) { - jj_scanpos = xsp; - if (jj_3R_25()) return true; - } - if (jj_scan_token(27)) return true; + final private boolean jj_3R_20() { + if (jj_scan_token(DOUBLE)) return true; return false; } - final private boolean jj_3R_25() { - if (jj_3R_5()) return true; - return false; - } - final private boolean jj_3_2() { if (jj_3R_5()) return true; - if (jj_scan_token(29)) return true; - if (jj_3R_13()) return true; + if (jj_scan_token(28)) return true; + if (jj_3R_11()) return true; Token xsp; while (true) { xsp = jj_scanpos; - if (jj_3R_14()) { jj_scanpos = xsp; break; } + if (jj_3R_12()) { jj_scanpos = xsp; break; } } if (jj_scan_token(30)) return true; if (jj_scan_token(CONF_END)) return true; return false; } - final private boolean jj_3R_16() { + final private boolean jj_3R_14() { if (jj_3R_5()) return true; return false; } - final private boolean jj_3R_22() { - if (jj_scan_token(DOUBLE)) return true; - return false; - } - final private boolean jj_3_1() { if (jj_3R_5()) return true; Token xsp; @@ -726,61 +669,54 @@ jj_scanpos = xsp; if (jj_3R_10()) { jj_scanpos = xsp; - if (jj_3R_11()) { + if (jj_scan_token(26)) { jj_scanpos = xsp; - if (jj_3R_12()) return true; + if (jj_scan_token(27)) return true; } } } } } - if (jj_scan_token(CONF_END)) return true; return false; } final private boolean jj_3R_9() { - if (jj_3R_22()) return true; + if (jj_3R_20()) return true; return false; } - final private boolean jj_3R_11() { - if (jj_scan_token(26)) return true; - if (jj_scan_token(27)) return true; + final private boolean jj_3R_5() { + if (jj_scan_token(ID)) return true; return false; } - final private boolean jj_3R_24() { - if (jj_3R_13()) return true; + final private boolean jj_3R_15() { + if (jj_3R_11()) return true; return false; } - final private boolean jj_3R_17() { - if (jj_3R_13()) return true; - return false; - } - - final private boolean jj_3R_20() { + final private boolean jj_3R_18() { if (jj_3R_5()) return true; return false; } - final private boolean jj_3R_5() { - if (jj_scan_token(ID)) return true; + final private boolean jj_3R_13() { + if (jj_3R_11()) return true; return false; } - final private boolean jj_3R_15() { - if (jj_3R_13()) return true; + final private boolean jj_3R_8() { + if (jj_3R_19()) return true; return false; } - final private boolean jj_3R_8() { - if (jj_3R_21()) return true; + final private boolean jj_3R_11() { + if (jj_scan_token(STRING)) return true; return false; } final private boolean jj_3_8() { - if (jj_scan_token(31)) return true; + if (jj_scan_token(27)) return true; if (jj_scan_token(32)) return true; return false; } @@ -790,25 +726,39 @@ return false; } - final private boolean jj_3R_27() { - if (jj_3R_5()) return true; + final private boolean jj_3_7() { + if (jj_scan_token(26)) return true; + if (jj_scan_token(31)) return true; return false; } - final private boolean jj_3R_13() { - if (jj_scan_token(STRING)) return true; + final private boolean jj_3R_12() { + if (jj_scan_token(29)) return true; + if (jj_3R_11()) return true; return false; } - final private boolean jj_3R_14() { - if (jj_scan_token(28)) return true; - if (jj_3R_13()) return true; + final private boolean jj_3R_17() { + if (jj_3R_11()) return true; return false; } - final private boolean jj_3_7() { - if (jj_scan_token(26)) return true; - if (jj_scan_token(27)) return true; + final private boolean jj_3_6() { + if (jj_scan_token(28)) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_15()) { + jj_scanpos = xsp; + if (jj_3R_16()) return true; + } + if (jj_scan_token(29)) return true; + xsp = jj_scanpos; + if (jj_3R_17()) { + jj_scanpos = xsp; + if (jj_3R_18()) return true; + } + if (jj_scan_token(30)) return true; + if (jj_scan_token(29)) return true; return false; } @@ -829,7 +779,7 @@ jj_la1_1(); } private static void jj_la1_0() { - jj_la1_0 = new int[] {0x1c00,0x100,0x1001000,0x1001000,0x1001000,0x1001000,0x1001000,0x1001000,0x1007000,0x4000000,0x80000000,0x10000000,0x1001000,}; + jj_la1_0 = new int[] {0x1c00,0x100,0x1001000,0x1001000,0x1001000,0x1001000,0x1001000,0x1001000,0x1007000,0x4000000,0x8000000,0x20000000,0x1001000,}; } private static void jj_la1_1() { jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; Modified: trunk/src/dl-learner/org/dllearner/parser/ConfParserConstants.java =================================================================== --- trunk/src/dl-learner/org/dllearner/parser/ConfParserConstants.java 2007-12-03 21:48:52 UTC (rev 320) +++ trunk/src/dl-learner/org/dllearner/parser/ConfParserConstants.java 2007-12-03 22:06:30 UTC (rev 321) @@ -55,11 +55,11 @@ "<STRING>", "\"=\"", "\"{\"", - "\"}\"", + "\"[\"", + "\"(\"", "\",\"", - "\"(\"", "\")\"", - "\"[\"", + "\"}\"", "\"]\"", }; Modified: trunk/src/dl-learner/org/dllearner/parser/ConfParserTokenManager.java =================================================================== --- trunk/src/dl-learner/org/dllearner/parser/ConfParserTokenManager.java 2007-12-03 21:48:52 UTC (rev 320) +++ trunk/src/dl-learner/org/dllearner/parser/ConfParserTokenManager.java 2007-12-03 22:06:30 UTC (rev 321) @@ -58,13 +58,13 @@ switch(curChar) { case 40: - return jjStopAtPos(0, 29); + return jjStopAtPos(0, 28); case 41: return jjStopAtPos(0, 30); case 43: return jjStopAtPos(0, 10); case 44: - return jjStopAtPos(0, 28); + return jjStopAtPos(0, 29); case 45: return jjStopAtPos(0, 11); case 46: @@ -86,13 +86,13 @@ case 84: return jjMoveStringLiteralDfa1_0(0x8000L); case 91: - return jjStopAtPos(0, 31); + return jjStopAtPos(0, 27); case 93: return jjStopAtPos(0, 32); case 123: return jjStopAtPos(0, 26); case 125: - return jjStopAtPos(0, 27); + return jjStopAtPos(0, 31); default : return jjMoveNfa_0(0, 0); } @@ -619,8 +619,8 @@ public static final String[] jjstrLiteralImages = { "", null, null, null, null, null, null, null, "\56", "\73", "\53", "\55", null, null, null, "\124\117\120", "\102\117\124\124\117\115", "\101\116\104", "\117\122", -null, null, null, "\76\75", "\74\75", null, "\75", "\173", "\175", "\54", "\50", -"\51", "\133", "\135", }; +null, null, null, "\76\75", "\74\75", null, "\75", "\173", "\133", "\50", "\54", +"\51", "\175", "\135", }; public static final String[] lexStateNames = { "DEFAULT", }; Modified: trunk/src/dl-learner/org/dllearner/parser/conf.jj =================================================================== --- trunk/src/dl-learner/org/dllearner/parser/conf.jj 2007-12-03 21:48:52 UTC (rev 320) +++ trunk/src/dl-learner/org/dllearner/parser/conf.jj 2007-12-03 22:06:30 UTC (rev 321) @@ -277,8 +277,10 @@ { ( // bei Konfigurationsoption geht der Parser bis zum Semikolon durch, da das das einzige // sichere Unterscheidungsmerkmal ist + // LOOKAHEAD(Id() [ "." Id() ] "=" ( Id() | Integer() | Double() | String() + // | "{" "}" | "{" ( ( String() | Id() ) "," )* (String() | Id()) "}" | "[" ) <CONF_END>) confOption=ConfOption() LOOKAHEAD(Id() [ "." Id() ] "=" ( Id() | Integer() | Double() | String() - | "{" "}" | "{" ( ( String() | Id() ) "," )* (String() | Id()) "}" ) <CONF_END>) confOption=ConfOption() + | "{" | "[" )) confOption=ConfOption() { addConfOption(confOption); } | LOOKAHEAD(Id() "(" String() ("," String())* ")" <CONF_END>) FunctionCall() // positive bzw. negative Beispiele sind an "+" bzw. "-" erkennbar @@ -326,6 +328,8 @@ else if(isSet) confOption = new ConfFileOption(option,subOption,values); + else if(isList) + confOption = new ConfFileOption(option,subOption,tuples); else confOption = new ConfFileOption(option,subOption,value); } else { @@ -337,6 +341,8 @@ else if(isSet) confOption = new ConfFileOption(option,values); + else if(isList) + confOption = new ConfFileOption(option,tuples); else confOption = new ConfFileOption(option,value); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2007-12-03 21:49:05
|
Revision: 320 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=320&view=rev Author: jenslehmann Date: 2007-12-03 13:48:52 -0800 (Mon, 03 Dec 2007) Log Message: ----------- continued tuple list support Modified Paths: -------------- trunk/examples/sparql/simple.conf trunk/src/dl-learner/org/dllearner/cli/ConfFileOption.java trunk/src/dl-learner/org/dllearner/cli/Start.java trunk/src/dl-learner/org/dllearner/kb/SparqlEndpointRestructured.java Modified: trunk/examples/sparql/simple.conf =================================================================== --- trunk/examples/sparql/simple.conf 2007-12-03 18:29:20 UTC (rev 319) +++ trunk/examples/sparql/simple.conf 2007-12-03 21:48:52 UTC (rev 320) @@ -44,6 +44,8 @@ "http://dbpedia.org/resource/Gerhard_Schr%C3%B6der" }; +// sparql2.example = [(a,b),(c,d)]; + /** examples **/ +"http://dbpedia.org/resource/Angela_Merkel" -"http://dbpedia.org/resource/Gerhard_Schr%C3%B6der" Modified: trunk/src/dl-learner/org/dllearner/cli/ConfFileOption.java =================================================================== --- trunk/src/dl-learner/org/dllearner/cli/ConfFileOption.java 2007-12-03 18:29:20 UTC (rev 319) +++ trunk/src/dl-learner/org/dllearner/cli/ConfFileOption.java 2007-12-03 21:48:52 UTC (rev 320) @@ -132,6 +132,14 @@ return doubleValue; } + public Set<String> getSetValues() { + return setValues; + } + + public List<StringTuple> getListTuples() { + return listTuples; + } + public Object getValue() { if(isIntegerOption) return intValue; @@ -199,10 +207,6 @@ else return completeOption + "=" + stringValue; } - - public Set<String> getSetValues() { - return setValues; - } public String getFullName() { if(containsSubOption) Modified: trunk/src/dl-learner/org/dllearner/cli/Start.java =================================================================== --- trunk/src/dl-learner/org/dllearner/cli/Start.java 2007-12-03 18:29:20 UTC (rev 319) +++ trunk/src/dl-learner/org/dllearner/cli/Start.java 2007-12-03 21:48:52 UTC (rev 320) @@ -53,6 +53,7 @@ import org.dllearner.core.config.InvalidConfigOptionValueException; import org.dllearner.core.config.StringConfigOption; import org.dllearner.core.config.StringSetConfigOption; +import org.dllearner.core.config.StringTupleListConfigOption; import org.dllearner.core.dl.AtomicConcept; import org.dllearner.core.dl.AtomicRole; import org.dllearner.core.dl.Concept; @@ -73,6 +74,7 @@ import org.dllearner.utilities.Datastructures; import org.dllearner.utilities.Helper; import org.dllearner.utilities.RoleComparator; +import org.dllearner.utilities.StringTuple; /** * Startup file for Command Line Interface. @@ -309,6 +311,12 @@ (StringSetConfigOption) configOption, option.getSetValues()); cm.applyConfigEntry(component, entry); + } else if (configOption instanceof StringTupleListConfigOption && option.isListOption()) { + + ConfigEntry<List<StringTuple>> entry = new ConfigEntry<List<StringTuple>>( + (StringTupleListConfigOption) configOption, option.getListTuples()); + cm.applyConfigEntry(component, entry); + } else { handleError("The type of conf file entry " + option + " is not correct."); } Modified: trunk/src/dl-learner/org/dllearner/kb/SparqlEndpointRestructured.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/SparqlEndpointRestructured.java 2007-12-03 18:29:20 UTC (rev 319) +++ trunk/src/dl-learner/org/dllearner/kb/SparqlEndpointRestructured.java 2007-12-03 21:48:52 UTC (rev 320) @@ -41,6 +41,7 @@ import org.dllearner.core.config.InvalidConfigOptionValueException; import org.dllearner.core.config.StringConfigOption; import org.dllearner.core.config.StringSetConfigOption; +import org.dllearner.core.config.StringTupleListConfigOption; import org.dllearner.core.dl.KB; import org.dllearner.kb.sparql.Manager; import org.dllearner.kb.sparql.Manipulator; @@ -155,6 +156,8 @@ options.add(new StringConfigOption("blankNodeIdentifier", "used to identify blanknodes in Tripels")); + options.add(new StringTupleListConfigOption("example", "example")); + return options; } @@ -203,6 +206,8 @@ role = (String) entry.getValue(); } else if (option.equals("blankNodeIdentifier")) { blankNodeIdentifier = (String) entry.getValue(); + } else if (option.equals("example")) { + System.out.println(entry.getValue()); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2007-12-03 18:29:22
|
Revision: 319 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=319&view=rev Author: jenslehmann Date: 2007-12-03 10:29:20 -0800 (Mon, 03 Dec 2007) Log Message: ----------- started parser support for lists of tuples Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/cli/ConfFileOption.java trunk/src/dl-learner/org/dllearner/parser/ConfParser.java trunk/src/dl-learner/org/dllearner/parser/ConfParserConstants.java trunk/src/dl-learner/org/dllearner/parser/ConfParserTokenManager.java trunk/src/dl-learner/org/dllearner/parser/conf.jj Modified: trunk/src/dl-learner/org/dllearner/cli/ConfFileOption.java =================================================================== --- trunk/src/dl-learner/org/dllearner/cli/ConfFileOption.java 2007-12-03 18:13:19 UTC (rev 318) +++ trunk/src/dl-learner/org/dllearner/cli/ConfFileOption.java 2007-12-03 18:29:20 UTC (rev 319) @@ -20,8 +20,11 @@ package org.dllearner.cli; +import java.util.List; import java.util.Set; +import org.dllearner.utilities.StringTuple; + /** * Represents one configuration option in a conf file, e.g. * refinement.horizontalExpansionFactor = 0.6. @@ -36,12 +39,14 @@ private boolean isDoubleOption = false; private boolean isStringOption = false; private boolean isSetOption = false; + private boolean isListOption = false; private String option; private String subOption; private String stringValue; private int intValue; private double doubleValue; private Set<String> setValues; + private List<StringTuple> listTuples; public ConfFileOption(String option, String value) { this(option, null, value); @@ -91,6 +96,18 @@ setValues = values; } + public ConfFileOption(String option, List<StringTuple> tuples) { + this(option, null, tuples); + containsSubOption = false; + } + + public ConfFileOption(String option, String subOption, List<StringTuple> tuples) { + this.option = option; + this.subOption = subOption; + isListOption = true; + listTuples = tuples; + } + public boolean containsSubOption() { return containsSubOption; } @@ -122,8 +139,10 @@ return doubleValue; else if(isStringOption) return stringValue; + else if(isSetOption) + return setValues; else - return setValues; + return listTuples; } /** @@ -161,6 +180,10 @@ return isSetOption; } + public boolean isListOption() { + return isListOption; + } + @Override public String toString() { String completeOption = "Configuration Option: "; Modified: trunk/src/dl-learner/org/dllearner/parser/ConfParser.java =================================================================== --- trunk/src/dl-learner/org/dllearner/parser/ConfParser.java 2007-12-03 18:13:19 UTC (rev 318) +++ trunk/src/dl-learner/org/dllearner/parser/ConfParser.java 2007-12-03 18:29:20 UTC (rev 319) @@ -239,12 +239,13 @@ } final public ConfFileOption ConfOption() throws ParseException { - boolean containsSubOption=false, isNumeric=false, isDouble=false, isSet=false; - String option="", subOption="", value="", tmp=""; + boolean containsSubOption=false, isNumeric=false, isDouble=false, isSet=false, isList=false; + String option="", subOption="", value="", tmp="", tmp2=""; int number = 0; double numberDouble = 0; ConfFileOption confOption; Set<String> values = new HashSet<String>(); + List<StringTuple> tuples = new LinkedList<StringTuple>(); option = Id(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case COMMAND_END: @@ -273,8 +274,8 @@ isNumeric=true; isDouble=true; break; default: - jj_la1[4] = jj_gen; - if (jj_2_6(2147483647)) { + jj_la1[8] = jj_gen; + if (jj_2_7(2147483647)) { jj_consume_token(26); jj_consume_token(27); isSet=true; @@ -321,9 +322,89 @@ isSet=true; break; default: - jj_la1[5] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); + jj_la1[9] = jj_gen; + if (jj_2_8(2147483647)) { + jj_consume_token(31); + jj_consume_token(32); + isList=true; + } else { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 31: + jj_consume_token(31); + label_3: + while (true) { + if (jj_2_6(6)) { + ; + } else { + break label_3; + } + jj_consume_token(29); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case STRING: + tmp = String(); + break; + case ID: + tmp = Id(); + break; + default: + jj_la1[4] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + jj_consume_token(28); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case STRING: + tmp2 = String(); + break; + case ID: + tmp2 = Id(); + break; + default: + jj_la1[5] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + jj_consume_token(30); + tuples.add(new StringTuple(tmp,tmp2)); + jj_consume_token(28); + } + jj_consume_token(29); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case STRING: + tmp = String(); + break; + case ID: + tmp = Id(); + break; + default: + jj_la1[6] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + jj_consume_token(28); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case STRING: + tmp2 = String(); + break; + case ID: + tmp2 = Id(); + break; + default: + jj_la1[7] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + jj_consume_token(30); + tuples.add(new StringTuple(tmp,tmp2)); + jj_consume_token(32); + isList=true; + break; + default: + jj_la1[10] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } } } } @@ -364,15 +445,15 @@ jj_consume_token(29); s2 = String(); list.add(s2); - label_3: + label_4: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 28: ; break; default: - jj_la1[6] = jj_gen; - break label_3; + jj_la1[11] = jj_gen; + break label_4; } jj_consume_token(28); s = String(); @@ -407,7 +488,7 @@ name = String(); break; default: - jj_la1[7] = jj_gen; + jj_la1[12] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -489,55 +570,92 @@ finally { jj_save(5, xla); } } - final private boolean jj_3_6() { - if (jj_scan_token(26)) return true; - if (jj_scan_token(27)) return true; + final private boolean jj_2_7(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + try { return !jj_3_7(); } + catch(LookaheadSuccess ls) { return true; } + finally { jj_save(6, xla); } + } + + final private boolean jj_2_8(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + try { return !jj_3_8(); } + catch(LookaheadSuccess ls) { return true; } + finally { jj_save(7, xla); } + } + + final private boolean jj_3R_19() { + if (jj_3R_13()) return true; return false; } - final private boolean jj_3_5() { + final private boolean jj_3_6() { + if (jj_scan_token(29)) return true; Token xsp; xsp = jj_scanpos; - if (jj_3R_14()) { + if (jj_3R_17()) { jj_scanpos = xsp; - if (jj_3R_15()) return true; + if (jj_3R_18()) return true; } if (jj_scan_token(28)) return true; + xsp = jj_scanpos; + if (jj_3R_19()) { + jj_scanpos = xsp; + if (jj_3R_20()) return true; + } + if (jj_scan_token(30)) return true; + if (jj_scan_token(28)) return true; return false; } - final private boolean jj_3R_12() { - if (jj_scan_token(STRING)) return true; + final private boolean jj_3_5() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_15()) { + jj_scanpos = xsp; + if (jj_3R_16()) return true; + } + if (jj_scan_token(28)) return true; return false; } - final private boolean jj_3R_21() { - if (jj_3R_12()) return true; + final private boolean jj_3R_26() { + if (jj_3R_13()) return true; return false; } - final private boolean jj_3R_18() { + final private boolean jj_3R_23() { Token xsp; xsp = jj_scanpos; - if (jj_3R_21()) { + if (jj_3R_26()) { jj_scanpos = xsp; - if (jj_3R_22()) return true; + if (jj_3R_27()) return true; } if (jj_scan_token(28)) return true; return false; } - final private boolean jj_3R_9() { - if (jj_3R_12()) return true; + final private boolean jj_3R_21() { + if (jj_scan_token(NUMBER)) return true; return false; } - final private boolean jj_3R_5() { + final private boolean jj_3R_10() { + if (jj_3R_13()) return true; + return false; + } + + final private boolean jj_3R_6() { if (jj_scan_token(COMMAND_END)) return true; - if (jj_3R_4()) return true; + if (jj_3R_5()) return true; return false; } + final private boolean jj_3R_18() { + if (jj_3R_5()) return true; + return false; + } + final private boolean jj_3_4() { if (jj_scan_token(NEG_EX)) return true; return false; @@ -548,60 +666,58 @@ return false; } - final private boolean jj_3R_11() { + final private boolean jj_3R_12() { if (jj_scan_token(26)) return true; Token xsp; while (true) { xsp = jj_scanpos; - if (jj_3R_18()) { jj_scanpos = xsp; break; } + if (jj_3R_23()) { jj_scanpos = xsp; break; } } xsp = jj_scanpos; - if (jj_3R_19()) { + if (jj_3R_24()) { jj_scanpos = xsp; - if (jj_3R_20()) return true; + if (jj_3R_25()) return true; } if (jj_scan_token(27)) return true; return false; } - final private boolean jj_3R_20() { - if (jj_3R_4()) return true; + final private boolean jj_3R_25() { + if (jj_3R_5()) return true; return false; } - final private boolean jj_3R_16() { - if (jj_scan_token(NUMBER)) return true; - return false; - } - final private boolean jj_3_2() { - if (jj_3R_4()) return true; + if (jj_3R_5()) return true; if (jj_scan_token(29)) return true; - if (jj_3R_12()) return true; + if (jj_3R_13()) return true; Token xsp; while (true) { xsp = jj_scanpos; - if (jj_3R_13()) { jj_scanpos = xsp; break; } + if (jj_3R_14()) { jj_scanpos = xsp; break; } } if (jj_scan_token(30)) return true; if (jj_scan_token(CONF_END)) return true; return false; } - final private boolean jj_3R_15() { - if (jj_3R_4()) return true; + final private boolean jj_3R_16() { + if (jj_3R_5()) return true; return false; } + final private boolean jj_3R_22() { + if (jj_scan_token(DOUBLE)) return true; + return false; + } + final private boolean jj_3_1() { - if (jj_3R_4()) return true; + if (jj_3R_5()) return true; Token xsp; xsp = jj_scanpos; - if (jj_3R_5()) jj_scanpos = xsp; + if (jj_3R_6()) jj_scanpos = xsp; if (jj_scan_token(25)) return true; xsp = jj_scanpos; - if (jj_3R_6()) { - jj_scanpos = xsp; if (jj_3R_7()) { jj_scanpos = xsp; if (jj_3R_8()) { @@ -610,7 +726,9 @@ jj_scanpos = xsp; if (jj_3R_10()) { jj_scanpos = xsp; - if (jj_3R_11()) return true; + if (jj_3R_11()) { + jj_scanpos = xsp; + if (jj_3R_12()) return true; } } } @@ -620,58 +738,80 @@ return false; } - final private boolean jj_3R_8() { - if (jj_3R_17()) return true; + final private boolean jj_3R_9() { + if (jj_3R_22()) return true; return false; } - final private boolean jj_3R_10() { + final private boolean jj_3R_11() { if (jj_scan_token(26)) return true; if (jj_scan_token(27)) return true; return false; } - final private boolean jj_3R_19() { - if (jj_3R_12()) return true; + final private boolean jj_3R_24() { + if (jj_3R_13()) return true; return false; } final private boolean jj_3R_17() { - if (jj_scan_token(DOUBLE)) return true; + if (jj_3R_13()) return true; return false; } - final private boolean jj_3R_14() { - if (jj_3R_12()) return true; + final private boolean jj_3R_20() { + if (jj_3R_5()) return true; return false; } - final private boolean jj_3R_7() { - if (jj_3R_16()) return true; + final private boolean jj_3R_5() { + if (jj_scan_token(ID)) return true; return false; } - final private boolean jj_3R_4() { - if (jj_scan_token(ID)) return true; + final private boolean jj_3R_15() { + if (jj_3R_13()) return true; return false; } - final private boolean jj_3R_6() { - if (jj_3R_4()) return true; + final private boolean jj_3R_8() { + if (jj_3R_21()) return true; return false; } - final private boolean jj_3R_22() { - if (jj_3R_4()) return true; + final private boolean jj_3_8() { + if (jj_scan_token(31)) return true; + if (jj_scan_token(32)) return true; return false; } + final private boolean jj_3R_7() { + if (jj_3R_5()) return true; + return false; + } + + final private boolean jj_3R_27() { + if (jj_3R_5()) return true; + return false; + } + final private boolean jj_3R_13() { + if (jj_scan_token(STRING)) return true; + return false; + } + + final private boolean jj_3R_14() { if (jj_scan_token(28)) return true; - if (jj_3R_12()) return true; + if (jj_3R_13()) return true; return false; } + final private boolean jj_3_7() { + if (jj_scan_token(26)) return true; + if (jj_scan_token(27)) return true; + return false; + } + public ConfParserTokenManager token_source; SimpleCharStream jj_input_stream; public Token token, jj_nt; @@ -681,15 +821,20 @@ public boolean lookingAhead = false; private boolean jj_semLA; private int jj_gen; - final private int[] jj_la1 = new int[8]; + final private int[] jj_la1 = new int[13]; static private int[] jj_la1_0; + static private int[] jj_la1_1; static { jj_la1_0(); + jj_la1_1(); } private static void jj_la1_0() { - jj_la1_0 = new int[] {0x1c00,0x100,0x1001000,0x1001000,0x1007000,0x4000000,0x10000000,0x1001000,}; + jj_la1_0 = new int[] {0x1c00,0x100,0x1001000,0x1001000,0x1001000,0x1001000,0x1001000,0x1001000,0x1007000,0x4000000,0x80000000,0x10000000,0x1001000,}; } - final private JJCalls[] jj_2_rtns = new JJCalls[6]; + private static void jj_la1_1() { + jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + } + final private JJCalls[] jj_2_rtns = new JJCalls[8]; private boolean jj_rescan = false; private int jj_gc = 0; @@ -702,7 +847,7 @@ token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 8; i++) jj_la1[i] = -1; + for (int i = 0; i < 13; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -715,7 +860,7 @@ token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 8; i++) jj_la1[i] = -1; + for (int i = 0; i < 13; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -725,7 +870,7 @@ token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 8; i++) jj_la1[i] = -1; + for (int i = 0; i < 13; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -735,7 +880,7 @@ token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 8; i++) jj_la1[i] = -1; + for (int i = 0; i < 13; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -744,7 +889,7 @@ token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 8; i++) jj_la1[i] = -1; + for (int i = 0; i < 13; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -753,7 +898,7 @@ token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 8; i++) jj_la1[i] = -1; + for (int i = 0; i < 13; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -864,21 +1009,24 @@ public ParseException generateParseException() { jj_expentries.removeAllElements(); - boolean[] la1tokens = new boolean[31]; + boolean[] la1tokens = new boolean[33]; if (jj_kind >= 0) { la1tokens[jj_kind] = true; jj_kind = -1; } - for (int i = 0; i < 8; i++) { + for (int i = 0; i < 13; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { if ((jj_la1_0[i] & (1<<j)) != 0) { la1tokens[j] = true; } + if ((jj_la1_1[i] & (1<<j)) != 0) { + la1tokens[32+j] = true; + } } } } - for (int i = 0; i < 31; i++) { + for (int i = 0; i < 33; i++) { if (la1tokens[i]) { jj_expentry = new int[1]; jj_expentry[0] = i; @@ -903,7 +1051,7 @@ final private void jj_rescan_token() { jj_rescan = true; - for (int i = 0; i < 6; i++) { + for (int i = 0; i < 8; i++) { try { JJCalls p = jj_2_rtns[i]; do { @@ -916,6 +1064,8 @@ case 3: jj_3_4(); break; case 4: jj_3_5(); break; case 5: jj_3_6(); break; + case 6: jj_3_7(); break; + case 7: jj_3_8(); break; } } p = p.next; Modified: trunk/src/dl-learner/org/dllearner/parser/ConfParserConstants.java =================================================================== --- trunk/src/dl-learner/org/dllearner/parser/ConfParserConstants.java 2007-12-03 18:13:19 UTC (rev 318) +++ trunk/src/dl-learner/org/dllearner/parser/ConfParserConstants.java 2007-12-03 18:29:20 UTC (rev 319) @@ -59,6 +59,8 @@ "\",\"", "\"(\"", "\")\"", + "\"[\"", + "\"]\"", }; } Modified: trunk/src/dl-learner/org/dllearner/parser/ConfParserTokenManager.java =================================================================== --- trunk/src/dl-learner/org/dllearner/parser/ConfParserTokenManager.java 2007-12-03 18:13:19 UTC (rev 318) +++ trunk/src/dl-learner/org/dllearner/parser/ConfParserTokenManager.java 2007-12-03 18:29:20 UTC (rev 319) @@ -85,6 +85,10 @@ return jjMoveStringLiteralDfa1_0(0x40000L); case 84: return jjMoveStringLiteralDfa1_0(0x8000L); + case 91: + return jjStopAtPos(0, 31); + case 93: + return jjStopAtPos(0, 32); case 123: return jjStopAtPos(0, 26); case 125: @@ -616,12 +620,12 @@ "", null, null, null, null, null, null, null, "\56", "\73", "\53", "\55", null, null, null, "\124\117\120", "\102\117\124\124\117\115", "\101\116\104", "\117\122", null, null, null, "\76\75", "\74\75", null, "\75", "\173", "\175", "\54", "\50", -"\51", }; +"\51", "\133", "\135", }; public static final String[] lexStateNames = { "DEFAULT", }; static final long[] jjtoToken = { - 0x7fffff01L, + 0x1ffffff01L, }; static final long[] jjtoSkip = { 0xfeL, Modified: trunk/src/dl-learner/org/dllearner/parser/conf.jj =================================================================== --- trunk/src/dl-learner/org/dllearner/parser/conf.jj 2007-12-03 18:13:19 UTC (rev 318) +++ trunk/src/dl-learner/org/dllearner/parser/conf.jj 2007-12-03 18:29:20 UTC (rev 319) @@ -290,12 +290,13 @@ ConfFileOption ConfOption() : { - boolean containsSubOption=false, isNumeric=false, isDouble=false, isSet=false; - String option="", subOption="", value="", tmp=""; + boolean containsSubOption=false, isNumeric=false, isDouble=false, isSet=false, isList=false; + String option="", subOption="", value="", tmp="", tmp2=""; int number = 0; double numberDouble = 0; ConfFileOption confOption; Set<String> values = new HashSet<String>(); + List<StringTuple> tuples = new LinkedList<StringTuple>(); } { option=Id() [ "." subOption=Id() {containsSubOption=true;} ] @@ -307,6 +308,13 @@ | "{" ( LOOKAHEAD(2) ( tmp=String() | tmp=Id() ) {values.add(tmp);} "," )* (tmp=String() | tmp=Id()) {values.add(tmp);} "}" {isSet=true;} // eine Liste von ein oder mehr Elementen in Mengenschreibweise + | LOOKAHEAD("[" "]") "[" "]" {isList=true;} // empty list + | "[" + ( LOOKAHEAD(6) "(" (tmp=String() | tmp=Id()) "," (tmp2=String() | tmp2=Id()) ")" + {tuples.add(new StringTuple(tmp,tmp2));} "," )* + "(" (tmp=String() | tmp=Id()) "," (tmp2=String() | tmp2=Id()) ")" + {tuples.add(new StringTuple(tmp,tmp2));} + "]" {isList=true;} ) <CONF_END> { if(containsSubOption) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2007-12-03 18:13:21
|
Revision: 318 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=318&view=rev Author: jenslehmann Date: 2007-12-03 10:13:19 -0800 (Mon, 03 Dec 2007) Log Message: ----------- started list of string tuples as config option Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/core/config/StringSetConfigOption.java trunk/src/dl-learner/org/dllearner/kb/sparql/ClassNode.java trunk/src/dl-learner/org/dllearner/kb/sparql/InstanceNode.java trunk/src/dl-learner/org/dllearner/kb/sparql/Manager.java trunk/src/dl-learner/org/dllearner/kb/sparql/Manipulator.java trunk/src/dl-learner/org/dllearner/kb/sparql/PropertyNode.java trunk/src/dl-learner/org/dllearner/kb/sparql/TypedSparqlQuery.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/core/config/StringTupleListConfigOption.java trunk/src/dl-learner/org/dllearner/utilities/StringTuple.java Removed Paths: ------------- trunk/src/dl-learner/org/dllearner/kb/sparql/Tupel.java Modified: trunk/src/dl-learner/org/dllearner/core/config/StringSetConfigOption.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/config/StringSetConfigOption.java 2007-12-03 17:58:20 UTC (rev 317) +++ trunk/src/dl-learner/org/dllearner/core/config/StringSetConfigOption.java 2007-12-03 18:13:19 UTC (rev 318) @@ -23,6 +23,8 @@ /** + * A set of strings. + * * @author Jens Lehmann * */ Added: trunk/src/dl-learner/org/dllearner/core/config/StringTupleListConfigOption.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/config/StringTupleListConfigOption.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/config/StringTupleListConfigOption.java 2007-12-03 18:13:19 UTC (rev 318) @@ -0,0 +1,67 @@ +/** + * Copyright (C) 2007, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.core.config; + +import java.util.List; + +import org.dllearner.utilities.StringTuple; + +/** + * A list if string tuples, for instance for specifying several + * parameters or replacement rules. + * + * @author Jens Lehmann + */ +public class StringTupleListConfigOption extends ConfigOption<List<StringTuple>> { + + public StringTupleListConfigOption(String name, String description) { + this(name, description, null); + } + + public StringTupleListConfigOption(String name, String description, List<StringTuple> defaultValue) { + super(name, description, defaultValue); + } + + /* (non-Javadoc) + * @see org.dllearner.core.config.ConfigOption#checkType(java.lang.Object) + */ + @Override + public boolean checkType(Object object) { + if(!(object instanceof List)) + return false; + + List<?> set = (List<?>) object; + for(Object element : set) { + if(!(element instanceof StringTuple)) + return false; + } + + return true; + } + + /* (non-Javadoc) + * @see org.dllearner.core.config.ConfigOption#isValidValue(java.lang.Object) + */ + @Override + public boolean isValidValue(List<StringTuple> value) { + return true; + } + +} Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/ClassNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/ClassNode.java 2007-12-03 17:58:20 UTC (rev 317) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/ClassNode.java 2007-12-03 18:13:19 UTC (rev 318) @@ -25,6 +25,8 @@ import java.util.Set; import java.util.Vector; +import org.dllearner.utilities.StringTuple; + // is a node in the graph that is a class public class ClassNode extends Node { Set<PropertyNode> properties = new HashSet<PropertyNode>(); @@ -36,14 +38,14 @@ @Override public Vector<Node> expand(TypedSparqlQuery tsq, Manipulator m) { - Set<Tupel> s = tsq.query(this.uri); + Set<StringTuple> s = tsq.query(this.uri); s = m.check(s, this); Vector<Node> Nodes = new Vector<Node>(); // Manipulation - Iterator<Tupel> it = s.iterator(); + Iterator<StringTuple> it = s.iterator(); while (it.hasNext()) { - Tupel t = (Tupel) it.next(); + StringTuple t = (StringTuple) it.next(); try { if (t.a.equals(m.type) || t.a.equals(m.subclass)) { ClassNode tmp = new ClassNode(new URI(t.b)); Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/InstanceNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/InstanceNode.java 2007-12-03 17:58:20 UTC (rev 317) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/InstanceNode.java 2007-12-03 18:13:19 UTC (rev 318) @@ -25,11 +25,13 @@ import java.util.Set; import java.util.Vector; +import org.dllearner.utilities.StringTuple; + // a node in the graph that is an instance public class InstanceNode extends Node { Set<ClassNode> classes = new HashSet<ClassNode>(); - Set<Tupel> datatypes = new HashSet<Tupel>(); + Set<StringTuple> datatypes = new HashSet<StringTuple>(); Set<PropertyNode> properties = new HashSet<PropertyNode>(); public InstanceNode(URI u) { @@ -41,15 +43,15 @@ @Override public Vector<Node> expand(TypedSparqlQuery tsq, Manipulator m) { - Set<Tupel> s = tsq.query(uri); + Set<StringTuple> s = tsq.query(uri); // Manipulation m.check(s, this); // System.out.println("fffffff"+m); Vector<Node> Nodes = new Vector<Node>(); - Iterator<Tupel> it = s.iterator(); + Iterator<StringTuple> it = s.iterator(); while (it.hasNext()) { - Tupel t = (Tupel) it.next(); + StringTuple t = (StringTuple) it.next(); try { if (t.a.equals(m.type)) { Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/Manager.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/Manager.java 2007-12-03 17:58:20 UTC (rev 317) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/Manager.java 2007-12-03 18:13:19 UTC (rev 318) @@ -23,6 +23,8 @@ import java.util.HashSet; import java.util.Set; +import org.dllearner.utilities.StringTuple; + // an object of this class encapsulates everything public class Manager { @@ -47,9 +49,9 @@ } catch (Exception e) { e.printStackTrace(); } - Set<Tupel> t = this.typedSparqlQuery.getTupelsForRole(u); + Set<StringTuple> t = this.typedSparqlQuery.getTupelsForRole(u); Set<String> ret = new HashSet<String>(); - for (Tupel one : t) { + for (StringTuple one : t) { ret.add(one.a); } return ret; @@ -62,9 +64,9 @@ } catch (Exception e) { e.printStackTrace(); } - Set<Tupel> t = this.typedSparqlQuery.getTupelsForRole(u); + Set<StringTuple> t = this.typedSparqlQuery.getTupelsForRole(u); Set<String> ret = new HashSet<String>(); - for (Tupel one : t) { + for (StringTuple one : t) { ret.add(one.b); } return ret; Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/Manipulator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/Manipulator.java 2007-12-03 17:58:20 UTC (rev 317) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/Manipulator.java 2007-12-03 18:13:19 UTC (rev 318) @@ -23,6 +23,8 @@ import java.util.Iterator; import java.util.Set; +import org.dllearner.utilities.StringTuple; + // used to manipulate retrieved tupels, identify blanknodes, etc. public class Manipulator { public String subclass = "http://www.w3.org/2000/01/rdf-schema#subClassOf"; @@ -46,11 +48,11 @@ } - public Set<Tupel> check(Set<Tupel> s, Node node) { - Set<Tupel> toRemove = new HashSet<Tupel>(); - Iterator<Tupel> it = s.iterator(); + public Set<StringTuple> check(Set<StringTuple> s, Node node) { + Set<StringTuple> toRemove = new HashSet<StringTuple>(); + Iterator<StringTuple> it = s.iterator(); while (it.hasNext()) { - Tupel t = (Tupel) it.next(); + StringTuple t = (StringTuple) it.next(); // System.out.println(t); // all classes with owl:type class if (t.a.equals(type) && t.b.equals(classns) && node instanceof ClassNode) { Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/PropertyNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/PropertyNode.java 2007-12-03 17:58:20 UTC (rev 317) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/PropertyNode.java 2007-12-03 18:13:19 UTC (rev 318) @@ -25,6 +25,8 @@ import java.util.Set; import java.util.Vector; +import org.dllearner.utilities.StringTuple; + public class PropertyNode extends Node { private Node a; @@ -47,13 +49,13 @@ @Override public Vector<Node> expand(TypedSparqlQuery tsq, Manipulator m) { - Set<Tupel> s = tsq.query(uri); + Set<StringTuple> s = tsq.query(uri); Vector<Node> Nodes = new Vector<Node>(); // Manipulation - Iterator<Tupel> it = s.iterator(); + Iterator<StringTuple> it = s.iterator(); while (it.hasNext()) { - Tupel t = (Tupel) it.next(); + StringTuple t = (StringTuple) it.next(); try { if (t.a.equals(m.type)) { specialTypes.add(t.b); Deleted: trunk/src/dl-learner/org/dllearner/kb/sparql/Tupel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/Tupel.java 2007-12-03 17:58:20 UTC (rev 317) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/Tupel.java 2007-12-03 18:13:19 UTC (rev 318) @@ -1,45 +0,0 @@ -/** - * Copyright (C) 2007, Sebastian Hellmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.dllearner.kb.sparql; - -// a container which can hold two Strings, mainly used as a helper -public class Tupel { - - public String a; - public String b; - - public Tupel(String a, String b) { - this.a = a; - this.b = b; - } - - @Override - public String toString() { - return "<" + a + "|" + b + ">"; - } - - public boolean equals(Tupel t) { - if (a.equals(t.a) && b.equals(t.b)) - return true; - else - return false; - } - -} Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/TypedSparqlQuery.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/TypedSparqlQuery.java 2007-12-03 17:58:20 UTC (rev 317) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/TypedSparqlQuery.java 2007-12-03 18:13:19 UTC (rev 318) @@ -32,6 +32,8 @@ import java.util.Iterator; import java.util.Set; +import org.dllearner.utilities.StringTuple; + // can execute different queries public class TypedSparqlQuery { private Configuration configuration; @@ -47,7 +49,7 @@ this.cache = new Cache("cache"); } - public Set<Tupel> query(URI u) { + public Set<StringTuple> query(URI u) { // getQuery String sparql = sparqlQueryMaker.makeSubjectQueryUsingFilters(u.toString()); @@ -55,18 +57,18 @@ } - public Set<Tupel> getTupelsForRole(URI u) { + public Set<StringTuple> getTupelsForRole(URI u) { // getQuery String sparql = sparqlQueryMaker.makeRoleQueryUsingFilters(u.toString()); - Set<Tupel> s = cachedSparql(u, sparql, "subject", "object"); + Set<StringTuple> s = cachedSparql(u, sparql, "subject", "object"); // System.out.println(s); return s; } - private Set<Tupel> cachedSparql(URI u, String sparql, String a, String b) { + private Set<StringTuple> cachedSparql(URI u, String sparql, String a, String b) { // check cache String FromCache = cache.get(u.toString(), sparql); @@ -91,7 +93,7 @@ // System.out.println(sparql); // System.out.println(xml); // process XML - Set<Tupel> s = processResult(xml, a, b); + Set<StringTuple> s = processResult(xml, a, b); try { System.out.println("retrieved " + s.size() + " tupels\n"); } catch (Exception e) { @@ -99,9 +101,9 @@ return s; } - public Set<Tupel> processResult(String xml, String a, String b) { + public Set<StringTuple> processResult(String xml, String a, String b) { - Set<Tupel> ret = new HashSet<Tupel>(); + Set<StringTuple> ret = new HashSet<StringTuple>(); // TODO if result is empty, catch exceptions String one = "<binding name=\"" + a + "\">"; String two = "<binding name=\"" + b + "\">"; @@ -120,7 +122,7 @@ xml = xml.substring(xml.indexOf(two) + two.length()); xml = xml.substring(xml.indexOf(uridel) + uridel.length()); objtmp = xml.substring(0, xml.indexOf(end)); - ret.add(new Tupel(predtmp, objtmp)); + ret.add(new StringTuple(predtmp, objtmp)); // System.out.println(new Tupel(predtmp,objtmp)); } Added: trunk/src/dl-learner/org/dllearner/utilities/StringTuple.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/StringTuple.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/utilities/StringTuple.java 2007-12-03 18:13:19 UTC (rev 318) @@ -0,0 +1,49 @@ +/** + * Copyright (C) 2007, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.utilities; + +/** + * A container which can hold two Strings, mainly used as a helper. + * + * @author Sebastian Hellmann + */ +public class StringTuple { + + public String a; + public String b; + + public StringTuple(String a, String b) { + this.a = a; + this.b = b; + } + + @Override + public String toString() { + return "<" + a + "|" + b + ">"; + } + + public boolean equals(StringTuple t) { + if (a.equals(t.a) && b.equals(t.b)) + return true; + else + return false; + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2007-12-03 17:58:29
|
Revision: 317 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=317&view=rev Author: jenslehmann Date: 2007-12-03 09:58:20 -0800 (Mon, 03 Dec 2007) Log Message: ----------- - changed some option names, added default values and explanations - created simple.conf example (simple entry example for learning on SPARQL endpoints) Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/kb/SparqlEndpointRestructured.java Added Paths: ----------- trunk/examples/sparql/simple.conf Added: trunk/examples/sparql/simple.conf =================================================================== --- trunk/examples/sparql/simple.conf (rev 0) +++ trunk/examples/sparql/simple.conf 2007-12-03 17:58:20 UTC (rev 317) @@ -0,0 +1,49 @@ +/** + * Simple example for using a SPARQL Endpoint as background + * knowledge. + * + * solutions: + * http://dbpedia.org/class/yago/Adult109605289 + * http://dbpedia.org/class/yago/Female109619168 + * http://dbpedia.org/class/yago/Scientist110560637 + */ + +// recursion depth of extraction algorithm +sparql2.recursionDepth = 2; + +// list of ignored roles +sparql2.predList = { + "http://www.w3.org/2004/02/skos/core", + "http://www.w3.org/2002/07/owl#sameAs", + "http://xmlns.com/foaf/0.1/", + "http://dbpedia.org/property/reference", + "http://dbpedia.org/property/website", + "http://dbpedia.org/property/wikipage" +}; + +// list of ignored objects +sparql2.objList = { + "http://dbpedia.org/resource/Category:Wikipedia_", + "http://dbpedia.org/resource/Category:Articles_", + "http://xmlns.com/foaf/0.1/", + "http://upload.wikimedia.org/wikipedia/commons", + "http://upload.wikimedia.org/wikipedia", + "http://www.geonames.org", + "http://www.w3.org/2006/03/wn/wn20/instances/synset", + "http://www4.wiwiss.fu-berlin.de/flickrwrappr", + "http://www.w3.org/2004/02/skos/core" +}; + +// use DBpedia endpoint +import("http://dbpedia.openlinksw.com:8890/sparql","SPARQL2"); + +// the set of objects as starting point for fragment selection +// (should be identical to the set of examples) +sparql2.instances = { + "http://dbpedia.org/resource/Angela_Merkel", + "http://dbpedia.org/resource/Gerhard_Schr%C3%B6der" +}; + +/** examples **/ ++"http://dbpedia.org/resource/Angela_Merkel" +-"http://dbpedia.org/resource/Gerhard_Schr%C3%B6der" Modified: trunk/src/dl-learner/org/dllearner/kb/SparqlEndpointRestructured.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/SparqlEndpointRestructured.java 2007-12-03 16:55:16 UTC (rev 316) +++ trunk/src/dl-learner/org/dllearner/kb/SparqlEndpointRestructured.java 2007-12-03 17:58:20 UTC (rev 317) @@ -53,11 +53,11 @@ import org.dllearner.reasoning.JenaOWLDIGConverter; /** - * Represents a SPARQL Endpoint. TODO: Is it necessary to create a class - * DBpediaSparqlEndpoint? + * Represents a SPARQL Endpoint. * * @author Jens Lehmann * @author Sebastian Knappe + * @author Sebastian Hellmann */ public class SparqlEndpointRestructured extends KnowledgeSource { @@ -66,16 +66,16 @@ String host; private Set<String> instances; private URL dumpFile; - private int numberOfRecursions; + private int recursionDepth = 2; private int predefinedFilter = 0; private int predefinedEndpoint = 0; private Set<String> predList; private Set<String> objList; private Set<String> classList; - private String format; - private boolean dumpToFile; + private String format = "N-TRIPLES"; + private boolean dumpToFile = true; private boolean useLits = false; - private boolean getAllBackground = false; + private boolean getAllSuperClasses = true; private boolean learnDomain = false; private String role; @@ -136,19 +136,19 @@ options.add(new StringConfigOption("host", "host of SPARQL Endpoint")); options.add(new StringSetConfigOption("instances", "relevant instances e.g. positive and negative examples in a learning problem")); - options.add(new IntegerConfigOption("numberOfRecursions", - "number of Recursions, the Sparql-Endpoint is asked")); + options.add(new IntegerConfigOption("recursionDepth", + "recursion depth of KB fragment selection", 2)); options.add(new IntegerConfigOption("predefinedFilter", "the mode of the SPARQL Filter")); options.add(new IntegerConfigOption("predefinedEndpoint", "the mode of the SPARQL Filter")); - options.add(new StringSetConfigOption("predList", "a predicate list")); - options.add(new StringSetConfigOption("objList", "an object list")); - options.add(new StringSetConfigOption("classList", "a class list")); - options.add(new StringConfigOption("format", "N-TRIPLES or KB format")); + options.add(new StringSetConfigOption("predList", "list of all ignored roles")); + options.add(new StringSetConfigOption("objList", "list of all ignored objects")); + options.add(new StringSetConfigOption("classList", "list of all ignored classes")); + options.add(new StringConfigOption("format", "N-TRIPLES or KB format", "N-TRIPLES")); options.add(new BooleanConfigOption("dumpToFile", - "wether Ontology from DBPedia is written to a file or not")); + "Specifies whether the extracted ontology is written to a file or not.", true)); options.add(new BooleanConfigOption("useLits", "use Literals in SPARQL query")); - options.add(new BooleanConfigOption("getAllBackground", "get")); + options.add(new BooleanConfigOption("getAllSuperClasses", "If true then all superclasses are retrieved until the most general class (owl:Thing) is reached.", true)); options.add(new BooleanConfigOption("learnDomain", "learns the Domain for a Role")); options.add(new StringConfigOption("role", "role to learn Domain from")); @@ -177,8 +177,8 @@ host = (String) entry.getValue(); } else if (option.equals("instances")) { instances = (Set<String>) entry.getValue(); - } else if (option.equals("numberOfRecursions")) { - numberOfRecursions = (Integer) entry.getValue(); + } else if (option.equals("recursionDepth")) { + recursionDepth = (Integer) entry.getValue(); } else if (option.equals("predList")) { predList = (Set<String>) entry.getValue(); } else if (option.equals("objList")) { @@ -195,8 +195,8 @@ dumpToFile = (Boolean) entry.getValue(); } else if (option.equals("useLits")) { useLits = (Boolean) entry.getValue(); - } else if (option.equals("getAllBackground")) { - getAllBackground = (Boolean) entry.getValue(); + } else if (option.equals("getAllSuperClasses")) { + getAllSuperClasses = (Boolean) entry.getValue(); } else if (option.equals("learnDomain")) { learnDomain = (Boolean) entry.getValue(); } else if (option.equals("role")) { @@ -244,7 +244,7 @@ sqt = new SparqlQueryType("forbid", objList, predList, useLits + ""); } // give everything to the manager - m.useConfiguration(sqt, sse, man, numberOfRecursions, getAllBackground); + m.useConfiguration(sqt, sse, man, recursionDepth, getAllSuperClasses); try { String ont = ""; // used to learn a domain of a role This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ku...@us...> - 2007-12-03 16:55:20
|
Revision: 316 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=316&view=rev Author: kurzum Date: 2007-12-03 08:55:16 -0800 (Mon, 03 Dec 2007) Log Message: ----------- small changes Modified Paths: -------------- trunk/examples/sparql/newworking.conf trunk/examples/sparql/newworkingManually.conf trunk/examples/sparql/reference.conf Modified: trunk/examples/sparql/newworking.conf =================================================================== --- trunk/examples/sparql/newworking.conf 2007-12-03 16:53:05 UTC (rev 315) +++ trunk/examples/sparql/newworking.conf 2007-12-03 16:55:16 UTC (rev 316) @@ -1,11 +1,3 @@ -/** - * Father Example - * - * possible solution: - * male AND EXISTS hasChild.TOP - * - * Copyright (C) 2007, Jens Lehmann - */ /** settings **/ // reasoner settings Modified: trunk/examples/sparql/newworkingManually.conf =================================================================== --- trunk/examples/sparql/newworkingManually.conf 2007-12-03 16:53:05 UTC (rev 315) +++ trunk/examples/sparql/newworkingManually.conf 2007-12-03 16:55:16 UTC (rev 316) @@ -1,12 +1,5 @@ -/** - * Father Example - * - * possible solution: - * male AND EXISTS hasChild.TOP - * - * Copyright (C) 2007, Jens Lehmann - */ + /** settings **/ // reasoner settings reasoner = dig; Modified: trunk/examples/sparql/reference.conf =================================================================== --- trunk/examples/sparql/reference.conf 2007-12-03 16:53:05 UTC (rev 315) +++ trunk/examples/sparql/reference.conf 2007-12-03 16:55:16 UTC (rev 316) @@ -1,12 +1,5 @@ -/** - * Father Example - * - * possible solution: - * male AND EXISTS hasChild.TOP - * - * Copyright (C) 2007, Jens Lehmann - */ + /** settings **/ // reasoner settings reasoner = dig; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ku...@us...> - 2007-12-03 16:53:10
|
Revision: 315 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=315&view=rev Author: kurzum Date: 2007-12-03 08:53:05 -0800 (Mon, 03 Dec 2007) Log Message: ----------- some more examples all in folder examples/sparql now Added Paths: ----------- trunk/examples/sparql/Aristotle.conf trunk/examples/sparql/WomanInPoliticsFirstTry.conf trunk/examples/sparql/newworking.conf trunk/examples/sparql/newworkingManually.conf Removed Paths: ------------- trunk/examples/dbpedia/newworking.conf trunk/examples/dbpedia/newworkingManually.conf Deleted: trunk/examples/dbpedia/newworking.conf =================================================================== --- trunk/examples/dbpedia/newworking.conf 2007-12-03 16:52:30 UTC (rev 314) +++ trunk/examples/dbpedia/newworking.conf 2007-12-03 16:53:05 UTC (rev 315) @@ -1,51 +0,0 @@ -/** - * Father Example - * - * possible solution: - * male AND EXISTS hasChild.TOP - * - * Copyright (C) 2007, Jens Lehmann - */ - -/** settings **/ -// reasoner settings -reasoner = dig; -//digReasonerURL = "http://localhost:8081"; -//useRetrievalForClassification = true; -//refinement.useDIGMultiInstanceChecks = twoChecks; - -// algorithm settings -algorithm = refinement; -//refinement.horizontalExpansionFactor = 0.5; -//refinement.quiet = false; - -// search tree protocol -// refinement.writeSearchTree = false; -// refinement.searchTreeFile = "log/searchTree.txt"; - -// control output -cli.checkSatisfiability = true; -cli.showIndividuals = false; -cli.showConcepts = false; -cli.showRoles = true; -cli.showSubsumptionHierarchy = false; - -// SPARQL options -sparql2.numberOfRecursions = 2; -sparql2.host = "dbpedia.openlinksw.com"; -sparql2.getAllBackground=true; -sparql2.instances = {"http://dbpedia.org/resource/Angela_Merkel"}; -sparql2.filterMode = 1; -//filtermode 1 and above uses a predefined setting -//0 means manual -sparql2.predList = {}; -sparql2.objList = {}; -sparql2.classList = {}; -sparql2.format = "N-TRIPLES"; -sparql2.dumpToFile = true; - -import("http://dbpedia.openlinksw.com:8890/sparql","SPARQL2"); - -/** examples **/ -+"http://dbpedia.org/resource/Angela_Merkel" --"http://dbpedia.org/resource/Gerhard_Schr%C3%B6der" \ No newline at end of file Deleted: trunk/examples/dbpedia/newworkingManually.conf =================================================================== --- trunk/examples/dbpedia/newworkingManually.conf 2007-12-03 16:52:30 UTC (rev 314) +++ trunk/examples/dbpedia/newworkingManually.conf 2007-12-03 16:53:05 UTC (rev 315) @@ -1,64 +0,0 @@ -/** - * Father Example - * - * possible solution: - * male AND EXISTS hasChild.TOP - * - * Copyright (C) 2007, Jens Lehmann - */ - -/** settings **/ -// reasoner settings -reasoner = dig; -//digReasonerURL = "http://localhost:8081"; -//useRetrievalForClassification = true; -//refinement.useDIGMultiInstanceChecks = twoChecks; - -// algorithm settings -algorithm = refinement; -//refinement.horizontalExpansionFactor = 0.5; -//refinement.quiet = false; - -// search tree protocol -// refinement.writeSearchTree = false; -// refinement.searchTreeFile = "log/searchTree.txt"; - -// control output -cli.checkSatisfiability = true; -cli.showIndividuals = false; -cli.showConcepts = false; -cli.showRoles = true; -cli.showSubsumptionHierarchy = false; - -// SPARQL options -sparql2.numberOfRecursions = 2; -sparql2.host = "dbpedia.openlinksw.com"; -sparql2.getAllBackground=true; -sparql2.instances = {"http://dbpedia.org/resource/Angela_Merkel"}; -sparql2.filterMode = 0; -//filtermode 1 and above uses a predefined setting -//0 means manual -sparql2.predList = {"http://www.w3.org/2004/02/skos/core", - "http://www.w3.org/2002/07/owl#sameAs", - "http://xmlns.com/foaf/0.1/", - "http://dbpedia.org/property/reference", - "http://dbpedia.org/property/website", - "http://dbpedia.org/property/wikipage"}; -sparql2.objList = {"http://dbpedia.org/resource/Category:Wikipedia_" - ,"http://dbpedia.org/resource/Category:Articles_" - ,"http://xmlns.com/foaf/0.1/" - ,"http://upload.wikimedia.org/wikipedia/commons" - ,"http://upload.wikimedia.org/wikipedia" - ,"http://www.geonames.org" - ,"http://www.w3.org/2006/03/wn/wn20/instances/synset" - ,"http://www4.wiwiss.fu-berlin.de/flickrwrappr" - ,"http://www.w3.org/2004/02/skos/core"}; -sparql2.classList = {}; -sparql2.format = "N-TRIPLES"; -sparql2.dumpToFile = true; - -import("http://dbpedia.openlinksw.com:8890/sparql","SPARQL2"); - -/** examples **/ -+"http://dbpedia.org/resource/Angela_Merkel" --"http://dbpedia.org/resource/Gerhard_Schr%C3%B6der" \ No newline at end of file Added: trunk/examples/sparql/Aristotle.conf =================================================================== --- trunk/examples/sparql/Aristotle.conf (rev 0) +++ trunk/examples/sparql/Aristotle.conf 2007-12-03 16:53:05 UTC (rev 315) @@ -0,0 +1,62 @@ +// reasoner settings +reasoner = dig; +//digReasonerURL = "http://localhost:8081"; +//useRetrievalForClassification = false; +//refinement.useDIGMultiInstanceChecks = twoChecks; + +// algorithm settings +algorithm = refinement; +//refinement.horizontalExpansionFactor = 0.6; +//refinement.quiet = false; +//refinement.useTooWeakList = true; + +// search tree protocol +//refinement.writeSearchTree = false; +//refinement.searchTreeFile = "Aristotle_searchTree.txt"; + +// control output +cli.checkSatisfiability = true; +cli.showIndividuals = false; +cli.showConcepts = false; +cli.showRoles = true; +cli.showSubsumptionHierarchy = false; + + + +// SPARQL options +sparql2.numberOfRecursions = 2; +sparql2.getAllBackground=true; +sparql2.format = "N-TRIPLES"; +sparql2.dumpToFile = true; +sparql2.instances = { + "http://dbpedia.org/resource/Democritus", + "http://dbpedia.org/resource/Zeno_of_Elea", + "http://dbpedia.org/resource/Plato", + "http://dbpedia.org/resource/Socrates", + "http://dbpedia.org/resource/Archytas", + "http://dbpedia.org/resource/Pythagoras", + "http://dbpedia.org/resource/Philolaus"}; + +//predefined Endpoint overrides host and it doesn't matter what the string in import below looks like +// 0 means nothing +// 1 means dbpedia +// 2 means localhost:2020 default joseki +sparql2.predefinedEndpoint=1; + + +//predefined filter overrides predList and ObjList +sparql2.predefinedFilter = 1; +//filtermode 1 and above uses a predefined setting +// 0 means nothing (manual configuration) +// 1 means only yago classes + +import("http://dbpedia.openlinksw.com:8890/sparql","SPARQL2"); + +/** examples **/ ++"http://dbpedia.org/resource/Pythagoras" ++"http://dbpedia.org/resource/Philolaus" ++"http://dbpedia.org/resource/Archytas" +-"http://dbpedia.org/resource/Socrates" +-"http://dbpedia.org/resource/Plato" +-"http://dbpedia.org/resource/Zeno_of_Elea" +-"http://dbpedia.org/resource/Democritus" \ No newline at end of file Added: trunk/examples/sparql/WomanInPoliticsFirstTry.conf =================================================================== --- trunk/examples/sparql/WomanInPoliticsFirstTry.conf (rev 0) +++ trunk/examples/sparql/WomanInPoliticsFirstTry.conf 2007-12-03 16:53:05 UTC (rev 315) @@ -0,0 +1,93 @@ + + +/** settings **/ +// reasoner settings +reasoner = dig; +//digReasonerURL = "http://localhost:8081"; +//useRetrievalForClassification = true; +//refinement.useDIGMultiInstanceChecks = twoChecks; + +// algorithm settings +algorithm = refinement; +//refinement.horizontalExpansionFactor = 0.5; +//refinement.quiet = false; + +// search tree protocol +// refinement.writeSearchTree = false; +// refinement.searchTreeFile = "log/searchTree.txt"; + +// control output +cli.checkSatisfiability = true; +cli.showIndividuals = false; +cli.showConcepts = false; +cli.showRoles = true; +cli.showSubsumptionHierarchy = false; + +// SPARQL options +//necessary: +sparql2.numberOfRecursions = 2; +sparql2.getAllBackground=true; +sparql2.format = "N-TRIPLES"; +sparql2.dumpToFile = true; +sparql2.instances = { +"http://dbpedia.org/resource/Indira_Gandhi", +"http://dbpedia.org/resource/Sonia_Gandhi", +"http://dbpedia.org/resource/Hillary_Rodham_Clinton", +"http://dbpedia.org/resource/Princess_Leia_Organa", +"http://dbpedia.org/resource/Angela_Merkel", +"http://dbpedia.org/resource/Christine_Todd_Whitman"}; + +//doesn't work yet, blank nodes are not in returned XML. +sparql2.blankNodeIdentifier="bnode"; + +//for Role learning: +//sparql2.role = "http://semanticbible.org/ns/2006/NTNames#religiousBelief"; +//sparql2.learnDomain=true; + + + +//predefined Endpoint overrides host and it doesn't matter what the string in import below looks like +// 0 means nothing +// 1 means dbpedia +// 2 means localhost:2020 default joseki +sparql2.predefinedEndpoint=1; +//sparql2.host = "dbpedia.openlinksw.com"; + + + +//predefined filter overrides predList and ObjList +sparql2.predefinedFilter = 1; +//filtermode 1 and above uses a predefined setting +// 0 means nothing (manual configuration) +// 1 means only yago classes + +/* +This is left here. It is the yago predefined Filter +sparql2.predList = {"http://www.w3.org/2004/02/skos/core", + "http://www.w3.org/2002/07/owl#sameAs", + "http://xmlns.com/foaf/0.1/", + "http://dbpedia.org/property/reference", + "http://dbpedia.org/property/website", + "http://dbpedia.org/property/wikipage"}; +sparql2.objList = {"http://dbpedia.org/resource/Category:Wikipedia_" + ,"http://dbpedia.org/resource/Category:Articles_" + ,"http://xmlns.com/foaf/0.1/" + ,"http://upload.wikimedia.org/wikipedia/commons" + ,"http://upload.wikimedia.org/wikipedia" + ,"http://www.geonames.org" + ,"http://www.w3.org/2006/03/wn/wn20/instances/synset" + ,"http://www4.wiwiss.fu-berlin.de/flickrwrappr" + ,"http://www.w3.org/2004/02/skos/core"}; +*/ + + + +import("http://dbpedia.openlinksw.com:8890/sparql","SPARQL2"); + +/** examples **/ ++"http://dbpedia.org/resource/Indira_Gandhi" ++"http://dbpedia.org/resource/Sonia_Gandhi" +-"http://dbpedia.org/resource/Hillary_Rodham_Clinton" +-"http://dbpedia.org/resource/Princess_Leia_Organa" +-"http://dbpedia.org/resource/Angela_Merkel" +-"http://dbpedia.org/resource/Christine_Todd_Whitman" \ No newline at end of file Copied: trunk/examples/sparql/newworking.conf (from rev 313, trunk/examples/dbpedia/newworking.conf) =================================================================== --- trunk/examples/sparql/newworking.conf (rev 0) +++ trunk/examples/sparql/newworking.conf 2007-12-03 16:53:05 UTC (rev 315) @@ -0,0 +1,61 @@ +/** + * Father Example + * + * possible solution: + * male AND EXISTS hasChild.TOP + * + * Copyright (C) 2007, Jens Lehmann + */ + +/** settings **/ +// reasoner settings +reasoner = dig; +//digReasonerURL = "http://localhost:8081"; +//useRetrievalForClassification = true; +//refinement.useDIGMultiInstanceChecks = twoChecks; + +// algorithm settings +algorithm = refinement; +//refinement.horizontalExpansionFactor = 0.5; +//refinement.quiet = false; + +// search tree protocol +// refinement.writeSearchTree = false; +// refinement.searchTreeFile = "log/searchTree.txt"; + +// control output +cli.checkSatisfiability = true; +cli.showIndividuals = false; +cli.showConcepts = false; +cli.showRoles = true; +cli.showSubsumptionHierarchy = false; + +// SPARQL options + + + +sparql2.numberOfRecursions = 2; +sparql2.getAllBackground=true; +sparql2.instances = {"http://dbpedia.org/resource/Angela_Merkel","http://dbpedia.org/resource/Gerhard_Schr%C3%B6der"}; +sparql2.format = "N-TRIPLES"; +sparql2.dumpToFile = true; + + +sparql2.predefinedEndpoint=1; +//sparql2.host = "dbpedia.openlinksw.com"; + + +sparql2.predefinedFilter = 1; +//filtermode 1 and above uses a predefined setting +//0 means manual +//sparql2.predList = {}; +//sparql2.objList = {}; +//sparql2.classList = {}; + + +import("http://dbpedia.openlinksw.com:8890/sparql","SPARQL2"); + + +/** examples **/ ++"http://dbpedia.org/resource/Angela_Merkel" +-"http://dbpedia.org/resource/Gerhard_Schr%C3%B6der" \ No newline at end of file Copied: trunk/examples/sparql/newworkingManually.conf (from rev 313, trunk/examples/dbpedia/newworkingManually.conf) =================================================================== --- trunk/examples/sparql/newworkingManually.conf (rev 0) +++ trunk/examples/sparql/newworkingManually.conf 2007-12-03 16:53:05 UTC (rev 315) @@ -0,0 +1,75 @@ +/** + * Father Example + * + * possible solution: + * male AND EXISTS hasChild.TOP + * + * Copyright (C) 2007, Jens Lehmann + */ + +/** settings **/ +// reasoner settings +reasoner = dig; +//digReasonerURL = "http://localhost:8081"; +//useRetrievalForClassification = true; +//refinement.useDIGMultiInstanceChecks = twoChecks; + +// algorithm settings +algorithm = refinement; +//refinement.horizontalExpansionFactor = 0.5; +//refinement.quiet = false; + +// search tree protocol +// refinement.writeSearchTree = false; +// refinement.searchTreeFile = "log/searchTree.txt"; + +// control output +cli.checkSatisfiability = true; +cli.showIndividuals = false; +cli.showConcepts = false; +cli.showRoles = true; +cli.showSubsumptionHierarchy = false; + +// SPARQL options +sparql2.numberOfRecursions = 2; +sparql2.getAllBackground=true; +sparql2.format = "N-TRIPLES"; +sparql2.dumpToFile = true; + + +//sparql2.predefinedEndpoint=0; +sparql2.host = "dbpedia.openlinksw.com"; +sparql2.instances = {"http://dbpedia.org/resource/Angela_Merkel","http://dbpedia.org/resource/Gerhard_Schr%C3%B6der"}; + + + +// +//sparql2.predefinedFilter = 1; +//filtermode 1 and above uses a predefined setting +//0 means manual + + +sparql2.predList = {"http://www.w3.org/2004/02/skos/core", + "http://www.w3.org/2002/07/owl#sameAs", + "http://xmlns.com/foaf/0.1/", + "http://dbpedia.org/property/reference", + "http://dbpedia.org/property/website", + "http://dbpedia.org/property/wikipage"}; +sparql2.objList = {"http://dbpedia.org/resource/Category:Wikipedia_" + ,"http://dbpedia.org/resource/Category:Articles_" + ,"http://xmlns.com/foaf/0.1/" + ,"http://upload.wikimedia.org/wikipedia/commons" + ,"http://upload.wikimedia.org/wikipedia" + ,"http://www.geonames.org" + ,"http://www.w3.org/2006/03/wn/wn20/instances/synset" + ,"http://www4.wiwiss.fu-berlin.de/flickrwrappr" + ,"http://www.w3.org/2004/02/skos/core"}; +//sparql2.classList = {}; + + + +import("http://dbpedia.openlinksw.com:8890/sparql","SPARQL2"); + +/** examples **/ ++"http://dbpedia.org/resource/Angela_Merkel" +-"http://dbpedia.org/resource/Gerhard_Schr%C3%B6der" \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2007-12-03 16:52:32
|
Revision: 314 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=314&view=rev Author: jenslehmann Date: 2007-12-03 08:52:30 -0800 (Mon, 03 Dec 2007) Log Message: ----------- updated arch example to new structure Modified Paths: -------------- trunk/examples/arch/arch.conf Added Paths: ----------- trunk/examples/arch/arch.kb Removed Paths: ------------- trunk/examples/arch/arch_owl.conf Modified: trunk/examples/arch/arch.conf =================================================================== --- trunk/examples/arch/arch.conf 2007-12-03 15:57:42 UTC (rev 313) +++ trunk/examples/arch/arch.conf 2007-12-03 16:52:30 UTC (rev 314) @@ -22,74 +22,12 @@ //export("arch.owl"); /** background knowledge **/ -parallelpipe = (brick OR wedge). -freeStandingPillar = (pillar AND NOT EXISTS touches.TOP ) . +import("arch.kb"); +// import("arch.owl"); -construction(c1). -construction(c2). -construction(c3). -construction(c4). -construction(c5). - -pillar(p1). -pillar(p2). -pillar(p3). -pillar(p4). -pillar(p5). -pillar(p6). -pillar(p7). -pillar(p8). -pillar(p9). - -brick(a). -brick(b). -brick(c). - -wedge(d). -wedge(e). - -hasPillar(c1,p1). -hasPillar(c1,p2). -hasPillar(c2,p3). -hasPillar(c2,p4). -hasPillar(c3,p5). -hasPillar(c3,p6). -hasPillar(c4,p7). -hasPillar(c4,p8). -hasPillar(c5,p9). - -hasParallelpipe(c1,a). -hasParallelpipe(c2,b). -hasParallelpipe(c3,c). -hasParallelpipe(c4,d). -hasParallelpipe(c5,e). - -supports(p1,a). -supports(p2,a). -supports(p5,c). -supports(p6,c). -supports(p7,d). -supports(p8,d). -supports(p9,e). - -leftof(p1,p2). -leftof(p3,p4). -leftof(p5,p6). -leftof(p7,p8). - -touches(p5,p6). - -freeStandingPillar(p1). -freeStandingPillar(p2). -freeStandingPillar(p3). -freeStandingPillar(p4). -freeStandingPillar(p7). -freeStandingPillar(p8). -freeStandingPillar(p9). - /** examples **/ -+arch(c1). -+arch(c4). --arch(c2). --arch(c3). --arch(c5). ++c1 ++c4 +-c2 +-c3 +-c5 Added: trunk/examples/arch/arch.kb =================================================================== --- trunk/examples/arch/arch.kb (rev 0) +++ trunk/examples/arch/arch.kb 2007-12-03 16:52:30 UTC (rev 314) @@ -0,0 +1,64 @@ +parallelpipe = (brick OR wedge). +freeStandingPillar = (pillar AND NOT EXISTS touches.TOP ) . + +construction(c1). +construction(c2). +construction(c3). +construction(c4). +construction(c5). + +pillar(p1). +pillar(p2). +pillar(p3). +pillar(p4). +pillar(p5). +pillar(p6). +pillar(p7). +pillar(p8). +pillar(p9). + +brick(a). +brick(b). +brick(c). + +wedge(d). +wedge(e). + +hasPillar(c1,p1). +hasPillar(c1,p2). +hasPillar(c2,p3). +hasPillar(c2,p4). +hasPillar(c3,p5). +hasPillar(c3,p6). +hasPillar(c4,p7). +hasPillar(c4,p8). +hasPillar(c5,p9). + +hasParallelpipe(c1,a). +hasParallelpipe(c2,b). +hasParallelpipe(c3,c). +hasParallelpipe(c4,d). +hasParallelpipe(c5,e). + +supports(p1,a). +supports(p2,a). +supports(p5,c). +supports(p6,c). +supports(p7,d). +supports(p8,d). +supports(p9,e). + +leftof(p1,p2). +leftof(p3,p4). +leftof(p5,p6). +leftof(p7,p8). + +touches(p5,p6). + +freeStandingPillar(p1). +freeStandingPillar(p2). +freeStandingPillar(p3). +freeStandingPillar(p4). +freeStandingPillar(p7). +freeStandingPillar(p8). +freeStandingPillar(p9). Deleted: trunk/examples/arch/arch_owl.conf =================================================================== --- trunk/examples/arch/arch_owl.conf 2007-12-03 15:57:42 UTC (rev 313) +++ trunk/examples/arch/arch_owl.conf 2007-12-03 16:52:30 UTC (rev 314) @@ -1,16 +0,0 @@ -/** - * See arch.conf. This is the same learning problem, but loading background - * knowledge from an OWL file instead. - * - * Copyright (C) 2007, Sebastian Hellmann - */ - -/** background knowledge **/ -import("arch.owl"); - -/** examples **/ -+arch("http://localhost/foo#c1"). -+arch("http://localhost/foo#c4"). --arch("http://localhost/foo#c2"). --arch("http://localhost/foo#c3"). --arch("http://localhost/foo#c5"). This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2007-12-03 15:57:46
|
Revision: 313 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=313&view=rev Author: jenslehmann Date: 2007-12-03 07:57:42 -0800 (Mon, 03 Dec 2007) Log Message: ----------- fixed KAON2 errors Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/kb/KBFile.java trunk/src/dl-learner/org/dllearner/reasoning/KAON2Reasoner.java Modified: trunk/src/dl-learner/org/dllearner/kb/KBFile.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/KBFile.java 2007-12-03 15:04:54 UTC (rev 312) +++ trunk/src/dl-learner/org/dllearner/kb/KBFile.java 2007-12-03 15:57:42 UTC (rev 313) @@ -120,7 +120,7 @@ public void export(File file, org.dllearner.core.OntologyFormat format){ Reasoner kaon2Reasoner = KAON2Reasoner.getKAON2Reasoner(kb); - OntologyFileFormat kaon2Format = null; + String kaon2Format = null; if(format.equals(org.dllearner.core.OntologyFormat.RDF_XML)) kaon2Format = OntologyFileFormat.OWL_RDF; else { Modified: trunk/src/dl-learner/org/dllearner/reasoning/KAON2Reasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/KAON2Reasoner.java 2007-12-03 15:04:54 UTC (rev 312) +++ trunk/src/dl-learner/org/dllearner/reasoning/KAON2Reasoner.java 2007-12-03 15:57:42 UTC (rev 313) @@ -96,7 +96,11 @@ if(imports.size()>1) System.out.println("Warning: KAON2-Reasoner currently supports only one import file. Ignoring all other imports."); - kaon2Connection = KAON2Manager.newConnection(); + try { + kaon2Connection = KAON2Manager.newConnection(); + } catch (KAON2Exception e2) { + e2.printStackTrace(); + } DefaultOntologyResolver resolver = new DefaultOntologyResolver(); @@ -470,7 +474,7 @@ public void saveOntology(File file, org.dllearner.core.OntologyFormat format) { // File exportFile = new File(baseDir, fileName); // String format = OntologyFileFormat.OWL_RDF; - OntologyFileFormat kaon2Format = null; + String kaon2Format = null; if(format.equals(org.dllearner.core.OntologyFormat.RDF_XML)) kaon2Format = OntologyFileFormat.OWL_RDF; else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ku...@us...> - 2007-12-03 15:04:59
|
Revision: 312 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=312&view=rev Author: kurzum Date: 2007-12-03 07:04:54 -0800 (Mon, 03 Dec 2007) Log Message: ----------- new example, moved reference.conf Added Paths: ----------- trunk/examples/sparql/ trunk/examples/sparql/reference.conf Removed Paths: ------------- trunk/examples/dbpedia/reference.conf Deleted: trunk/examples/dbpedia/reference.conf =================================================================== --- trunk/examples/dbpedia/reference.conf 2007-12-03 14:49:44 UTC (rev 311) +++ trunk/examples/dbpedia/reference.conf 2007-12-03 15:04:54 UTC (rev 312) @@ -1,81 +0,0 @@ -/** - * Father Example - * - * possible solution: - * male AND EXISTS hasChild.TOP - * - * Copyright (C) 2007, Jens Lehmann - */ - -/** settings **/ -// reasoner settings -reasoner = dig; -//digReasonerURL = "http://localhost:8081"; -//useRetrievalForClassification = true; -//refinement.useDIGMultiInstanceChecks = twoChecks; - -// algorithm settings -algorithm = refinement; -//refinement.horizontalExpansionFactor = 0.5; -//refinement.quiet = false; - -// search tree protocol -// refinement.writeSearchTree = false; -// refinement.searchTreeFile = "log/searchTree.txt"; - -// control output -cli.checkSatisfiability = true; -cli.showIndividuals = false; -cli.showConcepts = false; -cli.showRoles = true; -cli.showSubsumptionHierarchy = false; - -// SPARQL options -//necessary: -sparql2.numberOfRecursions = 2; -sparql2.getAllBackground=true; -sparql2.format = "N-TRIPLES"; -sparql2.dumpToFile = true; -sparql2.instances = {"http://dbpedia.org/resource/Angela_Merkel","http://dbpedia.org/resource/Gerhard_Schr%C3%B6der"}; - - -//predefined Endpoint overrides host and it doesn't matter what the string in import below looks like -// 0 means nothing -// 1 means dbpedia -sparql2.predefinedEndpoint=1; -//sparql2.host = "dbpedia.openlinksw.com"; - - - -//predefined filter overrides predList and ObjList -sparql2.predefinedFilter = 1; -//filtermode 1 and above uses a predefined setting -// 0 means nothing (manual configuration) -// 1 means only yago classes - -/* -This is left here. It is the yago predefined Filter -sparql2.predList = {"http://www.w3.org/2004/02/skos/core", - "http://www.w3.org/2002/07/owl#sameAs", - "http://xmlns.com/foaf/0.1/", - "http://dbpedia.org/property/reference", - "http://dbpedia.org/property/website", - "http://dbpedia.org/property/wikipage"}; -sparql2.objList = {"http://dbpedia.org/resource/Category:Wikipedia_" - ,"http://dbpedia.org/resource/Category:Articles_" - ,"http://xmlns.com/foaf/0.1/" - ,"http://upload.wikimedia.org/wikipedia/commons" - ,"http://upload.wikimedia.org/wikipedia" - ,"http://www.geonames.org" - ,"http://www.w3.org/2006/03/wn/wn20/instances/synset" - ,"http://www4.wiwiss.fu-berlin.de/flickrwrappr" - ,"http://www.w3.org/2004/02/skos/core"}; -*/ - - - -import("http://dbpedia.openlinksw.com:8890/sparql","SPARQL2"); - -/** examples **/ -+"http://dbpedia.org/resource/Angela_Merkel" --"http://dbpedia.org/resource/Gerhard_Schr%C3%B6der" \ No newline at end of file Added: trunk/examples/sparql/reference.conf =================================================================== --- trunk/examples/sparql/reference.conf (rev 0) +++ trunk/examples/sparql/reference.conf 2007-12-03 15:04:54 UTC (rev 312) @@ -0,0 +1,89 @@ +/** + * Father Example + * + * possible solution: + * male AND EXISTS hasChild.TOP + * + * Copyright (C) 2007, Jens Lehmann + */ + +/** settings **/ +// reasoner settings +reasoner = dig; +//digReasonerURL = "http://localhost:8081"; +//useRetrievalForClassification = true; +//refinement.useDIGMultiInstanceChecks = twoChecks; + +// algorithm settings +algorithm = refinement; +//refinement.horizontalExpansionFactor = 0.5; +//refinement.quiet = false; + +// search tree protocol +// refinement.writeSearchTree = false; +// refinement.searchTreeFile = "log/searchTree.txt"; + +// control output +cli.checkSatisfiability = true; +cli.showIndividuals = false; +cli.showConcepts = false; +cli.showRoles = true; +cli.showSubsumptionHierarchy = false; + +// SPARQL options +//necessary: +sparql2.numberOfRecursions = 2; +sparql2.getAllBackground=true; +sparql2.format = "N-TRIPLES"; +sparql2.dumpToFile = true; +sparql2.instances = {"http://dbpedia.org/resource/Angela_Merkel","http://dbpedia.org/resource/Gerhard_Schr%C3%B6der"}; +//doesn't work yet, blank nodes are not in returned XML. +sparql2.blankNodeIdentifier="bnode"; + +//for Role learning: +//sparql2.role = "http://semanticbible.org/ns/2006/NTNames#religiousBelief"; +//sparql2.learnDomain=true; + + + +//predefined Endpoint overrides host and it doesn't matter what the string in import below looks like +// 0 means nothing +// 1 means dbpedia +// 2 means localhost:2020 default joseki +sparql2.predefinedEndpoint=1; +//sparql2.host = "dbpedia.openlinksw.com"; + + + +//predefined filter overrides predList and ObjList +sparql2.predefinedFilter = 1; +//filtermode 1 and above uses a predefined setting +// 0 means nothing (manual configuration) +// 1 means only yago classes + +/* +This is left here. It is the yago predefined Filter +sparql2.predList = {"http://www.w3.org/2004/02/skos/core", + "http://www.w3.org/2002/07/owl#sameAs", + "http://xmlns.com/foaf/0.1/", + "http://dbpedia.org/property/reference", + "http://dbpedia.org/property/website", + "http://dbpedia.org/property/wikipage"}; +sparql2.objList = {"http://dbpedia.org/resource/Category:Wikipedia_" + ,"http://dbpedia.org/resource/Category:Articles_" + ,"http://xmlns.com/foaf/0.1/" + ,"http://upload.wikimedia.org/wikipedia/commons" + ,"http://upload.wikimedia.org/wikipedia" + ,"http://www.geonames.org" + ,"http://www.w3.org/2006/03/wn/wn20/instances/synset" + ,"http://www4.wiwiss.fu-berlin.de/flickrwrappr" + ,"http://www.w3.org/2004/02/skos/core"}; +*/ + + + +import("http://dbpedia.openlinksw.com:8890/sparql","SPARQL2"); + +/** examples **/ ++"http://dbpedia.org/resource/Angela_Merkel" +-"http://dbpedia.org/resource/Gerhard_Schr%C3%B6der" \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ku...@us...> - 2007-12-03 14:49:46
|
Revision: 311 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=311&view=rev Author: kurzum Date: 2007-12-03 06:49:44 -0800 (Mon, 03 Dec 2007) Log Message: ----------- small change in output Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/kb/sparql/TypedSparqlQuery.java Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/TypedSparqlQuery.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/TypedSparqlQuery.java 2007-12-03 14:45:11 UTC (rev 310) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/TypedSparqlQuery.java 2007-12-03 14:49:44 UTC (rev 311) @@ -82,7 +82,7 @@ // System.out.println(sparql); // System.out.println(xml); cache.put(u.toString(), sparql, xml); - System.out.print("\n"); + //System.out.print("\n"); } else { xml = FromCache; System.out.println("FROM CACHE"); @@ -93,7 +93,7 @@ // process XML Set<Tupel> s = processResult(xml, a, b); try { - System.out.println("retrieved " + s.size() + " tupels"); + System.out.println("retrieved " + s.size() + " tupels\n"); } catch (Exception e) { } return s; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ku...@us...> - 2007-12-03 14:45:16
|
Revision: 310 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=310&view=rev Author: kurzum Date: 2007-12-03 06:45:11 -0800 (Mon, 03 Dec 2007) Log Message: ----------- changed and Formatted everything Delete old Cache files Examples will follow Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/kb/SparqlEndpointRestructured.java trunk/src/dl-learner/org/dllearner/kb/sparql/Cache.java 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/InstanceNode.java trunk/src/dl-learner/org/dllearner/kb/sparql/Manager.java trunk/src/dl-learner/org/dllearner/kb/sparql/Manipulator.java trunk/src/dl-learner/org/dllearner/kb/sparql/Node.java trunk/src/dl-learner/org/dllearner/kb/sparql/PredefinedEndpoint.java trunk/src/dl-learner/org/dllearner/kb/sparql/PredefinedFilter.java trunk/src/dl-learner/org/dllearner/kb/sparql/PropertyNode.java trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryMaker.java trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryType.java trunk/src/dl-learner/org/dllearner/kb/sparql/SpecificSparqlEndpoint.java trunk/src/dl-learner/org/dllearner/kb/sparql/Test.java trunk/src/dl-learner/org/dllearner/kb/sparql/Tupel.java trunk/src/dl-learner/org/dllearner/kb/sparql/TypedSparqlQuery.java Modified: trunk/src/dl-learner/org/dllearner/kb/SparqlEndpointRestructured.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/SparqlEndpointRestructured.java 2007-12-02 20:52:38 UTC (rev 309) +++ trunk/src/dl-learner/org/dllearner/kb/SparqlEndpointRestructured.java 2007-12-03 14:45:11 UTC (rev 310) @@ -43,6 +43,7 @@ import org.dllearner.core.config.StringSetConfigOption; import org.dllearner.core.dl.KB; import org.dllearner.kb.sparql.Manager; +import org.dllearner.kb.sparql.Manipulator; import org.dllearner.kb.sparql.PredefinedEndpoint; import org.dllearner.kb.sparql.PredefinedFilter; import org.dllearner.kb.sparql.SparqlQueryType; @@ -52,94 +53,108 @@ import org.dllearner.reasoning.JenaOWLDIGConverter; /** - * Represents a SPARQL Endpoint. - * TODO: Is it necessary to create a class DBpediaSparqlEndpoint? + * Represents a SPARQL Endpoint. TODO: Is it necessary to create a class + * DBpediaSparqlEndpoint? * * @author Jens Lehmann * @author Sebastian Knappe */ public class SparqlEndpointRestructured extends KnowledgeSource { - - //ConfigOptions - private URL url; + + // ConfigOptions + private URL url; String host; private Set<String> instances; private URL dumpFile; private int numberOfRecursions; - private int predefinedFilter=0; - private int predefinedEndpoint=0; + private int predefinedFilter = 0; + private int predefinedEndpoint = 0; private Set<String> predList; private Set<String> objList; private Set<String> classList; private String format; private boolean dumpToFile; - private boolean useLits=false; - private boolean getAllBackground=false; - + private boolean useLits = false; + private boolean getAllBackground = false; + + private boolean learnDomain = false; + private String role; + private String blankNodeIdentifier = "bnode"; + /** - * Holds the results of the calculateSubjects method + * Holds the results of the calculateSubjects method */ private String[] subjects; - + /** - * Holds the results of the calculateTriples method + * Holds the results of the calculateTriples method */ private String[] triples; - + /** - * Holds the results of the calculateConceptSubjects method + * Holds the results of the calculateConceptSubjects method */ private String[] conceptSubjects; - + /** * if a method is running this becomes true */ - private boolean subjectThreadRunning=false; - - private boolean triplesThreadRunning=false; - - private boolean conceptThreadRunning=false; - + private boolean subjectThreadRunning = false; + + private boolean triplesThreadRunning = false; + + private boolean conceptThreadRunning = false; + /** * the Thread that is running a method */ private Thread subjectThread; - + private Thread triplesThread; - + private Thread conceptThread; - - //received ontology as array, used if format=Array(an element of the - //array consists of the subject, predicate and object separated by '<' + + // received ontology as array, used if format=Array(an element of the + // array consists of the subject, predicate and object separated by '<' private String[] ontArray; - - //received ontology as KB, the internal format + + // received ontology as KB, the internal format private KB kb; - + public static String getName() { return "SPARQL Endpoint Restructured"; } - + /** * sets the ConfigOptions for this KnowledgeSource + * * @return */ public static Collection<ConfigOption<?>> createConfigOptions() { - Collection<ConfigOption<?>> options = new LinkedList<ConfigOption<?>>(); + Collection<ConfigOption<?>> options = new LinkedList<ConfigOption<?>>(); options.add(new StringConfigOption("url", "URL of SPARQL Endpoint")); options.add(new StringConfigOption("host", "host of SPARQL Endpoint")); - options.add(new StringSetConfigOption("instances","relevant instances e.g. positive and negative examples in a learning problem")); - options.add(new IntegerConfigOption("numberOfRecursions","number of Recursions, the Sparql-Endpoint is asked")); - options.add(new IntegerConfigOption("predefinedFilter","the mode of the SPARQL Filter")); - options.add(new IntegerConfigOption("predefinedEndpoint","the mode of the SPARQL Filter")); - - options.add(new StringSetConfigOption("predList","a predicate list")); - options.add(new StringSetConfigOption("objList","an object list")); - options.add(new StringSetConfigOption("classList","a class list")); + options.add(new StringSetConfigOption("instances", + "relevant instances e.g. positive and negative examples in a learning problem")); + options.add(new IntegerConfigOption("numberOfRecursions", + "number of Recursions, the Sparql-Endpoint is asked")); + options.add(new IntegerConfigOption("predefinedFilter", "the mode of the SPARQL Filter")); + options.add(new IntegerConfigOption("predefinedEndpoint", "the mode of the SPARQL Filter")); + + options.add(new StringSetConfigOption("predList", "a predicate list")); + options.add(new StringSetConfigOption("objList", "an object list")); + options.add(new StringSetConfigOption("classList", "a class list")); options.add(new StringConfigOption("format", "N-TRIPLES or KB format")); - options.add(new BooleanConfigOption("dumpToFile", "wether Ontology from DBPedia is written to a file or not")); - options.add(new BooleanConfigOption("useLits","use Literals in SPARQL query")); - options.add(new BooleanConfigOption("getAllBackground","get")); + options.add(new BooleanConfigOption("dumpToFile", + "wether Ontology from DBPedia is written to a file or not")); + options.add(new BooleanConfigOption("useLits", "use Literals in SPARQL query")); + options.add(new BooleanConfigOption("getAllBackground", "get")); + + options.add(new BooleanConfigOption("learnDomain", "learns the Domain for a Role")); + options.add(new StringConfigOption("role", "role to learn Domain from")); + options.add(new StringConfigOption("blankNodeIdentifier", + "used to identify blanknodes in Tripels")); + return options; } @@ -147,7 +162,7 @@ * @see org.dllearner.core.Component#applyConfigEntry(org.dllearner.core.ConfigEntry) */ @Override - @SuppressWarnings({"unchecked"}) + @SuppressWarnings( { "unchecked" }) public <T> void applyConfigEntry(ConfigEntry<T> entry) throws InvalidConfigOptionValueException { String option = entry.getOptionName(); if (option.equals("url")) { @@ -155,103 +170,124 @@ try { url = new URL(s); } catch (MalformedURLException e) { - throw new InvalidConfigOptionValueException(entry.getOption(), entry.getValue(),"malformed URL " + s); + throw new InvalidConfigOptionValueException(entry.getOption(), entry.getValue(), + "malformed URL " + s); } - } else if(option.equals("host")) { + } else if (option.equals("host")) { host = (String) entry.getValue(); - } else if(option.equals("instances")) { + } else if (option.equals("instances")) { instances = (Set<String>) entry.getValue(); - } else if(option.equals("numberOfRecursions")){ - numberOfRecursions=(Integer)entry.getValue(); - } else if(option.equals("predList")) { + } else if (option.equals("numberOfRecursions")) { + numberOfRecursions = (Integer) entry.getValue(); + } else if (option.equals("predList")) { predList = (Set<String>) entry.getValue(); - } else if(option.equals("objList")) { + } else if (option.equals("objList")) { objList = (Set<String>) entry.getValue(); - } else if(option.equals("classList")) { + } else if (option.equals("classList")) { classList = (Set<String>) entry.getValue(); - } else if(option.equals("predefinedEndpoint")){ - predefinedEndpoint=(Integer)entry.getValue(); - } else if(option.equals("predefinedFilter")){ - predefinedFilter=(Integer)entry.getValue(); - } else if(option.equals("format")){ - format=(String)entry.getValue(); - } else if(option.equals("dumpToFile")){ - dumpToFile=(Boolean)entry.getValue(); - } else if(option.equals("useLits")){ - useLits=(Boolean)entry.getValue(); - } else if(option.equals("getAllBackground")){ - getAllBackground=(Boolean)entry.getValue(); + } else if (option.equals("predefinedEndpoint")) { + predefinedEndpoint = (Integer) entry.getValue(); + } else if (option.equals("predefinedFilter")) { + predefinedFilter = (Integer) entry.getValue(); + } else if (option.equals("format")) { + format = (String) entry.getValue(); + } else if (option.equals("dumpToFile")) { + dumpToFile = (Boolean) entry.getValue(); + } else if (option.equals("useLits")) { + useLits = (Boolean) entry.getValue(); + } else if (option.equals("getAllBackground")) { + getAllBackground = (Boolean) entry.getValue(); + } else if (option.equals("learnDomain")) { + learnDomain = (Boolean) entry.getValue(); + } else if (option.equals("role")) { + role = (String) entry.getValue(); + } else if (option.equals("blankNodeIdentifier")) { + blankNodeIdentifier = (String) entry.getValue(); } + } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.dllearner.core.Component#init() */ @Override public void init() { System.out.println("SparqlModul: Collecting Ontology"); - //SparqlOntologyCollector oc= - - - //new SparqlOntologyCollector(Datastructures.setToArray(instances), numberOfRecursions, filterMode, - //Datastructures.setToArray(predList),Datastructures.setToArray( objList),Datastructures.setToArray(classList),format,url,useLits); - Manager m=new Manager(); - SpecificSparqlEndpoint sse=null; - SparqlQueryType sqt=null; + // SparqlOntologyCollector oc= + // new SparqlOntologyCollector(Datastructures.setToArray(instances), + // numberOfRecursions, filterMode, + // Datastructures.setToArray(predList),Datastructures.setToArray( + // objList),Datastructures.setToArray(classList),format,url,useLits); + Manager m = new Manager(); + SpecificSparqlEndpoint sse = null; + SparqlQueryType sqt = null; + // get Options for Manipulator + Manipulator man = new Manipulator(blankNodeIdentifier); HashMap<String, String> parameters = new HashMap<String, String>(); parameters.put("default-graph-uri", "http://dbpedia.org"); parameters.put("format", "application/sparql-results.xml"); - - if(predefinedEndpoint>=1){ - sse=PredefinedEndpoint.getEndpoint(predefinedEndpoint); - + + // get Options for endpoints + if (predefinedEndpoint >= 1) { + sse = PredefinedEndpoint.getEndpoint(predefinedEndpoint); + } else { + sse = new SpecificSparqlEndpoint(url, host, parameters); } - else{ - SpecificSparqlEndpoint se=new SpecificSparqlEndpoint(url, host, parameters); - + + // get Options for Filters + if (predefinedFilter >= 1) { + sqt = PredefinedFilter.getFilter(predefinedFilter); + + } else { + sqt = new SparqlQueryType("forbid", objList, predList, useLits + ""); } - - if(predefinedFilter>=1){ - sqt=PredefinedFilter.getFilter(predefinedFilter); - + // give everything to the manager + m.useConfiguration(sqt, sse, man, numberOfRecursions, getAllBackground); + try { + String ont = ""; + // used to learn a domain of a role + if (learnDomain) { + instances = m.getDomainInstancesForRole(role); + // ad the role to the filter(a solution is always EXISTS + // role.TOP) + m.addPredicateFilter(role); + System.out.println(instances); } - else{ - sqt=new SparqlQueryType("forbid", objList,predList,useLits+""); - - - - } - m.useConfiguration(sqt, sse,numberOfRecursions,getAllBackground); - try - { - String ont=m.extract(instances); - - if (dumpToFile){ - String filename=System.currentTimeMillis()+".nt"; - String basedir="cache"+File.separator; - try{ - if(!new File(basedir).exists()) + // the actual extraction is started here + ont = m.extract(instances); + + if (dumpToFile) { + String filename = System.currentTimeMillis() + ".nt"; + String basedir = "cache" + File.separator; + try { + if (!new File(basedir).exists()) new File(basedir).mkdir(); - - FileWriter fw=new FileWriter(new File(basedir+filename),true); + + FileWriter fw = new FileWriter(new File(basedir + filename), true); fw.write(ont); fw.flush(); fw.close(); - - dumpFile=(new File(basedir+filename)).toURI().toURL(); - }catch (Exception e) {e.printStackTrace();} + + dumpFile = (new File(basedir + filename)).toURI().toURL(); + } catch (Exception e) { + e.printStackTrace(); + } } if (format.equals("KB")) { - try{ - kb=KBParser.parseKBFile(new StringReader(ont)); - } catch(Exception e) {e.printStackTrace();} + try { + kb = KBParser.parseKBFile(new StringReader(ont)); + } catch (Exception e) { + e.printStackTrace(); + } } - }catch(Exception e) { + } catch (Exception e) { e.printStackTrace(); } System.out.println("SparqlModul: ****Finished"); } - + /* * (non-Javadoc) * @@ -259,97 +295,94 @@ */ @Override public String toDIG(URI kbURI) { - if (format.equals("N-TRIPLES")) return JenaOWLDIGConverter.getTellsString(dumpFile, OntologyFormat.N_TRIPLES, kbURI); - else return DIGConverter.getDIGString(kb, kbURI).toString(); + if (format.equals("N-TRIPLES")) + return JenaOWLDIGConverter.getTellsString(dumpFile, OntologyFormat.N_TRIPLES, kbURI); + else + return DIGConverter.getDIGString(kb, kbURI).toString(); } - /* (non-Javadoc) - * @see org.dllearner.core.KnowledgeSource#export(java.io.File, org.dllearner.core.OntologyFormat) + /* + * (non-Javadoc) + * + * @see org.dllearner.core.KnowledgeSource#export(java.io.File, + * org.dllearner.core.OntologyFormat) */ @Override public void export(File file, OntologyFormat format) throws OntologyFormatUnsupportedException { - // currently no export functions implemented, so we just throw an exception + // currently no export functions implemented, so we just throw an + // exception throw new OntologyFormatUnsupportedException("export", format); } - + public URL getURL() { return url; } - + public String[] getOntArray() { return ontArray; } - - public void calculateSubjects(String label,int limit) - { + + public void calculateSubjects(String label, int limit) { System.out.println("SparqlModul: Collecting Subjects"); - SparqlOntologyCollector oc=new SparqlOntologyCollector(url); - try{ - subjects=oc.getSubjectsFromLabel(label,limit); - }catch (IOException e){ - subjects=new String[1]; - subjects[0]="[Error]Sparql Endpoint could not be reached."; + SparqlOntologyCollector oc = new SparqlOntologyCollector(url); + try { + subjects = oc.getSubjectsFromLabel(label, limit); + } catch (IOException e) { + subjects = new String[1]; + subjects[0] = "[Error]Sparql Endpoint could not be reached."; } System.out.println("SparqlModul: ****Finished"); } - + public void calculateTriples(String subject) { System.out.println("SparqlModul: Collecting Triples"); - SparqlOntologyCollector oc=new SparqlOntologyCollector(url); - try{ - triples=oc.collectTriples(subject); - }catch (IOException e){ - triples=new String[1]; - triples[0]="[Error]Sparql Endpoint could not be reached."; + SparqlOntologyCollector oc = new SparqlOntologyCollector(url); + try { + triples = oc.collectTriples(subject); + } catch (IOException e) { + triples = new String[1]; + triples[0] = "[Error]Sparql Endpoint could not be reached."; } System.out.println("SparqlModul: ****Finished"); } - - public void calculateConceptSubjects(String concept) - { + + public void calculateConceptSubjects(String concept) { System.out.println("SparqlModul: Collecting Subjects"); - SparqlOntologyCollector oc=new SparqlOntologyCollector(url); - try{ - conceptSubjects=oc.getSubjectsFromConcept(concept); - }catch (IOException e){ - conceptSubjects=new String[1]; - conceptSubjects[0]="[Error]Sparql Endpoint could not be reached."; + SparqlOntologyCollector oc = new SparqlOntologyCollector(url); + try { + conceptSubjects = oc.getSubjectsFromConcept(concept); + } catch (IOException e) { + conceptSubjects = new String[1]; + conceptSubjects[0] = "[Error]Sparql Endpoint could not be reached."; } System.out.println("SparqlModul: ****Finished"); } - - public boolean subjectThreadIsRunning() - { + + public boolean subjectThreadIsRunning() { return subjectThreadRunning; } - - public void setSubjectThreadRunning(boolean bool) - { - subjectThreadRunning=bool; + + public void setSubjectThreadRunning(boolean bool) { + subjectThreadRunning = bool; } - - public boolean triplesThreadIsRunning() - { + + public boolean triplesThreadIsRunning() { return triplesThreadRunning; } - - public void setTriplesThreadRunning(boolean bool) - { - triplesThreadRunning=bool; + + public void setTriplesThreadRunning(boolean bool) { + triplesThreadRunning = bool; } - - public boolean conceptThreadIsRunning() - { + + public boolean conceptThreadIsRunning() { return conceptThreadRunning; } - - public void setConceptThreadRunning(boolean bool) - { - conceptThreadRunning=bool; + + public void setConceptThreadRunning(boolean bool) { + conceptThreadRunning = bool; } - - public String[] getSubjects() - { + + public String[] getSubjects() { return subjects; } @@ -377,13 +410,11 @@ this.conceptThread = conceptThread; } - public String[] getTriples() - { + public String[] getTriples() { return triples; } - - public String[] getConceptSubjects() - { + + public String[] getConceptSubjects() { return conceptSubjects; } } Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/Cache.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/Cache.java 2007-12-02 20:52:38 UTC (rev 309) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/Cache.java 2007-12-03 14:45:11 UTC (rev 310) @@ -1,3 +1,22 @@ +/** + * Copyright (C) 2007, Sebastian Hellmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ package org.dllearner.kb.sparql; import java.io.File; @@ -7,19 +26,20 @@ import java.io.ObjectOutputStream; import java.io.Serializable; import java.net.URLEncoder; +import java.util.HashMap; public class Cache implements Serializable { // Object can be the cache itself // or a cache object(one entry) + // it now uses a hashmap and can contain different queries at once final static long serialVersionUID = 104; transient String basedir = ""; transient String fileending = ".cache"; long timestamp; - String content = ""; long daysoffreshness = 15; long multiplier = 24 * 60 * 60 * 1000;// h m s ms - String sparqlquery = ""; + private HashMap<String, String> hm; // constructor for the cache itself public Cache(String path) { @@ -28,14 +48,15 @@ System.out.println(new File(path).mkdir()); ; } - } // constructor for single cache object(one entry) - public Cache(String c, String sparql) { - this.content = c; - this.sparqlquery = sparql; + public Cache(String sparql, String content) { + // this.content = c; + // this.sparqlquery = sparql; this.timestamp = System.currentTimeMillis(); + this.hm = new HashMap<String, String>(); + hm.put(sparql, content); } public String get(String key, String sparql) { @@ -49,20 +70,32 @@ if (!c.checkFreshness()) return null; // System.out.println("fresh"); - if (!c.validate(sparql)) + String xml = ""; + try { + xml = c.hm.get(sparql); + } catch (Exception e) { return null; + } + return xml; // System.out.println("valid"); - ret = c.content; + // ret = c.content; } catch (Exception e) { e.printStackTrace(); } return ret; }; - public void put(String key, String content, String sparql) { + public void put(String key, String sparql, String content) { // System.out.println("put into "+key); - Cache c = new Cache(content, sparql); - putIntoFile(makeFilename(key), c); + Cache c = readFromFile(makeFilename(key)); + if (c == null) { + c = new Cache(sparql, content); + putIntoFile(makeFilename(key), c); + } else { + c.hm.put(sparql, content); + putIntoFile(makeFilename(key), c); + } + } String makeFilename(String key) { @@ -83,14 +116,6 @@ return false; } - boolean validate(String sparql) { - if (this.sparqlquery.equals(sparql)) - // valid - return true; - else - return false; - } - public void checkFile(String Filename) { if (!new File(Filename).exists()) { try { Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/ClassNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/ClassNode.java 2007-12-02 20:52:38 UTC (rev 309) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/ClassNode.java 2007-12-03 14:45:11 UTC (rev 310) @@ -1,3 +1,22 @@ +/** + * Copyright (C) 2007, Sebastian Hellmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ package org.dllearner.kb.sparql; import java.net.URI; @@ -6,6 +25,7 @@ import java.util.Set; import java.util.Vector; +// is a node in the graph that is a class public class ClassNode extends Node { Set<PropertyNode> properties = new HashSet<PropertyNode>(); @@ -29,6 +49,17 @@ ClassNode tmp = new ClassNode(new URI(t.b)); properties.add(new PropertyNode(new URI(m.subclass), this, tmp)); Nodes.add(tmp); + } else { + ClassNode tmp = new ClassNode(new URI(t.b)); + properties.add(new PropertyNode(new URI(t.a), this, tmp)); + // System.out.println(m.blankNodeIdentifier); + // System.out.println("XXXXX"+t.b); + if (t.b.startsWith(m.blankNodeIdentifier)) { + tmp.expand(tsq, m); + System.out.println(m.blankNodeIdentifier); + System.out.println("XXXXX" + t.b); + } + // Nodes.add(tmp); } } catch (Exception e) { System.out.println(t); @@ -40,6 +71,12 @@ } @Override + public Vector<Node> expandProperties(TypedSparqlQuery tsq, Manipulator m) { + // TODO return type doesn't make sense + return new Vector<Node>(); + } + + @Override public Set<String> toNTriple() { Set<String> s = new HashSet<String>(); s.add("<" + this.uri + "><" + "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" + "><" Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/Configuration.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/Configuration.java 2007-12-02 20:52:38 UTC (rev 309) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/Configuration.java 2007-12-03 14:45:11 UTC (rev 310) @@ -1,227 +1,71 @@ +/** + * Copyright (C) 2007, Sebastian Hellmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ package org.dllearner.kb.sparql; -import java.io.File; -import java.net.URI; -import java.net.URL; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; - -import org.semanticweb.owl.apibinding.OWLManager; -import org.semanticweb.owl.model.OWLConstant; -import org.semanticweb.owl.model.OWLDataPropertyExpression; -import org.semanticweb.owl.model.OWLIndividual; -import org.semanticweb.owl.model.OWLObjectPropertyExpression; -import org.semanticweb.owl.model.OWLOntology; -import org.semanticweb.owl.model.OWLOntologyManager; - +//stores all configuration settings public class Configuration { - private SpecificSparqlEndpoint SparqlEndpoint; - private SparqlQueryType SparqlQueryType; - private Manipulator Manipulator; + private SpecificSparqlEndpoint specificSparqlEndpoint; + private SparqlQueryType sparqlQueryType; + private Manipulator manipulator; private int recursiondepth = 2; private boolean getAllBackground = true; - + private Configuration() { } - - public Configuration(SpecificSparqlEndpoint SparqlEndpoint, - SparqlQueryType SparqlQueryType, int recursiondepth, + public Configuration(SpecificSparqlEndpoint specificSparqlEndpoint, + SparqlQueryType sparqlQueryType, Manipulator manipulator, int recursiondepth, boolean getAllBackground) { - this.SparqlEndpoint = SparqlEndpoint; - this.SparqlQueryType = SparqlQueryType; - this.Manipulator=new Manipulator(); + this.specificSparqlEndpoint = specificSparqlEndpoint; + this.sparqlQueryType = sparqlQueryType; + this.manipulator = manipulator; this.recursiondepth = recursiondepth; this.getAllBackground = getAllBackground; - } - public static Configuration getConfiguration(URI uri) { - // public static String getTellsString(URL file, URI kbURI){//throws - // OWLOntologyCreationException{ - Configuration ret = new Configuration(); - try { - String file = "config/config.owl"; + public Configuration changeQueryType(SparqlQueryType sqt) { + // TODO must clone here + return new Configuration(this.specificSparqlEndpoint, sqt, this.manipulator, + this.recursiondepth, this.getAllBackground); - File f = new File(file); - String fileURL = "file:///" + f.getAbsolutePath(); - URL u = new URL(fileURL); - /* Load an ontology from a physical URI */ - OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); - OWLOntology ontology = manager.loadOntologyFromPhysicalURI(u.toURI()); - // System.out.println( ontology.containsIndividualReference(uri)); - // OWLIndividualImpl ind=new OWLIndividualImpl(); - // System.out.println(ontology.getReferencedIndividuals()); - Set<OWLIndividual> s = ontology.getReferencedIndividuals(); - // System.out.println(ontology.getReferencedClasses()); - // Set<OWLIndividualAxiom> s= ontology.getIndividualAxioms(); - Iterator<OWLIndividual> it = s.iterator(); - while (it.hasNext()) { - OWLIndividual tmp = (OWLIndividual) it.next(); - // tmp.getURI() - if (tmp.getURI().equals(uri)) { - OWLIndividual[] arr = getIndividualsForProperty("hasSparqlEndpoint", tmp - .getObjectPropertyValues(ontology)); - OWLIndividual sEndpoint = arr[0]; - ret.SparqlEndpoint = makeEndpoint(sEndpoint, ontology); - arr = getIndividualsForProperty("hasTypedQuery", tmp - .getObjectPropertyValues(ontology)); - OWLIndividual typedQuery = arr[0]; - ret.SparqlQueryType = makeSparqlQueryType(typedQuery, ontology); - - } - // {hasSparqlEndpoint=[dbpediaEndpoint]} - } - - ret.Manipulator = makeManipulator(); - } catch (Exception e) { - e.printStackTrace(); - } - - return ret; } - public static OWLIndividual[] getIndividualsForProperty(String propertyname, - Map<OWLObjectPropertyExpression, Set<OWLIndividual>> m) { - Set<OWLObjectPropertyExpression> s = m.keySet(); - - Iterator<OWLObjectPropertyExpression> it = s.iterator(); - while (it.hasNext()) { - OWLObjectPropertyExpression tmp = (OWLObjectPropertyExpression) it.next(); - // System.out.println(tmp); - // System.out.println(propertyname); - if (tmp.toString().equals(propertyname)) { - Object[] arr = ((Set<OWLIndividual>) m.get(tmp)).toArray(); - OWLIndividual[] o = new OWLIndividual[arr.length]; - for (int i = 0; i < o.length; i++) { - o[i] = (OWLIndividual) arr[i]; - } - - return o; - } - } - return null; - - } - - public static String getFirstValueForDataProperty(String propertyname, - Map<OWLDataPropertyExpression, Set<OWLConstant>> m) { - return getValuesForDataProperty(propertyname, m)[0]; - } - - public static String[] getValuesForDataProperty(String propertyname, - Map<OWLDataPropertyExpression, Set<OWLConstant>> m) { - Set<OWLDataPropertyExpression> s = m.keySet(); - - Iterator<OWLDataPropertyExpression> it = s.iterator(); - while (it.hasNext()) { - OWLDataPropertyExpression tmp = (OWLDataPropertyExpression) it.next(); - if (tmp.toString().equals(propertyname)) { - Object[] arr = ((Set<OWLConstant>) m.get(tmp)).toArray(); - String[] str = new String[arr.length]; - for (int i = 0; i < str.length; i++) { - str[i] = ((OWLConstant) arr[i]).getLiteral(); - } - return str; - } - } - return null; - - } - - public static SpecificSparqlEndpoint makeEndpoint(OWLIndividual sEndpoint, OWLOntology o) { - String host = getFirstValueForDataProperty("hasHost", sEndpoint.getDataPropertyValues(o)); - String port = getFirstValueForDataProperty("hasPort", sEndpoint.getDataPropertyValues(o)); - String hasAfterGET = getFirstValueForDataProperty("hasAfterGET", sEndpoint - .getDataPropertyValues(o)); - String hasQueryParameter = getFirstValueForDataProperty("hasQueryParameter", sEndpoint - .getDataPropertyValues(o)); - OWLIndividual[] para = getIndividualsForProperty("hasGETParameter", sEndpoint - .getObjectPropertyValues(o)); - // System.out.println("test"); - HashMap<String, String> parameters = new HashMap<String, String>(); - if (para == null) - return null;//new SpecificSparqlEndpoint(host, port, hasAfterGET, hasQueryParameter, parameters); - for (OWLIndividual p : para) { - // System.out.println("test2"); - String a1 = getFirstValueForDataProperty("hasParameterName", p.getDataPropertyValues(o)); - String a2 = getFirstValueForDataProperty("hasParameterContent", p - .getDataPropertyValues(o)); - parameters.put(a1, a2); - } - // System.out.println("test2"); - // System.out.println(host+port+ hasAfterGET+ hasQueryParameter+ - // parameters); - return null;//new SpecificSparqlEndpoint(host, port, hasAfterGET, hasQueryParameter, parameters); - - } - - public static SparqlQueryType makeSparqlQueryType(OWLIndividual typedQuery, OWLOntology o) { - String useLiterals = getFirstValueForDataProperty("usesLiterals", typedQuery - .getDataPropertyValues(o)); - String hasMode = getFirstValueForDataProperty("hasMode", typedQuery - .getDataPropertyValues(o)); - // String - // hasAfterGET=getValuesForDataProperty("hasAfterGET",sEndpoint.getDataPropertyValues(o)); - // String - // hasQueryParameter=getValuesForDataProperty("hasQueryParameter",sEndpoint.getDataPropertyValues(o)); - OWLIndividual[] objFilter = getIndividualsForProperty("hasObjectFilterSet", typedQuery - .getObjectPropertyValues(o)); - OWLIndividual[] predFilter = getIndividualsForProperty("hasPredicateFilterSet", typedQuery - .getObjectPropertyValues(o)); - - Set<String> objectFilter = new HashSet<String>(); - Set<String> predicateFilter = new HashSet<String>(); - - for (OWLIndividual of : objFilter) { - String[] tmp = getValuesForDataProperty("filtersURI", of.getDataPropertyValues(o)); - for (String s : tmp) { - objectFilter.add(s); - - } - } - - for (OWLIndividual pf : predFilter) { - String[] tmp = getValuesForDataProperty("filtersURI", pf.getDataPropertyValues(o)); - for (String s : tmp) { - predicateFilter.add(s); - - } - } - // System.out.println(predicateFilter); - // System.out.println(hasMode+objectFilter+predicateFilter+useLiterals); - return new SparqlQueryType(hasMode, objectFilter, predicateFilter, useLiterals); - - } - - public static Manipulator makeManipulator() { - return new Manipulator(); - } - public Manipulator getManipulator() { - return this.Manipulator; + return this.manipulator; } public SpecificSparqlEndpoint getSparqlEndpoint() { - return SparqlEndpoint; + return specificSparqlEndpoint; } public SparqlQueryType getSparqlQueryType() { - return SparqlQueryType; + return sparqlQueryType; } - public boolean isGetAllBackground() { - return getAllBackground; + return getAllBackground; } - public int getRecursiondepth() { - return recursiondepth; + return recursiondepth; } } Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/ExtractionAlgorithm.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/ExtractionAlgorithm.java 2007-12-02 20:52:38 UTC (rev 309) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/ExtractionAlgorithm.java 2007-12-03 14:45:11 UTC (rev 310) @@ -1,3 +1,22 @@ +/** + * Copyright (C) 2007, Sebastian Hellmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ package org.dllearner.kb.sparql; import java.net.URI; @@ -3,4 +22,5 @@ import java.util.Vector; +// this class is used to extract the information recursively public class ExtractionAlgorithm { @@ -13,8 +33,8 @@ public ExtractionAlgorithm(Configuration Configuration) { this.configuration = Configuration; this.manipulator = Configuration.getManipulator(); - this.recursionDepth=Configuration.getRecursiondepth(); - this.getAllBackground=Configuration.isGetAllBackground(); + this.recursionDepth = Configuration.getRecursiondepth(); + this.getAllBackground = Configuration.isGetAllBackground(); } @@ -43,13 +63,14 @@ while (v.size() > 0) { Node tmpNode = v.remove(0); System.out.println("Expanding " + tmpNode); - //System.out.println(this.Manipulator); + // System.out.println(this.Manipulator); Vector<Node> tmpVec = tmpNode.expand(tsp, manipulator); tmp.addAll(tmpVec); } v = tmp; - System.out.println("Recursion counter: " + x + " with " + v.size()+" Nodes remaining"); + System.out + .println("Recursion counter: " + x + " with " + v.size() + " Nodes remaining"); } if (this.getAllBackground) { Vector<Node> classes = new Vector<Node>(); @@ -59,9 +80,9 @@ } } while (classes.size() > 0) { - System.out.println("Remaining classes: "+classes.size()); - Node next=classes.remove(0); - System.out.println("Expanding: "+next); + System.out.println("Remaining classes: " + classes.size()); + Node next = classes.remove(0); + System.out.println("Expanding: " + next); classes.addAll(next.expand(tsp, manipulator)); } Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/InstanceNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/InstanceNode.java 2007-12-02 20:52:38 UTC (rev 309) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/InstanceNode.java 2007-12-03 14:45:11 UTC (rev 310) @@ -1,3 +1,22 @@ +/** + * Copyright (C) 2007, Sebastian Hellmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ package org.dllearner.kb.sparql; import java.net.URI; @@ -6,6 +25,7 @@ import java.util.Set; import java.util.Vector; +// a node in the graph that is an instance public class InstanceNode extends Node { Set<ClassNode> classes = new HashSet<ClassNode>(); @@ -24,7 +44,7 @@ Set<Tupel> s = tsq.query(uri); // Manipulation m.check(s, this); - //System.out.println("fffffff"+m); + // System.out.println("fffffff"+m); Vector<Node> Nodes = new Vector<Node>(); Iterator<Tupel> it = s.iterator(); @@ -53,6 +73,14 @@ } @Override + public Vector<Node> expandProperties(TypedSparqlQuery tsq, Manipulator m) { + for (PropertyNode one : properties) { + one.expandProperties(tsq, m); + } + return new Vector<Node>(); + } + + @Override public Set<String> toNTriple() { Set<String> s = new HashSet<String>(); s.add("<" + uri + "><" + "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" + "><" Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/Manager.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/Manager.java 2007-12-02 20:52:38 UTC (rev 309) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/Manager.java 2007-12-03 14:45:11 UTC (rev 310) @@ -1,3 +1,22 @@ +/** + * Copyright (C) 2007, Sebastian Hellmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ package org.dllearner.kb.sparql; import java.net.URI; @@ -4,21 +23,53 @@ import java.util.HashSet; import java.util.Set; +// an object of this class encapsulates everything public class Manager { private Configuration configuration; private TypedSparqlQuery typedSparqlQuery; private ExtractionAlgorithm extractionAlgorithm; - + public void useConfiguration(SparqlQueryType SparqlQueryType, + SpecificSparqlEndpoint SparqlEndpoint, Manipulator manipulator, int recursiondepth, + boolean getAllBackground) { - public void useConfiguration(SparqlQueryType SparqlQueryType, SpecificSparqlEndpoint SparqlEndpoint, int recursiondepth,boolean getAllBackground) { - - this.configuration = new Configuration(SparqlEndpoint, SparqlQueryType,recursiondepth,getAllBackground); + this.configuration = new Configuration(SparqlEndpoint, SparqlQueryType, manipulator, + recursiondepth, getAllBackground); this.typedSparqlQuery = new TypedSparqlQuery(configuration); this.extractionAlgorithm = new ExtractionAlgorithm(configuration); } + public Set<String> getDomainInstancesForRole(String role) { + URI u = null; + try { + u = new URI(role); + } catch (Exception e) { + e.printStackTrace(); + } + Set<Tupel> t = this.typedSparqlQuery.getTupelsForRole(u); + Set<String> ret = new HashSet<String>(); + for (Tupel one : t) { + ret.add(one.a); + } + return ret; + } + + public Set<String> getRangeInstancesForRole(String role) { + URI u = null; + try { + u = new URI(role); + } catch (Exception e) { + e.printStackTrace(); + } + Set<Tupel> t = this.typedSparqlQuery.getTupelsForRole(u); + Set<String> ret = new HashSet<String>(); + for (Tupel one : t) { + ret.add(one.b); + } + return ret; + } + public String extract(URI uri) { // this.TypedSparqlQuery.query(uri); // System.out.println(ExtractionAlgorithm.getFirstNode(uri)); @@ -54,4 +105,9 @@ return nt; } + public void addPredicateFilter(String str) { + this.configuration.getSparqlQueryType().addPredicateFilter(str); + + } + } \ No newline at end of file Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/Manipulator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/Manipulator.java 2007-12-02 20:52:38 UTC (rev 309) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/Manipulator.java 2007-12-03 14:45:11 UTC (rev 310) @@ -1,3 +1,22 @@ +/** + * Copyright (C) 2007, Sebastian Hellmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ package org.dllearner.kb.sparql; import java.util.HashSet; @@ -4,9 +23,11 @@ import java.util.Iterator; import java.util.Set; +// used to manipulate retrieved tupels, identify blanknodes, etc. public class Manipulator { public String subclass = "http://www.w3.org/2000/01/rdf-schema#subClassOf"; public String type = "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"; + public String blankNodeIdentifier = "bnode"; String objectProperty = "http://www.w3.org/2002/07/owl#ObjectProperty"; String classns = "http://www.w3.org/2002/07/owl#Class"; @@ -16,13 +37,10 @@ String[] defaultClasses = { "http://dbpedia.org/class/yago", "http://dbpedia.org/resource/Category:", "http://dbpedia.org/resource/Template:", - "http://www.w3.org/2004/02/skos/core", "http://dbpedia.org/class/" }; // TODO - // FEHLER - // hier - // fehlt - // yago + "http://www.w3.org/2004/02/skos/core", "http://dbpedia.org/class/" }; - public Manipulator() { + public Manipulator(String blankNodeIdentifier) { + this.blankNodeIdentifier = blankNodeIdentifier; Set<String> classproperties = new HashSet<String>(); classproperties.add(subclass); @@ -33,21 +51,22 @@ Iterator<Tupel> it = s.iterator(); while (it.hasNext()) { Tupel t = (Tupel) it.next(); + // System.out.println(t); // all classes with owl:type class if (t.a.equals(type) && t.b.equals(classns) && node instanceof ClassNode) { toRemove.add(t); } - + // all with type class if (t.b.equals(classns) && node instanceof ClassNode) { toRemove.add(t); } - + // all instances with owl:type thing if (t.a.equals(type) && t.b.equals(thing) && node instanceof InstanceNode) { toRemove.add(t); } - + } s.removeAll(toRemove); Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/Node.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/Node.java 2007-12-02 20:52:38 UTC (rev 309) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/Node.java 2007-12-03 14:45:11 UTC (rev 310) @@ -1,3 +1,22 @@ +/** + * Copyright (C) 2007, Sebastian Hellmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ package org.dllearner.kb.sparql; import java.net.URI; @@ -4,29 +23,20 @@ import java.util.Set; import java.util.Vector; +// abstract class public abstract class Node { URI uri; protected String type; protected boolean expanded = false; - // Hashtable<String,Node> classes=new Hashtable<String,Node>(); - // Hashtable<String,Node> instances=new Hashtable<String,Node>();; - // Hashtable<String,Node> datatype=new Hashtable<String,Node>();; - public Node(URI u) { this.uri = u; - } - /* - * public void checkConsistency(){ if (type.equals("class") && ( - * instances.size()>0 || datatype.size()>0)){ System.out.println("Warning, - * inconsistent:"+this.toString()); } - * } - */ - public abstract Vector<Node> expand(TypedSparqlQuery tsq, Manipulator m); + public abstract Vector<Node> expandProperties(TypedSparqlQuery tsq, Manipulator m); + public abstract Set<String> toNTriple(); @Override Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/PredefinedEndpoint.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/PredefinedEndpoint.java 2007-12-02 20:52:38 UTC (rev 309) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/PredefinedEndpoint.java 2007-12-03 14:45:11 UTC (rev 310) @@ -1,3 +1,22 @@ +/** + * Copyright (C) 2007, Sebastian Hellmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ package org.dllearner.kb.sparql; import java.net.URL; @@ -3,26 +22,41 @@ import java.util.HashMap; +// holds some predefined endpoints public class PredefinedEndpoint { - public static SpecificSparqlEndpoint getEndpoint(int i) { + public static SpecificSparqlEndpoint getEndpoint(int i) { - switch (i) { - case 1: - return dbpediaEndpoint(); + switch (i) { + case 1: + return dbpediaEndpoint(); + case 2: + return localJoseki(); + } + return null; + } + public static SpecificSparqlEndpoint dbpediaEndpoint() { + URL u = null; + HashMap<String, String> m = new HashMap<String, String>(); + m.put("default-graph-uri", "http://dbpedia.org"); + m.put("format", "application/sparql-results.xml"); + try { + u = new URL("http://dbpedia.openlinksw.com:8890/sparql"); + } catch (Exception e) { + e.printStackTrace(); + } + return new SpecificSparqlEndpoint(u, "dbpedia.openlinksw.com", m); } - return null; - } - - public static SpecificSparqlEndpoint dbpediaEndpoint(){ - URL u = null; - HashMap<String, String> m = new HashMap<String, String>(); - m.put("default-graph-uri", "http://dbpedia.org"); - m.put("format", "application/sparql-results.xml"); - try { - u = new URL("http://dbpedia.openlinksw.com:8890/sparql"); - } catch (Exception e) { - e.printStackTrace(); + + public static SpecificSparqlEndpoint localJoseki() { + URL u = null; + HashMap<String, String> m = new HashMap<String, String>(); + // m.put("default-graph-uri", "http://dbpedia.org"); + // m.put("format", "application/sparql-results.xml"); + try { + u = new URL("http://localhost:2020/books"); + } catch (Exception e) { + e.printStackTrace(); + } + return new SpecificSparqlEndpoint(u, "localost", m); } - return new SpecificSparqlEndpoint(u, "dbpedia.openlinksw.com", m); } -} Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/PredefinedFilter.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/PredefinedFilter.java 2007-12-02 20:52:38 UTC (rev 309) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/PredefinedFilter.java 2007-12-03 14:45:11 UTC (rev 310) @@ -1,3 +1,22 @@ +/** + * Copyright (C) 2007, Sebastian Hellmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ package org.dllearner.kb.sparql; import java.util.HashSet; @@ -4,14 +23,15 @@ import java.util.Set; public class PredefinedFilter { - + public static SparqlQueryType getFilter(int i) { switch (i) { case 1: return YagoFilter(); - + case 2: + return CategoriesOnly(); } return null; } @@ -22,6 +42,7 @@ pred.add("http://www.w3.org/2004/02/skos/core"); pred.add("http://www.w3.org/2002/07/owl#sameAs"); pred.add("http://xmlns.com/foaf/0.1/"); + pred.add("http://dbpedia.org/property/reference"); pred.add("http://dbpedia.org/property/website"); pred.add("http://dbpedia.org/property/wikipage"); @@ -39,4 +60,36 @@ return new SparqlQueryType("forbid", obj, pred, "false"); } + + public static SparqlQueryType CategoriesOnly(){ + Set<String> pred = new HashSet<String>(); + pred.add("http://www.w3.org/2004/02/skos/core"); + pred.add("http://www.w3.org/2002/07/owl#sameAs"); + pred.add("http://xmlns.com/foaf/0.1/"); + + pred.add("http://dbpedia.org/property/reference"); + pred.add("http://dbpedia.org/property/website"); + pred.add("http://dbpedia.org/property/wikipage"); + + Set<String> obj = new HashSet<String>(); + obj.add("http://dbpedia.org/resource/Category:Wikipedia_"); + obj.add("http://dbpedia.org/resource/Category:Articles_"); + obj.add("http://xmlns.com/foaf/0.1/"); + obj.add("http://upload.wikimedia.org/wikipedia/commons"); + obj.add("http://upload.wikimedia.org/wikipedia"); + + obj.add("http://www.geonames.org"); + obj.add("http://www.w3.org/2006/03/wn/wn20/instances/synset"); + obj.add("http://www4.wiwiss.fu-berlin.de/flickrwrappr"); + obj.add("http://www.w3.org/2004/02/skos/core"); + + obj.add("http://dbpedia.org/class/yago"); + obj.add("http://dbpedia.org/resource/Template"); + + + return new SparqlQueryType("forbid", obj, pred, "false"); + } + + + } Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/PropertyNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/PropertyNode.java 2007-12-02 20:52:38 UTC (rev 309) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/PropertyNode.java 2007-12-03 14:45:11 UTC (rev 310) @@ -1,3 +1,22 @@ +/** + * Copyright (C) 2007, Sebastian Hellmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ package org.dllearner.kb.sparql; import java.net.URI; @@ -47,6 +66,12 @@ } return Nodes; } + @Override + public Vector<Node> expandProperties(TypedSparqlQuery tsq, Manipulator m) { + b.expandProperties(tsq, m); + return this.expand(tsq, m); + } + public Node getB() { return b; Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryMaker.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryMaker.java 2007-12-02 20:52:38 UTC (rev 309) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryMaker.java 2007-12-03 14:45:11 UTC (rev 310) @@ -1,5 +1,25 @@ +/** + * Copyright (C) 2007, Sebastian Hellmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ package org.dllearner.kb.sparql; +// can assemble sparql queries public class SparqlQueryMaker { private SparqlQueryType sparqlQueryType; @@ -8,9 +28,27 @@ this.sparqlQueryType = SparqlQueryType; } - public String makeQueryUsingFilters(String subject) { + public String makeSubjectQueryUsingFilters(String subject) { String lineend = "\n"; + String Filter = internalFilterAssemblySubject(); + String ret = "SELECT * WHERE { " + lineend + "<" + subject + "> ?predicate ?object. " + + lineend + "FILTER( " + lineend + "(" + Filter + ").}"; + // System.out.println(ret); + return ret; + } + public String makeRoleQueryUsingFilters(String role) { + String lineend = "\n"; + String Filter = internalFilterAssemblyRole(); + String ret = "SELECT * WHERE { " + lineend + "?subject <" + role + "> ?object. " + lineend + + "FILTER( " + lineend + "(" + Filter + ").}"; + // System.out.println(ret); + + return ret; + } + + private String internalFilterAssemblySubject() { + String lineend = "\n"; String Filter = ""; if (!this.sparqlQueryType.isLiterals()) Filter += "!isLiteral(?object))"; @@ -20,18 +58,32 @@ for (String o : sparqlQueryType.getObjectfilterlist()) { Filter += lineend + filterObject(o); } + return Filter; + } - String ret = "SELECT * WHERE { " + lineend + "<" + subject + "> ?predicate ?object. " - + lineend + "FILTER( " + lineend + "(" + Filter + ").}"; - // System.out.println(ret); - return ret; + private String internalFilterAssemblyRole() { + String lineend = "\n"; + String Filter = ""; + if (!this.sparqlQueryType.isLiterals()) + Filter += "!isLiteral(?object))"; + for (String s : sparqlQueryType.getObjectfilterlist()) { + Filter += lineend + filterSubject(s); + } + for (String o : sparqlQueryType.getObjectfilterlist()) { + Filter += lineend + filterObject(o); + } + return Filter; } - public String filterObject(String ns) { - return "&&( !regex(str(?object), '" + ns + "') )"; + public String filterSubject(String ns) { + return "&&( !regex(str(?subject), '" + ns + "') )"; } public String filterPredicate(String ns) { return "&&( !regex(str(?predicate), '" + ns + "') )"; } + + public String filterObject(String ns) { + return "&&( !regex(str(?object), '" + ns + "') )"; + } } Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryType.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryType.java 2007-12-02 20:52:38 UTC (rev 309) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryType.java 2007-12-03 14:45:11 UTC (rev 310) @@ -1,3 +1,22 @@ +/** + * Copyright (C) 2007, Sebastian Hellmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ package org.dllearner.kb.sparql; import java.util.Set; @@ -2,4 +21,5 @@ +// is used to set the filter: configuration public class SparqlQueryType { - + // TODO make sets out of them private String mode = "forbid"; @@ -58,4 +78,15 @@ return predicatefilterlist; } + public void addPredicateFilter(String filter) { + String[] tmp = new String[predicatefilterlist.length + 1]; + int i = 0; + for (; i < predicatefilterlist.length; i++) { + tmp[i] = predicatefilterlist[i]; + + } + tmp[i] = filter; + + } + } Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SpecificSparqlEndpoint.java... [truncated message content] |
From: <ku...@us...> - 2007-12-02 20:52:42
|
Revision: 309 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=309&view=rev Author: kurzum Date: 2007-12-02 12:52:38 -0800 (Sun, 02 Dec 2007) Log Message: ----------- changed some Options see examples/dbpedia/reference.conf Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/kb/SparqlEndpointRestructured.java trunk/src/dl-learner/org/dllearner/kb/sparql/Manager.java Added Paths: ----------- trunk/examples/dbpedia/reference.conf trunk/src/dl-learner/org/dllearner/kb/sparql/PredefinedEndpoint.java trunk/src/dl-learner/org/dllearner/kb/sparql/PredefinedFilter.java Removed Paths: ------------- trunk/src/dl-learner/org/dllearner/kb/sparql/PredefinedConfigurations.java Added: trunk/examples/dbpedia/reference.conf =================================================================== --- trunk/examples/dbpedia/reference.conf (rev 0) +++ trunk/examples/dbpedia/reference.conf 2007-12-02 20:52:38 UTC (rev 309) @@ -0,0 +1,81 @@ +/** + * Father Example + * + * possible solution: + * male AND EXISTS hasChild.TOP + * + * Copyright (C) 2007, Jens Lehmann + */ + +/** settings **/ +// reasoner settings +reasoner = dig; +//digReasonerURL = "http://localhost:8081"; +//useRetrievalForClassification = true; +//refinement.useDIGMultiInstanceChecks = twoChecks; + +// algorithm settings +algorithm = refinement; +//refinement.horizontalExpansionFactor = 0.5; +//refinement.quiet = false; + +// search tree protocol +// refinement.writeSearchTree = false; +// refinement.searchTreeFile = "log/searchTree.txt"; + +// control output +cli.checkSatisfiability = true; +cli.showIndividuals = false; +cli.showConcepts = false; +cli.showRoles = true; +cli.showSubsumptionHierarchy = false; + +// SPARQL options +//necessary: +sparql2.numberOfRecursions = 2; +sparql2.getAllBackground=true; +sparql2.format = "N-TRIPLES"; +sparql2.dumpToFile = true; +sparql2.instances = {"http://dbpedia.org/resource/Angela_Merkel","http://dbpedia.org/resource/Gerhard_Schr%C3%B6der"}; + + +//predefined Endpoint overrides host and it doesn't matter what the string in import below looks like +// 0 means nothing +// 1 means dbpedia +sparql2.predefinedEndpoint=1; +//sparql2.host = "dbpedia.openlinksw.com"; + + + +//predefined filter overrides predList and ObjList +sparql2.predefinedFilter = 1; +//filtermode 1 and above uses a predefined setting +// 0 means nothing (manual configuration) +// 1 means only yago classes + +/* +This is left here. It is the yago predefined Filter +sparql2.predList = {"http://www.w3.org/2004/02/skos/core", + "http://www.w3.org/2002/07/owl#sameAs", + "http://xmlns.com/foaf/0.1/", + "http://dbpedia.org/property/reference", + "http://dbpedia.org/property/website", + "http://dbpedia.org/property/wikipage"}; +sparql2.objList = {"http://dbpedia.org/resource/Category:Wikipedia_" + ,"http://dbpedia.org/resource/Category:Articles_" + ,"http://xmlns.com/foaf/0.1/" + ,"http://upload.wikimedia.org/wikipedia/commons" + ,"http://upload.wikimedia.org/wikipedia" + ,"http://www.geonames.org" + ,"http://www.w3.org/2006/03/wn/wn20/instances/synset" + ,"http://www4.wiwiss.fu-berlin.de/flickrwrappr" + ,"http://www.w3.org/2004/02/skos/core"}; +*/ + + + +import("http://dbpedia.openlinksw.com:8890/sparql","SPARQL2"); + +/** examples **/ ++"http://dbpedia.org/resource/Angela_Merkel" +-"http://dbpedia.org/resource/Gerhard_Schr%C3%B6der" \ No newline at end of file Modified: trunk/src/dl-learner/org/dllearner/kb/SparqlEndpointRestructured.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/SparqlEndpointRestructured.java 2007-12-02 19:53:08 UTC (rev 308) +++ trunk/src/dl-learner/org/dllearner/kb/SparqlEndpointRestructured.java 2007-12-02 20:52:38 UTC (rev 309) @@ -43,6 +43,8 @@ import org.dllearner.core.config.StringSetConfigOption; import org.dllearner.core.dl.KB; import org.dllearner.kb.sparql.Manager; +import org.dllearner.kb.sparql.PredefinedEndpoint; +import org.dllearner.kb.sparql.PredefinedFilter; import org.dllearner.kb.sparql.SparqlQueryType; import org.dllearner.kb.sparql.SpecificSparqlEndpoint; import org.dllearner.parser.KBParser; @@ -64,7 +66,8 @@ private Set<String> instances; private URL dumpFile; private int numberOfRecursions; - private int filterMode; + private int predefinedFilter=0; + private int predefinedEndpoint=0; private Set<String> predList; private Set<String> objList; private Set<String> classList; @@ -127,7 +130,9 @@ options.add(new StringConfigOption("host", "host of SPARQL Endpoint")); options.add(new StringSetConfigOption("instances","relevant instances e.g. positive and negative examples in a learning problem")); options.add(new IntegerConfigOption("numberOfRecursions","number of Recursions, the Sparql-Endpoint is asked")); - options.add(new IntegerConfigOption("filterMode","the mode of the SPARQL Filter")); + options.add(new IntegerConfigOption("predefinedFilter","the mode of the SPARQL Filter")); + options.add(new IntegerConfigOption("predefinedEndpoint","the mode of the SPARQL Filter")); + options.add(new StringSetConfigOption("predList","a predicate list")); options.add(new StringSetConfigOption("objList","an object list")); options.add(new StringSetConfigOption("classList","a class list")); @@ -164,8 +169,10 @@ objList = (Set<String>) entry.getValue(); } else if(option.equals("classList")) { classList = (Set<String>) entry.getValue(); - } else if(option.equals("filterMode")){ - filterMode=(Integer)entry.getValue(); + } else if(option.equals("predefinedEndpoint")){ + predefinedEndpoint=(Integer)entry.getValue(); + } else if(option.equals("predefinedFilter")){ + predefinedFilter=(Integer)entry.getValue(); } else if(option.equals("format")){ format=(String)entry.getValue(); } else if(option.equals("dumpToFile")){ @@ -189,19 +196,32 @@ //new SparqlOntologyCollector(Datastructures.setToArray(instances), numberOfRecursions, filterMode, //Datastructures.setToArray(predList),Datastructures.setToArray( objList),Datastructures.setToArray(classList),format,url,useLits); Manager m=new Manager(); - if(filterMode>=1){ - m.usePredefinedConfiguration(filterMode); + SpecificSparqlEndpoint sse=null; + SparqlQueryType sqt=null; + HashMap<String, String> parameters = new HashMap<String, String>(); + parameters.put("default-graph-uri", "http://dbpedia.org"); + parameters.put("format", "application/sparql-results.xml"); + + if(predefinedEndpoint>=1){ + sse=PredefinedEndpoint.getEndpoint(predefinedEndpoint); + + } + else{ + SpecificSparqlEndpoint se=new SpecificSparqlEndpoint(url, host, parameters); + + } + + if(predefinedFilter>=1){ + sqt=PredefinedFilter.getFilter(predefinedFilter); } else{ - SparqlQueryType sqt=new SparqlQueryType("forbid", objList,predList,useLits+""); - HashMap<String, String> parameters = new HashMap<String, String>(); - parameters.put("default-graph-uri", "http://dbpedia.org"); - parameters.put("format", "application/sparql-results.xml"); - SpecificSparqlEndpoint se=new SpecificSparqlEndpoint(url, host, parameters); - m.useConfiguration(sqt, se,numberOfRecursions,getAllBackground); + sqt=new SparqlQueryType("forbid", objList,predList,useLits+""); + + + } - + m.useConfiguration(sqt, sse,numberOfRecursions,getAllBackground); try { String ont=m.extract(instances); Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/Manager.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/Manager.java 2007-12-02 19:53:08 UTC (rev 308) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/Manager.java 2007-12-02 20:52:38 UTC (rev 309) @@ -10,20 +10,8 @@ private TypedSparqlQuery typedSparqlQuery; private ExtractionAlgorithm extractionAlgorithm; - /*public void usePredefinedConfiguration(URI uri) { - - this.Configuration = org.dllearner.kb.sparql.Configuration.getConfiguration(uri); - this.TypedSparqlQuery = new TypedSparqlQuery(Configuration); - this.ExtractionAlgorithm = new ExtractionAlgorithm(Configuration); - }*/ - public void usePredefinedConfiguration(int i) { - this.configuration = PredefinedConfigurations.get(i); - this.typedSparqlQuery = new TypedSparqlQuery(configuration); - this.extractionAlgorithm = new ExtractionAlgorithm(configuration); - } - public void useConfiguration(SparqlQueryType SparqlQueryType, SpecificSparqlEndpoint SparqlEndpoint, int recursiondepth,boolean getAllBackground) { this.configuration = new Configuration(SparqlEndpoint, SparqlQueryType,recursiondepth,getAllBackground); Deleted: trunk/src/dl-learner/org/dllearner/kb/sparql/PredefinedConfigurations.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/PredefinedConfigurations.java 2007-12-02 19:53:08 UTC (rev 308) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/PredefinedConfigurations.java 2007-12-02 20:52:38 UTC (rev 309) @@ -1,68 +0,0 @@ -package org.dllearner.kb.sparql; - -import java.net.URL; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Set; - -public class PredefinedConfigurations { - - public static Configuration get(int i) { - - switch (i) { - case 1: - return dbpediaYago(); - - } - return null; - } - - public static Configuration dbpediaYago() { - - SpecificSparqlEndpoint sse=dbpediaEndpoint(); - // System.out.println(u); - SparqlQueryType sqt = YagoFilter(); - - return new Configuration(sse, sqt, 2, true); - - } - - public static SparqlQueryType YagoFilter(){ - - Set<String> pred = new HashSet<String>(); - pred.add("http://www.w3.org/2004/02/skos/core"); - pred.add("http://www.w3.org/2002/07/owl#sameAs"); - pred.add("http://xmlns.com/foaf/0.1/"); - pred.add("http://dbpedia.org/property/reference"); - pred.add("http://dbpedia.org/property/website"); - pred.add("http://dbpedia.org/property/wikipage"); - - Set<String> obj = new HashSet<String>(); - obj.add("http://dbpedia.org/resource/Category:Wikipedia_"); - obj.add("http://dbpedia.org/resource/Category:Articles_"); - obj.add("http://xmlns.com/foaf/0.1/"); - obj.add("http://upload.wikimedia.org/wikipedia/commons"); - obj.add("http://upload.wikimedia.org/wikipedia"); - obj.add("http://www.geonames.org"); - obj.add("http://www.w3.org/2006/03/wn/wn20/instances/synset"); - obj.add("http://www4.wiwiss.fu-berlin.de/flickrwrappr"); - obj.add("http://www.w3.org/2004/02/skos/core"); - - return new SparqlQueryType("forbid", obj, pred, "false"); - } - - - public static SpecificSparqlEndpoint dbpediaEndpoint(){ - URL u = null; - HashMap<String, String> m = new HashMap<String, String>(); - m.put("default-graph-uri", "http://dbpedia.org"); - m.put("format", "application/sparql-results.xml"); - try { - u = new URL("http://dbpedia.openlinksw.com:8890/sparql"); - } catch (Exception e) { - e.printStackTrace(); - } - return new SpecificSparqlEndpoint(u, "dbpedia.openlinksw.com", m); - } - -} Added: trunk/src/dl-learner/org/dllearner/kb/sparql/PredefinedEndpoint.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/PredefinedEndpoint.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/PredefinedEndpoint.java 2007-12-02 20:52:38 UTC (rev 309) @@ -0,0 +1,29 @@ +package org.dllearner.kb.sparql; + +import java.net.URL; +import java.util.HashMap; + +public class PredefinedEndpoint { + public static SpecificSparqlEndpoint getEndpoint(int i) { + + switch (i) { + case 1: + return dbpediaEndpoint(); + + } + return null; + } + + public static SpecificSparqlEndpoint dbpediaEndpoint(){ + URL u = null; + HashMap<String, String> m = new HashMap<String, String>(); + m.put("default-graph-uri", "http://dbpedia.org"); + m.put("format", "application/sparql-results.xml"); + try { + u = new URL("http://dbpedia.openlinksw.com:8890/sparql"); + } catch (Exception e) { + e.printStackTrace(); + } + return new SpecificSparqlEndpoint(u, "dbpedia.openlinksw.com", m); +} +} Added: trunk/src/dl-learner/org/dllearner/kb/sparql/PredefinedFilter.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/PredefinedFilter.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/PredefinedFilter.java 2007-12-02 20:52:38 UTC (rev 309) @@ -0,0 +1,42 @@ +package org.dllearner.kb.sparql; + +import java.util.HashSet; +import java.util.Set; + +public class PredefinedFilter { + + + public static SparqlQueryType getFilter(int i) { + + switch (i) { + case 1: + return YagoFilter(); + + } + return null; + } + + + public static SparqlQueryType YagoFilter(){ + Set<String> pred = new HashSet<String>(); + pred.add("http://www.w3.org/2004/02/skos/core"); + pred.add("http://www.w3.org/2002/07/owl#sameAs"); + pred.add("http://xmlns.com/foaf/0.1/"); + pred.add("http://dbpedia.org/property/reference"); + pred.add("http://dbpedia.org/property/website"); + pred.add("http://dbpedia.org/property/wikipage"); + + Set<String> obj = new HashSet<String>(); + obj.add("http://dbpedia.org/resource/Category:Wikipedia_"); + obj.add("http://dbpedia.org/resource/Category:Articles_"); + obj.add("http://xmlns.com/foaf/0.1/"); + obj.add("http://upload.wikimedia.org/wikipedia/commons"); + obj.add("http://upload.wikimedia.org/wikipedia"); + obj.add("http://www.geonames.org"); + obj.add("http://www.w3.org/2006/03/wn/wn20/instances/synset"); + obj.add("http://www4.wiwiss.fu-berlin.de/flickrwrappr"); + obj.add("http://www.w3.org/2004/02/skos/core"); + + return new SparqlQueryType("forbid", obj, pred, "false"); + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ku...@us...> - 2007-12-02 19:53:13
|
Revision: 308 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=308&view=rev Author: kurzum Date: 2007-12-02 11:53:08 -0800 (Sun, 02 Dec 2007) Log Message: ----------- Manual settings work now. Filtermode=0 means all configurations have to be done manual filtermode 1 and above uses presets overriding almost all manual configurations made new example workingexamplemanual.conf changed workingexample.conf filtermode=1 uses yago and dbpedia Modified Paths: -------------- trunk/examples/dbpedia/newworking.conf trunk/src/dl-learner/org/dllearner/kb/SparqlEndpointRestructured.java trunk/src/dl-learner/org/dllearner/kb/sparql/ExtractionAlgorithm.java trunk/src/dl-learner/org/dllearner/kb/sparql/PredefinedConfigurations.java Added Paths: ----------- trunk/examples/dbpedia/newworkingManually.conf Removed Paths: ------------- trunk/src/dl-learner/org/dllearner/kb/extraction/ Modified: trunk/examples/dbpedia/newworking.conf =================================================================== --- trunk/examples/dbpedia/newworking.conf 2007-12-02 17:40:55 UTC (rev 307) +++ trunk/examples/dbpedia/newworking.conf 2007-12-02 19:53:08 UTC (rev 308) @@ -35,7 +35,9 @@ sparql2.host = "dbpedia.openlinksw.com"; sparql2.getAllBackground=true; sparql2.instances = {"http://dbpedia.org/resource/Angela_Merkel"}; -sparql2.filterMode = 0; +sparql2.filterMode = 1; +//filtermode 1 and above uses a predefined setting +//0 means manual sparql2.predList = {}; sparql2.objList = {}; sparql2.classList = {}; Added: trunk/examples/dbpedia/newworkingManually.conf =================================================================== --- trunk/examples/dbpedia/newworkingManually.conf (rev 0) +++ trunk/examples/dbpedia/newworkingManually.conf 2007-12-02 19:53:08 UTC (rev 308) @@ -0,0 +1,64 @@ +/** + * Father Example + * + * possible solution: + * male AND EXISTS hasChild.TOP + * + * Copyright (C) 2007, Jens Lehmann + */ + +/** settings **/ +// reasoner settings +reasoner = dig; +//digReasonerURL = "http://localhost:8081"; +//useRetrievalForClassification = true; +//refinement.useDIGMultiInstanceChecks = twoChecks; + +// algorithm settings +algorithm = refinement; +//refinement.horizontalExpansionFactor = 0.5; +//refinement.quiet = false; + +// search tree protocol +// refinement.writeSearchTree = false; +// refinement.searchTreeFile = "log/searchTree.txt"; + +// control output +cli.checkSatisfiability = true; +cli.showIndividuals = false; +cli.showConcepts = false; +cli.showRoles = true; +cli.showSubsumptionHierarchy = false; + +// SPARQL options +sparql2.numberOfRecursions = 2; +sparql2.host = "dbpedia.openlinksw.com"; +sparql2.getAllBackground=true; +sparql2.instances = {"http://dbpedia.org/resource/Angela_Merkel"}; +sparql2.filterMode = 0; +//filtermode 1 and above uses a predefined setting +//0 means manual +sparql2.predList = {"http://www.w3.org/2004/02/skos/core", + "http://www.w3.org/2002/07/owl#sameAs", + "http://xmlns.com/foaf/0.1/", + "http://dbpedia.org/property/reference", + "http://dbpedia.org/property/website", + "http://dbpedia.org/property/wikipage"}; +sparql2.objList = {"http://dbpedia.org/resource/Category:Wikipedia_" + ,"http://dbpedia.org/resource/Category:Articles_" + ,"http://xmlns.com/foaf/0.1/" + ,"http://upload.wikimedia.org/wikipedia/commons" + ,"http://upload.wikimedia.org/wikipedia" + ,"http://www.geonames.org" + ,"http://www.w3.org/2006/03/wn/wn20/instances/synset" + ,"http://www4.wiwiss.fu-berlin.de/flickrwrappr" + ,"http://www.w3.org/2004/02/skos/core"}; +sparql2.classList = {}; +sparql2.format = "N-TRIPLES"; +sparql2.dumpToFile = true; + +import("http://dbpedia.openlinksw.com:8890/sparql","SPARQL2"); + +/** examples **/ ++"http://dbpedia.org/resource/Angela_Merkel" +-"http://dbpedia.org/resource/Gerhard_Schr%C3%B6der" \ No newline at end of file Modified: trunk/src/dl-learner/org/dllearner/kb/SparqlEndpointRestructured.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/SparqlEndpointRestructured.java 2007-12-02 17:40:55 UTC (rev 307) +++ trunk/src/dl-learner/org/dllearner/kb/SparqlEndpointRestructured.java 2007-12-02 19:53:08 UTC (rev 308) @@ -189,14 +189,16 @@ //new SparqlOntologyCollector(Datastructures.setToArray(instances), numberOfRecursions, filterMode, //Datastructures.setToArray(predList),Datastructures.setToArray( objList),Datastructures.setToArray(classList),format,url,useLits); Manager m=new Manager(); - if(filterMode==0){ - + if(filterMode>=1){ m.usePredefinedConfiguration(filterMode); } else{ SparqlQueryType sqt=new SparqlQueryType("forbid", objList,predList,useLits+""); - SpecificSparqlEndpoint se=new SpecificSparqlEndpoint(url, host, new HashMap<String, String>()); + HashMap<String, String> parameters = new HashMap<String, String>(); + parameters.put("default-graph-uri", "http://dbpedia.org"); + parameters.put("format", "application/sparql-results.xml"); + SpecificSparqlEndpoint se=new SpecificSparqlEndpoint(url, host, parameters); m.useConfiguration(sqt, se,numberOfRecursions,getAllBackground); } Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/ExtractionAlgorithm.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/ExtractionAlgorithm.java 2007-12-02 17:40:55 UTC (rev 307) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/ExtractionAlgorithm.java 2007-12-02 19:53:08 UTC (rev 308) @@ -49,7 +49,7 @@ tmp.addAll(tmpVec); } v = tmp; - System.out.println("Rec: " + x + " with " + v); + System.out.println("Recursion counter: " + x + " with " + v.size()+" Nodes remaining"); } if (this.getAllBackground) { Vector<Node> classes = new Vector<Node>(); @@ -59,9 +59,9 @@ } } while (classes.size() > 0) { - System.out.println(classes.size()); + System.out.println("Remaining classes: "+classes.size()); Node next=classes.remove(0); - System.out.println(next); + System.out.println("Expanding: "+next); classes.addAll(next.expand(tsp, manipulator)); } Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/PredefinedConfigurations.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/PredefinedConfigurations.java 2007-12-02 17:40:55 UTC (rev 307) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/PredefinedConfigurations.java 2007-12-02 19:53:08 UTC (rev 308) @@ -10,7 +10,7 @@ public static Configuration get(int i) { switch (i) { - case 0: + case 1: return dbpediaYago(); } @@ -18,18 +18,18 @@ } public static Configuration dbpediaYago() { - URL u = null; - HashMap<String, String> m = new HashMap<String, String>(); - m.put("default-graph-uri", "http://dbpedia.org"); - m.put("format", "application/sparql-results.xml"); - try { - u = new URL("http://dbpedia.openlinksw.com:8890/sparql"); - } catch (Exception e) { - e.printStackTrace(); - } - SpecificSparqlEndpoint sse = new SpecificSparqlEndpoint(u, "dbpedia.openlinksw.com", m); + + SpecificSparqlEndpoint sse=dbpediaEndpoint(); // System.out.println(u); - Set<String> pred = new HashSet<String>(); + SparqlQueryType sqt = YagoFilter(); + + return new Configuration(sse, sqt, 2, true); + + } + + public static SparqlQueryType YagoFilter(){ + + Set<String> pred = new HashSet<String>(); pred.add("http://www.w3.org/2004/02/skos/core"); pred.add("http://www.w3.org/2002/07/owl#sameAs"); pred.add("http://xmlns.com/foaf/0.1/"); @@ -48,10 +48,21 @@ obj.add("http://www4.wiwiss.fu-berlin.de/flickrwrappr"); obj.add("http://www.w3.org/2004/02/skos/core"); - SparqlQueryType sqt = new SparqlQueryType("forbid", obj, pred, "false"); - - return new Configuration(sse, sqt, 2, true); - + return new SparqlQueryType("forbid", obj, pred, "false"); } + + + public static SpecificSparqlEndpoint dbpediaEndpoint(){ + URL u = null; + HashMap<String, String> m = new HashMap<String, String>(); + m.put("default-graph-uri", "http://dbpedia.org"); + m.put("format", "application/sparql-results.xml"); + try { + u = new URL("http://dbpedia.openlinksw.com:8890/sparql"); + } catch (Exception e) { + e.printStackTrace(); + } + return new SpecificSparqlEndpoint(u, "dbpedia.openlinksw.com", m); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2007-12-02 17:40:57
|
Revision: 307 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=307&view=rev Author: jenslehmann Date: 2007-12-02 09:40:55 -0800 (Sun, 02 Dec 2007) Log Message: ----------- adapted DL-Learner to latest KAON2 release Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/kb/KBFile.java trunk/src/dl-learner/org/dllearner/reasoning/KAON2Reasoner.java Modified: trunk/src/dl-learner/org/dllearner/kb/KBFile.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/KBFile.java 2007-12-02 17:06:39 UTC (rev 306) +++ trunk/src/dl-learner/org/dllearner/kb/KBFile.java 2007-12-02 17:40:55 UTC (rev 307) @@ -120,7 +120,7 @@ public void export(File file, org.dllearner.core.OntologyFormat format){ Reasoner kaon2Reasoner = KAON2Reasoner.getKAON2Reasoner(kb); - String kaon2Format = ""; + OntologyFileFormat kaon2Format = null; if(format.equals(org.dllearner.core.OntologyFormat.RDF_XML)) kaon2Format = OntologyFileFormat.OWL_RDF; else { Modified: trunk/src/dl-learner/org/dllearner/reasoning/KAON2Reasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/KAON2Reasoner.java 2007-12-02 17:06:39 UTC (rev 306) +++ trunk/src/dl-learner/org/dllearner/reasoning/KAON2Reasoner.java 2007-12-02 17:40:55 UTC (rev 307) @@ -96,12 +96,7 @@ if(imports.size()>1) System.out.println("Warning: KAON2-Reasoner currently supports only one import file. Ignoring all other imports."); - try { - kaon2Connection = KAON2Manager.newConnection(); - } catch (KAON2Exception e2) { - // TODO Auto-generated catch block - e2.printStackTrace(); - } + kaon2Connection = KAON2Manager.newConnection(); DefaultOntologyResolver resolver = new DefaultOntologyResolver(); @@ -475,7 +470,7 @@ public void saveOntology(File file, org.dllearner.core.OntologyFormat format) { // File exportFile = new File(baseDir, fileName); // String format = OntologyFileFormat.OWL_RDF; - String kaon2Format = ""; + OntologyFileFormat kaon2Format = null; if(format.equals(org.dllearner.core.OntologyFormat.RDF_XML)) kaon2Format = OntologyFileFormat.OWL_RDF; else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2007-12-02 17:06:47
|
Revision: 306 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=306&view=rev Author: jenslehmann Date: 2007-12-02 09:06:39 -0800 (Sun, 02 Dec 2007) Log Message: ----------- added illustration for learning on SPARQL endpoints Modified Paths: -------------- trunk/resources/architecture.svg Added Paths: ----------- trunk/resources/sparql_learning.svg Modified: trunk/resources/architecture.svg =================================================================== --- trunk/resources/architecture.svg 2007-12-02 15:19:26 UTC (rev 305) +++ trunk/resources/architecture.svg 2007-12-02 17:06:39 UTC (rev 306) @@ -12,11 +12,13 @@ height="1052.3622047" id="svg2" sodipodi:version="0.32" - inkscape:version="0.45" + inkscape:version="0.45.1" sodipodi:docname="architecture.svg" sodipodi:docbase="/home/jl/promotion/dl-learner-svn/trunk/resources" inkscape:output_extension="org.inkscape.output.svg.inkscape" - sodipodi:modified="true"> + inkscape:export-filename="/home/jl/promotion/dl-learner-svn/trunk/resources/architecture_large.png" + inkscape:export-xdpi="150" + inkscape:export-ydpi="150"> <defs id="defs4"> <marker @@ -194,7 +196,7 @@ sodipodi:role="line" x="431.42856" y="422.00504" - id="tspan3191">measure</tspan></text> + id="tspan3191">measure (heuristics)</tspan></text> <text xml:space="preserve" style="font-size:18px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans" Added: trunk/resources/sparql_learning.svg =================================================================== --- trunk/resources/sparql_learning.svg (rev 0) +++ trunk/resources/sparql_learning.svg 2007-12-02 17:06:39 UTC (rev 306) @@ -0,0 +1,275 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://web.resource.org/cc/" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="744.09448819" + height="1052.3622047" + id="svg2" + sodipodi:version="0.32" + inkscape:version="0.45.1" + sodipodi:docbase="/home/jl/promotion/dl-learner-svn/trunk/resources" + sodipodi:docname="sparql_learning.svg" + inkscape:output_extension="org.inkscape.output.svg.inkscape" + inkscape:export-filename="/home/jl/promotion/dl-learner-svn/trunk/resources/sparql_learning_large.png" + inkscape:export-xdpi="125.57305" + inkscape:export-ydpi="125.57305"> + <defs + id="defs4"> + <marker + inkscape:stockid="Arrow1Mend" + orient="auto" + refY="0.0" + refX="0.0" + id="Arrow1Mend" + style="overflow:visible;"> + <path + id="path3227" + d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z " + style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none;" + transform="scale(0.4) rotate(180) translate(10,0)" /> + </marker> + <marker + inkscape:stockid="Arrow1Mstart" + orient="auto" + refY="0.0" + refX="0.0" + id="Arrow1Mstart" + style="overflow:visible"> + <path + id="path3224" + d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z " + style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none" + transform="scale(0.4) translate(10,0)" /> + </marker> + <marker + inkscape:stockid="Arrow1Lend" + orient="auto" + refY="0.0" + refX="0.0" + id="Arrow1Lend" + style="overflow:visible;"> + <path + id="path3221" + d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z " + style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none;" + transform="scale(0.8) rotate(180) translate(12.5,0)" /> + </marker> + <marker + inkscape:stockid="Arrow1Lstart" + orient="auto" + refY="0.0" + refX="0.0" + id="Arrow1Lstart" + style="overflow:visible"> + <path + id="path3218" + d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z " + style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none" + transform="scale(0.8) translate(12.5,0)" /> + </marker> + </defs> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + gridtolerance="10000" + guidetolerance="10" + objecttolerance="10" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="0.7" + inkscape:cx="375" + inkscape:cy="520" + inkscape:document-units="px" + inkscape:current-layer="layer1" + inkscape:window-width="1280" + inkscape:window-height="951" + inkscape:window-x="0" + inkscape:window-y="0" /> + <metadata + id="metadata7"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1"> + <rect + style="opacity:1;fill:#ff9955;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect3195" + width="41.42857" + height="137.14285" + x="351.42856" + y="332.36218" /> + <rect + style="opacity:1;fill:#ff7f2a;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.81044334;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect2180" + width="207.33243" + height="90.18956" + x="15.619508" + y="356.5531" /> + <rect + style="opacity:1;fill:#ff7f2a;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.13091314;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect3153" + width="202.72621" + height="155.58337" + x="394.3512" + y="323.85617" /> + <rect + style="opacity:1;fill:#ff7f2a;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect3155" + width="240" + height="94.285713" + x="475.71426" + y="108.07646" /> + <rect + style="opacity:1;fill:#ff7f2a;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect3157" + width="234.28572" + height="85.714287" + x="487.14285" + y="603.79071" /> + <text + xml:space="preserve" + style="font-size:24px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans" + x="52.857143" + y="395.21933" + id="text3159"><tspan + sodipodi:role="line" + id="tspan3161" + x="52.857143" + y="395.21933">Semantic</tspan><tspan + sodipodi:role="line" + x="52.857143" + y="425.21933" + id="tspan3163">Application</tspan></text> + <text + xml:space="preserve" + style="font-size:24px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans" + x="-465.93082" + y="370.84204" + id="text3165" + transform="matrix(-2.1514347e-2,-0.9997685,0.9997685,-2.1514347e-2,0,0)"><tspan + sodipodi:role="line" + id="tspan3167" + x="-465.93082" + y="370.84204" + style="font-size:20px">Webservice</tspan></text> + <text + xml:space="preserve" + style="font-size:24px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans" + x="422.85715" + y="376.64789" + id="text3169"><tspan + sodipodi:role="line" + id="tspan3171" + x="422.85715" + y="376.64789">DL-Learner</tspan></text> + <text + xml:space="preserve" + style="font-size:24px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans" + x="539.99994" + y="143.79074" + id="text3173"><tspan + sodipodi:role="line" + id="tspan3175" + x="539.99994" + y="143.79074">SPARQL-</tspan><tspan + sodipodi:role="line" + x="539.99994" + y="173.79074" + id="tspan3177">Endpoint</tspan></text> + <text + xml:space="preserve" + style="font-size:24px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans" + x="519.99994" + y="649.50507" + id="text3179"><tspan + sodipodi:role="line" + id="tspan3181" + x="519.99994" + y="649.50507">OWL-Reasoner</tspan></text> + <text + xml:space="preserve" + style="font-size:24px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans" + x="138.57143" + y="249.50507" + id="text3183"><tspan + sodipodi:role="line" + id="tspan3185" + x="138.57143" + y="249.50507" + style="font-size:20px">extract relevant knowledge via SPARQL</tspan><tspan + sodipodi:role="line" + x="138.57143" + y="274.50507" + id="tspan3187" + style="font-size:20px">queries and convert to OWL</tspan></text> + <text + xml:space="preserve" + style="font-size:24px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans" + x="164.28571" + y="539.505" + id="text3189"><tspan + sodipodi:role="line" + id="tspan3191" + x="164.28571" + y="539.505" + style="font-size:20px">send extracted knowledge to </tspan><tspan + sodipodi:role="line" + x="164.28571" + y="564.505" + id="tspan3193" + style="font-size:20px">reasoner, e.g. using the DIG interface</tspan></text> + <rect + style="opacity:1;fill:#d45500;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.19901943;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect3211" + width="59.645962" + height="136.94447" + x="407.1395" + y="-562.11157" + transform="matrix(-1.7823318e-3,0.9999984,-0.9999931,-3.7051892e-3,0,0)" /> + <text + xml:space="preserve" + style="font-size:24px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans" + x="440" + y="432.36224" + id="text3205"><tspan + sodipodi:role="line" + id="tspan3207" + x="440" + y="432.36224" + style="font-size:20px">Learning</tspan><tspan + sodipodi:role="line" + x="440" + y="457.36224" + id="tspan3209" + style="font-size:20px">Algorithms</tspan></text> + <path + style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:url(#Arrow1Mstart);marker-end:url(#Arrow1Mend);stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0" + d="M 230,399.50504 L 342.85714,399.50504" + id="path3213" /> + <path + style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:url(#Arrow1Mstart);marker-end:url(#Arrow1Mend);stroke-miterlimit:4;stroke-dasharray:6,6;stroke-dashoffset:0" + d="M 475.71429,313.79075 L 607.14286,212.36218" + id="path3421" /> + <path + style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Arrow1Mstart);marker-end:url(#Arrow1Mend);stroke-miterlimit:4;stroke-dasharray:6, 6;stroke-dashoffset:0;stroke-opacity:1" + d="M 476.3246,487.68186 L 603.67541,594.18535" + id="path3423" /> + </g> +</svg> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2007-12-02 15:19:42
|
Revision: 305 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=305&view=rev Author: jenslehmann Date: 2007-12-02 07:19:26 -0800 (Sun, 02 Dec 2007) Log Message: ----------- improved documentation Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/core/dl/AtomicConcept.java trunk/src/dl-learner/org/dllearner/core/dl/AtomicRole.java trunk/src/dl-learner/org/dllearner/core/dl/ConceptAssertion.java trunk/src/dl-learner/org/dllearner/core/dl/Individual.java trunk/src/dl-learner/org/dllearner/core/dl/RoleAssertion.java Modified: trunk/src/dl-learner/org/dllearner/core/dl/AtomicConcept.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/AtomicConcept.java 2007-12-02 14:44:58 UTC (rev 304) +++ trunk/src/dl-learner/org/dllearner/core/dl/AtomicConcept.java 2007-12-02 15:19:26 UTC (rev 305) @@ -1,3 +1,22 @@ +/** + * Copyright (C) 2007, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ package org.dllearner.core.dl; import java.util.Map; @@ -4,12 +23,16 @@ import org.dllearner.utilities.Helper; - - +/** + * Represents an atomic concept in a knowledge base / ontology, + * e.g. "car", "person". + * + * @author Jens Lehmann + * + */ public class AtomicConcept extends Concept { String name; - // List<String> subs public AtomicConcept(String name) { this.name = name; @@ -19,31 +42,6 @@ return name; } - /* - @Override - protected void calculateSets(FlatABox abox, SortedSet<String> adcPosSet, SortedSet<String> adcNegSet) { - posSet = abox.atomicConceptsPos.get(conceptName); - negSet = abox.atomicConceptsNeg.get(conceptName); - - if(posSet == null) - posSet = new TreeSet<String>(); - if(negSet == null) - negSet = new TreeSet<String>(); - } - */ - - @Override - public String toString() { - // es soll ein Prefix ausgeblendet werden um Konzepte - // lesbarer zu machen (z.B. http://blabla.org/bla/bla#eigentlicher Name -// String prefixToHide = Helper.findPrefixToHide(name); -// -// if(prefixToHide != null) -// return name.substring(prefixToHide.length()); -// else - return name; - } - public int getLength() { return 1; } @@ -53,6 +51,11 @@ return 0; } + @Override + public String toString() { + return name; + } + public String toString(String baseURI, Map<String,String> prefixes) { return Helper.getAbbreviatedString(name, baseURI, prefixes); } Modified: trunk/src/dl-learner/org/dllearner/core/dl/AtomicRole.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/AtomicRole.java 2007-12-02 14:44:58 UTC (rev 304) +++ trunk/src/dl-learner/org/dllearner/core/dl/AtomicRole.java 2007-12-02 15:19:26 UTC (rev 305) @@ -1,3 +1,22 @@ +/** + * Copyright (C) 2007, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ package org.dllearner.core.dl; import java.util.Map; @@ -4,6 +23,13 @@ import org.dllearner.utilities.Helper; +/** + * Represents an atomic concept in a knowledge base / ontology, + * e.g. "hasChild". + * + * @author Jens Lehmann + * + */ public class AtomicRole extends Role { public AtomicRole(String name) { @@ -11,18 +37,11 @@ } public int getLength() { - // TODO Auto-generated method stub return 1; } @Override public String toString() { -// String name = getName(); -// String prefixToHide = Helper.findPrefixToHide(name); -// -// if(prefixToHide != null) -// return name.substring(prefixToHide.length()); -// else return name; } Modified: trunk/src/dl-learner/org/dllearner/core/dl/ConceptAssertion.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/ConceptAssertion.java 2007-12-02 14:44:58 UTC (rev 304) +++ trunk/src/dl-learner/org/dllearner/core/dl/ConceptAssertion.java 2007-12-02 15:19:26 UTC (rev 305) @@ -1,3 +1,22 @@ +/** + * Copyright (C) 2007, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ package org.dllearner.core.dl; import java.util.Map; @@ -2,2 +21,9 @@ +/** + * Represents an concept assertion in a knowledge base / ontology, + * e.g. "heiko is a person", "heiko is a male person having one child". + * + * @author Jens Lehmann + * + */ public class ConceptAssertion extends AssertionalAxiom { Modified: trunk/src/dl-learner/org/dllearner/core/dl/Individual.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/Individual.java 2007-12-02 14:44:58 UTC (rev 304) +++ trunk/src/dl-learner/org/dllearner/core/dl/Individual.java 2007-12-02 15:19:26 UTC (rev 305) @@ -1,3 +1,22 @@ +/** + * Copyright (C) 2007, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ package org.dllearner.core.dl; import java.util.Map; @@ -5,25 +24,13 @@ import org.dllearner.utilities.Helper; /** - * Indiviualklasse soll ein Mapping von Namen auf Zahlen sein, so - * dass compare-Methoden schneller werden. + * Represents an invididual in a knowledge base / ontology. * - * Wenn man individuals nur als Strings repräsentiert, dann funktioniert - * auch die Kurzdarstellung mit hidePrefix nicht (obwohl das keine so - * hohe Priorität hat und man an geeigneten Stellen auch anders lösen - * kann). - * - * => das sollte man erst nach den ersten Papers im Februar einbinden um - * größere Änderungen im System zu vermeiden - * - * @author jl + * @author Jens Lehmann * */ public class Individual implements KBElement, Comparable<Individual> { - // public static int idCounter = 0; - - // private int id; private String name; public String getName() { @@ -32,24 +39,12 @@ public Individual(String name) { this.name = name; - // id = idCounter; - // idCounter++; } public int getLength() { return 1; } - @Override - public String toString() { -// String prefixToHide = Helper.findPrefixToHide(name); -// -// if(prefixToHide != null) -// return name.substring(prefixToHide.length()); -// else - return name; - } - public int compareTo(Individual o) { return name.compareTo(o.name); } @@ -59,6 +54,11 @@ return (compareTo((Individual)o)==0); } + @Override + public String toString() { + return name; + } + public String toString(String baseURI, Map<String,String> prefixes) { return Helper.getAbbreviatedString(name, baseURI, prefixes); } Modified: trunk/src/dl-learner/org/dllearner/core/dl/RoleAssertion.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/dl/RoleAssertion.java 2007-12-02 14:44:58 UTC (rev 304) +++ trunk/src/dl-learner/org/dllearner/core/dl/RoleAssertion.java 2007-12-02 15:19:26 UTC (rev 305) @@ -1,3 +1,22 @@ +/** + * Copyright (C) 2007, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ package org.dllearner.core.dl; import java.util.Map; @@ -2,2 +21,9 @@ +/** + * Represents an role assertion in a knowledge base / ontology, + * e.g. "heiko is brother of stefan". + * + * @author Jens Lehmann + * + */ public class RoleAssertion extends AssertionalAxiom { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2007-12-02 14:45:05
|
Revision: 304 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=304&view=rev Author: jenslehmann Date: 2007-12-02 06:44:58 -0800 (Sun, 02 Dec 2007) Log Message: ----------- removed isXXX methods (can be checked using instanceof) Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/kb/sparql/ClassNode.java trunk/src/dl-learner/org/dllearner/kb/sparql/ExtractionAlgorithm.java trunk/src/dl-learner/org/dllearner/kb/sparql/InstanceNode.java trunk/src/dl-learner/org/dllearner/kb/sparql/Manipulator.java trunk/src/dl-learner/org/dllearner/kb/sparql/Node.java trunk/src/dl-learner/org/dllearner/kb/sparql/PropertyNode.java Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/ClassNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/ClassNode.java 2007-12-02 14:41:38 UTC (rev 303) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/ClassNode.java 2007-12-02 14:44:58 UTC (rev 304) @@ -40,11 +40,6 @@ } @Override - public boolean isClass() { - return true; - } - - @Override public Set<String> toNTriple() { Set<String> s = new HashSet<String>(); s.add("<" + this.uri + "><" + "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" + "><" Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/ExtractionAlgorithm.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/ExtractionAlgorithm.java 2007-12-02 14:41:38 UTC (rev 303) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/ExtractionAlgorithm.java 2007-12-02 14:44:58 UTC (rev 304) @@ -54,7 +54,7 @@ if (this.getAllBackground) { Vector<Node> classes = new Vector<Node>(); for (Node one : v) { - if (one.isClass()) { + if (one instanceof ClassNode) { classes.add(one); } } Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/InstanceNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/InstanceNode.java 2007-12-02 14:41:38 UTC (rev 303) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/InstanceNode.java 2007-12-02 14:44:58 UTC (rev 304) @@ -53,11 +53,6 @@ } @Override - public boolean isInstance() { - return true; - } - - @Override public Set<String> toNTriple() { Set<String> s = new HashSet<String>(); s.add("<" + uri + "><" + "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" + "><" Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/Manipulator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/Manipulator.java 2007-12-02 14:41:38 UTC (rev 303) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/Manipulator.java 2007-12-02 14:44:58 UTC (rev 304) @@ -34,17 +34,17 @@ while (it.hasNext()) { Tupel t = (Tupel) it.next(); // all classes with owl:type class - if (t.a.equals(type) && t.b.equals(classns) && node.isClass()) { + if (t.a.equals(type) && t.b.equals(classns) && node instanceof ClassNode) { toRemove.add(t); } // all with type class - if (t.b.equals(classns) && node.isClass()) { + if (t.b.equals(classns) && node instanceof ClassNode) { toRemove.add(t); } // all instances with owl:type thing - if (t.a.equals(type) && t.b.equals(thing) && node.isInstance()) { + if (t.a.equals(type) && t.b.equals(thing) && node instanceof InstanceNode) { toRemove.add(t); } Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/Node.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/Node.java 2007-12-02 14:41:38 UTC (rev 303) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/Node.java 2007-12-02 14:44:58 UTC (rev 304) @@ -35,18 +35,6 @@ } - public boolean isClass() { - return false; - } - - public boolean isInstance() { - return false; - } - - public boolean isProperty() { - return false; - } - public URI getURI() { return uri; } Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/PropertyNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/PropertyNode.java 2007-12-02 14:41:38 UTC (rev 303) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/PropertyNode.java 2007-12-02 14:44:58 UTC (rev 304) @@ -48,11 +48,6 @@ return Nodes; } - @Override - public boolean isProperty() { - return true; - } - public Node getB() { return b; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2007-12-02 14:41:40
|
Revision: 303 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=303&view=rev Author: jenslehmann Date: 2007-12-02 06:41:38 -0800 (Sun, 02 Dec 2007) Log Message: ----------- Fixed more code style problems. (Do not use this.object when object is sufficient.) Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/kb/sparql/ExtractionAlgorithm.java trunk/src/dl-learner/org/dllearner/kb/sparql/InstanceNode.java trunk/src/dl-learner/org/dllearner/kb/sparql/Manager.java trunk/src/dl-learner/org/dllearner/kb/sparql/Manipulator.java trunk/src/dl-learner/org/dllearner/kb/sparql/PropertyNode.java trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryMaker.java trunk/src/dl-learner/org/dllearner/kb/sparql/Tupel.java trunk/src/dl-learner/org/dllearner/kb/sparql/TypedSparqlQuery.java Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/ExtractionAlgorithm.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/ExtractionAlgorithm.java 2007-12-02 14:34:12 UTC (rev 302) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/ExtractionAlgorithm.java 2007-12-02 14:41:38 UTC (rev 303) @@ -37,14 +37,14 @@ System.out.println("StartVector: " + v); // n.expand(tsp, this.Manipulator); // Vector<Node> second= - for (int x = 1; x <= this.recursionDepth; x++) { + for (int x = 1; x <= recursionDepth; x++) { Vector<Node> tmp = new Vector<Node>(); while (v.size() > 0) { Node tmpNode = v.remove(0); System.out.println("Expanding " + tmpNode); //System.out.println(this.Manipulator); - Vector<Node> tmpVec = tmpNode.expand(tsp, this.manipulator); + Vector<Node> tmpVec = tmpNode.expand(tsp, manipulator); tmp.addAll(tmpVec); } @@ -62,7 +62,7 @@ System.out.println(classes.size()); Node next=classes.remove(0); System.out.println(next); - classes.addAll(next.expand(tsp, this.manipulator)); + classes.addAll(next.expand(tsp, manipulator)); } } Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/InstanceNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/InstanceNode.java 2007-12-02 14:34:12 UTC (rev 302) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/InstanceNode.java 2007-12-02 14:41:38 UTC (rev 303) @@ -21,7 +21,7 @@ @Override public Vector<Node> expand(TypedSparqlQuery tsq, Manipulator m) { - Set<Tupel> s = tsq.query(this.uri); + Set<Tupel> s = tsq.query(uri); // Manipulation m.check(s, this); //System.out.println("fffffff"+m); @@ -48,7 +48,7 @@ } } - this.expanded = true; + expanded = true; return Nodes; } @@ -60,15 +60,15 @@ @Override public Set<String> toNTriple() { Set<String> s = new HashSet<String>(); - s.add("<" + this.uri + "><" + "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" + "><" + s.add("<" + uri + "><" + "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" + "><" + "http://www.w3.org/2002/07/owl#Thing" + ">."); for (ClassNode one : classes) { - s.add("<" + this.uri + "><" + "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" + "><" + s.add("<" + uri + "><" + "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" + "><" + one.getURI() + ">."); s.addAll(one.toNTriple()); } for (PropertyNode one : properties) { - s.add("<" + this.uri + "><" + one.getURI() + "><" + one.getB().getURI() + ">."); + s.add("<" + uri + "><" + one.getURI() + "><" + one.getB().getURI() + ">."); s.addAll(one.toNTriple()); s.addAll(one.getB().toNTriple()); } Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/Manager.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/Manager.java 2007-12-02 14:34:12 UTC (rev 302) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/Manager.java 2007-12-02 14:41:38 UTC (rev 303) @@ -35,7 +35,7 @@ // this.TypedSparqlQuery.query(uri); // System.out.println(ExtractionAlgorithm.getFirstNode(uri)); System.out.println("Start extracting"); - Node n = this.extractionAlgorithm.expandNode(uri, this.typedSparqlQuery); + Node n = extractionAlgorithm.expandNode(uri, typedSparqlQuery); Set<String> s = n.toNTriple(); String nt = ""; for (String str : s) { @@ -52,7 +52,7 @@ for (String one : instances) { try { - Node n = this.extractionAlgorithm.expandNode(new URI(one), this.typedSparqlQuery); + Node n = extractionAlgorithm.expandNode(new URI(one), typedSparqlQuery); ret.addAll(n.toNTriple()); } catch (Exception e) { e.printStackTrace(); Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/Manipulator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/Manipulator.java 2007-12-02 14:34:12 UTC (rev 302) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/Manipulator.java 2007-12-02 14:41:38 UTC (rev 303) @@ -34,21 +34,20 @@ while (it.hasNext()) { Tupel t = (Tupel) it.next(); // all classes with owl:type class - if (t.a.equals(this.type) && t.b.equals(this.classns) && node.isClass()) { + if (t.a.equals(type) && t.b.equals(classns) && node.isClass()) { toRemove.add(t); } - ; + // all with type class - if (t.b.equals(this.classns) && node.isClass()) { + if (t.b.equals(classns) && node.isClass()) { toRemove.add(t); } - ; + // all instances with owl:type thing - if (t.a.equals(this.type) && t.b.equals(this.thing) && node.isInstance()) { + if (t.a.equals(type) && t.b.equals(thing) && node.isInstance()) { toRemove.add(t); } - ; - + } s.removeAll(toRemove); Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/PropertyNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/PropertyNode.java 2007-12-02 14:34:12 UTC (rev 302) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/PropertyNode.java 2007-12-02 14:41:38 UTC (rev 303) @@ -28,7 +28,7 @@ @Override public Vector<Node> expand(TypedSparqlQuery tsq, Manipulator m) { - Set<Tupel> s = tsq.query(this.uri); + Set<Tupel> s = tsq.query(uri); Vector<Node> Nodes = new Vector<Node>(); // Manipulation @@ -54,16 +54,16 @@ } public Node getB() { - return this.b; + return b; } @Override public Set<String> toNTriple() { Set<String> s = new HashSet<String>(); - s.add("<" + this.uri + "><" + "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" + "><" + s.add("<" + uri + "><" + "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" + "><" + "http://www.w3.org/2002/07/owl#ObjectProperty" + ">."); for (String one : specialTypes) { - s.add("<" + this.uri + "><" + "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" + "><" + s.add("<" + uri + "><" + "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" + "><" + one + ">."); } Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryMaker.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryMaker.java 2007-12-02 14:34:12 UTC (rev 302) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryMaker.java 2007-12-02 14:41:38 UTC (rev 303) @@ -14,10 +14,10 @@ String Filter = ""; if (!this.sparqlQueryType.isLiterals()) Filter += "!isLiteral(?object))"; - for (String p : this.sparqlQueryType.getPredicatefilterlist()) { + for (String p : sparqlQueryType.getPredicatefilterlist()) { Filter += lineend + filterPredicate(p); } - for (String o : this.sparqlQueryType.getObjectfilterlist()) { + for (String o : sparqlQueryType.getObjectfilterlist()) { Filter += lineend + filterObject(o); } Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/Tupel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/Tupel.java 2007-12-02 14:34:12 UTC (rev 302) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/Tupel.java 2007-12-02 14:41:38 UTC (rev 303) @@ -16,7 +16,7 @@ } public boolean equals(Tupel t) { - if (this.a.equals(t.a) && this.b.equals(t.b)) + if (a.equals(t.a) && b.equals(t.b)) return true; else return false; Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/TypedSparqlQuery.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/TypedSparqlQuery.java 2007-12-02 14:34:12 UTC (rev 302) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/TypedSparqlQuery.java 2007-12-02 14:41:38 UTC (rev 303) @@ -17,13 +17,13 @@ private Configuration configuration; // private SparqlHTTPRequest SparqlHTTPRequest; private SparqlQueryMaker sparqlQueryMaker; - Cache Cache; + Cache cache; public TypedSparqlQuery(Configuration Configuration) { this.configuration = Configuration; // this.SparqlHTTPRequest = new SparqlHTTPRequest(Configuration.getSparqlEndpoint()); this.sparqlQueryMaker = new SparqlQueryMaker(Configuration.getSparqlQueryType()); - this.Cache = new Cache("cache"); + this.cache = new Cache("cache"); } public Set<Tupel> query(URI u) { @@ -32,7 +32,7 @@ String sparql = sparqlQueryMaker.makeQueryUsingFilters(u.toString()); // check cache - String FromCache = this.Cache.get(u.toString(), sparql); + String FromCache = cache.get(u.toString(), sparql); String xml = null; // if not in cache get it from EndPoint @@ -45,7 +45,7 @@ } //System.out.println(sparql); //System.out.println(xml); - this.Cache.put(u.toString(), xml, sparql); + cache.put(u.toString(), xml, sparql); System.out.print("\n"); } else { xml = FromCache; @@ -54,7 +54,7 @@ // System.out.println(xml); // process XML - Set<Tupel> s = this.processResult(xml); + Set<Tupel> s = processResult(xml); try { System.out.println("retrieved " + s.size() + " tupels"); } catch (Exception e) { @@ -115,7 +115,7 @@ Iterator<String> it=s.iterator(); String FullURI=""; while (it.hasNext()) { - String element = (String) it.next(); + String element = it.next(); FullURI+=""+URLEncoder.encode(element, "UTF-8")+"="+ URLEncoder.encode(se.getParameters().get(element), "UTF-8")+"&"; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |