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: <lor...@us...> - 2011-11-16 12:55:55
|
Revision: 3407 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3407&view=rev Author: lorenz_b Date: 2011-11-16 12:55:46 +0000 (Wed, 16 Nov 2011) Log Message: ----------- Small fix in algorithm. Modified Paths: -------------- trunk/components-core/src/main/java/org/dllearner/algorithms/DisjointClassesLearner.java Modified: trunk/components-core/src/main/java/org/dllearner/algorithms/DisjointClassesLearner.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/algorithms/DisjointClassesLearner.java 2011-11-16 10:03:47 UTC (rev 3406) +++ trunk/components-core/src/main/java/org/dllearner/algorithms/DisjointClassesLearner.java 2011-11-16 12:55:46 UTC (rev 3407) @@ -19,7 +19,9 @@ package org.dllearner.algorithms; +import java.net.URL; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -186,6 +188,14 @@ Set<NamedClass> completeDisjointclasses = new TreeSet<NamedClass>(allClasses); completeDisjointclasses.removeAll(class2Count.keySet()); + //we remove the asserted sublcasses here + if(reasoner.isPrepared()){ + completeDisjointclasses.removeAll(reasoner.getClassHierarchy().getSubClasses(classToDescribe)); + } else { + completeDisjointclasses.removeAll(reasoner.getSubClasses(classToDescribe)); + } + + EvaluatedDescription evalDesc; //firstly, create disjoint classexpressions which not occur and give score of 1 if(reasoner.isPrepared()){ @@ -208,12 +218,13 @@ } public static void main(String[] args) throws Exception{ - DisjointClassesLearner l = new DisjointClassesLearner(new SparqlEndpointKS(SparqlEndpoint.getEndpointDBpedia())); - l.setClassToDescribe(new NamedClass("http://dbpedia.org/ontology/SoccerClub")); + DisjointClassesLearner l = new DisjointClassesLearner(new SparqlEndpointKS(new SparqlEndpoint(new URL("http://dbpedia.aksw.org:8902/sparql"), + Collections.singletonList("http://dbpedia.org"), Collections.<String>emptyList()))); + l.setClassToDescribe(new NamedClass("http://dbpedia.org/ontology/ChemicalSubstance")); l.init(); l.start(); - for(EvaluatedAxiom e : l.getCurrentlyBestEvaluatedAxioms(50)){ + for(EvaluatedAxiom e : l.getCurrentlyBestEvaluatedAxioms(Integer.MAX_VALUE, 0.75)){ System.out.println(e); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2011-11-16 10:03:54
|
Revision: 3406 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3406&view=rev Author: jenslehmann Date: 2011-11-16 10:03:47 +0000 (Wed, 16 Nov 2011) Log Message: ----------- several changes to get closer to get fuzzy DL working Modified Paths: -------------- trunk/components-core/src/main/java/org/dllearner/algorithms/fuzzydll/FuzzyCELOE.java trunk/components-core/src/main/java/org/dllearner/core/AnnComponentManager.java trunk/components-core/src/main/java/org/dllearner/learningproblems/FuzzyPosNegLPStandard.java trunk/components-core/src/main/java/org/dllearner/reasoning/fuzzydll/FuzzyOWLAPIReasoner.java Added Paths: ----------- trunk/test/fuzzydll/fuzzytrains.conf Modified: trunk/components-core/src/main/java/org/dllearner/algorithms/fuzzydll/FuzzyCELOE.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/algorithms/fuzzydll/FuzzyCELOE.java 2011-11-15 20:14:39 UTC (rev 3405) +++ trunk/components-core/src/main/java/org/dllearner/algorithms/fuzzydll/FuzzyCELOE.java 2011-11-16 10:03:47 UTC (rev 3406) @@ -34,6 +34,7 @@ import org.dllearner.core.AbstractCELA; import org.dllearner.core.AbstractLearningProblem; import org.dllearner.core.AbstractReasonerComponent; +import org.dllearner.core.ComponentAnn; import org.dllearner.core.ComponentInitException; import org.dllearner.core.EvaluatedDescription; import org.dllearner.core.FuzzyClassExpressionLearningAlgorithm; @@ -78,6 +79,7 @@ * @author Jens Lehmann * */ +@ComponentAnn(name="Fuzzy CELOE", shortName="fceloe", version=0.2, description="See Fuzzy DL-Learner paper published at ISDA 2011.") public class FuzzyCELOE extends AbstractCELA implements FuzzyClassExpressionLearningAlgorithm { private static Logger logger = Logger.getLogger(FuzzyCELOE.class); Modified: trunk/components-core/src/main/java/org/dllearner/core/AnnComponentManager.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/core/AnnComponentManager.java 2011-11-15 20:14:39 UTC (rev 3405) +++ trunk/components-core/src/main/java/org/dllearner/core/AnnComponentManager.java 2011-11-16 10:03:47 UTC (rev 3406) @@ -50,7 +50,8 @@ // components must be listed here if they should be supported in interfaces // (CLI, GUI, Web Service) and scripts (HTML documentation generator) private static List<String> componentClassNames = new ArrayList<String> ( Arrays.asList(new String[]{ - "org.dllearner.algorithms.celoe.CELOE", + "org.dllearner.algorithms.celoe.CELOE", + "org.dllearner.algorithms.fuzzydll.FuzzyCELOE", "org.dllearner.algorithms.BruteForceLearner", "org.dllearner.algorithms.RandomGuesser", "org.dllearner.algorithms.properties.DisjointObjectPropertyAxiomLearner", @@ -76,10 +77,12 @@ "org.dllearner.kb.SparqlEndpointKS", "org.dllearner.kb.sparql.SparqlKnowledgeSource", "org.dllearner.learningproblems.PosNegLPStandard", + "org.dllearner.learningproblems.FuzzyPosNegLPStandard", "org.dllearner.learningproblems.PosOnlyLP", "org.dllearner.learningproblems.ClassLearningProblem", "org.dllearner.reasoning.FastInstanceChecker", "org.dllearner.reasoning.OWLAPIReasoner", + "org.dllearner.reasoning.fuzzydll.FuzzyOWLAPIReasoner", "org.dllearner.algorithms.ocel.OCEL", "org.dllearner.algorithms.ocel.MultiHeuristic", "org.dllearner.refinementoperators.RhoDRDown", Modified: trunk/components-core/src/main/java/org/dllearner/learningproblems/FuzzyPosNegLPStandard.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/learningproblems/FuzzyPosNegLPStandard.java 2011-11-15 20:14:39 UTC (rev 3405) +++ trunk/components-core/src/main/java/org/dllearner/learningproblems/FuzzyPosNegLPStandard.java 2011-11-16 10:03:47 UTC (rev 3406) @@ -27,6 +27,7 @@ import java.util.TreeSet; import org.dllearner.core.AbstractReasonerComponent; +import org.dllearner.core.ComponentAnn; import org.dllearner.core.EvaluatedDescription; import org.dllearner.core.fuzzydll.FuzzyUnsupportedCodeException; import org.dllearner.core.options.BooleanConfigOption; @@ -52,6 +53,7 @@ * @author Jens Lehmann * */ +@ComponentAnn(name = "FuzzyPosNegLPStandard", shortName = "fuzzyPosNeg", version = 0.2) public class FuzzyPosNegLPStandard extends FuzzyPosNegLP { // approximation and F-measure Modified: trunk/components-core/src/main/java/org/dllearner/reasoning/fuzzydll/FuzzyOWLAPIReasoner.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/reasoning/fuzzydll/FuzzyOWLAPIReasoner.java 2011-11-15 20:14:39 UTC (rev 3405) +++ trunk/components-core/src/main/java/org/dllearner/reasoning/fuzzydll/FuzzyOWLAPIReasoner.java 2011-11-16 10:03:47 UTC (rev 3406) @@ -41,6 +41,7 @@ import org.dllearner.core.AbstractKnowledgeSource; import org.dllearner.core.AbstractReasonerComponent; +import org.dllearner.core.ComponentAnn; import org.dllearner.core.ComponentInitException; import org.dllearner.core.options.ConfigEntry; import org.dllearner.core.options.ConfigOption; @@ -128,6 +129,7 @@ * @author Jens Lehmann * */ +@ComponentAnn(name = "Fuzzy OWL API Reasoner", shortName = "foar", version = 0.2) public class FuzzyOWLAPIReasoner extends AbstractReasonerComponent { // private static Logger logger = Logger @@ -172,6 +174,10 @@ private int reasonersComparationDisparityCounter = 0; private URL owlLinkURL; + public FuzzyOWLAPIReasoner() { + + } + public FuzzyOWLAPIReasoner(Set<AbstractKnowledgeSource> sources) { super(sources); } Added: trunk/test/fuzzydll/fuzzytrains.conf =================================================================== --- trunk/test/fuzzydll/fuzzytrains.conf (rev 0) +++ trunk/test/fuzzydll/fuzzytrains.conf 2011-11-16 10:03:47 UTC (rev 3406) @@ -0,0 +1,24 @@ +/** + * Fuzzy Trains Example + * + * Copyright (C) 2011, Josué Iglesias, Jens Lehmann + */ + +// declare some prefixes to use as abbreviations +prefixes = [ ("ex","http://www.example.com/fuzzyTrains.owl#") ] + +// knowledge source definition +ks.type = "OWL File" +ks.fileName = "fuzzyTrains_v5.0.owl" + +// reasoner +reasoner.type = "Fuzzy OWL API Reasoner" +reasoner.sources = { ks } + +// learning problem +lp.type = "fuzzyPosNeg" +lp.positiveExamples = { "ex:east1", "ex:east2" } +lp.negativeExamples = { "ex:west6", "ex:west7" } + +// create learning algorithm to run +alg.type = "Fuzzy CELOE" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lor...@us...> - 2011-11-15 20:14:46
|
Revision: 3405 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3405&view=rev Author: lorenz_b Date: 2011-11-15 20:14:39 +0000 (Tue, 15 Nov 2011) Log Message: ----------- Added workaround for CELOE for the case that the class is empty, e.g. also not found by the reasoner which will cause a ComponentInitException. Modified Paths: -------------- trunk/interfaces/src/main/java/org/dllearner/cli/Enrichment.java Modified: trunk/interfaces/src/main/java/org/dllearner/cli/Enrichment.java =================================================================== --- trunk/interfaces/src/main/java/org/dllearner/cli/Enrichment.java 2011-11-15 14:36:34 UTC (rev 3404) +++ trunk/interfaces/src/main/java/org/dllearner/cli/Enrichment.java 2011-11-15 20:14:39 UTC (rev 3405) @@ -39,6 +39,7 @@ import java.security.SecureRandom; import java.text.DecimalFormat; import java.util.ArrayList; +import java.util.Collections; import java.util.HashSet; import java.util.LinkedList; import java.util.List; @@ -283,7 +284,11 @@ Set<NamedClass> classes = st.getAllClasses(); int entities = 0; for(NamedClass nc : classes) { - runClassLearningAlgorithms(ks, nc); + try { + runClassLearningAlgorithms(ks, nc); + } catch (Exception e) { + e.printStackTrace(); + } entities++; if(maxEntitiesPerType != -1 && entities > maxEntitiesPerType) { break; @@ -355,6 +360,10 @@ // get instances of class as positive examples SPARQLReasoner sr = new SPARQLReasoner(ks); SortedSet<Individual> posExamples = sr.getIndividuals(nc, 20); + if(posExamples.isEmpty()){ + System.out.println("Skipping CELOE because class " + nc.toString() + " is empty."); + return Collections.emptyList(); + } SortedSet<String> posExStr = Helper.getStringSet(posExamples); // use own implementation of negative example finder This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lor...@us...> - 2011-11-15 14:36:45
|
Revision: 3404 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3404&view=rev Author: lorenz_b Date: 2011-11-15 14:36:34 +0000 (Tue, 15 Nov 2011) Log Message: ----------- Changed script. Modified Paths: -------------- trunk/interfaces/src/main/java/org/dllearner/cli/Enrichment.java Modified: trunk/interfaces/src/main/java/org/dllearner/cli/Enrichment.java =================================================================== --- trunk/interfaces/src/main/java/org/dllearner/cli/Enrichment.java 2011-11-14 22:08:32 UTC (rev 3403) +++ trunk/interfaces/src/main/java/org/dllearner/cli/Enrichment.java 2011-11-15 14:36:34 UTC (rev 3404) @@ -23,6 +23,7 @@ import java.io.BufferedOutputStream; import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; @@ -218,11 +219,12 @@ private Set<OWLAxiom> learnedOWLAxioms; - public Enrichment(SparqlEndpoint se, Entity resource, double threshold, boolean useInference, boolean verbose) { + public Enrichment(SparqlEndpoint se, Entity resource, double threshold, int nrOfAxiomsToLearn, boolean useInference, boolean verbose) { this.se = se; this.resource = resource; this.verbose = verbose; this.threshold = threshold; + this.nrOfAxiomsToLearn = nrOfAxiomsToLearn; this.useInference = useInference; objectPropertyAlgorithms = new LinkedList<Class<? extends AxiomLearningAlgorithm>>(); @@ -722,6 +724,9 @@ parser.acceptsAll(asList("t", "threshold"), "Confidence threshold for suggestions. Set it to a value between 0 and 1.").withOptionalArg() .ofType(Double.class).defaultsTo(0.7); + parser.acceptsAll(asList("l", "limit"), + "Maximum number of returned axioms per axiom type. Set it to -1 if all axioms above the threshold should be returned.").withOptionalArg() + .ofType(Integer.class).defaultsTo(10); parser.acceptsAll(asList("i", "inference"), "Specifies whether to use inference. If yes, the schema will be loaded into a reasoner and used for computing the scores.").withOptionalArg().ofType(Boolean.class).defaultsTo(true); parser.acceptsAll(asList("s", "serialize"), "Specify a file where the ontology with all axioms can be written.") @@ -806,6 +811,10 @@ boolean useInference = (Boolean) options.valueOf("i"); // boolean verbose = (Boolean) options.valueOf("v"); double threshold = (Double) options.valueOf("t"); + int maxNrOfResults = (Integer) options.valueOf("l"); + if(maxNrOfResults == -1){ + maxNrOfResults = Integer.MAX_VALUE; + } // TODO: some handling for inaccessible files or overwriting existing files File f = (File) options.valueOf("o"); @@ -816,7 +825,7 @@ System.setOut(printStream); } - Enrichment e = new Enrichment(se, resource, threshold, useInference, false); + Enrichment e = new Enrichment(se, resource, threshold, maxNrOfResults, useInference, false); e.start(); SparqlEndpointKS ks = new SparqlEndpointKS(se); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lor...@us...> - 2011-11-14 22:08:38
|
Revision: 3403 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3403&view=rev Author: lorenz_b Date: 2011-11-14 22:08:32 +0000 (Mon, 14 Nov 2011) Log Message: ----------- Added template serialization test. Added Paths: ----------- trunk/components-ext/src/test/java/org/dllearner/algorithm/tbsl/TemplateSerializationTest.java Added: trunk/components-ext/src/test/java/org/dllearner/algorithm/tbsl/TemplateSerializationTest.java =================================================================== --- trunk/components-ext/src/test/java/org/dllearner/algorithm/tbsl/TemplateSerializationTest.java (rev 0) +++ trunk/components-ext/src/test/java/org/dllearner/algorithm/tbsl/TemplateSerializationTest.java 2011-11-14 22:08:32 UTC (rev 3403) @@ -0,0 +1,41 @@ +package org.dllearner.algorithm.tbsl; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.util.Set; + +import org.dllearner.algorithm.tbsl.sparql.Template; +import org.dllearner.algorithm.tbsl.templator.Templator; + +public class TemplateSerializationTest { + + /** + * @param args + */ + public static void main(String[] args) throws Exception{ + Templator templateGenerator = new Templator(); + templateGenerator.setUNTAGGED_INPUT(true); + + //generate templates + Set<Template> templates = templateGenerator.buildTemplates("Give me all soccer clubs in Premier League."); + for(Template t : templates){ + System.out.println(t); + } + + //serialize + ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(new File("templates.out"))); + oos.writeObject(templates); + + //deserialize + ObjectInputStream ois = new ObjectInputStream(new FileInputStream(new File("templates.out"))); + templates = (Set<Template>) ois.readObject(); + + for(Template t : templates){ + System.out.println(t); + } + } + +} Property changes on: trunk/components-ext/src/test/java/org/dllearner/algorithm/tbsl/TemplateSerializationTest.java ___________________________________________________________________ Added: svn:mime-type + text/plain This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lor...@us...> - 2011-11-14 16:29:31
|
Revision: 3402 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3402&view=rev Author: lorenz_b Date: 2011-11-14 16:29:24 +0000 (Mon, 14 Nov 2011) Log Message: ----------- Made templates serializable. Modified Paths: -------------- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/Query.java trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/SPARQL_Filter.java trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/SPARQL_Pair.java trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/SPARQL_Prefix.java trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/SPARQL_Term.java trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/SPARQL_Triple.java trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/SPARQL_Value.java trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/Slot.java trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/Template.java Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/Query.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/Query.java 2011-11-14 14:19:28 UTC (rev 3401) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/Query.java 2011-11-14 16:29:24 UTC (rev 3402) @@ -1,13 +1,14 @@ package org.dllearner.algorithm.tbsl.sparql; +import java.io.Serializable; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; -public class Query -{ - +public class Query implements Serializable { + + private static final long serialVersionUID = 6040368736352575802L; Set<SPARQL_Term> selTerms; // SELECT ?x ?y Set<SPARQL_Prefix> prefixes; Set<SPARQL_Triple> conditions; Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/SPARQL_Filter.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/SPARQL_Filter.java 2011-11-14 14:19:28 UTC (rev 3401) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/SPARQL_Filter.java 2011-11-14 16:29:24 UTC (rev 3402) @@ -1,11 +1,13 @@ package org.dllearner.algorithm.tbsl.sparql; +import java.io.Serializable; import java.util.HashSet; import java.util.Set; -public class SPARQL_Filter +public class SPARQL_Filter implements Serializable { - + private static final long serialVersionUID = -6243542586884540703L; + private Set<SPARQL_Pair> terms = new HashSet<SPARQL_Pair>(); private boolean and = true; Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/SPARQL_Pair.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/SPARQL_Pair.java 2011-11-14 14:19:28 UTC (rev 3401) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/SPARQL_Pair.java 2011-11-14 16:29:24 UTC (rev 3402) @@ -1,7 +1,11 @@ package org.dllearner.algorithm.tbsl.sparql; -public class SPARQL_Pair +import java.io.Serializable; + +public class SPARQL_Pair implements Serializable { + private static final long serialVersionUID = -1255754209857823420L; + public SPARQL_Term a; public Object b; Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/SPARQL_Prefix.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/SPARQL_Prefix.java 2011-11-14 14:19:28 UTC (rev 3401) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/SPARQL_Prefix.java 2011-11-14 16:29:24 UTC (rev 3402) @@ -1,7 +1,11 @@ package org.dllearner.algorithm.tbsl.sparql; -public class SPARQL_Prefix { +import java.io.Serializable; + +public class SPARQL_Prefix implements Serializable{ + private static final long serialVersionUID = 1971250768286898228L; + private String name; private String url; Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/SPARQL_Term.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/SPARQL_Term.java 2011-11-14 14:19:28 UTC (rev 3401) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/SPARQL_Term.java 2011-11-14 16:29:24 UTC (rev 3402) @@ -1,12 +1,15 @@ package org.dllearner.algorithm.tbsl.sparql; +import java.io.Serializable; + import org.dllearner.algorithm.tbsl.sparql.SPARQL_Aggregate; import org.dllearner.algorithm.tbsl.sparql.SPARQL_OrderBy; import org.dllearner.algorithm.tbsl.sparql.SPARQL_Term; import org.dllearner.algorithm.tbsl.sparql.SPARQL_Value; -public class SPARQL_Term extends SPARQL_Value { +public class SPARQL_Term extends SPARQL_Value{ + SPARQL_OrderBy orderBy = SPARQL_OrderBy.NONE; SPARQL_Aggregate aggregate = SPARQL_Aggregate.NONE; boolean isURI = false; Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/SPARQL_Triple.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/SPARQL_Triple.java 2011-11-14 14:19:28 UTC (rev 3401) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/SPARQL_Triple.java 2011-11-14 16:29:24 UTC (rev 3402) @@ -1,6 +1,11 @@ package org.dllearner.algorithm.tbsl.sparql; -public class SPARQL_Triple { +import java.io.Serializable; + +public class SPARQL_Triple implements Serializable{ + + private static final long serialVersionUID = -1681019680404287955L; + SPARQL_Term variable = new SPARQL_Term(""); SPARQL_Property property = new SPARQL_Property(""); SPARQL_Value value = new SPARQL_Value(); Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/SPARQL_Value.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/SPARQL_Value.java 2011-11-14 14:19:28 UTC (rev 3401) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/SPARQL_Value.java 2011-11-14 16:29:24 UTC (rev 3402) @@ -1,6 +1,11 @@ package org.dllearner.algorithm.tbsl.sparql; -public class SPARQL_Value { +import java.io.Serializable; + +public class SPARQL_Value implements Serializable{ + + private static final long serialVersionUID = -3733491240975566183L; + protected String name; private boolean isVariable = false; Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/Slot.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/Slot.java 2011-11-14 14:19:28 UTC (rev 3401) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/Slot.java 2011-11-14 16:29:24 UTC (rev 3402) @@ -1,11 +1,14 @@ package org.dllearner.algorithm.tbsl.sparql; +import java.io.Serializable; import java.util.ArrayList; import java.util.Iterator; import java.util.List; -public class Slot { +public class Slot implements Serializable{ + private static final long serialVersionUID = 8672756914248710435L; + String anchor; String token; SlotType type; Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/Template.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/Template.java 2011-11-14 14:19:28 UTC (rev 3401) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/Template.java 2011-11-14 16:29:24 UTC (rev 3402) @@ -1,10 +1,13 @@ package org.dllearner.algorithm.tbsl.sparql; +import java.io.Serializable; import java.util.ArrayList; import java.util.List; -public class Template { +public class Template implements Serializable{ + private static final long serialVersionUID = -3925093269596915997L; + Query query; List<Slot> slots; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <km...@us...> - 2011-11-14 14:19:35
|
Revision: 3401 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3401&view=rev Author: kmpf Date: 2011-11-14 14:19:28 +0000 (Mon, 14 Nov 2011) Log Message: ----------- Tested bug fix for .arff file creation Modified Paths: -------------- trunk/scripts/src/main/java/org/dllearner/examples/pdb/PDBIdRdfModel.java Modified: trunk/scripts/src/main/java/org/dllearner/examples/pdb/PDBIdRdfModel.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/examples/pdb/PDBIdRdfModel.java 2011-11-14 10:56:41 UTC (rev 3400) +++ trunk/scripts/src/main/java/org/dllearner/examples/pdb/PDBIdRdfModel.java 2011-11-14 14:19:28 UTC (rev 3401) @@ -22,6 +22,7 @@ import com.hp.hpl.jena.query.QueryExecution; import com.hp.hpl.jena.query.QueryExecutionFactory; import com.hp.hpl.jena.query.QueryFactory; +import com.hp.hpl.jena.rdf.model.Literal; import com.hp.hpl.jena.rdf.model.NodeIterator; import com.hp.hpl.jena.rdf.model.Property; import com.hp.hpl.jena.rdf.model.RDFNode; @@ -206,6 +207,7 @@ "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> " + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> " + "PREFIX fn: <http://www.w3.org/2005/xpath-functions#> " + + "PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> " + "CONSTRUCT { ?x1 pdb:beginsAt ?x2 ." + " ?x1 pdb:endsAt ?x3 ." + " ?x5 dcterms:isPartOf ?x4 ." + @@ -213,6 +215,7 @@ " ?x5 pdb:isImmediatelyBefore ?x7 ." + " ?x5 pdb:hasChainPosition ?x8 ." + " ?x8 rdfs:label ?residuePosition ." + + " ?x8 pdb:hasValue ?x9 ." + " ?organism rdfs:label ?organismName ." + " ?seq rdf:type pdb:PolymerSequence ." + " ?seq pdb:hasValue ?sequence . } " + @@ -223,11 +226,12 @@ " ?x4 rdf:type <http://bio2rdf.org/pdb:Polypeptide(L)> ." + " ?x5 dcterms:isPartOf ?x4 ." + " ?x5 rdf:type ?x6 ." + + // with the optional clause i get the information by which amino acid + // a amino acid is followed + " OPTIONAL { ?x5 pdb:isImmediatelyBefore ?x7 . } . " + " ?x5 pdb:hasChainPosition ?x8 ." + - " ?x8 dcterms:isPartOf ?x4 ." + " ?x8 rdfs:label ?residuePosition ." + - " OPTIONAL { ?x5 pdb:isImmediatelyBefore ?x7 . } . "; - + " ?x8 pdb:hasValue ?x9 Filter (xsd:int(?x9)) ."; if (chainID.length() == 1 && pdbID.length() == 4) { queryString += @@ -239,8 +243,6 @@ " ?x4 pdb:hasPolymerSequence ?seq . " + " ?seq rdf:type pdb:PolymerSequence . " + " ?seq pdb:hasValue ?sequence . " + - // with the Optional clause i get the information by which amino acid - // a amino acid is followed " OPTIONAL { ?organism rdfs:label ?organismName " + "FILTER (str(?organism) = fn:concat(str(?x4), '/extraction/source/gene/organism')) . } . }"; @@ -283,13 +285,12 @@ ResIterator firstAAs = this.getFirstAA(); while ( firstAAs.hasNext()){ Resource firstAA = firstAAs.next(); - Resource nextAA = firstAA; Resource currentAA = firstAA; - do { - currentAA = nextAA; + posres.put(new Integer(this.getResiduePosition(currentAA)), currentAA); + while (currentAA.hasProperty(iib)) { + currentAA = _pdbIdModel.getProperty(currentAA, iib).getResource(); posres.put(new Integer(this.getResiduePosition(currentAA)), currentAA); - nextAA = _pdbIdModel.getProperty(currentAA, iib).getResource(); - } while (currentAA.hasProperty(iib)); + } } return posres; @@ -297,18 +298,18 @@ private int getResiduePosition(Resource res) { Property hasChainPosition = ResourceFactory.createProperty("http://bio2rdf.org/pdb:", "hasChainPosition"); - Property label = ResourceFactory.createProperty("http://www.w3.org/2000/01/rdf-schema#", "label"); + Property hasValue = ResourceFactory.createProperty("http://bio2rdf.org/pdb:", "hasValue"); ResourceFactory.createResource(); NodeIterator residuePosition = _pdbIdModel.listObjectsOfProperty(res, hasChainPosition ); ArrayList<RDFNode> positionNodes = new ArrayList<RDFNode>(); - ArrayList<String> positionLabels = new ArrayList<String>(); + ArrayList<Integer> positionLabels = new ArrayList<Integer>(); while ( residuePosition.hasNext() ) { RDFNode positionNode = residuePosition.next(); positionNodes.add(positionNode); - NodeIterator positionLabelNodes = _pdbIdModel.listObjectsOfProperty( positionNode.asResource(), label ); + NodeIterator positionLabelNodes = _pdbIdModel.listObjectsOfProperty( positionNode.asResource(), hasValue ); while ( positionLabelNodes.hasNext() ) { - positionLabels.add(positionLabelNodes.next().toString()); + positionLabels.add(positionLabelNodes.next().asLiteral().getInt()); } } @@ -316,11 +317,7 @@ Integer position = null; if ( positionNodes.size() == 1 && positionLabels.size() == 1 ) { - String positionLabel = positionLabels.get(0); - String a = new String( "Position " ); - String b = new String( " on chain" ); - position = Integer.parseInt( - positionLabel.substring(positionLabel.indexOf(a) + a.length(), positionLabel.indexOf(b))); + position = positionLabels.get(0); } else { position = new Integer(0); _logger.error(""); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2011-11-14 10:56:48
|
Revision: 3400 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3400&view=rev Author: christinaunger Date: 2011-11-14 10:56:41 +0000 (Mon, 14 Nov 2011) Log Message: ----------- [tbsl] enabled parsing of NERs enclodes in "..." and of genitives (...'s) Modified Paths: -------------- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/ltag/parser/GrammarFilter.java trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/ltag/parser/Parser.java trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/ltag/parser/Preprocessor.java trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/templator/SlotBuilder.java trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/templator/Templator.java Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/ltag/parser/GrammarFilter.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/ltag/parser/GrammarFilter.java 2011-11-12 23:10:28 UTC (rev 3399) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/ltag/parser/GrammarFilter.java 2011-11-14 10:56:41 UTC (rev 3400) @@ -33,6 +33,8 @@ static List<Integer> usedInts = new ArrayList<Integer>(); static ArrayList<String> doubles = new ArrayList<String>(); + public static boolean VERBOSE = true; + static ParseGrammar filter(String taggedinput,LTAGLexicon grammar,List<Integer> temps, String mode) { // DISAM: CLEAR @@ -191,7 +193,7 @@ start++; } - logger.trace("\ncovered tokens: " + coveredTokens); + if (VERBOSE) logger.trace("\ncovered tokens: " + coveredTokens); /* construct slots for all unknown tokens */ @@ -211,7 +213,7 @@ } } } - logger.trace("unknown words: " + unknownWords); + if (VERBOSE) logger.trace("unknown words: " + unknownWords); List<Pair<String,String>> buildSlotFor = new ArrayList<Pair<String,String>>(); @@ -238,7 +240,7 @@ System.out.println("Oh no, " + s + " has no POS tag!"); } } - logger.trace("build slot for: " + buildSlotFor + "\n"); + if (VERBOSE) logger.trace("build slot for: " + buildSlotFor + "\n"); List<String[]> entries; if (mode.equals("LEIPZIG")) { Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/ltag/parser/Parser.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/ltag/parser/Parser.java 2011-11-12 23:10:28 UTC (rev 3399) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/ltag/parser/Parser.java 2011-11-14 10:56:41 UTC (rev 3400) @@ -18,6 +18,7 @@ public boolean USE_LESS_MEMORY = false; public boolean SHOW_GRAMMAR = false; public boolean SHOW_LEXICAL_COVERAGE = false; + public boolean VERBOSE = true; public String MODE = "BASIC"; // MODE ::= BASIC | LEIPZIG (set by Templator and BasicTemplator) private String[] input; @@ -50,6 +51,8 @@ derivedTrees.clear(); dudes.clear(); temporaryEntries.clear(); + + if (!VERBOSE) GrammarFilter.VERBOSE = false; /* * create a local copy of the grammar with own treeIDs. This is @@ -64,7 +67,7 @@ inputNoTags += s.substring(0,s.indexOf("/")) + " "; } - this.input = ("# ".concat(inputNoTags.trim())).split(" "); + this.input = ("# ".concat(inputNoTags.replaceAll("'","").trim())).split(" "); int n = this.input.length; @@ -84,7 +87,7 @@ internalParse(parseGrammar.getDPInitTrees(), n); } - logger.trace("Constructed " + derivationTrees.size() + " derivation trees.\n"); + if (VERBOSE) logger.trace("Constructed " + derivationTrees.size() + " derivation trees.\n"); return derivationTrees; } Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/ltag/parser/Preprocessor.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/ltag/parser/Preprocessor.java 2011-11-12 23:10:28 UTC (rev 3399) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/ltag/parser/Preprocessor.java 2011-11-14 10:56:41 UTC (rev 3400) @@ -16,19 +16,25 @@ private static final Logger logger = Logger.getLogger(Preprocessor.class); - static final String[] genericReplacements = { "\"", "", "'", "", "[!?.,;]", "" }; + static final String[] genericReplacements = { "[!?.,;]", "" }; static final String[] englishReplacements = { "don't", "do not", "doesn't", "does not" }; static boolean USE_NER; + static boolean VERBOSE; static NER ner; public Preprocessor(boolean n) { USE_NER = n; + VERBOSE = true; if (USE_NER) { // ner = new LingPipeNER(true); //not case sensitive best solution? ner = new DBpediaSpotlightNER(); } } + public void setVERBOSE(boolean b) { + VERBOSE = b; + } + public String normalize(String s) { return normalize(s, new String[0]); } @@ -58,7 +64,7 @@ * nn/RBR of/IN > nn/NPREP * usw. * */ - String condensedstring = taggedstring; + String condensedstring = taggedstring.replaceAll("``/``","").replaceAll("''/''","").replaceAll(" "," "); Matcher m; Pattern compAdjPattern = Pattern.compile("(\\w+/RBR.(\\w+)/JJ)"); @@ -89,7 +95,7 @@ m = compAdjPattern.matcher(condensedstring); while (m.find()) { - logger.trace("Replacing " + m.group(1) + " by " + m.group(2)+"/JJR"); + if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by " + m.group(2)+"/JJR"); condensedstring = condensedstring.replaceFirst(m.group(1),m.group(2)+"/JJR"); } // m = superAdjPattern.matcher(condensedstring); @@ -99,57 +105,57 @@ // } m = howManyPattern.matcher(condensedstring); while (m.find()) { - logger.trace("Replacing " + m.group(1) + " by how/WLEX many/WLEX"); + if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by how/WLEX many/WLEX"); condensedstring = condensedstring.replaceFirst(m.group(1),"how/WLEX many/WLEX"); } m = howAdjPattern.matcher(condensedstring); while (m.find()) { - logger.trace("Replacing " + m.group(1) + " by " + m.group(2)+"/JJH"); + if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by " + m.group(2)+"/JJH"); condensedstring = condensedstring.replaceFirst(m.group(1),m.group(2)+"/JJH"); } m = thesameasPattern.matcher(condensedstring); while (m.find()) { - logger.trace("Replacing " + m.group(1) + " by " + m.group(2)+"/NNSAME"); + if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by " + m.group(2)+"/NNSAME"); condensedstring = condensedstring.replaceFirst(m.group(1),m.group(2)+"/NNSAME"); } m = nprepPattern.matcher(condensedstring); while (m.find()) { - logger.trace("Replacing " + m.group(1) + " by " + m.group(2)+"/NPREP"); + if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by " + m.group(2)+"/NPREP"); condensedstring = condensedstring.replaceFirst(m.group(1),m.group(2)+"/NPREP"); } m = didPattern.matcher(condensedstring); while (m.find()) { - logger.trace("Replacing " + m.group(1) + " by \"\""); + if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by \"\""); condensedstring = condensedstring.replaceFirst(m.group(1),""); } m = prepfrontPattern.matcher(condensedstring); while (m.find()) { - logger.trace("Replacing " + m.group(1) + " by \"\""); + if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by \"\""); condensedstring = condensedstring.replaceFirst(m.group(1),""); } m = passivePattern1a.matcher(condensedstring); while (m.find()) { - logger.trace("Replacing " + m.group(1) + " by " + m.group(6)+"/PASSIVE"); + if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by " + m.group(6)+"/PASSIVE"); condensedstring = condensedstring.replaceFirst(m.group(1),m.group(6)+"/PASSIVE"); } m = passivePattern1b.matcher(condensedstring); while (m.find()) { - logger.trace("Replacing " + m.group(1) + " by " + m.group(6)+m.group(7)+"/PASSIVE"); + if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by " + m.group(6)+m.group(7)+"/PASSIVE"); condensedstring = condensedstring.replaceFirst(m.group(1),m.group(6) + m.group(7)+"/PASSIVE"); } m = passivePattern2a.matcher(condensedstring); while (m.find()) { - logger.trace("Replacing " + m.group(1) + " by " + m.group(7)+"/PASSIVE"); + if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by " + m.group(7)+"/PASSIVE"); condensedstring = condensedstring.replaceFirst(m.group(1),m.group(7)+"/PASSIVE"); } m = pseudopassPattern.matcher(condensedstring); while (m.find()) { - logger.trace("Replacing " + m.group(1) + " by " + m.group(7)+"/VPREP"); + if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by " + m.group(7)+"/VPREP"); condensedstring = condensedstring.replaceFirst(m.group(1),m.group(7)+"/VPREP"); } m = pseudopwhPattern.matcher(condensedstring); while (m.find()) { - logger.trace("Replacing " + m.group(1) + " by " + m.group(7)+m.group(8)+"/VPREP"); + if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by " + m.group(7)+m.group(8)+"/VPREP"); condensedstring = condensedstring.replaceFirst(m.group(1),m.group(7)+" "+m.group(8)+"/VPREP"); } m = saveIsThere.matcher(condensedstring); @@ -158,57 +164,57 @@ } m = passivePattern2b.matcher(condensedstring); while (m.find()) { - logger.trace("Replacing " + m.group(1) + " by " + m.group(7)+"/PASSIVE"); + if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by " + m.group(7)+"/PASSIVE"); condensedstring = condensedstring.replaceFirst(m.group(1),m.group(7)+"/PASSIVE"); } m = passpartPattern.matcher(condensedstring); while (m.find()) { - logger.trace("Replacing " + m.group(1) + " by " + m.group(2)+"/PASSPART"); + if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by " + m.group(2)+"/PASSPART"); condensedstring = condensedstring.replaceFirst(m.group(1),m.group(2)+"/PASSPART"); } m = vpassPattern.matcher(condensedstring); while (m.find()) { - logger.trace("Replacing " + m.group(1) + " by " + m.group(2)+"/VPASS"); + if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by " + m.group(2)+"/VPASS"); condensedstring = condensedstring.replaceFirst(m.group(1),m.group(2)+"/VPASS"); } m = vpassinPattern.matcher(condensedstring); while (m.find()) { - logger.trace("Replacing " + m.group(1) + " by " + m.group(2)+"/VPASSIN"); + if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by " + m.group(2)+"/VPASSIN"); condensedstring = condensedstring.replaceFirst(m.group(1),m.group(2)+"/VPASSIN"); } m = gerundinPattern.matcher(condensedstring); while (m.find()) { - logger.trace("Replacing " + m.group(1) + " by " + m.group(2)+"/GERUNDIN"); + if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by " + m.group(2)+"/GERUNDIN"); condensedstring = condensedstring.replaceFirst(m.group(1),m.group(2)+"/GERUNDIN"); } m = vprepPattern.matcher(condensedstring); while (m.find()) { - logger.trace("Replacing " + m.group(1) + " by " + m.group(2)+"/VPREP"); + if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by " + m.group(2)+"/VPREP"); condensedstring = condensedstring.replaceFirst(m.group(1),m.group(2)+"/VPREP"); } m = whenPattern.matcher(condensedstring); while (m.find()) { - logger.trace("Replacing " + m.group(1) + " by " + m.group(2)+m.group(3)+"/WHEN"); + if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by " + m.group(2)+m.group(3)+"/WHEN"); condensedstring = condensedstring.replaceFirst(m.group(1),m.group(2) + m.group(3)+"/WHEN"); } m = wherePattern.matcher(condensedstring); while (m.find()) { - logger.trace("Replacing " + m.group(1) + " by " + m.group(2)+m.group(3)+"/WHERE"); + if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by " + m.group(2)+m.group(3)+"/WHERE"); condensedstring = condensedstring.replaceFirst(m.group(1),m.group(2) + m.group(3)+"/WHERE"); } m = adjsPattern.matcher(condensedstring); while (m.find()) { - logger.trace("Replacing " + m.group(1) + " by " + m.group(2)+"_"+m.group(3)+"/JJ"); + if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by " + m.group(2)+"_"+m.group(3)+"/JJ"); condensedstring = condensedstring.replaceFirst(m.group(1),m.group(2)+"_"+m.group(3)+"/JJ"); } m = adjnounPattern.matcher(condensedstring); while (m.find()) { - logger.trace("Replacing " + m.group(1) + " by " + m.group(2)+"_"+m.group(3)+"/JJNN"); + if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by " + m.group(2)+"_"+m.group(3)+"/JJNN"); condensedstring = condensedstring.replaceFirst(m.group(1),m.group(2)+"_"+m.group(3)+"/JJNN"); } m = adjnprepPattern.matcher(condensedstring); while (m.find()) { - logger.trace("Replacing " + m.group(1) + " by " + m.group(2)+"_"+m.group(3)+"/JJNPREP"); + if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by " + m.group(2)+"_"+m.group(3)+"/JJNPREP"); condensedstring = condensedstring.replaceFirst(m.group(1),m.group(2)+"_"+m.group(3)+"/JJNPREP"); } @@ -259,7 +265,7 @@ List<String> namedentities = ner.getNamedEntitites(untagged); List<String> usefulnamedentities = new ArrayList<String>(); - logger.trace("Proposed NEs: " + namedentities); + if (VERBOSE) logger.trace("Proposed NEs: " + namedentities); // keep only longest matches (e.g. keep 'World of Warcraft' and forget about 'Warcraft') // containing at least one upper case letter (in order to filter out errors like 'software') @@ -277,7 +283,7 @@ } } - logger.trace("Accepted NEs: " + usefulnamedentities); + if (VERBOSE) logger.trace("Accepted NEs: " + usefulnamedentities); // replace POS tags accordingly for (String ne : usefulnamedentities) { Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/templator/SlotBuilder.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/templator/SlotBuilder.java 2011-11-12 23:10:28 UTC (rev 3399) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/templator/SlotBuilder.java 2011-11-14 10:56:41 UTC (rev 3400) @@ -34,8 +34,23 @@ String type = "UNSPEC"; + /* 's */ + if (token.equals("'s")) { + String slot = "SLOT_of/SYMPROPERTY/of"; + String[] npAdjunct = {token, + "(NP NP* PART:'s' NP[obj]))", + "<x,l1,<e,t>,[ l1:[ y | SLOT_of(x,y) ] ],[(l2,y,obj,<e,t>)],[l2=l1],["+slot+"]>" + + " ;; <x,l1,<e,t>,[ l1:[ y | empty(x,y) ] ],[(l2,y,obj,<e,t>)],[l2=l1],[]>"}; + String[] dpAdjunct = {token, + "(DP DP* PART:'s' NP[obj]))", + "<x,l1,<<e,t>,t>,[ l1:[ y | SLOT_of(x,y) ] ],[(l2,y,obj,<e,t>)],[l2=l1],["+slot+"]>" + + " ;; <x,l1,<<e,t>,t>,[ l1:[ y | empty(x,y) ] ],[(l2,y,obj,<e,t>)],[l2=l1],[]>"}; + result.add(npAdjunct); + result.add(dpAdjunct); + } + /* NOUNS */ - if (equalsOneOf(pos,noun)) { + else if (equalsOneOf(pos,noun)) { if (pos.equals("NN") || pos.equals("NNS")) { type = "CLASS"; Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/templator/Templator.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/templator/Templator.java 2011-11-12 23:10:28 UTC (rev 3399) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/templator/Templator.java 2011-11-14 10:56:41 UTC (rev 3400) @@ -53,8 +53,9 @@ boolean ONE_SCOPE_ONLY = true; boolean UNTAGGED_INPUT = true; - boolean USE_NER = false; + boolean USE_WORDNET = true; + boolean VERBOSE = true; public Templator() { this(new StanfordPartOfSpeechTagger(), new WordNet()); @@ -74,7 +75,6 @@ } g = LTAG_Constructor.construct(grammarFiles); - p = new Parser(); p.SHOW_GRAMMAR = true; @@ -85,12 +85,41 @@ pp = new Preprocessor(USE_NER); } + public Templator(boolean b) { + this.tagger = new StanfordPartOfSpeechTagger(); + this.USE_WORDNET = false; + VERBOSE = b; + + List<InputStream> grammarFiles = new ArrayList<InputStream>(); + for(int i = 0; i < GRAMMAR_FILES.length; i++){ + grammarFiles.add(this.getClass().getClassLoader().getResourceAsStream(GRAMMAR_FILES[i])); + } + + g = LTAG_Constructor.construct(grammarFiles); + + p = new Parser(); + p.SHOW_GRAMMAR = false; + p.VERBOSE = b; + p.USE_DPS_AS_INITTREES = true; + p.CONSTRUCT_SEMANTICS = true; + p.MODE = "LEIPZIG"; + + pp = new Preprocessor(USE_NER); + pp.setVERBOSE(b); + } + public void setUNTAGGED_INPUT(boolean b) { UNTAGGED_INPUT = b; } public void setUSE_NER(boolean b) { USE_NER = b; } + public void setVERBOSE(boolean b) { + VERBOSE = b; + } + public void setGrammarFiles(String[] gf) { + GRAMMAR_FILES = gf; + } public Set<Template> buildTemplates(String s) { @@ -100,7 +129,7 @@ if (UNTAGGED_INPUT) { s = pp.normalize(s); tagged = tagger.tag(s); - logger.trace("Tagged input: " + tagged); + if (VERBOSE) logger.trace("Tagged input: " + tagged); } else { tagged = s; @@ -114,20 +143,20 @@ else newtagged = pp.condenseNominals(tagged); newtagged = pp.condense(newtagged); - logger.trace("Preprocessed: " + newtagged); + if (VERBOSE) logger.trace("Preprocessed: " + newtagged); p.parse(newtagged,g); if (p.getDerivationTrees().isEmpty()) { p.clear(g,p.getTemps()); clearAgain = false; - logger.error("[Templator.java] '" + s + "' could not be parsed."); + if (VERBOSE) logger.error("[Templator.java] '" + s + "' could not be parsed."); } else { try { p.buildDerivedTrees(g); } catch (ParseException e) { - logger.error("[Templator.java] ParseException at '" + e.getMessage() + "'", e); + if (VERBOSE) logger.error("[Templator.java] ParseException at '" + e.getMessage() + "'", e); } } @@ -154,10 +183,12 @@ if (!containsModuloRenaming(drses,drs)) { // // DEBUG - System.out.println(dude); - System.out.println(drs); - for (Slot sl : slots) { - System.out.println(sl.toString()); + if (VERBOSE) { + System.out.println(dude); + System.out.println(drs); + for (Slot sl : slots) { + System.out.println(sl.toString()); + } } // // drses.add(drs); @@ -168,54 +199,55 @@ continue; } - // find WordNet synonyms - List<String> newwords; - String word; - String pos; - for (Slot slot : temp.getSlots()) { - if (!slot.getWords().isEmpty()) { - - word = slot.getWords().get(0); - pos = postable.get(word.toLowerCase().replace(" ","_")); - - POS wordnetpos = null; - if (pos != null) { - if (equalsOneOf(pos,noun)) { - wordnetpos = POS.NOUN; + if (USE_WORDNET) { // find WordNet synonyms + List<String> newwords; + String word; + String pos; + for (Slot slot : temp.getSlots()) { + if (!slot.getWords().isEmpty()) { + + word = slot.getWords().get(0); + pos = postable.get(word.toLowerCase().replace(" ","_")); + + POS wordnetpos = null; + if (pos != null) { + if (equalsOneOf(pos,noun)) { + wordnetpos = POS.NOUN; + } + else if (equalsOneOf(pos,adjective)) { + wordnetpos = POS.ADJECTIVE; + } + else if (equalsOneOf(pos,verb)) { + wordnetpos = POS.VERB; + } + } + + List<String> strings = new ArrayList<String>(); + if (wordnetpos != null && wordnetpos.equals(POS.ADJECTIVE)) { + strings = wordnet.getAttributes(word); + } + + newwords = new ArrayList<String>(); + newwords.addAll(slot.getWords()); + newwords.addAll(strings); + + if (wordnetpos != null && !slot.getSlotType().equals(SlotType.RESOURCE)) { + newwords.addAll(wordnet.getBestSynonyms(wordnetpos,getLemmatizedWord(word))); + for (String att : getLemmatizedWords(strings)) { + newwords.addAll(wordnet.getBestSynonyms(wordnetpos,att)); + } } - else if (equalsOneOf(pos,adjective)) { - wordnetpos = POS.ADJECTIVE; + if(newwords.isEmpty()){ + } - else if (equalsOneOf(pos,verb)) { - wordnetpos = POS.VERB; + if (newwords.isEmpty()) { + newwords.add(slot.getWords().get(0)); } + List<String> newwordslist = new ArrayList<String>(); + newwordslist.addAll(newwords); + slot.setWords(newwordslist); } - - List<String> strings = new ArrayList<String>(); - if (wordnetpos != null && wordnetpos.equals(POS.ADJECTIVE)) { - strings = wordnet.getAttributes(word); - } - - newwords = new ArrayList<String>(); - newwords.addAll(slot.getWords()); - newwords.addAll(strings); - - if (wordnetpos != null && !slot.getSlotType().equals(SlotType.RESOURCE)) { - newwords.addAll(wordnet.getBestSynonyms(wordnetpos,getLemmatizedWord(word))); - for (String att : getLemmatizedWords(strings)) { - newwords.addAll(wordnet.getBestSynonyms(wordnetpos,att)); - } - } - if(newwords.isEmpty()){ - - } - if (newwords.isEmpty()) { - newwords.add(slot.getWords().get(0)); - } - List<String> newwordslist = new ArrayList<String>(); - newwordslist.addAll(newwords); - slot.setWords(newwordslist); - } + } } // This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sha...@us...> - 2011-11-12 23:10:35
|
Revision: 3399 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3399&view=rev Author: shadowtm Date: 2011-11-12 23:10:28 +0000 (Sat, 12 Nov 2011) Log Message: ----------- Cleaned up CLI output so that stacktraces could be minimized and more user friendly messages displayed. Modified Paths: -------------- trunk/components-core/pom.xml trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/CELOE.java trunk/components-core/src/main/java/org/dllearner/algorithms/fuzzydll/FuzzyCELOE.java trunk/components-core/src/main/java/org/dllearner/algorithms/isle/ISLE.java trunk/components-core/src/main/java/org/dllearner/algorithms/ocel/ROLearner2.java trunk/components-core/src/main/java/org/dllearner/reasoning/OWLAPIReasoner.java trunk/components-ext/pom.xml trunk/interfaces/pom.xml trunk/interfaces/src/main/java/org/dllearner/cli/CLI.java trunk/interfaces/src/main/java/org/dllearner/configuration/spring/ComponentInitializationBeanPostProcessor.java trunk/interfaces/src/main/java/org/dllearner/configuration/spring/DefaultApplicationContextBuilder.java trunk/interfaces/src/main/resources/log4j.properties trunk/interfaces/src/test/java/org/dllearner/configuration/spring/TestBean.java trunk/pom.xml Modified: trunk/components-core/pom.xml =================================================================== --- trunk/components-core/pom.xml 2011-11-12 09:37:21 UTC (rev 3398) +++ trunk/components-core/pom.xml 2011-11-12 23:10:28 UTC (rev 3399) @@ -277,11 +277,12 @@ </dependency> + <!-- This module is a library module, so it needs only to have the slf api dependency to enable logging --> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> - <version>1.5.8</version> </dependency> + <dependency> <groupId>commons-codec</groupId> <artifactId>commons-codec</artifactId> Modified: trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/CELOE.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/CELOE.java 2011-11-12 09:37:21 UTC (rev 3398) +++ trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/CELOE.java 2011-11-12 23:10:28 UTC (rev 3399) @@ -511,6 +511,7 @@ logger.info("Algorithm stopped ("+expressionTests+" descriptions tested). " + nodes.size() + " nodes in the search tree.\n"); } else { logger.info("Algorithm terminated successfully ("+expressionTests+" descriptions tested). " + nodes.size() + " nodes in the search tree.\n"); + logger.info(reasoner.toString()); } if(singleSuggestionMode) { Modified: trunk/components-core/src/main/java/org/dllearner/algorithms/fuzzydll/FuzzyCELOE.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/algorithms/fuzzydll/FuzzyCELOE.java 2011-11-12 09:37:21 UTC (rev 3398) +++ trunk/components-core/src/main/java/org/dllearner/algorithms/fuzzydll/FuzzyCELOE.java 2011-11-12 23:10:28 UTC (rev 3399) @@ -514,6 +514,7 @@ logger.info("Algorithm stopped ("+expressionTests+" descriptions tested). " + nodes.size() + " nodes in the search tree.\n"); } else { logger.info("Algorithm terminated successfully ("+expressionTests+" descriptions tested). " + nodes.size() + " nodes in the search tree.\n"); + logger.info(reasoner.toString()); } if(singleSuggestionMode) { Modified: trunk/components-core/src/main/java/org/dllearner/algorithms/isle/ISLE.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/algorithms/isle/ISLE.java 2011-11-12 09:37:21 UTC (rev 3398) +++ trunk/components-core/src/main/java/org/dllearner/algorithms/isle/ISLE.java 2011-11-12 23:10:28 UTC (rev 3399) @@ -392,6 +392,7 @@ logger.info("Algorithm stopped ("+expressionTests+" descriptions tested). " + nodes.size() + " nodes in the search tree.\n"); } else { logger.info("Algorithm terminated successfully ("+expressionTests+" descriptions tested). " + nodes.size() + " nodes in the search tree.\n"); + logger.info(reasoner.toString()); } if(singleSuggestionMode) { Modified: trunk/components-core/src/main/java/org/dllearner/algorithms/ocel/ROLearner2.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/algorithms/ocel/ROLearner2.java 2011-11-12 09:37:21 UTC (rev 3398) +++ trunk/components-core/src/main/java/org/dllearner/algorithms/ocel/ROLearner2.java 2011-11-12 23:10:28 UTC (rev 3399) @@ -520,6 +520,7 @@ logger.info("Algorithm stopped ("+conceptTests+" descriptions tested).\n"); } else { logger.info("Algorithm terminated successfully ("+conceptTests+" descriptions tested).\n"); + logger.info(rs.toString()); } totalLearningTime.stop(); Modified: trunk/components-core/src/main/java/org/dllearner/reasoning/OWLAPIReasoner.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/reasoning/OWLAPIReasoner.java 2011-11-12 09:37:21 UTC (rev 3398) +++ trunk/components-core/src/main/java/org/dllearner/reasoning/OWLAPIReasoner.java 2011-11-12 23:10:28 UTC (rev 3399) @@ -147,7 +147,7 @@ Set<OWLOntology> allImports = new HashSet<OWLOntology>(); prefixes = new TreeMap<String, String>(); - + Set<OWLImportsDeclaration> directImports = new HashSet<OWLImportsDeclaration>(); for (AbstractKnowledgeSource source : sources) { @@ -202,9 +202,9 @@ } } catch (OWLOntologyCreationException e) { - e.printStackTrace(); + throw new RuntimeException(e); } catch (URISyntaxException e) { - e.printStackTrace(); + throw new RuntimeException(e); } // all other sources are converted to KB and then to an // OWL API ontology @@ -217,7 +217,7 @@ try { ontology = manager.createOntology(ontologyURI); } catch (OWLOntologyCreationException e) { - e.printStackTrace(); + throw new RuntimeException(e); } OWLAPIAxiomConvertVisitor.fillOWLOntology(manager, ontology, kb); owlAPIOntologies.add(ontology); @@ -232,8 +232,8 @@ ontology = manager.createOntology(IRI.create("http://dl-learner/all"), new HashSet<OWLOntology>(owlAPIOntologies)); //we have to add all import declarations manually here, because this are no axioms List<OWLOntologyChange> addImports = new ArrayList<OWLOntologyChange>(); - for(OWLImportsDeclaration i : directImports){ - addImports.add(new AddImport(ontology, i)); + for (OWLImportsDeclaration i : directImports) { + addImports.add(new AddImport(ontology, i)); } manager.applyChanges(addImports); } catch (OWLOntologyCreationException e1) { @@ -252,7 +252,7 @@ try { reasoner = new FaCTPlusPlusReasonerFactory().createNonBufferingReasoner(ontology, conf); } catch (Exception e) { - e.printStackTrace(); + throw new RuntimeException(e); } System.out.println("Using FaCT++."); } else if (getReasonerTypeString().equals("hermit")) { @@ -340,7 +340,7 @@ for (OWLNamedIndividual owlIndividual : owlIndividuals) { individuals.add(new Individual(owlIndividual.toStringID())); } - + // remove top and bottom properties (for backwards compatibility) // atomicRoles.remove(new ObjectProperty("http://www.w3.org/2002/07/owl#bottomObjectProperty")); // atomicRoles.remove(new ObjectProperty("http://www.w3.org/2002/07/owl#topObjectProperty")); @@ -779,8 +779,8 @@ // take one element from the set and ignore the rest // (TODO: we need to make sure we always ignore the same concepts) OWLObjectPropertyExpression property = node.getRepresentativeElement(); - if(!property.isAnonymous()) { - roles.add(new ObjectProperty(property.asOWLObjectProperty().toStringID())); + if (!property.isAnonymous()) { + roles.add(new ObjectProperty(property.asOWLObjectProperty().toStringID())); } } roles.remove(new ObjectProperty(factory.getOWLTopObjectProperty().toStringID())); Modified: trunk/components-ext/pom.xml =================================================================== --- trunk/components-ext/pom.xml 2011-11-12 09:37:21 UTC (rev 3398) +++ trunk/components-ext/pom.xml 2011-11-12 23:10:28 UTC (rev 3399) @@ -52,19 +52,42 @@ <groupId>org.aksw.commons</groupId> <artifactId>sparql</artifactId> </dependency> + <dependency> <groupId>org.apache.solr</groupId> <artifactId>solr-core</artifactId> - <version>3.3.0</version> - <type>jar</type> - <scope>compile</scope> </dependency> + + <!--BEGIN Logging Dependencies--> + + <!--This is the api jar, it's needed at compile time--> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> - <version>1.6.0</version> </dependency> + + <!--This is the bridge that ties calls to the slf4j api to the log4j framework. This is a runtime dependency for programs which wish to use log4j as their implementation.--> <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + <scope>runtime</scope> + </dependency> + + <!-- This is the concrete implementation of the log4j framework - it is a runtime dependency that needs to be used with the slf4j-log4j12 dependency --> + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + </dependency> + + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>jcl-over-slf4j</artifactId> + <scope>runtime</scope> + </dependency> + <!--END Logging Dependencies--> + + + <dependency> <groupId>edu.stanford</groupId> <artifactId>postagger</artifactId> <version>3.0.2</version> @@ -148,7 +171,6 @@ <dependency> <groupId>org.nlp2rdf</groupId> <artifactId>nif</artifactId> - <version>1.1-SNAPSHOT</version> </dependency> Modified: trunk/interfaces/pom.xml =================================================================== --- trunk/interfaces/pom.xml 2011-11-12 09:37:21 UTC (rev 3398) +++ trunk/interfaces/pom.xml 2011-11-12 23:10:28 UTC (rev 3399) @@ -56,9 +56,9 @@ <mainClass>org.dllearner.cli.Enrichment</mainClass> <name>enrichment</name> </program> - <!-- <program> <mainClass>org.dllearner.gui.StartGUI</mainClass> - <name>gui</name> </program> <program> <mainClass>org.dllearner.cli.QuickStart</mainClass> - <name>quickstart</name> </program> <program> <mainClass>org.dllearner.server.DLLearnerWS</mainClass> + <!-- <program> <mainClass>org.dllearner.gui.StartGUI</mainClass> + <name>gui</name> </program> <program> <mainClass>org.dllearner.cli.QuickStart</mainClass> + <name>quickstart</name> </program> <program> <mainClass>org.dllearner.server.DLLearnerWS</mainClass> <name>ws</name> </program> --> </programs> </configuration> @@ -171,10 +171,10 @@ </requestLog> </configuration> <!--execution is used for testing --> - <!--executions> <execution> <id>start-jetty</id> <phase>pre-integration-test</phase> - <goals> <goal>run</goal> </goals> <configuration> <scanIntervalSeconds>0</scanIntervalSeconds> - <daemon>true</daemon> <stopKey>stopKey</stopKey> <stopPort>9999</stopPort> - </configuration> </execution> <execution> <id>stop-jetty</id> <phase>post-integration-test</phase> + <!--executions> <execution> <id>start-jetty</id> <phase>pre-integration-test</phase> + <goals> <goal>run</goal> </goals> <configuration> <scanIntervalSeconds>0</scanIntervalSeconds> + <daemon>true</daemon> <stopKey>stopKey</stopKey> <stopPort>9999</stopPort> + </configuration> </execution> <execution> <id>stop-jetty</id> <phase>post-integration-test</phase> <goals> <goal>stop</goal> </goals> </execution> </executions --> </plugin> @@ -205,8 +205,8 @@ <dependency> <groupId>org.dllearner</groupId> <artifactId>components-ext</artifactId> - </dependency> - <!-- Added the dependency of the core tests so that they will be accessible + </dependency> + <!-- Added the dependency of the core tests so that they will be accessible from the tests in this component --> <dependency> <groupId>org.dllearner</groupId> @@ -267,6 +267,45 @@ <artifactId>spring-xmlbeans-3.0</artifactId> <version>1.0</version> </dependency> + + <dependency> + <groupId>net.sf.jopt-simple</groupId> + <artifactId>jopt-simple</artifactId> + </dependency> + + <dependency> + <groupId>org.json</groupId> + <artifactId>json</artifactId> + </dependency> + + <!--BEGIN Logging Dependencies--> + + <!--This is the api jar, it's needed at compile time--> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + </dependency> + + <!--This is the bridge that ties calls to the slf4j api to the log4j framework. This is a runtime dependency for programs which wish to use log4j as their implementation.--> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + <scope>runtime</scope> + </dependency> + + <!--Log4J dependency needed for the runtime as well as some specific compile time calls--> + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + </dependency> + + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>jcl-over-slf4j</artifactId> + <scope>runtime</scope> + </dependency> + <!--END Logging Dependencies--> + </dependencies> Modified: trunk/interfaces/src/main/java/org/dllearner/cli/CLI.java =================================================================== --- trunk/interfaces/src/main/java/org/dllearner/cli/CLI.java 2011-11-12 09:37:21 UTC (rev 3398) +++ trunk/interfaces/src/main/java/org/dllearner/cli/CLI.java 2011-11-12 23:10:28 UTC (rev 3399) @@ -20,7 +20,9 @@ package org.dllearner.cli; import java.io.File; +import java.io.FileOutputStream; import java.io.IOException; +import java.io.PrintStream; import java.util.ArrayList; import java.util.List; @@ -139,12 +141,6 @@ */ public static void main(String[] args) throws ParseException, IOException, ReasoningMethodUnsupportedException { - Layout layout = new PatternLayout(); - ConsoleAppender consoleAppender = new ConsoleAppender(layout); - rootLogger.removeAllAppenders(); - rootLogger.addAppender(consoleAppender); - rootLogger.setLevel(Level.INFO); - // System.out.println("DL-Learner " + Info.build + " [TODO: read pom.version and put it here (make sure that the code for getting the version also works in the release build!)] command line interface"); System.out.println("DL-Learner command line interface"); @@ -168,24 +164,32 @@ //DL-Learner Configuration Object IConfiguration configuration = new ConfParserConfiguration(confFile); - ApplicationContextBuilder builder = new DefaultApplicationContextBuilder(); - ApplicationContext context = builder.buildApplicationContext(configuration,springConfigResources); - - // TODO: later we could check which command line interface is specified in the conf file - // for now we just use the default one - - CLI cli; - if(context.containsBean("cli")) { - cli = (CLI) context.getBean("cli"); - } else { - cli = new CLI(); + try { + ApplicationContextBuilder builder = new DefaultApplicationContextBuilder(); + ApplicationContext context = builder.buildApplicationContext(configuration,springConfigResources); + + // TODO: later we could check which command line interface is specified in the conf file + // for now we just use the default one + + CLI cli; + if(context.containsBean("cli")) { + cli = (CLI) context.getBean("cli"); + } else { + cli = new CLI(); + } + cli.setContext(context); + cli.setConfFile(file); + cli.run(); + } catch (Exception e) { + String stacktraceFileName = "log/error.log"; + logger.error("An Error Occurred During Processing. Terminating DL-Learner...and writing stacktrace to: " + stacktraceFileName); + FileOutputStream fos = new FileOutputStream(stacktraceFileName); + PrintStream ps = new PrintStream(fos); + e.printStackTrace(ps); } - cli.setContext(context); - cli.setConfFile(file); - cli.run(); - - } + } + public void setContext(ApplicationContext context) { this.context = context; } Modified: trunk/interfaces/src/main/java/org/dllearner/configuration/spring/ComponentInitializationBeanPostProcessor.java =================================================================== --- trunk/interfaces/src/main/java/org/dllearner/configuration/spring/ComponentInitializationBeanPostProcessor.java 2011-11-12 09:37:21 UTC (rev 3398) +++ trunk/interfaces/src/main/java/org/dllearner/configuration/spring/ComponentInitializationBeanPostProcessor.java 2011-11-12 23:10:28 UTC (rev 3399) @@ -1,29 +1,49 @@ package org.dllearner.configuration.spring; +import org.dllearner.core.AnnComponentManager; import org.dllearner.core.Component; import org.dllearner.core.ComponentInitException; +import org.dllearner.utilities.Helper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.BeansException; import org.springframework.beans.factory.config.BeanPostProcessor; +import java.util.Date; + /** * Created by IntelliJ IDEA. * User: Chris * Date: 8/23/11 * Time: 7:00 AM - * + * <p/> * Post Processor to initialize our components. */ -public class ComponentInitializationBeanPostProcessor implements BeanPostProcessor{ +public class ComponentInitializationBeanPostProcessor implements BeanPostProcessor { + private static Logger logger = LoggerFactory.getLogger(ComponentInitializationBeanPostProcessor.class); + @Override public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { - if(bean instanceof Component){ + if (bean instanceof Component) { Component c = (Component) bean; + + String componentName = AnnComponentManager.getName(c); try { + + Date startTime = new Date(); c.init(); + Date stopTime = new Date(); + long elapsedTime = stopTime.getTime() - startTime.getTime(); + + logger.info("Initializing Component \"" + componentName + "\"... OK (" + Helper.prettyPrintMilliSeconds(elapsedTime) + ")"); } catch (ComponentInitException e) { - throw new RuntimeException("Problem initializing the component with beanName: " + beanName,e); + throw new RuntimeException("Problem initializing the component \"" + componentName + "\" with beanName: " + beanName, e); + } catch (Exception e) { + /** Catch any exception as an init exception */ + logger.warn("Could not initialize component \"" + componentName + "\""); + throw new RuntimeException(e); } } return bean; Modified: trunk/interfaces/src/main/java/org/dllearner/configuration/spring/DefaultApplicationContextBuilder.java =================================================================== --- trunk/interfaces/src/main/java/org/dllearner/configuration/spring/DefaultApplicationContextBuilder.java 2011-11-12 09:37:21 UTC (rev 3398) +++ trunk/interfaces/src/main/java/org/dllearner/configuration/spring/DefaultApplicationContextBuilder.java 2011-11-12 23:10:28 UTC (rev 3399) @@ -6,6 +6,9 @@ import java.util.List; import org.dllearner.configuration.IConfiguration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor; import org.springframework.context.ApplicationContext; import org.springframework.context.ConfigurableApplicationContext; @@ -23,6 +26,8 @@ */ public class DefaultApplicationContextBuilder implements ApplicationContextBuilder{ + private static Logger logger = LoggerFactory.getLogger(DefaultApplicationContextBuilder.class); + @Override public ApplicationContext buildApplicationContext(IConfiguration configuration, List<Resource> springConfigurationLocations) throws IOException{ ConfigurableApplicationContext context = null; @@ -51,7 +56,15 @@ context.addBeanFactoryPostProcessor(beanDefinitionRegistryPostProcessor); //Instantiate and initialize the beans. - context.refresh(); + try { + context.refresh(); + } catch (BeanCreationException e) { + logger.error("There was a problem creating the bean named \"" + e.getBeanName() + "\" - Check your configuration file and try again."); + throw new RuntimeException(e); + } catch (Exception e) { + logger.error("There was a problem initializing the components...shutting down."); + throw new RuntimeException(e); + } return context; } } Modified: trunk/interfaces/src/main/resources/log4j.properties =================================================================== --- trunk/interfaces/src/main/resources/log4j.properties 2011-11-12 09:37:21 UTC (rev 3398) +++ trunk/interfaces/src/main/resources/log4j.properties 2011-11-12 23:10:28 UTC (rev 3399) @@ -2,17 +2,20 @@ log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d{HH:mm:ss} %-5p %-20c{1} :: %m%n log4j.appender.file=org.apache.log4j.FileAppender log4j.appender.file.File=log/interfaces.log log4j.appender.file.layout=org.apache.log4j.PatternLayout log4j.appender.file.layout.ConversionPattern= %-4r [%t] %-5p %c %x - %m%n -# Joseki server logging -log4j.logger.org.dllearner=DEBUG +# DL-Learner Logs +log4j.logger.org.dllearner=INFO + log4j.logger.org.dllearner.server.nke.LogicalRelationStrategy=DEBUG +# Eliminate most of the Spring Context Loading noise +log4j.logger.org.springframework=WARN + ## log4j.logger.org.joseki.server.http.LocatorServletContext=ALL # Jena, including the Joseki client Modified: trunk/interfaces/src/test/java/org/dllearner/configuration/spring/TestBean.java =================================================================== --- trunk/interfaces/src/test/java/org/dllearner/configuration/spring/TestBean.java 2011-11-12 09:37:21 UTC (rev 3398) +++ trunk/interfaces/src/test/java/org/dllearner/configuration/spring/TestBean.java 2011-11-12 23:10:28 UTC (rev 3399) @@ -1,6 +1,7 @@ package org.dllearner.configuration.spring; import org.dllearner.core.Component; +import org.dllearner.core.ComponentAnn; import java.util.Map; import java.util.Set; @@ -13,6 +14,7 @@ * * Test Bean for testing that we can store all the types we need. */ +@ComponentAnn(version = 1,shortName ="tbc", name = "TestBean Component") public class TestBean implements Component{ private String simpleValue; Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2011-11-12 09:37:21 UTC (rev 3398) +++ trunk/pom.xml 2011-11-12 23:10:28 UTC (rev 3399) @@ -17,6 +17,9 @@ <!--Define the AKSW dependency version --> <aksw.version>0.1</aksw.version> + + <slf4j.version>1.6.4</slf4j.version> + <log4j.version>1.2.16</log4j.version> </properties> <modules> @@ -29,7 +32,7 @@ </modules> - <!--This is the SCM information, which needs to be here so we can use the + <!--This is the SCM information, which needs to be here so we can use the maven release plugin --> <scm> <connection>scm:svn:https://dl-learner.svn.sourceforge.net/svnroot/dl-learner/trunk</connection> @@ -39,9 +42,9 @@ </scm> <build> - <!-- - Plugin Management defines the plugins that the child components - can use - It's good practice to do this as we can ensure all children use - common versions - of the plugins, and we can look in one place to see all + <!-- - Plugin Management defines the plugins that the child components + can use - It's good practice to do this as we can ensure all children use + common versions - of the plugins, and we can look in one place to see all plugin dependencies. --> <pluginManagement> <plugins> @@ -64,8 +67,8 @@ </configuration> </plugin> - <!-- - Maven Jar Plugin - if you want to create and/or sign jars. - I'm - putting this in so we can create a jar for the test classes - in components + <!-- - Maven Jar Plugin - if you want to create and/or sign jars. - I'm + putting this in so we can create a jar for the test classes - in components core so that other components' tests can leverage them --> <plugin> <groupId>org.apache.maven.plugins</groupId> @@ -88,12 +91,12 @@ </build> <dependencyManagement> - <!-- - Dependency Management defines the dependencies at the parent level - - These set the dependencies on a global level and the children are forced - to use the defined version - We do this to ensure consistent dependencies - amongst all children artifacts that are generated by this pom. - - Children - still have to include the dependency, but only the groupId and artifactId - as version is retrieved from the parent. - - Remember, default scope is compile + <!-- - Dependency Management defines the dependencies at the parent level + - These set the dependencies on a global level and the children are forced + to use the defined version - We do this to ensure consistent dependencies + amongst all children artifacts that are generated by this pom. - - Children + still have to include the dependency, but only the groupId and artifactId + as version is retrieved from the parent. - - Remember, default scope is compile in Maven. --> <dependencies> <dependency> @@ -120,19 +123,43 @@ <version>0.9.3</version> </dependency> - <dependency> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> - <version>1.2.16</version> - </dependency> + <!-- SOLR Dependency --> + <dependency> + <groupId>org.apache.solr</groupId> + <artifactId>solr-core</artifactId> + <version>3.3.0</version> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + <exclusion> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-jdk14</artifactId> + </exclusion> + </exclusions> + </dependency> - <dependency> + <dependency> + <groupId>org.nlp2rdf</groupId> + <artifactId>nif</artifactId> + <version>1.1-SNAPSHOT</version> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + + + <dependency> <groupId>com.extjs</groupId> <artifactId>gxt</artifactId> <version>2.2.3</version> </dependency> - <!--Available via central, we use the latest with minor mods to DL Learner + <!--Available via central, we use the latest with minor mods to DL Learner source (IE Dig related code) --> <dependency> <groupId>com.hp.hpl.jena</groupId> @@ -390,12 +417,18 @@ <version>1.0.3</version> <scope>provided</scope> </dependency> - + <!-- Spring --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>3.0.5.RELEASE</version> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>org.springframework</groupId> @@ -403,6 +436,47 @@ <version>3.0.5.RELEASE</version> </dependency> + <!--BEGIN Logging Dependencies--> + + <!--This is the api jar, it's needed at compile time--> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + <version>${slf4j.version}</version> + </dependency> + + <!--This is the bridge that ties calls to the slf4j api to the log4j framework. This is a runtime dependency for programs which wish to use log4j as their implementation.--> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + <version>${slf4j.version}</version> + </dependency> + + <!-- This is the concrete implementation of the log4j framework - it is a runtime dependency that needs to be used with the slf4j-log4j12 dependency --> + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <version>${log4j.version}</version> + </dependency> + + <!--Bridge from JCL to SLF4J. Then we go from SLF4J to our desired logging framework (which for DL-Learner interfaces is Log4J). + - JCL is in use by Spring and so this lets us control the output from the Spring libraries in the same way we control anything else. + - This is also a runtime dependency. + --> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>jcl-over-slf4j</artifactId> + <version>${slf4j.version}</version> + </dependency> + + + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-jdk14</artifactId> + <version>${slf4j.version}</version> + </dependency> + <!--END Logging Dependencies--> + </dependencies> </dependencyManagement> @@ -445,8 +519,8 @@ <url>http://maven.jahia.org/maven2/</url> </repository> - <!-- - This is so we can get the 1.3-SNAPSHOT of GWT Maven Plugin cause - 1.2 is broken on the hudson - - Here's a good place to browse the repository: + <!-- - This is so we can get the 1.3-SNAPSHOT of GWT Maven Plugin cause + 1.2 is broken on the hudson - - Here's a good place to browse the repository: https://nexus.codehaus.org --> <repository> <id>maven.codehaus.snapshots</id> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lor...@us...> - 2011-11-12 09:37:28
|
Revision: 3398 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3398&view=rev Author: lorenz_b Date: 2011-11-12 09:37:21 +0000 (Sat, 12 Nov 2011) Log Message: ----------- Added missing prefixes to positive examples. Modified Paths: -------------- trunk/examples/qtl/dbpedia_simple.conf Modified: trunk/examples/qtl/dbpedia_simple.conf =================================================================== --- trunk/examples/qtl/dbpedia_simple.conf 2011-11-12 08:14:05 UTC (rev 3397) +++ trunk/examples/qtl/dbpedia_simple.conf 2011-11-12 09:37:21 UTC (rev 3398) @@ -7,6 +7,6 @@ // learning problem lp.type = "posonlylp" -lp.positiveExamples = { "Bob_Dylan", "The_Beatles", "dbr:Aerosmith" } +lp.positiveExamples = { "dbr:Bob_Dylan", "dbr:The_Beatles", "dbr:Aerosmith" } alg.type = "qtl" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2011-11-12 08:14:14
|
Revision: 3397 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3397&view=rev Author: jenslehmann Date: 2011-11-12 08:14:05 +0000 (Sat, 12 Nov 2011) Log Message: ----------- several changes to get QTL algorithm working from conf file Modified Paths: -------------- trunk/components-core/src/main/java/org/dllearner/core/AbstractLearningProblem.java trunk/components-core/src/main/java/org/dllearner/core/AnnComponentManager.java trunk/components-core/src/main/java/org/dllearner/learningproblems/PosOnlyLP.java trunk/components-ext/src/main/java/org/dllearner/algorithm/qtl/QTL.java trunk/interfaces/pom.xml Added Paths: ----------- trunk/examples/qtl/ trunk/examples/qtl/dbpedia_simple.conf Modified: trunk/components-core/src/main/java/org/dllearner/core/AbstractLearningProblem.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/core/AbstractLearningProblem.java 2011-11-11 15:05:29 UTC (rev 3396) +++ trunk/components-core/src/main/java/org/dllearner/core/AbstractLearningProblem.java 2011-11-12 08:14:05 UTC (rev 3397) @@ -119,7 +119,7 @@ return reasoner; } - @Autowired + @Autowired(required=false) public void setReasoner(AbstractReasonerComponent reasoner) { this.reasoner = reasoner; } Modified: trunk/components-core/src/main/java/org/dllearner/core/AnnComponentManager.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/core/AnnComponentManager.java 2011-11-11 15:05:29 UTC (rev 3396) +++ trunk/components-core/src/main/java/org/dllearner/core/AnnComponentManager.java 2011-11-12 08:14:05 UTC (rev 3397) @@ -70,6 +70,7 @@ "org.dllearner.algorithms.properties.SubDataPropertyOfAxiomLearner", "org.dllearner.algorithms.DisjointClassesLearner", "org.dllearner.algorithms.SimpleSubclassLearner", + "org.dllearner.algorithm.qtl.QTL", "org.dllearner.kb.KBFile", "org.dllearner.kb.OWLFile", "org.dllearner.kb.SparqlEndpointKS", Modified: trunk/components-core/src/main/java/org/dllearner/learningproblems/PosOnlyLP.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/learningproblems/PosOnlyLP.java 2011-11-11 15:05:29 UTC (rev 3396) +++ trunk/components-core/src/main/java/org/dllearner/learningproblems/PosOnlyLP.java 2011-11-12 08:14:05 UTC (rev 3397) @@ -109,10 +109,14 @@ // reasoning options (i.e. options are the same up to reversed example sets) // definitionLP.init(); - individuals = new LinkedList<Individual>(getReasoner().getIndividuals()); + Random rand = new Random(1); + + if(getReasoner()!=null) { + individuals = new LinkedList<Individual>(getReasoner().getIndividuals()); + Collections.shuffle(individuals, rand); + } + positiveExamplesShuffled = new LinkedList<Individual>(positiveExamples); - Random rand = new Random(1); - Collections.shuffle(individuals, rand); Collections.shuffle(positiveExamplesShuffled, rand); } Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/qtl/QTL.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/qtl/QTL.java 2011-11-11 15:05:29 UTC (rev 3396) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/qtl/QTL.java 2011-11-12 08:14:05 UTC (rev 3397) @@ -46,6 +46,7 @@ import org.dllearner.algorithm.qtl.util.SPARQLEndpointEx; import org.dllearner.core.AbstractComponent; import org.dllearner.core.AbstractLearningProblem; +import org.dllearner.core.ComponentAnn; import org.dllearner.core.ComponentManager; import org.dllearner.core.LearningProblemUnsupportedException; import org.dllearner.core.SparqlQueryLearningAlgorithm; @@ -60,6 +61,7 @@ import org.dllearner.learningproblems.PosNegLP; import org.dllearner.learningproblems.PosOnlyLP; import org.dllearner.utilities.Helper; +import org.springframework.beans.factory.annotation.Autowired; import com.hp.hpl.jena.query.QuerySolution; import com.hp.hpl.jena.query.ResultSetRewindable; @@ -76,11 +78,12 @@ * * */ +@ComponentAnn(name="query tree learner", shortName="qtl", version=0.8) public class QTL extends AbstractComponent implements SparqlQueryLearningAlgorithm { private static final Logger logger = Logger.getLogger(QTL.class); - private AbstractLearningProblem lp; + private AbstractLearningProblem learningProblem; private SparqlEndpointKS endpointKS; // private QTLConfigurator configurator; @@ -115,11 +118,15 @@ return options; } + public QTL() { + + } + public QTL(AbstractLearningProblem learningProblem, SparqlEndpointKS endpointKS) throws LearningProblemUnsupportedException{ if(!(learningProblem instanceof PosOnlyLP || learningProblem instanceof PosNegLP)){ throw new LearningProblemUnsupportedException(learningProblem.getClass(), getClass()); } - this.lp = learningProblem; + this.learningProblem = learningProblem; this.endpointKS = endpointKS; // this.configurator = new QTLConfigurator(this); @@ -307,11 +314,11 @@ } public void init() { - if(lp instanceof PosOnlyLP){ - this.posExamples = convert(((PosOnlyLP)lp).getPositiveExamples()); - } else if(lp instanceof PosNegLP){ - this.posExamples = convert(((PosNegLP)lp).getPositiveExamples()); - this.negExamples = convert(((PosNegLP)lp).getNegativeExamples()); + if(learningProblem instanceof PosOnlyLP){ + this.posExamples = convert(((PosOnlyLP)learningProblem).getPositiveExamples()); + } else if(learningProblem instanceof PosNegLP){ + this.posExamples = convert(((PosNegLP)learningProblem).getPositiveExamples()); + this.negExamples = convert(((PosNegLP)learningProblem).getNegativeExamples()); } endpoint = endpointKS.getEndpoint(); @@ -354,5 +361,23 @@ System.out.println(query); } + public AbstractLearningProblem getLearningProblem() { + return learningProblem; + } + + @Autowired + public void setLearningProblem(AbstractLearningProblem learningProblem) { + this.learningProblem = learningProblem; + } + + public SparqlEndpointKS getEndpointKS() { + return endpointKS; + } + + @Autowired + public void setEndpointKS(SparqlEndpointKS endpointKS) { + this.endpointKS = endpointKS; + } + } Added: trunk/examples/qtl/dbpedia_simple.conf =================================================================== --- trunk/examples/qtl/dbpedia_simple.conf (rev 0) +++ trunk/examples/qtl/dbpedia_simple.conf 2011-11-12 08:14:05 UTC (rev 3397) @@ -0,0 +1,12 @@ + +prefixes = [ ("dbr","http://dbpedia.org/resource/") ] + +ks.type = "SPARQL" +ks.url = "http://live.dbpedia.org/sparql" +ks.defaultGraphURIs = { "http://dbpedia.org" } + +// learning problem +lp.type = "posonlylp" +lp.positiveExamples = { "Bob_Dylan", "The_Beatles", "dbr:Aerosmith" } + +alg.type = "qtl" Modified: trunk/interfaces/pom.xml =================================================================== --- trunk/interfaces/pom.xml 2011-11-11 15:05:29 UTC (rev 3396) +++ trunk/interfaces/pom.xml 2011-11-12 08:14:05 UTC (rev 3397) @@ -202,6 +202,10 @@ <groupId>org.dllearner</groupId> <artifactId>components-core</artifactId> </dependency> + <dependency> + <groupId>org.dllearner</groupId> + <artifactId>components-ext</artifactId> + </dependency> <!-- Added the dependency of the core tests so that they will be accessible from the tests in this component --> <dependency> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <km...@us...> - 2011-11-11 15:05:35
|
Revision: 3396 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3396&view=rev Author: kmpf Date: 2011-11-11 15:05:29 +0000 (Fri, 11 Nov 2011) Log Message: ----------- Untested workaround to get the positive/negative class mapping correct. Modified Paths: -------------- trunk/scripts/src/main/java/org/dllearner/examples/pdb/AminoAcids.java trunk/scripts/src/main/java/org/dllearner/examples/pdb/HelixRDFCreator.java trunk/scripts/src/main/java/org/dllearner/examples/pdb/PDBIdRdfModel.java Modified: trunk/scripts/src/main/java/org/dllearner/examples/pdb/AminoAcids.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/examples/pdb/AminoAcids.java 2011-11-11 09:22:08 UTC (rev 3395) +++ trunk/scripts/src/main/java/org/dllearner/examples/pdb/AminoAcids.java 2011-11-11 15:05:29 UTC (rev 3396) @@ -117,29 +117,29 @@ return resourceString; } - public static HashMap<Resource, String> getAminoAcidArffAttributeMap(){ - HashMap<Resource, String> resdata = new HashMap<Resource, String>(30); - resdata.put(ALA, new String("2,0,0.5,?,?")); - resdata.put(CYS, new String("1,0,1,?,0")); - resdata.put(ASP, new String("0,-1,1,?,-1")); - resdata.put(GLU, new String("0,-1,2,?,-1")); - resdata.put(PHE, new String("2,0,2,1,?")); - resdata.put(GLY, new String("2,0,0.5,?,?")); - resdata.put(HIS, new String("1,1,2,1,1")); - resdata.put(ILE, new String("2,0,2,0,?")); - resdata.put(LYS, new String("1,1,2,?,1")); - resdata.put(LEU, new String("2,0,2,0,?")); - resdata.put(MET, new String("2,0,2,?,?")); - resdata.put(ASN, new String("0,0,1,?,0")); - resdata.put(PRO, new String("?,0,1,?,?")); - resdata.put(GLN, new String("0,0,2,?,0")); - resdata.put(ARG, new String("0,1,2,?,1")); - resdata.put(SER, new String("0,0,0.5,?,0")); - resdata.put(THR, new String("1,0,1,?,0,")); - resdata.put(VAL, new String("2,0,1,0,?")); - resdata.put(TRP, new String("1,0,2,1,1")); - resdata.put(TYR, new String("1,0,2,1,0")); - resdata.put(SEL, new String("?,?,?,?,?")); + public static HashMap<String, String> getAminoAcidArffAttributeMap(){ + HashMap<String, String> resdata = new HashMap<String, String>(30); + resdata.put(new String("A"), new String("2,0,0.5,?,?")); + resdata.put(new String("C"), new String("1,0,1,?,0")); + resdata.put(new String("D"), new String("0,-1,1,?,-1")); + resdata.put(new String("E"), new String("0,-1,2,?,-1")); + resdata.put(new String("F"), new String("2,0,2,1,?")); + resdata.put(new String("G"), new String("2,0,0.5,?,?")); + resdata.put(new String("H"), new String("1,1,2,1,1")); + resdata.put(new String("I"), new String("2,0,2,0,?")); + resdata.put(new String("K"), new String("1,1,2,?,1")); + resdata.put(new String("L"), new String("2,0,2,0,?")); + resdata.put(new String("M"), new String("2,0,2,?,?")); + resdata.put(new String("N"), new String("0,0,1,?,0")); + resdata.put(new String("P"), new String("?,0,1,?,?")); + resdata.put(new String("Q"), new String("0,0,2,?,0")); + resdata.put(new String("R"), new String("0,1,2,?,1")); + resdata.put(new String("S"), new String("0,0,0.5,?,0")); + resdata.put(new String("T"), new String("1,0,1,?,0,")); + resdata.put(new String("V"), new String("2,0,1,0,?")); + resdata.put(new String("W"), new String("1,0,2,1,1")); + resdata.put(new String("Y"), new String("1,0,2,1,0")); + resdata.put(new String("U"), new String("?,?,?,?,?")); return resdata; } Modified: trunk/scripts/src/main/java/org/dllearner/examples/pdb/HelixRDFCreator.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/examples/pdb/HelixRDFCreator.java 2011-11-11 09:22:08 UTC (rev 3395) +++ trunk/scripts/src/main/java/org/dllearner/examples/pdb/HelixRDFCreator.java 2011-11-11 15:05:29 UTC (rev 3396) @@ -156,6 +156,7 @@ _logger.info("PDB ID: " + protein.getPdbID()); _logger.info("chain ID: " + protein.getChainID()); + trainmodel = new PDBIdRdfModel(protein); if (fasta){ @@ -491,13 +492,55 @@ out.println(data); // HashMap containing information about the properties of every amino acid - HashMap<Resource, String> resdata = AminoAcids.getAminoAcidArffAttributeMap(); + HashMap<String, String> resdata = AminoAcids.getAminoAcidArffAttributeMap(); ArrayList<Resource> positives = model.getPositives(); ArrayList<Resource> negatives = model.getNegatives(); Property type = ResourceFactory.createProperty("http://www.w3.org/1999/02/22-rdf-syntax-ns#", "type"); Property iib = ResourceFactory.createProperty("http://bio2rdf.org/pdb:", "isImmediatelyBefore"); - + String sequence = protein.getSequence(); + HashMap<Integer, Resource> posRes = model.getPositionResource(); + for ( int i = 0; i < sequence.length(); i++) { + StringBuffer dataLine = new StringBuffer(""); + String key = Character.toString( sequence.charAt(i) ); + + // add amino acid description to dataLine + if ( resdata.containsKey(key) ){ + dataLine.append( resdata.get(key) + "," ); + } else { + // + dataLine.append( resdata.get("U") + "," ); + } + + // add information about neighbouring amino acids to dataLine + for (int j = (i - 8); j <= (i + 8) ; j++){ + try { + dataLine.append( protein.getSequence().charAt(j) + "," ); + } catch (IndexOutOfBoundsException e) { + dataLine.append( "?," ); + } + } + + // add information about positive or negative to dataLine + if (positives.contains( posRes.get( new Integer(i) ))){ + dataLine.append( "1" ); + } else if (negatives.contains( posRes.get( new Integer(i) ))){ + dataLine.append( "0" ); + } else { + dataLine.append( "?" ); + } + + _logger.info(dataLine); + out.println(dataLine); + + } + + } catch (FileNotFoundException e){ + e.printStackTrace(); + } + + +/* // to be exchanged while (firstAAs.hasNext()){ Resource firstAA = firstAAs.next(); Resource currentAA = firstAA; @@ -529,6 +572,8 @@ dataLine.append( "1" ); } else if (negatives.contains(currentAA)){ dataLine.append( "0" ); + } else { + dataLine.append( "?" ); } @@ -537,12 +582,6 @@ if (model.getModel().contains(currentAA, iib)){ nextAA = model.getModel().getProperty(currentAA, iib).getResource(); } - _logger.info(dataLine); - out.println(dataLine); - } - } - } catch (FileNotFoundException e){ - e.printStackTrace(); - } +*/ } } Modified: trunk/scripts/src/main/java/org/dllearner/examples/pdb/PDBIdRdfModel.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/examples/pdb/PDBIdRdfModel.java 2011-11-11 09:22:08 UTC (rev 3395) +++ trunk/scripts/src/main/java/org/dllearner/examples/pdb/PDBIdRdfModel.java 2011-11-11 15:05:29 UTC (rev 3396) @@ -5,7 +5,13 @@ import java.io.IOException; import java.io.PrintStream; import java.util.ArrayList; +import java.util.HashMap; +import org.apache.log4j.ConsoleAppender; +import org.apache.log4j.FileAppender; +import org.apache.log4j.Level; +import org.apache.log4j.Logger; +import org.apache.log4j.SimpleLayout; import org.xml.sax.InputSource; import com.dumontierlab.pdb2rdf.model.PdbRdfModel; @@ -27,13 +33,17 @@ public class PDBIdRdfModel { + private static Logger _logger = Logger.getRootLogger(); + private PdbRdfModel _pdbIdModel = new PdbRdfModel(); private PdbRdfModel _removedFromModel = new PdbRdfModel(); private PDBProtein _protein = null ; private ArrayList<Resource> _positives = null; private ArrayList<Resource> _negatives = null; + private HashMap<Integer, Resource> _positionResource = null; - public PDBIdRdfModel (PDBProtein protein){ + public PDBIdRdfModel (PDBProtein protein) { + this._protein = protein; this._pdbIdModel = this.getPdbRdfModel(); this.getProtein().setSequence(extractSequence(_pdbIdModel)); @@ -41,6 +51,7 @@ this.getProtein().setSpecies(extractSpecies(_pdbIdModel)); System.out.println("Species: " + this.getProtein().getSpecies()); createPositivesAndNegatives(); + _positionResource = createPositionResidueMap(); } public PdbRdfModel getModel(){ @@ -58,6 +69,10 @@ public ArrayList<Resource> getNegatives(){ return _negatives; } + + public HashMap<Integer, Resource> getPositionResource(){ + return _positionResource; + } private PdbRdfModel getPdbRdfModel() { String[] pdbIDs = {_protein.getPdbID()}; @@ -192,13 +207,15 @@ "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> " + "PREFIX fn: <http://www.w3.org/2005/xpath-functions#> " + "CONSTRUCT { ?x1 pdb:beginsAt ?x2 ." + - " ?x1 pdb:endsAt ?x3 . " + - " ?x5 dcterms:isPartOf ?x4 . " + + " ?x1 pdb:endsAt ?x3 ." + + " ?x5 dcterms:isPartOf ?x4 ." + " ?x5 rdf:type ?x6 ." + " ?x5 pdb:isImmediatelyBefore ?x7 ." + + " ?x5 pdb:hasChainPosition ?x8 ." + + " ?x8 rdfs:label ?residuePosition ." + " ?organism rdfs:label ?organismName ." + " ?seq rdf:type pdb:PolymerSequence ." + - " ?seq pdb:hasValue ?sequence. } " + + " ?seq pdb:hasValue ?sequence . } " + "WHERE { ?x1 rdf:type pdb:Helix ." + " ?x1 pdb:beginsAt ?x2 ." + " ?x1 pdb:endsAt ?x3 ." + @@ -206,7 +223,9 @@ " ?x4 rdf:type <http://bio2rdf.org/pdb:Polypeptide(L)> ." + " ?x5 dcterms:isPartOf ?x4 ." + " ?x5 rdf:type ?x6 ." + - " ?x5 pdb:hasChainPosition ?x8 . " + + " ?x5 pdb:hasChainPosition ?x8 ." + + " ?x8 dcterms:isPartOf ?x4 ." + + " ?x8 rdfs:label ?residuePosition ." + " OPTIONAL { ?x5 pdb:isImmediatelyBefore ?x7 . } . "; if (chainID.length() == 1 && pdbID.length() == 4) @@ -256,6 +275,59 @@ return niter; } + private HashMap<Integer, Resource> createPositionResidueMap(){ + + HashMap<Integer, Resource> posres = new HashMap<Integer, Resource>(150); + Property iib = ResourceFactory.createProperty("http://bio2rdf.org/pdb:", "isImmediatelyBefore"); + + ResIterator firstAAs = this.getFirstAA(); + while ( firstAAs.hasNext()){ + Resource firstAA = firstAAs.next(); + Resource nextAA = firstAA; + Resource currentAA = firstAA; + do { + currentAA = nextAA; + posres.put(new Integer(this.getResiduePosition(currentAA)), currentAA); + nextAA = _pdbIdModel.getProperty(currentAA, iib).getResource(); + } while (currentAA.hasProperty(iib)); + } + + return posres; + } + + private int getResiduePosition(Resource res) { + Property hasChainPosition = ResourceFactory.createProperty("http://bio2rdf.org/pdb:", "hasChainPosition"); + Property label = ResourceFactory.createProperty("http://www.w3.org/2000/01/rdf-schema#", "label"); + ResourceFactory.createResource(); + + NodeIterator residuePosition = _pdbIdModel.listObjectsOfProperty(res, hasChainPosition ); + ArrayList<RDFNode> positionNodes = new ArrayList<RDFNode>(); + ArrayList<String> positionLabels = new ArrayList<String>(); + while ( residuePosition.hasNext() ) { + RDFNode positionNode = residuePosition.next(); + positionNodes.add(positionNode); + NodeIterator positionLabelNodes = _pdbIdModel.listObjectsOfProperty( positionNode.asResource(), label ); + while ( positionLabelNodes.hasNext() ) { + positionLabels.add(positionLabelNodes.next().toString()); + } + + } + + + Integer position = null; + if ( positionNodes.size() == 1 && positionLabels.size() == 1 ) { + String positionLabel = positionLabels.get(0); + String a = new String( "Position " ); + String b = new String( " on chain" ); + position = Integer.parseInt( + positionLabel.substring(positionLabel.indexOf(a) + a.length(), positionLabel.indexOf(b))); + } else { + position = new Integer(0); + _logger.error(""); + } + return position.intValue(); + } + public void addDistanceInfo(){ String queryString = "PREFIX pdb: <http://bio2rdf.org/pdb:> " + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lor...@us...> - 2011-11-11 09:22:14
|
Revision: 3395 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3395&view=rev Author: lorenz_b Date: 2011-11-11 09:22:08 +0000 (Fri, 11 Nov 2011) Log Message: ----------- Added method to select resources randomly - very slow. Modified Paths: -------------- trunk/scripts/src/main/java/org/dllearner/scripts/SPARQLSampleDebugging.java Modified: trunk/scripts/src/main/java/org/dllearner/scripts/SPARQLSampleDebugging.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/scripts/SPARQLSampleDebugging.java 2011-11-10 14:58:27 UTC (rev 3394) +++ trunk/scripts/src/main/java/org/dllearner/scripts/SPARQLSampleDebugging.java 2011-11-11 09:22:08 UTC (rev 3395) @@ -55,6 +55,28 @@ return resources; } + private Set<String> extractSampleResourcesRandom(int size){ + logger.info("Extracting " + sampleSize + "sample resources..."); + long startTime = System.currentTimeMillis(); + Set<String> resources = new HashSet<String>(); + + String query = "SELECT COUNT(DISTINCT ?s) WHERE {?s a ?type}"; + ResultSet rs = SparqlQuery.convertJSONtoResultSet(cache.executeSelectQuery(endpoint, query)); + int max = rs.next().getLiteral(rs.getResultVars().get(0)).getInt(); + + for(int i = 0; i < size; i++){ + int random = (int)(Math.random() * max); + query = String.format("SELECT DISTINCT ?s WHERE {?s a ?type} LIMIT 1 OFFSET %d", random); + System.out.println(random); + rs = SparqlQuery.convertJSONtoResultSet(cache.executeSelectQuery(endpoint, query)); + resources.add(rs.next().getResource("s").getURI());System.out.println(resources); + } + + + logger.info("...done in " + (System.currentTimeMillis()-startTime) + "ms."); + return resources; + } + private OWLOntology extractSampleModule(Set<String> resources){ logger.info("Extracting sample module..."); long startTime = System.currentTimeMillis(); @@ -94,8 +116,8 @@ OWLOntology sample; OWLOntology merged; OWLReasoner reasoner; - for(int i = 0; i < 10; i++){ - Set<String> resources = extractSampleResources(i * sampleSize); + for(int i = 0; i < 1; i++){ + Set<String> resources = extractSampleResourcesRandom(sampleSize); sample = extractSampleModule(resources); Set<OWLOntology> ontologies = new HashSet<OWLOntology>(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lor...@us...> - 2011-11-10 14:58:36
|
Revision: 3394 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3394&view=rev Author: lorenz_b Date: 2011-11-10 14:58:27 +0000 (Thu, 10 Nov 2011) Log Message: ----------- Started script which picks some random resources from endpoint, and retrieves their surrounding up to a specific level and uses this data together with a generated DBpedia ontology for debugging tests. Added Paths: ----------- trunk/scripts/src/main/java/org/dllearner/scripts/SPARQLSampleDebugging.java trunk/scripts/src/main/resources/dbpedia_0.75.owl Added: trunk/scripts/src/main/java/org/dllearner/scripts/SPARQLSampleDebugging.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/scripts/SPARQLSampleDebugging.java (rev 0) +++ trunk/scripts/src/main/java/org/dllearner/scripts/SPARQLSampleDebugging.java 2011-11-10 14:58:27 UTC (rev 3394) @@ -0,0 +1,129 @@ +package org.dllearner.scripts; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.net.URL; +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; + +import org.apache.log4j.Level; +import org.apache.log4j.Logger; +import org.dllearner.algorithm.qtl.util.ModelGenerator; +import org.dllearner.algorithm.qtl.util.ModelGenerator.Strategy; +import org.dllearner.kb.sparql.ExtractionDBCache; +import org.dllearner.kb.sparql.SparqlEndpoint; +import org.dllearner.kb.sparql.SparqlQuery; +import org.semanticweb.owlapi.apibinding.OWLManager; +import org.semanticweb.owlapi.model.IRI; +import org.semanticweb.owlapi.model.OWLOntology; +import org.semanticweb.owlapi.model.OWLOntologyCreationException; +import org.semanticweb.owlapi.model.OWLOntologyManager; +import org.semanticweb.owlapi.reasoner.OWLReasoner; + +import com.clarkparsia.pellet.owlapiv3.PelletReasonerFactory; +import com.hp.hpl.jena.query.ResultSet; +import com.hp.hpl.jena.rdf.model.Model; +import com.hp.hpl.jena.rdf.model.ModelFactory; + +public class SPARQLSampleDebugging { + + private SparqlEndpoint endpoint; + private ExtractionDBCache cache = new ExtractionDBCache("cache"); + + private int sampleSize = 1000; + private int depth = 3; + + private Logger logger = Logger.getLogger(SPARQLSampleDebugging.class); + + public SPARQLSampleDebugging(SparqlEndpoint endpoint) { + this.endpoint = endpoint; + } + + private Set<String> extractSampleResources(int offset){ + logger.info("Extracting " + sampleSize + "sample resources..."); + long startTime = System.currentTimeMillis(); + Set<String> resources = new HashSet<String>(); + String query = String.format("SELECT DISTINCT ?s WHERE {?s a ?type} LIMIT %d OFFSET %d", sampleSize, offset); + + ResultSet rs = SparqlQuery.convertJSONtoResultSet(cache.executeSelectQuery(endpoint, query)); + + while(rs.hasNext()){ + resources.add(rs.next().getResource("s").getURI()); + } + logger.info("...done in " + (System.currentTimeMillis()-startTime) + "ms."); + return resources; + } + + private OWLOntology extractSampleModule(Set<String> resources){ + logger.info("Extracting sample module..."); + long startTime = System.currentTimeMillis(); + ModelGenerator modelGen = new ModelGenerator(endpoint, cache); + Model model = ModelFactory.createDefaultModel(); + for(String resource : resources){ + model.add(modelGen.createModel(resource, Strategy.CHUNKS, depth)); + } + logger.info("...done in " + (System.currentTimeMillis()-startTime) + "ms."); + return convert(model); + + } + + private OWLOntology loadReferenceOntology() throws OWLOntologyCreationException{ + OWLOntology ontology = OWLManager.createOWLOntologyManager().loadOntologyFromOntologyDocument( + getClass().getClassLoader().getResourceAsStream("dbpedia_0.75.owl")); + return ontology; + } + + private OWLOntology convert(Model model) { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + model.write(baos, "N-TRIPLE"); + ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); + OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); + OWLOntology retOnt = null; + try { + retOnt = manager.loadOntologyFromOntologyDocument(bais); + } catch (OWLOntologyCreationException e) { + + } + return retOnt; + } + + public void run() throws OWLOntologyCreationException{ + OWLOntology reference = loadReferenceOntology(); + + OWLOntology sample; + OWLOntology merged; + OWLReasoner reasoner; + for(int i = 0; i < 10; i++){ + Set<String> resources = extractSampleResources(i * sampleSize); + sample = extractSampleModule(resources); + + Set<OWLOntology> ontologies = new HashSet<OWLOntology>(); + ontologies.add(sample); + ontologies.add(reference); + + merged = OWLManager.createOWLOntologyManager().createOntology(IRI.create("http://merged.en"), ontologies); + + reasoner = PelletReasonerFactory.getInstance().createNonBufferingReasoner(merged); + boolean isConsistent = reasoner.isConsistent(); + logger.info("Consistent: " + isConsistent); + System.out.println(isConsistent); + reasoner.dispose(); + } + + } + + /** + * @param args + * @throws Exception + */ + public static void main(String[] args) throws Exception { + Logger.getRootLogger().setLevel(Level.INFO); + Logger.getLogger(SPARQLSampleDebugging.class).setLevel(Level.INFO); + SparqlEndpoint endpoint = new SparqlEndpoint(new URL("http://dbpedia.aksw.org:8902/sparql"), + Collections.singletonList("http://dbpedia.org"), Collections.<String>emptyList()); + new SPARQLSampleDebugging(endpoint).run(); + + } + +} Property changes on: trunk/scripts/src/main/java/org/dllearner/scripts/SPARQLSampleDebugging.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: trunk/scripts/src/main/resources/dbpedia_0.75.owl =================================================================== --- trunk/scripts/src/main/resources/dbpedia_0.75.owl (rev 0) +++ trunk/scripts/src/main/resources/dbpedia_0.75.owl 2011-11-10 14:58:27 UTC (rev 3394) @@ -0,0 +1,32812 @@ +<?xml version="1.0"?> +<rdf:RDF xmlns="owlapi:ontology:ont1#" + xml:base="owlapi:ontology:ont1" + xmlns:Software="http://dbpedia.org/ontology/Software/" + xmlns:Astronaut="http://dbpedia.org/ontology/Astronaut/" + xmlns:SpaceStation="http://dbpedia.org/ontology/SpaceStation/" + xmlns:Building="http://dbpedia.org/ontology/Building/" + xmlns:Work="http://dbpedia.org/ontology/Work/" + xmlns:GrandPrix="http://dbpedia.org/ontology/GrandPrix/" + xmlns:Spacecraft="http://dbpedia.org/ontology/Spacecraft/" + xmlns:Infrastructure="http://dbpedia.org/ontology/Infrastructure/" + xmlns:MeanOfTransportation="http://dbpedia.org/ontology/MeanOfTransportation/" + xmlns:schema="http://schema.org/" + xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" + xmlns:PopulatedPlace="http://dbpedia.org/ontology/PopulatedPlace/" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:SpaceShuttle="http://dbpedia.org/ontology/SpaceShuttle/" + xmlns:Lake="http://dbpedia.org/ontology/Lake/" + xmlns:LunarCrater="http://dbpedia.org/ontology/LunarCrater/" + xmlns:School="http://dbpedia.org/ontology/School/" + xmlns:Rocket="http://dbpedia.org/ontology/Rocket/" + xmlns:foaf="http://xmlns.com/foaf/0.1/" + xmlns:AutomobileEngine="http://dbpedia.org/ontology/AutomobileEngine/" + xmlns:Automobile="http://dbpedia.org/ontology/Automobile/" + xmlns:ontology="http://dbpedia.org/ontology/" + xmlns:Canal="http://dbpedia.org/ontology/Canal/" + xmlns:SpaceMission="http://dbpedia.org/ontology/SpaceMission/" + xmlns:Planet="http://dbpedia.org/ontology/Planet/" + xmlns:Stream="http://dbpedia.org/ontology/Stream/" + xmlns:Weapon="http://dbpedia.org/ontology/Weapon/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema#" + xmlns:owl="http://www.w3.org/2002/07/owl#" + xmlns:gml="http://www.opengis.net/gml/" + xmlns:Person="http://dbpedia.org/ontology/Person/"> + <owl:Ontology rdf:about="owlapi:ontology:ont1"/> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Datatypes + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://dbpedia.org/datatype/centimetre --> + + <rdfs:Datatype rdf:about="http://dbpedia.org/datatype/centimetre"/> + + + + <!-- http://dbpedia.org/datatype/cubicCentimetre --> + + <rdfs:Datatype rdf:about="http://dbpedia.org/datatype/cubicCentimetre"/> + + + + <!-- http://dbpedia.org/datatype/cubicKilometre --> + + <rdfs:Datatype rdf:about="http://dbpedia.org/datatype/cubicKilometre"/> + + + + <!-- http://dbpedia.org/datatype/cubicMetre --> + + <rdfs:Datatype rdf:about="http://dbpedia.org/datatype/cubicMetre"/> + + + + <!-- http://dbpedia.org/datatype/cubicMetrePerSecond --> + + <rdfs:Datatype rdf:about="http://dbpedia.org/datatype/cubicMetrePerSecond"/> + + + + <!-- http://dbpedia.org/datatype/day --> + + <rdfs:Datatype rdf:about="http://dbpedia.org/datatype/day"/> + + + + <!-- http://dbpedia.org/datatype/engineConfiguration --> + + <rdfs:Datatype rdf:about="http://dbpedia.org/datatype/engineConfiguration"/> + + + + <!-- http://dbpedia.org/datatype/euro --> + + <rdfs:Datatype rdf:about="http://dbpedia.org/datatype/euro"/> + + + + <!-- http://dbpedia.org/datatype/fuelType --> + + <rdfs:Datatype rdf:about="http://dbpedia.org/datatype/fuelType"/> + + + + <!-- http://dbpedia.org/datatype/hour --> + + <rdfs:Datatype rdf:about="http://dbpedia.org/datatype/hour"/> + + + + <!-- http://dbpedia.org/datatype/inhabitantsPerSquareKilometre --> + + <rdfs:Datatype rdf:about="http://dbpedia.org/datatype/inhabitantsPerSquareKilometre"/> + + + + <!-- http://dbpedia.org/datatype/kelvin --> + + <rdfs:Datatype rdf:about="http://dbpedia.org/datatype/kelvin"/> + + + + <!-- http://dbpedia.org/datatype/kilogram --> + + <rdfs:Datatype rdf:about="http://dbpedia.org/datatype/kilogram"/> + + + + <!-- http://dbpedia.org/datatype/kilogramPerCubicMetre --> + + <rdfs:Datatype rdf:about="http://dbpedia.org/datatype/kilogramPerCubicMetre"/> + + + + <!-- http://dbpedia.org/datatype/kilometre --> + + <rdfs:Datatype rdf:about="http://dbpedia.org/datatype/kilometre"/> + + + + <!-- http://dbpedia.org/datatype/kilometrePerSecond --> + + <rdfs:Datatype rdf:about="http://dbpedia.org/datatype/kilometrePerSecond"/> + + + + <!-- http://dbpedia.org/datatype/kilowatt --> + + <rdfs:Datatype rdf:about="http://dbpedia.org/datatype/kilowatt"/> + + + + <!-- http://dbpedia.org/datatype/litre --> + + <rdfs:Datatype rdf:about="http://dbpedia.org/datatype/litre"/> + + + + <!-- http://dbpedia.org/datatype/megabyte --> + + <rdfs:Datatype rdf:about="http://dbpedia.org/datatype/megabyte"/> + + + + <!-- http://dbpedia.org/datatype/metre --> + + <rdfs:Datatype rdf:about="http://dbpedia.org/datatype/metre"/> + + + + <!-- http://dbpedia.org/datatype/millimetre --> + + <rdfs:Datatype rdf:about="http://dbpedia.org/datatype/millimetre"/> + + + + <!-- http://dbpedia.org/datatype/minute --> + + <rdfs:Datatype rdf:about="http://dbpedia.org/datatype/minute"/> + + + + <!-- http://dbpedia.org/datatype/newtonMetre --> + + <rdfs:Datatype rdf:about="http://dbpedia.org/datatype/newtonMetre"/> + + + + <!-- http://dbpedia.org/datatype/poundSterling --> + + <rdfs:Datatype rdf:about="http://dbpedia.org/datatype/poundSterling"/> + + + + <!-- http://dbpedia.org/datatype/squareKilometre --> + + <rdfs:Datatype rdf:about="http://dbpedia.org/datatype/squareKilometre"/> + + + + <!-- http://dbpedia.org/datatype/squareMetre --> + + <rdfs:Datatype rdf:about="http://dbpedia.org/datatype/squareMetre"/> + + + + <!-- http://dbpedia.org/datatype/usDollar --> + + <rdfs:Datatype rdf:about="http://dbpedia.org/datatype/usDollar"/> + + + + <!-- http://dbpedia.org/datatype/valvetrain --> + + <rdfs:Datatype rdf:about="http://dbpedia.org/datatype/valvetrain"/> + + + + <!-- http://www.w3.org/2001/XMLSchema#date --> + + <rdfs:Datatype rdf:about="http://www.w3.org/2001/XMLSchema#date"/> + + + + <!-- http://www.w3.org/2001/XMLSchema#gYear --> + + <rdfs:Datatype rdf:about="http://www.w3.org/2001/XMLSchema#gYear"/> + + + + <!-- http://www.w3.org/2001/XMLSchema#gYearMonth --> + + <rdfs:Datatype rdf:about="http://www.w3.org/2001/XMLSchema#gYearMonth"/> + + + + <!-- + /////////////////////////////////////////////////////////////////////////////////////// + // + // Object Properties + // + /////////////////////////////////////////////////////////////////////////////////////// + --> + + + + + <!-- http://dbpedia.org/ontology/academicAdvisor --> + + <owl:ObjectProperty rdf:about="http://dbpedia.org/ontology/academicAdvisor"> + <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#InverseFunctionalProperty"/> + <rdfs:domain rdf:resource="http://dbpedia.org/ontology/Person"/> + <rdfs:domain rdf:resource="http://dbpedia.org/ontology/Scientist"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/actScore"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/addressInRoad"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/administrativeCollectivity"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/administrativeDistrict"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/affiliation"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/aircraftAttack"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/aircraftBomber"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/aircraftElectronic"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/aircraftFighter"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/aircraftHelicopter"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/aircraftHelicopterAttack"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/aircraftHelicopterCargo"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/aircraftHelicopterMultirole"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/aircraftHelicopterObservation"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/aircraftHelicopterTransport"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/aircraftHelicopterUtility"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/aircraftInterceptor"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/aircraftPatrol"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/aircraftRecon"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/aircraftTrainer"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/aircraftTransport"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/album"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/alliance"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/alumni"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/animal"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/anthem"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/appointer"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/archipelago"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/architect"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/architecturalStyle"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/arrondissement"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/artery"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/artist"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/assembly"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/assistantPrincipal"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/associate"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/associateEditor"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/associatedAct"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/associatedBand"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/associatedMusicalArtist"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/associatedRocket"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/associationOfLocalGovernment"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/athletics"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/author"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/authority"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/automobilePlatform"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/availableSmartCard"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/award"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/bandMember"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/basedOn"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/battle"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/beatifiedBy"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/beatifiedPlace"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/beltwayCity"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/billed"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/binomial"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/binomialAuthority"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/biome"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/birthPlace"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/blockAlloy"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/board"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/bodyDiscovered"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/bodyStyle"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/boiler"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/boilerPressure"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/booster"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/border"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/borough"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/branchFrom"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/branchTo"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/brand"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/broadcastArea"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/broadcastNetwork"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/builder"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/building"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/campus"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/canonizedBy"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/canonizedPlace"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/canton"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/capital"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/capitalCountry"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/capitalMountain"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/capitalPlace"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/capitalPosition"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/capitalRegion"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/category"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/ceo"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/ceremonialCounty"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/chain"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/chairLabel"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/chairman"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/chairperson"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/chancellor"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/channel"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/chaplain"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/chef"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/chiefEditor"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/child"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/childOrganisation"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/choreographer"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/cinematography"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/citizenship"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/city"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/class"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/closingFilm"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/clubsRecordGoalscorer"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/coach"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/coachedTeam"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/college"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/colour"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/commandStructure"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/commander"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/committeeInLegislature"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/company"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/comparable"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/compiler"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/component"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/composer"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/computingInput"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/computingMedia"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/computingPlatform"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/congressionalDistrict"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/connotation"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/constructionMaterial"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/coolingSystem"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/councilArea"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/country"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/countryOrigin"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/countryWithFirstAstronaut"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/countryWithFirstSatellite"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/countryWithFirstSatelliteLaunched"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/countryWithFirstSpaceflight"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/county"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/countySeat"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/coverArtist"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/cpu"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/creativeDirector"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/creator"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/creatorOfDish"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/crew"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/crewMember"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/crosses"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/curator"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/currency"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/currentMember"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/currentPartner"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/currentProduction"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/custodian"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/daylightSavingTimeZone"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/dean"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/deathCause"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/deathPlace"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/debutTeam"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/denomination"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/department"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/deputy"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/derivative"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/designCompany"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/designer"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/developer"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/director"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/discoverer"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/distributingCompany"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/distributingLabel"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/distributor"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/district"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/division"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/doctoralStudent"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/domain"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/draftTeam"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/drainsFrom"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/drainsTo"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/editing"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/editor"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/education"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/educationSystem"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/emmyAward"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/employer"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/endPoint"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/endingTheme"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/engine"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/engineType"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/engineer"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/equipment"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/era"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/ethnicGroup"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/ethnicity"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/europeanAffiliation"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/europeanParliamentGroup"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/event"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/executiveProducer"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/family"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/fastestDriver"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/fastestDriverCountry"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/fastestDriverTeam"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/federalState"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/field"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/film"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/filmFareAward"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/firstAppearance"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/firstAscentPerson"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/firstDriver"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/firstDriverCountry"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/firstDriverTeam"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/firstFlight"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/firstLaunchRocket"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/firstLeader"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/firstPopularVote"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/firstRace"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/firstWin"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/firstWinner"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/flagBearer"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/followingEvent"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/format"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/formerBandMember"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/formerBroadcastNetwork"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/formerChoreographer"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/formerCoach"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/formerHighschool"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/formerPartner"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/formerTeam"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/foundationPlace"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/foundedBy"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/foundingPerson"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/fourthCommander"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/frazioni"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/fuel"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/fuelSystem"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/fundedBy"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/gameArtist"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/gameEngine"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/garrison"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/gender"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/generalManager"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/genre"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/genus"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/governingBody"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/government"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/governmentCountry"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/governmentMountain"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/governmentPlace"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/governmentPosition"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/governmentRegion"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/governmentType"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/governor"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/governorGeneral"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/grades"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/ground"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/growingGrape"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/guest"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/hasJunctionWith"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/hasVariant"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/head"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/headAlloy"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/headChef"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/headquarter"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/headquarters"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/headteacher"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/heir"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/highestMountain"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/highestPlace"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/highestPosition"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/highestRegion"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/highestState"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/highschool"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/highwaySystem"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/homeArena"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/homeStadium"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/homeport"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/hometown"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/honours"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/house"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/hubAirport"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/ideology"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/illustrator"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/incumbent"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/industry"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/inflow"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/ingredient"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/innervates"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/instrument"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/intercommunality"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/internationalAffiliation"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/isPartOf"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/isPartOfAnatomicalStructure"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/isPartOfMilitaryConflict"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/isPartOfWineRegion"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/island"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/iso6391Code"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/iso6392Code"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/iso6393Code"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/isoCodeRegion"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/jointCommunity"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/jurisdiction"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/keyPerson"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/kingdom"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/knownFor"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/landingVehicle"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/language"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/languageFamily"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/languageRegulator"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/largestCity"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/largestSettlement"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/lastAppearance"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/lastFlight"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/lastLaunchRocket"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/lastRace"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/lastWin"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/launchPad"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/launchSite"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/launchVehicle"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/layout"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/leader"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/leaderFunction"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/leaderName"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/leaderParty"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/league"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/leftChild"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/leftTributary"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/legalForm"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/license"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/lieutenancyArea"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/lieutenant"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/literaryGenre"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/localAuthority"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/locatedInArea"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/location"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/locationCity"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/locationCountry"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/lounge"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/lowestMountain"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/lowestPlace"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/lowestPosition"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/lowestRegion"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/lowestState"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/lymph"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/lyrics"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/maidenFlightRocket"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/mainInterest"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/mainOrgan"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/maintainedBy"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/majorIsland"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/majorShrine"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/management"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/managementMountain"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/managementPlace"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/managementPosition"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/manager"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/managerClub"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/managingEditor"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/manufacturer"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/map"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/march"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/mayor"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/mediaType"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/meetingRoad"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/memberOfParliament"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/mergedIntoParty"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/metropolitanBorough"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/militaryBranch"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/militaryRank"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/militaryUnit"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/mission"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/monarch"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/mostWins"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/mountainRange"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/mouthCountry"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/mouthMountain"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/mouthPlace"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/mouthPosition"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/mouthRegion"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/movement"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/municipality"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/musicBy"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/musicComposer"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/musicFusionGenre"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/musicSubgenre"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/musicalArtist"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/musicalBand"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/namedAfter"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/narrator"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/nationalAffiliation"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/nationalOlympicCommittee"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/nationality"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/nearestCity"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/neighboringMunicipality"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/nerve"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/network"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/nextMission"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/nobelLaureates"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/nominee"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/nonFictionSubject"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/notableCommander"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/notableIdea"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/notableWine"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/notableWork"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/nrhpType"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/numberOfClassrooms"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/occupation"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/officerInCharge"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/officialLanguage"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/oilSystem"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/openingFilm"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/openingTheme"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/operatedBy"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/operatingSystem"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/operator"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/opponent"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/order"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/organSystem"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/origin"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/originalEndPoint"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/originalLanguage"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/originalStartPoint"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/orogeny"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/otherParty"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/outflow"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/owner"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/owningCompany"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/owningOrganisation"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/parent"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/parentCompany"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/parentMountainPeak"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/parentOrganisation"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/parish"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/part"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/partner"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/party"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/pastMember"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/pastor"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/patron"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/person"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/personFunction"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/philosophicalSchool"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/photographer"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/phylum"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/picture"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/pictureFormat"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/place"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/placeOfBurial"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/plant"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/poleDriver"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/poleDriverCountry"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/poleDriverTeam"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/politicalPartyInLegislature"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/politicalPartyOfLeader"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/populationPlace"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/port1"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/port2"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/portrayer"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/powerType"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/precursor"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/predecessor"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/premierePlace"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/presenter"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/president"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/previousEditor"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/previousEvent"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/previousInfrastructure"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/previousMission"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/previousWork"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/primeMinister"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/principal"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/principalArea"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/principalEngineer"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/producer"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/product"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/profession"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/programmeFormat"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/programmingLanguage"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/projectCoordinator"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/projectParticipant"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/promotion"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/prospectTeam"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/province"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/provost"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/publisher"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/railwayLineUsingTunnel"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/railwayRollingStock"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/rebuilder"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/recentWinner"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/recordLabel"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/recordedIn"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/rector"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/region"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/regionServed"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/regionalLanguage"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/related"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/relatedMeanOfTransportation"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/relation"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/relative"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/religion"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/religiousHead"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/religiousHeadLabel"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/residence"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/resolution"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/restingPlace"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/restingPlacePosition"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/retiredRocket"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/rightChild"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/rightTributary"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/rival"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/river"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/riverBranch"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/riverBranchOf"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/riverMouth"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/rocket"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/rocketFunction"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/routeEnd"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/routeEndLocation"/> + <owl:propertyDisjointWith rdf:resource="http://dbpedia.org/ontology/routeJunctio... [truncated message content] |
From: <seb...@us...> - 2011-11-10 13:28:58
|
Revision: 3393 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3393&view=rev Author: sebastianwtr Date: 2011-11-10 13:28:52 +0000 (Thu, 10 Nov 2011) Log Message: ----------- [tbsl] catched Exception Modified Paths: -------------- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/exploration/Sparql/SparqlObject.java Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/exploration/Sparql/SparqlObject.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/exploration/Sparql/SparqlObject.java 2011-11-10 13:01:22 UTC (rev 3392) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/exploration/Sparql/SparqlObject.java 2011-11-10 13:28:52 UTC (rev 3393) @@ -294,6 +294,17 @@ try { tmp_semantics=getSemantics(tmp_semantics); + if (tmp_semantics==null){ + goOnAfterWordnet=false; + final_answer.add("Error in searching Wordnet\n"); + } + else{ + //each word only one time + for(String k : tmp_semantics){ + if(!semantics.contains(k)) semantics.add(k); + } + } + } catch (IOException e) { // TODO Auto-generated catch block //e.printStackTrace(); @@ -301,10 +312,6 @@ final_answer.add("Error in searching Wordnet\n"); } - //each word only one time - for(String k : tmp_semantics){ - if(!semantics.contains(k)) semantics.add(k); - } } @@ -584,6 +591,7 @@ private static ArrayList<String> getSemantics (ArrayList<String> semantics) throws IOException, JWNLException { ArrayList<String> result = new ArrayList<String>(); + try{ for(String id :semantics){ List<String> array =wordnet.getRelatedNouns(id); for(String i:array){ @@ -593,6 +601,9 @@ } return result; + } catch (Exception e) { + return null; + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <seb...@us...> - 2011-11-10 13:01:32
|
Revision: 3392 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3392&view=rev Author: sebastianwtr Date: 2011-11-10 13:01:22 +0000 (Thu, 10 Nov 2011) Log Message: ----------- [tbsl] fixed some errors and programmed iteration depth 1 Modified Paths: -------------- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/exploration/Sparql/GetRessourcePropertys.java trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/exploration/Sparql/SparqlObject.java trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/exploration/exploration_main/exploration_main.java trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/exploration/exploration_main/test_vergleich.java trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/exploration/sax/ParseXmlHtml.java Added Paths: ----------- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/exploration/Sparql/Levenshtein.java Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/exploration/Sparql/GetRessourcePropertys.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/exploration/Sparql/GetRessourcePropertys.java 2011-11-10 08:15:41 UTC (rev 3391) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/exploration/Sparql/GetRessourcePropertys.java 2011-11-10 13:01:22 UTC (rev 3392) @@ -15,8 +15,12 @@ public class GetRessourcePropertys { public ArrayList<String> getPropertys(String element) throws IOException{ + try{ sendServerPropertyRequest(element); return do_parsing("answer_property"); + } catch (Exception e){ + return null; + } } Added: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/exploration/Sparql/Levenshtein.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/exploration/Sparql/Levenshtein.java (rev 0) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/exploration/Sparql/Levenshtein.java 2011-11-10 13:01:22 UTC (rev 3392) @@ -0,0 +1,88 @@ +package org.dllearner.algorithm.tbsl.exploration.Sparql; + + +import java.lang.Math; +import java.math.BigDecimal; + +public class Levenshtein { + + + //http://de.wikipedia.org/wiki/Levenshtein-Distanz + public double nld(String orig, String eing){ + //int result = diff(orig,eing); + int result = computeLevenshteinDistance(orig,eing); + int length=Math.max(orig.length(),eing.length()); + + + //if distance between both is zero, then the NLD must be one + if(result==0 ){ + return 1; + } + else{ + BigDecimal m = new BigDecimal(result); + BigDecimal n = new BigDecimal(length); + + BigDecimal c = new BigDecimal(0); + c=m.divide(n, 5, BigDecimal.ROUND_FLOOR); + + return c.doubleValue(); + } + + } + + public int diff(String orig, String eing) { + + int matrix[][] = new int[orig.length() + 1][eing.length() + 1]; + for (int i = 0; i < orig.length() + 1; i++) { + matrix[i][0] = i; + } + for (int i = 0; i < eing.length() + 1; i++) { + matrix[0][i] = i; + } + for (int a = 1; a < orig.length() + 1; a++) { + for (int b = 1; b < eing.length() + 1; b++) { + int right = 0; + if (orig.charAt(a - 1) != eing.charAt(b - 1)) { + right = 1; + } + int mini = matrix[a - 1][b] + 1; + if (matrix[a][b - 1] + 1 < mini) { + mini = matrix[a][b - 1] + 1; + } + if (matrix[a - 1][b - 1] + right < mini) { + mini = matrix[a - 1][b - 1] + right; + } + matrix[a][b] = mini; + } + } + + return matrix[orig.length()][eing.length()]; + } + + + //http://en.wikibooks.org/wiki/Algorithm_Implementation/Strings/Levenshtein_distance#Java + private static int minimum(int a, int b, int c) { + return Math.min(Math.min(a, b), c); + } + + public static int computeLevenshteinDistance(CharSequence str1, + CharSequence str2) { + int[][] distance = new int[str1.length() + 1][str2.length() + 1]; + + for (int i = 0; i <= str1.length(); i++) + distance[i][0] = i; + for (int j = 0; j <= str2.length(); j++) + distance[0][j] = j; + + for (int i = 1; i <= str1.length(); i++) + for (int j = 1; j <= str2.length(); j++) + distance[i][j] = minimum( + distance[i - 1][j] + 1, + distance[i][j - 1] + 1, + distance[i - 1][j - 1] + + ((str1.charAt(i - 1) == str2.charAt(j - 1)) ? 0 + : 1)); + + return distance[str1.length()][str2.length()]; + } +} Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/exploration/Sparql/SparqlObject.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/exploration/Sparql/SparqlObject.java 2011-11-10 08:15:41 UTC (rev 3391) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/exploration/Sparql/SparqlObject.java 2011-11-10 13:01:22 UTC (rev 3392) @@ -17,6 +17,7 @@ import net.didion.jwnl.JWNLException; +import org.dllearner.algorithm.tbsl.exploration.sax.ParseXmlHtml; import org.dllearner.algorithm.tbsl.nlp.WordNet; import org.dllearner.algorithm.tbsl.sparql.BasicQueryTemplate; import org.dllearner.algorithm.tbsl.sparql.Path; @@ -36,22 +37,26 @@ static int explorationdepthwordnet=1; static int iterationdepth =0; static int numberofanswers=1; + static double LvenstheinMin = 0.95; static WordNet wordnet; BasicTemplator btemplator; Templator templator; - HashMap<String, String> hm; + private static HashMap<String, String> hm = new HashMap<String, String>(); //Konstruktor - public SparqlObject(HashMap<String, String> hm_new) throws MalformedURLException{ + public SparqlObject() throws MalformedURLException{ wordnet = new WordNet(); - hm=hm_new; + //hm=hm_new; + hm=ParseXmlHtml.parse_xml("/home/swalter/workspace/qaldEntity2",hm); + hm=ParseXmlHtml.parse_xml("/home/swalter/workspace/qaldEntity1",hm); System.out.println("Loading SPARQL Templator"); btemplator = new BasicTemplator(); templator = new Templator(); System.out.println("Loading SPARQL Templator Done\n"); setExplorationdepthwordnet(1); - setIterationdepth(0); + //eigentlich immer mit 0 initialisieren + setIterationdepth(1); setNumberofanswers(1); } @@ -101,17 +106,23 @@ public void create_Sparql_query(String question) throws JWNLException, IOException{ //create_Sparql_query_new(string); - ArrayList<String> lstquery = new ArrayList<String>(); + ArrayList<ArrayList<String>> lstquery = new ArrayList<ArrayList<String>>(); + long startParsingTime = System.currentTimeMillis(); lstquery=getQuery(question); + long endParsingTime = System.currentTimeMillis(); + System.out.println("The Questionparsing took "+ (endParsingTime-startParsingTime)+ " ms"); + ArrayList<String> final_answer = new ArrayList<String>(); //if(!lstquery.isEmpty()){ //for each querry - for(String query : lstquery){ + for(ArrayList<String> querylist : lstquery){ /* * ################################################################################################# */ //only testfunction to save the generated queries in the tmp-folder + String query=""; + query=querylist.get(0).toString(); if(getIterationdepth()==-1){ String tmp = new String(); String s = null; @@ -139,7 +150,7 @@ } String out=null; - if (query=="" || query==" ") query="Could not parse"; + if (query=="" || query==" "||query.length()==0) query="Could not parse"; out=tmp + "\n" + question + ":\n"+query+"\n"; BufferedWriter outfile = new BufferedWriter( @@ -182,7 +193,9 @@ } String answer; answer=sendServerQuestionRequest(query); - System.out.println(query); + final_answer.add(answer); + /*System.out.println(query); + if (query=="" || query==" "||query.length()==0) answer="Could not parse"; System.out.println("Antwort: " + answer); String out=tmp + "\n" + "Question: "+question + "\n"+"Query: " + query +"\n Anwer: "+answer+"\n\n##############################"; @@ -191,7 +204,7 @@ new FileOutputStream( "/tmp/answer.txt" ) ) ); outfile.write(out); - outfile.close(); + outfile.close(); */ } /* * ################################################################################################# @@ -199,6 +212,134 @@ //Iterration 1 if(getIterationdepth()==1){ + //asking server + String answer; + answer=sendServerQuestionRequest(query); + + //if Emty answer, get properties an look up the right property with levensthein + if(answer.contains("EmtyAnswer")){ + //TODO: get all information from the query + //TODO: maybe put the query + information in an array list of arraylist. each arraylist contains the query, the variables and the uris. Then iterate over the List and get the query for sending to server + String rescource=""; + + //get the resource of the query. always the last Item in the array! + //Funktioniert! + String resource_tmp=""; + int tmp_length=querylist.size(); + resource_tmp=querylist.get(tmp_length-1); + String[] array_tmp = resource_tmp.split(":"); + rescource=array_tmp[1]; + + + //the property we are looking for is always the second last in the array! + //Funktioniert! + String property_to_compare_with=""; + tmp_length=querylist.size(); + //second last + property_to_compare_with=querylist.get(tmp_length-2); + array_tmp = property_to_compare_with.split(":"); + property_to_compare_with=array_tmp[1]; + //System.out.println("property_to_compare_with: "+property_to_compare_with); + + + //contains uri AND string, every second is the string + //Funktioniert + ArrayList<String> properties = new ArrayList<String>(); + GetRessourcePropertys property = new GetRessourcePropertys(); + Boolean goOnAfterProperty = true; + try { + //using uri now, not the string + properties=property.getPropertys(hm.get(rescource.toLowerCase())); + if (properties==null){ + final_answer.add("Error in getting Properties\n"); + goOnAfterProperty=false; + } + //System.out.println(properties); + } catch (IOException e) { + // TODO Auto-generated catch block + //e.printStackTrace(); + final_answer.add("Error in getting Properties\n"); + goOnAfterProperty=false; + + } + if(goOnAfterProperty==true){ + //property_to_compare_with mit der Liste der propertys vergleichen, und wenn der normalisierte Wert >= LvenstheinMin ist, einbauen und neue query erzeugen. + Levenshtein levensthein = new Levenshtein(); + ArrayList<String> new_queries= new ArrayList<String>(); + for(int i =1; i<=properties.size()-2;i=i+2){ + //double tmp=levensthein.nld(property_to_compare_with.toLowerCase(), properties.get(i).toLowerCase()); + double tmp=levensthein.computeLevenshteinDistance(property_to_compare_with.toLowerCase(), properties.get(i).toLowerCase()); + //create new query + //System.out.println(tmp); + //if(tmp>=LvenstheinMin){ + if(tmp<=3.0){ + //System.out.println(tmp); + //alte property uri mit neuer ersetzen: + String query_tmp=query; + query_tmp=query_tmp.replace(hm.get(property_to_compare_with.toLowerCase()),properties.get(i-1)); + //System.out.println("hm.get(property_to_compare_with.toLowerCase(): " + hm.get(property_to_compare_with.toLowerCase())); + new_queries.add(query_tmp); + } + + } + + System.out.println("Start Iterating Wordnet with "+property_to_compare_with+" and deept of "+explorationdepthwordnet); + ArrayList<String> semantics=new ArrayList<String>(); + ArrayList<String> tmp_semantics=new ArrayList<String>(); + ArrayList<String> result_SemanticsMatchProperties=new ArrayList<String>(); + semantics.add(property_to_compare_with); + tmp_semantics=semantics; + Boolean goOnAfterWordnet = true; + for(int i=0;i<=explorationdepthwordnet;i++){ + + try { + tmp_semantics=getSemantics(tmp_semantics); + } catch (IOException e) { + // TODO Auto-generated catch block + //e.printStackTrace(); + goOnAfterWordnet=false; + final_answer.add("Error in searching Wordnet\n"); + + } + //each word only one time + for(String k : tmp_semantics){ + if(!semantics.contains(k)) semantics.add(k); + } + + } + + if(goOnAfterWordnet==true){ + // ArrayList<String> new_queries= new ArrayList<String>(); + + //TODO: Try, if it works, if you use only one loop: (b.lowerCase).contains(properties.get(h)) + for(int h=1;h<properties.size()-2;h=h+2){ + for(String b : semantics){ + //System.out.println(properties.get(h)); + //System.out.println(b); + if(properties.get(h).contains(b.toLowerCase())){ + if(!result_SemanticsMatchProperties.contains(properties.get(h))){ + //create new query + result_SemanticsMatchProperties.add(properties.get(h)); + String query_tmp=query; + query_tmp=query_tmp.replace(hm.get(property_to_compare_with.toLowerCase()),properties.get(h-1)); + //System.out.println("hm.get(property_to_compare_with.toLowerCase(): " + hm.get(property_to_compare_with.toLowerCase())); + new_queries.add(query_tmp); + } + } + } + } + + for(String bla : new_queries){ + String answer_tmp; + answer_tmp=sendServerQuestionRequest(bla); + if(!answer_tmp.contains("EmtyAnswer")){ + final_answer.add(answer_tmp); + } + } + } + } + } + } /* * ################################################################################################# @@ -208,6 +349,46 @@ } } + + BufferedReader in = null; + + String tmp=""; + // Lies Textzeilen aus der Datei in einen Vector: + try { + in = new BufferedReader( + new InputStreamReader( + new FileInputStream( "/tmp/answer" ) ) ); + String s; + while( null != (s = in.readLine()) ) { + tmp=tmp+"\n"+s; + } + } catch( FileNotFoundException ex ) { + } catch( Exception ex ) { + System.out.println( ex ); + } finally { + if( in != null ) + try { + in.close(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + String out=""; + for(String answer : final_answer){ + + out=out+ "\n"+answer+"\n"; + + } + System.out.println(question); + System.out.println(out); + BufferedWriter outfile = new BufferedWriter( + new OutputStreamWriter( + new FileOutputStream( "/tmp/answer" ) ) ); + + outfile.write(tmp+"\n"+question+" :\n"+out); + outfile.close(); } // string=string.replaceAll("?", ""); @@ -220,8 +401,8 @@ * @param question question in natural language * @return ArrayList of Sparql queries. */ - private ArrayList<String> getQuery(String question) { - ArrayList<String> lstquery = new ArrayList<String>(); + private ArrayList<ArrayList<String>> getQuery(String question) { + ArrayList<ArrayList<String>> lstquery = new ArrayList<ArrayList<String>>(); Set<BasicQueryTemplate> querytemps = btemplator.buildBasicQueries(question); for (BasicQueryTemplate temp : querytemps) { @@ -230,7 +411,8 @@ System.out.println("temp.getVariablesAsStringList();" + temp.getVariablesAsStringList()); System.out.println("temp.getConditions();" + temp.getConditions()); System.out.println("temp.getSlots();" + temp.getSlots());*/ - + ArrayList<String> lstquerynew = new ArrayList<String>(); + ArrayList<String> lstquerupsidedown = new ArrayList<String>(); String query; String selTerms =""; for(SPARQL_Term terms :temp.getSelTerms()) selTerms=selTerms+(terms.toString())+" "; @@ -270,7 +452,6 @@ String[] slots= null; for(Slot slot : temp.getSlots()){ - //hier muss dann noch die abfrage aus der hm raus, also das direkt die uri eingebettet wird. String tmp= slot.toString(); tmp= tmp.replace("UNSPEC",""); tmp= tmp.replace("RESOURCE",""); @@ -300,9 +481,25 @@ query_upside_down=query_upside_down.replace(replace, "<"+hm_result+">"); } + lstquerupsidedown.add(query_upside_down); + lstquerynew.add(query); + + //slots hinzufügen + for(Slot slot : temp.getSlots()){ + String tmp= slot.toString(); + tmp= tmp.replace("UNSPEC",""); + tmp= tmp.replace("RESOURCE",""); + tmp= tmp.replace("{",""); + tmp= tmp.replace("}",""); + tmp=tmp.replace(" ",""); + lstquerupsidedown.add(tmp); + lstquerynew.add(tmp); + } //System.out.println("Query: "+query); - lstquery.add(query); - lstquery.add(query_upside_down); + /*lstquery.add(query); + lstquery.add(query_upside_down);*/ + lstquery.add(lstquerynew); + lstquery.add(lstquerupsidedown); } @@ -455,6 +652,9 @@ string=string.replace("<td>",""); string=string.replace("<th>callret-0</th>", ""); string=string.replace("<th>y</th>",""); + while (string.contains(" ")) string=string.replace(" ",""); + if (string.length()==0) string="EmtyAnswer"; + //System.out.println("Stringlänge: "+string.length()); return string; } Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/exploration/exploration_main/exploration_main.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/exploration/exploration_main/exploration_main.java 2011-11-10 08:15:41 UTC (rev 3391) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/exploration/exploration_main/exploration_main.java 2011-11-10 13:01:22 UTC (rev 3392) @@ -31,7 +31,7 @@ */ public class exploration_main { - private static HashMap<String, String> hm = new HashMap<String, String>(); + //private static HashMap<String, String> hm = new HashMap<String, String>(); private static String qaldEntity2="http://greententacle.techfak.uni-bielefeld.de:5171/sparql?default-graph-uri=&query=SELECT+DISTINCT+%3Fc+%3Fl++WHERE+{%0D%0A++%3Fx+rdf%3Atype+%3Fc+.%0D%0A++%3Fc+rdfs%3Alabel+%3Fl+.%0D%0A++FILTER+%28lang%28%3Fl%29+%3D+%27en%27%29%0D%0A}&format=text%2Fhtml&debug=on&timeout="; private static String qaldEntity1="http://greententacle.techfak.uni-bielefeld.de:5171/sparql?default-graph-uri=&query=SELECT+DISTINCT+%3Fx+%3Fl++WHERE+{%0D%0A++%3Fx+rdf%3Atype+%3Fc+.%0D%0A++%3Fx+rdfs%3Alabel+%3Fl+.%0D%0A++FILTER+%28lang%28%3Fl%29+%3D+%27en%27%29%0D%0A}&format=text%2Fhtml&debug=on&timeout="; /** @@ -50,20 +50,20 @@ System.out.println("Start Indexing"); //For testing! - hm=ParseXmlHtml.parse_xml("/home/swalter/workspace/ressource/sparql_zwei",hm); - hm=ParseXmlHtml.parse_xml("/home/swalter/workspace/ressource/sparql_eins",hm); + //hm=ParseXmlHtml.parse_xml("/home/swalter/workspace/qaldEntity2",hm); + //hm=ParseXmlHtml.parse_xml("/home/swalter/workspace/qaldEntity1",hm); - + //30% Ram /* * For real use! */ - /* hm=ParseXmlHtml.parse_xml((getEntity(qaldEntity2,"/tmp/qaldEntity2")),hm); + /*hm=ParseXmlHtml.parse_xml((getEntity(qaldEntity2,"/tmp/qaldEntity2")),hm); System.out.println("Entity2 done"); hm=ParseXmlHtml.parse_xml((getEntity(qaldEntity1,"/tmp/qaldEntity1")),hm); System.out.println("Entity1 done");*/ System.out.println("Done with indexing\n"); System.out.println("Start generating Wordnet Dictionary"); - SparqlObject sparql = new SparqlObject(hm); + SparqlObject sparql = new SparqlObject(); System.out.println("Generating Wordnet Dictionary Done"); long stopInitTime = System.currentTimeMillis(); System.out.println("Time for Initialising "+(stopInitTime-startInitTime)+" ms"); Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/exploration/exploration_main/test_vergleich.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/exploration/exploration_main/test_vergleich.java 2011-11-10 08:15:41 UTC (rev 3391) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/exploration/exploration_main/test_vergleich.java 2011-11-10 13:01:22 UTC (rev 3392) @@ -9,6 +9,7 @@ import java.net.URL; import java.util.ArrayList; +import org.dllearner.algorithm.tbsl.exploration.Sparql.Levenshtein; import org.dllearner.algorithm.tbsl.exploration.sax.MySaxParser; Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/exploration/sax/ParseXmlHtml.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/exploration/sax/ParseXmlHtml.java 2011-11-10 08:15:41 UTC (rev 3391) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/exploration/sax/ParseXmlHtml.java 2011-11-10 13:01:22 UTC (rev 3392) @@ -5,10 +5,15 @@ import java.util.HashMap; public class ParseXmlHtml { + + //TODO: zweite Hashmap in der als Key (barack,Obama) auf die Value barack Obama verweißt + //TODO: Rückgabewert in List<Map<String, String>> listOfMaps = new ArrayList<Map<String, String>>(); ändern und dann beide hashmaps übergeben und dann hm aus dem Funktionsheader nehmen + public static HashMap<String, String> parse_xml(String dateiname, HashMap<String, String> hm) { ArrayList<String> indexObject = null; File file = new File(dateiname); + HashMap<String, String> hm_new = new HashMap<String, String>(); try { MySaxParser parser = new MySaxParser(file); @@ -18,11 +23,18 @@ { hm.put((indexObject.get(i+1)).toLowerCase(), indexObject.get(i)); }*/ + int zaehler=0; for (int i = 1; i < indexObject.size(); i=i+2) { hm.put((indexObject.get(i)).toLowerCase(), indexObject.get(i-1)); + String[] tmp_array = indexObject.get(i).toLowerCase().split(" "); + if(tmp_array.length>=2) { + for(String tmp : tmp_array)hm_new.put(tmp.toLowerCase(), indexObject.get(i-1)); + } + zaehler=zaehler+1; } indexObject.clear(); + System.out.println("Anzahl: "+zaehler); } catch (Exception ex) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <km...@us...> - 2011-11-10 08:15:47
|
Revision: 3391 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3391&view=rev Author: kmpf Date: 2011-11-10 08:15:41 +0000 (Thu, 10 Nov 2011) Log Message: ----------- Bug fixed SPARQL query that retrieves the data used in the intern PDBRdfModel. Modified Paths: -------------- trunk/scripts/pom.xml trunk/scripts/src/main/java/org/dllearner/examples/pdb/HelixRDFCreator.java trunk/scripts/src/main/java/org/dllearner/examples/pdb/PDBIdRdfModel.java trunk/scripts/src/main/java/org/dllearner/examples/pdb/PDBWekaLearner.java Modified: trunk/scripts/pom.xml =================================================================== --- trunk/scripts/pom.xml 2011-11-09 10:02:03 UTC (rev 3390) +++ trunk/scripts/pom.xml 2011-11-10 08:15:41 UTC (rev 3391) @@ -64,5 +64,11 @@ <artifactId>commons-compress</artifactId> <version>1.2</version> </dependency> + <dependency> + <groupId>weka</groupId> + <artifactId>weka</artifactId> + <version>3.6.5</version> + </dependency> + </dependencies> </project> Modified: trunk/scripts/src/main/java/org/dllearner/examples/pdb/HelixRDFCreator.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/examples/pdb/HelixRDFCreator.java 2011-11-09 10:02:03 UTC (rev 3390) +++ trunk/scripts/src/main/java/org/dllearner/examples/pdb/HelixRDFCreator.java 2011-11-10 08:15:41 UTC (rev 3391) @@ -109,8 +109,10 @@ /* * data for test purpose */ - PDBProtein testProtein = new PDBProtein("1XFF"); + PDBProtein testProtein = new PDBProtein("1XFF","A"); // PDBProtein testProtein = new PDBProtein("1LMB", "3"); +// PDBProtein testProtein = new PDBProtein("8ABP"); + /* * create a training data set @@ -185,7 +187,8 @@ trainmodel.removeStatementsWithPoperty(endsAt); Resource residue = ResourceFactory.createResource("http://bio2rdf.org/pdb:Residue"); trainmodel.removeStatementsWithObject(residue); - + Property isPartOf = ResourceFactory.createProperty("http://purl.org/dc/terms/", "isPartOf"); + trainmodel.removeStatementsWithPoperty(isPartOf); /* * we add the information which amino acid is the fourth predecessor of which other amino acid */ @@ -228,20 +231,23 @@ * proteins that originate from that particular species. If it already exists * we will append to it. */ - File speciesProteins = new File(_dataDir + protein.getSpecies() + ".pos"); - try { - String line = protein.getPdbID() + "." + protein.getChainID() + "." + protein.getSpecies() + "\n"; - FileWriter out = new FileWriter(speciesProteins, true); - _logger.debug("Write " + line + "to file " + speciesProteins.getPath()); - out.write(line); - out.close(); - } catch (FileNotFoundException e) { - _logger.error("Could not find file " + speciesProteins.getPath() ); - e.printStackTrace(); - } catch (IOException e) { - _logger.error("Something went wrong while trying to write to " + speciesProteins.getPath() ); - e.printStackTrace(); + if (protein.getSpecies() != ""){ + File speciesProteins = new File(_dataDir + protein.getSpecies() + ".pos"); + + try { + String line = protein.getPdbID() + "." + protein.getChainID() + "." + protein.getSpecies() + "\n"; + FileWriter out = new FileWriter(speciesProteins, true); + _logger.debug("Write " + line + " to file " + speciesProteins.getPath()); + out.write(line); + out.close(); + } catch (FileNotFoundException e) { + _logger.error("Could not find file " + speciesProteins.getPath() + speciesProteins.getName()); + e.printStackTrace(); + } catch (IOException e) { + _logger.error("Something went wrong while trying to write to " + speciesProteins.getPath() + speciesProteins.getName()); + e.printStackTrace(); + } } } } Modified: trunk/scripts/src/main/java/org/dllearner/examples/pdb/PDBIdRdfModel.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/examples/pdb/PDBIdRdfModel.java 2011-11-09 10:02:03 UTC (rev 3390) +++ trunk/scripts/src/main/java/org/dllearner/examples/pdb/PDBIdRdfModel.java 2011-11-10 08:15:41 UTC (rev 3391) @@ -100,12 +100,11 @@ "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> " + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> " + "PREFIX fn: <http://www.w3.org/2005/xpath-functions#> " + - "CONSTRUCT { pdb:" + this.getProtein().getPdbID() + "/extraction/source/gene/organism rdfs:label ?species. }" + + "CONSTRUCT { <http://bio2rdf.org/pdb:" + this.getProtein().getPdbID() + "/extraction/source/gene/organism> rdfs:label ?species. }" + "WHERE { ?x1 dcterms:isPartOf ?x2 ." + - " ?x1 rdf:type> ?x3 ." + + " ?x1 rdf:type ?x3 ." + " ?x1 pdb:isImmediatelyBefore ?x4 ." + - " ?x5 rdfs:label ?species " + - " FILTER (str(?x5) = fn:concat(str(?x2), '/extraction/source/gene/organism')) . }"; + " OPTIONAL { ?x5 rdfs:label ?species FILTER (str(?x5) = fn:concat(str(?x2), '/extraction/source/gene/organism')) . } . }"; // System.out.println(queryString); @@ -151,7 +150,7 @@ NodeIterator niter = model.listObjectsOfProperty(nextRes, hasValue); sequence = niter.next().toString(); - System.out.println(sequence); + System.out.println("Sequence: " + sequence); } } return sequence; @@ -206,23 +205,25 @@ " ?x3 dcterms:isPartOf ?x4 ." + " ?x4 rdf:type <http://bio2rdf.org/pdb:Polypeptide(L)> ." + " ?x5 dcterms:isPartOf ?x4 ." + - " ?x5 rdf:type ?x6 ."; + " ?x5 rdf:type ?x6 ." + + " ?x5 pdb:hasChainPosition ?x8 . " + + " OPTIONAL { ?x5 pdb:isImmediatelyBefore ?x7 . } . "; + if (chainID.length() == 1 && pdbID.length() == 4) { queryString += - " ?x5 pdb:hasChainPosition ?x8 ." + - " ?x8 dcterms:isPartOf pdb:" + + " ?x8 dcterms:isPartOf <http://bio2rdf.org/pdb:" + pdbID.toUpperCase() + "/chain_" + chainID.toUpperCase() + "> ."; } queryString += - " ?organism rdfs:label ?organismName " + - "FILTER (str(?organism) = fn:concat(str(?x4), '/extraction/source/gene/organism')) . " + + " ?x4 pdb:hasPolymerSequence ?seq . " + " ?seq rdf:type pdb:PolymerSequence . " + - " ?seq pdb:hasValue ?sequence ." + + " ?seq pdb:hasValue ?sequence . " + // with the Optional clause i get the information by which amino acid // a amino acid is followed - " OPTIONAL { ?x5 pdb:isImmediatelyBefore ?x7 . } .}"; + " OPTIONAL { ?organism rdfs:label ?organismName " + + "FILTER (str(?organism) = fn:concat(str(?x4), '/extraction/source/gene/organism')) . } . }"; System.out.println(queryString); Query query = QueryFactory.create(queryString); @@ -324,6 +325,7 @@ while (riter.hasNext()) { // Initialization of variables needed Resource firstAA = riter.nextResource(); + System.out.println("First AA: " + firstAA.getLocalName()); Resource currentAA = firstAA; Resource nextAA = firstAA; boolean inHelix = false; @@ -358,7 +360,16 @@ } while (currentAA.hasProperty(iib)) ; } _positives = pos; + System.out.println("+++ Positive set +++"); + for (int i = 0; i < pos.size(); i++){ + System.out.println("Das " + i + "te Element: " + pos.get(i).getLocalName()); + } + _negatives = neg; + System.out.println("+++ Negatvie set +++"); + for (int i = 0; i < neg.size(); i++){ + System.out.println("Das " + i + "te Element: " + neg.get(i).getLocalName()); + } } public void createFastaFile(String dir){ @@ -366,23 +377,24 @@ String fastaFilePath = dir + this.getProtein().getFastaFileName(); PrintStream out = new PrintStream (new File(fastaFilePath)); out.println(">" + this.getProtein().getPdbID() + "." + this.getProtein().getChainID() + "." + this.getProtein().getSpecies()); - int seqLength = this.getProtein().getSequence().length(); + String sequence = this.getProtein().getSequence(); + int seqLength = sequence.length(); if (seqLength > 80) { // write sequence in 80 character blocks into file int beginIndex = 0; int endIndex = 80; - for (int i = 1; endIndex <= seqLength; i++ ){ - out.println(this.getProtein().getSequence().substring(beginIndex, endIndex)); - if (seqLength - endIndex <= 80){ - out.println(this.getProtein().getSequence().substring(endIndex, seqLength)); + while ( endIndex <= seqLength ){ + out.println(sequence.substring(beginIndex, endIndex)); + if (seqLength - endIndex < 80){ + out.println(sequence.substring(endIndex, seqLength)); } beginIndex = endIndex; - endIndex += (i * 80); + endIndex += 80; } } else { - out.println(this.getProtein().getSequence()); + out.println(sequence); } out.close(); } catch (IOException e) { Modified: trunk/scripts/src/main/java/org/dllearner/examples/pdb/PDBWekaLearner.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/examples/pdb/PDBWekaLearner.java 2011-11-09 10:02:03 UTC (rev 3390) +++ trunk/scripts/src/main/java/org/dllearner/examples/pdb/PDBWekaLearner.java 2011-11-10 08:15:41 UTC (rev 3391) @@ -1,11 +1,6 @@ package org.dllearner.examples.pdb; import java.io.File; -import java.io.IOException; - -import org.apache.log4j.Logger; -/* -import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.util.Random; @@ -20,14 +15,14 @@ import weka.classifiers.bayes.NaiveBayes; import weka.core.Instances; import weka.core.converters.ConverterUtils.DataSource; -*/ + public class PDBWekaLearner { private static Logger logger = Logger.getRootLogger(); public PDBWekaLearner (File arffFile) throws IOException{ - /* + // create logger (configure this to your needs) SimpleLayout layout = new SimpleLayout(); FileAppender fileAppender = new FileAppender(layout, "log/sample_log.txt", false); @@ -75,6 +70,6 @@ } catch (Exception e){ e.printStackTrace(); } - */ + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2011-11-09 10:02:17
|
Revision: 3390 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3390&view=rev Author: christinaunger Date: 2011-11-09 10:02:03 +0000 (Wed, 09 Nov 2011) Log Message: ----------- [tbsl] update BasicSlotBuilder Modified Paths: -------------- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/converter/DRS2BasicSPARQL_Converter.java trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/templator/BasicSlotBuilder.java trunk/components-ext/src/main/resources/tbsl/lexicon/english.lex Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/converter/DRS2BasicSPARQL_Converter.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/converter/DRS2BasicSPARQL_Converter.java 2011-11-08 13:59:11 UTC (rev 3389) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/converter/DRS2BasicSPARQL_Converter.java 2011-11-09 10:02:03 UTC (rev 3390) @@ -23,6 +23,7 @@ import org.dllearner.algorithm.tbsl.sparql.SPARQL_QueryType; import org.dllearner.algorithm.tbsl.sparql.SPARQL_Term; import org.dllearner.algorithm.tbsl.sparql.Slot; +import org.dllearner.algorithm.tbsl.sparql.SlotType; public class DRS2BasicSPARQL_Converter { @@ -56,8 +57,13 @@ } private BasicQueryTemplate convert(DRS drs, BasicQueryTemplate temp, boolean negate) { - + +// System.out.println("--- DRS (before): " + drs); // DEBUG redundantEqualRenaming(drs); + if (!restructureEmpty(drs)) { + return null; + } + System.out.println("--- DRS (after) : " + drs); // DEBUG for (DRS_Condition condition : drs.getConditions()) { convertCondition(condition,temp); @@ -359,4 +365,71 @@ usedInts.add(fresh); return fresh; } + + private boolean restructureEmpty(DRS drs) { + + Set<Simple_DRS_Condition> emptyConditions = new HashSet<Simple_DRS_Condition>(); + for (Simple_DRS_Condition c : drs.getAllSimpleConditions()) { + if(c.getPredicate().equals("empty")) { + emptyConditions.add(c); + } + } + if (emptyConditions.isEmpty()) { + return true; + } + + boolean globalsuccess = false; + for (Simple_DRS_Condition c : emptyConditions) { + String nounToExpand = c.getArguments().get(1).getValue(); + String fallbackNoun = c.getArguments().get(0).getValue(); + boolean success = false; + loop: + for (Simple_DRS_Condition sc : drs.getAllSimpleConditions()) { + if (sc.getArguments().size() == 1 && sc.getArguments().get(0).getValue().equals(nounToExpand)) { + for (Slot s : slots) { + if (s.getAnchor().equals(sc.getPredicate())) { + if (s.getSlotType().equals(SlotType.CLASS) || s.getSlotType().equals(SlotType.UNSPEC)) { + s.setSlotType(SlotType.PROPERTY); + List<DiscourseReferent> newargs = new ArrayList<DiscourseReferent>(); + newargs.add(c.getArguments().get(0)); + newargs.add(sc.getArguments().get(0)); + sc.setArguments(newargs); + success = true; + globalsuccess = true; + break loop; + } + } + } + } + } + if (!success) { // do the same for fallbackNoun + loop: + for (Simple_DRS_Condition sc : drs.getAllSimpleConditions()) { + if (sc.getArguments().size() == 1 && sc.getArguments().get(0).getValue().equals(fallbackNoun)) { + for (Slot s : slots) { + if (s.getAnchor().equals(sc.getPredicate())) { + if (s.getSlotType().equals(SlotType.CLASS) || s.getSlotType().equals(SlotType.UNSPEC)) { + s.setSlotType(SlotType.PROPERTY); + List<DiscourseReferent> newargs = new ArrayList<DiscourseReferent>(); + newargs.add(c.getArguments().get(1)); + newargs.add(sc.getArguments().get(0)); + sc.setArguments(newargs); + success = true; + globalsuccess = true; + break loop; + } + } + } + } + } + } + } + + if (globalsuccess) { + for (Simple_DRS_Condition c : emptyConditions) { + drs.removeCondition(c); + } + } + return globalsuccess; + } } Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/templator/BasicSlotBuilder.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/templator/BasicSlotBuilder.java 2011-11-08 13:59:11 UTC (rev 3389) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/templator/BasicSlotBuilder.java 2011-11-09 10:02:03 UTC (rev 3390) @@ -136,23 +136,27 @@ if (pos.equals("PASSIVE")) { String[] passEntry1 = {token, "(S DP[subj] (VP V:'" + token + "' DP[obj]))", - "<x,l1,t,[ l1:[|], l4:[ p | SLOT_" + token + "(p), p(y,x) ] ],[(l2,x,subj,<<e,t>,t>),(l3,y,obj,<<e,t>,t>)],[ l2<l1,l3<l1,l4<scope(l2),l4<scope(l3) ],[" + slot + "]>"}; + "<x,l1,t,[ l1:[|], l4:[ p | SLOT_" + token + "(p), p(y,x) ] ],[(l2,x,subj,<<e,t>,t>),(l3,y,obj,<<e,t>,t>)],[ l2<l1,l3<l1,l4<scope(l2),l4<scope(l3) ],[" + slot + "]>" + + " ;; <x,l1,t,[ l1:[|], l4:[ | empty(y,x) ] ],[(l2,x,subj,<<e,t>,t>),(l3,y,obj,<<e,t>,t>)],[ l2<l1,l3<l1,l4<scope(l2),l4<scope(l3) ],[]>"}; String[] passEntry2 = {token, "(S DP[wh] (VP DP[dp] V:'" + token + "'))", - "<x,l1,t,[ l1:[|], l4:[ p | SLOT_" + token + "(p), p(y,x) ] ],[(l2,x,wh,<<e,t>,t>),(l3,y,dp,<<e,t>,t>)],[ l2<l1,l3<l1,l4<scope(l2),l4<scope(l3) ],[" + slot + "]>"}; + "<x,l1,t,[ l1:[|], l4:[ p | SLOT_" + token + "(p), p(y,x) ] ],[(l2,x,wh,<<e,t>,t>),(l3,y,dp,<<e,t>,t>)],[ l2<l1,l3<l1,l4<scope(l2),l4<scope(l3) ],[" + slot + "]>" + + " ;; <x,l1,t,[ l1:[|], l4:[ | empty(x,y) ] ],[(l2,x,wh,<<e,t>,t>),(l3,y,dp,<<e,t>,t>)],[ l2<l1,l3<l1,l4<scope(l2),l4<scope(l3) ],[]>"}; result.add(passEntry1); result.add(passEntry2); } else if (pos.equals("PASSPART")) { String[] passpartEntry = {token, "(NP NP* (VP V:'" + token + "' DP[dp]))", - "<x,l1,t,[ l1:[ p | SLOT_" + token + "(p), p(y,x) ] ],[(l2,y,dp,<<e,t>,t>)],[ l2=l1 ],[" + slot + "]>"}; + "<x,l1,t,[ l1:[ p | SLOT_" + token + "(p), p(y,x) ] ],[(l2,y,dp,<<e,t>,t>)],[ l2=l1 ],[" + slot + "]>" + + " ;; <x,l1,t,[ l1:[ | empty(y,x) ] ],[(l2,y,dp,<<e,t>,t>)],[ l2=l1 ],[]>"}; result.add(passpartEntry); } else if (pos.equals("VPASS")) { String[] passEntry = {token, "(S DP[subj] (VP V:'" + token + "'))", - "<x,l1,t,[ l1:[|], l4:[ p | SLOT_" + token + "(p), p(y,x) ] ],[(l2,x,subj,<<e,t>,t>),(l3,y,obj,<<e,t>,t>)],[ l2<l1,l3<l1,l4<scope(l2),l4<scope(l3) ],[" + slot + "]>"}; + "<x,l1,t,[ l1:[|], l4:[ p | SLOT_" + token + "(p), p(y,x) ] ],[(l2,x,subj,<<e,t>,t>),(l3,y,obj,<<e,t>,t>)],[ l2<l1,l3<l1,l4<scope(l2),l4<scope(l3) ],[" + slot + "]>" + + " ;; <x,l1,t,[ l1:[|], l4:[ | empty(y,x) ] ],[(l2,x,subj,<<e,t>,t>),(l3,y,obj,<<e,t>,t>)],[ l2<l1,l3<l1,l4<scope(l2),l4<scope(l3) ],[]>"}; result.add(passEntry); } else if (pos.equals("VPASSIN")) { @@ -164,39 +168,51 @@ else if (pos.equals("GERUNDIN")) { String[] gerundinEntry1 = {token, "(NP NP* V:'" + token + "' DP[obj]))", - "<x,l1,t,[ l1:[ p | SLOT_" + token + "(p), p(y,x) ] ],[(l2,y,obj,<<e,t>,t>)],[ l2=l1 ],[" + slot + "]>"}; + "<x,l1,t,[ l1:[ p | SLOT_" + token + "(p), p(y,x) ] ],[(l2,y,obj,<<e,t>,t>)],[ l2=l1 ],[" + slot + "]>" + + " ;; <x,l1,t,[ l1:[ | empty(x,y) ] ],[(l2,y,obj,<<e,t>,t>)],[ l2=l1 ],[]>"}; String[] gerundinEntry2 = {token, "(ADJ V:'" + token + "' DP[obj]))", - "<x,l1,<e,t>,[ l1:[ p | SLOT_" + token + "(p), p(y,x) ] ],[(l2,y,obj,<<e,t>,t>)],[ l2=l1 ],[" + slot + "]>"}; + "<x,l1,<e,t>,[ l1:[ p | SLOT_" + token + "(p), p(y,x) ] ],[(l2,y,obj,<<e,t>,t>)],[ l2=l1 ],[" + slot + "]>" + + " ;; <x,l1,<e,t>,[ l1:[ | empty(x,y) ] ],[(l2,y,obj,<<e,t>,t>)],[ l2=l1 ],[]>"}; result.add(gerundinEntry1); result.add(gerundinEntry2); } else if (pos.equals("VPREP")) { String[] passEntry = {token, "(S DP[subj] (VP V:'" + token + "' DP[obj]))", - "<x,l1,t,[ l1:[|], l4:[ p | SLOT_" + token + "(p), p(x,y) ] ],[(l2,x,subj,<<e,t>,t>),(l3,y,obj,<<e,t>,t>)],[ l2<l1,l3<l1,l4<scope(l2),l4<scope(l3) ],[" + slot + "]>"}; + "<x,l1,t,[ l1:[|], l4:[ p | SLOT_" + token + "(p), p(x,y) ] ],[(l2,x,subj,<<e,t>,t>),(l3,y,obj,<<e,t>,t>)],[ l2<l1,l3<l1,l4<scope(l2),l4<scope(l3) ],[" + slot + "]>" + + " ;; <x,l1,t,[ l1:[|], l4:[ | empty(x,y) ] ],[(l2,x,subj,<<e,t>,t>),(l3,y,obj,<<e,t>,t>)],[ l2<l1,l3<l1,l4<scope(l2),l4<scope(l3) ],[]>"}; String[] whEntry = {token, "(S DP[obj] (VP DP[subj] V:'" + token + "'))", - "<x,l1,t,[ l1:[|], l4:[ p | SLOT_" + token + "(p), p(x,y) ] ],[(l2,x,subj,<<e,t>,t>),(l3,y,obj,<<e,t>,t>)],[ l2<l1,l3<l1,l4<scope(l2),l4<scope(l3) ],[" + slot + "]>"}; + "<x,l1,t,[ l1:[|], l4:[ p | SLOT_" + token + "(p), p(x,y) ] ],[(l2,x,subj,<<e,t>,t>),(l3,y,obj,<<e,t>,t>)],[ l2<l1,l3<l1,l4<scope(l2),l4<scope(l3) ],[" + slot + "]>" + + " ;; <x,l1,t,[ l1:[|], l4:[ | empty(x,y) ] ],[(l2,x,subj,<<e,t>,t>),(l3,y,obj,<<e,t>,t>)],[ l2<l1,l3<l1,l4<scope(l2),l4<scope(l3) ],[]>"}; result.add(passEntry); result.add(whEntry); } else if (pos.equals("VBD") || pos.equals("VBZ") || pos.equals("VBP")) { String[] vEntry = {token, "(S DP[subj] (VP V:'" + token + "' DP[obj]))", - "<x,l1,t,[ l1:[|], l4:[ p | SLOT_" + token + "(p), p(x,y) ] ],[(l2,x,subj,<<e,t>,t>),(l3,y,obj,<<e,t>,t>)],[ l2<l1,l3<l1,l4<scope(l2),l4<scope(l3) ],[" + slot + "]>"}; + "<x,l1,t,[ l1:[|], l4:[ p | SLOT_" + token + "(p), p(x,y) ] ],[(l2,x,subj,<<e,t>,t>),(l3,y,obj,<<e,t>,t>)],[ l2<l1,l3<l1,l4<scope(l2),l4<scope(l3) ],[" + slot + "]>" + + " ;; <x,l1,t,[ l1:[|], l4:[ | empty(x,y) ] ],[(l2,x,subj,<<e,t>,t>),(l3,y,obj,<<e,t>,t>)],[ l2<l1,l3<l1,l4<scope(l2),l4<scope(l3) ],[]>" + + " ;; <x,l1,t,[ l1:[|], l4:[ | empty(y,x) ] ],[(l2,x,subj,<<e,t>,t>),(l3,y,obj,<<e,t>,t>)],[ l2<l1,l3<l1,l4<scope(l2),l4<scope(l3) ],[]>"}; result.add(vEntry); } else if (pos.equals("VB")) { String[] whEntry = {token, "(S DP[obj] (VP DP[subj] V:'" + token + "'))", - "<x,l1,t,[ l1:[|], l4:[ p | SLOT_" + token + "(p), p(x,y) ] ],[(l2,x,subj,<<e,t>,t>),(l3,y,obj,<<e,t>,t>)],[ l2<l1,l3<l1,l4<scope(l2),l4<scope(l3) ],[" + slot + "]>"}; + "<x,l1,t,[ l1:[|], l4:[ p | SLOT_" + token + "(p), p(x,y) ] ],[(l2,x,subj,<<e,t>,t>),(l3,y,obj,<<e,t>,t>)],[ l2<l1,l3<l1,l4<scope(l2),l4<scope(l3) ],[" + slot + "]>" + + " ;; <x,l1,t,[ l1:[|], l4:[ | empty(x,y) ] ],[(l2,x,subj,<<e,t>,t>),(l3,y,obj,<<e,t>,t>)],[ l2<l1,l3<l1,l4<scope(l2),l4<scope(l3) ],[]>"}; result.add(whEntry); } else if (pos.equals("VBG") || pos.equals("VBN")) { String[] gerEntry = {token, "(NP NP* (VP V:'" + token + "' DP[dp]))", - "<x,l1,t,[ l1:[ p | SLOT_" + token + "(p), p(x,y) ] ],[(l2,y,dp,<<e,t>,t>)],[ l2=l1 ],[" + slot + "]>"}; + "<x,l1,t,[ l1:[ p | SLOT_" + token + "(p), p(x,y) ] ],[(l2,y,dp,<<e,t>,t>)],[ l2=l1 ],[" + slot + "]>" + + ";; <x,l1,t,[ l1:[ | empty(x,y) ] ],[(l2,y,dp,<<e,t>,t>)],[ l2=l1 ],[]>"}; + String[] wasGerEntry = {token, + "(S DP[comp] (VP V:'was' DP[subject] V:'" + token + "'))", + "<y,l1,t,[ l1:[ | SLOT_" + token + "(p), p(y,z) ] ],[(l2,y,comp,<<e,t>,t>), (l3,z,subject,<<e,t>,t>) ],[ l2=l1, l3=l1 ],[" + slot + "]>"}; + result.add(wasGerEntry); result.add(gerEntry); } else if (pos.equals("WHEN")) { @@ -275,8 +291,14 @@ else if (equalsOneOf(pos,preps)) { String[] npAdjunct = {token, "(NP NP* (PP P:'" + token.toLowerCase() + "' DP[pobj]))", - "<x,l1,<e,t>,[ l1:[ | SLOT_" + token + "(p), p(x,y) ] ],[(l2,y,pobj,<<e,t>,t>)],[l2=l1],[]>"}; + "<x,l1,<e,t>,[ l1:[ | SLOT_" + token + "(p), p(x,y) ] ],[(l2,y,pobj,<<e,t>,t>)],[l2=l1],[]>" + + " ;; <x,l1,<e,t>,[ l1:[ | empty(x,y) ] ],[(l2,y,pobj,<<e,t>,t>)],[l2=l1],[]>"}; + String[] vpAdjunct = {token, + "(VP VP* (PP P:'" + token.toLowerCase() + "' DP[pobj]))", + "<x,l1,t,[ l1:[ | SLOT_" + token + "(p), p(x,y) ] ],[(l2,y,pobj,<<e,t>,t>)],[l2=l1],[]>" + + " ;; <x,l1,t,[ l1:[ | empty(x,y) ] ],[(l2,y,pobj,<<e,t>,t>)],[l2=l1],[]>"}; result.add(npAdjunct); + result.add(vpAdjunct); } } Modified: trunk/components-ext/src/main/resources/tbsl/lexicon/english.lex =================================================================== --- trunk/components-ext/src/main/resources/tbsl/lexicon/english.lex 2011-11-08 13:59:11 UTC (rev 3389) +++ trunk/components-ext/src/main/resources/tbsl/lexicon/english.lex 2011-11-09 10:02:03 UTC (rev 3390) @@ -117,6 +117,7 @@ which || (DP WH:'which') || <x, l1, <<e,t>,t>, [ l1:[ ?x | ] ], [], [], []> how many || (DP WH:'how' ADJ:'many' NP[noun]) || <y, l1, <<e,t>,t>, [ l1:[ | l2:[ y | ] HOWMANY y l3:[|] ] ], [ (l4,y,noun,<e,t>) ], [ l4=l2 ],[]> who || (DP WH:'who') || <x, l1, <<e,t>,t>, [ l1:[ ?x | ] ], [], [], []> + whom || (DP WH:'whom') || <x, l1, <<e,t>,t>, [ l1:[ ?x | ] ], [], [], []> when || (S WH:'when' S[s]) || <x, l1, t, [ l1:[ ?x | SLOT_p(y,x) ] ], [(l2,y,s,t)], [l2=l1], [ SLOT_p/PROPERTY/date ]> when || (DP WH:'when') || <y, l1, <<e,t>,t>, [ l1:[ ?x | SLOT_p(y,x) ] ], [], [], [ SLOT_p/PROPERTY/date ]> where || (S WH:'where' S[s]) || <x, l1, t, [ l1:[ ?x | SLOT_p(y,x) ] ], [(l2,y,s,t)], [l2=l1], [ SLOT_p/PROPERTY/place ]> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lor...@us...> - 2011-11-08 13:59:20
|
Revision: 3389 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3389&view=rev Author: lorenz_b Date: 2011-11-08 13:59:11 +0000 (Tue, 08 Nov 2011) Log Message: ----------- Added cacheDir parameter to constructor. Modified Paths: -------------- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/learning/SPARQLTemplateBasedLearner.java Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/learning/SPARQLTemplateBasedLearner.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/learning/SPARQLTemplateBasedLearner.java 2011-11-08 12:47:55 UTC (rev 3388) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/learning/SPARQLTemplateBasedLearner.java 2011-11-08 13:59:11 UTC (rev 3389) @@ -24,6 +24,7 @@ import org.dllearner.algorithm.tbsl.nlp.Lemmatizer; import org.dllearner.algorithm.tbsl.nlp.LingPipeLemmatizer; import org.dllearner.algorithm.tbsl.nlp.PartOfSpeechTagger; +import org.dllearner.algorithm.tbsl.nlp.StanfordPartOfSpeechTagger; import org.dllearner.algorithm.tbsl.nlp.WordNet; import org.dllearner.algorithm.tbsl.search.HierarchicalSolrSearch; import org.dllearner.algorithm.tbsl.search.SolrQueryResultItem; @@ -137,34 +138,18 @@ } public SPARQLTemplateBasedLearner(Options options){ - init(options); - - Set<String> predicateFilters = new HashSet<String>(); - predicateFilters.add("http://dbpedia.org/ontology/wikiPageWikiLink"); - predicateFilters.add("http://dbpedia.org/property/wikiPageUsesTemplate"); - - prefixMap = Prefixes.getPrefixes(); - - modelGenenerator = new ModelGenerator(endpoint, predicateFilters); - - templateGenerator = new Templator(); + this(options, new StanfordPartOfSpeechTagger()); } public SPARQLTemplateBasedLearner(Options options, PartOfSpeechTagger tagger){ - init(options); - - Set<String> predicateFilters = new HashSet<String>(); - predicateFilters.add("http://dbpedia.org/ontology/wikiPageWikiLink"); - predicateFilters.add("http://dbpedia.org/property/wikiPageUsesTemplate"); - - prefixMap = Prefixes.getPrefixes(); - - modelGenenerator = new ModelGenerator(endpoint, predicateFilters); - - templateGenerator = new Templator(tagger); + this(options, tagger, new WordNet()); } public SPARQLTemplateBasedLearner(Options options, PartOfSpeechTagger tagger, WordNet wordNet){ + this(options, tagger, wordNet, "cache"); + } + + public SPARQLTemplateBasedLearner(Options options, PartOfSpeechTagger tagger, WordNet wordNet, String cacheDir){ init(options); Set<String> predicateFilters = new HashSet<String>(); @@ -176,6 +161,7 @@ modelGenenerator = new ModelGenerator(endpoint, predicateFilters); templateGenerator = new Templator(tagger, wordNet); + cache = new ExtractionDBCache(cacheDir); } /* @@ -1519,8 +1505,8 @@ // String question = "Which/WDT music/NN albums/NNS contain/VBP the/DT song/NN Last/NNP Christmas/NNP"; // String question = "Which/WDT companies/NNS are/VBP located/VBN in/IN California/NNP USA/NNP"; // String question = "Who/WP wrote/VBD the/DT book/NN The/NNP pillars/NNP of/NNP the/NNP Earth/NNP"; - String question = "Who/WP is/VBZ called/VBN Dana/NNP"; - SPARQLTemplateBasedLearner learner = new SPARQLTemplateBasedLearner();learner.setUseIdealTagger(true); + String question = "Give me all books written by Dan Brown"; + SPARQLTemplateBasedLearner learner = new SPARQLTemplateBasedLearner();//learner.setUseIdealTagger(true); // SparqlEndpoint endpoint = new SparqlEndpoint(new URL("http://greententacle.techfak.uni-bielefeld.de:5171/sparql"), // Collections.<String>singletonList(""), Collections.<String>emptyList()); SparqlEndpoint endpoint = new SparqlEndpoint(new URL("http://greententacle.techfak.uni-bielefeld.de:5171/sparql"), This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lor...@us...> - 2011-11-08 12:48:02
|
Revision: 3388 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3388&view=rev Author: lorenz_b Date: 2011-11-08 12:47:55 +0000 (Tue, 08 Nov 2011) Log Message: ----------- Added constructors. Modified Paths: -------------- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/learning/SPARQLTemplateBasedLearner.java trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/nlp/WordNet.java trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/templator/Templator.java Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/learning/SPARQLTemplateBasedLearner.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/learning/SPARQLTemplateBasedLearner.java 2011-11-07 18:14:29 UTC (rev 3387) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/learning/SPARQLTemplateBasedLearner.java 2011-11-08 12:47:55 UTC (rev 3388) @@ -24,6 +24,7 @@ import org.dllearner.algorithm.tbsl.nlp.Lemmatizer; import org.dllearner.algorithm.tbsl.nlp.LingPipeLemmatizer; import org.dllearner.algorithm.tbsl.nlp.PartOfSpeechTagger; +import org.dllearner.algorithm.tbsl.nlp.WordNet; import org.dllearner.algorithm.tbsl.search.HierarchicalSolrSearch; import org.dllearner.algorithm.tbsl.search.SolrQueryResultItem; import org.dllearner.algorithm.tbsl.search.SolrQueryResultSet; @@ -163,6 +164,20 @@ templateGenerator = new Templator(tagger); } + public SPARQLTemplateBasedLearner(Options options, PartOfSpeechTagger tagger, WordNet wordNet){ + init(options); + + Set<String> predicateFilters = new HashSet<String>(); + predicateFilters.add("http://dbpedia.org/ontology/wikiPageWikiLink"); + predicateFilters.add("http://dbpedia.org/property/wikiPageUsesTemplate"); + + prefixMap = Prefixes.getPrefixes(); + + modelGenenerator = new ModelGenerator(endpoint, predicateFilters); + + templateGenerator = new Templator(tagger, wordNet); + } + /* * Only for Evaluation useful. */ @@ -870,7 +885,7 @@ } } } - int prominence = getProminenceValue(item.getUri(), slot.getSlotType()); + double prominence = getProminenceValue(item.getUri(), slot.getSlotType()); allocations.add(new Allocation(item.getUri(), prominence, similarity)); } @@ -921,7 +936,7 @@ return labels; } - private int getProminenceValue(String uri, SlotType type){ + private double getProminenceValue(String uri, SlotType type){ int cnt = 1; String query = null; if(type == SlotType.CLASS){ @@ -941,6 +956,10 @@ projectionVar = qs.varNames().next(); cnt = qs.get(projectionVar).asLiteral().getInt(); } +// if(cnt == 0){ +// return 0; +// } +// return Math.log(cnt); return cnt; } @@ -1395,7 +1414,7 @@ } } - } catch (Exception e) { + } catch (Exception e) {e.printStackTrace(); logger.error("Query execution failed.", e); } return resources; @@ -1499,7 +1518,8 @@ // String question = "How/WRB many/JJ films/NNS did/VBD Leonardo/NNP DiCaprio/NNP star/VB in/IN"; // String question = "Which/WDT music/NN albums/NNS contain/VBP the/DT song/NN Last/NNP Christmas/NNP"; // String question = "Which/WDT companies/NNS are/VBP located/VBN in/IN California/NNP USA/NNP"; - String question = "Who/WP wrote/VBD the/DT book/NN The/NNP pillars/NNP of/NNP the/NNP Earth/NNP"; +// String question = "Who/WP wrote/VBD the/DT book/NN The/NNP pillars/NNP of/NNP the/NNP Earth/NNP"; + String question = "Who/WP is/VBZ called/VBN Dana/NNP"; SPARQLTemplateBasedLearner learner = new SPARQLTemplateBasedLearner();learner.setUseIdealTagger(true); // SparqlEndpoint endpoint = new SparqlEndpoint(new URL("http://greententacle.techfak.uni-bielefeld.de:5171/sparql"), // Collections.<String>singletonList(""), Collections.<String>emptyList()); Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/nlp/WordNet.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/nlp/WordNet.java 2011-11-07 18:14:29 UTC (rev 3387) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/nlp/WordNet.java 2011-11-08 12:47:55 UTC (rev 3388) @@ -31,6 +31,15 @@ } } + public WordNet(String configPath) { + try { + JWNL.initialize(this.getClass().getClassLoader().getResourceAsStream(configPath)); + dict = Dictionary.getInstance(); + } catch (JWNLException e) { + e.printStackTrace(); + } + } + public List<String> getBestSynonyms(POS pos, String s) { List<String> synonyms = new ArrayList<String>(); Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/templator/Templator.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/templator/Templator.java 2011-11-07 18:14:29 UTC (rev 3387) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/templator/Templator.java 2011-11-08 12:47:55 UTC (rev 3388) @@ -54,14 +54,19 @@ boolean ONE_SCOPE_ONLY = true; boolean UNTAGGED_INPUT = true; - boolean USE_NER = true; + boolean USE_NER = false; public Templator() { - this(new StanfordPartOfSpeechTagger()); + this(new StanfordPartOfSpeechTagger(), new WordNet()); } public Templator(final PartOfSpeechTagger tagger) { + this(tagger, new WordNet()); + } + + public Templator(final PartOfSpeechTagger tagger, WordNet wordnet) { this.tagger = tagger; + this.wordnet = wordnet; List<InputStream> grammarFiles = new ArrayList<InputStream>(); for(int i = 0; i < GRAMMAR_FILES.length; i++){ @@ -78,8 +83,6 @@ p.MODE = "LEIPZIG"; pp = new Preprocessor(USE_NER); - - wordnet = new WordNet(); } public void setUNTAGGED_INPUT(boolean b) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2011-11-07 18:14:35
|
Revision: 3387 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3387&view=rev Author: jenslehmann Date: 2011-11-07 18:14:29 +0000 (Mon, 07 Nov 2011) Log Message: ----------- fixed test Modified Paths: -------------- trunk/interfaces/src/test/java/org/dllearner/cli/NLP2RDFCLITest.java Modified: trunk/interfaces/src/test/java/org/dllearner/cli/NLP2RDFCLITest.java =================================================================== --- trunk/interfaces/src/test/java/org/dllearner/cli/NLP2RDFCLITest.java 2011-11-07 17:23:56 UTC (rev 3386) +++ trunk/interfaces/src/test/java/org/dllearner/cli/NLP2RDFCLITest.java 2011-11-07 18:14:29 UTC (rev 3387) @@ -14,9 +14,10 @@ @Test public void sampleTest() throws IOException { -// File f = new File("../examples/nlp2rdf/sample/sample1.conf"); - File f = new File("../examples/nlp2rdf/learning_initial_6/dbpedia_spotlight_plus/copper17_vs_gold35.conf"); + File f = new File("../examples/nlp2rdf/sample/sample1.conf"); +// File f = new File("../examples/nlp2rdf/learning_initial_6/dbpedia_spotlight_plus/copper17_vs_gold35.conf"); CLI cli = new CLI(f); + cli.init(); cli.run(); ApplicationContext context = cli.getContext(); AbstractReasonerComponent rc = context.getBean(AbstractReasonerComponent.class); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lor...@us...> - 2011-11-07 17:24:02
|
Revision: 3386 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3386&view=rev Author: lorenz_b Date: 2011-11-07 17:23:56 +0000 (Mon, 07 Nov 2011) Log Message: ----------- Small fix. Modified Paths: -------------- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/learning/SPARQLTemplateBasedLearner.java Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/learning/SPARQLTemplateBasedLearner.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/learning/SPARQLTemplateBasedLearner.java 2011-11-07 16:07:31 UTC (rev 3385) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/learning/SPARQLTemplateBasedLearner.java 2011-11-07 17:23:56 UTC (rev 3386) @@ -1402,7 +1402,10 @@ } public int getLearnedPosition() { - return learnedPos+1; + if(learnedPos >= 0){ + return learnedPos+1; + } + return learnedPos; } private List<String> getResultFromLocalModel(String query, Model model){ @@ -1493,10 +1496,10 @@ // String question = "Which/WDT organizations/NNS were/VBD founded/VBN in/IN 1950/CD"; // String question = "Is/VBZ there/RB a/DT video/NN game/NN called/VBN Battle/NNP Chess/NNP"; // String question = "Which/WDT software/NN has/VBZ been/VBN developed/VBN by/IN organizations/NNS founded/VBN in/IN California/NNP"; - String question = "How/WRB many/JJ films/NNS did/VBD Leonardo/NNP DiCaprio/NNP star/VB in/IN"; +// String question = "How/WRB many/JJ films/NNS did/VBD Leonardo/NNP DiCaprio/NNP star/VB in/IN"; // String question = "Which/WDT music/NN albums/NNS contain/VBP the/DT song/NN Last/NNP Christmas/NNP"; // String question = "Which/WDT companies/NNS are/VBP located/VBN in/IN California/NNP USA/NNP"; -// String question = "Who/WP wrote/VBD the/DT book/NN The/NNP pillars/NNP of/NNP the/NNP Earth/NNP"; + String question = "Who/WP wrote/VBD the/DT book/NN The/NNP pillars/NNP of/NNP the/NNP Earth/NNP"; SPARQLTemplateBasedLearner learner = new SPARQLTemplateBasedLearner();learner.setUseIdealTagger(true); // SparqlEndpoint endpoint = new SparqlEndpoint(new URL("http://greententacle.techfak.uni-bielefeld.de:5171/sparql"), // Collections.<String>singletonList(""), Collections.<String>emptyList()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lor...@us...> - 2011-11-07 16:07:41
|
Revision: 3385 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3385&view=rev Author: lorenz_b Date: 2011-11-07 16:07:31 +0000 (Mon, 07 Nov 2011) Log Message: ----------- Some changes to get position of learned query if exists. Modified Paths: -------------- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/learning/SPARQLTemplateBasedLearner.java trunk/components-ext/src/test/java/org/dllearner/algorithm/tbsl/Evaluation.java Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/learning/SPARQLTemplateBasedLearner.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/learning/SPARQLTemplateBasedLearner.java 2011-11-07 10:59:39 UTC (rev 3384) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/learning/SPARQLTemplateBasedLearner.java 2011-11-07 16:07:31 UTC (rev 3385) @@ -105,6 +105,7 @@ private Templator templateGenerator; private String question; + private int learnedPos = -1; private Oracle oracle; @@ -1305,7 +1306,7 @@ if(!results.isEmpty()){ try{ int cnt = Integer.parseInt(results.get(0)); - if(cnt > 0){ + if(cnt > 0){learnedPos = queries.indexOf(query); learnedSPARQLQueries.put(query, results); if(stopIfQueryResultNotEmpty){ return; @@ -1313,6 +1314,7 @@ } } catch (NumberFormatException e){ learnedSPARQLQueries.put(query, results); + learnedPos = queries.indexOf(query); if(stopIfQueryResultNotEmpty){ return; } @@ -1329,12 +1331,13 @@ // if(stopIfQueryResultNotEmpty && result){ // return; // } - if(stopIfQueryResultNotEmpty){ + if(stopIfQueryResultNotEmpty){learnedPos = queries.indexOf(query); return; } logger.info("Result: " + result); } } + mon.stop(); logger.info("Done in " + mon.getLastValue() + "ms."); } @@ -1398,6 +1401,10 @@ return resources; } + public int getLearnedPosition() { + return learnedPos+1; + } + private List<String> getResultFromLocalModel(String query, Model model){ List<String> resources = new ArrayList<String>(); QueryExecution qe = QueryExecutionFactory.create(query, model); @@ -1411,29 +1418,36 @@ } private Set<String> getDomains(String property){ + String tmp = property; + if(property.startsWith("http://dbpedia.org/property/")){ + tmp = "http://dbpedia.org/ontology" + property.substring(property.lastIndexOf("/")); + } Set<String> domains = new HashSet<String>(); - String query = String.format("SELECT ?domain WHERE {<%s> <%s> ?domain}", property, RDFS.domain.getURI()); + String query = String.format("SELECT ?domain WHERE {<%s> <%s> ?domain}", tmp, RDFS.domain.getURI()); ResultSet rs = SparqlQuery.convertJSONtoResultSet(cache.executeSelectQuery(endpoint, query)); QuerySolution qs; while(rs.hasNext()){ qs = rs.next(); domains.add(qs.getResource("domain").getURI()); } - return domains; } private Set<String> getRanges(String property){ - Set<String> domains = new HashSet<String>(); - String query = String.format("SELECT ?range WHERE {<%s> <%s> ?range}", property, RDFS.range.getURI()); + String tmp = property; + if(property.startsWith("http://dbpedia.org/property/")){ + tmp = "http://dbpedia.org/ontology" + property.substring(property.lastIndexOf("/")); + } + Set<String> ranges = new HashSet<String>(); + String query = String.format("SELECT ?range WHERE {<%s> <%s> ?range}", tmp, RDFS.range.getURI()); ResultSet rs = SparqlQuery.convertJSONtoResultSet(cache.executeSelectQuery(endpoint, query)); QuerySolution qs; while(rs.hasNext()){ qs = rs.next(); - domains.add(qs.getResource("range").getURI()); + ranges.add(qs.getResource("range").getURI()); } - return domains; + return ranges; } private boolean isObjectProperty(String property){ @@ -1479,10 +1493,10 @@ // String question = "Which/WDT organizations/NNS were/VBD founded/VBN in/IN 1950/CD"; // String question = "Is/VBZ there/RB a/DT video/NN game/NN called/VBN Battle/NNP Chess/NNP"; // String question = "Which/WDT software/NN has/VBZ been/VBN developed/VBN by/IN organizations/NNS founded/VBN in/IN California/NNP"; -// String question = "How/WRB many/JJ films/NNS did/VBD Leonardo/NNP DiCaprio/NNP star/VB in/IN"; + String question = "How/WRB many/JJ films/NNS did/VBD Leonardo/NNP DiCaprio/NNP star/VB in/IN"; // String question = "Which/WDT music/NN albums/NNS contain/VBP the/DT song/NN Last/NNP Christmas/NNP"; // String question = "Which/WDT companies/NNS are/VBP located/VBN in/IN California/NNP USA/NNP"; - String question = "Who/WP wrote/VBD the/DT book/NN The/NNP pillars/NNP of/NNP the/NNP Earth/NNP"; +// String question = "Who/WP wrote/VBD the/DT book/NN The/NNP pillars/NNP of/NNP the/NNP Earth/NNP"; SPARQLTemplateBasedLearner learner = new SPARQLTemplateBasedLearner();learner.setUseIdealTagger(true); // SparqlEndpoint endpoint = new SparqlEndpoint(new URL("http://greententacle.techfak.uni-bielefeld.de:5171/sparql"), // Collections.<String>singletonList(""), Collections.<String>emptyList()); @@ -1493,6 +1507,7 @@ learner.learnSPARQLQueries(); System.out.println("Learned query:\n" + learner.getBestSPARQLQuery()); System.out.println("Lexical answer type is: " + learner.getTemplates().iterator().next().getLexicalAnswerType()); + System.out.println(learner.getLearnedPosition()); } Modified: trunk/components-ext/src/test/java/org/dllearner/algorithm/tbsl/Evaluation.java =================================================================== --- trunk/components-ext/src/test/java/org/dllearner/algorithm/tbsl/Evaluation.java 2011-11-07 10:59:39 UTC (rev 3384) +++ trunk/components-ext/src/test/java/org/dllearner/algorithm/tbsl/Evaluation.java 2011-11-07 16:07:31 UTC (rev 3385) @@ -321,6 +321,7 @@ String errorCode = ""; LatexWriter latex = new LatexWriter(); int i = 0; + int cnt = 0; for(Entry<Integer, String> entry : id2Question.entrySet()){//if(entry.getKey()==50)continue; if((testID != -1 && entry.getKey() != testID) || (yagoExclusions.contains(entry.getKey())))continue; try { @@ -361,6 +362,11 @@ //get the used templates List<Template> templates = new ArrayList<Template>(stbl.getTemplates()); + if(stbl.getLearnedPosition() == -1 || stbl.getLearnedPosition() > 10){ + cnt++; + } + i++; + //start output //write templates subsection latex.beginSubsection("Templates (" + templates.size() + ")"); @@ -392,8 +398,6 @@ q.setPrefix("dbr", "http://dbpedia.org/resource/"); } String queryString = q.toString(); - String requestURL = new QueryEngineHTTP(endpoint.getURL().toString(), queryString).toString(); -// System.out.println(requestURL); queryString = queryString + "\n" + "Score(" + wQ.getScore() + ")"; latex.addListing(queryString); latex.endEnumerationItem(); @@ -483,7 +487,7 @@ latex.addSummaryTableEntry(questionId, extractSentence(question), precision, recall, errorCode); } } - + System.out.println(cnt + "/" + i); latex.write("log/evaluation_" + System.currentTimeMillis()+ ".tex", Calendar.getInstance().getTime().toString(), correctAnswers); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2011-11-07 10:59:45
|
Revision: 3384 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3384&view=rev Author: jenslehmann Date: 2011-11-07 10:59:39 +0000 (Mon, 07 Nov 2011) Log Message: ----------- bug fix and new config option to work around Pellet bug Modified Paths: -------------- trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/CELOE.java trunk/components-core/src/main/java/org/dllearner/reasoning/OWLAPIReasoner.java trunk/scripts/src/main/java/org/dllearner/scripts/evaluation/NLP2RDFEval.java Modified: trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/CELOE.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/CELOE.java 2011-11-06 21:31:13 UTC (rev 3383) +++ trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/CELOE.java 2011-11-07 10:59:39 UTC (rev 3384) @@ -94,6 +94,7 @@ private RefinementOperator operator; private DescriptionMinimizer minimizer; + private boolean useMinimizer = true; // all nodes in the search tree (used for selecting most promising node) private TreeSet<OENode> nodes; @@ -760,7 +761,12 @@ private Description rewriteNode(OENode node) { Description description = node.getDescription(); // minimize description (expensive!) - also performes some human friendly rewrites - Description niceDescription = minimizer.minimizeClone(description); + Description niceDescription; + if(useMinimizer) { + niceDescription = minimizer.minimizeClone(description); + } else { + niceDescription = description; + } // replace \exists r.\top with \exists r.range(r) which is easier to read for humans ConceptTransformation.replaceRange(niceDescription, reasoner); return niceDescription; @@ -987,6 +993,14 @@ public void setReuseExistingDescription(boolean reuseExistingDescription) { this.reuseExistingDescription = reuseExistingDescription; + } + + public boolean isUseMinimizer() { + return useMinimizer; + } + + public void setUseMinimizer(boolean useMinimizer) { + this.useMinimizer = useMinimizer; } } Modified: trunk/components-core/src/main/java/org/dllearner/reasoning/OWLAPIReasoner.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/reasoning/OWLAPIReasoner.java 2011-11-06 21:31:13 UTC (rev 3383) +++ trunk/components-core/src/main/java/org/dllearner/reasoning/OWLAPIReasoner.java 2011-11-07 10:59:39 UTC (rev 3384) @@ -779,7 +779,9 @@ // take one element from the set and ignore the rest // (TODO: we need to make sure we always ignore the same concepts) OWLObjectPropertyExpression property = node.getRepresentativeElement(); - roles.add(new ObjectProperty(property.asOWLObjectProperty().toStringID())); + if(!property.isAnonymous()) { + roles.add(new ObjectProperty(property.asOWLObjectProperty().toStringID())); + } } roles.remove(new ObjectProperty(factory.getOWLTopObjectProperty().toStringID())); roles.remove(new ObjectProperty(factory.getOWLBottomObjectProperty().toStringID())); Modified: trunk/scripts/src/main/java/org/dllearner/scripts/evaluation/NLP2RDFEval.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/scripts/evaluation/NLP2RDFEval.java 2011-11-06 21:31:13 UTC (rev 3383) +++ trunk/scripts/src/main/java/org/dllearner/scripts/evaluation/NLP2RDFEval.java 2011-11-07 10:59:39 UTC (rev 3384) @@ -56,13 +56,17 @@ // "../examples/nlp2rdf/learning_7_components/dbpedia_spotlight_plus/gas9_vs_nat-gas26.conf", // }; // - String baseDir = "../examples/nlp2rdf/learning_7_components/"; +// String baseDir = "../examples/nlp2rdf/learning_7_components/"; + String baseDir = "../examples/nlp2rdf/learning_reduced/"; String outputFile = "results.csv"; String content = ""; + // gate + spotlight plus; gate + snowball; standford + spotlight plus String[] tools = new String[] { - "stanford", "opennlp", "gateannie", "dbpedia_spotlight", "dbpedia_spotlight_plus" //, "combined" + "gateannie_dbpedia_spotlight_plus", + // "gateannie_snowball", zu langsam + "stanford_dbpedia_spotlight_plus", "stanford", "opennlp", "gateannie", "dbpedia_spotlight", "dbpedia_spotlight_plus", "snowball" }; String topics[] = new String[] { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lor...@us...> - 2011-11-06 21:31:19
|
Revision: 3383 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3383&view=rev Author: lorenz_b Date: 2011-11-06 21:31:13 +0000 (Sun, 06 Nov 2011) Log Message: ----------- Storing allocations in query objects for better debugging support. Modified Paths: -------------- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/WeightedQuery.java Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/WeightedQuery.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/WeightedQuery.java 2011-11-06 21:28:47 UTC (rev 3382) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/WeightedQuery.java 2011-11-06 21:31:13 UTC (rev 3383) @@ -1,10 +1,15 @@ package org.dllearner.algorithm.tbsl.sparql; +import java.util.HashSet; +import java.util.Set; + public class WeightedQuery implements Comparable<WeightedQuery>{ private double score; private Query query; + private Set<Allocation> allocations = new HashSet<Allocation>(); + public WeightedQuery(Query query, double score) { super(); this.score = score; @@ -26,6 +31,18 @@ public Query getQuery() { return query; } + + public void addAllocation(Allocation a){ + allocations.add(a); + } + + public void addAllocations(Set<Allocation> allocations){ + this.allocations.addAll(allocations); + } + + public Set<Allocation> getAllocations() { + return allocations; + } @Override public int compareTo(WeightedQuery o) { @@ -50,6 +67,16 @@ return query.toString() + "\n(Score: " + score + ")"; } + public String explain(){ + String explanation = toString(); + explanation += "\n["; + for(Allocation a : allocations){ + explanation += a.toString() + "\n"; + } + explanation += "]"; + return explanation; + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |