1 MASWS XML, RDF and RDFS Contents 2 RDF In
Total Page:16
File Type:pdf, Size:1020Kb
1 MASWS XML, RDF and RDFS Contents 1 Outline 1 2 RDF in XML 1 2.1 Tree-based View . 1 3 RDFS 4 4 Summary 6 2 RDF in XML 2.1 Tree-based View Document Trees Again, 1 • As before, we can represent XML documents as trees. • An example from last lecture: Example XML Document <film> <title lang="en">Seven Samurai</title> <title lang="ja">Shichinin no samurai</title> <director>Akira Kurosawa</director> <date>1954</date> </film> Document Trees Again, 1 • Elements are represented as nodes. • So are Attributes and Text items! Element: title Element: film Element: title Element: date Attr: lang Text: "en" Element: title Text: "Seven Samurai" Attr: lang Text: "ja" Element: film Element: title Text: "Shichinin no samurai" Element: date Text: "1954" RDF Triples as XML Trees, 1 • RDF Triples are encoded as rdf:Description elements. RDF Triple with literal Object edstaff:104599 foaf:name ‘Jacques Fleuriot’ RDF Triples as XML Trees, 2 RDF Triples with resource Object infcourses:masws dc:creator edstaff:104599 RDF Triples as XML Trees, 3 • RDF Triples are serialized as rdf:Description elements. • The Subject is the value of the rdf:about attribute on rdf:Description. • The Predicate becomes a child element of rdf:Description. • Objects: – Literal Objects are text content of the ‘Predicate’ element. – Resource Objects are values of the rdf:resource attribute of the ‘Predicate’ element. – URIs have to be written out in full (no Qnames) when they are attribute values. 2 RDF Triples as XML Trees, 4 RDF Triple with literal Object edstaff:104599 foaf:name ‘Jacques Fleuriot’ Linear version <rdf:Description rdf:about="http://...#104599"> <foaf:name>Jacques Fleuriot</foaf:name> </rdf:Description> RDF Triples as XML Trees, 5 RDF Triples with resource Object infcourses:masws dc:creator edstaff:104599 Linear version <rdf:Description rdf:about="http://.../masws"> <dc:creator rdf:resource="http://...#104599"/> </rdf:Description> Abbreviating Multiple Properties RDF Triples with shared Subject edstaff:104599 foaf:name ’Jacques Fleuriot’ edstaff:104599 foaf:homepage http://.../~jdf/ Linear version <rdf:Description rdf:about="http://...#104599"> <foaf:name>Jacques Fleuriot</foaf:name> </rdf:Description> <rdf:Description rdf:about="http://...#104599"> <foaf:homepage rdf:resource="http://.../~jdf/> </rdf:Description> Linear version 3 <rdf:Description rdf:about="http://...#104599"> <foaf:name>Jacques Fleuriot</foaf:name> <foaf:homepage rdf:resource="http://.../~jdf/> </rdf:Description> Blank Nodes mailto:[email protected] foaf:mailbox http://.../~kim dc:creator foaf:name 'Kim' XML version of blank node <rdf:Description rdf:about="http://.../~kim"> <dc:creator rdf:nodeID="abc"/> </rdf:Description> <rdf:Description rdf:nodeID="abc"> <foaf:mailbox rdf:resource="mailto:[email protected]> <foaf:name>Kim</foaf:name> </rdf:Description> 3 RDFS RDF Schema • RDFS is a vocabulary description language for RDF. – Acts as a semantic extension of RDF. • RDFS defines classes and properties that may be used to describe classes, properties and other re- sources. • RDFS is similar to the type systems of object-oriented programming languages (e.g. Java). – But it describes properties in terms of the classes of resource to which they apply (through the use of domain and range mechanisms). Ontologies Again • Recall isa and io links from the ontology lecture. 4 Classes and Instances Declaring Classes terms:Giraffe rdf:type rdfs:Class terms:Herbivore rdf:type rdfs:Class Giraffe and Herbivore are classes. Instances myzoo:gerome rdf:type terms:Giraffe jerome is a member of (io) Giraffe. Subclasses terms:Giraffe rdfs:subClassOf terms:Herbivore Giraffe is a subclass of (isa) Herbivore. Properties Subclasses terms:eats rdf:type rdf:Property eats is a property. Range terms:eats rdfs:range terms:Plant The values of eats are instances of Plant. Domain terms:eats rdfs:domain terms:Animal The subjects of eats are instances of Animal. RDF and RDFS Properties 5 4 Summary Summary • RDF Schema (RDFS) provides mechanisms for describing (simple) ontologies. • RDFS build on top of RDF, using rdf:type. • Provides – Class, subClassOf – Property, subPropertyOf – domain, range • Classes are primitives, not defined in terms of necessary and sufficient properties. Reading • Walton, Section 2.2; • RDF Vocabulary Description Language 1.0: RDF Schema (http://www.w3.org/TR/rdf-schema). 6.