Lecture 8: RDF& SPARQL Dr. Taysir Hassan A. Soliman December 13, 2015 INF411 Information Engineering Information Systems Dept. Faculty of Computers & Information.

Slides:



Advertisements
Similar presentations
Dr. Alexandra I. Cristea CS 253: Topics in Database Systems: C3.
Advertisements

CH-4 Ontologies, Querying and Data Integration. Introduction to RDF(S) RDF stands for Resource Description Framework. RDF is a standard for describing.
The Semantic Web – WEEK 4: RDF
SPARQL- A QUERY LANGUAGE FOR RDF( S ) Fred Freitas - CIn/UFPE - Brazil.
Introduction to RDF Based on tutorial at
1 RDF Tutorial. C. Abela RDF Tutorial2 What is RDF? RDF stands for Resource Description Framework It is used for describing resources on the web Makes.
CS570 Artificial Intelligence Semantic Web & Ontology 2
ESDSWG2011 – Semantic Web session Semantic Web Sub-group Session ESDSWG 2011 Meeting – Semantic Web sub-group session Wednesday, November 2, 2011 Norfolk,
RDF Tutorial.
Information Systems & Semantic Web University of Koblenz ▪ Landau, Germany Semantic Web - Query Languages – Steffen Staab
 Copyright 2004 Digital Enterprise Research Institute. All rights reserved. SPARQL Query Language for RDF presented by Cristina Feier.
SPARQL RDF Query.
Ontology Notes are from:
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.
RDF Kitty Turner. Current Situation there is hardly any metadata on the Web search engine sites do the equivalent of going through a library, reading.
RDF: Building Block for the Semantic Web Jim Ellenberger UCCS CS5260 Spring 2011.
Semantic Web Presented by: Edward Cheng Wayne Choi Tony Deng Peter Kuc-Pittet Anita Yong.
The RDF meta model: a closer look Basic ideas of the RDF Resource instance descriptions in the RDF format Application-specific RDF schemas Limitations.
Module 2b: Modeling Information Objects and Relationships IMT530: Organization of Information Resources Winter, 2007 Michael Crandall.
Introduction to XML This material is based heavily on the tutorial by the same name at
Semantic Web Andrejs Lesovskis. Publishing on the Web Making information available without knowing the eventual use; reuse, collaboration; reproduction.
Ontologies: Making Computers Smarter to Deal with Data Kei Cheung, PhD Yale Center for Medical Informatics CBB752, February 9, 2015, Yale University.
Logics for Data and Knowledge Representation SPARQL Protocol and RDF Query Language (SPARQL) Feroz Farazi.
© 2006 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice Publishing data on the Web (with.
ONTOLOGY SUPPORT For the Semantic Web. THE BIG PICTURE  Diagram, page 9  html5  xml can be used as a syntactic model for RDF and DAML/OIL  RDF, RDF.
RDF (Resource Description Framework) Why?. XML XML is a metalanguage that allows users to define markup XML separates content and structure from formatting.
1cs The Need “Most of the Web's content today is designed for humans to read, not for computer programs to manipulate meaningfully.” Berners-Lee,
Introduction to SPARQL. Acknowledgements This presentation is based on the W3C Candidate Recommendation “SPARQL Query Language for RDF” from
The Semantic Web Service Shuying Wang Outline Semantic Web vision Core technologies XML, RDF, Ontology, Agent… Web services DAML-S.
INF 384 C, Spring 2009 Ontologies Knowledge representation to support computer reasoning.
The Semantic Web Web Science Systems Development Spring 2015.
Ontology Query. What is an Ontology Ontologies resemble faceted taxonomies but use richer semantic relationships among terms and attributes, as well as.
SPARQL AN RDF Query Language. SPARQL SPARQL is a recursive acronym for SPARQL Protocol And Rdf Query Language SPARQL is the SQL for RDF Example: PREFIX.
SPARQL All slides are adapted from the W3C Recommendation SPARQL Query Language for RDF Web link:
The LOM RDF binding – update Mikael Nilsson The Knowledge Management.
RDF – RESOURCE DESCRIPTION FRAMEWORK Antonio Bucchiarone FBK-IRST Trento, Italy 01Dicembre 2009.
Towards a semantic web Philip Hider. This talk  The Semantic Web vision  Scenarios  Standards  Semantic Web & RDA.
Semantic Web - an introduction By Daniel Wu (danielwujr)
1 Metadata –Information about information – Different objects, different forms – e.g. Library catalogue record Property:Value: Author Ian Beardwell Publisher.
EEL 5937 Ontologies EEL 5937 Multi Agent Systems Lecture 5, Jan 23 th, 2003 Lotzi Bölöni.
1 SPARQL A. Emrah Sanön. 2 RDF RDF is quite committed to Semantic Web. Data model Serialization by means of XML Formal semantics Still something is missing!
The future of the Web: Semantic Web 9/30/2004 Xiangming Mu.
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.
User Profiling using Semantic Web Group members: Ashwin Somaiah Asha Stephen Charlie Sudharshan Reddy.
The RDF meta model Basic ideas of the RDF Resource instance descriptions in the RDF format Application-specific RDF schemas Limitations of XML compared.
1cs The Need “Most of the Web's content today is designed for humans to read, not for computer programs to manipulate meaningfully.” Berners-Lee,
05/01/2016 SPARQL SPARQL Protocol and RDF Query Language S. Garlatti.
Doc.: IEEE /0169r0 Submission Joe Kwak (InterDigital) Slide 1 November 2010 Slide 1 Overview of Resource Description Framework (RFD/XML) Date:
THE SEMANTIC WEB By Conrad Williams. Contents  What is the Semantic Web?  Technologies  XML  RDF  OWL  Implementations  Social Networking  Scholarly.
EEL 5937 Ontologies EEL 5937 Multi Agent Systems Lotzi Bölöni.
The Semantic Web. What is the Semantic Web? The Semantic Web is an extension of the current Web in which information is given well-defined meaning, enabling.
OWL Web Ontology Language Summary IHan HSIAO (Sharon)
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.
Semantic Web in Depth SPARQL Protocol and RDF Query Language Dr Nicholas Gibbins –
XML and Distributed Applications By Quddus Chong Presentation for CS551 – Fall 2001.
Semantic Web In Depth Resource Description Framework 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.
SPARQL.
Introduction to SPARQL
SPARQL SPARQL Protocol and RDF Query Language
SPARQL: A query language for RDF
Grid Computing 7700 Fall 2005 Lecture 18: Semantic Grid
Logics for Data and Knowledge Representation
Grid Computing 7700 Fall 2005 Lecture 18: Semantic Grid
Logics for Data and Knowledge Representation
Presentation transcript:

Lecture 8: RDF& SPARQL Dr. Taysir Hassan A. Soliman December 13, 2015 INF411 Information Engineering Information Systems Dept. Faculty of Computers & Information

Agenda Semantic web 3.0 RDF SPARQL

(In)famous “Layer Cake”  Data Exchange  Semantics+reasoning  Relational Data ? ? ??? Relationship between layers is not clear Uniform Resource Identifier (URI) is a string of characters used to identify the name of a resource. stringcharactersidentifyresource NS – Name Space – OWL DL extends “DL subset” of RDF

4 Semantic Web Content: New “Users” applications agents

Semantic web The Semantic Web is an extension of the Web through standards by the World Wide Web Consortium (W3C).WebWorld Wide Web Consortium The standards promote common data formats and exchange protocols on the Web, most fundamentally the Resource Description Framework (RDF).WebResource Description Framework

According to the W3C, "The Semantic Web provides a common framework that allows data to be shared and reused across application, enterprise, and community boundaries“ The term was coined by Tim Berners-Lee for a web of data that can be processed by machines.Tim Berners-Lee

Semantic Web 3.0 Technology Is connective intelligence; connecting data, concepts, applications and ultimately people. (Nova Spivack) Principally, the Semantic Web is a Web 3.0 web technology - a way of linking data between systems or entities that allows for rich, self-describing interrelations of data available across the globe on the web.

RIF is the W3C Rule Interchange Format. It's an XML language for expressing Web rules that computers can execute. RIF provides multiple versions, called dialects. It includes a RIF Basic Logic Dialect (RIF-BLD) and RIF Production Rules Dialect (RIF PRD).

Semantic Web Rule Language (SWRL) based on a combination of the OWL DL and OWL Lite sublanguages of the OWL Web Ontology Language with the Unary/Binary Datalog RuleML sublanguages of the Rule Markup Language.

How is it different ? Today, much of the data we get from the web is delivered to us in the form of web pages - HTML documents that are linked to each other through the use of hyperlinks. Humans or machines can read these documents, but other than typically seeking keywords in a page, machines have difficulty extracting any meaning from these documents themselves.

How do we represent the data? RDF is a common acronym within the semantic web community because it forms one of the basic building blocks for forming the web of semantic data. RDF defines graph database. Graph databases build the semantic web, globally.

12 XML: document = labelled tree course teachertitlestudents namehttp = XML Schema: grammars for describing legal trees and datatypes node = label + attr/values + contents So: why not use XML to represent semantics?

In XML: there must be a hierarchy Example of XML document Ahmed Khaled Reminder Don't forget our meeting on Friday!

Different kinds of Databases

Data Graph In a data graph, there is no concept of roots (or a hierarchy). A graph consists of resources related to other resources, with no single resource having any particular intrinsic importance over another.

An Example of a Data Graph Bengie is a dog. Bonnie is a cat. Bengie and Bonnie are friends.

two things - identified by "Thing 1" and "Thing 2" – have the properties name,animalType and friends With. we can see that "Thing 1"'s name is Bengie, and "Thing 2"'s name is Bonnie. "Thing 1" is a dog, and "Thing 2" is a cat. And finally, both are friends with each other (implied by the friendsWithproperty pointing in both directions).

RDF example The arrows in the above diagram are properties, sometimes in RDF terminology called predicates. Subject is the T-shirt Predicate (property) is the color Object is white

RDF, whilst the foundation of defining data structures for the semantic web, does not in itself describe the semantics, or meaning, behind the data

Graph Data The data are represented in RDF The metadata are in RDFS / OWL Query Syntax is SPARQL

Sharing with Semantic Web Models Vocabulary - A collection of terms given a well- defined meaning that is consistent across contexts. Ontology - Allows you to define contextual relationships behind a defined vocabulary. It is the cornerstone of defining a knowledge domain. A formal syntax for defining ontologies is OWL (Web Ontology Language) which is an extension to RDFS (RDF Schema).OWL (Web Ontology Language)

What is RDF? (Resource Description Framework) RDF is a framework for describing resources on the web RDF is designed to be read and understood by computers RDF is not designed for being displayed to people RDF is written in XML RDF is a part of the W3C's Semantic Web Activity RDF is a W3C Recommendation from 10. February 2004

RDF is used for Describing properties for shopping items, such as price and availability Describing time schedules for web events Describing information about web pages (content, author, created and modified date) Describing content and rating for web pictures Describing content for search engines Describing electronic libraries

RDF Resource, Property, and Property Value A Resource is anything that can have a URI, such as " A Property is a Resource that has a name, such as "author" or "homepage" A Property value is the value of a Property, such as "Jan Egil Refsnes" or " (note that a property value can be another resource)

Jan Egil Refsnes

RDF Elements The main elements of RDF are the root element,, and the element, which identifies a resource. The Element is the root element of an RDF document. It defines the XML document to be an RDF document. It also contains a reference to the RDF namespace:

RDF Element...Description goes here...

Element The element identifies a resource with the about attribute. The element contains elements that describe the resource:

Bob Dylan UK Columbia

The elements, artist, country, company, price, and year, are defined in the namespace. This namespace is outside RDF (and not a part of RDF). RDF defines only the framework. The elements, artist, country, company, price, and year, must be defined by someone else (company, organization, person, etc).

Properties as Attributes The property elements can also be defined as attributes (instead of elements):

Properties as Resources

RDF Containers RDF containers are used to describe group of things. The following RDF elements are used to describe groups:,, and.

The Element John Paul George Ringo

Element George John Paul Ringo

The Element CD Record Tape

RDF Schema and application classes RDF Schema (RDFS) is an extension to RDF. RDF describes resources with classes, properties, and values. In addition, RDF also needs a way to define application-specific classes and properties. Application-specific classes and properties must be defined using extensions to RDF.

RDF Schema (RDFS) RDF Schema does not provide actual application-specific classes and properties. Instead RDF Schema provides the framework to describe application-specific classes and properties. Classes in RDF Schema are much like classes in object oriented programming languages. This allows resources to be defined as instances of classes, and subclasses of classes.

Example of RDFS

What is Metadata ? Metadata is a term you will come across again and again when harnessing semantic web technologies. "Metadata" is not a complex term or concept - it simply means "data about data" (taken from the Greek meta- meaning "after").

Initiatives The Dublin Core Metadata Initiative (DCMI) has created some predefined properties for describing documents. RDF is metadata (data about data). RDF is used to describe information resources.

SPARQL SELECT ?title WHERE { ?title. }

44 Example q1 contains a query: SELECT ?x WHERE (?x,, "John Smith") The outcome is: x =============================

45 Example Return all the resources that have property FN and the associated values: SELECT ?x, ?fname WHERE (?x,, ?fname) The outcome is: x | fname ================================================ | "John Smith" | "Sarah Jones" | "Matt Jones"

46 Example Return the first name of Jones: SELECT ?givenName WHERE (?y,, "Jones"), (?y,, ?givenName) The outcome is: givenName ========= "Matthew" "Sarah"

47 URI Prefixes : USING RDQL has a syntactic convenience that allows prefix strings to be defined in the USING clause : SELECT ?x WHERE (?x, vCard:FN, "John Smith") USING vCard FOR SELECT ?givenName WHERE (?y, vCard:Family, "Smith"), (?y, vCard:Given, ?givenName) USING vCard FOR

48 Filters RDQL has a syntactic convenience that allows prefix strings to be defined in the USING clause : SELECT ?resource WHERE (?resource, info:age, ?age) AND ?age >= 24 USING info FOR

SPARQL SPARQL is a recursive acronym standing for – SPARQL Protocol and RDF Query Language It provides facilities to [Staab 2006]: – extract information in the form of URIs, blank nodes, plain and typed literals. – extract RDF subgraphs. – construct new RDF graphs based on information in the queried graphs

SPARQL A SPARQL query comprises, in order: Prefix declarations, for abbreviating URIs Dataset definition, stating what RDF graph(s) are being queried A result clause, identifying what information to return from the query The query pattern, specifying what to query for in the underlying dataset Query modifiers, slicing, ordering, and otherwise rearranging query results

Results of SPARQL queries The results of SPARQL queries can be returned and/or rendered in a variety of formats:XML. SPARQL specifies an XML vocabulary for returning tables of results.XML vocabulary JSON. A JSON "port" of the XML vocabulary, particularly useful for Web applications.JSON "port" RDF. Certain SPARQL result clauses trigger RDF responses, which in turn can be serialized in a number of ways (RDF/XML, etc.)RDF/XML

HTML. When using an interactive form to work with SPARQL queries. Often implemented by applying an XSL transform to XML results.

Dataset: Friend of a Friend (FOAF) FOAF is a standard RDF vocabulary for describing people and relationships FOAF FOAF integrates three kinds of network: social networks of human collaboration, friendship and association; representational networks that describe a simplified view of a cartoon universe in factual terms, and information networks that use Web-based linking to share independently published descriptions of this inter-connected foaf:

Graph Patterns Basic Graph Pattern – set of Triple Patterns Group Pattern - a set of graph patterns must all match Value Constraints - restrict RDF terms in a solution Optional Graph Patterns.- additional patterns may extend the solution Alternative Graph Pattern – two or more possible patterns are tried Patterns on Named Graphs - patterns are matched against named graphs

Basic Graph Pattern Set of Triple Patterns – Triple Pattern – similar to an RDF Triple (subject, predicate, object), but any component can be a query variable; literal subjects are allowed – Matching a triple pattern to a graph: bindings between variables and RDF Terms Matching of Basic Graph Patterns – A Pattern Solution of Graph Pattern GP on graph G is any substitution S such that S(GP) is a subgraph of G. xv rdf:typerdf:Property rdf:type rdf:type rdf:Property SELECT ?x ?v WHERE { ?x ?x ?v } ?book dc:title ?title

Basic Graph Pattern - Multiple Matches PREFIX foaf: SELECT ?name ?mbox WHERE { ?x foaf:name ?name. ?x foaf:mbox ?mbox foaf:. _:a foaf:name "Johnny Lee Outlaw". _:a foaf:mbox. _:b foaf:name "Peter Goodguy". _:b foaf:mbox. namembox "Johnny Lee Outlaw" "Peter Goodguy" Group Graph Pattern (set of graph patterns) also! Data Query Query Result

Basic Graph Pattern - Blank Nodes PREFIX foaf: SELECT ?x ?name WHERE { ?x foaf:name ?name foaf:. _:a foaf:name "Alice". _:b foaf:name "Bob". xname _:c“Alice“ _:d“Bob” Data Query Query Result

Graph Patterns Basic Graph Pattern – set of Triple Patterns Group Pattern - a set of graph patterns must all match Value Constraints - restrict RDF terms in a solution Optional Graph Patterns.- additional patterns may extend the solution Alternative Graph Pattern – two or more possible patterns are tried Patterns on Named Graphs - patterns are matched against named graphs

Group Pattern PREFIX foaf: SELECT ?name ?mbox WHERE { ?x foaf:name ?name. ?x foaf:mbox ?mbox } PREFIX foaf: SELECT ?name ?mbox WHERE { {?x foaf:name ?name; foaf:mbox ?mbox } }

Graph Patterns Basic Graph Pattern – set of Triple Patterns Group Pattern - a set of graph patterns must all match Value Constraints - restrict RDF terms in a solution Optional Graph Patterns.- additional patterns may extend the solution Alternative Graph Pattern – two or more possible patterns are tried Patterns on Named Graphs - patterns are matched against named graphs

Value Constraints PREFIX dc: PREFIX ns: SELECT ?title ?price WHERE { ?x ns:price ?price. FILTER ?price < 30. ?x dc:title ?title. ns:. :book1 dc:title "SPARQL Tutorial". :book1 ns:price 42. :book2 dc:title "The Semantic Web". :book2 ns:price 23. titleprice "The Semantic Web"23 Data Query Query Result

62 Regular expressions can be used PREFIX dc: PREFIX ldap: PREFIX foaf: SELECT ?name ?name2 { ?doc dc:title ?title. FILTER regex(?title, “SPARQL”). ?doc dc:creator ?reseacher. ?researcher ldap: ? . ?researcher ldap:name ?name } “Find the name and addresses of authors of a paper about SPARQL”

Graph Patterns Basic Graph Pattern – set of Triple Patterns Group Pattern - a set of graph patterns must all match Value Constraints - restrict RDF terms in a solution Optional Graph Patterns.- additional patterns may extend the solution Alternative Graph Pattern – two or more possible patterns are tried Patterns on Named Graphs - patterns are matched against named graphs

Optional graph patterns PREFIX dc: PREFIX ns: SELECT ?title ?price WHERE { ?x dc:title ?title. OPTIONAL { ?x ns:price ?price. FILTER ?price < 30 ns:. :book1 dc:title "SPARQL Tutorial". :book1 ns:price 42. :book2 dc:title "The Semantic Web". :book2 ns:price 23. titleprice “SPARQL Tutorial“ "The Semantic Web"23 Data Query Query Result

Multiple Optional Blocks PREFIX foaf: SELECT ?name ?mbox ?hpage WHERE { ?x foaf:name ?name. OPTIONAL { ?x foaf:mbox ?mbox }. OPTIONAL { ?x foaf:homepage ?hpage } rdfs:. _:a foaf:name "Alice". _:a foaf:homepage. _:b foaf:name "Bob". _:b foaf:mbox. Data Query Query Result nameMboxhpage “Alice“ “Bob“

Graph Patterns Basic Graph Patterns – set of Triple Patterns Group Patterns - a set of graph patterns must all match Value Constraints - restrict RDF terms in a solution Optional Graph Patterns.- additional patterns may extend the solution Alternative Graph Patterns – two or more possible patterns are tried Patterns on Named Graphs - patterns are matched against named graphs

Alternative Graph Patterns PREFIX dc10: PREFIX dc11: SELECT ?x ?y WHERE { { ?book dc10:title ?x } UNION { ?book dc11:title ?y } dc11:. _:a dc10:title "SPARQL Query Language Tutorial". _:b dc11:title "SPARQL Protocol Tutorial". _:c dc10:title "SPARQL". _:c dc11:title "SPARQL (updated)". Data Query Query Result xy "SPARQL (updated)" "SPARQL Protocol Tutorial" "SPARQL" "SPARQL Query Language Tutorial"

© Copyright TopQuadrant Inc., “Semantic Technology and EA”, slide 68 This is an Example of Ontology within an Enterprise

References Protege Ontology Libraries Protege tutorial Protege Website