{{ RDF Primer 5.2 Describing Properties The rdfs:range property is used to indicate that the values of a particular property are instances of a designated class. For example, if example.org wanted to indicate that the property ex:author had values that are instances of class ex:Person, it would write the RDF statements: ex:Person rdf:type rdfs:Class . ex:author rdf:type rdf:Property . ex:author rdfs:range ex:Person . These statements indicate that ex:Person is a class, ex:author is a property, and that RDF statements using the ex:author property have instances of ex:Person as objects. ...... [snip] ...... The rdfs:range property can also be used to indicate that the value of a property is given by a typed literal, as discussed in Section 2.4. For example, if example.org wanted to indicate that the property ex:age had values from the XML Schema datatype xsd:integer, it would write the RDF statements: ex:age rdf:type rdf:Property . ex:age rdfs:range xsd:integer . The datatype xsd:integer is identified by its URIref (the full URIref being http://www.w3.org/2001/XMLSchema#integer). This URIref can be used without explicitly stating in the schema that it identifies a datatype. However, it is often useful to explicitly state that a given URIref identifies a datatype. This can be done using the RDF Schema class rdfs:Datatype. To state that xsd:integer is a datatype, example.org would write the RDF statement: xsd:integer rdf:type rdfs:Datatype . This statement says that xsd:integer is the URIref of a datatype (which is assumed to conform to the requirements for RDF datatypes described in [RDF-CONCEPTS]). Such a statement does not constitute a definition of a datatype, e.g., in the sense that example.org is defining a new datatype. There is no way to define datatypes in RDF Schema. As noted in Section 2.4, datatypes are defined externally to RDF (and to RDF Schema), and referred to in RDF statements by their URIrefs. This statement simply serves to document the existence of the datatype, and indicate explicitly that it is being used in this schema. }} {{ OWL Reference 4.1.3 rdfs:range http://www.w3.org/TR/2004/REC-owl-ref-20040210/#range-def Syntactically, rdfs:range is a built-in property that links a property (some instance of the class rdf:Property) to to either a class description or a data range. An rdfs:range axiom asserts that the values of this property must belong to the class extension of the class description or to data values in the specified data range. Multiple range restrictions are interpreted as stating that the range of the property is the intersection of all ranges (i.e., the intersection of the class extension of the class descriptions c.q. the intersection of the data ranges). Similar to rdfs:domain, multiple alternative ranges can be specified by using a class description of the owl:unionOf form (see the previous subsection). }} 举例: RDF Schema <rdf:Property rdf:ID="registeredTo"> <rdfs:domain rdf:resource="#MotorVehicle"/> <rdfs:range rdf:resource="#Person"/> <!--用rdfs:range指定 属性值 应为某个类的实例(实际值应为一个URIref)--></rdf:Property><rdf:Property rdf:ID="rearSeatLegRoom"> <rdfs:domain rdf:resource="#PassengerVehicle"/> <rdfs:range rdf:resource="&xsd;integer"/> <!-- 用rdfs:range指定 属性值 应为某个数据类型 (实际值应为一个typed literal) --></rdf:Property><rdfs:Class rdf:ID="Person"/> <!-- Person为一个类 --><rdfs:Datatype rdf:about="&xsd;integer"/> <!-- &xsd;integer为一个Datatype--> RDF <?xml version="1.0"?><!DOCTYPE rdf:RDF [<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#">]><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:ex="http://example.org/schemas/vehicles#" xml:base="http://example.org/things"> <ex:PassengerVehicle rdf:ID="johnSmithsCar"> <ex:registeredTo rdf:resource="http://www.example.org/staffid/85740"/> <ex:rearSeatLegRoom rdf:datatype="&xsd;integer">127</ex:rearSeatLegRoom> <ex:primaryDriver rdf:resource="http://www.example.org/staffid/85740"/> </ex:PassengerVehicle></rdf:RDF> 关于rdfs:range的缺省值 RDF Schema规定了range的rdfs:range为rdfs:Class。 在RDF中,如果没有为一个rdf:Property的实例指定range,则该property的range缺省值为:rdfs:Class(即该property的值的类型为rdfs:Class) 或更具体的为 rdfs:Datatype(它是rdfs:Class的子类)(即该property的值的类型为rdfs:Datatype。通常在RDF中声明XML Schema中的datatypes类型为rdfs:Datatype)。 注:上述缺省值是通过RDF和RDFS的RDF Schema推导出来的。 在OWL中,rdf:Property被分为两个子类, owl:ObjectProperty, 其range为owl:Thing owl:DatatypeProperty, 在OWL-Lite中其range为XML Schema Datatypes或rdfs:XMLLiteral;在OWL-DL和OWL-DL中, owl:DatatypeProperty的range还可能是owl:DataRange。 注:这里的缺省值是根据OWL Semantics的推导出来的?? 疑问:OWL中,为什么没有像RDF中那样,使用RDF Schema Datatypes前,先声明其为rdfs:Datatype ??