• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Semantic Web - RDF
 

Semantic Web - RDF

on

  • 545 views

 

Statistics

Views

Total Views
545
Views on SlideShare
545
Embed Views
0

Actions

Likes
4
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Semantic Web - RDF Semantic Web - RDF Presentation Transcript

    • Faculty of Science, Technology and Communication (FSTC) Bachelor en informatique (professionnel) Semantic Web Unit 4: RDF and RDF Schema Rules Data Trust Data Proof Ontology vocabula ry RDF + RD F Schem a Digital Signature Logic XML + N amespac es + XML Schema •URI •Unicode Semantic Web ::: Serge Linckels, 2013 ::: www.linckels.lu ::: serge@linckels.lu ::: 1
    • 4. RDF and RDF Schema Semantic Web Roadmap: Controlled growth bottom up according to this architecture. Architecture was (slightly) modified in the last years. Semantic Web ::: Serge Linckels, 2013 ::: www.linckels.lu ::: serge@linckels.lu ::: 2
    • 4. RDF and RDF Schema 4.1. Why is XML not Sufficient? 4.2. RDF Specifications 4.3. RDF Schema (RDFS) 4.4. SPARQL – RDF Query Language 4.5. Sharing Vocabulary in RDF 4.6. Jena – RDF in Java 4.7. References Semantic Web ::: Serge Linckels, 2013 ::: www.linckels.lu ::: serge@linckels.lu ::: 3
    • 4. RDF and RDF Schema 4.1. Why is XML not Sufficient? Level of knowledge representation and semantics OWL domain knowledge, interconnections RDF / RDF Schema knowledge about objects, relations between objects XML / XML Schema objects, structure Semantic Web ::: Serge Linckels, 2013 ::: www.linckels.lu ::: serge@linckels.lu ::: 4
    • 4. RDF and RDF Schema 4.1. Why is XML not Sufficient? ? Problem 1: missing relational expressivity Christoph Meinel Viola Brehmer Long Wang Feng Cheng Dirk Cordel Serge Linckels Harald Sack What is the relation between a "Professor", a "Secretary" and a "PhDStudent"? XML document <ChairMeinel> <Professor> <FirstName>Christoph</FirstName> <LastName>Meinel</LastName> </Professor> <Secretary>Viola Brehmer</Secretary> <PhDStudent>Long Wang</PhDStudent> <PhDStudent>Feng Cheng</PhDStudent> <PhDStudent>Dirk Cordel</PhDStudent> <PhDStudent>Serge Linckels</PhDStudent> <FormerPhDStudent>Harald Sack</FormerPhDStudent> </ChairMeinel> We need a more powerful formalism above XML to describe relations between objects Semantic Web ::: Serge Linckels, 2013 ::: www.linckels.lu ::: serge@linckels.lu ::: 5
    • 4. RDF and RDF Schema 4.1. Why is XML not Sufficient? Problem 2: missing relational expressivity XML document 2 XML document 1 <phonenumber> <owner>Serge Linckels</owner> <number>++352-691-123456</number> </phonenumber> ? <person> <name>Serge Linckels</name> <phone>++352-691-123456</phone> </person> XML document 3 <person name="Serge Linckels" phone="++352-691-123456" /> Are all three documents equivalent? Do they represent the same information? Solving this kind of problem requires a matching of all 3 documents and their according DTD / XML Schema, e.g., with XSLT. This reengineering is difficult, complex and can be avoided. We need a more powerful formalism above XML to describe objects with a shared vocabulary Semantic Web ::: Serge Linckels, 2013 ::: www.linckels.lu ::: serge@linckels.lu ::: 6
    • 4. RDF and RDF Schema 4.2. RDF Specifications RDF overview Resource Description Framework RDF allows to describe resources in a more expressive way than XML RDF can be serialized as XML (or in other formats) The syntax of a RDF document can be described in a RDF Schema RDF documents can be queried using optimized query languages, e.g., SPARQL Semantic Web ::: Serge Linckels, 2013 ::: www.linckels.lu ::: serge@linckels.lu ::: 7
    • 4. RDF and RDF Schema 4.2. RDF Specifications RDF standard W3C recommendation Make statements (assertions) about resources, e.g., "Serge Linckels is a teacher. He teaches RDF." The object "Serge Linckels" has a property "hasJob" that has the value "teacher" Statement 1 The object "Serge Linckels" has a property "toTeach" that has the value "RDF" Statement 2 RDF statement A RDF statement is a "triple": resource – property – value Serge Linckels Subject Resource hasJob Predicate Property teacher Object Value Semantic Web ::: Serge Linckels, 2013 ::: www.linckels.lu ::: serge@linckels.lu ::: English RDF 8
    • 4. RDF and RDF Schema 4.2. RDF Specifications RDF graph RDF statements are represented as directed and labeled graphs, where each resource is represented as a node Each resource is identified by a URI hasJob teacher http://www.linckels.lu/ toTeach RDF RDF serialization RDF graphs can be serialized in different formats, e.g., as XML <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:myNS="http://www.linckels.lu/myNS/"> <rdf:Description rdf:about="http://www.linckels.lu/"> <myNS:hasJob>teacher</myNS:hasJob> <myNS:toTeach>RDF</myNS:toTeach> </rdf:Description> </rdf:RDF> Semantic Web ::: Serge Linckels, 2013 ::: www.linckels.lu ::: serge@linckels.lu ::: 9
    • 4. RDF and RDF Schema 4.2. RDF Specifications RDF validation RDF graphs can be validated with "a validator", e.g., http://www.w3.org/RDF/Validator/ Semantic Web ::: Serge Linckels, 2013 ::: www.linckels.lu ::: serge@linckels.lu ::: 10
    • 4. RDF and RDF Schema 4.2. RDF Specifications More about objects An RDF object can be a literal Serge Linckels hasJob teacher is a literal An RDF object can be a resource Serge Linckels worksWith Denis Zampuniéris is a resource <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:myNS="http://www.linckels.lu/myNS/"> <rdf:Description rdf:about="http://www.linckels.lu/"> <myNS:hasJob>teacher</myNS:hasJob> <myNS:worksWith rdf:resource="http://www.zampunieris.be" /> </rdf:Description> </rdf:RDF> Semantic Web ::: Serge Linckels, 2013 ::: www.linckels.lu ::: serge@linckels.lu ::: 11
    • 4. RDF and RDF Schema 4.2. RDF Specifications Example – RDF graph hasTitle ISBN: 2-495-10604-8 hasAutho r s ork w http://www.linckels.lu/ li k th Wi es To R Les Générations Pascal hasJob professor ea d http://www.zampunieris.be hasJob hasName toTeach hasName Denis Zampuniéris teacher Serge Linckels RDF Semantic Web ::: Serge Linckels, 2013 ::: www.linckels.lu ::: serge@linckels.lu ::: 12
    • 4. RDF and RDF Schema 4.2. RDF Specifications Example – XML serialization <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:myNS="http://www.linckels.lu/myNS/"> <rdf:Description rdf:about="http://www.linckels.lu/"> <myNS:hasJob>teacher</myNS:hasJob> <myNS:hasName>Serge Linckels</myNS:hasName> <myNS:toTeach>RDF</myNS:toTeach> <myNS:worksWith rdf:resource="http://www.zampunieris.be/" /> </rdf:Description> Related elements <rdf:Description rdf:about="http://www.zampunieris.be/"> must not be nested <myNS:hasJob>professor</myNS:hasJob> within the elements <myNS:hasName>Denis Zampunieris</myNS:hasName> they are related to <myNS:likesToRead rdf:resource="ISBN: 2-495-10604-8" /> </rdf:Description> <rdf:Description rdf:about="ISBN: 2-495-10604-8"> <myNS:hasTitle>Les Générations Pascal</myNS:hasTitle> <myNS:hasAuthor rdf:resource="http://www.linckels.lu/" /> </rdf:Description> </rdf:RDF> Semantic Web ::: Serge Linckels, 2013 ::: www.linckels.lu ::: serge@linckels.lu ::: 13
    • 4. RDF and RDF Schema 4.2. RDF Specifications RDF directed graph – 3 types of nodes hasJob uriref node http://www.linckels.lu/ fullname teacher first last blank node literal Serge Linckels <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:myNS="http://www.linckels.lu/myNS/"> <rdf:Description rdf:about="http://www.linckels.lu/"> <myNS:fullname> <rdf:Description> <myNS:first>Serge</myNS:first> <myNS:last>Linckels</myNS:last> </rdf:Description> </myNS:fullname> <myNS:hasJob>teacher</myNS:hasJob> <myNS:toTeach>RDF</myNS:toTeach> </rdf:Description> </rdf:RDF> Semantic Web ::: Serge Linckels, 2013 ::: www.linckels.lu ::: serge@linckels.lu ::: 14
    • 4. RDF and RDF Schema 4.2. RDF Specifications RDF type attribute rdf:type explicitly specifies the type of a resource The following two examples are equivalent <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:myNS="http://www.linckels.lu/myNS/"> <rdf:Description rdf:about="http://www.linckels.lu/"> <myNS:hasName>Serge Linckels</myNS:hasName> <myNS:hasJob>teacher</myNS:hasJob> <myNS:toTeach>RDF</myNS:toTeach> <rdf:type rdf:resource="http://www.linckels.lu/myNS/Person" /> </rdf:Description> </rdf:RDF> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:myNS="http://www.linckels.lu/myNS/"> <myNS:Person rdf:about="http://www.linckels.lu/"> <myNS:hasName>Serge Linckels</myNS:hasName> <myNS:hasJob>teacher</myNS:hasJob> <myNS:toTeach>RDF</myNS:toTeach> </myNS:Person> </rdf:RDF> Semantic Web ::: Serge Linckels, 2013 ::: www.linckels.lu ::: serge@linckels.lu ::: 15
    • 4. RDF and RDF Schema 4.2. RDF Specifications RDF datatypes rdf:datatype explicitly specifies the type of a literal No implicit semantics are attached to typed literals <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:myNS="http://www.linckels.lu/myNS/" xmlns:xsd="http://www.w3.org/2001/XMLSchema#"> <myNS:Person rdf:about="http://www.linckels.lu/"> <myNS:hasName rdf:datatype="xsd:string">Serge Linckels</myNS:hasName> <myNS:luckyNumber rdf:datatype="xsd:integer">12</myNS:luckyNumber> </myNS:Person> </rdf:RDF> Semantic Web ::: Serge Linckels, 2013 ::: www.linckels.lu ::: serge@linckels.lu ::: 16
    • 4. RDF and RDF Schema 4.2. RDF Specifications RDF containers - example hasName http://www.linckels.lu/ hasH obbie s Serge Linckels _1 _2 rdf:Bag Aviation Taekwondo <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:myNS="http://www.linckels.lu/myNS/"> <rdf:Description rdf:about="http://www.linckels.lu/"> <myNS:hasHobbies> <rdf:Bag> <rdf:li>Aviation</rdf:li> <rdf:li>Taekwondo</rdf:li> </rdf:Bag> </myNS:hasHobbies> <myNS:hasName>Serge Linckels</myNS:hasName> </rdf:Description> </rdf:RDF> Semantic Web ::: Serge Linckels, 2013 ::: www.linckels.lu ::: serge@linckels.lu ::: 17
    • 4. RDF and RDF Schema 4.2. RDF Specifications RDF containers - overview rdf:Bag – containing unordered lists of resources or literals, with duplicate data allowed rdf:Seq – containing ordered lists of resources or literals, with duplicate data allowed rdf:Alt – containing resources or literals that represent possible alternatives for a specific value RDF collections - overview Unlike a container, a collection is a finite grouping of resources or literals <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:myNS="http://www.linckels.lu/myNS/"> <rdf:Description rdf:about="http://www.linckels.lu/"> <myNS:hasFriends rdf:parseType="Collection"> <rdf:Description rdf:about="http://www.toto.lu" /> <rdf:Description rdf:about="http://www.titi.lu" /> <rdf:Description rdf:about="http://www.tata.lu" /> </myNS:hasFriends> <myNS:hasName>Serge Linckels</myNS:hasName> </rdf:Description> </rdf:RDF> Semantic Web ::: Serge Linckels, 2013 ::: www.linckels.lu ::: serge@linckels.lu ::: 18
    • 4. RDF and RDF Schema 4.2. RDF Specifications RDF lists hasName http://www.linckels.lu/ hasF r A list is a terminated sequence of items Traversing a list becomes a matter of finding the start node and then accessing the next predicates for that node iend Serge Linckels rdf:first s rdf:list http://www.toto.lu/ rdf:rest rdf:first http://www.titi.lu/ rdf:rest rdf:first http://www.tata.lu/ rdf:rest rdf:nil Semantic Web ::: Serge Linckels, 2013 ::: www.linckels.lu ::: serge@linckels.lu ::: 19
    • 4. RDF and RDF Schema 4.2. RDF Specifications RDF lists <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:myNS="http://www.linckels.lu/myNS/"> <rdf:Description rdf:about="http://www.linckels.lu/"> <myNS:hasFriends> <rdf:List> <rdf:first rdf:resource="http://www.toto.lu" /> <rdf:rest> <rdf:List> <rdf:first rdf:resource="http://www.titi.lu" /> <rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/> </rdf:List> </rdf:rest> </rdf:List> </myNS:hasFriends> <myNS:hasName>Serge Linckels</myNS:hasName> </rdf:Description> </rdf:RDF> Semantic Web ::: Serge Linckels, 2013 ::: www.linckels.lu ::: serge@linckels.lu ::: 20
    • 4. RDF and RDF Schema 4.2. RDF Specifications Reification Reification is a method of formally modeling a statement about another statement This lemon Serge Linckels says rdf:Statement are sweet <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:myNS="http://www.linckels.lu/myNS/"> <rdf:Description rdf:about="http://www.linckels.lu/"> <myNS:says rdf:resource="#myStatement" /> identification of </rdf:Description> the statement <rdf:Statement rdf:about="#myStatement"> <rdf:subject rdf:resource="http://www.lemon123.lu" /> <rdf:predicate rdf:resource="myNS:are" /> <rdf:object>sweet</rdf:object> </rdf:Statement> </rdf:RDF> Semantic Web ::: Serge Linckels, 2013 ::: www.linckels.lu ::: serge@linckels.lu ::: 21
    • 4. RDF and RDF Schema 4.2. RDF Specifications Reification – problem Reification is always an subjective view and can cause ambiguities Who do you believe? Serge Linckels says Denis Zampunieris rdf:Statement This lemon are sweet says are bitter rdf:Statement Semantic Web ::: Serge Linckels, 2013 ::: www.linckels.lu ::: serge@linckels.lu ::: 22
    • 4. RDF and RDF Schema 4.2. RDF Specifications Reification is useful Useful to formally express trust Create metadata over assertions (assertion ≠ fact) Serge Linckels Who do you believe? says A. Einstein D. Zampunieris O. Hahn π sa ys says says hasValue 1.61803 hasValue M. Planck sa ys 3.14159 Semantic Web ::: Serge Linckels, 2013 ::: www.linckels.lu ::: serge@linckels.lu ::: 23
    • 4. RDF and RDF Schema 4.2. RDF Specifications RDF helps to make semantic relations between databases Relations between distinct databases can made explicit  same URI = same resources Data can be integrated (from one database into another)  same URI, same vocabulary Database 2 Database 1 Ministère de l'Éducation Nationale hasName http://www.myschool.lu ISBN: 2-495-10604-8 hasAuthor e hasProject publishedBy i tl sT ha http://www.men.lu http://www.men.lu Les Générations Pascal http://www.linckels.lu/ Semantic Web ::: Serge Linckels, 2013 ::: www.linckels.lu ::: serge@linckels.lu ::: 24
    • 4. RDF and RDF Schema 4.2. RDF Specifications RDF helps to make semantic relations between databases Relations between distinct databases can made explicit  same URI = same resources Data can be integrated (from one database into another)  same URI, same vocabulary Ministère de l'Éducation Nationale Les Générations Pascal hasName http://www.men.lu hasProject http://www.myschool.lu hasTitle publishedBy ISBN: 2-495-10604-8 hasAuthor http://www.linckels.lu/ Semantic Web ::: Serge Linckels, 2013 ::: www.linckels.lu ::: serge@linckels.lu ::: 25
    • 4. RDF and RDF Schema 4.3. RDF Schema (RDFS) RDFS overview RDFS specifies: - how RDF constructs relate to each other - how RDF constructs can be diagrammed in XML RDFS is a rules-based dictionary that: - defines the elements of importance to a domain - describes how these elements relate to one another RDF is a way of describing data RDFS is a domain-neutral way of describing the metadata that can be used to describe the data for domain-specific vocabulary RDFS allows to define: - abstract datatypes (classes) - hierarchically structure the datamodel - properties and relations (e.g., inheritance) Semantic Web ::: Serge Linckels, 2013 ::: www.linckels.lu ::: serge@linckels.lu ::: 26
    • 4. RDF and RDF Schema 4.3. RDF Schema (RDFS) RDFS – defining classes rdfs:Resource rdfs:class – definition of a new class that inherits from the super class specified in rdfs:subClassOf rdfs:Resource is the RDFS top-class rdf:Property – definition of a new property of a class specified in rdfs:domain myNS:Person fullname Example: <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"> <rdfs:class rdf:about="http://www.linckels.lu/myNS/Person"> <rdfs:subClassOf rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Resource" /> </rdfs:class> <rdf:Property rdf:about="http://www.linckels.lu/myNS/fullname"> <rdfs:domain rdf:resource="http://www.linckels.lu/myNS/Person" /> </rdf:Property> </rdf:RDF> Semantic Web ::: Serge Linckels, 2013 ::: www.linckels.lu ::: serge@linckels.lu ::: 27
    • 4. RDF and RDF Schema 4.3. RDF Schema (RDFS) RDFS – defining a instance of a class <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:myNS="http://www.linckels.lu/myNS/"> <rdfs:class rdf:about="http://www.linckels.lu/myNS/Person"> <rdfs:subClassOf rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Resource" /> </rdfs:class> <rdf:Property rdf:about="http://www.linckels.lu/myNS/fullname"> <rdfs:domain rdf:resource="http://www.linckels.lu/myNS/Person" /> </rdf:Property> <myNS:Person rdf:about="http://www.linckels.lu/"> <myNS:fullname>Serge Linckels</myNS:fullname> </myNS:Person> </rdf:RDF> = <rdf:Description rdf:about="http://www.linckels.lu/"> <myNS:fullname>Serge Linckels</myNS:fullname> <rdf:type rdf:resource="http://www.linckels.lu/myNS/Person" /> </rdf:Description> Semantic Web ::: Serge Linckels, 2013 ::: www.linckels.lu ::: serge@linckels.lu ::: 28
    • 4. RDF and RDF Schema 4.3. RDF Schema (RDFS) RDFS – defining relations and restrictions rdfs:Resource rdfs:range – specifies the classes the property can reference as values This mechanism allows to define basic relations between classes and to define datatypes for property values ! A validator checks only the syntax, not if the values for properties are correct. This task must be assumed by the application. myNS:Firm myNS:Person worksFor age <rdf:Property rdf:about="http://www.linckels.lu/myNS/worksFor"> <rdfs:domain rdf:resource="http://www.linckels.lu/myNS/Person" /> <rdfs:range rdf:resource="http://www.linckels.lu/myNS/Firm" /> </rdf:Property> <rdf:Property rdf:about="http://www.linckels.lu/myNS/age"> <rdfs:domain rdf:resource="http://www.linckels.lu/myNS/Person" /> <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#integer" /> </rdf:Property> Semantic Web ::: Serge Linckels, 2013 ::: www.linckels.lu ::: serge@linckels.lu ::: 29
    • 4. RDF and RDF Schema 4.3. RDF Schema (RDFS) RDFS – other elements rdfs:label – provides a (human) readable version the resource's name rdfs:Literal - defines a node as being a literal value, not a resource rdfs:Comment – defines a comment rdfs:Container – superclass of all RDF container elements (rdf:Bag, rdf:Seq and rdf:Alt) rdfs:member – superproperty for each numbered container element (e.g., _1, _2, etc.) rdfs:subPropertyOf – specifies a property as a refinement of another property rdfs:seeAlso – identifies another resource that contains additional information rdfs:isDefinedBy – identifies the namespace for the resource, preventing any ambiguity Semantic Web ::: Serge Linckels, 2013 ::: www.linckels.lu ::: serge@linckels.lu ::: 30
    • 4. RDF and RDF Schema 4.4. SPARQL – RDF Query Language RDF query languages – overview There exists multiple languages to query RDF data: ARQ, RDQL, N3QL, RQL, SPARQL, SeRQL, Versa, XUL, Adenine, RDQ, N3QL… SPARQL (SPARQL Protocol and RDF Query Language) was standardized in January 2008 by the W3C "SQL like" syntax to query RDF data as triples Example: "show me all firms that have employees" @prefix myNS: <http://www.linckels.lu/myNS#> SELECT DISTINCT ?X FROM <http://www.linckels.lu/myRDF-file.rdf> WHERE { myNS:Person myNS:worksFor ?X . } triple Complex filtering is possible, e.g., - string operations - conjunctions and disjunctions of logical tests - datatype checking Semantic Web ::: Serge Linckels, 2013 ::: www.linckels.lu ::: serge@linckels.lu ::: 31
    • 4. RDF and RDF Schema 4.4. SPARQL – RDF Query Language RDF query languages – overview Example: "show me all persons and the firms they work for, who are between 31 and 40 in age" @prefix myNS: <http://www.linckels.lu/myNS#> @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> SELECT ?person ?firm FROM <http://www.linckels.lu/myRDF-file.rdf> WHERE { ?person rdf:type myNS:Person . ?person myNS:worksFor ?firm . ?firm rdf:type myNS:Firm . ?person myNS:age ?age . FILTER (?age > 30) . FILTER (?age <= 40) . } Semantic Web ::: Serge Linckels, 2013 ::: www.linckels.lu ::: serge@linckels.lu ::: 32
    • 4. RDF and RDF Schema 4.5. Sharing Vocabulary in RDF Problem with not identical predicates ISBN: 2-495-10604-8 ISBN: 2-495-10604-8 hasTitle avoirTitre Les Générations Pascal =? Les Générations Pascal - Resources are equal because same URI - Objects are equal because same value  are both predicates equal ? Use (as far as possible) existing vocabulary for predicates, or share your own vocabulary with others Examples: Dublin Core (DC), Friend of a Friend (FOAF) Semantic Web ::: Serge Linckels, 2013 ::: www.linckels.lu ::: serge@linckels.lu ::: 33
    • 4. RDF and RDF Schema 4.5. Sharing Vocabulary in RDF Dublin Core (DC) DC metadata element set is a standard for cross-domain information resource description Provides a simple and standardized set of conventions for describing resources DC is widely used to describe digital materials such as video, sound, image, text, and composite media like web pages DC is controlled by Dublin Core Metadata Initiative (DCMI), an organization providing an open forum for the development of interoperable online metadata standards Dublin Core is defined by NISO Standard Z39.85-2007 http://dublincore.org/ ISBN: 2-495-10604-8 dc:title Les Générations Pascal Semantic Web ::: Serge Linckels, 2013 ::: www.linckels.lu ::: serge@linckels.lu ::: 34
    • 4. RDF and RDF Schema 4.5. Sharing Vocabulary in RDF Dublin Core (DC) Simple Dublin Core Metadata Element Set (DCMES) consists of 15 metadata elements title creator subject description publisher contributor date type format identifier source language relation coverage rights : : : : : : : : : : : : : : : a name given to a resource an entity responsible for making the content of the resource the topic of the content of the resource an account of the content of the resource an entity responsible for making the content available an entity responsible for making contributions to the content of the resource a date associated with an event in the life cycle of the resource the nature or genre of the content of the resource the physical or digital manifestation of the resource an unambiguous reference to the resource within a given context a reference to the resource from which the present resource is derived a language of the intellectual content of the resource a reference to a related resource the extent or scope of the content of the resource information about rights held in and over the resource Qualified Dublin Core Metadata Element Set (QDCME) includes three additional elements (audience, provenance and rightsholder), as well as a group of element refinements Semantic Web ::: Serge Linckels, 2013 ::: www.linckels.lu ::: serge@linckels.lu ::: 35
    • 4. RDF and RDF Schema 4.5. Sharing Vocabulary in RDF Friend of a Friend (FOAF) FOAF is a way to describe people and relationships to computers; it is a vocabulary http://www.foaf-project.org/ Agent Person name nick title homepage mbox mbox_sha1sum img depiction surname family_name givenname firstName FOAF Basics weblog knows interest currentProject pastProject plan based_near workplaceHomepage workInfoHomepage schoolHomepage topic_interest publications geekcode myersBriggs dnaChecksum OnlineAccount OnlineChatAccount OnlineEcommerceAccount OnlineGamingAccount holdsAccount accountServiceHomepage accountName icqChatID msnChatID aimChatID jabberID yahooChatID Document Image PersonalProfileDocument topic (page) primaryTopic tipjar sha1 made (maker) thumbnail logo Online Accounts Personal Info Documents & Images Semantic Web ::: Serge Linckels, 2013 ::: www.linckels.lu ::: serge@linckels.lu ::: Projects & Groups Project Organization Group member membershipClass fundedBy theme 36
    • 4. RDF and RDF Schema 4.5. Sharing Vocabulary in RDF Mixing Vocabularies ISBN: 2-495-10604-8 dc:creator http://www.linckels.lu/ dc:title am foaf:n e myNS:toTeach Les Générations Pascal Serge Linckels RDF <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:myNS="http://www.linckels.lu/myNS/"> <myNS:Person rdf:about="http://www.linckels.lu/"> <foaf:name>Serge Linckels</foaf:name> <myNS:toTeach>RDF</myNS:toTeach> </myNS:Person> <rdf:Description rdf:about="ISBN: 2-495-10604-8"> <dc:title>Les Générations Pascal</dc:title> <dc:creator rdf:resource="http://www.linckels.lu/" /> </rdf:Description> </rdf:RDF> Semantic Web ::: Serge Linckels, 2013 ::: www.linckels.lu ::: serge@linckels.lu ::: 37
    • 4. RDF and RDF Schema 4.6. Jena – RDF in Java Jena – overview Jena is a Java framework for building Semantic Web applications Jena provides a programmatic environment for RDF, RDFS, OWL and SPARQL Jena is open source and grown out of work with the HP Labs Semantic Web Programme http://jena.sourceforge.net/ Semantic Web ::: Serge Linckels, 2013 ::: www.linckels.lu ::: serge@linckels.lu ::: 38
    • 4. RDF and RDF Schema 4.6. Jena – RDF in Java Jena – example: creating a resource import com.hp.hpl.jena.mem.ModelMem; import com.hp.hpl.jena.rdf.model.*; static String myDemo= "http://www.linckels.lu/"; static String myNS = " http://www.linckels.lu/myNS"; // create an empty graph Model myModel = new ModelMem(); // create the resource Resource myResource = myModel.createResource(myDemo); // create the predicate (property) Property fullname = myModel.createProperty(myNS,"fullname"); // add the property with associated value (object) myResource.addProperty(fullname, "Serge Linckels"); // print RDF/XML of model to system out myModel.write(new PrintWriter(System.out)); Semantic Web ::: Serge Linckels, 2013 ::: www.linckels.lu ::: serge@linckels.lu ::: 39
    • 4. RDF and RDF Schema 4.6. Jena – RDF in Java Jena – example: browsing through a graph // using a statement iterator StmtIterator iter = myModel.listStatements(); while (iter.hasNext()) { // read a statement (resource, predicate, object) Statement stmt = iter.next(); // identify resource Resource subject = stmt.getSubject(); // identify predicate Property predicate = stmt.getPredicate(); // identify object RDFNode object = stmt.getObject(); // output System.out.print("("+predicate.toString()+","); System.out.print(subject.toString()+","); System.out.println(object.toString()+")"); } Semantic Web ::: Serge Linckels, 2013 ::: www.linckels.lu ::: serge@linckels.lu ::: 40
    • 4. RDF and RDF Schema 4.6. Jena – RDF in Java Jena – example: read and write a file String filename = "myFile.rdf"; // creating a model Model myModel = new ModelMem(); // read a file Model.read(new FileReader(filename)); // write a file Model.write(new PrintWriter(System.out)); Jena – example: creating a container Bag bag = myModel.createBag(); bag.add("Romeo and Juliet") bag.add("Hamlet") bag.add("Othello"); NodeIterator iter = bag.iterator(); while (iter.hasNext()) { System.out.println(" " + iter.next().toString()); } Semantic Web ::: Serge Linckels, 2013 ::: www.linckels.lu ::: serge@linckels.lu ::: 41
    • 4. RDF and RDF Schema 4.7. References E-Librarian Service User-Friendly Semantic Search in Digital Libraries Serge Linckels, Christoph Meinel Creating the Semantic Web with RDF: Professional Developer's Guide Johan Hjelm Practical RDF Shelley Powers Semantic Web ::: Serge Linckels, 2013 ::: www.linckels.lu ::: serge@linckels.lu ::: 42
    • 4. RDF and RDF Schema 4.7. References A Semantic Web Primer (Cooperative Information Systems) Grigoris Antoniou , Frank van Harmelen Semantic Web: Concepts, Technologies and Applications K.K. Breitman, M.A. Casanova, W. Truszkowski Foundations of Semantic Web Technologies Pascal Hitzler, Markus Krötzsch, Sebastian Rudolph Semantic Web ::: Serge Linckels, 2013 ::: www.linckels.lu ::: serge@linckels.lu ::: 43