diff --git a/components-core/pom.xml b/components-core/pom.xml index edc8f04173..c1d30fa47b 100644 --- a/components-core/pom.xml +++ b/components-core/pom.xml @@ -106,6 +106,10 @@ xercesImpl xerces + + any23-core + org.deri.any23 + diff --git a/components-core/src/main/java/org/dllearner/algorithms/DisjointClassesLearner.java b/components-core/src/main/java/org/dllearner/algorithms/DisjointClassesLearner.java index 1dd5507928..f61b130b10 100644 --- a/components-core/src/main/java/org/dllearner/algorithms/DisjointClassesLearner.java +++ b/components-core/src/main/java/org/dllearner/algorithms/DisjointClassesLearner.java @@ -21,10 +21,8 @@ import java.net.URL; import java.util.ArrayList; -import java.util.Collections; import java.util.HashMap; import java.util.HashSet; -import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Map.Entry; @@ -46,11 +44,8 @@ import org.dllearner.core.owl.NamedClass; import org.dllearner.kb.LocalModelBasedSparqlEndpointKS; import org.dllearner.kb.SparqlEndpointKS; -import org.dllearner.kb.sparql.SparqlEndpoint; import org.dllearner.learningproblems.AxiomScore; import org.dllearner.learningproblems.Heuristics; -import org.openrdf.model.vocabulary.OWL; -import org.openrdf.model.vocabulary.RDF; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -61,6 +56,8 @@ import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.ModelFactory; import com.hp.hpl.jena.rdf.model.Resource; +import com.hp.hpl.jena.vocabulary.OWL2; +import com.hp.hpl.jena.vocabulary.RDF; /** * Learns disjoint classes using SPARQL queries. @@ -340,7 +337,7 @@ private List buildEvaluatedClassDescriptions(Map entry : sortByValues(class2Count)){ //drop classes from OWL and RDF namespace - if(entry.getKey().getName().startsWith(OWL.NAMESPACE) || entry.getKey().getName().startsWith(RDF.NAMESPACE))continue; + if(entry.getKey().getName().startsWith(OWL2.getURI()) || entry.getKey().getName().startsWith(RDF.getURI()))continue; // evalDesc = new EvaluatedDescription(entry.getKey(), // new AxiomScore(1 - (entry.getValue() / (double)all))); double[] confidenceInterval = Heuristics.getConfidenceInterval95Wald(total, entry.getValue()); diff --git a/components-core/src/main/java/org/dllearner/core/AbstractAxiomLearningAlgorithm.java b/components-core/src/main/java/org/dllearner/core/AbstractAxiomLearningAlgorithm.java index 5ac142d4ab..7334a665ba 100644 --- a/components-core/src/main/java/org/dllearner/core/AbstractAxiomLearningAlgorithm.java +++ b/components-core/src/main/java/org/dllearner/core/AbstractAxiomLearningAlgorithm.java @@ -44,9 +44,6 @@ import org.dllearner.learningproblems.Heuristics; import org.dllearner.reasoning.SPARQLReasoner; import org.dllearner.utilities.owl.AxiomComparator; -import org.openrdf.model.vocabulary.OWL; -import org.openrdf.model.vocabulary.RDF; -import org.openrdf.model.vocabulary.RDFS; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -58,6 +55,9 @@ import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.sparql.engine.http.QueryEngineHTTP; import com.hp.hpl.jena.util.iterator.Filter; +import com.hp.hpl.jena.vocabulary.OWL2; +import com.hp.hpl.jena.vocabulary.RDF; +import com.hp.hpl.jena.vocabulary.RDFS; /** * @author Lorenz Bühmann @@ -334,7 +334,7 @@ class OWLFilter extends Filter{ @Override public boolean accept(OntClass cls) { if(!cls.isAnon()){ - return cls.getURI().startsWith(OWL.NAMESPACE); + return cls.getURI().startsWith(OWL2.getURI()); } return false; } @@ -346,7 +346,7 @@ class RDFSFilter extends Filter{ @Override public boolean accept(OntClass cls) { if(!cls.isAnon()){ - return cls.getURI().startsWith(RDFS.NAMESPACE); + return cls.getURI().startsWith(RDFS.getURI()); } return false; } @@ -358,7 +358,7 @@ class RDFFilter extends Filter{ @Override public boolean accept(OntClass cls) { if(!cls.isAnon()){ - return cls.getURI().startsWith(RDF.NAMESPACE); + return cls.getURI().startsWith(RDF.getURI()); } return false; } diff --git a/components-core/src/main/java/org/dllearner/utilities/StructureBasedRootClassFinder.java b/components-core/src/main/java/org/dllearner/utilities/StructureBasedRootClassFinder.java index 4178605941..1ccab14c25 100644 --- a/components-core/src/main/java/org/dllearner/utilities/StructureBasedRootClassFinder.java +++ b/components-core/src/main/java/org/dllearner/utilities/StructureBasedRootClassFinder.java @@ -8,7 +8,6 @@ import java.util.Map; import java.util.Set; -import org.apache.commons.httpclient.methods.GetMethod; import org.semanticweb.owlapi.apibinding.OWLManager; import org.semanticweb.owlapi.model.AddAxiom; import org.semanticweb.owlapi.model.AxiomType; @@ -47,10 +46,6 @@ import org.semanticweb.owlapi.reasoner.OWLReasoner; import org.semanticweb.owlapi.reasoner.OWLReasonerFactory; -import uk.ac.manchester.cs.owlapi.modularity.ModuleType; - -import com.clarkparsia.modularity.ModularityUtils; -import com.clarkparsia.owlapi.modularity.locality.LocalityClass; import com.clarkparsia.pellet.owlapiv3.PelletReasonerFactory; public class StructureBasedRootClassFinder implements RootClassFinder, OWLClassExpressionVisitor { diff --git a/examples/carcinogenesis/train.conf b/examples/carcinogenesis/train.conf index 431baa62e7..b0b36d09cb 100644 --- a/examples/carcinogenesis/train.conf +++ b/examples/carcinogenesis/train.conf @@ -355,7 +355,7 @@ lp.negativeExamples = { "kb:d335" } -op.type = "syncrho" +op.type = "rho" op.cardinalityLimit = 5 // CELOE configuration @@ -366,7 +366,7 @@ alg.searchTreeFile = "log/carcinogenesis/searchTree.log" alg.writeSearchTree = false alg.noisePercentage = 32 alg.startClass = "http://dl-learner.org/carcinogenesis#Compound" -alg.maxExecutionTimeInSeconds = 1800 +alg.maxExecutionTimeInSeconds = 100 //alg.maxClassDescriptionTests = 10000000 // PCELOE configuration diff --git a/examples/family-benchmark/Aunt.conf b/examples/family-benchmark/Aunt.conf index 700fe73dae..2cb70ab351 100644 --- a/examples/family-benchmark/Aunt.conf +++ b/examples/family-benchmark/Aunt.conf @@ -17,7 +17,7 @@ op.useCardinalityRestrictions = false h.type ="celoe_heuristic" h.expansionPenaltyFactor = 0.02 alg.type = "celoe" -alg.maxExecutionTimeInSeconds = 200 +alg.maxExecutionTimeInSeconds = 100 alg.terminateOnNoiseReached = true diff --git a/interfaces/src/test/java/org/dllearner/test/junit/ExampleTests.java b/interfaces/src/test/java/org/dllearner/test/junit/ExampleTests.java index 7e950374b0..7ac1a80a20 100644 --- a/interfaces/src/test/java/org/dllearner/test/junit/ExampleTests.java +++ b/interfaces/src/test/java/org/dllearner/test/junit/ExampleTests.java @@ -163,13 +163,13 @@ public void testAllConfFiles() throws ComponentInitException { // start example CLI start = new CLI(new File(conf)); start.init(); - start.run(); // System.out.println("algorithm: " + start.getLearningAlgorithm()); boolean isSparql = start.getKnowledgeSource() instanceof SparqlKnowledgeSource; // boolean isSparql = false; LearningAlgorithm algorithm = start.getLearningAlgorithm(); if((testGP || !(algorithm instanceof GP)) && (sparql == 0 || (sparql == 1 && isSparql) || (sparql == 2 && !isSparql) ) ) { + start.run(); started = true; // start.start(false); // test is successful if a concept was learned