2

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?

Rok
  • 97
  • 6
  • 2
    I guess you can use an [RDF collection](https://www.w3.org/TR/rdf-schema/#ch_collectionvocab). But why don't you use OWL for complex ranges? – UninformedUser Nov 08 '17 at 16:15

1 Answers1

4

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") ].
Reto Gmür
  • 2,497
  • 1
  • 20
  • 25
Rok
  • 97
  • 6
  • There's no need to give the class a name and far less to use owl:equivalentClass, you could use the [ ... ] construct directly as object of rdfs:range or if you ant to give it a name so you can reuse it, directly declare example:YesNo a owl:DataRange; owl:oneOf ("yes" "no"). – Reto Gmür Nov 11 '17 at 22:57