Presentation is loading. Please wait.

Presentation is loading. Please wait.

RDF Schema (RDFS) RDF user communities need to define the vocabularies (terms) to indicate that they  are describing specific kinds or classes of resources.

Similar presentations


Presentation on theme: "RDF Schema (RDFS) RDF user communities need to define the vocabularies (terms) to indicate that they  are describing specific kinds or classes of resources."— Presentation transcript:

1 RDF Schema (RDFS) RDF user communities need to define the vocabularies (terms) to indicate that they  are describing specific kinds or classes of resources and  use specific properties in describing those resources Convention:  A class name begins with an uppercase letter  A property name has an initial lowercase letter Cf. Dublin Core and Friend Of A Friend RDF itself has no way to define such application-specific classes and properties  They’re described as an RDF vocabulary, using extensions to RDF provided by RDF Schema (or RDFS)

2 RDFS provides a type system for RDF Similar in some ways to the type systems of OO programming languages—e.g.:  Resources can be defined as instances of one or more classes  Classes organized in a hierarchical fashion But RDF classes and properties are also very different from programming language types  Their descriptions don’t create a straightjacket into which info is forced  Instead, they provide additional info about RDF resources RDFS facilities themselves are provided in the form of an RDF vocabulary—i.e., as a specialized set of predefined RDF resources with their own special meanings

3 The resources in the RDFS vocabulary have URIrefs with prefix http://www.w3.org/2000/01/rdf-schema#  Conventionally associated with QName prefix rdfs: Vocabulary descriptions (schemas) written in RDFS are legal RDF graphs  So RDF software not written to process the RDFS vocabulary can still interpret a schema as a legal RDF graph  But won’t understand the built-in meanings of the RDFS terms

4 Describing Classes A class corresponds to the generic concept of a Type or Category Classes are described using  the RDFS resources rdfs:Class and rdfs:Resource and  the properties rdf:type and rdfs:subClassOf

5 Example Organization example.org wants to provide info about kinds of motor vehicles First needs a class to represent the category of things that are motor vehicles  The resources belonging to a class are its instances A class is any resource having an rdf:type property whose value is the resource rdfs:Class So the motor vehicle class is described by  assigning the class a URIref, say ex:MotorVehicle using ex: to stand for the prefix for URIrefs from example.org's vocabulary, viz., http://www.example.org/schemas/vehicles  describing that resource with an rdf:type property whose value is the resource rdfs:Class I.e., it would write the RDF statement ex:MotorVehicle rdf:type rdfs:Class.  Property rdf:type indicates that a resource is an instance of a class

6 Then resource exthings:companyCar is described as a motor vehicle by the RDF statement exthings:companyCar rdf:type ex:MotorVehicle. The resource rdfs:Class itself has an rdf:type of rdfs:Class A resource may be an instance of more than one class

7 After describing class ex:MotorVehicle, example.org describes additional classes for specialized kinds of motor vehicle: ex:Van rdf:type rdfs:Class. ex:Truck rdf:type rdfs:Class. Etc. That they’re specialized kinds of ex:MotorVehicle is described using the rdfs:subClassOf property—e.g., ex:Van rdfs:subClassOf ex:MotorVehicle.  This means that any instance of class ex:Van is also an instance of class ex:MotorVehicle So, if exthings:companyVan is an instance of ex:Van, then RDF software written to understand the RDFS vocabulary can infer that also exthings:companyVan is also an instance of ex:MotorVehicle

8 The rdfs:subClassOf property is transitive—e.g., given ex:Van rdfs:subClassOf ex:MotorVehicle. ex:MiniVan rdfs:subClassOf ex:Van. RDFS defines ex:MiniVan as also being a subclass of ex:MotorVehicle A class may be a subclass of more than one class RDFS defines all classes as subclasses of class rdfs:Resource  The instances belonging to all classes are resources RDFS defines both the subjects and objects of statements using rdfs:subClassOf to be resources of type rdfs:Class  So this information could be inferred  But it’s good practice to provide this info explicitly

9 The class hierarchy discussed ex:MotorVehicle rdf:type rdfs:Class. ex:PassengerVehicle rdf:type rdfs:Class. ex:Van rdf:type rdfs:Class. ex:Truck rdf:type rdfs:Class. ex:MiniVan rdf:type rdfs:Class. ex:PassengerVehicle rdfs:subClassOf ex:MotorVehicle. ex:Van rdfs:subClassOf ex:MotorVehicle. ex:Truck rdfs:subClassOf ex:MotorVehicle. ex:MiniVan rdfs:subClassOf ex:Van. ex:MiniVan rdfs:subClassOf ex:PassengerVehicle.

10 In RDF/XML using typed nodes ]> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xml:base="http://example.org/schemas/vehicles">

11 Note the rdf:ID To ensure that references to these schema classes are correct even if the schema is relocated, the class descriptions can also include xml:base="http://example.org/schemas/vehicles"  Use of an explicit xml:base declaration is good practice To refer to these classes in RDF instance data located elsewhere, example.org must identify the classes either  by writing absolute URIrefs, or  by using relative URIrefs together with an appropriate xml:base declaration, or  by using QNames together with an appropriate namespace declaration

12 E.g., to describe the resource exthings:companyCar as an instance of the class ex:MotorVehicle : <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"> The QName ex:MotorVehicle when expanded using the namespace declaration becomes the full URIref http://example.org/schemas/vehicles#MotorVehicle  The xml:base declaration is used since a QName can’t be the value of an attribute (here rdf:ID )

13 Describing Properties In RDFS, properties are described using  the RDF class rdf:Property, and  the RDFS properties rdfs:domain, rdfs:range, and rdfs:subPropertyOf All properties in RDF are instances of class rdf:Property A new property is described by  assigning the property a URIref, and  describing that resource with an rdf:type property whose value is the resource rdf:Property E.g., exterms:weightInKg rdf:type rdf:Property.

14 RDF Schema provides vocabulary for describing how properties and classes are intended to be used together Most important are RDFS properties rdfs:range and rdfs:domain rdfs:range indicates that the values of a given property are instances of a designated class E.g., example.org wants to indicate that property ex:author has values that are instances of class ex:Person : ex:Person rdf:type rdfs:Class. ex:author rdf:type rdf:Property. ex:author rdfs:range ex:Person.

15 A property, ex:hasMother, can have 0, 1, or more range properties If it has no range property, nothing is said about the values of ex:hasMother If has 1 range property, e.g., specifying ex:Person as the range, this says that the values of the ex:hasMother property are instances of class ex:Person If it has > 1 range property, e.g., 1 specifying ex:Person as its range, and another specifying ex:Female as its range, this says that the values of the ex:hasMother property are resources that are instances of all of the classes specified as the ranges,  i.e., any value of ex:hasMother is both a ex:Female and a ex:Person

16 rdfs:range can also be used to indicate that the value of a property is given by a typed literal E.g., to indicate that the ex:age has values from the XML Schema datatype xsd:integer : ex:age rdf:type rdf:Property. ex:age rdfs:range xsd:integer. This URIref can be used without explicitly stating in the schema that it identifies a datatype  But it’s often useful to explicitly state that a given URIref identifies a datatype Use the RDFs class rdfs:Datatype xsd:integer rdf:type rdfs:Datatype.  Not a definition of a datatype (in the sense of defining a new one)

17 No way to define datatypes in RDFS Datatypes are defined externally to RDF (and to RDFS), and referred to in RDF statements by their URIrefs This statement just documents the existence of the datatype, and indicates explicitly that it’s being used in this schema

18 rdfs:domain indicates that a given property applies to a designated class E.g., to indicate that property ex:author applies to instances of class ex:Book : ex:Book rdf:type rdfs:Class. ex:author rdf:type rdf:Property. ex:author rdfs:domain ex:Book.

19 A property, exterms:weight, may have 0, 1, or more domain properties If it has no domain property, nothing is said about the resources that exterms:weight properties may be used with  Any resource could have a exterms:weight property If it has 1 domain property, e.g., specifying ex:Book as the domain, this says that the exterms:weight property applies to instances of class ex:Book If it has > 1 domain properties, e.g., 1 specifying ex:Book as the domain and another specifying ex:MotorVehicle as the domain, this says that any resource that has a exterms:weight property is an instance of all of the classes specified as the domains,  i.e., any resource that has a exterms:weight property is both a ex:Book and a ex:MotorVehicle

20 Extending the Example Vehicle Schema Add 2 properties:  ex:registeredTo (applies to any ex:MotorVehicle, value is a ex:Person )  ex:rearSeatLegRoom, (for any ex:PassengerVehicle, value is an integer) Add a new class ex:Person Explicitly describe datatype xsd:integer as a datatype

21 Predefined property rdfs:subPropertyOf denotes the specialization relationship between 2 properties E.g., ex:primaryDriver and ex:driver are properties, the former a specialization of the latter ex:driver rdf:type rdf:Property. ex:primaryDriver rdf:type rdf:Property. ex:primaryDriver rdfs:subPropertyOf ex:driver. The meaning of this rdfs:subPropertyOf relationship: If an instance exstaff:fred is an ex:primaryDriver of the instance ex:companyVan, then exstaff:fred is also an ex:driver of ex:companyVan A property may be a subproperty of 0, 1, or more properties  All rdfs:range and rdfs:domain properties that apply to a property also apply to its subproperties

22 In RDF/XML:

23 The Full Example Vehicle Schema ]> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xml:base="http://example.org/schemas/vehicles">

24

25

26 An Instance of ex:PassengerVehicle ]> <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"> 127 Note: ex:PassengerVehicle is a subclass of ex:MotorVehicle  So an ex:registeredTo property can be used in describing this instance of ex:PassengerVehicle

27 Interpreting RDF Schema Declarations RDF differs from most programming language (PL) type systems in several ways One important difference  A PL class has a collection of specific properties  An RDF schema describes properties as applying to specific classes of resources, using domain and range properties In the PL class description, attribute author is part of the description of class Book  Applies only to instances of class Book  An attribute called author in another class is considered a different attribute

28 I.e., the scope of an attribute description in PLs is restricted to the class or type in which it is defined But, in RDF, property descriptions are, by default, independent of class definitions  They have, by default, global scope (but may be restricted using domain specifications) A benefit of the RDF property-based approach:  It’s easier to extend the use of property definitions to originally unanticipated cases

29 Another result of the global scope of RDF property descriptions:  Can’t define a given property as having locally-different ranges depending on the class of the resource it’s applied to E.g., in defining ex:hasParent, we’d like it so humans have human parents, monkeys monkey parents  But, in RDFS, any range defined for a property applies to all uses of the property  Locally-different ranges can be defined in OWL

30 Another important difference between PL type systems and RDF:  RDF Schema descriptions aren’t necessarily prescriptive like PL type declarations E.g., suppose a PL declares a class Book with an author attribute having values of type Person  This gives a group of constraints  The language won’t allow the an instance of Book without an author attribute an instance of Book with an author attribute that doesn’t have a Person as its value  And, if author is the only attribute for class Book, we can’t have an instance of Book with some other attribute

31 But RDFS provides schema info as additional descriptions of resources  Doesn’t prescribe how these descriptions should be used by an application E.g., suppose an RDF schema states that an ex:author property has an r dfs:range of class ex:Person  This is just an RDF statement that RDF statements containing ex:author properties have instances of ex:Person as objects

32 This schema-supplied info might be used in various ways One application might interpret this statement as specifying part of a template for RDF data it’s creating  Ensure that any ex:author property has a ex:Person value  I.e., interpret the schema description as a constraint (as a PL does) Another application might interpret this statement as providing additional info about data it’s receiving— info not explicitly provided in the original data  E.g., suppose it receives some RDF data that includes an ex:author property whose value is a resource of unspecified class  It uses this schema statement to conclude that the resource is an instance of ex:Person

33 A 3 rd application might use the statement for consistency checking  E.g., suppose it receives some RDF data that includes an ex:author property whose value is a resource of class ex:Corporation  It could warn of a possible inconsistency  But it might not be inconsistent after all E.g., somewhere else there might be a declaration that a corporation is a (legal) person

34 Depending on how the application interprets the property descriptions, a description of an instance might be considered valid either  without some of the schema-specified properties or  with additional properties RDF schema statements are always descriptions  They may also be prescriptive But only if the application interpreting them wants to treat them so

35 Other Schema Information See: Dan Brickley and R.V. Guha (eds.), RDF Vocabulary Description Language 1.0: RDF Schema, W3C Recommendation, 2004, http://www.w3.org/TR/rdf-schema/ http://www.w3.org/TR/rdf-schema/ rdfs:label is an instance of rdf:Property used to provide a human-readable version of a resource's name  A triple of the form R rdfs:label L states that L is a human readable label for R  rdfs:domain is rdfs:Resource  rdfs:range is rdfs:Literal

36 rdfs:comment is an instance of rdf:Property used to provide a human-readable description of a resource  A triple of the form: R rdfs:comment L states that L is a human readable description of R  rdfs:domain is rdfs:Resource  rdfs:range is rdfs:Literal

37 N3 Example @prefix rdf:. @prefix rdfs:. @prefix ex:. ex:Car a rdfs:Class. ex:foo a ex:Car ; rdfs:label "My car" ; rdfs:comment "I've owned it since 2002.". In RDF/XML <rdf:RDF xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:ex="http://www.example.org/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> My car I've owned it since 2002.

38 rdfs:Container is a super-class of the RDF Container classes: rdf:Bag, rdf:Seq, rdf:Alt rdfs:ContainerMembershipProperty class has as instances the properties rdf:_1, rdf:_2, rdf:_3,... rdfs:member is an instance of rdf:Property that’s a super- property of all the container membership properties  I.e., each container membership property has an rdfs:subPropertyOf relationship to the property rdfs:member

39 rdfs:seeAlso is an instance of rdf:Property  Used to indicate a resource that might provide additional info about the subject resource rdfs:isDefinedBy is an instance of rdf:Property  Used to indicate a resource defining the subject resource  May be used to indicate an RDF vocabulary in which a resource is described

40 N3 Example @prefix rdf:. @prefix rdfs:. @prefix ex:. ex:Car a rdfs:Class ; rdfs:isDefinedBy. ex:foo a ex:Car ; rdfs:seeAlso. In RDF/XML <rdf:RDF xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:ex="http://www.example.org/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">


Download ppt "RDF Schema (RDFS) RDF user communities need to define the vocabularies (terms) to indicate that they  are describing specific kinds or classes of resources."

Similar presentations


Ads by Google