From: <sk...@us...> - 2007-10-29 10:36:38
|
Revision: 266 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=266&view=rev Author: sknappe Date: 2007-10-29 03:36:36 -0700 (Mon, 29 Oct 2007) Log Message: ----------- Modified Sparql Classes to work with all functions of ajax version of dbpedia-navigator Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/kb/SparqlEndpoint.java Modified: trunk/src/dl-learner/org/dllearner/kb/SparqlEndpoint.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/SparqlEndpoint.java 2007-10-29 10:30:25 UTC (rev 265) +++ trunk/src/dl-learner/org/dllearner/kb/SparqlEndpoint.java 2007-10-29 10:36:36 UTC (rev 266) @@ -55,7 +55,8 @@ * @author Sebastian Knappe */ public class SparqlEndpoint extends KnowledgeSource { - + + //ConfigOptions private URL url; private Set<String> instances; private URL dumpFile; @@ -64,16 +65,25 @@ private Set<String> predList; private Set<String> objList; private Set<String> classList; - private KB kb; private String format; private boolean dumpToFile; private boolean useLits=false; + + //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 + private KB kb; + public static String getName() { return "SPARQL Endpoint"; } - + + /** + * sets the ConfigOptions for this KnowledgeSource + * @return + */ public static Collection<ConfigOption<?>> createConfigOptions() { Collection<ConfigOption<?>> options = new LinkedList<ConfigOption<?>>(); options.add(new StringConfigOption("url", "URL of SPARQL Endpoint")); @@ -130,16 +140,9 @@ @Override public void init() { System.out.println("SparqlModul: Collecting Ontology"); - String[] a=new String[0]; - SparqlOntologyCollector oc=new SparqlOntologyCollector(instances.toArray(a), numberOfRecursions, - filterMode, Datastructures.setToArray(predList),Datastructures.setToArray( objList),Datastructures.setToArray(classList),format,url,useLits); - String ont=""; - if (format.equals("Array")){ - ontArray=oc.collectOntologyAsArray(); - } - else{ - ont=oc.collectOntology(); - } + SparqlOntologyCollector oc=new SparqlOntologyCollector(Datastructures.setToArray(instances), numberOfRecursions, filterMode, + Datastructures.setToArray(predList),Datastructures.setToArray( objList),Datastructures.setToArray(classList),format,url,useLits); + String ont=oc.collectOntology(); if (dumpToFile){ String filename=System.currentTimeMillis()+".nt"; @@ -196,9 +199,18 @@ public String[] getSubjects(String label,int limit) { System.out.println("SparqlModul: Collecting Subjects"); - SparqlOntologyCollector oc=new SparqlOntologyCollector(null, 1,0,null,null,null,null,url,false); + SparqlOntologyCollector oc=new SparqlOntologyCollector(url); String[] ret=oc.getSubjectsFromLabel(label,limit); System.out.println("SparqlModul: ****Finished"); return ret; } + + public String[] getTriples(){ + System.out.println("SparqlModul: Collecting Triples"); + SparqlOntologyCollector oc=new SparqlOntologyCollector(Datastructures.setToArray(instances), numberOfRecursions, filterMode, + Datastructures.setToArray(predList),Datastructures.setToArray( objList),Datastructures.setToArray(classList),format,url,useLits); + String[] ret=oc.collectTriples(); + System.out.println("SparqlModul: ****Finished"); + return ret; + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |