Deep integration of Python with Semantic Web technologies

Similar documents
Table of Contents. iii

KDI OWL. Fausto Giunchiglia and Mattia Fumagallli. University of Trento

Short notes about OWL 1

Reasoning with the Web Ontology Language (OWL)

Semantic Web Technologies: Web Ontology Language

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

An Introduction to the Semantic Web. Jeff Heflin Lehigh University

The Semantic Web RDF, RDF Schema, and OWL (Part 2)

Web Ontology Language: OWL

Semantic Web. Ontology and OWL. Morteza Amini. Sharif University of Technology Fall 95-96

Making BioPAX SPARQL

Semantic Web Technologies: RDF + RDFS

Semantic Technologies

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

FOUNDATIONS OF SEMANTIC WEB TECHNOLOGIES

Efficient Querying of Web Services Using Ontologies

INF3580/4580 Semantic Technologies Spring 2017

INF3580 Semantic Technologies Spring 2012

Bryan Smith May 2010

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

Semantic Web Test

TMCL and OWL. Lars Marius Garshol. Bouvet, Oslo, Norway

LINKING BACKGROUND INFORMATION

An RDF-based Distributed Expert System

2. RDF Semantic Web Basics Semantic Web

Web Ontology Language: OWL

Web Data and Declarative Programming

Forward Chaining Reasoning Tool for Rya

Lecture 8 OWL: Web Ontology Language

Semantic Web in Depth: Web Ontology Language (OWL) Dr Nicholas Gibbins 32/3019

Main topics: Presenter: Introduction to OWL Protégé, an ontology editor OWL 2 Semantic reasoner Summary TDT OWL

Introducing Linked Data

Semantic Web In Depth: Resource Description Framework. Dr Nicholas Gibbins 32/4037

The OWL API: An Introduction

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

Integration of the Semantic Web with Meta Object Facilities

Semantic Technologies & Triplestores for BI

Scaling the Semantic Wall with AllegroGraph and TopBraid Composer. A Joint Webinar by TopQuadrant and Franz

Extracting Ontologies from Standards: Experiences and Issues

OWL DL / Full Compatability

Developing markup metaschemas to support interoperation among resources with different markup schemas

CSc 8711 Report: OWL API

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

Semantic Web and Linked Data

Semantic Web. RDF and RDF Schema. Morteza Amini. Sharif University of Technology Spring 90-91

DEVELOPING AN OWL ONTOLOGY FOR E- TOURISM

Limitations of the WWW

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

CC LA WEB DE DATOS PRIMAVERA Lecture 4: Web Ontology Language (I) Aidan Hogan

Short introduction to the Semantic Web

For return on 19 January 2018 (late submission: 2 February 2018)

Mustafa Jarrar: Lecture Notes on RDF Schema Birzeit University, Version 3. RDFS RDF Schema. Mustafa Jarrar. Birzeit University

Genea: Schema-Aware Mapping of Ontologies into Relational Databases

Web Ontology Language: OWL by Grigoris Antoniou Frank van Harmelen

Intelligent Agents. Pınar Yolum Utrecht University. Spring 2018 Pınar Yolum

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

XML and Semantic Web Technologies. III. Semantic Web / 1. Ressource Description Framework (RDF)

The Semantic Web. Mansooreh Jalalyazdi

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

Big Data 14. Graph Databases

Web Ontology Language: OWL

LECTURE 09 RDF: SCHEMA - AN INTRODUCTION

Building Blocks of Linked Data

FOUNDATIONS OF SEMANTIC WEB TECHNOLOGIES

Semantic Web and Python Concepts to Application development

Semantic Web Engineering

OSM Lecture (14:45-16:15) Takahira Yamaguchi. OSM Exercise (16:30-18:00) Susumu Tamagawa

Chapter 4 Web Ontology Language: OWL

Lecture 4: Reasoning

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

RDF Schema. Mario Arrigoni Neri

OWL-based reasoning with retractable inference

Publishing OWL ontologies with Presto

Linked data basic notions!

Metamodels for RDF Schema and OWL

Extracting knowledge from Ontology using Jena for Semantic Web

Open Geospatial Consortium Inc.

ROWLBAC Representing Role Based Access Control in OWL

Semantic Web Ontologies

Linguaggi Logiche e Tecnologie per la Gestione Semantica dei testi

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

RDF AND SPARQL. Part III: Semantics of RDF(S) Dresden, August Sebastian Rudolph ICCL Summer School

Formalising the Semantic Web. (These slides have been written by Axel Polleres, WU Vienna)

What is the Semantic Web?

Description Logic. Eva Mráková,

RDF /RDF-S Providing Framework Support to OWL Ontologies

FOUNDATIONS OF SEMANTIC WEB TECHNOLOGIES

Querying Data through Ontologies

Semantic Web Solutions

Adding formal semantics to the Web

12th ICCRTS. On the Automated Generation of an OWL Ontology based on the Joint C3 Information Exchange Data Model (JC3IEDM)

TopBraid Composer. Getting Started Guide. Version 5.2. September 21, TopBraid Composer, Copyright TopQuadrant, Inc.

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

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

SEMANTIC WEB 05 RDF SCHEMA MODELLING SEMANTICS IMRAN IHSAN ASSISTANT PROFESSOR, AIR UNIVERSITY, ISLAMABAD

ONTOLOGY QUERY LANGUAGES FOR THE SEMANTIC WEB: A PERFORMANCE EVALUATION ZHIJUN ZHANG. (Under the Direction of John.A.

Unit 2 RDF Formal Semantics in Detail

SEMANTIC WEB AN INTRODUCTION. Luigi De

08 OWL SEMANTIC WEB ONTOLOGY WEB LANGUAGE IMRAN IHSAN ASSISTANT PROFESSOR, AIR UNIVERSITY, ISLAMABAD

Schema-Agnostic Query Rewriting in SPARQL 1.1

Transcription:

Deep integration of Python with Semantic Web technologies Marian Babik, Ladislav Hluchy Intelligent and Knowledge Technologies Group Institute of Informatics, SAS

Goals of the presentation Brief introduction of Semantic Web technologies Introduce deep integration ideas Show initial implementation of the Python integrated with OWL Discuss architecture

Semantic Web Extension of the current Web, providing infrastructure for the integration of data on the Web Data should be available for further processing It should be possible to combine and merge data on a Web scale Metadata, reasoning Making data machine processable: Names for resources Common data model: RDF Access to the data: SPARQL, OWL-QL Define vocabularies: RDFS, OWL, SKOS Reasoning: OWL, Rules

Resource Description Framework (RDF) Based on triples (subject, predicate, object) Labelled connection btw. two resources (subject, object) Subject, predicate are URI-s; Object is URI (e.g. Subject) or Literal ( http://www.marianbabik.org, http://.../mycalendar, http://.../calendar ) (subject, predicate, object) can be seen as a labeled edge in a graph Serialization XML, Turtle, N3, etc.

RDF example Marian Babik s:hasname http://www.tuke.sk/fei-cit/babik s:haswritten http://www.semanticscrip /Paper1.pdf Turtle (N3) XML/RDF <rdf:description rdf:about="http://www.tuke.sk/fei-cit/babik"> <s:hasname>marian Babik</s:hasName> <s:haswritten rdf:resource="http://www.semanticscripting.org/sfsw2006/paper1.pdf"/> </rdf:description> <http://www.tuke.sk/fei-cit/babik> s:hasname Marian Babik ; s:haswritten <http://www.semanticscripting.org/sfsw2006/paper1.pdf>.

RDF Vocabulary Description Language (RDFS) RDF lacks vocabulary with semantic meaning RDFS defines resources and classes and relationships among classes/resource rdf:type, rdfs:class, rdfs:subclassof rdfs:subpropertyof, Resource may belong to several classes (range, domain) Special kind of type system

RDFS example #Person rdf:type rdfs:subclassof #John rdf:type #Man :Person rdfs:subclassof :Man. :John rdf:type :Man. <rdf:description rdf:id= John > </rdf:description> <rdf:type rdf:resource= Man /> <rdf:description rdf:id= Man > <rdfs:subclassof rdf:resource= Person /> </rdf:description>

RDFS example (2) :Person rdfs:subclassof :Man. :John rdf:type :Man. :isprogrammer rdf:type rdf:property; rdf:domain :Person; rdf:range rdfs:literal.

Web Ontology Language (OWL) RDFS doesn t solve all the issues Reasoning about terms Behavior of properties (symmetric, transitive, etc.) Cardinality constraints Equivalence of classes Enumeration (oneof), union of classes Datatype properties Compromise btw Rich semantics Feasibility, implementability Three layers: OWL-Lite, OWL-DL (based on Description Logic SHOIN(D)) OWL-Full (might be undecidable)

OWL-DL Class definition, axioms Complex class definitions based on the class descriptions Property definition, axioms RDF Schema constructs (rdfs:subpropertyof, rdfs:domain and rdfs:range) relations to other properties: owl:equivalentproperty and owl:inverseof) global cardinality constraints: owl:functionalproperty and owl:inversefunctionalproperty logical property characteristics owl:symmetricproperty and owl:transitiveproperty Individuals facts about class membership and property values of individuals

OWL-DL example @prefix people: <http://sample.org/people>. people:person a owl:class. people:man a owl:class; rdfs:subclassof people:person people:haschild a owl:property. people:hasson a owl:propery; rdfs:subpropertyof people:haschild PersonWithSingleSon a owl:class ; rdfs:subclassof [ a owl:restriction ; owl:cardinality "1"^^ ; owl:onproperty :hasson ]; rdfs:subclassof [ a owl:restriction ; owl:cardinality "1"^^ ; owl:onproperty :haschild ]. People:John a people:person. People:Bob a people:personwithsingleson.

SW for developers Classes are types for instances Each instance has one class (as its type). Classes don t share instances List of classes is known at compile time Compilers are used Properties are defined locally to a class Instances have values for attached properties. Values must be correctly typed. Range constraints are used for type checking Closed world assumption Class behavior through functions and methods Classes are sets of individuals Each individual can belong to multiple classes Classes can be created and changed at runtime Reasoners are used for classification and consistency Properties are standalone entities (can exist without classes) Instance can have arbitrary values for any property. Range and domain constraints can be used for type checking and type inference. Open world assumption Classes make their meaning explicit in terms of OWL statements. Source: www.w3.org/tr/sw-oosd-primer

Deep integration ideas Import OWL classes alongside classes defined normally (native API) Support for intensional definition of classes/properties (OWL statements) Separation of concerns among declarative and procedural aspects Similar to what SQLObject does for databases

Benefits Ontologies Python Definition of data and domain using Semantic Web tools (Protégé, SWOOP) Native OWL API OWL Inference and Web sharing of concepts New programming paradigm for Python Native interface for ontologies, developers can work directly with OWL classes and their instances Existing Python Web frameworks and access to large set of libraries

OWL APIs Jena, OWL API Different notion of polymorphism means APIs have to introduce sophisticated design patterns Resource r = mymodel.getresource( myns + "DigitalCamera" ); OntClass cls = (OntClass) r.as( OntClass.class ); Restriction rest = (Restriction) cls.as( Restriction.class );

RDF/OWL APIs Python RDFLib statement-centric (Daniel Krech) CWM model centric Pychinko model, statement-centric, rule based MetaLog statement, resource-centric, based on prolog Sparta, Tramp resource centric Others Active RDF (Ruby) native mapping, RDF, integrated with Rails RDFHomepage (PHP) native mapping

OWL-DL and Python Ontology corresponds to Python module OWL Class corresponds to Python Class Instance of OWL Class corresponds to Python Object OWL Property corresponds to Python Class or Python method

Classes OWL Class corresponds to Python Class Instances of OWL Class correspond to Python Objects Class definition Each python class has two attributes: URI (owl:class URI) definedby (intensional definition) >>> from seth import Thing, Property >>> Person = Thing.new( :Person a owl:class.') >>> print Person <class seth.meta.person> >>> Man = Thing.new(' :Man a owl:class ; rdfs:subclassof :Person.')

Classes (2) >>> PersonWithSingleSon = Thing.new("""PersonWithSingleSon a owl:class ; rdfs:subclassof [ a owl:restriction ; owl:cardinality "1"^^ ; owl:onproperty :hasson ]; rdfs:subclassof [ a owl:restriction ; owl:cardinality "1"^^ ; owl:onproperty :haschild ].""") >>> model = OntModel() >>> model.bind( people, http://somewhere.net/people# ) >>> Thing.setOntModel(model) >>> Person = Thing.new( people:person a owl:class. )

Properties owl:property corresponds to special kind of python object Similar to Class definition But such classes don t have instances >>> haschild = Property.new('hasChild a owl:objectproperty.') >>> print haschild <class 'seth.meta.haschild'> >>> hasson = Property.new('hasSon a owl:objectproperty ; rdfs:subpropertyof :haschild.') owl:property corresponds to python object attribute (method) >>> John.hasChild(Bob)

Individuals Individual is python object (class instance) >>> Bob = PersonWithSingleSon( Bob ) >>> John = Person('John ) >>> print John <seth.meta.person object at 0xb7a29e4c> >>> haschild(bob, John)

Ontologies owl:ontology corresponds to Python s module >>> ModuleFactory( people, http://somewhere.net/people.owl ) >>> import people >>> print people.person <seth.people.person :Man a owl:class ; rdfs:subclassof :Person. >>> print people.john <seth.people.person object at 0xb7a29e4c> serialization >>> people.serialize( /tmp/test.owl, RDF/XML-ABBREV )

Queries Triple like queries >>> for individual in Person.findInstances():... print individual, individual.name <seth.meta.man object at 0xb7d0b64c> Peter <seth.meta.person object at 0xb7d0b50c> John <seth.meta.person object at 0xb7d0b6ec> Jane >>> for who in hasson.q(bob):... who.name 'John' >>> print hasson.query(bob, John) 1 OWL-QL, SPARQL Native queries

Architecture Interaction with Java-based libraries (reasoners) Interactive Class/Property Generators File/URI RDF/XML OntModel Knowledge Base Interface Query language Query Engine

Python and Java Jython - Python implemented for the Java Virtual Machine JPE(Java-Python Extension) - uses JNI to provide a bridging mechanism between Java and a Python interpreter JPype - interfacing at the native level in both Virtual Machines SPIRO - uses ORB (Object-Request Broker) technology GCJ

Issues Performance (conversion between JVMs) Cache Datatype properties Open world semantics Debugging Rules

Summary SETH Homepage: http://seth-scripting.sourceforge.net Available through CVS under MIT license Discussion, support mailing list: seth.ui@savba.sk Contact: Marian.Babik@gmail.com

References Introduction to Semantic Web http://www.w3.org/2006/talks/0524-edinburgh-ih/overview.pdf Deep Integration http://www.semanticscripting.org/sfsw2005/papers/vrandecic- Deep_Integration.pdf http://gigaton.thoughtworks.net/~ofernand1/deepintegration.pdf http://www.semanticscripting.org/sfsw2006/paper1.pdf