Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPE when working on ontology with no classes contained in #28

Open
LorenzBuehmann opened this issue Nov 5, 2015 · 0 comments
Open

NPE when working on ontology with no classes contained in #28

LorenzBuehmann opened this issue Nov 5, 2015 · 0 comments

Comments

@LorenzBuehmann
Copy link

The current implementation of Pellet does not work when we load an ontology with no classes and then e.g. ask for domains of a property.

The ontology:

@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@base <http://www.w3.org/2002/07/owl#> .
[ rdf:type owl:Ontology
] .
<http://dl-learner.org/test/strings/stringValue> rdf:type owl:DatatypeProperty .
<http://dl-learner.org/test/strings/p0> rdf:type owl:NamedIndividual ;
                     <http://dl-learner.org/test/strings/stringValue> "X"^^xsd:string .

The example code:

File file = //load file here;
OWLOntologyManager man = OWLManager.createOWLOntologyManager();
OWLDataFactory df = man.getOWLDataFactory();
OWLOntology ontology = man.loadOntologyFromOntologyDocument(file);
PrefixManager pm = new DefaultPrefixManager("http://dl-learner.org/test/strings/");
OWLDataProperty dp = df.getOWLDataProperty("stringValue", pm);
OWLReasonerFactory reasonerFactory = PelletReasonerFactory.getInstance();
OWLReasoner reasoner = reasonerFactory.createNonBufferingReasoner
reasoner.getDataPropertyDomains(dp, true); // NPE occurs

Exception:

java.lang.NullPointerException
    at org.mindswap.pellet.taxonomy.CDOptimizedTaxonomyBuilder.classify(CDOptimizedTaxonomyBuilder.java:826)
    at org.mindswap.pellet.taxonomy.CDOptimizedTaxonomyBuilder.classify(CDOptimizedTaxonomyBuilder.java:802)
    at org.mindswap.pellet.KnowledgeBase.getAllEquivalentClasses(KnowledgeBase.java:3565)
    at org.mindswap.pellet.KnowledgeBase.getEquivalentClasses(KnowledgeBase.java:3535)
    at com.clarkparsia.pellet.owlapiv3.PelletReasoner.getDataPropertyDomains(PelletReasoner.java:414)

The reason is in class CDOptimizedTaxonomyBuilder in line 826

ConceptFlag flag = conceptFlags.get( c );

The conceptFlags object is not created because the method classify() returns before because of an empty set of classes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant