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