[[PageOutline]] = RDF = Resource Description Framework Purpose: Make *statements* about *resources*. What is fundamental to RDF is the *graph model* of the statements. The notation used to represent or depict the graph is secondary. = RDF Notations = == RDF/XML notation == Example 1: August 16, 1999 en An obvious way to talk about any RDF statement is to say it is a *description*, and that it is *about* the subject of the statement (in this case, about http://www.example.org/index.html). Example 2: ]> Overnighter 2 2.4 784 ...other product descriptions... Here the `rdf:Description` element has an `rdf:ID` attribute instead of an `rdf:about` attribute. Using `rdf:ID` specifies a *fragment identifier* as an abbreviation of the complete URIref of the resource being described. The fragment identifier will be interpreted relative to a base URI. Suppose the RDF/XML document is identified by (and located at) `http://www.example.com/2002/04/products` the full URIref for the resource is `http://www.example.com/2002/04/products#item10245`. Example 3: Eric Miller Dr. RDF/XML provides a special abbreviation for describing *typed nodes*. In this abbreviation, the `rdf:type` property and its value are removed, and the `rdf:Description` element for the node is replaced by an element whose name is the QName corresponding to the value of the removed `rdf:type` property (a URIref that names a class). == N3 notation == Another RDF notation is *N3* ("Notation 3", developed by Tim Berners-Lee). N3 Example: @prefix dc: . dc:title "Tim Berners-Lee"; dc:publisher "Wikipedia". Full URIrefs must be enclosed in angle brackets in the triples notation. = RDF Concepts = == Statement == A statement about a *resource* that states the resource has a certain *property* with a certain *value*. A statement consists of 3 parts (a SPO-triple): 1. Resource (subject) -- An URIref 2. Property (predicate) -- An URIref 3. Value (object) -- An URIref or a Literal == URI reference (URIref) == An URIref consists of 2 parts (separated by the "#" character): 1. An URI 2. a *fragment identifier* (optional). Example: http://www.example.org/index.html#section2 == URI == There are 3 kinds of URIs: - Network-accessible things, e.g. an electronic document, an image, a service (e.g., "today's weather report for Los Angeles"), or a group of other resources. - Things that are not network-accessible, e.g. human beings, corporations, and bound books in a library. - Abstract concepts that do not physically exist, e.g. the concept of a "creator". == Literal == There are 2 kinds of literals: - Plain Literal - Typed Literal == Vocabulary == A *vocabulary* is a set of URIrefs, mostly properties, intended for a specific purpose. It's easy to imagine Property vocabularies describing books, videos, pizza joints, fine wines, mutual funds, and many other species of Web wildlife. == Qualified Name (QName) == A QName consists of 2 parts (separated by a colon): 1. a *prefix* that has been assigned to a namespace URI 2. a *local name* The full URIref is formed from the QName by appending the local name to the namespace URI assigned to the prefix. Example: foo:bar if the QName prefix `foo` is assigned to the namespace URI `http://example.org/somewhere/`, this QName is shorthand for the URIref `http://example.org/somewhere/bar`. == Structured Property Values and Blank Nodes == Structured information like a person's address is represented in RDF by considering the aggregate thing to be described as a resource, and then making statements about that new resource. Such resources may never need to be referred to directly from outside a particular graph, and hence may not require "universal" identifiers. Here, the node that stands for the concept of "John Smith's address" has no URIref. In the drawing this *blank node* just provides the necessary connectivity between the various other parts of the graph. (Blank nodes are also called *anonymous resources*.) In the triple representation of a graph *blank node identifiers* have the form `_:name`. Each distinct blank node in the graph is given a different blank node identifier. Two different graphs might independently use the same blank node identifiers, and it would be incorrect to assume that blank nodes from different graphs having the same blank node identifiers are the same. Example: exstaff:85740 exterms:address _:johnaddress . _:johnaddress exterms:street "1501 Grant Avenue" . _:johnaddress exterms:city "Bedford" . _:johnaddress exterms:state "Massachusetts" . _:johnaddress exterms:postalCode "01730" . Hint: RDF directly represents only binary relationships. The 5-way relationship (between John and the 4 address components) must be broken up into a group of separate binary relationships. Blank nodes provide one way to do this. = RDF Schema = RDF Schema provides a *type system* for RDF. The RDF Schema type system is similar in some respects to the type systems of object-oriented programming languages such as Java. For example, RDF Schema allows resources to be defined as instances of one or more *classes*. In addition, it allows classes to be organized in a hierarchical fashion; for example a class `ex:Dog` might be defined as a subclass of `ex:Mammal` which is a subclass of `ex:Animal`, meaning that any resource which is in class ex:Dog is also implicitly in class `ex:Animal` as well. The RDF Schema facilities are themselves provided in the form of an RDF vocabulary; that is, as a specialized set of predefined RDF resources with their own special meanings. The resources in the RDF Schema vocabulary have URIrefs with the prefix `http://www.w3.org/2000/01/rdf-schema#` (conventionally associated with the QName prefix rdfs:). Vocabulary descriptions (schemas) written in the RDF Schema language are legal RDF graphs. == Classes == Classes are described using the RDF Schema resources `rdfs:Class` and `rdfs:Resource`, and the properties `rdf:type` and `rdfs:subClassOf`. In RDF Schema, a class is any resource having an `rdf:type` property whose value is the resource `rdfs:Class`. Describing a class (example): ex:MotorVehicle rdf:type rdfs:Class . (using ex: to stand for the URIref `http://www.example.org/schemas/vehicles`) Describing an instance (example): exthings:companyCar rdf:type ex:MotorVehicle . Common convention: - class names are written with an initial uppercase letter. - property and instance names are written with an initial lowercase letter. ### Subclass Specialization (example): ex:Van rdf:type rdfs:Class . ex:Van rdfs:subClassOf ex:MotorVehicle . A class may be a subclass of more than one class. Schema in RDF/XML notation (example): ]> == Properties == In RDF Schema, properties are described using the RDF class `rdf:Property`, and the RDF Schema properties `rdfs:domain`, `rdfs:range`, and `rdfs:subPropertyOf`. All properties in RDF are described as instances of class `rdf:Property`. Describing a property (example): exterms:weightInKg rdf:type rdf:Property . === Range === The `rdfs:range` property is used to indicate that the values of a particular property are instances of a designated class. A property with instances as values (example): ex:Person rdf:type rdfs:Class . ex:author rdf:type rdf:Property . ex:author rdfs:range ex:Person . A property can have zero, one, or more than one range property. In case of many: the values of the property are resources that are instances of *all* of the classes specified as the ranges. A property with 2 ranges (example): ex:hasMother rdfs:range ex:Female . ex:hasMother rdfs:range ex:Person . A property with a typed literal value (example, `xsd:integer` is a XML Schema datatype): ex:age rdf:type rdf:Property . ex:age rdfs:range xsd:integer . === Domain === The `rdfs:domain` property is used to indicate that a particular property applies to a designated class. ex:Book rdf:type rdfs:Class . ex:author rdf:type rdf:Property . ex:author rdfs:domain ex:Book . A property may have zero, one, or more than one domain property. In case of many: this says that any resource that has the property is an instance of *all* of the classes specified as the domains. A property with 2 domains (in RDFs this is a nonsense example!!): exterms:weight rdfs:domain ex:Book . exterms:weight rdfs:domain ex:MotorVehicle . RDF/XML notation (to be added to Classes example above): === Subproperty === RDF Schema provides a way to specialize properties as well as classes. This specialization relationship between two properties is described using the predefined `rdfs:subPropertyOf` property. Describing a subproperty (example): 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 is that if an instance `exstaff:fred` is an `ex:primaryDriver` of the instance `ex:companyVan`, then RDF Schema defines `exstaff:fred` as also being an `ex:driver` of `ex:companyVan`. All RDF Schema `rdfs:range` and `rdfs:domain` properties that apply to an RDF property also apply to each of its subproperties. RDF/XML notation (to be added to Classes example above): == Describing an instance (complex example) == ]> 127 Note that a typed literal is used for the value of the `ex:rearSetLegRoom` property in this instance, rather than a plain literal (i.e., rather than stating the value as `127`). Because the schema describes the range of this property as an `xsd:integer`, the value of the property should be a typed literal of that datatype in order to match the range description (i.e., the range declaration does *not* automatically "assign" a datatype to a plain literal, and so a typed literal of the appropriate datatype must be explicitly provided). = Dublin Core Metadata Initiative (DCMI) = The Dublin Core metadata set is intended to be suitable for use by resource discovery tools on the Internet, such as the "Webcrawlers" employed by popular World Wide Web search engines. An real-world application of RDF. The four currently approved DCMI namespace URIs are: http://purl.org/dc/terms/ All DCMI properties, classes and encoding schemes http://purl.org/dc/dcmitype/ Classes in the DCMI Type Vocabulary http://purl.org/dc/dcam/ Terms used in the DCMI Abstract Model http://purl.org/dc/elements/1.1/ The Dublin Core Metadata Element Set, Version 1.1 (original 15 elements)