 Copyright 2010 Digital Enterprise Research Institute. All rights reserved. Digital Enterprise Research Institute www.deri.ie Transforming between RDF.

Slides:



Advertisements
Similar presentations
Chungnam National University DataBase System Lab
Advertisements

Querying on the Web: XQuery, RDQL, SparQL Semantic Web - Spring 2006 Computer Engineering Department Sharif University of Technology.
CH-4 Ontologies, Querying and Data Integration. Introduction to RDF(S) RDF stands for Resource Description Framework. RDF is a standard for describing.
XML: Extensible Markup Language
1 XSLT – eXtensible Stylesheet Language Transformations Modified Slides from Dr. Sagiv.
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.
27 January Semantically Coordinated E-Market Semantic Web Term Project Prepared by Melike Şah 27 January 2005.
Using JavaScript in Linked Data Applications Oshani Seneviratne Oct 12, 2010.
Ontology Engineering Lab #8 October 21, Review - Trial Query Exercises  What are the bones of the foot? (not sure this can be done in a single.
SPECIAL TOPIC XML. Introducing XML XML (eXtensible Markup Language) ◦A language used to create structured documents XML vs HTML ◦XML is designed to transport.
ESDSWG2011 – Semantic Web session Semantic Web Sub-group Session ESDSWG 2011 Meeting – Semantic Web sub-group session Wednesday, November 2, 2011 Norfolk,
RDF Tutorial.
Semantic Web Introduction
© Copyright IBM Corporation 2014 Getting started with Rational Engineering Lifecycle Manager queries Andy Lapping – Technical sales and solutions Joanne.
Jena Sparql 4/11/2017.
 Copyright 2004 Digital Enterprise Research Institute. All rights reserved. SPARQL Query Language for RDF presented by Cristina Feier.
SPARQL RDF Query.
Chapter 3 Querying RDF stores with SPARQL. TL;DR We will want to query large RDF datasets, e.g. LOD SPARQL is the SQL of RDF SPARQL is a language to query.
Michael Povolotsky CMSC491s/691s. What is Virtuoso? Virtuoso, known as Virtuoso Universal Server, is a multi-protocol RDBMS Includes an object-relational.
SPARQL for Querying PML Data Jitin Arora. Overview SPARQL: Query Language for RDF Graphs W3C Recommendation since 15 January 2008 Outline: Basic Concepts.
Information Retrieval in Practice
CSCI 572 Project Presentation Mohsen Taheriyan Semantic Search on FOAF profiles.
 Copyright 2005 Digital Enterprise Research Institute. All rights reserved. 1 The Architecture of a Large-Scale Web Search and Query Engine.
NaLIX: A Generic Natural Language Search Environment for XML Data Presented by: Erik Mathisen 02/12/2008.
1 COS 425: Database and Information Management Systems XML and information exchange.
Dr. Jim Bowring Computer Science Department College of Charleston CSIS 690 (633) May Evening 2009 Semantic Web Principles and Practice Class 4: 20 May.
XML –Query Languages, Extracting from Relational Databases ADVANCED DATABASES Khawaja Mohiuddin Assistant Professor Department of Computer Sciences Bahria.
Ontology translation: two approaches Xiangkui Yao OntoMorph: A Translation System for Symbolic Knowledge By: Hans Chalupsky Ontology Translation on the.
Overview of Search Engines
Axel Polleres Siemens AG Querying and Exchanging XML and RDF on the Web with XSPARQL (most slides taken from WWW’2012 Tutorial) This tutorial presents.
Semantic Web Andrejs Lesovskis. Publishing on the Web Making information available without knowing the eventual use; reuse, collaboration; reproduction.
CSC 8310 Programming Languages Meeting 2 September 2/3, 2014.
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.
Managing Large RDF Graphs (Infinite Graph) Vaibhav Khadilkar Department of Computer Science, The University of Texas at Dallas FEARLESS engineering.
 Copyright 2009 Digital Enterprise Research Institute. All rights reserved Digital Enterprise Research Institute Semantic Search for CMS IKS.
Rajashree Deka Tetherless World Constellation Rensselaer Polytechnic Institute.
SPARQL All slides are adapted from the W3C Recommendation SPARQL Query Language for RDF Web link:
Lecture 21 XML querying. 2 XSL (eXtensible Stylesheet Language) In HTML, default styling is built into browsers as tag set for HTML is predefined and.
Comparing XSLT and XQuery Michael Kay XTech 2005.
Introduction to SPARQL. Acknowledgements This presentation is based on the W3C Candidate Recommendation “SPARQL Query Language for RDF” from
The Semantic Web Web Science Systems Development Spring 2015.
Chapter 3 Querying RDF stores with SPARQL. Why an RDF Query Language? Why not use an XML query language? XML at a lower level of abstraction than RDF.
Copyright © Orbeon, Inc. All rights reserved. Erik Bruchez Applications of XML Pipelines XML Prague, June 16 th, 2007.
JSTL, XML and XSLT An introduction to JSP Standard Tag Library and XML/XSLT transformation for Web layout.
Complex Data Transformations in Digital Libraries with Spatio-Temporal Information B. Martins, N. Freire, J. Borbinha Instituto Superior Técnico, Technical.
Chapter 27 The World Wide Web and XML. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.27-2 Topics in this Chapter The Web and the Internet.
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.
XML Presented by Kushan Athukorala. 2 Agenda XML Overview Entity References Elements vs. Atributes XML Validation DTD XML Schema Linking XML and CSS XSLT.
User Profiling using Semantic Web Group members: Ashwin Somaiah Asha Stephen Charlie Sudharshan Reddy.
 Copyright 2005 Digital Enterprise Research Institute. All rights reserved. 1 A Sitemap extension to enable efficient interaction with large.
ESIP Semantic Web Products and Services ‘triples’ “tutorial” aka sausage making ESIP SW Cluster, Jan ed.
Ontology based e-Real Estate Agency Information System By Moein Mehrolhasani Bijan Zamanian cmpe 588.
05/01/2016 SPARQL SPARQL Protocol and RDF Query Language S. Garlatti.
Chapter 3 Querying RDF stores with SPARQL
THE SEMANTIC WEB By Conrad Williams. Contents  What is the Semantic Web?  Technologies  XML  RDF  OWL  Implementations  Social Networking  Scholarly.
CC L A W EB DE D ATOS P RIMAVERA 2015 Lecture 7: SPARQL (1.0) Aidan Hogan
 XML derives its strength from a variety of supporting technologies.  Structure and data types: When using XML to exchange data among clients, partners,
XML Extensible Markup Language
The AstroGrid-D Information Service Stellaris A central grid component to store, manage and transform metadata - and connect to the VO!
Information Retrieval in Practice
XML: Extensible Markup Language
CC La Web de Datos Primavera 2017 Lecture 7: SPARQL [i]
Search Engine Architecture
SPARQL SPARQL Protocol and RDF Query Language
Logics for Data and Knowledge Representation
CC La Web de Datos Primavera 2016 Lecture 7: SPARQL (1.0)
CC La Web de Datos Primavera 2018 Lecture 8: SPARQL [1.1]
Logics for Data and Knowledge Representation
Presentation transcript:

 Copyright 2010 Digital Enterprise Research Institute. All rights reserved. Digital Enterprise Research Institute Transforming between RDF and XML with XSPARQL Nuno Lopes, Axel Polleres

Digital Enterprise Research Institute XSPARQL: Close the gap in the Web of Data 2 SOAP/WSDL RSS HTML SPARQL XSLT/XQuery XSPARQL

Digital Enterprise Research Institute 33 W3C Member Submission Supported by: DERI CTIC INRIA UIBK Asemantics S.R.L

Digital Enterprise Research Institute This talk How can YOU use XSPARQL for handling XML and RDF data What happened since 2009 What’s next in XSPARQL 4

Digital Enterprise Research Institute A Sample Scenario… 5

Digital Enterprise Research Institute Example: Favourite artists location 6 Using RDF allows to combine Last.fm info with other information on the web, e.g. location. Last.fm knows what music you listen to, your most played artists, etc. Display information about your favourite artists on a map Show your top bands hometown in Google Maps.

Digital Enterprise Research Institute 1) Get your favourite bands Example: Favourite artists location How to implement the visualisation? 7 Last.fm shows your most listened bands 2) Get the hometown of the bands 3) Create a KML file to be displayed in Google Maps Last.fm API: Last.fm is not so useful in this step

Digital Enterprise Research Institute 1) Get your favourite bands Example: Favourite artists location How to implement the visualisation? 8 2) Get the hometown of the bands 3) Create a KML file to be displayed in Google Maps SPARQL XML Res SPARQL ? XQuery

Digital Enterprise Research Institute Transformation and Query Languages 9 XSLT XML Transformation Language Syntax: XML XPath is the common core Mostly used to select nodes from an XML doc SPARQL Query Language for RDF Pattern based declarative RDF world XML world SPARQL XML Result format RDF/XML… ambiguous XQuery XML Query Language non-XML syntax

Digital Enterprise Research Institute Background: Existing languages (XPath, XQuery and SPARQL) 10

Digital Enterprise Research Institute Background: XML & XPath 11 Therion Nightwish Last.fm API format: root element: “lfm”, then “topartists” sequence of “artist” XPath steps: /lfm Selects the “lfm” root element //artist Selects all the “artist” elements XPath Predicates: = 1] Selects the “artist” with rank 1 Querying this document with XPath:

Digital Enterprise Research Institute Background: XQuery overview let $doc := " for $artist in doc($doc)//artist where = 2] return {$artist} 12 Query: Retrieve information regarding a users' top artists from the Last.fm API assign values to variables iterate over sequences filter expressions create XML elements

Digital Enterprise Research Institute Background: DBPedia RDF dbpedia-owl:. dbpedia:Nightwish dbpprop:origin "Kitee, ; dbpedia-owl:hometown dbpedia:Kitee, dbpedia:Finland. Excerpt from: RDF data from DBPedia describing artists:

Digital Enterprise Research Institute Background: SPARQL prefix dbprop: select $origin from where { $artist dbprop:origin $origin } limit 1 14 Prefix declarations construct RDF Graphs Solution modifiers Data to be queried pattern to be matched against data Query: Retrieve the origin of an artist from DBPedia prefix dbprop: prefix foaf: construct { $artist foaf:based_near $origin } from where { $artist dbprop:origin $origin } limit 1 SELECT

Digital Enterprise Research Institute One language to bind them all: XSPARQL 15

Digital Enterprise Research Institute XSPARQL Transformation language Consume and generate XML and RDF Syntactic extension of XQuery, ie. XSPARQL = XQuery + SPARQL 16

Digital Enterprise Research Institute Data Input (XML or RDF) XSPARQL: Syntax overview (I) 17 Prefix declarations Data Output (XML or RDF)

Digital Enterprise Research Institute SPARQLFOR Clause represents a SPARQL query 18 XSPARQL Syntax overview (II) 18 XQuery or SPARQL prefix declarations Any XQuery query construct allows to create RDF

Digital Enterprise Research Institute Use case 19

Digital Enterprise Research Institute XSPARQL: Convert XML to RDF prefix lastfm: let $doc := " for $artist in doc($doc)//artist where < 6] construct { [] lastfm:topArtist {$artist//name}; lastfm:artistRank } lastfm:. [ lastfm:topArtist "Therion" ; lastfm:artistRank "1" ]. [ lastfm:topArtist "Nightwish" ; lastfm:artistRank "2" ]. [ lastfm:topArtist "Blind Guardian" ; lastfm:artistRank "3" ]. [ lastfm:topArtist "Rhapsody of Fire" ; lastfm:artistRank "4" ]. [ lastfm:topArtist "Iced Earth" ; lastfm:artistRank "5" ]. Result: Query: Convert Last.fm top artists of a user into RDF construct generates valid Turtle RDF

Digital Enterprise Research Institute Use case 21

Digital Enterprise Research Institute XSPARQL: Integrate RDF sources prefix dbprop: prefix foaf: construct { $artist foaf:based_near $origin } from where { $artist dbprop:origin $origin } 22 Issue: determining the artist identifiers Query: Retrieve the origin of an artist from DBPedia: Same as the SPARQL query DBPedia does not have the map coordinates

Digital Enterprise Research Institute XSPARQL: Integrate RDF sources 23 Query: Retrieve the origin of an artist from DBPedia including map coordinates DBPedia does not have the map coordinates prefix wgs84_pos: prefix dbprop: for * from where { $artist dbprop:origin $origin } return let $hometown := fn:concat(" for * from $hometown where { [] wgs84_pos:lat $lat; wgs84_pos:long $long } limit 1 construct { $artist wgs84_pos:lat $lat; wgs84_pos:long $long }

Digital Enterprise Research Institute Use case 24

Digital Enterprise Research Institute Output: KML XML format 25 Hometown of Nightwish 30.15,62.1,0 KML format: root element: “kml”, then “Document” sequence of “Placemark” Each “Placemark” contains: “Name” element “Point” element with the “coordinates”

Digital Enterprise Research Institute prefix dbprop: { let $doc := " for $artist in doc($doc)//artist return let $artistName := fn:data($artist//name) let $uri := fn:concat(" $artistName) for $origin from $uri where { [] dbprop:origin $origin } return let $hometown := fn:concat(" fn:encode-for-uri($origin)) for * from $hometown where { [] wgs84_pos:lat $lat; wgs84_pos:long $long } limit 1 return {fn:concat("Hometown of ", $artistName)} {fn:concat($long, ",", $lat, ",0")} } XSPARQL: Putting it all together 26 Query: Display top artists origin in a map

Digital Enterprise Research Institute XSPARQL: Demo 27

Digital Enterprise Research Institute XSPARQL: more examples 28

Digital Enterprise Research Institute XSPARQL: Convert FOAF to KML RDF (FOAF) data representing your location … in different ways Show this information in a Google Map embedded in your webpage 29 Demo at:

Digital Enterprise Research Institute prefix foaf: prefix geo: { for $name $long $lat from where { $person a foaf:Person; foaf:name $name; foaf:based_near [ a geo:Point; geo:long $long; geo:lat $lat ] } return {fn:concat("Location of ", $name)} {fn:concat($long, ",", $lat, ",0")} } Display location in Google Maps based on your FOAF file XSPARQL: Convert FOAF to KML

Digital Enterprise Research Institute XSPARQL: Convert FOAF to KML Different location representation in different foaf files… 31 prefix foaf: prefix georss: { for * from where { $person a foaf:Person; foaf:name $name; foaf:based_near $point. } return for * from $point where { $c georss:point $latLong } return let $coordinates := fn:tokenize($latLong, " ") let $lat1 := $coordinates[1] let $long1 := $coordinates[2] return {fn:concat("Location of ", $name)} {fn:concat($long1, ",", $lat1, ",0")} } We can handle different representations of locations in the FOAF files

Digital Enterprise Research Institute XSPARQL: Convert FOAF to KML you can cater for different representations in one query… Previous 2 queries can be easily combined into one… see:

Digital Enterprise Research Institute Obtaining locations in RDF prefix foaf: prefix geo: prefix kml: let $loc := "Hilton San Francisco Union Square, San Francisco, CA" for $place in doc(fn:concat(" fn:encode-for-uri($loc), ”&num=1&output=kml")) let $geo := fn:tokenize($place//kml:coordinates, ",") construct { foaf:based_near [ geo:long {$geo[1]}; geo:lat {$geo[2]} ] } 33  Update or enhance your FOAF file with your current location based on a Google Maps kml:. foaf:based_near [ geo:long " " ; geo:lat " " ]. Result: Find the location in Google Maps and get the result as KML

Digital Enterprise Research Institute Classes { for * from where { $class a owl:Class; rdfs:label $label; rdfs:comment $comment. } return {$label} {$comment} } Properties { for * from where { $prop a rdf:Property; rdfs:label $lbl; rdfs:comment $commnt. } return {$lbl} {$commnt} } Ontology Documentation in HTML Given an ontology you can generate an XHTML describing it… 34 Use case and query by Henry Story

Digital Enterprise Research Institute XSPARQL vs. SPARQL for “pure RDF” queries 35

Digital Enterprise Research Institute Extending SPARQL1.0: Computing values prefix foaf: prefix geo: prefix : construct { $person :latLong $lat; :latLong $long } from where { $person a foaf:Person; foaf:name $name; foaf:based_near [ geo:long $long; geo:lat $lat ] } Computing values is not possible in SPARQL 1.0: prefix foaf: prefix geo: prefix : construct { $person :latLong {fn:concat($lat, " ”, $long }} from where { $person a foaf:Person; foaf:name $name; foaf:based_near [ geo:long $long; geo:lat $lat ] } While XSPARQL allows to use all the XPath functions: 36 Note: SPARQL1.1 allow that (BIND/LET), see Andy’s tutorial (yesterday)!

Digital Enterprise Research Institute Federated Queries in SPARQL PREFIX dbpedia2: PREFIX foaf: SELECT ?N ?MyB FROM { [ foaf:birthday ?MyB ]. SERVICE { SELECT ?N WHERE { [ dbpedia2:born ?B; foaf:name ?N ]. FILTER ( Regex(Str(?B),str(?MyB)) ) } } } Find which persons in DBPedia have the same birthday as Axel (foaf-file): SPARQL 1.1 has new feature SERVICE to query remote endpoints PREFIX dbpedia2: PREFIX foaf: SELECT ?N ?MyB FROM { [ foaf:birthday ?MyB ]. SERVICE { SELECT ?N WHERE { [ dbpedia2:born ?B; foaf:name ?N ]. FILTER ( Regex(str(?B),str(?MyB)) ) } } } Doesn’t work!!! ?MyB unbound in SERVICE query

Digital Enterprise Research Institute Federated Queries in SPARQL PREFIX dbpedia2: PREFIX foaf: SELECT ?N ?MyB FROM { [ foaf:birthday ?MyB ]. SERVICE { SELECT ?N WHERE { [ dbpedia2:born ?B; foaf:name ?N ]. FILTER ( Regex(Str(?B),str(?MyB)) ) } } } Find which persons in DBPedia have the same birthday as Axel (foaf-file): SPARQL 1.1 has new feature SERVICE to query remote endpoints PREFIX dbpedia2: PREFIX foaf: SELECT ?N ?MyB FROM { [ foaf:birthday ?MyB ]. SERVICE { SELECT ?N WHERE { [ dbpedia2:born ?B; foaf:name ?N ]. } } FILTER ( Regex(Str(?B),str(?MyB)) ) } Doesn’t work either in practice  as SERVICE endpoint only returns limited results…

Digital Enterprise Research Institute Federated Queries 39 prefix dbprop: prefix foaf: prefix : let $MyB := for * from where { [ foaf:birthday $B ]. } return $B for * from endpoint where { [ dbprop:born $B; foaf:name $N ]. filter ( regex(str($B),str($MyB)) ) } construct { :axel :sameBirthDayAs $N } Specifies the endpoint to perform the query, similar to SERVICE in SPARQL1.1 Find which persons in DBPedia have the same birthday as Axel (foaf-file): In XSPARQL: Works! In XSPARQL bound values (?MyDB) are injected into the SPARQL subquery  More direct control over “query execution plan”

Digital Enterprise Research Institute XSPARQL: next steps 40

Digital Enterprise Research Institute Next Steps: Relational databases 41 Integrating SQL in XSPARQL  XSPARQL + SQL (subset) Transform relational data into XML or RDF  RDB2RDF prefix lastfm: for topArtists.artist as $artist, topArtists.rank as $rank from topArtists where topArtists.rank < 6 construct { [] lastfm:topArtist $artist; lastfm:artistRank $rank. } Query: Convert top artists of a user into RDF. Data stored in an RDB relation “topArtists”. Prototype coming out soon!

Digital Enterprise Research Institute New features & Next Steps New features we didn’t talk about:  Assign Graphs to variables  Dataset-scoping in nested Queries Further Next steps: Optimisations SPARQL 1.1 JSON  Most Web APIS are exposing data as JSON 42

Digital Enterprise Research Institute Conclusions 43 XSPARQL can easily integrate XML and RDF sources Beyond the expressiveness of SPARQL 1.0 (and partially also SPARQL 1.1) More features on the way (RDB, JSON) Check our webpage for XSPARQLer engine (BSD licence) and demos at

Digital Enterprise Research Institute XSPARQL: further details 44

Digital Enterprise Research Institute Implementation 45 Each XSPARQL query is translated into an XQuery SPARQLForClauses are translated into SPARQL SELECT clauses Uses off the shelf components: XQuery engine: Saxon SPARQL engine: Jena / ARQ