rdfrdfs+

The simplest way of declaring that a property’s range is one of a limited number of literal values


This seems like a question that should have an obvious simple answer but google has been of no help.

What is the simplest way of declaring that a property’s range is one of a limited number of literal values? As far as I understand, the following is not valid:

example:myProperty rdfs:range "yes", "no".

because "The rdfs:range of rdfs:range is the class rdfs:Class." (RDF Schema 1.1 specification).

How is this usually declared in RDF schemas? If there are alternative ways, what are their pros & cons?


Solution

  • Thanks for pointing me in the right direction, ASKW!

    # Declare datatype 
    example:YesNo rdf:type rdfs:Datatype;
        owl:oneOf ("yes" "no").
    
    # Use the datatype as rdfs:range
    example:myProperty rdfs:range example:YesNo.
    
    # Or else just declare the DataRange inline as anonymous class
    example:myProperty rdfs:range [ owl:oneOf ("yes" "no") ].