CWM Closed World Machine. CWM Overview CWM is a simple Semantic Web program that can do the following tasks – Read and pretty-print several RDF formats.

Slides:



Advertisements
Similar presentations
Artificial Intelligence
Advertisements

Inference Rules Universal Instantiation Existential Generalization
Methods of Proof Chapter 7, second half.. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound)
Methods of Proof Chapter 7, Part II. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound) generation.
Logic.
N3 590SW Stanley Kok. What is N3? Notation triple? “Human-writable” vs RDF/XML – machine-processable expresses the same things as RDF/XML RDF express.
CSCI 572 Project Presentation Mohsen Taheriyan Semantic Search on FOAF profiles.
Dr. Alexandra I. Cristea RDF.
COMP 6703 eScience Project Semantic Web for Museums Student : Lei Junran Client/Technical Supervisor : Tom Worthington Academic Supervisor : Peter Strazdins.
Methods of Proof Chapter 7, second half.
Knowledge Technologies Manolis Koubarakis 1 An Introduction to RDF Schema.
Knoweldge Representation & Reasoning
More RDF CS 431 – Carl Lagoze – Cornell University Acknowledgements: Eric Miller Dieter Fensel.
Chapter 7: Resource Description Framework (RDF) Service-Oriented Computing: Semantics, Processes, Agents – Munindar P. Singh and Michael N. Huhns, Wiley,
RDF: Building Block for the Semantic Web Jim Ellenberger UCCS CS5260 Spring 2011.
Dr. Jim Bowring Computer Science Department College of Charleston CSIS 690 (633) May Evening 2009 Semantic Web Principles and Practice Class 3: 18 May.
Logical and Rule-Based Reasoning Part I. Logical Models and Reasoning Big Question: Do people think logically?
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.
Semantic Web Andrejs Lesovskis. Publishing on the Web Making information available without knowing the eventual use; reuse, collaboration; reproduction.
RDF Semantics by Patrick Hayes W3C Recommendation Presented by Jie Bao RPI Sept 4, 2008 Part 1 of RDF/OWL Semantics Tutorial.
Logics for Data and Knowledge Representation SPARQL Protocol and RDF Query Language (SPARQL) Feroz Farazi.
Notes for Chapter 12 Logic Programming The AI War Basic Concepts of Logic Programming Prolog Review questions.
1 st Workshop on Intelligent and Knowledge-oriented Technologies, , Bratislava Scripting the Semantic Web Marian Babik, Ladislav Hluchy Intelligent.
Chapter 3 RDF Schema. Introduction RDF has a very simple data model RDF Schema (RDFS) enriches the data model, adding vocabulary and associated semantics.
Using Semantic Web Data: Inference Lalana Kagal Decentralized Information Group MIT CSAIL Eric Prud'hommeaux Engineer World Wide Web Consortium.
Coastal Atlas Interoperability - Ontologies (Advanced topics that we did not get to in detail) Luis Bermudez Stephanie Watson Marine Metadata Interoperability.
Deep integration of Python with Semantic Web technologies Marian Babik, Ladislav Hluchy Intelligent and Knowledge Technologies Group Institute of Informatics,
Chapter 3 RDF and RDFS Semantics. Introduction RDF has a very simple data model But it is quite liberal in what you can say Semantics can be given using.
CWM Closed World Machine. CWM Overview CWM is a popular Semantic Web program that can do the following tasks – Parse and pretty-print several RDF formats:
Chapter 7: Resource Description Framework (RDF) Service-Oriented Computing: Semantics, Processes, Agents – Munindar P. Singh and Michael N. Huhns, Wiley,
RDF & RDF Schema Machine Understandable Metadata for the Web Semantic Web - Spring 2006 Computer Engineering Department Sharif University of Technology.
1 Artificial Intelligence Applications Institute Centre for Intelligent Systems and their Applications Stuart Aitken Artificial Intelligence Applications.
Of 35 lecture 5: rdf schema. of 35 RDF and RDF Schema basic ideas ece 627, winter ‘132 RDF is about graphs – it creates a graph structure to represent.
RDF Schema (RDFS) RDF user communities need to define the vocabularies (terms) to indicate that they  are describing specific kinds or classes of resources.
Introduction The Resource Description Framework (RDF) is recommended by the World Wide Web Consortium (W3C) to model meta-data about the resources of the.
Automated Reasoning Early AI explored how to automated several reasoning tasks – these were solved by what we might call weak problem solving methods as.
Logical Agents Chapter 7. Outline Knowledge-based agents Logic in general Propositional (Boolean) logic Equivalence, validity, satisfiability.
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.
Understanding RDF. 2/30 What is RDF? Resource Description Framework is an XML-based language to describe resources. A common understanding of a resource.
Chapter 7: Resource Description Framework (RDF) Service-Oriented Computing: Semantics, Processes, Agents – Munindar P. Singh and Michael N. Huhns, Wiley,
Dr. Lowell Vizenor Ontology and Semantic Technology Practice Lead Alion Science and Technology Semantic Technology: A Basic Introduction.
CS6133 Software Specification and Verification
Artificial Intelligence 7. Making Deductive Inferences Course V231 Department of Computing Imperial College, London Jeremy Gow.
Important Concepts from the W3C RDF Vocabulary/Schema Sungtae Kim SNU OOPSLA Lab. August 19, 2004.
Milos Hauskrecht (PDF) Hieu D. Vu (PPT) LISP PROGARMMING LANGUAGE.
© Copyright 2008 STI INNSBRUCK Intelligent Systems Propositional Logic.
Of 38 lecture 6: rdf – axiomatic semantics and query.
Semantic web course – Computer Engineering Department – Sharif Univ. of Technology – Fall RDF & RDF Schema Machine Understandable Metadata for the.
Knowledge Technologies Manolis Koubarakis 1 Some Other Useful Features of RDF.
An Optimization Technique for RDFS Inference using the Application Order of RDFS Entailment Rules Kisung Kim, Taewhi Lee
Lecture 041 Predicate Calculus Learning outcomes Students are able to: 1. Evaluate predicate 2. Translate predicate into human language and vice versa.
Semantic Web in Depth Rules Dr Nicholas Gibbins
Linked Data & Semantic Web Technology The Semantic Web Part 7. RDF Semantics Dr. Myungjin Lee.
Semantic Web in Depth RDF Schema Dr Nicholas Gibbins –
Knowledge Representation Lecture 2 out of 5. Last Week Intelligence needs knowledge We need to represent this knowledge in a way a computer can process.
Service-Oriented Computing: Semantics, Processes, Agents
Charlie Abela Department of Intelligent Computer Systems
The Semantic Web Part 6. RDF Vocabularies: RDF Schema
Service-Oriented Computing: Semantics, Processes, Agents
CWM Closed World Machine
Rules, RIF and RuleML.
SPARQL Exercise Much of this exercise has been copied from: INF3580/INF4580 – MANDATORY EXERCISE 3
Introduction to RDF and RDFS Editor: MR3
ece 720 intelligent web: ontology and beyond
SPARQL Exercise Most of this exercise has been copied from: INF3580/INF4580 – MANDATORY EXERCISE 3
Chapter 3 RDF and RDFS Semantics
Predicates and Quantifiers
Semantic Web Basics (cont.)
CWM Closed World Machine
Semantic-Web, Triple-Strores, and SPARQL
Presentation transcript:

CWM Closed World Machine

CWM Overview CWM is a simple Semantic Web program that can do the following tasks – Read and pretty-print several RDF formats – Store triples in a queryable triples database – Perform inferences via forward chaining rules – Perform builtin functions such as comparing strings, retrieving resources, all using an extensible builtins suite CWM was written in Python by Tim Berners-Lee and Dan Connolly of the W3C

What’s CWM good for? CWM is good for experimenting with RDF and RDFS and some OWL CWM’s rule based reasoner can’t cover all of OWL It’s good as a Unix tool that you can call from the command line rdfs:seeAlso – –

CWM in a Nutshell CWM rdf in various encodings rdf in various encodings Reasoning via N3 rules filter

Some alternative libraries If you want to play with RDF and RDFS from a programming language, you might check out some of these: Redland RDF Libraries (C): Jena (Java): Sesame (Java): RDFLib (Python): SWI (Prolog): Wilbur (Lisp): rdf.sourceforge.net/

CWM command line Example: cwm --rdf foo.rdf --n3 > foo.n3 Args are processed left to right (except for flags --pipe and –help Here’s what happens: – Switch to RDF/XML input-output format – Read in foo.rdf (use a filename or URI) and add triples to store – Switch to --n3 input-output format – Output triples in store to stdout in N3 – Unix redirect captures output in foo.n3

On N3 and Turtle N3 notation was invented by Tim Berners Lee Not a standard, but a large subset, Turtle, isTurtle What’s in N3 but not in Turtle – Representing inference rules over RDF triples – A compact syntax for reification – Some other bits The rules part is most useful – It’s been supplanted in part by SWRL and SPARQL – And by RIF (Rule Interchange Formalism)

Reasoning using N3 Rules N3 has a simple notation for Prolog like rules These are represented in RDF, of course, and can read these into CWM just like a data file Command line args tell CWM to reason --apply=foo : read rules from foo, apply to store, adding conclusions to store --rules : apply once the rules in the store to the store, adding conclusions to the store --filter=foo : apply rules in foo to the store, REPLACING the store with the conclusions --think : apply rules in store to the store, adding conclusions to the store, iteratively until no more new conclusions are made

N3 facts and rules :Pat owl:sameAs :Patrick. :Man rdfs:subclassOf :Human. :YoungMan rdfs:subclassOf :Man. :has_father rdfs:domain :Human; rdfs:range :Man. :Sara :has_father :Alan. { ?x :has_parent ?y } => { ?y :has_child :?x }. {?x :has_parent ?y. ?y :has_brother ?z} => {?x :has_uncle ?z}. { :thermostat :temp ?x. ?x math:greaterThan "70" } => { :cooling :power "high" }.

Implications in logic In logic, an implication is a sentence that is either true or false – forall X man(x) => mortal(x) If we believe an implication to be true, we can use it to derive new sentences that must be true from others we believe true – man(socrates) therefore mortal(socrates) This is the basis for rule based reasoning systems – Prolog, Datalog, Jess, etc.

Quantifiers In first order logic, we have two quantifiers, for all (  ) and exists (  ) –  x  y has_child(x, y) => is_parent(x) For all x, if there exists a y such that x has_child y, then x is a parent, or in other words X is a parent if X has (at least) one child – You only need to find one child to conclude that someone is a parent Variables (e.g., x and y) range over all objects in the universe, but for KB systems, we can narrow this to objects mentioned in the KB

Variables in rules implicitly quantified Most rule-based systems don’t use explicit quantifiers Variables are implicitly quantified as either  or , often using the following All variables in the rule’s conclusion are universally quantified All variables appearing only in the premise are existentially quantified has_child(p,c) => isa_parent(p) is interpreted as  c  c has_child(p,c) => isa_parent(p)

Variables in rules implicitly quantified To see why this is a reasonable design decision for a rule language, consider  x  y has_child(x, y) => isa_parent(x) What does this mean? X is a parent if we can prove that X has every object in our universe as a child Such rules are not often useful Many rule languages do have ways to express them, of course

Reasoning: Forward and Backward Rule based systems tend to use one of two reasoning strategies (and some do both) – Reasoning forward from known facts to new ones (find all people who are parents; is Bob among them?)forward – Reasoning backward from a conclusion posed as a query to see if it is true (Is Bob a parent?)backward Each has advantages and disadvantages which may effect its utility in a given use case CWM uses a forward reasoning strategy – We often want to compute all RDF triples that follow from a given set (i.e., find the deductive closure)deductive closure

N3 Rules: premis => conclusion An N3 rule has a conjunction of triples as a premise and a conjunction as a conclusion Eg: 2nd element of a triple is always a property { ?S ?P ?O. } => { ?P a rdf:Property. } Eg: The meaning of rdfs:domain { ?S ?P ?O. ?P rdfs:domain ?D.} => { ?O a ?D. } Variables begin with a ?. Variable in conclusions must appear in premise Each way to instantiate triples in the premise with a set of KB triples yields new facts

Note: limited negation & disjunction Disjunction in the premise can be achieved using several rules – { ?S :has_son ?0.} => { ?S :has_child ?O.} – { ?S :has_daughter ?0.} => { ?S :has_child ?O.} No disjunction is allows in the conclusion

Note: limited negation & disjunction No general logical negation is provided Negation and disjunction supported in other ways in OWL and RIF and in other reasonersRIF

N3 rules use cases Use N3 rules to implement the semantics of RDF, RDFS, and OWL vocabularies – See rdfs-rules.n3rdfs-rules.n3 – See owl-rules.n3owl-rules.n3 Use N3 rules to provide domain/application specific rules – See gedcom-relations.n3gedcom-relations.n3

A simple example % more simple1.n3 # A simple :. :john a foaf:Person; foaf:name "John Smith"; foaf:gender "Male"; foaf:name "John Smith".

Invoking CSM (1) % cwm simple1.n3 # Processed by Id: cwm.py,v /12/13 15:38:39 syosi Exp # using base file:///Users/finin/Sites/691s13/examples/n3/simple1.n3 # Notation3 generation by notation3.py,v /12/11 21:18:08 syosi Exp # Base was: :. :john a ; "Male"; "John Smith". #ENDS

Invoking CSM (2) n3> cwm -n3=/d simple1.n3 # Processed by Id: cwm.py,v /12/13 15:38:39 syosi Exp # using base file:///Users/finin/Sites/691s13/examples/n3/simple1.n3 # Notation3 generation by notation3.py,v /12/11 21:18:08 syosi Exp # Base was: foaf:. a foaf:Person; foaf:gender "Male"; foaf:name "John Smith".

Some useful CWM flags CWM command has a lot of flags and switches Do cwm --help to see them Here are a few --rdf Input & Output ** in RDF/XML insead of n3 from now on --n3 Input & Output in N3 from now on. (Default) --n3=flags Input & Output in N3 and set N3 flags --ntriples Input & Output in NTriples (equiv --n3=usbpartane -bySubject -quiet) --apply=foo Read rules from foo, apply to store, adding conclusions to store --think as -rules but continue until no more rule matches (or forever!) --think=foo as -apply=foo but continue until no more rule matches (or forever!) --data Remove all except plain RDF triples (formulae, forAll, etc) --help print this message

RDFS in N3 owl:. … rdfs:comment rdfs:domain rdfs:Resource; rdfs:range rdfs:Literal. rdfs:domain rdfs:domain rdf:Property; rdfs:range rdfs:Class. rdfs:label rdfs:domain rdfs:Resource; rdfs:range rdfs:Literal. rdfs:range rdfs:domain rdf:Property; rdfs:range rdfs:Class. rdfs:seeAlso rdfs:domain rdfs:Resource; rdfs:range rdfs:Resource. rdfs:subClassOf rdfs:domain rdfs:Class; rdfs:range rdfs:Class. rdfs:subPropertyOf rdfs:domain rdf:Property; rdfs:range rdf:Property. rdf:type rdfs:domain rdfs:Resource; rdfs:range rdfs:Class. …

RDFS in N3 (2) {?S ?P ?O} => {?P a rdf:Property}. {?S ?P ?O} => {?S a rdfs:Resource}. {?S ?P ?O} => {?O a rdfs:Resource}. {?P rdfs:domain ?C. ?S ?P ?O} => {?S a ?C}. {?P rdfs:range ?C. ?S ?P ?O} => {?O a ?C}. {?Q rdfs:subPropertyOf ?R. ?P rdfs:subPropertyOf ?Q} => {?P rdfs:subPropertyOf ?R}. {?P rdfs:subPropertyOf ?R. ?S ?P ?O} => {?S ?R ?O}. {?A rdfs:subClassOf ?B. ?S a ?A} => {?S a ?B}. {?B rdfs:subClassOf ?C. ?A rdfs:subClassOf ?B} => {?A rdfs:subClassOf ?C}.

Demonstration Install cwm Download files in the n3 examples directory 1/examples/n3/ 1/examples/n3/

HW3

Summary CWM is a relatively simple program that lets you manipulate and explore RDF and Semantic Web technology It’s limited in what it can do and not very efficient But useful and “close to the machine” Written in Python There are related tools in Python, see rdflibrdflib And lots more tools in other languages

genesis # A simple example of family relations using the gedcom :. # data from the Bible in GEDCOM form :fam1 a gc:Family. :Able gc:sex gc:Male; gc:givenName "Able"; gc:childIn :fam1; owl:differentFrom :Cain. :Cain gc:sex gc:Male; gc:givenName "Cain"; gc:childIn :fam1; owl:differentFrom :Able. :Adam gc:sex gc:Male; gc:givenName "Adam"; gc:spouseIn :fam1; owl:differentFrom :Eve. :Eve gc:sex gc:Female; gc:givenName "Eve"; gc:spouseIn :fam1; owl:differentFrom