Semantic Web in Depth Rules

Slides:



Advertisements
Similar presentations
Dr. Leo Obrst MITRE Information Semantics Information Discovery & Understanding Command & Control Center February 6, 2014February 6, 2014February 6, 2014.
Advertisements

Requirements. UC&R: Phase Compliance model –RIF must define a compliance model that will identify required/optional features Default.
A Web Rules WG Charter Focus Strawman Proposal Version 1.1, April 30, 2005 This Version Prepared by: Benjamin Grosof, Harold Boley, Michael Kifer, and.
CH-4 Ontologies, Querying and Data Integration. Introduction to RDF(S) RDF stands for Resource Description Framework. RDF is a standard for describing.
Semantics Static semantics Dynamic semantics attribute grammars
ESDSWG2011 – Semantic Web session Semantic Web Sub-group Session ESDSWG 2011 Meeting – Semantic Web sub-group session Wednesday, November 2, 2011 Norfolk,
RDF Tutorial.
 Copyright 2004 Digital Enterprise Research Institute. All rights reserved. SPARQL Query Language for RDF presented by Cristina Feier.
Answer Set Programming Overview Dr. Rogelio Dávila Pérez Profesor-Investigador División de Posgrado Universidad Autónoma de Guadalajara
Of 27 lecture 7: owl - introduction. of 27 ece 627, winter ‘132 OWL a glimpse OWL – Web Ontology Language describes classes, properties and relations.
1 Ontology Language Comparisons doug foxvog 16 September 2004.
Dr. Alexandra I. Cristea RDF.
Proof System HY-566. Proof layer Next layer of SW is logic and proof layers. – allow the user to state any logical principles, – computer can to infer.
Dr. Jim Bowring Computer Science Department College of Charleston CSIS 690 (633) May Evening 2009 Semantic Web Principles and Practice Class 3: 18 May.
JOSH FLECK Semantic Web. What is Semantic Web? Movement led by W3C that promotes common formats for data on the web Describes things in a way that computer.
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.
RDF: Concepts and Abstract Syntax W3C Recommendation 10 February Michael Felderer Digital Enterprise.
SPARQL All slides are adapted from the W3C Recommendation SPARQL Query Language for RDF Web link:
Ontology Development Kenneth Baclawski Northeastern University Harvard Medical School.
Notes for Chapter 12 Logic Programming The AI War Basic Concepts of Logic Programming Prolog Review questions.
SAWA: An Assistant for Higher-Level Fusion and Situation Awareness Christopher J. Matheus, Mieczyslaw M. Kokar, Kenneth Baclawski, Jerzy A. Letkowski,
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.
Ontology Query. What is an Ontology Ontologies resemble faceted taxonomies but use richer semantic relationships among terms and attributes, as well as.
Logical Agents Logic Propositional Logic Summary
Coastal Atlas Interoperability - Ontologies (Advanced topics that we did not get to in detail) Luis Bermudez Stephanie Watson Marine Metadata Interoperability.
Semantic Web - an introduction By Daniel Wu (danielwujr)
RDF and XML 인공지능 연구실 한기덕. 2 개요  1. Basic of RDF  2. Example of RDF  3. How XML Namespaces Work  4. The Abbreviated RDF Syntax  5. RDF Resource Collections.
Rules, RIF and RuleML.
1 SPARQL A. Emrah Sanön. 2 RDF RDF is quite committed to Semantic Web. Data model Serialization by means of XML Formal semantics Still something is missing!
The AI War LISP and Prolog Basic Concepts of Logic Programming
Ch. 13 Ch. 131 jcmt CSE 3302 Programming Languages CSE3302 Programming Languages (notes?) Dr. Carter Tiernan.
User Profiling using Semantic Web Group members: Ashwin Somaiah Asha Stephen Charlie Sudharshan Reddy.
SPIN in Five Slides Holger Knublauch, TopQuadrant Inc. Example file:
Of 33 lecture 1: introduction. of 33 the semantic web vision today’s web (1) web content – for human consumption (no structural information) people search.
Doc.: IEEE /0169r0 Submission Joe Kwak (InterDigital) Slide 1 November 2010 Slide 1 Overview of Resource Description Framework (RFD/XML) Date:
Of 38 lecture 6: rdf – axiomatic semantics and query.
Dr. Bhavani Thuraisingham September 18, 2006 Building Trustworthy Semantic Webs Lecture #9: Logic and Inference Rules.
1 RIF Design Roadmap Draft PM Harold Boley (NRC), Michael Kifer (Stony Brook U), Axel Polleres (DERI), Jos de Bruijn (DERI), Michael Sintek.
CC L A W EB DE D ATOS P RIMAVERA 2015 Lecture 7: SPARQL (1.0) Aidan Hogan
Of 35 lecture 17: semantic web rules. of 35 ece 627, winter ‘132 logic importance - high-level language for expressing knowledge - high expressive power.
The International RuleML Symposium on Rule Interchange and Applications Visualization of Proofs in Defeasible Logic Ioannis Avguleas 1, Katerina Gkirtzou.
Ontology Technology applied to Catalogues Paul Kopp.
Semantic Web in Depth Rules Dr Nicholas Gibbins
Semantic Web in Depth SPARQL Protocol and RDF Query Language Dr Nicholas Gibbins –
Semantic Web In Depth Resource Description Framework Dr Nicholas Gibbins –
NEDA ALIPANAH, MARIA ADELA GRANDO DBMI 11/19/2012.
Logical Agents. Outline Knowledge-based agents Logic in general - models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability.
OWL (Ontology Web Language and Applications) Maw-Sheng Horng Department of Mathematics and Information Education National Taipei University of Education.
Rule-based Reasoning in Semantic Text Analysis
OWL, DL and rules Based on slides from Grigoris Antoniou, Frank van Harmele and Vassilis Papataxiarhis.
n-ary relations OWL modeling problem when n≥3
By P. S. Suryateja Asst. Professor, CSE Vishnu Institute of Technology
CC La Web de Datos Primavera 2017 Lecture 7: SPARQL [i]
SPARQL.
Building the Semantic Web
Resource Description Framework
Using Rules with Ontologies in the Semantic Web
ece 720 intelligent web: ontology and beyond
Rules, RIF and RuleML.
Dept. Informatics, Aristotle Univ of Thessaloniki, Greece
Logics for Data and Knowledge Representation
ece 720 intelligent web: ontology and beyond
CC La Web de Datos Primavera 2016 Lecture 7: SPARQL (1.0)
Logic Use mathematical deduction to derive new knowledge.
Logical Agents Chapter 7.
Resource Description Framework (RDF)
Logics for Data and Knowledge Representation
Representations & Reasoning Systems (RRS) (2.2)
Presentation transcript:

Semantic Web in Depth Rules Professor Steffen Staab - s.r.staab@soton.ac.uk 2016 Many slides courtesy by Dr. Nick Gibbins

The Semantic Web layer cake Proof Trust User Interface and Applications XML + Namespaces URI Unicode Signature Encryption RDF RDF Schema OWL Identity Standard syntax Metadata Ontologies + Inference Explanation Attribution SPARQL (queries) Rules

The Role of Rules The KR formalisms of the Semantic Web have expressive limitations which can be overcome by rule-based knowledge For example, we cannot assert a new fact in OWL by checking three other relations, like: triangle(?x,?y,?z) :- knows(?x,?y),knows(?y,?z),knows(?z,?x). “Three nodes are called a triangle if all three nodes know each other.” OWL does not allow for stating constraints: Inconsistent :- hasChild(?x,?y), hasAge(?x,?n), hasAge(?y,?m), ?n < ?m. “A parent cannot be younger than his/her child.”

Rule Format The majority of rules in rule-based systems are of the form: A ⇐ B1 ∧ B2 ∧ … ∧ Bn A is known as the consequent or head of the rule B1…Bn are known as the antecedents or body of the rule Also known as Horn Clauses (disjunction with at most one positive literal)

Rule Format A ⇐ B1 ∧ B2 ∧ … ∧ Bn A is known as the consequent or head of the rule B1…Bn are known as the antecedents or body of the rule Rule systems differ in what kind of heads and antecedents they allow Propositional: P, Q, … Relational: Pk(?X1,…,?Xn) (nested) Function Symbols: Pk(f(?X1),…,g(?Xn-1, f(?X1),?Xn)) Negation (for the antecedent): not Pk (?X1,…,?Xn)

Rules – One Word for Two Things Declarative, but rather procedural knowledge Traditional Expert Systems CLIPS, JESS, OPS,… Database triggers, ECA rules (Event-Condition-Action), Production rules Rules are active in time The order of processing is key to the effect of rules Declarative, (truely) logical knowledge Datalog (part of many DBs) Answer set programming: DLV, Potassco F-Logic: Florid, Ontobroker, Flora-2 / Ergo Suite … Rules describe logical constraints. Either used to derive data views (F-Logic) XOR logical consistency (ASP)

Rules – One Word for Two Things Declarative, but rather procedural knowledge Traditional Expert Systems CLIPS, JESS, OPS,… Database triggers, ECA rules (Event-Condition-Action), Production rules Rules are active in time The order of processing is key to the effect of rules Declarative, (truely) logical knowledge Datalog (part of many DBs) Answer set programming: DLV, Potassco F-Logic: Florid, Ontobroker, Flora-2 / Ergo Suite … Rules describe logical constraints. Either used to derive data views (F-Logic) XOR logical consistency (ASP) Some important languages sit in the middle: Prolog, RIF,...

Rules and the Semantic Web Several proposed rule languages for use with the SW: RuleML N3 Rules Jena Rules Semantic Web Rule Language (SWRL) Rule Interchange Format (RIF) SPIN

ECA-like Rules: Given Empty default graph PREFIX dc: http://purl.org/dc/elements/1.1/ my: <http://example.org> Rule my:hasCreated(?X,?Y) :- dc:creator(?Y,?X). Sequence of Actions INSERT DATA { <http://example/book1> dc:creator "A.N.Other" . } DELETE DATA { <http://example/book1> dc:creator "A.N.Other" . } What is now returned in Step 3? CREATE ?X ?P ?Z. WHERE {?X ?P ?Z.} "A.N.Other“ my:hasCreated <http://example/book1>. An event happened here that added a statement which was never retracted by another rule.

Declarative Logical Rules: Given Empty default graph PREFIX dc: http://purl.org/dc/elements/1.1/ my: <http://example.org> Rule my:hasCreated(?X,?Y) :- dc:creator(?Y,?X). Sequence of Actions INSERT DATA { <http://example/book1> dc:creator "A.N.Other" . } DELETE DATA { <http://example/book1> dc:creator "A.N.Other" . } What is now returned in Step 3? CREATE ?X ?P ?Z. WHERE {?X ?P ?Z.} {} Here, data and logical rules are questioned to determine what holds at time of querying.

Issues with Semantics of Logical Rules Recursion Infinite structures Undecidability Multiple semantics Negation Function symbols Negation-as-failure Non-monotonicity

Non-monotonicity Given: Person(nicola). Man(?X) :- Person(?X), not Woman(?X). Infers: Man(nicola). But add another fact: Woman(nicola) Then the inference Man(nicola) needs to be retracted. OWL and 1st order predicate logics are monotonous: More facts always lead to more inferences, never to less.

Multiple Semantics Given: Person(nicola). Man(?X) :- Person(?X), not Woman(?X). Woman(?X) :- Person(?X), not Man(?X). What should be inferred? Possibility 1: Nothing (e.g. well-founded semantics) Possibility 2: Two competing solutions that are never true at the same time (e.g. answer-set semantics) a. Man(nicola) b. Woman(nicola)

Infinite Structures Number(0). Number(succ(?X)) :- Number(?X). Number holds for 0, succ(0), succ(succ(0)),... Even(0). Even(0) Even(succ(succ(?X))) :- Even(?X). Even(2),Even(4),... Odd(succ(?X)) :- Even(?X). Odd(1),Odd(3),.. Magic :- EXISTS ?X Number(?X) and not Even(?X) and not Odd(?X). Magic requires to check all infinitely many numbers

Description Logics and Rules Some work on designing DLs which include trigger rules of the form: C ⇒D (if an individual is a member of C, then it must be a member of D

Description Logics and Rules C ⇒D is (often) not the same as saying C ⊑ D (every instance of C is an instance of D) C ⊑ D is equivalent to saying ¬D ⊑ ¬C (contrapositive) The procedural trigger rule C ⇒D is not equivalent to ¬D ⇒ ¬C DLs with rules include an epistemic (modal) operator K: KC can be read as “the class of things which are known to be of class C” C ⇒D is equivalent to KC ⊑ D Used as a foundation for SWRL, etc

SPIN

SPARQL CONSTRUCT PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX vcard: <http://www.w3.org/2001/vcard-rdf/3.0#> CONSTRUCT { ?x vcard:FN ?name . ?x vcard:EMAIL ?mail . } WHERE { ?x foaf:name ?name . ?x foaf:mbox ?mail . } CONSTRUCT matches graph patterns and returns a new graph We could implement a simple rule-based system using CONSTRUCT queries to represent rules

SPARQL CONSTRUCT is not a rule language From the Data Access Working Group Charter: “While it is hoped that the product of the RDF Data Access Working Group will be useful in later development of a rules language, development of such a rules language is out of scope for this working group. However, any serializations of a query language must not preclude extension to, or inclusion in, a rules language. The group should expend minimal effort assuring that such an extension be intuitive and and consistent with any query language produced by the group.” Spin goes this way.

Constraints # must be at least 18 years old ASK WHERE { ?this ex:age ?age . FILTER (?age < 18) . } Put this boolean condition on a class.

Class constraint in SPIN ex:Parent a rdfs:Class ; rdfs:label "Parent"^^xsd:string ; rdfs:subClassOf ex:Person ; spin:constraint [ a sp:Ask ; rdfs:comment "must be at least 18 years old"^^xsd:string ; sp:where ([ sp:object sp:_age ;  variable ?age sp:predicate ex:age ;  property ex:age sp:subject spin:_this  variable ?this ] [ a sp:Filter ; sp:expression [ a sp:lt ; sp:arg1 sp:_age ; sp:arg2 18 ] ]) ]. Spin encodes the syntax tree of SPARQL queries using blank nodes.

Spin encodes the syntax tree of SPARQL queries using blank nodes. Unreadable Unless it is made readable by a tool Constraint/rule can be stored together with data and executed to indicate consistency or inferred data

SPARQL Construct Query CONSTRUCT { ?this ex:grandParent ?grandParent . } WHERE { ?parent ex:child ?this . ?grandParent ex:child ?parent .

SPARQL Construct Query Turned into SPIN Rule ex:Person a rdfs:Class ; rdfs:label "Person"^^xsd:string ; rdfs:subClassOf owl:Thing ; spin:rule [ a sp:Construct ; sp:templates ([ sp:object sp:_grandParent ; sp:predicate ex:grandParent ; sp:subject spin:_this ]) ; sp:where ([ sp:object spin:_this ; sp:predicate ex:child ; sp:subject sp:_parent ] [ sp:object sp:_parent ; sp:subject sp:_grandParent ]) ] .

Jena Rules

Jena Rules Jena RDF/OWL library contains support for forward- and backward-chaining rules Only implemented in Jena Syntax: [rule name: antecedents -> consequent ] Antecedents expressed as triple patterns (unfortunately not in a SPARQL-like syntax)

Jena Rule Example # Example rule file @prefix ont: <http://example.org/ontology#>. @include <RDFS>. [rule1: (?x ont:parent ?t) (?t ont:brother ?z) -> (?x ont:uncle ?z)] can include other rulebases – these are the entailment rules for RDFS

Semantic Web Rule Language

SWRL Member Submission to W3C in 2004 Based on RuleML subset and OWL XML and RDF-based serialisations (also, human-readable abstract syntax) Obeys constraints put on OWL re: disjointness of instances and datatype values Two types of variable in expressions I-variable – matches class instances D-variable – matches datatype values

SWRL Rule Example In abstract syntax: hasParent(?x1,?x2) ∧ hasBrother(?x2,?x3) ⇒ hasUncle(?x1,?x3) In abstract syntax: Implies(Antecedent(hasParent(I-variable(x1) I-variable(x2)) hasBrother(I-variable(x2) I-variable(x3))) Consequent(hasUncle(I-variable(x1) I-variable(x3))))

SWRL Rule Example Artist(?x) ∧ artistStyle(?x,?y) ∧ Style(?y) ∧ creator(?z,?x) ⇒ style/period(?z,?y) Implies(Antecedent(Artist(I-variable(x)) artistStyle(I-variable(x) I-variable(y)) Style(I-variable(y)) creator(I-variable(z) I-variable(x))) Consequent(style/period(I-variable(z) I-variable(y)))) Class membership

SWRL Rule Example Artist(?x) ∧ (≤1 artistStyle)(?x) ∧ creator(?z,?x) ⇒ (≤1 style/period)(?z) Implies(Antecedent(Artist(I-variable(x)) (restriction(artistStyle maxCardinality(1))) (I-variable(x)) Style(I-variable(y)) creator(I-variable(z) I-variable(x))) Consequent((restriction(style/period maxCardinality(1)) (I-variable(z)))) Use of restrictions and other OWL features

SWRL XML Syntax <ruleml:imp> <ruleml:_rlab ruleml:href="#example1"/> <ruleml:_body> <swrlx:individualPropertyAtom swrlx:property="hasParent"> <ruleml:var>x1</ruleml:var> <ruleml:var>x2</ruleml:var> </swrlx:individualPropertyAtom> <swrlx:individualPropertyAtom swrlx:property="hasBrother"> <ruleml:var>x2</ruleml:var> <ruleml:var>x3</ruleml:var> </swrlx:individualPropertyAtom> </ruleml:_body> <ruleml:_head> <swrlx:individualPropertyAtom swrlx:property="hasUncle"> <ruleml:var>x1</ruleml:var> <ruleml:var>x3</ruleml:var> </swrlx:individualPropertyAtom> </ruleml:_head> </ruleml:imp> Based on OWL XML Presentation Syntax (with RuleML)

SWRL RDF Syntax <swrl:Variable rdf:ID="x1"/> <swrl:Variable rdf:ID="x2"/> <swrl:Variable rdf:ID="x3"/> <ruleml:Imp> <ruleml:body rdf:parseType="Collection”> <swrl:IndividualPropertyAtom> <swrl:propertyPredicate rdf:resource="&eg;hasParent"/> <swrl:argument1 rdf:resource="#x1" /> <swrl:argument2 rdf:resource="#x2" /> </swrl:IndividualPropertyAtom> <swrl:IndividualPropertyAtom> <swrl:propertyPredicate rdf:resource="&eg;hasSibling"/> <swrl:argument1 rdf:resource="#x2" /> <swrl:argument2 rdf:resource="#x3" /> </swrl:IndividualPropertyAtom> </ruleml:body> …

Rule Interchange Format

Rule Interchange Format W3C Working Group chartered in late 2005 More expressive language than SWRL Common core with extensions Reached Recommendation in June 2010

Rule Interchange Format Defines XML syntax and non-XML presentation syntax (c.f. OWL) Latest version from: http://www.w3.org/2005/rules/wiki/RIF_Working_Group

RIF Dialects Two dialects (building on a common core): RIF Basic Logic Dialect Monotonic condition and conclusion Statements are either true or false The values of predicates cannot be changed, you can only add new statements RIF Production Rule Dialect Non-monotonic condition and conclusion Values of predicates can be changed

RIF Basic Logic Dialect Definite Horn rules Disjunction with exactly one positive literal A :- B and C and D N-ary predicates (sugared syntax)

RIF Structure Rules occur in Groups: Groups occur in Documents: Group( (Forall ?x Q(?x) :- P(?x)) (Forall ?x Q(?x) :- R(?x)) ) Groups occur in Documents: Document( Group( (Forall ?x Q(?x) :- P(?x)) (Forall ?x Q(?x) :- R(?x)) ) Group( (Forall ?y R(?y) :- S(?y)) ) )

RIF Example Document( Prefix(cpt http://example.com/concepts#) Prefix(ppl http://example.com/people#) Prefix(bks http://example.com/books#) Group ( Forall ?Buyer ?Item ?Seller ( cpt:buy(?Buyer ?Item ?Seller) :- cpt:sell(?Seller ?Item ?Buyer) ) cpt:sell(ppl:John bks:LeRif ppl:Mary) ) )

RIF Example Document( Prefix(dbp http://dbpedia.org/property/) Prefix(my http://mydata.org/resource#) Prefix(rdfs http://www.w3.org/2000/01/rdf-schema#) Group ( Forall ?mname ?aname ?movie ?actor my:actorIn(?aname ?mname) :- And( dbp:starring(?movie ?actor) rdfs:label(?movie ?mname) rdfs:label(?actor ?aname) ) ) )

RIF Example Document( Prefix(dbp http://dbpedia.org/property/) Prefix(my http://mydata.org/resource#) Prefix(rdfs http://www.w3.org/2000/01/rdf-schema#) Group ( Forall ?mname ?aname ?movie ?actor my:actorIn(?aname ?mname) :- And( ?movie[dbp:starring -> ?actor rdfs:label -> ?mname] ?actor[rdfs:label ?aname] ) ) )

Reflection

Reflection on Rules Current subjective assessment of rules Much used in Knowledge representation and Databases More used than Description Logics Rules are not exchanged much on the Web Suggested solution for the time being: Define your rules locally Use whatever rule mechanism and syntax you like Apply with data from the Web