Querying Description Logics

Similar documents
Orchestrating Music Queries via the Semantic Web

SEMANTIC WEB AND COMPARATIVE ANALYSIS OF INFERENCE ENGINES

Logical reconstruction of RDF and ontology languages

SPARQL Back-end for Contextual Logic Agents

Position Paper W3C Workshop on RDF Next Steps: OMG Ontology PSIG

Semantic Web Information Management

SPARQL Protocol And RDF Query Language

Querying the Semantic Web

Falcon-AO: Aligning Ontologies with Falcon

WSDL RDF Mapping. Jacek Kopecký 2005/12/14. Copyright 2005 Digital Enterprise Research Institute. All rights reserved.

Using RDF to Model the Structure and Process of Systems

Semantic Web and Linked Data

Semantic Web and Python Concepts to Application development

Day 2. RISIS Linked Data Course

Standardization of Ontologies

The Logic of the Semantic Web. Enrico Franconi Free University of Bozen-Bolzano, Italy

CHAPTER 1 INTRODUCTION

OWL a glimpse. OWL a glimpse (2) requirements for ontology languages. requirements for ontology languages

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

SPARQL-DL. Czech Technical University in Prague (CZ) April 2008

On Querying Ontologies with Contextual Logic Programming

Semantics. Matthew J. Graham CACR. Methods of Computational Science Caltech, 2011 May 10. matthew graham

OWL DL / Full Compatability

Linked Data Tutorial

Linked Data and RDF. COMP60421 Sean Bechhofer

Semantic Web Fundamentals

Linked Data and RDF. COMP60421 Sean Bechhofer

Chapter 3 Querying RDF stores with SPARQL

A short tutorial on rrdf

Building Blocks of Linked Data

Semantic Web Fundamentals

Vocabulary and Semantics in the Virtual Observatory

TrOWL: Tractable OWL 2 Reasoning Infrastructure

Semantic Web Systems Querying Jacques Fleuriot School of Informatics

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

Web Ontology for Software Package Management

Unit 1 a Bird s Eye View on RDF(S), OWL & SPARQL

Making BioPAX SPARQL

Unit 2 RDF Formal Semantics in Detail

BUILDING THE SEMANTIC WEB

Ontological Modeling: Part 2

A General Approach to Query the Web of Data

Implementing and extending SPARQL queries over DLVHEX

A Unified Logical Framework for Rules (and Queries) with Ontologies - position paper -

Answering Queries over OWL Ontologies with SPARQL

Multi-agent and Semantic Web Systems: Querying

An Introduction to the Semantic Web. Jeff Heflin Lehigh University

SWAD-Europe Deliverable 3.18: RDF Query Standardisation

Semantic Adaptation Approach for Adaptive Web-Based Systems

3. Queries Applied Artificial Intelligence Prof. Dr. Bernhard Humm Faculty of Computer Science Hochschule Darmstadt University of Applied Sciences

Representing Linked Data as Virtual File Systems

Racer: An OWL Reasoning Agent for the Semantic Web

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

Semantic representation of genetic circuit designs

Generating of RDF graph from a relational database using Jena API

Towards an Ontology-based Soil Information System

SPARQL QUERY LANGUAGE WEB:

Ontological Decision-Making for Disaster Response Operation Planning

Forward Chaining Reasoning Tool for Rya

The Formal Syntax and Semantics of Web-PDDL

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

Linked Data Practices for the Geospatial Community

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

Introduction. October 5, Petr Křemen Introduction October 5, / 31

2. Knowledge Representation Applied Artificial Intelligence

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

SPARQL Protocol And RDF Query Language

Recursion in RDF Data Shape Languages

SPARQL (RDF Query Language)

Apache Jena Framework. Philippe Genoud Université Joseph Fourier Grenoble (France)

Today: RDF syntax. + conjunctive queries for OWL. KR4SW Winter 2010 Pascal Hitzler 3

Representing and Querying Multiple Ontologies with Contextual Logic Programming

H1 Spring B. Programmers need to learn the SOAP schema so as to offer and use Web services.

Count Distinct Semantic Queries over Multiple Linked Datasets

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

Making Ontology Documentation with LODE

CycQL: A SPARQL Adapter for OpenCyc

The OWL API: An Introduction

SPARQL By Example: The Cheat Sheet

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

Web Ontology Language (OWL)

FedX: Optimization Techniques for Federated Query Processing on Linked Data. ISWC 2011 October 26 th. Presented by: Ziv Dayan

Modern Trends in Semantic Web

path-based language Versa (see XPath for RDF forward/backward traversal, filtering, but no support for restructuring/constructing

SWOOP. mindswap maryland information and network dynamics lab semantic web agents project

Temporal Reasoning for Supporting Temporal Queries in OWL 2.0

Semantic Web. MPRI : Web Data Management. Antoine Amarilli Friday, January 11th 1/29

Benchmarking DL Reasoners Using Realistic Ontologies

Semantics-Aware Querying of Web-Distributed RDF(S) Repositories

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

EQuIKa System: Supporting OWL applications with local closed world assumption

Semantic Technologies and CDISC Standards. Frederik Malfait, Information Architect, IMOS Consulting Scott Bahlavooni, Independent

References to Ontology Services

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

Introduction to Linked Data

ISA Action 1.17: A Reusable INSPIRE Reference Platform (ARE3NA)

Helmi Ben Hmida Hannover University, Germany

GraphOnto: OWL-Based Ontology Management and Multimedia Annotation in the DS-MIRF Framework

Deep integration of Python with Semantic Web technologies

An efficient SQL-based querying method to RDF schemata

Transcription:

Querying Description Logics Petr Křemen 1 SPARQL and Ontology Querying 1.1 SPARQL Query Structure SPARQL Language [SS13] is aimed at querying RDF(S) [GB04] documents. As OWL 2 [MPSP09] is an extension of RDF(S), we will use it here as a syntax for OWL 2 conjunctive queries. We will use SPARQL queries of the form PREFIX <prefix1>:<uri1> PREFIX <prefix2>:<uri2> SELECT <vars> <triple1>. <triple2>.... <triplen>. where <vars> is a list of variables (identifier started with a sign? ) delimited with spaces and <triplei> is a triple of the form subj pred obj, where each subj, pred and obj is either a variable, or individual URI (also in a shortened form using a PREFIX). Additionally, obj can be literal (string in double-quotes). 1.2 Expressing conjunctive queries in SPARQL syntax Example 1.1. Consider a conjunctive query (without full URIs) Q 1 (?X,?Y ) P rofessor(?x), worksf or(?x, CV UT ), name(?x,?y ). (1) Its SPARQL counterpart is : SELECT?X?Y 1

?X u:name?y. If we are not interested in the binding of the particular name Y, we would pose a conjunctive query Q 2 (?X) P rofessor(?x), worksf or(?x, CV UT ), name(?x,?y ) (2) To reflect this change in SPARQL, we could simply remove the variable from the SE- LECT clause, obtaining: SELECT?X?X u:name?y. However, this SPARQL query doesn t return individuals (bindings for?x) for which there is no name known, but their existence is inferred (e.g. i in axiom ( name )(i)). To capture all cases, we need to use a bnode instead of the (distinguished) variable: SELECT?X?X u:name _:Y. 1.3 Avoiding complex concepts in SPARQL To avoid rather complex RDF/XML syntax for complex OWL class descriptions in SPARQL queries, we can define a new concept in the description logic theory and query the new concept instead. Example 1.2. To express a conjunctive query, e.g. Q 2(?X) (P rofessor name )(?X), worksf or(?x, CV UT ), we will define a new concept P rofessorw ithname in the description logic theory (OWL Class in Protege): P rofessorw ithname P rofessor name 2

and reformulate the query into Queries Q 2 Q 2(?X) P rofessorw ithname(?x), worksf or(?x, CV UT ). and Q 2 are equivalent. For some more interesting SPARQL examples, refer to the last section of this document. 2 Conjunctive Queries Practically 1. Download Pellet 2.3.1 from the course web pages. 2. Pellet is a command-line tool. Use./pellet.sh help (or pellet.bat help) command to find out details about its usage. 3. Download the wine ontology from http://www.w3.org/tr/owl-guide/wine.rdf and save it into the Pellet home directory. 4. Open the wine ontology in Protege and insert a new instance of Wine into the ontology. 5. Download an example query from the seminar web pages. This query finds all wines (instances of Wine) : pellet.bat query -q <file-with-query> <file-with-ontology> 6. In the file with a query, replace the distinguished variable?y with an undistinguished variable :Y and compare results (use the --bnode switch for Pellet) 7. Check your result from the previous point to the that you got the same result as in the DL-query tab (How to formulate such query?). 8. Formulate and evaluate a query that finds all regions in USA together with dry wines produced in these regions. finds all regions in USA that produce both dry and sweet wines. 9. Insert a new type locatedin some Region to the individual ItalianRegion. Then, formulate a query that finds all wines that are produced in some (arbitrary) super-region of Italy (i.e. region in which ItalianRegion is located in (locatedin)). Use the --bnode parameter in the Pellet command line to correctly evaluate the query. 3

3 (OPTIONAL) SPARQL Queries on DBPedia DBPedia is imprecise, yet interesting data source. Use the http://dbpedia-live. openlinksw.com/sparql/ endpoint and pose the following queries. Ex. 1 Find all types (classes) of a Gray wolf in DBPedia. Answer (Ex. 1) SELECT DISTINCT? o <http : / / dbpedia. org / r e s o u r c e / Gray wolf> a?o Ex. 2 How many world countries have more than one official language? Answer (Ex. 2) SELECT count (? country ) SELECT DISTINCT? country, COUNT(? language )? country dbpedia owl : o f f i c i a l L a n g u a g e? language. GROUP BY? country HAVING COUNT(? language ) > 1 Ex. 3 Find five countries with the highest population. Answer (Ex. 3) SELECT DISTINCT? country? cnt? country a dbpedia owl : Country.? country dbpprop : populationcensus? cnt ORDER BY DESC(? cnt ) LIMIT 5 Ex. 4 Find all female ancestors of the Prince Charles. Answer (Ex. 4) SELECT 4

<http : / / dbpedia. org / r e s o u r c e / Charles, P r i n c e o f W a l e s > (<http : / / dbpedia. org / property /mother>)+? s. LIMIT 10 Reference [GB04] Ramanathan V. Guha and Dan Brickley. RDF Vocabulary Description Language 1.0: RDF Schema [online]. W3C Recommendation, W3C, 2004. Available at http://www.w3.org/tr/2004/rec-rdf-schema-20040210, cit. 11/1/2012. [MPSP09] Boris Motik, Peter F. Patel-Schneider, and Bijan Parsia. OWL 2 Web Ontology Language Structural Specification and Functional-Style Syntax [online]. W3C Recommendation, W3C, 2009. Available at http://www.w3.org/tr/ 2009/REC-owl2-syntax-20091027, cit. 11/1/2012. [SS13] Andy Seaborne and Harris Steve. SPARQL 1.1 query language [online]. W3C Recommendation, W3C, 2013. Available at http://www.w3.org/tr/ sparql11-query, cit. 1/4/2013. 5