Thibaut Guirimand
Thibaut Guirimand

Reputation: 912

How to define an rdfs:range target in a list of possibilities?

I'm trying to declare a property phs:hasTheValue to add a boolean or an integer to an object.

Currently, I've wrote this code to define the property.

phs:hasTheValue a rdf:Property;
    rdfs:range [
            a owl:DataRange;
            owl:oneOf (xsd:boolean xsd:integer);
        ];
    .

My problem is that I can't open my file with Protégé 5.0 because of the owl:oneOf assertion. Is this a wrong syntax or a wrong way to declare the rdfs:range of my property ?

Upvotes: 3

Views: 554

Answers (1)

Artemis
Artemis

Reputation: 3301

The reason this is not working is because owl:oneOf is defined as:

An enumeration is a owl:oneOf element, containing a list of the objects that are its instances. This enables us to define a class by exhaustively enumerating its elements. The class defined by the oneOf element contains exactly the enumerated elements, no more, no less. For example:

<owl:oneOf rdf:parseType="Collection">
<owl:Thing rdf:about="#Eurasia"/>
<owl:Thing rdf:about="#Africa"/>
<owl:Thing rdf:about="#North_America"/>
<owl:Thing rdf:about="#South_America"/>
<owl:Thing rdf:about="#Australia"/>
<owl:Thing rdf:about="#Antarctica"/>
</oneOf>

What you are trying to define does not fit into the definition of owl:oneOf. I think what you need is a normal union.

<owl:DatatypeProperty rdf:about="http://www.example.org/demo.owl#hasTheValue">
    <rdfs:range>
        <rdfs:Datatype>
            <owl:unionOf rdf:parseType="Collection">
                <rdf:Description rdf:about="&xsd;boolean"/>
                <rdf:Description rdf:about="&xsd;integer"/>
            </owl:unionOf>
        </rdfs:Datatype>
    </rdfs:range>
</owl:DatatypeProperty>

Upvotes: 4

Related Questions