What's the correct way to set domains/ranges of data/object properties in OWL?
If I have two classes A
, B
and a data property hasName
:
<Declaration><Class IRI="#A"/></Declaration>
<Declaration><Class IRI="#B"/></Declaration>
<Declaration><DataProperty IRI="#hasName"/></Declaration>
<FunctionalDataProperty>
<DataProperty IRI="#hasName"/>
</FunctionalDataProperty>
<DataPropertyRange>
<DataProperty IRI="#hasName"/>
<Datatype abbreviatedIRI="xsd:string"/>
</DataPropertyRange>
I want to set class A
and class B
as solely domains for hasName
. I tried to do it in three ways, which approach bellow is correct?
Option 1 - infered domain results:
A
,B
andowl:Thing
<DataPropertyDomain> <DataProperty IRI="#hasName"/> <Class IRI="#A"/> </DataPropertyDomain> <DataPropertyDomain> <DataProperty IRI="#hasName"/> <Class IRI="#B"/> </DataPropertyDomain>
Option 2 - infered domain result:
owl:Thing
<DataPropertyDomain> <DataProperty IRI="#hasName"/> <ObjectUnionOf> <Class IRI="#A"/> <Class IRI="#B"/> </ObjectUnionOf> </DataPropertyDomain>
Option 3 - infered domain result:
owl:Thing
<EquivalentClasses> <Class IRI="#A"/> <DataExactCardinality cardinality="1"> <DataProperty IRI="#hasName"/> <Datatype abbreviatedIRI="xsd:string"/> </DataExactCardinality> </EquivalentClasses> <EquivalentClasses> <Class IRI="#B"/> <DataExactCardinality cardinality="1"> <DataProperty IRI="#hasName"/> <Datatype abbreviatedIRI="xsd:string"/> </DataExactCardinality> </EquivalentClasses>
From option 1, I got 3 results from HermiT reasoner: A
, B
, and owl:Thing
, but when I read this post he said that I wrote wrong semantics and should've use owl:unionOf
.
Then I tried to express the classes like in option 2, but when I infered again, I only get the class owl:Thing
, not A
or B
.
With option 3, I set the classes as domains in the equivalent class axioms. It could work but then I cannot use the powerful reasoner tool to infer:
Set<OWLClass> classes = reasoner.getDataPropertyDomains(hasNameProperty, false).getFlattened();