简体   繁体   中英

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 ?

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM