Illegal punning in prov-o.ttl, prov.ttl imports broken

Hi, hope you are all well!

It was raised to my attention [1] that our http://www.w3.org/ns/prov-o
(aka https://www.w3.org/ns/prov-o.ttl or
https://www.w3.org/ns/prov-o.rdf) has an illegal OWL 2 punning of an
annotation property and object property, and that this causes error
messages (but no apparant issues) when loading the ontology in Protege -
reported by the underlying OWLAPI.

Using my updated OWL2 ProfileChecker 1.1.0 [2] (which uses OWLAPI 5.1):

    stain@biggiebuntu:~$ profilechecker http://www.w3.org/ns/prov-o --all
    [main] ERROR uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl -
    Illegal redeclarations of entities: reuse of entity
    http://www.w3.org/ns/prov#wasRevisionOf in punning not allowed
    [Declaration(ObjectProperty(<http://www.w3.org/ns/prov#wasRevisionOf>)),
    Declaration(AnnotationProperty(<http://www.w3.org/ns/prov#wasRevisionOf>))]
    [main] ERROR uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl -
    Illegal redeclarations of entities: reuse of entity
    http://www.w3.org/ns/prov#specializationOf in punning not allowed
    [Declaration(ObjectProperty(<http://www.w3.org/ns/prov#specializationOf>)),
    Declaration(AnnotationProperty(<http://www.w3.org/ns/prov#specializationOf>))]
    
    OWL2_DL: 9 violations
    OWL2_QL: 29 violations
    OWL2_EL: 32 violations
    OWL2_RL: 16 violations
    OWL2_FULL: 9 violations

See gist [3] for all the OWL2 Full violations.


This seems to be because our prov-o.ttl (and .rdf) declares
prov:wasRevisionOf and prov:specializationOf as both ObjectProperty and
AnnotationProperty.  


    :wasRevisionOf
        a owl:AnnotationProperty, owl:ObjectProperty ;


    :specializationOf
        a owl:AnnotationProperty, owl:ObjectProperty ;

While this punning is allowed for OWL2 Full - it is
not allowed in RDF serializations of OWL ontologies [4]
because an IRI or BlankNode must be assigned  to "at most one" of object
property expressions, data property expression or annotation property.
 

I think we did the above because we also declare provenance of the
owl:Ontology within the same file:


  <http://www.w3.org/ns/prov-o#>
    a owl:Ontology ;
    rdfs:label "W3C PROVenance Interchange Ontology (PROV-O)"@en ;
    rdfs:seeAlso <http://www.w3.org/TR/prov-o/>, <http://www.w3.org/ns/prov> ;
    owl:versionIRI <http://www.w3.org/ns/prov-o-20130430> ;
    owl:versionInfo "Recommendation version 2013-04-30"@en ;
    :specializationOf <http://www.w3.org/ns/prov-o> ;
    :wasRevisionOf <http://www.w3.org/ns/prov-o-20120312> .

Ironically the AnnotationProperty declaration is something Protege/OWLAPI added
automatically at the time because of this - and in fact if "a
owl:AnnotationProperty" is not implicitly declared (but it is still stated on
the owl:Ontology), then there is no warning at all from OWLAPI:

    stain@biggiebuntu:~/Desktop$ profilechecker prov-o.ttl --all
    OWL2_DL: OK
    OWL2_QL: 20 violations
    OWL2_EL: 23 violations
    OWL2_RL: 7 violations
    OWL2_FULL: OK
    
Note how the above now is OWL2 DL compliant again.  I double-checked the
history - and when we did profile checking the OWLAPI didn't do this
punning check - it was introduced just a few months after our release.


So I would suggest that we fix prov-o.ttl and prov-o.rdf to remove the explicit 
AnnotationProperty statement.  If you agree we can also remove it from the
statements on the owl:Ontology itself (that is anyway covered by the provenance
file) - although for Protege/OWLAPI that doesn't seem necessary.

----

There's a larger issue, in that the "all in one go"
http://www.w3.org/ns/prov (aka https://www.w3.org/ns/prov.ttl) declares:


    <http://www.w3.org/ns/prov#>
        a owl:Ontology ;

and also https://www.w3.org/ns/prov-o.ttl declares:


    <http://www.w3.org/ns/prov#>
        a owl:Ontology .

This causes loading exceptions in OWLAPI 5 [6], including:

    Exception in thread "main" org.semanticweb.owlapi.model.UnloadableImportException: Could not load imported ontology: <http://www.w3.org/ns/prov-aq#> Cause: Ontology already exists. OntologyID(OntologyIRI(<http://www.w3.org/ns/prov#>) VersionIRI(<null>))


This prevents http://www.w3.org/ns/prov being used as "owl:imports" in
other ontologies.


Given that we use "/ns/prov-o#" as name in:

    rdfs:isDefinedBy <http://www.w3.org/ns/prov-o#> ;

then I think this should be the owl:Ontology IRI within prov-o.ttl and
friends - that is the style we've used say in
http://www.w3.org/ns/prov-o-inverses
and would prevent conflict with prov.ttl.



I also wonder why prov.ttl both does an owl:imports AND re-declares all the
concepts (and multiple owl:Ontology), which seems a bit pointless, as well as
causing their owl:Ontology to be declared both within prov.ttl and prov-o.ttl
-- perhaps that also gives errors.  Suggested fix is for prov.ttl and friends
to only have the imports - or at least to not have repeated owl:Ontology
declarations.



[1] https://github.com/evoinfo/miapa/issues/25
[2] https://github.com/stain/profilechecker/releases/tag/1.1.0
[3] https://gist.github.com/stain/1c61313ab1b5349d3cba6467c7c51a2d
[4] https://sourceforge.net/p/owlapi/mailman/message/31757311/
[5] https://www.w3.org/TR/owl2-mapping-to-rdf/#Populating_an_Ontology
[6] https://gist.github.com/stain/9f1c5caeb32b618547ca63612edfd6e7


-- 
Stian Soiland-Reyes
The University of Manchester
http://www.esciencelab.org.uk/
http://orcid.org/0000-0001-9842-9718

Received on Thursday, 4 May 2017 15:34:04 UTC