owlcs / owlapi

OWL API main repository
828 stars 315 forks source link

Manchester syntax parser crashes on class/property punning #851

Closed cmungall closed 5 years ago

cmungall commented 5 years ago

Note that there was a similar issue fixed in #548 but there wasn't a test case, so this seems to be a new case.

The following ontology puns creator_of, but it is impossible to use the punned OP in a HasValue expression:

Prefix: : <http://x.org/>

Ontology: <http://x.org>
## comment to prevent interpretation as obo format

Individual: x
Class: creator_of
ObjectProperty: creator_of

Class: Test
  EquivalentClasses: creator_of value x

yields

Encountered value at line 11 column 32. Expected one of:
        Individual:
        AnnotationProperty:
        or
        Datatype:
        DataProperty:
        ObjectProperty:
        DisjointProperties:
        ,
        ValuePartition:
        EquivalentClasses:
        Import:
        Prefix:
        DisjointClasses:
        and
        Class:
        SameIndividual:
        DifferentIndividuals:
        org.semanticweb.owlapi.manchestersyntax.parser.ManchesterOWLSyntaxParserImpl$ExceptionBuilder.build(Manchester
OWLSyntaxParserImpl.java:2521)
cmungall commented 5 years ago

Note that punning OP and class is a use case for CRO: https://github.com/data2health/contributor-role-ontology/issues/14

ignazio1977 commented 5 years ago

Uhm, unfortunately it's also an OWL 2 DL violation :-(

cmungall commented 5 years ago

I thought punning on class and object property was permitted? https://www.w3.org/TR/owl2-new-features/#F12:_Punning

ignazio1977 commented 5 years ago

I have plenty of comments that I could address to the people who wrote the specs. Most of them are rude and therefore I shall keep quiet.

cmungall commented 5 years ago

What's my best bet for actually seeing what is permitted? Is the one I linked to the best or is there others?

ignazio1977 commented 5 years ago

I'm not aware of any other source.

matthewhorridge commented 5 years ago

What's my best bet for actually seeing what is permitted? Is the one I linked to the best or is there others?

That's it @cmungall. From my understanding, it is permitted. Property punning between properties is illegal, but punning of a property name and class name or individual name is allowed.... as far as I can tell.

matthewhorridge commented 5 years ago

p.s. for years (!) I thought it was illegal

ignazio1977 commented 5 years ago

p.s. for years (!) I thought it was illegal

Me too.

ignazio1977 commented 5 years ago

Aside from punning, there's a problem in the example because Equivalentclasses expects at least two arguments. I assume that's an issue in the example, not in CRO?

ignazio1977 commented 5 years ago

Let me know if you need a release of this fix urgently.

sszuev commented 5 years ago

as for me, I'd like to have have 5.1.11 released soon

ignazio1977 commented 5 years ago

Cool, I'll release once we've reached a decision on undeclared obo tags.

cmungall commented 5 years ago

Aside from punning, there's a problem in the example because Equivalentclasses expects at least two arguments. I assume that's an issue in the example, not in CRO?

The example is manchester / frame syntax though...?

Anyway thanks for the fix! Don't need a release urgently. But I don't want to be the holdup on the release, I'll answer in the other ticket about obo tages

ignazio1977 commented 5 years ago

The example is manchester / frame syntax though...?

I wasn't referring to the syntax, it's the OWL axiom that needs two or more. Syntax might allow writing it (functional syntax complains, because it's closer to the spec in its grammar) but it's still a bad axiom. Not important here though.

cmungall commented 5 years ago

Ah, I see, I used EquivalentClasses which is not a construct in Manchester.

Class: Test
  EquivalentClasses: creator_of value x

I meant EquivalentTo which is Manchester