INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 11 (part 2): 04.04.2011 MDI I, Part II: Semantic Web.

Slides:



Advertisements
Similar presentations
CH-4 Ontologies, Querying and Data Integration. Introduction to RDF(S) RDF stands for Resource Description Framework. RDF is a standard for describing.
Advertisements

RDF Schemata (with apologies to the W3C, the plural is not ‘schemas’) CSCI 7818 – Web Technologies 14 November 2001 Van Lepthien.
1 © Copyright 2010 Dieter Fensel, Federico Facca and Ioan Toma Semantic Web Storage and Querying.
CS570 Artificial Intelligence Semantic Web & Ontology 2
RDF Tutorial.
 Copyright 2004 Digital Enterprise Research Institute. All rights reserved. SPARQL Query Language for RDF presented by Cristina Feier.
SPARQL for Querying PML Data Jitin Arora. Overview SPARQL: Query Language for RDF Graphs W3C Recommendation since 15 January 2008 Outline: Basic Concepts.
CSCI 572 Project Presentation Mohsen Taheriyan Semantic Search on FOAF profiles.
Dr. Alexandra I. Cristea RDF.
COMP 6703 eScience Project Semantic Web for Museums Student : Lei Junran Client/Technical Supervisor : Tom Worthington Academic Supervisor : Peter Strazdins.
More RDF CS 431 – Carl Lagoze – Cornell University Acknowledgements: Eric Miller Dieter Fensel.
Chapter 7: Resource Description Framework (RDF) Service-Oriented Computing: Semantics, Processes, Agents – Munindar P. Singh and Michael N. Huhns, Wiley,
RDF: Building Block for the Semantic Web Jim Ellenberger UCCS CS5260 Spring 2011.
Cornell CS 502 Resource Description Framework Building the Semantic Web CS 502 – Carl Lagoze – Cornell University Acknowledgements: Eric Miller.
LDK R Logics for Data and Knowledge Representation Resource Description Framework (RDF) Fausto Giunchiglia and Biswanath Dutta Fall’2011.
Semantic Web Andrejs Lesovskis. Publishing on the Web Making information available without knowing the eventual use; reuse, collaboration; reproduction.
Resource Description Framework (RDF)
Triple Stores.
RDF Semantics by Patrick Hayes W3C Recommendation Presented by Jie Bao RPI Sept 4, 2008 Part 1 of RDF/OWL Semantics Tutorial.
Logics for Data and Knowledge Representation SPARQL Protocol and RDF Query Language (SPARQL) Feroz Farazi.
RDF (Resource Description Framework) Why?. XML XML is a metalanguage that allows users to define markup XML separates content and structure from formatting.
Logics for Data and Knowledge Representation Resource Description Framework (RDF) Feroz Farazi.
Chapter 6 Understanding Each Other CSE 431 – Intelligent Agents.
1 Slides based on Lecture Notes by Dieter Fensel and Federico Facca COMPSCI 732: Semantic Web Technologies Resource Description Framework (RDF)
Logics for Data and Knowledge Representation
The Semantic Web Web Science Systems Development Spring 2015.
© Copyright 2008 STI INNSBRUCK RDF and RDF Schema Semantic Web Lecture Lecture III – xx 2009 Dieter Fensel Slides.
Chapter 9. 9 RDFS (RDF Schema) RDFS Part of the Ontological Primitive layer Adds features to RDF Provides standard vocabulary for describing concepts.
Of 41 lecture 4: rdf – basics and language. of 41 RDF basic ideas the fundamental concepts of RDF  resources  properties  statements ece 720, winter.
Chapter 3 RDF and RDFS Semantics. Introduction RDF has a very simple data model But it is quite liberal in what you can say Semantics can be given using.
Chapter 7: Resource Description Framework (RDF) Service-Oriented Computing: Semantics, Processes, Agents – Munindar P. Singh and Michael N. Huhns, Wiley,
EEL 5937 Ontologies EEL 5937 Multi Agent Systems Lecture 5, Jan 23 th, 2003 Lotzi Bölöni.
RDF & RDF Schema Machine Understandable Metadata for the Web Semantic Web - Spring 2006 Computer Engineering Department Sharif University of Technology.
1 Artificial Intelligence Applications Institute Centre for Intelligent Systems and their Applications Stuart Aitken Artificial Intelligence Applications.
Of 35 lecture 5: rdf schema. of 35 RDF and RDF Schema basic ideas ece 627, winter ‘132 RDF is about graphs – it creates a graph structure to represent.
© Copyright 2008 STI INNSBRUCK Semantic Web Repositories and SPARQL Dieter Fensel Federico Facca.
RDF Schema (RDFS) RDF user communities need to define the vocabularies (terms) to indicate that they  are describing specific kinds or classes of resources.
Introduction The Resource Description Framework (RDF) is recommended by the World Wide Web Consortium (W3C) to model meta-data about the resources of the.
Introduction to the Semantic Web and Linked Data Module 1 - Unit 2 The Semantic Web and Linked Data Concepts 1-1 Library of Congress BIBFRAME Pilot Training.
Understanding RDF. 2/30 What is RDF? Resource Description Framework is an XML-based language to describe resources. A common understanding of a resource.
Chapter 7: Resource Description Framework (RDF) Service-Oriented Computing: Semantics, Processes, Agents – Munindar P. Singh and Michael N. Huhns, Wiley,
User Profiling using Semantic Web Group members: Ashwin Somaiah Asha Stephen Charlie Sudharshan Reddy.
Important Concepts from the W3C RDF Vocabulary/Schema Sungtae Kim SNU OOPSLA Lab. August 19, 2004.
Dr. Bhavani Thuraisingham September 24, 2008 Building Trustworthy Semantic Webs Lecture #9: RDF and RDF Security.
RDF/RDFS Tutorial. Introduction The Resource Description Framework (RDF) is recommended by the World Wide Web Consortium (W3C) to model meta-data about.
Practical RDF Ch.4 Specialized RDF Relationships: Reification, Containers, and Collections Kim, Jong-Nam SNU OOPSLA Lab. August 12, 2004.
Of 38 lecture 6: rdf – axiomatic semantics and query.
EEL 5937 Ontologies EEL 5937 Multi Agent Systems Lotzi Bölöni.
Semantic web course – Computer Engineering Department – Sharif Univ. of Technology – Fall RDF & RDF Schema Machine Understandable Metadata for the.
Knowledge Technologies Manolis Koubarakis 1 Some Other Useful Features of RDF.
Chapter 5 The Semantic Web 1. The Semantic Web  Initiated by Tim Berners-Lee, the inventor of the World Wide Web.  A common framework that allows data.
Other RDF Capabilities. Exercise: Write the following information into a set of statements (triples) and then draw them into and RDF graph The article.
Linked Data & Semantic Web Technology The Semantic Web Part 5. Resource Description Framework (2) Dr. Myungjin Lee.
Semantic Web In Depth Resource Description Framework Dr Nicholas Gibbins –
Linked Data & Semantic Web Technology The Semantic Web Part 7. RDF Semantics Dr. Myungjin Lee.
Semantic Web in Depth RDF Schema Dr Nicholas Gibbins –
Setting the stage: linked data concepts Moving-Away-From-MARC-a-thon.
Linked Data & Semantic Web Technology The Semantic Web Part 4. Resource Description Framework (1) Dr. Myungjin Lee.
OWL (Ontology Web Language and Applications) Maw-Sheng Horng Department of Mathematics and Information Education National Taipei University of Education.
The Semantic Web By: Maulik Parikh.
Storage and Querying Anna Fensel
SPARQL ดร.มารุต บูรณรัช
Introduction to the Semantic Web (tutorial) 2009 Semantic Technology Conference San Jose, California, USA June 15, 2009 Ivan Herman, W3C
Service-Oriented Computing: Semantics, Processes, Agents
Logics for Data and Knowledge Representation
ece 720 intelligent web: ontology and beyond
Chapter 3 RDF and RDFS Semantics
Semantic Web Basics (cont.)
Semantic-Web, Triple-Strores, and SPARQL
Presentation transcript:

INF5120 ”Modellbasert Systemutvikling” ”Modelbased System development” Lecture 11 (part 2): MDI I, Part II: Semantic Web

Agenda Semantic Web Intro RDF, RDFS, and SPARQL Tool support for RDF/RDFS Conclusions

World Wide Web ("WWW" or simply the "Web") “A system of interlinked, hypertext documents that runs over the Internet. With a Web browser, a user views Web pages that may contain text, images, and other multimedia and navigates between them using hyperlinks ” The success of WWW is based on three simple principles: 1. A simple and uniform addressing schema to indentify information chunks i.e. Uniform Resource Identifiers (URIs) 2. A simple and uniform representation formalism to structure information chunks allowing browsers to render them i.e. Hyper Text Markup Language (HTML) 3. A simple and uniform protocol to access information chunks i.e. Hyper Text Transfer Protocol (HTTP) 3

Semantic Web (SW) “An extension of the current web in which information is given well-defined meaning, better enabling computers and people to work in cooperation.” (T. Berners-Lee, J. Hendler, O. Lassila, “The Semantic Web”, Scientific American, May 2001) Semantic Web is about: Web Data Annotation connecting (syntactic) Web objects, like text chunks, images, … to their semantic notion (e.g., this image is about Oslo, Arne J. Berre is a professor) Data Linking on the Web (Web of Data) global networking of knowledge through URI, RDF, and SPARQL (e.g., connecting my calendar with my rss feeds, my pictures,...) Data Integration over the Web seamless integration of data based on different conceptual models (e.g., integrating data coming from my two favorite book sellers) 4

Linked Data A term used to describe a recommended best practice for exposing, sharing, and connecting pieces of data, information, and knowledge on the Semantic Web using URIs and RDF 5

Data linking on the Web principles Use URIs as names for things anything, not just documents you are not your homepage information resources and non-information resources Use HTTP URIs globally unique names, distributed ownership allows people to look up those names Provide useful information in RDF when someone looks up a URI Include RDF links to other URIs to enable discovery of related information 6

Data integration over the Web Data integration involves combining data residing in different sources and providing user with a unified view of these data Data integration over the Web can be implemented as follows: 1. Export the data sets to be integrated as RDF graphs 2. Merge identical resources (i.e. resources having the same URI) from different data sets 3. Start making queries on the integrated data, queries that were not possible on the individual data sets.

Data integration over the Web 1. Export first data set as RDF graph For example the following RDF graph contains information about book “The Glass Palace” by Amitav Ghosh

Data integration over the Web 1. Export second data set as RDF graph Information about the same book but in French this time is modeled in RDF graph below

Data integration over the Web Same URI = Same resource 2. Merge identical resources (i.e. resources having the same URI) from different data sets

Data integration over the Web 2. Merge identical resources (i.e. resources having the same URI) from different data sets

Data integration over the Web 3. Start making queries on the integrated data A user of the second dataset may ask queries like: “give me the title of the original book” This information is not in the second dataset This information can be however retrieved from the integrated dataset, in which the second dataset was connected with the the first dataset

Semantic Web Architecture Adapted from

UNICODE, URI and XML UNICODE is the standard international character set E.g. used to encode the data in the repository Uniform Resource Identifiers (URIs) identify things and concepts E.g. used to indentify resources on the Web and in the repository eXtensible Markup Language (XML) is a markup language used for data exchange E.g. format that can be wrapped into RDF and imported into the repository

RDF, RDFS and OWL Resource Description Framework (RDF) is the HTML of the Semantic Web Simple way to describe resources on the Web Based on triples Various serializations, including one based on XML A simple ontology language (RDFS) E.g. language used to store the data in the repository Web Ontology Language (OWL) is a more complex ontology language than RDFS Layered language based on DL Overcomes some RDF(S) limitations E.g. ontology language used to define the schemas used in the repository

SPARQL and Rule Languages SPARQL Query language for RDF triples A protocol for querying RDF data over the Web E.g. language used to query the repository from the user interface Rule languages (esp. Rule Interchange Format RIF) Extend ontology languages with proprietary axioms Based on different types of logics Description Logic Logic Programming E.g. used to enable reasoning over data to infer new knowledge

RDF Basics RDF is a language that enable to describe making statements on resources John is father of Bill Statement (or triple) as a logical formula P(x, y), where the binary predicate P relates the object x to the object y Triple data model: Subject: Resource or blank node Predicate: Property Object: Resource (or collection of resources), literal or blank node Example: RDF offers only binary predicates (properties)

Resources A resource may be: Web page (e.g. ) A person (e.g. ) A book (e.g. urn:isbn: ) Anything denoted with a URI! A URI is an identifier and not a location on the Web RDF allows making statements about resources: has the format text/html urn:isbn: has author Tolkien

Literals Plain literals E.g. ”any text” Optional language tag, e.g. ”Hello, how are Typed literals E.g. "hello"^^xsd:string, "1"^^xsd:integer Recommended datatypes: XML Schema datatypes Only as object of a triple, e.g.: ,, ”John Smith”ˆˆxsd:string 

Datatypes One pre-defined datatype: rdf:XMLLiteral Used for embedding XML in RDF Recommended datatypes are XML Schema datatypes, e.g.: xsd:string xsd:integer xsd:float xsd:anyURI xsd:boolean

Blank Nodes I Blank nodes are nodes without a URI Unnamed resources More complex constructs A blank node can be used to indirectly attach to a resource a consistent set of properties which together represent a complex data Representation of blank nodes is syntax-dependent Blank node identifier For example: ,, _:johnsname   _:johnsname,, ”John”ˆˆxsd:string   _:johnsname,, ”Smith”ˆˆxsd:string 

RDF Containers “The lecture is attended by John, Mary and Chris” Bag “[RDF-Concepts] is edited by Graham and Jeremy (in that order)” Seq “The source code for the application may be found at ftp1.example.org, ftp2.example.org, ftp3.example.org” Alt Grouping property values:

RDF Containers 2 Three types of containers: rdf:Bag - unordered set of items rdf:Seq - ordered set of items rdf:Alt - set of alternatives Every container has a triple declaring the rdf:type Items in the container are denoted with rdf:_1, rdf:_2,...,rdf:_n : Semantics of the container is up to the application What about closed sets? How do we know whether Graham and Jeremy are the only editors of [RDF-Concepts]?

RDF Triple Graph Representation The triple data model can be represented as a graph Such graph is called in the Artificial Intelligence community a semantic net Labeled, directed graphs Nodes: resources, literals Labels: properties Edges: statements

RDF: a Direct Connected Graph based Model Different interconnected triples lead to a more complex graphic model Basically a RDF document is a direct connect graph

RDF Containers Graph Representation: Bag “The lecture is attended by John, Mary and Chris”

RDF Containers Graph Representation: Seq “[RDF-Concepts] is edited by Graham and Jeremy (in that order)”

RDF Containers Graph Representation: Alt “The source code for the application may be found at ftp1.example.org, ftp2.example.org, ftp3.example.org ”

RDF Collections “[RDF-Concepts] is edited by Graham and Jeremy (in that order) and nobody else” RDF provides support for describing groups containing only the specified members, in the form of RDF collections.

Reification I Reification: statements about statements Mary claims that John’s name is “John Smith”. , rdf:type, rdf:Statement  , rdf:subject,  , rdf:predicate,  , rdf:object, ”John Smith”  This kind of statement can be used to describe belief or trust in other statements, which is important in some kinds of applications Necessary because there are only triples in RDF: we cannot add an identifier directly to a triple (then it would be a quadruple)

Reification II Reification: statements about statements Mary claims that John’s name is “John Smith”. , rdf:type, rdf:Statement  , rdf:subject,  , rdf:predicate,  , rdf:object, ”John Smith”   ,, ”John Smith”  In such a way we attached a label to the statement.

Reification III Reification: statements about statements Mary claims that John’s name is “John Smith”. , rdf:type, rdf:Statement  , rdf:subject,  , rdf:predicate,  , rdf:object, ”John Smith”  ,,  RDF uses only binary properties. This restriction seems quite serious because often we use predicates with more than two arguments. Luckily, such predicates can be simulated by a number of binary predicates.

RDF Vocabulary RDF defines a number of resources and properties We have already seen: rdf:XMLLiteral, rdf:type,... RDF vocabulary is defined in the namespace: Classes: rdf:Property, rdf:Statement, rdf:XMLLiteral rdf:Seq, rdf:Bag, rdf:Alt, rdf:List Properties: rdf:type, rdf:subject, rdf:predicate, rdf:object, rdf:first, rdf:rest, rdf:_n rdf:value Resources: rdf:nil

RDF Vocabulary Typing using rdf:type : “A belongs to class B” All properties belong to class rdf:Property : “P is a property” “rdf:type is a property”

RDF Vocabulary Description Language Types in RDF: What is a “ #Student ”? RFD is not defining a vocabulary about the statements, but only to express statements We know that “ #Student ” identifies a category (a concept or a class), but this is only implicitly defined in RDF

RDF Vocabulary Description Language We need a language for defining RDF types: Define classes: “ #Student is a class” Relationships between classes: “ #Student is a sub-class of #Person ” Properties of classes: “ #Person has a property hasName ” RDF Schema is such a language

RDF Vocabulary Description Language Classes: Class hierarchies: Properties: Property hierarchies: Associating properties with classes (a): “The property #hasName only applies to #Person ” Associating properties with classes (b): “The type of the property #hasName is #xsd:string ”

RDFS Vocabulary RDFS Classes – rdfs:Resource – rdfs:Class – rdfs:Literal – rdfs:Datatype – rdfs:Container – rdfs:ContainerMembershipProperty RDFS Properties – rdfs:domain – rdfs:range – rdfs:subPropertyOf – rdfs:subClassOf – rdfs:member – rdfs:seeAlso – rdfs:isDefinedBy – rdfs:comment – rdfs:label RDFS Extends the RDF Vocabulary RDFS vocabulary is defined in the namespace:

RDFS Principles Resource All resources are implicitly instances of rdfs:Resource Class Describe sets of resources Classes are resources themselves - e.g. Webpages, people, document types Class hierarchy can be defined through rdfs:subClassOf Every class is a member of rdfs:Class Property Subset of RDFS Resources that are properties Domain: class associated with property: rdfs:domain Range: type of the property values: rdfs:range Property hierarchy defined through: rdfs:subPropertyOf

RDFS Example ex:Faculty- Staff

RDFS Vocabulary Example

RDFS Metadata Properties Metadata is “data about data” Any meta-data can be attached to a resource, using: rdfs:comment Human-readable description of the resource, e.g. , rdfs:comment, ”A person is any human being”  rdfs:label Human-readable version of the resource name, e.g. , rdfs:label, ”Human being”  rdfs:seeAlso Indicate additional information about the resource, e.g. , rdfs:seeAlso,  rdfs:isDefinedBy A special kind of rdfs:seeAlso, e.g. ,rdfs:isDefinedBy, 

Semantics RDF(S) vocabulary has built-in “meaning” RDF(S) Semantics Makes meaning explicit Defines what follows from an RDF graph Semantic notions Subgraph Instance Entailment

RDFS Entailment

Entailment Rules Semantics defined through entailment rules Rule: If S contains then add Executing all entailment rules yields realization of S S entails E if E is a subgraph of the realization of S Axiomatic triple are always added

RDF Entailment if E contains then add if E contains (l is a valid XML literal) then add where _:X identifies to blank node allocated to l

RDFS Entailment 1 everything in the subject is a resource if E contains then add every non-literal in the object is a resource if E contains (C is not a literal) then add every class is subclass of rdfs:Resource if E contains then add inheritance: if E contains, then add rdfs:subClassOf is transitive if E contains, then add

RDFS Entailment 2 rdfs:subClassOf is reflexive if E contains then add rdfs:subPropertyOf is transitive if E contains, then add rdfs:subPropertyOf is reflexive if E contains then add domain of properties if E contains, then add range of properties if E contains, then add

RDFS Entailment 3 every literal is a member of rdfs:Literal if E contains (l is a plain literal) then add every datatype is subclass of rdfs:Literal if E contains then add

RDF Serialization Formats There are several machine readable serialization formats for RDF RDF/XML Turtle Notation3 (N3) {:John :Loves :Mary} :accordingTo :Bill

Querying RDF SPARQL RDF Query language Based on RDQL Uses SQL-like syntax Example: PREFIX uni: SELECT ?name FROM WHERE { ?s uni:name ?name. ?s rdf:type uni:lecturer }

SPARQL Queries PREFIX uni: SELECT ?name FROM WHERE { ?s uni:name ?name. ?s rdf:type uni:lecturer } PREFIX Prefix mechanism for abbreviating URIs SELECT Identifies the variables to be returned in the query answer SELECT DISTINCT SELECT REDUCED FROM Name of the graph to be queried FROM NAMED WHERE Query pattern as a list of triple patterns LIMIT OFFSET ORDER BY

SPARQL Query keywords PREFIX: based on namespaces DISTINCT: The DISTINCT solution modifier eliminates duplicate solutions. Specifically, each solution that binds the same variables to the same RDF terms as another solution is eliminated from the solution set. REDUCED: While the DISTINCT modifier ensures that duplicate solutions are eliminated from the solution set, REDUCED simply permits them to be eliminated. The cardinality of any set of variable bindings in an REDUCED solution set is at least one and not more than the cardinality of the solution set with no DISTINCT or REDUCED modifier. LIMIT: The LIMIT clause puts an upper bound on the number of solutions returned. If the number of actual solutions is greater than the limit, then at most the limit number of solutions will be returned.

SPARQL Query keywords OFFSET: OFFSET causes the solutions generated to start after the specified number of solutions. An OFFSET of zero has no effect. ORDER BY: The ORDER BY clause establishes the order of a solution sequence. Following the ORDER BY clause is a sequence of order comparators, composed of an expression and an optional order modifier (either ASC() or DESC()). Each ordering comparator is either ascending (indicated by the ASC() modifier or by no modifier) or descending (indicated by the DESC() modifier).

Example RDF Graph "John Smith“ :_X1 _:X1 "John" _:X1 "Smith“ "32“ "Mary Smith“ :_X2 _:X2 "Mary" _:X2 "Smith" "29"

SPARQL Queries: All Full Names “Return the full names of all people in the graph” PREFIX vCard: SELECT ?fullName WHERE {?x vCard:FN ?fullName} result: fullName ================= "John Smith" "Mary vcard:. ex:john vcard:FN "John Smith" ; vcard:N [ vcard:Given "John" ; vcard:Family "Smith" ] ; ex:hasAge 32 ; ex:marriedTo :mary. ex:mary vcard:FN "Mary Smith" ; vcard:N [ vcard:Given "Mary" ; vcard:Family "Smith" ] ; ex:hasAge 29.

SPARQL Queries: Properties “Return the relation between John and Mary” PREFIX ex: SELECT ?p WHERE {ex:john ?p ex:mary} result: p vcard:. ex:john vcard:FN "John Smith" ; vcard:N [ vcard:Given "John" ; vcard:Family "Smith" ] ; ex:hasAge 32 ; ex:marriedTo :mary. ex:mary vcard:FN "Mary Smith" ; vcard:N [ vcard:Given "Mary" ; vcard:Family "Smith" ] ; ex:hasAge 29.

SPARQL Queries: Complex Patterns “Return the spouse of a person by the name of John Smith” PREFIX vCard: PREFIX ex: SELECT ?y WHERE {?x vCard:FN "John Smith". ?x ex:marriedTo ?y} result: y vcard:. ex:john vcard:FN "John Smith" ; vcard:N [ vcard:Given "John" ; vcard:Family "Smith" ] ; ex:hasAge 32 ; ex:marriedTo :mary. ex:mary vcard:FN "Mary Smith" ; vcard:N [ vcard:Given "Mary" ; vcard:Family "Smith" ] ; ex:hasAge 29.

SPARQL Queries: Complex Patterns “Return the spouse of a person by the name of John Smith” PREFIX vCard: PREFIX ex: SELECT ?y WHERE {?x vCard:FN "John Smith". ?x ex:marriedTo ?y} result: y vcard:. ex:john vcard:FN "John Smith" ; vcard:N [ vcard:Given "John" ; vcard:Family "Smith" ] ; ex:hasAge 32 ; ex:marriedTo :mary. ex:mary vcard:FN "Mary Smith" ; vcard:N [ vcard:Given "Mary" ; vcard:Family "Smith" ] ; ex:hasAge 29.

SPARQL Queries: Blank Nodes “Return the first name of all people in the KB” PREFIX vCard: SELECT ?name, ?firstName WHERE {?x vCard:N ?name. ?name vCard:Given ?firstName} result: name firstName ================= _:a "John" _:b "Mary vcard:. ex:john vcard:FN "John Smith" ; vcard:N [ vcard:Given "John" ; vcard:Family "Smith" ] ; ex:hasAge 32 ; ex:marriedTo :mary. ex:mary vcard:FN "Mary Smith" ; vcard:N [ vcard:Given "Mary" ; vcard:Family "Smith" ] ; ex:hasAge 29.

SPARQL Queries: Blank Nodes “Return the first name of all people in the KB” PREFIX vCard: SELECT ?name, ?firstName WHERE {?x vCard:N ?name. ?name vCard:Given ?firstName} result: name firstName ================= _:a "John" _:b "Mary vcard:. ex:john vcard:FN "John Smith" ; vcard:N [ vcard:Given "John" ; vcard:Family "Smith" ] ; ex:hasAge 32 ; ex:marriedTo :mary. ex:mary vcard:FN "Mary Smith" ; vcard:N [ vcard:Given "Mary" ; vcard:Family "Smith" ] ; ex:hasAge 29.

SPARQL Queries: Building RDF Graph “Rewrite the naming information in original graph by using the foaf:name ” PREFIX vCard: PREFIX foaf: CONSTRUCT { ?x foaf:name ?name } WHERE { ?x vCard:FN ?name } result: #john foaf:name “John Smith" #marry foaf:name “Marry vcard:. ex:john vcard:FN "John Smith" ; vcard:N [ vcard:Given "John" ; vcard:Family "Smith" ] ; ex:hasAge 32 ; ex:marriedTo :mary. ex:mary vcard:FN "Mary Smith" ; vcard:N [ vcard:Given "Mary" ; vcard:Family "Smith" ] ; ex:hasAge 29.

SPARQL Queries: Building RDF Graph “Rewrite the naming information in original graph by using the foaf:name ” PREFIX vCard: PREFIX foaf: CONSTRUCT { ?x foaf:name ?name } WHERE { ?x vCard:FN ?name } result: #john foaf:name “John Smith" #marry foaf:name “Marry vcard:. ex:john vcard:FN "John Smith" ; vcard:N [ vcard:Given "John" ; vcard:Family "Smith" ] ; ex:hasAge 32 ; ex:marriedTo :mary. ex:mary vcard:FN "Mary Smith" ; vcard:N [ vcard:Given "Mary" ; vcard:Family "Smith" ] ; ex:hasAge 29. <rdf:RDF xmlns:rdf=" xmlns:foaf=" xmlns:ex=" John Smith Marry Smith

SPARQL Queries: Testing if the Solution Exists “Are there any married persons in the KB?” PREFIX ex: ASK { ?person ex:marriedTo ?spouse } result: yes vcard:. ex:john vcard:FN "John Smith" ; vcard:N [ vcard:Given "John" ; vcard:Family "Smith" ] ; ex:hasAge 32 ; ex:marriedTo :mary. ex:mary vcard:FN "Mary Smith" ; vcard:N [ vcard:Given "Mary" ; vcard:Family "Smith" ] ; ex:hasAge 29.

SPARQL Queries: Constraints (Filters) “Return all people over 30 in the KB” PREFIX ex: SELECT ?x WHERE {?x hasAge ?age. FILTER(?age > 30)} result: x vcard:. ex:john vcard:FN "John Smith" ; vcard:N [ vcard:Given "John" ; vcard:Family "Smith" ] ; ex:hasAge 32 ; ex:marriedTo :mary. ex:mary vcard:FN "Mary Smith" ; vcard:N [ vcard:Given "Mary" ; vcard:Family "Smith" ] ; ex:hasAge 29.

SPARQL Queries: Optional Patterns “Return all people and (optionally) their spouse” PREFIX ex: SELECT ?person, ?spouse WHERE {?person ex:hasAge ?age. OPTIONAL { ?person ex:marriedTo ?spouse } } result: ?person ?spouse vcard:. ex:john vcard:FN "John Smith" ; vcard:N [ vcard:Given "John" ; vcard:Family "Smith" ] ; ex:hasAge 32 ; ex:marriedTo :mary. ex:mary vcard:FN "Mary Smith" ; vcard:N [ vcard:Given "Mary" ; vcard:Family "Smith" ] ; ex:hasAge 29.

Example – A RDF Graph Modeling Movies movie1 movie:Movie “Edward ScissorHands” “1990” rdf:type movie:title movie:year movie:Genre movie:Romance movie:Comedy rdf:type movie:genre movie:Role “Edward ScissorHands” r1r1 actor1 movie:playedBy movie:characterName rdf:type movie:hasPart [ me-tutorial-eswc2006.ppt]

Example Query 1 Select the movies that has a character called “Edward Scissorhands” PREFIX movie: SELECT DISTINCT ?x ?t WHERE { ?x movie:title ?t ; movie:hasPart ?y. ?y movie:characterName ?z. FILTER (?z = “Edward }

Example Query 1 PREFIX movie: SELECT DISTINCT ?x ?t WHERE { ?x movie:title ?t ; movie:hasPart ?y. ?y movie:characterName ?z. FILTER (?z = “Edward } Note the use of “;” This allows to create triples referring to the previous triple pattern (extended version would be ?x movie:hasPart ?y) Note as well the use of the language speciation in the

Example Query 2 Create a graph of actors and relate them to the movies they play in (through a new ‘playsInMovie’ relation) PREFIX movie: PREFIX foaf: CONSTRUCT { ?x foaf:firstName ?fname. ?x foaf:lastName ?lname. ?x movie:playInMovie ?m } WHERE { ?m movie:title ?t ; movie:hasPart ?y. ?y movie:playedBy ?x. ?x foaf:firstName ?fname. ?x foaf:lastName ?lname. }

Example Query 3 Find all movies which share at least one genre with “Gone with the Wind” PREFIX movie: SELECT DISTINCT ?x2 ?t2 WHERE { ?x1 movie:title ?t1. ?x1 movie:genre ?g1. ?x2 movie:genre ?g2. ?x2 movie:title ?t2. FILTER (?t1 = “Gone with the && ?x1!=?x2 && ?g1=?g2) }

Tool Support for RDF/RDFS Ontology editors Protégé ( Browser /facet ( RFD repositories Sesame ( APIs RDF2Go – Java ( Jena – Java ( Validator W3C Validator (

Developed by Stanford Medical Informatics Has a large user community (approx 30k) Support Graph view, consistency check, web, merging No support Addition of new basic types Limited multi-user support

/facet /facet is a generic browser for heterogeneous semantic web repositories Works on any RDFS dataset without any additional configuration Select and navigate facets of resources of any type Make selections based on properties of other, semantically related, types Allows the inclusion of facet- specific display options

Sesame A framework for storage, querying and inferencing of RDF and RDF Schema A Java Library for handling RDF A Database Server for (remote)access to repositories of RDF data Features: Light-weight yet powerful Java API SeRQL, SPARQL High scalability (O(10^7) triples on desktop hardware) Various backends (Native Store, RDBMS, main memory) Reasoning support Transactional support Context support RDF/XML, Turtle, N3, N-Triples

Jena A Java framework for building Semantic Web applications Initiated by Hewlett Packard (HP) Labs Semantic Web Programme. Includes: A RDF API Reading and writing RDF in RDF/XML, N3 and N-Triples An OWL API In-memory and persistent storage SPARQL query engine

RDF2Go RDF2Go is an abstraction over triple (and quad) stores. It allows developers to program against rdf2go interfaces and choose or change the implementation later easily It can be extended: you can create an adapter from any RDF Object Model to RDF2Go object model Directly supported implementations: Jena 2.4 Jena 2.6 Sesame 2

W3C Validator RDF Validator Parse RDF documents and detects errors w.r.t. the current RDF specification Available online service Downloadable code Based on ARP parser (the one also adopted in Jena)

Conclusions Semantic Web is about: annotation of data on the Web data linking on the Web data integration over the Web 81