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

Allow parsing of OWL qualified cardinality restrictions even when the onProperty is not known to be an Object or Datatype property. #571

Open
chrispetsos opened this issue Oct 26, 2016 · 3 comments

Comments

@chrispetsos
Copy link

chrispetsos commented Oct 26, 2016

I use OWL API version 4 and the following snippet,

manager = OWLManager.createOWLOntologyManager();  
        try {  
            ontology = manager.loadOntologyFromOntologyDocument(new StreamDocumentSource(axioms));  
        } catch (OWLOntologyCreationException e) {  
            e.printStackTrace();  
        }

to load the following ontology that contains a qualified cardinality restriction,

@prefix : <http://www.seerc.org/test/pellet-icv#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
@prefix owl: <http://www.w3.org/2002/07/owl#> .

:Manager rdfs:subClassOf
              [ a owl:Restriction ;
                owl:onProperty :manages ;
                owl:qualifiedCardinality "1"^^xsd:nonNegativeInteger ;
                owl:onClass :Department
              ] .

The OWL API logs the following,

0 [main] ERROR org.semanticweb.owlapi.rdf.rdfxml.parser.OWLRDFConsumer - Entity not properly recognized, missing triples in input? http://org.semanticweb.owlapi/error#Error1 for type Class

The ontology contains the Error1 class,

SubClassOf(http://www.seerc.org/test/pellet-icv#Manager http://org.semanticweb.owlapi/error#Error1) AnnotationAssertion(owl:qualifiedCardinality _:genid1 "1"^^xsd:nonNegativeInteger)

and the cardinality restriction is not parsed correctly.
When i declare :manages as Object Property,

@prefix : <http://www.seerc.org/test/pellet-icv#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
@prefix owl: <http://www.w3.org/2002/07/owl#> .

:Manager rdfs:subClassOf
              [ a owl:Restriction ;
                owl:onProperty :manages ;
                owl:qualifiedCardinality "1"^^xsd:nonNegativeInteger ;
                owl:onClass :Department
              ] .

:manages a owl:ObjectProperty .

it parses the ontology correctly,

Declaration(ObjectProperty(http://www.seerc.org/test/pellet-icv#manages)) SubClassOf(http://www.seerc.org/test/pellet-icv#Manager ObjectExactCardinality(1 http://www.seerc.org/test/pellet-icv#manages http://www.seerc.org/test/pellet-icv#Department))

No Error1 class and the cardinality restriction is parsed correctly.

My suggestion is that whenever a property is not known to be an Object or Datatype property, to default to an Object Property if we are in LAX mode. What do you think about such an enhancement? Any good strategies to tackle such a requirement? Would a solution be to alter a bit the logic here?

@ignazio1977
Copy link
Contributor

Can you describe what you wish to happen?

When a property is undefined, parser behavior is supposed to be to throw exceptions.

In order to deal with real world data, we attempt to treat such cases with a best guess, but we need more information on this one.

@ignazio1977
Copy link
Contributor

Sorry, saw your update after my comment

chrispetsos added a commit to chrispetsos/PaaSword that referenced this issue Oct 27, 2016
Commented the object property in exactCardinalityConstraint.owl. Will
try to solve Issue 571 (owlcs/owlapi#571).
chrispetsos added a commit to chrispetsos/owlapi that referenced this issue Oct 27, 2016
Relax a bit the Object Property assertion logic. If it is not explicitly
declared to be an Object Property or a Datatype Property, then assume it
is an Object Property.
@chrispetsos chrispetsos changed the title Assume object property when property not defined in LAX mode Allow parsing of OWL qualified cardinality restrictions even when the onProperty is not known to be an Object or Datatype property. Nov 3, 2016
@chrispetsos
Copy link
Author

The new title represents what my original intention was after all... i'll issue a new pull request that tries to fulfill this in a more elegant way.

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

No branches or pull requests

2 participants