13 RDFS and SPARQL. Internet Technology. MSc in Communication Sciences 2011-12 Program in Technologies for Human Communication.



Similar documents
Logic and Reasoning in the Semantic Web (part I RDF/RDFS)

12 The Semantic Web and RDF

RDF Resource Description Framework

Semantic Modeling with RDF. DBTech ExtWorkshop on Database Modeling and Semantic Modeling Lili Aunimo

Network Graph Databases, RDF, SPARQL, and SNA

RDF y SPARQL: Dos componentes básicos para la Web de datos

Getting Started Guide

4 Semantic Web Application Architecture

Ampersand and the Semantic Web

SPARQL: Un Lenguaje de Consulta para la Web

RDF Support in Oracle Oracle USA Inc.

Query engine for massive distributed ontologies using MapReduce

Drupal.

LINKED DATA EXPERIENCE AT MACMILLAN Building discovery services for scientific and scholarly content on top of a semantic data model

Integrating and Exchanging XML Data using Ontologies

Extending Policy Languages to the Semantic Web

Grids, Logs, and the Resource Description Framework

Chapter 2 AN INTRODUCTION TO THE OWL WEB ONTOLOGY LANGUAGE 1. INTRODUCTION. Jeff Heflin Lehigh University

Semantic Interoperability

A Semantic web approach for e-learning platforms

SPARQL By Example: The Cheat Sheet

Layering the Semantic Web: Problems and Directions

excellent graph matching capabilities with global graph analytic operations, via an interface that researchers can use to plug in their own

High Performance Descriptive Semantic Analysis of Semantic Graph Databases

Defining a benchmark suite for evaluating the import of OWL Lite ontologies

Types and Annotations for CIDOC CRM Properties

A Secure Mediator for Integrating Multiple Level Access Control Policies

Managing enterprise applications as dynamic resources in corporate semantic webs an application scenario for semantic web services.

Taming Big Data Variety with Semantic Graph Databases. Evren Sirin CTO Complexible

DLDB: Extending Relational Databases to Support Semantic Web Queries

How To Create A Federation Of A Federation In A Microsoft Microsoft System (R)

JOURNAL OF COMPUTER SCIENCE AND ENGINEERING

Presentation / Interface 1.3

Exposing Domain Models as Linked Data

Federated Data Management and Query Optimization for Linked Open Data

The Yin/Yang Web: A Unified Model for XML Syntax and RDF Semantics

Developing Web 3.0. Nova Spivak & Lew Tucker Tim Boudreau

ARC: appmosphere RDF Classes for PHP Developers

OSLC Primer Learning the concepts of OSLC

How To Write A Rdf Database In A Relational Database With A Statement Table

OWL: Path to Massive Deployment. Dean Allemang Chief Scien0st, TopQuadrant Inc.

How To Understand And Understand Common Lisp

TopBraid Application Development Quickstart Guide. Version 3.3

A Comparison of Database Query Languages: SQL, SPARQL, CQL, DMX

Creating an RDF Graph from a Relational Database Using SPARQL

Formalization of the CRM: Initial Thoughts

Programming the Semantic Web with Java. Taylor Cowan Travelocity 8982

Extending the Linked Data API with RDFa

OWL based XML Data Integration

! E6893 Big Data Analytics Lecture 9:! Linked Big Data Graph Computing (I)

Introduction to Ontologies

THE SEMANTIC WEB AND IT`S APPLICATIONS

Ching-Yung Lin, Ph.D. Adjunct Professor, Dept. of Electrical Engineering and Computer Science IBM Chief Scientist, Graph Computing. October 29th, 2015

SEMANTIC WEB PUBLISHING WITH DRUPAL

Ontology Based Knowledge Discovery in Social Networks

ABSTRACT 1. INTRODUCTION. Kamil Bajda-Pawlikowski

BUSINESS VALUE OF SEMANTIC TECHNOLOGY

We have big data, but we need big knowledge

Produce and Consume Linked Data with Drupal!

Experiences with JSON and XML Transformations IBM Submission to W3C Workshop on Data and Services Integration October , Bedford, MA, USA

SPARQL UniProt.RDF. Get these slides! Tutorial plan. Everyone has had some introduction slash knowledge of RDF.

Bigdata Model And Components Of Smalldata Structure

Semantic Web Standard in Cloud Computing

Evaluation experiment of ontology tools interoperability with the WebODE ontology engineering workbench

technische universiteit eindhoven WIS & Engineering Geert-Jan Houben

Programming the Semantic Web

Scalable and Reactive Programming for Semantic Web Developers

Semantic to Intelligent Web Era Building Blocks, Applications, and Current Trends

Transcription:

MSc in Communication Sciences 2011-12 Program in Technologies for Human Communication Davide Eynard nternet Technology 13 RDFS and SPARQL

2 RDF - Summary Main characteristics of RDF: Abstract syntax based on triples (subj-pred-obj) The data model is a graph, instead of a tree Resources (identified by URs) vs literals (xsd datatypes) Building patterns: Blank nodes Reification Serializations RDF/XML, N3 family, RDFa NOTE: RDF ser RDF returns the original RDF, while ser RDF ser does not necessarily return the same serialization!

3 Explicit reification Shakespeare wrote Hamlet lit:shakespeare lit:wrote lit:hamlet. lit:hamlet lit:author lit:shakespeare. Shakespeare wrote Hamlet in 1601 bio:n1 bio:author lit:shakespeare ; bio:title "Hamlet" ; bio:publicationdate 1601. Wikipedia says that Shakespeare wrote Hamlet q:n1 rdf:subject lit:shakespeare ; rdf:predicate lit:wrote ; rdf:object lit:hamlet. web:wikipedia m:says q:n1.

4 RDF Schema RDF Schema is a semantic extension of RDF which defines classes and properties that may be used to describe classes, properties and other resources RDFS provides mechanisms for describing groups of related resources and the relationships between these resources RDFS vocabulary descriptions are written in RDF Similar to XML Schema wrt XML Similarities with OOP No real inheritance, but subclassing (an instance of a subclass is also an instance of the parent class) Nothing similar to method override RDF Schema defines meaning in terms of possible inferences

5 RDF Schema Just as Semantic Web modeling in RDF is about graphs, Semantic Web modeling in the RDF Schema Language (RDFS) is about sets. What do we gain by specifying explicitly that something is a set? We gain a description of the meaning of membership in a set How can we specify what we mean by set membership? n RDFS, we express meaning through the mechanism of inference

6 RDF Schema at a glance Classes rdfs:resource rdfs:class rdfs:literal rdfs:datatype rdf:xmlliteral rdf:property Properties rdfs:domain rdfs:range rdf:type rdfs:subclassof rdfs:subpropertyof rdfs:label rdfs:comment Reification vocabulary rdf:statement rdf:subject rdf:predicate rdf:object Utility properties rdfs:seealso rdfs:isdefinedby rdf:value

7 Type and Relationship propagation rdfs:subclassof f we have triples of the form A rdfs:subclassof B. r rdf:type A. then we can infer r rdf:type B. rdfs:subpropertyof f we have triples of the form P rdfs:subpropertyof R. then, if we have the triple a P b, we can infer a R b.

8 Typing data rdfs:domain F P rdfs:domain D. and x P y. THEN x rdf:type D. rdfs:range F P rdfs:range R. and x P y. THEN y rdf:type R.

9 RDF validation n RDFS, there is no way to assert that a particular individual is not a member of a particular class no notion of an incorrect or inconsistent inference Unlike the case of XML Schema, an RDF Schema will never proclaim an input as invalid; it will simply infer appropriate type information

10 RDFS modeling: intersection Set intersection C rdfs:subclassof A. C rdfs:subclassof B. x rdf:type C. Then: x rdf:type B. x rdf:type A. Property intersection :lodgedn rdfs:subpropertyof :billedfor. :logdedn rdfs:subpropertyof :assignedto. :Marcus :lodgedn :Room101. Then: :Marcus :billedfor :Room101. :Marcus :assignedto :Room101.

11 RDFS modeling: union Set union A rdfs:subclassof C. B rdfs:subclassof C. Writing x rdf:type A. or x rdf:type B. implies: x rdf:type C. Property union P rdfs:subpropertyof R. Q rdfs:subpropertyof R. Writing x P y. or x Q y. implies: x R y.

12 Non-modeling properties rdfs:label provides a readable/printable name for any resource rdfs:seealso used for cross-referencing rdfs:isdefinedby provides a link to the primary source of information about a resource. This allows modelers to specify where the definitional description of a resource can be found rdfs:subpropertyof of rdfs:seealso. rdfs:comment model documentation

13 SPARQL by example SPARQL is a recursive acronym that stands for SPARQL Protocol And RDF Query Language Features: Graph patterns Optional values Matching alternatives Multiple RDF graphs as data sources ORDER BY, DSTNCT, OFFSET, LMT Filters on returned values Let's try it! Go to http://sparql.org

14 Our first SPARQL query Go to http://www.sparql.org/query.html and type the following: PREFX books: PREFX dc: PREFX vcard: SELECT?s?p?o WHERE {?s?p?o } <http://example.org/book/> <http://purl.org/dc/elements/1.1/> <http://www.w3.org/2001/vcard-rdf/3.0#> The meaning is (after a sequence of namespace declarations): for all the triples subject predicate object show me the subject, the predicate, and the object?s,?p, and?o are variables that are filled with the results that satisfy your query (in this case, all the triples in the graph) Use the construct option to create an RDF you can validate and display using the W3C validation service!

15 SPARQL queries Another basic query: PREFX books: <http://example.org/book/> PREFX dc: <http://purl.org/dc/elements/1.1/> SELECT?book?title WHERE {?book dc:title?title.?book dc:creator "J.K. Rowling" } t reads like follows: there is a?book whose title is?title the same?book has a creator which is J.K. Rowling show me the list of book-title pairs you have (that is, give me all the books by J.K. Rowling) NOTE: SPARQL builds a graph out of your query and tries to match it with the data inside the KB

16 SPARQL queries with anonymous nodes A more complex query on the books dataset: PREFX books: <http://example.org/book/> PREFX dc: <http://purl.org/dc/elements/1.1/> PREFX vcard: <http://www.w3.org/2001/vcard-rdf/3.0#> SELECT DSTNCT?name WHERE {?s dc:creator?o.?o vcard:n?n.?n vcard:given?name } t reads like follows: there is a?s whose creator is?o this?o has a full name which is?n this?n has a first/given name which is?name show me all the distinct?names you have

17 SPARQL queries with OPTONAL clause PREFX books: <http://example.org/book/> PREFX dc: <http://purl.org/dc/elements/1.1/> SELECT?book?title WHERE {?book dc:title?title.?book dc:creator "J.K. Rowling" } What if there are books for which the creator has not been specified? Check the difference: PREFX books: <http://example.org/book/> PREFX dc: <http://purl.org/dc/elements/1.1/> SELECT?book?title WHERE {?book dc:title?title. optional {?book dc:creator "J.K. Rowling"} }

18 SPARQL queries with anonymous nodes A more complex query on the books dataset: PREFX books: <http://example.org/book/> PREFX dc: <http://purl.org/dc/elements/1.1/> PREFX vcard: <http://www.w3.org/2001/vcard-rdf/3.0#> SELECT?book?title?creator WHERE { {?book dc:title?title.?book dc:creator "J.K. Rowling"} UNON {?book dc:title?title.?book dc:creator?creator.?creator vcard:fn "J.K. Rowling"} } NOTE: this technique is very useful to merge information coming from different schemas

19 Changing datasets on SPARQLer Three steps: choose general purpose SPARQL processor specify the target graph UR (for instance, try with http://rdf.freebase.com/rdf/en.arnold_schwarzenegger) write a query, for instance: PREFX fb: <http://rdf.freebase.com/ns/> select?film where{?s fb:film.performance.film?film } NOTE: to get the name of the properties, you can always send an SPO (?s?p?o) query!

20 More advanced queries on Freebase data Get the list of movies and the characters: PREFX fb: <http://rdf.freebase.com/ns/> PREFX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> select?filmtitle?character where{?film a fb:film.performance.?film fb:film.performance.film?filmtitle.?film fb:film.performance.character?character } Get the list of related webpages: PREFX fb: <http://rdf.freebase.com/ns/> PREFX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> select?o where{?s fb:common.webpage.uri?o }

21 References Some Web references: Tools: RDF Primer: http://www.w3.org/tr/rec-rdf-syntax RDF Schema: http://www.w3.org/tr/rdf-schema Dean Allemang, Jim Hendler: Semantic Web for the Working Ontologist. http://workingontologist.org W3C RDF Validator: http://www.w3.org/rdf/validator Morla RDF editor: http://www.morlardf.net