Multi-agent and Semantic Web Systems: Querying

Similar documents
Semantic Web Systems Querying Jacques Fleuriot School of Informatics

Query. Ewan Klein. MASWS 12 February Multi-agent Semantic Web Systems: Query. Ewan Klein. Outline. Introduction RSS.

Multi-agent and Semantic Web Systems: Linked Open Data

The Semantic Web. What is the Semantic Web?

Multi-agent and Semantic Web Systems: RDF Data Structures

COMPUTER AND INFORMATION SCIENCE JENA DB. Group Abhishek Kumar Harshvardhan Singh Abhisek Mohanty Suhas Tumkur Chandrashekhara

Semantic Web Information Management

Implementing and extending SPARQL queries over DLVHEX

SPARQL Protocol And RDF Query Language

Multi-agent Semantic Web Systems: RDF Models

Lars Schmidt-Thieme, Information Systems and Machine Learning Lab (ISMLL), University of Hildesheim, Germany, Course on XML and Semantic Web

INF3580/4580 Semantic Technologies Spring 2015

SPARQL. Dr Nicholas Gibbins

Querying the Semantic Web

SPARQL QUERY LANGUAGE WEB:

RDF. Charlie Abela Department of Artificial Intelligence

KNOWLEDGE GRAPHS. Lecture 4: Introduction to SPARQL. TU Dresden, 6th Nov Markus Krötzsch Knowledge-Based Systems

Description Set Profiles: A constraint language for Dublin Core Application Profiles

XML and Semantic Web Technologies. III. Semantic Web / 3. SPARQL Query Language for RDF

Semantic Web Fundamentals

Chapter 3 Querying RDF stores with SPARQL

Quang Vu DANG. Computer Science Department Institut Telecom SudParis

From the Web to the Semantic Web: RDF and RDF Schema

Today s Plan. INF3580/4580 Semantic Technologies Spring Reminder: RDF triples. Outline. Lecture 4: The SPARQL Query Language.

BASI DI DATI II 2 modulo Parte VIII: SPARQL

Incremental Export of Relational Database Contents into RDF Graphs

Enabling Semantic Web Programming by Integrating RDF and Common Lisp

infoh509 xml & web technologies lecture 9: sparql Stijn Vansummeren February 14, 2017

Winter Lecture 4

RDF AND SPARQL. Part IV: Syntax of SPARQL. Dresden, August Sebastian Rudolph ICCL Summer School

INF3580/4580 Semantic Technologies Spring 2017

MI-PDB, MIE-PDB: Advanced Database Systems

> Semantic Web Use Cases and Case Studies

An overview of RDB2RDF techniques and tools

On the Semantics of Heterogeneous Querying of Relational, XML and RDF Data with XSPARQL

Using RDF to Model the Structure and Process of Systems

XML Perspectives on RDF Querying: Towards integrated Access to Data and Metadata on the Web

RDF. Mario Arrigoni Neri

Answering Aggregate Queries Over Large RDF Graphs

Querying Semantic Web Data

From Raw Sensor Data to Semantic Web Triples Information Flow in Semantic Sensor Networks

Linked Data: What Now? Maine Library Association 2017

Finding Similarity and Comparability from Merged Hetero Data of the Semantic Web by Using Graph Pattern Matching

RSS - VERSION 1.0 TAGS AND SYNTAX

The SBML Level 3 Annotation package: an initial proposal

Semantic Web and Linked Data

Why You Should Care About Linked Data and Open Data Linked Open Data (LOD) in Libraries

Chapter 13: Advanced topic 3 Web 3.0

Two hours UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE. Date: Wednesday 23rd May 2018 Time: 14:00-16:00. Please answer all Questions.

Semantic Web Technologies: Assignment 1. Axel Polleres Siemens AG Österreich

SPARQL By Example: The Cheat Sheet

KNOWLEDGE GRAPHS. Lecture 2: Encoding Graphs with RDF. TU Dresden, 23th Oct Markus Krötzsch Knowledge-Based Systems

Outline RDF. RDF Schema (RDFS) RDF Storing. Semantic Web and Metadata What is RDF and what is not? Why use RDF? RDF Elements

Semantic Web Fundamentals

Library of Congress BIBFRAME Pilot. NOTSL Fall Meeting October 30, 2015

SPARQL. Fausto Giunchiglia and Mattia Fumagallli. University of Trento

Semantic Web Technologies

Representing Linked Data as Virtual File Systems

Knowledge Representation for the Semantic Web

Semantic Web and Python Concepts to Application development

Semantic Web Solutions

Linked data and its role in the semantic web. Dave Reynolds, Epimorphics

Day 2. RISIS Linked Data Course

Multi-agent Semantic Web Systems: Data & Metadata

Nested Queries in SPARQL

SPARQL Protocol And RDF Query Language

Mozilla XUL Templates rule language

Interacting with Linked Data Part I: General Introduction

RESOURCES DESCRIPTION FRAMEWORK: RDF

Introduction to RDF and the Semantic Web for the life sciences

Semistructured Data and XML

Querying RDF & RDFS. Several query languages exist to retrieve

Flat triples approach to RDF graphs in JSON

Web 2.0, AJAX and RIAs

Package rrdf. R topics documented: February 15, Type Package

Semantic Days 2011 Tutorial Semantic Web Technologies

Contents. G52IWS: The Semantic Web. The Semantic Web. Semantic web elements. Semantic Web technologies. Semantic Web Services

Semantic Web Technologies: Theory & Practice. Axel Polleres Siemens AG Österreich

Processing ontology alignments with SPARQL

BUILDING THE SEMANTIC WEB

H2 Spring B. We can abstract out the interactions and policy points from DoDAF operational views

COMP9321 Web Application Engineering

Testbed-12 CITE User Guide - Profiles

Semantic Web Systems Web Services Part 2 Jacques Fleuriot School of Informatics

Linked Data in the Clouds : a Sindice.com perspective

Reminder: RDF triples

Semantic Web. Querying on the Web: XQuery, RDQL, SparQL. Morteza Amini. Sharif University of Technology Fall 94-95

COMP9321 Web Application Engineering

Filter: Evaluable Expression. List Syntax. Tests. Filter: Evaluable Expression. Tests : functions. Tests 06/09/2013. (1?x v )

SPARQL Back-end for Contextual Logic Agents

COMP9321 Web Application Engineering

Today s Plan. 1 Repetition: RDF. 2 Jena: Basic Datastructures. 3 Jena: Inspecting Models. 4 Jena: I/O. 5 Example. 6 Jena: ModelFactory and ModelMaker

Mapping SPARQL and SQL to XQuery

Querying Description Logics

SEMANTIC WEB AN INTRODUCTION. Luigi De

Semantic Web Systems Linked Open Data Jacques Fleuriot School of Informatics

The Semantic Web Revisited. Nigel Shadbolt Tim Berners-Lee Wendy Hall

Efficient, Scalable, and Provenance-Aware Management of Linked Data

Linked Stream Data Processing Part I: Basic Concepts & Modeling

Semantic Web Programming

Transcription:

Multi-agent and Semantic Web Systems: Querying Fiona McNeill School of Informatics 11th February 2013 Fiona McNeill Multi-agent Semantic Web Systems: Querying 11th February 2013 0/30

Contents This lecture will discuss two kinds of querying: querying with XML querying with SPARQL Fiona McNeill Multi-agent Semantic Web Systems: Querying 11th February 2013 1/30

Storing RDF flat file easy, but doesn t scale triplestore database that is customized for storing triples large triplestores measured in terms of billions see http://en.wikipedia.org/wiki/triplestore for list of current technologies We have a local data repository http://data.inf.ed.ac.uk uses that 4store (http://www.4store.org/) Fiona McNeill Multi-agent Semantic Web Systems: Querying 11th February 2013 2/30

Querying RDF Data Querying is crucial to being able to use RDF data. Allows data across different data repositories to be combined. Allows selected data to be re-used and re-presented. Compare XML and SPARQL. Fiona McNeill Multi-agent Semantic Web Systems: Querying 11th February 2013 3/30

Node Tree for a del.icio.us RSS Feed rss:title text: del.icio.us/recent?min=2 rss:channel rss:link text: http://del.icio.us/recent %3Fmin%3D2... rdf:rdf rss:title text: SimpleFlickr Plugin... rss:item rss:link... rdf:li text: http://www.joshgerdes.com attribute: rdf:resource dc:topics rdf:bag rdf:li attribute: rdf:resource rss:item rdf:li attribute: rdf:resource... Fiona McNeill Multi-agent Semantic Web Systems: Querying 11th February 2013 4/30

Pick a path through XML tree A path expression: /rdf:rdf/rss:item/dc:topics/rdf:bag/rdf:li Fiona McNeill Multi-agent Semantic Web Systems: Querying 11th February 2013 5/30

Pick a path through XML tree A path expression: /rdf:rdf/rss:item/dc:topics/rdf:bag/rdf:li Reading from right to left: Fiona McNeill Multi-agent Semantic Web Systems: Querying 11th February 2013 5/30

Pick a path through XML tree A path expression: /rdf:rdf/rss:item/dc:topics/rdf:bag/rdf:li Reading from right to left: Select every node with tag rdf:li Fiona McNeill Multi-agent Semantic Web Systems: Querying 11th February 2013 5/30

Pick a path through XML tree A path expression: /rdf:rdf/rss:item/dc:topics/rdf:bag/rdf:li Reading from right to left: Select every node with tag rdf:li that s the direct child of an rdf:bag element Fiona McNeill Multi-agent Semantic Web Systems: Querying 11th February 2013 5/30

Pick a path through XML tree A path expression: /rdf:rdf/rss:item/dc:topics/rdf:bag/rdf:li Reading from right to left: Select every node with tag rdf:li that s the direct child of an rdf:bag element that s the direct child of a dc:topics element Fiona McNeill Multi-agent Semantic Web Systems: Querying 11th February 2013 5/30

Pick a path through XML tree A path expression: /rdf:rdf/rss:item/dc:topics/rdf:bag/rdf:li Reading from right to left: Select every node with tag rdf:li that s the direct child of an rdf:bag element that s the direct child of a dc:topics element that s the direct child of an rss:item element Fiona McNeill Multi-agent Semantic Web Systems: Querying 11th February 2013 5/30

Pick a path through XML tree A path expression: /rdf:rdf/rss:item/dc:topics/rdf:bag/rdf:li Reading from right to left: Select every node with tag rdf:li that s the direct child of an rdf:bag element that s the direct child of a dc:topics element that s the direct child of an rss:item element that s the direct child of the rdf:rdf element Fiona McNeill Multi-agent Semantic Web Systems: Querying 11th February 2013 5/30

Pick a path through XML tree A path expression: /rdf:rdf/rss:item/dc:topics/rdf:bag/rdf:li Reading from right to left: Select every node with tag rdf:li that s the direct child of an rdf:bag element that s the direct child of a dc:topics element that s the direct child of an rss:item element that s the direct child of the rdf:rdf element at the root of the document ( / ). Fiona McNeill Multi-agent Semantic Web Systems: Querying 11th February 2013 5/30

The path through the node tree rss:title text: del.icio.us/recent?min=2 rss:channel rss:link text: http://del.icio.us/recent %3Fmin%3D2... rdf:rdf rss:title text: SimpleFlickr Plugin... rss:item rss:link... rdf:li text: http://www.joshgerdes.com attribute: rdf:resource dc:topics rdf:bag rdf:li attribute: rdf:resource rss:item rdf:li attribute: rdf:resource... Fiona McNeill Multi-agent Semantic Web Systems: Querying 11th February 2013 6/30

Remarks on XML query Basic idea: search along paths in an XML tree. XPath provides an exact syntax for this. Most modern programming languages provide rich support for XML parsing and querying. Requires you know how data is encoded in the XML document. Fiona McNeill Multi-agent Semantic Web Systems: Querying 11th February 2013 7/30

RDF Query Make use of the graph model, not the (XML) serialisation. At least half a dozen competing proposals during approx 10 year period: Path-based query SQL-like pattern matching SPARQL is now the standard approach, and is 2nd type of language. Fiona McNeill Multi-agent Semantic Web Systems: Querying 11th February 2013 8/30

SPARQL overview SPARQL Query result set Fiona McNeill Multi-agent Semantic Web Systems: Querying 11th February 2013 9/30

SPARQL overview Local file / Remote file (HTTP URI) / SPARQL Endpoint SPARQL Query result set Fiona McNeill Multi-agent Semantic Web Systems: Querying 11th February 2013 10/30

SPARQL overview Local file / Remote file (HTTP URI) / SPARQL Endpoint SPARQL Query ARQ result set Fiona McNeill Multi-agent Semantic Web Systems: Querying 11th February 2013 11/30

SPARQL query example Fiona McNeill Multi-agent Semantic Web Systems: Querying 11th February 2013 12/30

SPARQL components 1. Basic graph pattern matching 2. Graph expressions 3. Solution modifiers Fiona McNeill Multi-agent Semantic Web Systems: Querying 11th February 2013 13/30

Basic graph patterns (BGPs) Basic graph patterns are a block of adjacent triple patterns that match, or don t match, all together. Every named variable must receive some value for the pattern to have been matched. Filters add restrictions on the values variables can take. Fiona McNeill Multi-agent Semantic Web Systems: Querying 11th February 2013 14/30

Graph expressions Graph expressions: OPTIONAL, UNION, GRAPH, groups (things between {}) Combine BGPs in various ways to give more complicated patterns. Graph expressions are recursive so you can have patterns within patterns. A SPARQL query has one graph expression in the WHERE clause. Fiona McNeill Multi-agent Semantic Web Systems: Querying 11th February 2013 15/30

Solution modifiers Solution modifiers: DISTINCT, ORDER BY, LIMIT/OFFSET Apply to output of matching the query graph pattern; process it in various ways to yield the result set. Fiona McNeill Multi-agent Semantic Web Systems: Querying 11th February 2013 16/30

Patterns Based on triples. Combination of URIs/QNames, literals and variables. Variable names:?var, $var cannot start with an integer, or contain :, - or.. Fiona McNeill Multi-agent Semantic Web Systems: Querying 11th February 2013 17/30

Small FOAF file Fiona McNeill Multi-agent Semantic Web Systems: Querying 11th February 2013 18/30

SELECT example Run query against the RDF data to be found at URI. URI has to be addressable via HTTP when the query is executed. Fiona McNeill Multi-agent Semantic Web Systems: Querying 11th February 2013 19/30

Result Set ------------------- name ===================== Ewan Klein Harry Halpin -------------------- Fiona McNeill Multi-agent Semantic Web Systems: Querying 11th February 2013 20/30

Matching Query matches the graph: find a set of variable value bindings, such that result of replacing variables by values is a triple in the graph. Solution1: variable?x has value blank node _:a and variable?name has value Ewan Triple (_:a foaf:name Ewan ) is in the graph. Solution 2: variable?x has value blank node _:b and variable?name has value Harry Triple (_:b foaf:name Harry ) is in the graph. Fiona McNeill Multi-agent Semantic Web Systems: Querying 11th February 2013 21/30

Multiple patterns get name1 and name2 where person1 knows person2, and person1 has name1 and person2 had name2 Fiona McNeill Multi-agent Semantic Web Systems: Querying 11th February 2013 22/30

Result set ---------------------------------------- name1 name2 ======================================== Ewan Klein Harry Halpin ---------------------------------------- Fiona McNeill Multi-agent Semantic Web Systems: Querying 11th February 2013 23/30

More on patterns Dots. separate patterns in the query. Can use N3 abbreviatory syntax in Basic Graph Patterns Fiona McNeill Multi-agent Semantic Web Systems: Querying 11th February 2013 24/30

Multiple data sources NB: Multiples FROM clauses allowed in a query. Fiona McNeill Multi-agent Semantic Web Systems: Querying 11th February 2013 25/30

Multiple data sources Fiona McNeill Multi-agent Semantic Web Systems: Querying 11th February 2013 26/30

Multiple data sources Create models from the data sets; merge the models; run query against model. Fiona McNeill Multi-agent Semantic Web Systems: Querying 11th February 2013 27/30

SPARQL query forms SELECT: Like SQL; returns a tuple of values. CONSTRUCT: Builds a new graph by inserting values into a triple pattern. ASK: Asks whether a query has a solution in a graph. Fiona McNeill Multi-agent Semantic Web Systems: Querying 11th February 2013 28/30

Conclusions XML-based query depends on paths through the node tree. SPARQL matches triple patterns in the RDF graph. XML-based query depends on knowing the syntactic structure of the serialisation. There are different but equivalent serialisations of RDF in XML; these would require different XML queries. SPARQL query depends on knowing the graph structure of the RDF store. There are different but equivalent serialisations of RDF (in XML, N3,...); these can all be matched using the same SPARQL query. Fiona McNeill Multi-agent Semantic Web Systems: Querying 11th February 2013 29/30

Task Using your rdf dataset, think up some SPAQRL queries which could be run on it. What would the outcome be? Fiona McNeill Multi-agent Semantic Web Systems: Querying 11th February 2013 30/30