Skip to content

Commit

Permalink
Removed dependencies to SESAME.
Browse files Browse the repository at this point in the history
Changed some examples by reducing execution time.
Fixed Unit test to ignore SPARQL examples correctly.
  • Loading branch information
LorenzBuehmann committed Mar 29, 2012
1 parent e642b33 commit 133ee3d
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 21 deletions.
4 changes: 4 additions & 0 deletions components-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@
<artifactId>xercesImpl</artifactId>
<groupId>xerces</groupId>
</exclusion>
<exclusion>
<artifactId>any23-core</artifactId>
<groupId>org.deri.any23</groupId>
</exclusion>
</exclusions>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand All @@ -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.
Expand Down Expand Up @@ -340,7 +337,7 @@ private List<EvaluatedDescription> buildEvaluatedClassDescriptions(Map<NamedClas
//secondly, create disjoint classexpressions with score 1 - (#occurence/#all)
for(Entry<NamedClass, Integer> 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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -334,7 +334,7 @@ class OWLFilter extends Filter<OntClass>{
@Override
public boolean accept(OntClass cls) {
if(!cls.isAnon()){
return cls.getURI().startsWith(OWL.NAMESPACE);
return cls.getURI().startsWith(OWL2.getURI());
}
return false;
}
Expand All @@ -346,7 +346,7 @@ class RDFSFilter extends Filter<OntClass>{
@Override
public boolean accept(OntClass cls) {
if(!cls.isAnon()){
return cls.getURI().startsWith(RDFS.NAMESPACE);
return cls.getURI().startsWith(RDFS.getURI());
}
return false;
}
Expand All @@ -358,7 +358,7 @@ class RDFFilter extends Filter<OntClass>{
@Override
public boolean accept(OntClass cls) {
if(!cls.isAnon()){
return cls.getURI().startsWith(RDF.NAMESPACE);
return cls.getURI().startsWith(RDF.getURI());
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions examples/carcinogenesis/train.conf
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ lp.negativeExamples = {
"kb:d335"
}

op.type = "syncrho"
op.type = "rho"
op.cardinalityLimit = 5

// CELOE configuration
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/family-benchmark/Aunt.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 133ee3d

Please sign in to comment.