4

Are these statements the same ? Is there any concern if I remove owl:Restriction and owl:Class. they seem redundant to state, but this is always how I see examples online. owl:onProperty has domain owl:restriction and owl:restriction is a subclassOf owl:class.

:myClass owl:equivalentClass  
[a owl:Class ;
          owl:intersectionOf (
          [ a owl:Restriction ; owl:onProperty :hasProp  ; owl:allValuesFrom  :SomeOtherClass ]
          [ a owl:Restriction ; owl:onProperty :hasChild ; owl:someValuesFrom :SomeOtherClass ] ) ] .



:myClass owl:equivalentClass  
[owl:intersectionOf  (
  [ owl:onProperty :hasProp ; owl:allValuesFrom  :SomeOtherClass ]
  [ owl:onProperty :hasProp ; owl:someValuesFrom :SomeOtherClass ] )
] .
Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140
Mike
  • 295
  • 1
  • 2
  • 7

1 Answers1

6

Good question. The reason you need these types to be specified is due to the mapping from RDF graphs to OWL (2) Ontologies. In an OWL 2 ontology, every entities must be explicitly typed as either a class, an object property, a datatype property, an annotation property, a datatype or an ontology. To ensure this constraint is addressed in all RDF serialisation of an OWL ontology, one must explicitly type all resources introduced by the ontology, including these blank nodes associated with restrictions, intersections and so on.

With that said, there are many cases when the explicit typing is not really useful because the type can be inferred from the other triples. For instance:

:myClass  owl:intersectionOf  ( owl:Thing ) .

requires that :myClass is an owl:Class. Consider the example that you give:

:myClass owl:equivalentClass  
[owl:intersectionOf  (
  [ owl:onProperty :hasProp ; owl:allValuesFrom  :SomeOtherClass ]
  [ owl:onProperty :hasProp ; owl:someValuesFrom :SomeOtherClass ] )
] .

On the one hand, :myClass must be a class, because of owl:equivalentClass; the two blank nodes inside the list are necessarily owl:Restriction, because of the use of the predicate owl:onProperty; this entails that the blank node with the owl:intersectionOf attribute is necessarily a class.

On the other hand, it is not clear whether :SomeOtherClass is a class or a datatype, because it is not known whether :hasProp is an object property or a datatype property. So here you have a situation whether explicitly typing makes a difference.

Now, the real question may be: "do I really need to put these types explicitly in pratice?" I'd say, it depends on the tools you are using. Most OWL processors will interpret many non compliant RDF graphs as valid OWL ontologies, but you have to be careful, as surprises could happen. For example, I tried opening a file in Protégé containing the example that you give. Protégé did not manage to interpret the content as defining any class or property. However, the problem was not because of the missing owl:Restriction or the missing owl:Class for the blank nodes. If I simply added an explicit type for :myClass, then Protégé interpreted the content as defining two classes, an object property, and an axiom about :myClass. Compare:

# This does not work in Protégé 4.3
@prefix : <http://ex.com/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .

:myClass owl:equivalentClass [
    owl:intersectionOf  (
        [ owl:onProperty :hasProp; owl:allValuesFrom  :SomeOtherClass ]
        [ owl:onProperty :hasProp; owl:someValuesFrom :SomeOtherClass ]
    )
] .

and:

# This works in Protégé 4.3
@prefix : <http://ex.com/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .

:myClass a owl:Class;
    owl:equivalentClass [
        owl:intersectionOf  (
            [ owl:onProperty :hasProp; owl:allValuesFrom  :SomeOtherClass ]
            [ owl:onProperty :hasProp; owl:someValuesFrom :SomeOtherClass ]
        )
    ] .

What is surprising is that Protégé decided to interpret :hasProp as an object property while it could have been a datatype property.

Finally, to wrap this answer up, I noticed that if you discard the owl:Restriction type completely, ontologies in RDF are still recognised as valid OWL 2 DL ontologies by the Manchester OWL 2 validator. Try this as an input:

@prefix : <http://ex.com/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .

:SomeOtherClass a owl:Class .
:hasProp a owl:ObjectProperty .
:myClass a owl:Class;
  owl:equivalentClass [
    owl:intersectionOf  (
      [ owl:onProperty :hasProp; owl:allValuesFrom  :SomeOtherClass ]
      [ owl:onProperty :hasProp; owl:someValuesFrom :SomeOtherClass ]
    )
  ] .

Edit: I just checked the OWL 2 specification and it appears that the RDF graph above should be classified as an OWL 2 DL ontology document. However, in this particular example, there is no ambiguity on the types of the entities.

Antoine Zimmermann
  • 5,314
  • 18
  • 36
  • The fact that the OWL 2 validator does not complain does not imply that the ontology parsed corresponds to what the ontology was intended to represent, though. In the OWL 2 Test suite for reasoners, many ontologies in RDF/XML remove some of the elements mentioned above and as a consequence are parsed incorrectly, so another variable involved here is the parser behaviour. I have not tested this extensively, but it might well be that the parser is being tolerant (i.e., arbitrarily resolving ambiguous situations). Mileage may vary across formats. In short: beware of messing with serializations. – Ignazio Feb 23 '14 at 08:56
  • Ignazio, if the validator classifies an ontology document as OWL 2 DL when it does not conform exactly to the OWL 2 DL fragment, then it is a bug. A validator is not *just* a parser. It must be in strict alignment with the spec and thus has to reject all ambiguous situations. I checked the standard and my last example should not be classified as an OWL 2 DL ontology document, so yes, it is a bug in the validator. – Antoine Zimmermann Feb 23 '14 at 13:25
  • I agree, both on the bug and on the purpose of a validator. I believe the validators powering the website are the ones in the OWL API, and in that case they do not look directly at the input but only at the results of the parsing. So, if the parser takes a shortcut and does not report about it, the validator has no way to know. I'm not advocating that this is not a bug :-) just outlining some of the variables at play. – Ignazio Feb 23 '14 at 17:04
  • Guys thank you . I just did another test where i tried viewing the ontograph in protege with the owl:Class and owl:Restrictions removed. the screen didn't render correctly and i got this exception. `ClassCastException: uk.ac.manchester.cs.owl.owlapi.OWLAnonymousIndividualImpl cannot be cast to org.semanticweb.owlapi.model.OWLNamedIndividual` Although after adding back all the owl:Class and owl:Restriction, the screen rendered ok, but i still see this message. Perhaps protege wants me to explicitly declare things as owl:NamedIndividual ? – Mike Feb 25 '14 at 05:43