Changes between Version 1 and Version 2 of RDF
- Timestamp:
- 11.03.2012 23:32:38 (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
RDF
v1 v2 5 5 Resource Description Framework 6 6 7 Purpose: 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 18 What is fundamental to RDF is the * graph model* of the statements.7 Purpose: 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 18 What is fundamental to RDF is the **graph model** of the statements.\\ 19 19 The notation used to represent or depict the graph is secondary. 20 20 21 <img src="http://www.w3.org/TR/rdf-primer/fig1dec16.png"> 21 [[Image(http://www.w3.org/TR/rdf-primer/fig1dec16.png)]] 22 22 23 23 … … 29 29 30 30 Example 1: 31 31 {{{ 32 32 <?xml version="1.0"?> 33 33 <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" … … 41 41 </rdf:Description> 42 42 </rdf:RDF> 43 44 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).43 }}} 44 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). 45 45 46 46 Example 2: 47 47 {{{ 48 48 <?xml version="1.0"?> 49 49 <!DOCTYPE rdf:RDF [<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#">]> … … 61 61 62 62 </rdf:RDF> 63 64 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`.63 }}} 64 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`. 65 65 66 66 Example 3: 67 67 {{{ 68 68 <?xml version="1.0"?> 69 69 <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" … … 76 76 </contact:Person> 77 77 </rdf:RDF> 78 79 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).78 }}} 79 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). 80 80 81 81 82 82 == N3 notation == 83 83 84 Another RDF notation is * N3* ("Notation 3", developed by Tim Berners-Lee).84 Another RDF notation is **N3** ("Notation 3", developed by Tim Berners-Lee). 85 85 86 86 N3 Example: 87 87 {{{ 88 88 @prefix dc: <http://purl.org/dc/elements/1.1/>. 89 89 90 90 <http://de.wikipedia.org/wiki/Tim_Berners-Lee> dc:title "Tim Berners-Lee"; 91 91 dc:publisher "Wikipedia". 92 92 }}} 93 93 Full URIrefs must be enclosed in angle brackets in the triples notation. 94 94 … … 100 100 == Statement == 101 101 102 A statement about a * resource* that states the resource has a certain *property* with a certain *value*.102 A statement about a **resource** that states the resource has a certain **property** with a certain **value**. 103 103 A statement consists of 3 parts (a SPO-triple): 104 104 … … 113 113 114 114 1. An URI 115 2. a * fragment identifier* (optional).115 2. a **fragment identifier** (optional). 116 116 117 117 Example: 118 118 {{{ 119 119 http://www.example.org/index.html#section2 120 120 }}} 121 121 122 122 == URI == … … 148 148 == Vocabulary == 149 149 150 A * vocabulary* is a set of URIrefs, mostly properties, intended for150 A **vocabulary** is a set of URIrefs, mostly properties, intended for 151 151 a specific purpose. It's easy to imagine Property vocabularies 152 152 describing books, videos, pizza joints, fine wines, mutual funds, and … … 158 158 A QName consists of 2 parts (separated by a colon): 159 159 160 1. a * prefix* that has been assigned to a namespace URI161 162 2. a * local name*160 1. a **prefix** that has been assigned to a namespace URI 161 162 2. a **local name** 163 163 164 164 The full URIref is formed from the QName by appending the local name to the namespace URI assigned to the prefix. 165 165 166 166 Example: 167 167 {{{ 168 168 foo:bar 169 169 }}} 170 170 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`. 171 171 … … 175 175 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. 176 176 177 <img src="http://www.w3.org/TR/rdf-primer/fig6may19.png"> 178 179 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*.)180 181 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.177 [[Image(http://www.w3.org/TR/rdf-primer/fig6may19.png)]] 178 179 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//.) 180 181 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. 182 182 183 183 Example: 184 184 {{{ 185 185 exstaff:85740 exterms:address _:johnaddress . 186 186 _:johnaddress exterms:street "1501 Grant Avenue" . … … 188 188 _:johnaddress exterms:state "Massachusetts" . 189 189 _:johnaddress exterms:postalCode "01730" . 190 190 }}} 191 191 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. 192 192 … … 195 195 = RDF Schema = 196 196 197 <http://www.w3.org/TR/rdf-schema/> 198 199 RDF Schema provides a * type system* for RDF.197 http://www.w3.org/TR/rdf-schema/ 198 199 RDF Schema provides a **type system** for RDF. 200 200 201 201 The RDF Schema type system is similar in some respects to the type 202 202 systems of object-oriented programming languages such as Java. For 203 203 example, RDF Schema allows resources to be defined as instances of one 204 or more * classes*. In addition, it allows classes to be organized204 or more **classes**. In addition, it allows classes to be organized 205 205 in a hierarchical fashion; for example a class `ex:Dog` might be defined 206 206 as a subclass of `ex:Mammal` which is a subclass of `ex:Animal`, meaning … … 224 224 225 225 Describing a class (example): 226 226 {{{ 227 227 ex:MotorVehicle rdf:type rdfs:Class . 228 228 }}} 229 229 (using ex: to stand for the URIref `http://www.example.org/schemas/vehicles`) 230 230 231 231 Describing an instance (example): 232 232 {{{ 233 233 exthings:companyCar rdf:type ex:MotorVehicle . 234 234 }}} 235 235 Common convention: 236 236 … … 238 238 - property and instance names are written with an initial lowercase letter. 239 239 240 ### Subclass 240 === Subclass === 241 241 242 242 Specialization (example): 243 243 {{{ 244 244 ex:Van rdf:type rdfs:Class . 245 245 ex:Van rdfs:subClassOf ex:MotorVehicle . 246 246 }}} 247 247 A class may be a subclass of more than one class. 248 248 249 249 Schema in RDF/XML notation (example): 250 250 {{{ 251 251 <?xml version="1.0"?> 252 252 <!DOCTYPE rdf:RDF [<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#">]> … … 272 272 273 273 </rdf:RDF> 274 274 }}} 275 275 276 276 == Properties == … … 281 281 282 282 Describing a property (example): 283 283 {{{ 284 284 exterms:weightInKg rdf:type rdf:Property . 285 285 }}} 286 286 === Range === 287 287 … … 289 289 290 290 A property with instances as values (example): 291 291 {{{ 292 292 ex:Person rdf:type rdfs:Class . 293 293 ex:author rdf:type rdf:Property . 294 294 ex:author rdfs:range ex:Person . 295 296 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.295 }}} 296 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. 297 297 298 298 A property with 2 ranges (example): 299 299 {{{ 300 300 ex:hasMother rdfs:range ex:Female . 301 301 ex:hasMother rdfs:range ex:Person . 302 302 }}} 303 303 A property with a typed literal value (example, `xsd:integer` is a XML Schema datatype): 304 304 {{{ 305 305 ex:age rdf:type rdf:Property . 306 306 ex:age rdfs:range xsd:integer . 307 307 }}} 308 308 === Domain === 309 309 310 310 The `rdfs:domain` property is used to indicate that a particular property applies to a designated class. 311 311 {{{ 312 312 ex:Book rdf:type rdfs:Class . 313 313 ex:author rdf:type rdf:Property . 314 314 ex:author rdfs:domain ex:Book . 315 316 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.315 }}} 316 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. 317 317 318 318 A property with 2 domains (in RDFs this is a nonsense example!!): 319 319 {{{ 320 320 exterms:weight rdfs:domain ex:Book . 321 321 exterms:weight rdfs:domain ex:MotorVehicle . 322 322 }}} 323 323 RDF/XML notation (to be added to Classes example above): 324 324 {{{ 325 325 <rdf:Property rdf:ID="registeredTo"> 326 326 <rdfs:domain rdf:resource="#MotorVehicle"/> … … 336 336 337 337 <rdfs:Datatype rdf:about="&xsd;integer"/> 338 338 }}} 339 339 === Subproperty === 340 340 … … 342 342 343 343 Describing a subproperty (example): 344 344 {{{ 345 345 ex:driver rdf:type rdf:Property . 346 346 ex:primaryDriver rdf:type rdf:Property . 347 347 ex:primaryDriver rdfs:subPropertyOf ex:driver . 348 348 }}} 349 349 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`. 350 350 351 351 All RDF Schema `rdfs:range` and `rdfs:domain` properties that apply to an RDF property also apply to each of its subproperties. 352 352 {{{ 353 353 RDF/XML notation (to be added to Classes example above): 354 354 … … 360 360 <rdfs:subPropertyOf rdf:resource="#driver"/> 361 361 </rdf:Property> 362 362 }}} 363 363 364 364 == Describing an instance (complex example) == 365 365 {{{ 366 366 <?xml version="1.0"?> 367 367 <!DOCTYPE rdf:RDF [<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#">]> … … 376 376 </ex:PassengerVehicle> 377 377 </rdf:RDF> 378 379 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 `<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).378 }}} 379 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 `<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 380 381 381 … … 383 383 = Dublin Core Metadata Initiative (DCMI) = 384 384 385 <http://dublincore.org/> 385 http://dublincore.org/ 386 386 387 387 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. 388 388 389 389 The four currently approved DCMI namespace URIs are: 390 390 {{{ 391 391 http://purl.org/dc/terms/ All DCMI properties, classes and encoding schemes 392 http://purl.org/dc/dcmitype/ 392 http://purl.org/dc/dcmitype/ Classes in the DCMI Type Vocabulary 393 393 http://purl.org/dc/dcam/ Terms used in the DCMI Abstract Model 394 394 http://purl.org/dc/elements/1.1/ The Dublin Core Metadata Element Set, Version 1.1 (original 15 elements) 395 }}}