100 likes | 114 Views
Learn about compound property values in RDF, including literals, resources, containers, collections, and qualified property values. Discover how to parse compound values, stripe syntax, and create RDF/XML statements efficiently.
E N D
8.3.7 Compound Property Values • Property values can be • Literals • Resource • Container • Collection, or… • Compound Value • Compound Value • Has multiple value parts • 1 part identified as primary value of the property • Lets properties describe “n-ary” relationships
8.3.7.1.1 Resource Parse Type • rdf:parseType="Resource" • Tells parser to interpret the contained value as a an “in-line” resource • Identifies a compound value
8.3.7.1.2 Qualified Property Value • rdf:value property • Identifies primary value within compound property value • Called the qualified property value • Can be a literal or a resource • Not required, but available • Other properties describe qualified property value • Example • <rdf:Description rdf:about="&kor;Menu/Dessert#applePie"> <price rdf:parseType="Resource"> <rdf:value>2.5</rdf:value> <menu:currency>USD</menu:currency> </price></rdf:Description>
Units ExampleXML and Graph Exproduct:item10245 exterms:weight 2.4^^xsd:decimal rdf:value N3 Approach: exproduct:item10245 exterms:weight _:weight10245 . _:weight10245 rdf:value "2.4"^^xsd:decimal . _:weight10245 exterms:units exunits:kilograms . RDF/XML: <?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:exterms="http://www.example.org/terms/"> <rdf:Description rdf:about="http://www.example.com/2002/04/products#item10245"> <exterms:weight rdf:parseType="Resource"> <rdf:value rdf:datatype="&xsd;decimal">2.4</rdf:value> <exterms:units rdf:resource="http://www.example.org/units/kilograms"/> </exterms:weight> </rdf:Description> </rdf:RDF> exterms:units Exunits:kilograms
Qualified Property Practices • rdf:parseType="Resource" • attribute is used to indicate that the contents of an element are to be interpreted as the description of a new (blank node) resource • Don’t have to write a nested rdf:Description element • It is generally not safe to make the assumption that anyone accessing a property value will understand the units being used • So rdf:value is a recommended mechanism, alternatives: • Property value with units in name (i.e. weightInKg) • Properties to specify this information off main node (i.e. weightUnits) • …
8.3.8 Striped Syntax • Nesting rdf:Description elements • Chains alternating property/value descriptions • Called “striping” • Creates a blank (anonymous) mode when parsed • Not recommended, because • Easier to read, but • Harder to edit and • More difficult to generate from automated tool • Example • <rdf:Descriptionrdf:about="#KnightOwlRestaurant"> <website> <rdf:Descriptionrdf:about="&kor;"> <webmaster>Jorge Garcia</webmaster> </rdf:Description> <website></rdf:description>
8.3.9 RDF Description Summary • RDF/XML statements use rdf:Description • Subject can be either new or existing resource • Properties specify the predicate • Object (property value) can be Literal, Resource, Container, Collection, or Compound Value • Can “stripe” by using an “in-line” statement as the object of a property, but not recommended • RDF/XML statements can usually be automatically generated from databases
8.4 RDF/XML Summary • RDF/XML provides • Structured method for serializing RDF in XML • Mechanism for interchanging RDF content • RDF resources • Declared & described using • rdf:Description element • Properties and property values
8.5 Why RDF/XML is not enough • RDF/XML • Introduces some standardization to descriptions • Cannot describe more complex semantic relationships (especially classes) • Lacks concepts for enumeration and datatypes • RDFS • Adds object-oriented features to RDF