0

Have been stuck one day and would someone be kind enough to help? I have loaded an ontology which imported SWEET(Semantic Web for Earth and Environmental Ontology). I did some SPARQL query on it, and I got such answer: "Object Property hasLowerBound is used with a hasValue restriction where the value is a literal: "0"^^integer". (hasLowerBound, which I have checked in the SWEET, is an Datatype Ontology in SWEET)

How can I solve this problem?

Here is the code I wrote and the error I got,Thank you so much for your help~

public class load {
public static void main(String[] args) throws OWLOntologyCreationException {
    // Get hold of an ontology manager
    OWLOntologyManager manager = OWLManager.createOWLOntologyManager();

    File file = new File("G:/Protege/owlfiles/Before_Gather.owl");
            // Load the local copy
    OWLOntology loadMODIS = manager.loadOntologyFromOntologyDocument(file);

    PelletReasoner reasoner = 
    PelletReasonerFactory.getInstance().createNonBufferingReasoner( loadMODIS         
    );

    KnowledgeBase kb = reasoner.getKB();
    PelletInfGraph graph = new 
    org.mindswap.pellet.jena.PelletReasoner().bind( kb );
    InfModel model = ModelFactory.createInfModel( graph );

    String PREFIX = "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-
    ns#>" +
            "PREFIX owl: <http://www.w3.org/2002/07/owl#>" +
            "PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>" +
            "PREFIX seaice: <http://www.semanticweb.org/SeaIceOntology#>" +
            "PREFIX repr: <http://sweet.jpl.nasa.gov/2.3/reprDataFormat.owl#>" +
            "PREFIX realmCryo: <http://sweet.jpl.nasa.gov/2.3/realmCryo.owl#>" +
            "PREFIX relaMath: <http://sweet.jpl.nasa.gov/2.3/relaMath.owl#>";
    String SELECT = "select ?dataset ";
    String WHERE = "where {" +
            "?dataset relaMath:hasLowerBound " + "\"0\"^^xsd:integer" +
            "}" ;

    QueryExecution qe = SparqlDLExecutionFactory.create(QueryFactory.create(PREFIX + SELECT + WHERE), model);
    ResultSet rs = qe.execSelect();
    ResultSetFormatter.out(System.out,rs);
    rs = null;  qe.close();

    reasoner.dispose();

    //OWLReasonerSPARQLEngine sparqlEngine=new OWLReasonerSPARQLEngine(new MinimalPrintingMonitor());
    //sparqlEngine.execQuery(str.toString(),dataset);

    System.out.println("Loaded ontology: " + loadMODIS);
}
}

Exception in thread "main" org.mindswap.pellet.exceptions.InternalReasonerException: Object Property hasLowerBound is used with a hasValue restriction where the value is a literal: "0"^^integer at org.mindswap.pellet.tableau.completion.rule.SomeValuesRule.applySomeValuesRule(SomeValuesRule.java:204) at org.mindswap.pellet.tableau.completion.rule.SomeValuesRule.apply(SomeValuesRule.java:64) at org.mindswap.pellet.tableau.completion.rule.AbstractTableauRule.apply(AbstractTableauRule.java:64) at org.mindswap.pellet.tableau.completion.SROIQStrategy.complete(SROIQStrategy.java:157) at org.mindswap.pellet.ABox.isConsistent(ABox.java:1423) at org.mindswap.pellet.ABox.isConsistent(ABox.java:1260) at org.mindswap.pellet.KnowledgeBase.consistency(KnowledgeBase.java:1987) at org.mindswap.pellet.KnowledgeBase.isConsistent(KnowledgeBase.java:2061) at org.mindswap.pellet.jena.PelletInfGraph.prepare(PelletInfGraph.java:258) at org.mindswap.pellet.jena.PelletInfGraph.prepare(PelletInfGraph.java:241) at com.clarkparsia.pellet.sparqldl.jena.SparqlDLExecutionFactory.create(SparqlDLExecutionFactory.java:113) at com.clarkparsia.pellet.sparqldl.jena.SparqlDLExecutionFactory.create(SparqlDLExecutionFactory.java:261) at com.clarkparsia.pellet.sparqldl.jena.SparqlDLExecutionFactory.create(SparqlDLExecutionFactory.java:226) at loadMODIS.load.main(load.java:78)

  • For some reason the property hasLowerBound is handled as object property, so you would have to check what's wrong in the ontology. It might be that the ontology is wrong or something happens during the OWL API parsing step. – UninformedUser Jan 22 '16 at 03:02
  • Thank u so much for your answer. At first I thought the SWEET, the ontology I loaded, is wrong. But it is officially released and I checked inside the ontology, it seems they are right. The Property hasLowerBound is a DataProperty. So I am now considering the second choice you said. But how can I look into the parsing step? Would you please give me some suggestions? – Julyana Lin Jan 22 '16 at 07:21
  • I would suggest to ask for help on the OWL API mailing list. Those guys are pretty fast and usually can help you quite well. IF the property is explicitly defined as owl:DatatypeProperty something else (e.g. another axiom) must let Pellet think that it's an owl:ObjectProperty. It might also occur somewhere in the conversion from OWL API to Pellet internal structures. – UninformedUser Jan 22 '16 at 21:39
  • Which version of Pellet and OWLAPI? Also, can you add a link to the ontology? – Ignazio Jan 22 '16 at 22:14
  • Sounds like a good idea! I will go for the mailing list for help. It can be a big possibility that error occur during the conversion from OWL API to Pellet internal structure. Thank you very much for your nice advice~ – Julyana Lin Jan 23 '16 at 04:14
  • Version of Pellet: 2.3.0 Version of OWL API: 3.4.10 The link to the ontology: [link](https://sweet.jpl.nasa.gov/download), and I used version 2.3 Is there anything wrong?@ignazio – Julyana Lin Jan 23 '16 at 04:18
  • Might be a parsing bug in OWLAPI, I'll have a look at the actual ontology. – Ignazio Jan 23 '16 at 09:27
  • Parsing the ontology with OWLAPI 3.4.10 reports hasLowerBound as a data property only - so I'm guessing it's not an OWLAPI bug. – Ignazio Jan 23 '16 at 11:19

1 Answers1

0

hasLowerBound is parsed as a data property and an annotation property.

Pellet is checking for a data property case and assumes that if a property is not a data property it must be an object property. This is always the case for OWL 2 ontologies, but this ontology is not being parsed as an OWL 2 compatible ontology - punning of an annotation property and a data property is not allowed.

I'm not sure yet whether the problem is in the ontology or in the OWLAPI parsing of it.

Edit: It's a parsing issue. hasLowerBound is declared in relaMath.owl as data property. However relaMath.owl imports reprMath.owl, which uses hasLowerBound but does not declare it. reprMath.owl imports relaMath.owl, so there is a cyclic import there.

The problem is that, during parsing: - relaMath.owl is parsed, import is found, reprMath.owl import is resolved; no declarations are parsed yet. - reprMath.owl is parsed, import is found. relaMath.owl is already being parsed, so call does nothing. All entities declared in relaMath.owl are included while parsing reprMath.owl. PROBLEM: the entities have not been parsed yet, so this set is empty. hasLowerBound is found in reprMath but no declaration exists yet. Therefore OWLAPI defaults to AnnotationProperty. - relaMath.owl parsing continues, declaration is found.

Final result: Any ontology importing relaMath.owl has illegal punning for hasLowerBound. OWLAPI bug.

Workaround: Add data property declaration to reprMath.owl:

<owl:DatatypeProperty rdf:about="#hasLowerBound"/>

This might need to be done in more than one ontology.

Ignazio
  • 10,504
  • 1
  • 14
  • 25
  • Thank you for your advice! I didn't know that an Annotation Property can not be a Datatype Property at the same time. But I don't quiet understand your solution. Is it means to declare a new Datatype Property only exists in the specific document rather than citing the Property already declared in the relaMath.owl? I've tried with deleting all the Annotation declaration of hasLowerBound in all the Documents, because I thought the document will automatically find the hasLowerBound property in relaMath.owl. But it still doesn't work. Am I wrong? – Julyana Lin Jan 24 '16 at 09:17
  • The declaration in relaMath.owl /should/ be found automatically but it's not - that's the bug. The workaround is not to delete the annotation property declarations (there aren't any), it is to add the data property declaration to all ontologies that use hasLowerBound – Ignazio Jan 24 '16 at 10:00
  • Oh, sorry, I mistaken you. the Ontology relaMath include is repr, reprMath, PropFunction, reprMathGraph, propDifference, reprMathFunction, reprMathOperation, reprMathStatistics, among which only reprMath import relaMath leading to a cyclic. So I only added in repeMath.owl and changed the namespace "mrela" to "math". It is still not working. should I change other owl documents like matrWater, which relaMath.owl does not include but matrWater itself include relaMath? – Julyana Lin Jan 24 '16 at 13:13
  • I've not attempted applying the fix to all ontologies, so you might have to try adding the declaration to all of them in order for the issue to go away. Also, the property is used with integers and doubles - that might cause legitimate errors, but I've not investigated that possibility. – Ignazio Jan 24 '16 at 13:56
  • Thaaank you soo much. I got the problem fixed. Here's what I did according to what you said: 1. Change the 0 to 0.0; 0 to 0.0 in all the documents. – Julyana Lin Jan 25 '16 at 07:25
  • 2. Declare and in the documents that has hasValue restriction on the 2 properties and change the namespace of hasLowerBound and hasUpperBound. Change 0 to 0. – Julyana Lin Jan 25 '16 at 07:27