Changes between Initial Version and Version 1 of RDF


Ignore:
Timestamp:
11.03.2012 23:07:44 (9 years ago)
Author:
jri
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • RDF

    v1 v1  
     1[[PageOutline]] 
     2 
     3= RDF = 
     4 
     5Resource Description Framework 
     6 
     7Purpose: Make *statements* about *resources*. 
     8 
     9<http://www.w3.org/RDF/>   
     10 
     11<http://www.w3.org/TR/rdf-primer/>   
     12<http://www.w3.org/TR/rdf-concepts/>   
     13<http://www.w3.org/TR/rdf-syntax-grammar/>   
     14<http://www.w3.org/TR/rdf-mt/>   
     15<http://www.w3.org/TR/rdf-schema/>   
     16<http://www.w3.org/TR/rdf-testcases/> 
     17 
     18What is fundamental to RDF is the *graph model* of the statements.   
     19The notation used to represent or depict the graph is secondary. 
     20 
     21<img src="http://www.w3.org/TR/rdf-primer/fig1dec16.png"> 
     22 
     23 
     24 
     25= RDF Notations = 
     26 
     27 
     28== RDF/XML notation == 
     29 
     30Example 1: 
     31 
     32    <?xml version="1.0"?> 
     33    <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
     34             xmlns:dc="http://purl.org/dc/elements/1.1/" 
     35             xmlns:exterms="http://www.example.org/terms/"> 
     36 
     37        <rdf:Description rdf:about="http://www.example.org/index.html"> 
     38            <exterms:creation-date>August 16, 1999</exterms:creation-date> 
     39            <dc:language>en</dc:language> 
     40            <dc:creator rdf:resource="http://www.example.org/staffid/85740"/> 
     41        </rdf:Description> 
     42    </rdf:RDF> 
     43 
     44An 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). 
     45 
     46Example 2: 
     47 
     48    <?xml version="1.0"?> 
     49    <!DOCTYPE rdf:RDF [<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#">]> 
     50    <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
     51             xmlns:exterms="http://www.example.com/terms/"> 
     52 
     53        <rdf:Description rdf:ID="item10245"> 
     54            <exterms:model rdf:datatype="&xsd;string">Overnighter</exterms:model> 
     55            <exterms:sleeps rdf:datatype="&xsd;integer">2</exterms:sleeps> 
     56            <exterms:weight rdf:datatype="&xsd;decimal">2.4</exterms:weight> 
     57            <exterms:packedSize rdf:datatype="&xsd;integer">784</exterms:packedSize> 
     58        </rdf:Description> 
     59 
     60        ...other product descriptions... 
     61 
     62    </rdf:RDF> 
     63 
     64Here 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`. 
     65 
     66Example 3: 
     67 
     68    <?xml version="1.0"?> 
     69    <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
     70             xmlns:contact="http://www.w3.org/2000/10/swap/pim/contact#"> 
     71 
     72        <contact:Person rdf:about="http://www.w3.org/People/EM/contact#me"> 
     73            <contact:fullName>Eric Miller</contact:fullName> 
     74            <contact:mailbox rdf:resource="mailto:em@w3.org"/> 
     75            <contact:personalTitle>Dr.</contact:personalTitle>  
     76        </contact:Person> 
     77    </rdf:RDF> 
     78 
     79RDF/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). 
     80 
     81 
     82== N3 notation == 
     83 
     84Another RDF notation is *N3* ("Notation 3", developed by Tim Berners-Lee). 
     85 
     86N3 Example: 
     87 
     88    @prefix dc: <http://purl.org/dc/elements/1.1/>. 
     89 
     90    <http://de.wikipedia.org/wiki/Tim_Berners-Lee> dc:title "Tim Berners-Lee"; 
     91                                                   dc:publisher "Wikipedia". 
     92 
     93Full URIrefs must be enclosed in angle brackets in the triples notation. 
     94 
     95 
     96 
     97= RDF Concepts = 
     98 
     99 
     100== Statement == 
     101 
     102A statement about a *resource* that states the resource has a certain *property* with a certain *value*. 
     103A statement consists of 3 parts (a SPO-triple): 
     104 
     1051. Resource (subject) -- An URIref 
     1062. Property (predicate) -- An URIref 
     1073. Value (object) -- An URIref or a Literal 
     108 
     109 
     110== URI reference (URIref) == 
     111 
     112An URIref consists of 2 parts (separated by the "#" character): 
     113 
     1141. An URI  
     1152. a *fragment identifier* (optional). 
     116 
     117Example: 
     118 
     119    http://www.example.org/index.html#section2 
     120 
     121 
     122== URI == 
     123 
     124There are 3 kinds of URIs: 
     125 
     126- Network-accessible things, 
     127 
     128  e.g. an electronic document, an image, a service (e.g., "today's weather  
     129  report for Los Angeles"), or a group of other resources. 
     130 
     131- Things that are not network-accessible, 
     132 
     133  e.g. human beings, corporations, and bound books in a library. 
     134 
     135- Abstract concepts that do not physically exist, 
     136 
     137  e.g. the concept of a "creator". 
     138 
     139 
     140== Literal == 
     141 
     142There are 2 kinds of literals: 
     143 
     144- Plain Literal 
     145- Typed Literal 
     146 
     147 
     148== Vocabulary == 
     149 
     150A *vocabulary* is a set of URIrefs, mostly properties, intended for  
     151a specific purpose. It's easy to imagine Property vocabularies  
     152describing books, videos, pizza joints, fine wines, mutual funds, and  
     153many other species of Web wildlife. 
     154 
     155 
     156== Qualified Name (QName) == 
     157 
     158A QName consists of 2 parts (separated by a colon): 
     159 
     1601. a *prefix* that has been assigned to a namespace URI 
     161 
     1622. a *local name* 
     163 
     164The full URIref is formed from the QName by appending the local name to the namespace URI assigned to the prefix. 
     165 
     166Example: 
     167 
     168    foo:bar 
     169 
     170if 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`. 
     171 
     172 
     173== Structured Property Values and Blank Nodes == 
     174 
     175Structured 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. 
     176 
     177<img src="http://www.w3.org/TR/rdf-primer/fig6may19.png"> 
     178 
     179Here, 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*.) 
     180 
     181In 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. 
     182 
     183Example: 
     184 
     185    exstaff:85740   exterms:address         _:johnaddress . 
     186    _:johnaddress   exterms:street          "1501 Grant Avenue" . 
     187    _:johnaddress   exterms:city            "Bedford" . 
     188    _:johnaddress   exterms:state           "Massachusetts" . 
     189    _:johnaddress   exterms:postalCode      "01730" . 
     190 
     191Hint: 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. 
     192 
     193 
     194 
     195= RDF Schema = 
     196 
     197<http://www.w3.org/TR/rdf-schema/> 
     198 
     199RDF Schema provides a *type system* for RDF. 
     200 
     201The RDF Schema type system is similar in some respects to the type  
     202systems of object-oriented programming languages such as Java. For  
     203example, RDF Schema allows resources to be defined as instances of one  
     204or more *classes*. In addition, it allows classes to be organized  
     205in a hierarchical fashion; for example a class `ex:Dog` might be defined  
     206as a subclass of `ex:Mammal` which is a subclass of `ex:Animal`, meaning  
     207that any resource which is in class ex:Dog is also implicitly in class  
     208`ex:Animal` as well. 
     209 
     210The RDF Schema facilities are themselves provided in the form of an RDF  
     211vocabulary; that is, as a specialized set of predefined RDF resources  
     212with their own special meanings. The resources in the RDF Schema  
     213vocabulary have URIrefs with the prefix  
     214`http://www.w3.org/2000/01/rdf-schema#` (conventionally associated with  
     215the QName prefix rdfs:). Vocabulary descriptions (schemas) written in  
     216the RDF Schema language are legal RDF graphs. 
     217 
     218 
     219== Classes == 
     220 
     221Classes are described using the RDF Schema resources `rdfs:Class` and `rdfs:Resource`, and the properties `rdf:type` and `rdfs:subClassOf`. 
     222 
     223In RDF Schema, a class is any resource having an `rdf:type` property whose value is the resource `rdfs:Class`. 
     224 
     225Describing a class (example): 
     226 
     227    ex:MotorVehicle   rdf:type   rdfs:Class . 
     228 
     229(using ex: to stand for the URIref `http://www.example.org/schemas/vehicles`) 
     230 
     231Describing an instance (example): 
     232 
     233    exthings:companyCar   rdf:type   ex:MotorVehicle . 
     234 
     235Common convention: 
     236 
     237- class names are written with an initial uppercase letter. 
     238- property and instance names are written with an initial lowercase letter. 
     239 
     240### Subclass 
     241 
     242Specialization (example): 
     243 
     244    ex:Van   rdf:type          rdfs:Class . 
     245    ex:Van   rdfs:subClassOf   ex:MotorVehicle . 
     246 
     247A class may be a subclass of more than one class. 
     248 
     249Schema in RDF/XML notation (example): 
     250 
     251    <?xml version="1.0"?> 
     252    <!DOCTYPE rdf:RDF [<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#">]> 
     253    <rdf:RDF    
     254        xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"   
     255        xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" 
     256        xml:base="http://example.org/schemas/vehicles"> 
     257 
     258        <rdfs:Class rdf:ID="MotorVehicle"/> 
     259 
     260        <rdfs:Class rdf:ID="PassengerVehicle"> 
     261            <rdfs:subClassOf rdf:resource="#MotorVehicle"/> 
     262        </rdfs:Class> 
     263 
     264        <rdfs:Class rdf:ID="Van"> 
     265            <rdfs:subClassOf rdf:resource="#MotorVehicle"/> 
     266        </rdfs:Class> 
     267 
     268        <rdfs:Class rdf:ID="MiniVan"> 
     269            <rdfs:subClassOf rdf:resource="#Van"/> 
     270            <rdfs:subClassOf rdf:resource="#PassengerVehicle"/> 
     271        </rdfs:Class> 
     272 
     273    </rdf:RDF> 
     274 
     275 
     276== Properties == 
     277 
     278In RDF Schema, properties are described using the RDF class `rdf:Property`, and the RDF Schema properties `rdfs:domain`, `rdfs:range`, and `rdfs:subPropertyOf`. 
     279 
     280All properties in RDF are described as instances of class `rdf:Property`. 
     281 
     282Describing a property (example): 
     283 
     284    exterms:weightInKg   rdf:type   rdf:Property . 
     285 
     286=== Range === 
     287 
     288The `rdfs:range` property is used to indicate that the values of a particular property are instances of a designated class. 
     289 
     290A property with instances as values (example): 
     291 
     292    ex:Person   rdf:type     rdfs:Class . 
     293    ex:author   rdf:type     rdf:Property . 
     294    ex:author   rdfs:range   ex:Person . 
     295 
     296A 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. 
     297 
     298A property with 2 ranges (example): 
     299 
     300    ex:hasMother   rdfs:range   ex:Female . 
     301    ex:hasMother   rdfs:range   ex:Person . 
     302 
     303A property with a typed literal value (example, `xsd:integer` is a XML Schema datatype): 
     304 
     305    ex:age   rdf:type     rdf:Property . 
     306    ex:age   rdfs:range   xsd:integer . 
     307 
     308=== Domain === 
     309 
     310The `rdfs:domain` property is used to indicate that a particular property applies to a designated class. 
     311 
     312    ex:Book     rdf:type      rdfs:Class . 
     313    ex:author   rdf:type      rdf:Property . 
     314    ex:author   rdfs:domain   ex:Book . 
     315 
     316A 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. 
     317 
     318A property with 2 domains (in RDFs this is a nonsense example!!): 
     319 
     320    exterms:weight   rdfs:domain   ex:Book . 
     321    exterms:weight   rdfs:domain   ex:MotorVehicle . 
     322 
     323RDF/XML notation (to be added to Classes example above): 
     324 
     325    <rdf:Property rdf:ID="registeredTo"> 
     326        <rdfs:domain rdf:resource="#MotorVehicle"/> 
     327        <rdfs:range rdf:resource="#Person"/> 
     328    </rdf:Property> 
     329 
     330    <rdf:Property rdf:ID="rearSeatLegRoom"> 
     331        <rdfs:domain rdf:resource="#PassengerVehicle"/>  
     332        <rdfs:range rdf:resource="&xsd;integer"/> 
     333    </rdf:Property> 
     334 
     335    <rdfs:Class rdf:ID="Person"/> 
     336 
     337    <rdfs:Datatype rdf:about="&xsd;integer"/> 
     338 
     339=== Subproperty === 
     340 
     341RDF 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. 
     342 
     343Describing a subproperty (example): 
     344 
     345    ex:driver          rdf:type             rdf:Property . 
     346    ex:primaryDriver   rdf:type             rdf:Property . 
     347    ex:primaryDriver   rdfs:subPropertyOf   ex:driver . 
     348 
     349The 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`. 
     350 
     351All RDF Schema `rdfs:range` and `rdfs:domain` properties that apply to an RDF property also apply to each of its subproperties. 
     352 
     353RDF/XML notation (to be added to Classes example above): 
     354 
     355    <rdf:Property rdf:ID="driver"> 
     356        <rdfs:domain rdf:resource="#MotorVehicle"/> 
     357    </rdf:Property> 
     358 
     359    <rdf:Property rdf:ID="primaryDriver"> 
     360        <rdfs:subPropertyOf rdf:resource="#driver"/> 
     361    </rdf:Property> 
     362 
     363 
     364== Describing an instance (complex example) == 
     365 
     366    <?xml version="1.0"?> 
     367    <!DOCTYPE rdf:RDF [<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#">]> 
     368    <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
     369             xmlns:ex="http://example.org/schemas/vehicles#" 
     370             xml:base="http://example.org/things"> 
     371 
     372        <ex:PassengerVehicle rdf:ID="johnSmithsCar"> 
     373            <ex:registeredTo rdf:resource="http://www.example.org/staffid/85740"/> 
     374            <ex:rearSeatLegRoom rdf:datatype="&xsd;integer">127</ex:rearSeatLegRoom> 
     375            <ex:primaryDriver rdf:resource="http://www.example.org/staffid/85740"/> 
     376        </ex:PassengerVehicle> 
     377    </rdf:RDF> 
     378 
     379Note 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 `<ex:rearSeatLegRoom>127</ex:rearSeatLegRoom>`). 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). 
     380 
     381 
     382 
     383= Dublin Core Metadata Initiative (DCMI) = 
     384 
     385<http://dublincore.org/> 
     386 
     387The 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. 
     388 
     389The four currently approved DCMI namespace URIs are: 
     390 
     391    http://purl.org/dc/terms/           All DCMI properties, classes and encoding schemes 
     392    http://purl.org/dc/dcmitype/            Classes in the DCMI Type Vocabulary 
     393    http://purl.org/dc/dcam/            Terms used in the DCMI Abstract Model 
     394    http://purl.org/dc/elements/1.1/    The Dublin Core Metadata Element Set, Version 1.1 (original 15 elements)