57ca7cf0306c3d15b3f5f85867521fbd.ppt
- Количество слайдов: 64
Introduction to Semantic Web Dr. Bhavani Thuraisingham The University of Texas at Dallas February 2012
Outline l XML l RDF l OWL l RULES l Reference: G. Antoniou and F. van. Harmelen, A Semantic Web Primer, MIT Press, 2004 (second edition, 2008)
XML The XML Language An XML document consists of l a prolog l a number of elements l an optional epilog The prolog consists of l an XML declaration and l an optional reference to external structuring documents <? xml version="1. 0" encoding="UTF-16"? > <!DOCTYPE book SYSTEM "book. dtd"> 3
XML Elements l Content may be text, or other elements, or nothing <lecturer> <name>David Billington</name> <phone> +61 − 7 − 3875 507 </phone> </lecturer> l 4 If there is no content, then the element is called empty; it is abbreviated as follows: <lecturer/> for <lecturer></lecturer>
XML Attributes l An empty element is not necessarily meaningless – l 5 It may have some properties in terms of attributes An attribute is a name-value pair inside the opening tag of an element <lecturer name="David Billington" phone="+61 − 7 − 3875 507"/>
Well-Formed XML Documents l l 6 Syntactically correct documents Some syntactic rules: – Only one outermost element (called root element) – Each element contains an opening and a corresponding closing tag – Tags may not overlap l <author><name>Lee Hong</author></name> – Attributes within an element have unique names – Element and tag names must be permissible An XML document is valid if – it is well-formed – respects the structuring information it uses There are two ways of defining the structure of XML documents: – DTDs (the older and more restricted way) – XML Schema (offers extended possibilities) –
The Tree Model of XML Documents: An Example <email> <head> <from name="Michael Maher" address="michaelmaher@cs. gu. edu. au"/> <to name="Grigoris Antoniou" address="grigoris@cs. unibremen. de"/> <subject>Where is your draft? </subject> </head> <body> Grigoris, where is the draft of the paper you promised me last week? </body> </email> 7
The Tree Model of XML Documents: An Example (2) 8
DTD: Element Type Definition <lecturer> <name>David Billington</name> <phone> +61 − 7 − 3875 507 </phone> </lecturer> DTD for above element (and all lecturer elements): l l l 9 l <!ELEMENT lecturer (name, phone)> <!ELEMENT name (#PCDATA)> <!ELEMENT phone (#PCDATA)> The element types lecturer, name, and phone may be used in the document A lecturer element contains a name element and a phone element, in that order (sequence) A name element and a phone element may have any content In DTDs, #PCDATA is the only atomic type for elements
XML Schema Significantly richer language for defining the structure of XML documents l Tts syntax is based on XML itself – not necessary to write separate tools l Reuse and refinement of schemas – Expand or delete already existent schemas l Sophisticated set of data types, compared to DTDs (which only supports strings) l An XML schema is an element with an opening tag like <schema "http: //www. w 3. org/2000/10/XMLSchema" version="1. 0"> l Structure of schema elements – Element and attribute types using data types l 10
Data Types l l l 11 There is a variety of built-in data types – Numerical data types: integer, Short etc. – String types: string, IDREF, CDATA etc. – Date and time data types: time, Month etc. There also user-defined data types – simple data types, which cannot use elements or attributes – complex data types, which can use these Complex data types are defined from already existing data types by defining some attributes (if any) and using: – sequence, a sequence of existing data type elements (order is important) – all, a collection of elements that must appear (order is not important) – choice, a collection of elements, of which one will be chosen
A Data Type Example <complex. Type name="lecturer. Type"> <sequence> <element name="firstname" type="string" min. Occurs="0“ max. Occurs="unbounded"/> <element name="lastname" type="string"/> </sequence> <attribute name="title" type="string" use="optional"/> </complex. Type> 12
XML Schema: The Email Example <element name="email" type="email. Type"/> <complex. Type name="email. Type"> <sequence> <element name="head" type="head. Type"/> <element name="body" type="body. Type"/> </sequence> </complex. Type> 13
Namespaces l l l An XML document may use more than one DTD or schema Since each structuring document was developed independently, name clashes may appear The solution is to use a different prefix for each DTD or schema – 14 prefix: name
An Example <vu: instructors xmlns: vu="http: //www. vu. com/emp. DTD" xmlns: gu="http: //www. gu. au/emp. DTD" xmlns: uky="http: //www. uky. edu/emp. DTD"> <uky: faculty uky: title="assistant professor" uky: name="John Smith" uky: department="Computer Science"/> <gu: academic. Staff gu: title="lecturer" gu: name="Mate Jones" gu: school="Information Technology"/> </vu: instructors> 15
Addressing and Querying XML Documents: XPATH l l 16 In relational databases, parts of a database can be selected and retrieved using SQL – Same necessary for XML documents – Query languages: XQuery, XQL, XML-QL The central concept of XML query languages is a path expression – Specifies how a node or a set of nodes, in the tree representation of the XML document can be reached XPath is core for XML query languages Language for addressing parts of an XML document. – It operates on the tree data model of XML – It has a non-XML syntax
XSL Transformations (XSLT) l l l XSLT specifies rules with which an input XML document is transformed to – another XML document, an HTML document , plain text The output document may use the same DTD or schema, or a completely different vocabulary XSLT can be used independently of the formatting language <author> <name>Grigoris Antoniou</name> <affiliation>University of Bremen</affiliation> <email>ga@tzi. de</email> </author> may be displayed in different ways: Grigoris Antoniou University of Bremen ga@tzi. de 17 Grigoris Antoniou University of Bremen ga@tzi. de
Summary l l 18 XML is a metalanguage that allows users to define markup XML separates content and structure from formatting XML is the de facto standard for the representation and exchange of structured information on the Web XML is supported by query languages
RDF Drawbacks of XML l l XML is a universal metalanguage for defining markup It provides a uniform frramework for interchange of data and metadata between applications However, XML does not provide any means of talking about the semantics (meaning) of data E. g. , there is no intended meaning associated with the nesting of tags – 19 It is up to each application to interpret the nesting.
Basic Ideas of RDF l l l 20 Basic building block: object-attribute-value triple – It is called a statement – Sentence about Billington is such a statement RDF has been given a syntax in XML – This syntax inherits the benefits of XML – Other syntactic representations of RDF possible The fundamental concepts of RDF are: – resources – properties – statements
Resources l We can think of a resource as an object, a “thing” we want to talk about – l l Every resource has a URI, a Universal Resource Identifier A URI can be – – 21 E. g. authors, books, publishers, places, people, hotels a URL (Web address) or some other kind of unique identifier
Properties l l Properties are a special kind of resources They describe relations between resources – l l Properties are also identified by URIs Advantages of using URIs: – – 22 E. g. “written by”, “age”, “title”, etc. Α global, worldwide, unique naming scheme Reduces the homonym problem of distributed data representation
Statements assert the properties of resources l A statement is an object-attribute-value triple – It consists of a resource, a property, and a value l Values can be resources or literals l Literals are atomic values (strings) l Three views of a Statement – A triple – A piece of a graph – A piece of XML code Thus an RDF document can be viewed as: l A set of triples l A graph (semantic net) l An XML document l 23
Statements as Triples (http: //www. cit. gu. edu. au/~db, l http: //www. mydomain. org/site-owner, #David Billington) The triple (x, P, y) can be considered as a logical formula P(x, y) – Binary predicate P relates object x to object y – RDF offers only binary predicates (properties) A Set of Triples as a Semantic Net 24
RDF Statements in XML l l l An RDF document is represented by an XML element with the tag rdf: RDF The content of this element is a number of descriptions, which use rdf: Description tags. Every description makes a statement about a resource, identified in 3 ways: – an about attribute, referencing an existing resource – an ID attribute, creating a new resource – without a name, creating an anonymous resource <rdf: RDF xmlns: rdf="http: //www. w 3. org/1999/02/22 -rdf-syntax-ns#" xmlns: mydomain="http: //www. mydomain. org/my-rdf-ns"> 25 <rdf: Description rdf: about="http: //www. cit. gu. edu. au/~db"> <mydomain: site-owner rdf: resource=“#David Billington“/> </rdf: Description> </rdf: RDF>
Reification l l l 26 In RDF it is possible to make statements about statements – Grigoris believes that David Billington is the creator of http: //www. cit. gu. edu. au/~db Such statements can be used to describe belief or trust in other statements The solution is to assign a unique identifier to each statement – It can be used to refer to the statement Introduce an auxiliary object (e. g. belief 1) relate it to each of the 3 parts of the original statement through the properties subject, predicate and object In the preceding example – subject of belief 1 is David Billington – predicate of belief 1 is creator – object of belief 1 is http: //www. cit. gu. edu. au/~db
The rdf: resource Attribute <rdf: Description rdf: about="CIT 1111"> <uni: course. Name>Discrete Mathematics</uni: course. Name> <uni: is. Taught. By rdf: resource="949318"/> </rdf: Description> <rdf: Description rdf: about="949318"> <uni: name>David Billington</uni: name> <uni: title>Associate Professor</uni: title> </rdf: Description> 27
Container Elements l l Collect a number of resources or attributes about which we want to make statements as a whole E. g. , we may wish to talk about the courses given by a particular lecturer The content of container elements are named rdf: _1, rdf: _2, etc. – Alternatively rdf: li Three Types of Container Elements – rdf: Bag an unordered container, allowing multiple occurrences l – rdf: Seq an ordered container, which may contain multiple occurrences l – 28 E. g. members of the faculty board, documents in a folder E. g. modules of a course, items on an agenda, an alphabetized list of staff members (order is imposed) rdf: Alt a set of alternatives l E. g. the document home and mirrors, translations of a document in various languages
Example for a Bag <uni: lecturer rdf: ID="949352" uni: name="Grigoris Antoniou" uni: title="Professor"> <uni: courses. Taught> <rdf: Bag> <rdf: _1 rdf: resource="#CIT 1112"/> <rdf: _2 rdf: resource="#CIT 3116"/> </rdf: Bag> </uni: courses. Taught> </uni: lecturer> 29 A Semantic Web Primer
Example for Alternative <uni: course rdf: ID="CIT 1111" uni: course. Name="Discrete Mathematics"> <uni: lecturer> <rdf: Alt> <rdf: li rdf: resource="#949352"/> <rdf: li rdf: resource="#949318"/> </rdf: Alt> </uni: lecturer> </uni: course> 30 Chapter 3 A Semantic Web Primer
RDF Collections l l l A limitation of these containers is that there is no way to close them – “these are all the members of the container” RDF provides support for describing groups containing only the specified members, in the form of RDF collections – list structure in the RDF graph – constructed using a predefined collection vocabulary: rdf: List, rdf: first, rdf: rest and rdf: nil Shorthand syntax: – "Collection" value for the rdf: parse. Type attribute: <rdf: Description rdf: about="#CIT 2112"> <uni: is. Taught. By rdf: parse. Type="Collection"> <rdf: Description rdf: about="#949111"/> <rdf: Description rdf: about="#949352"/> <rdf: Description rdf: about="#949318"/> </uni: is. Taught. By> </rdf: Description> 31
Basic Ideas of RDF Schema l RDF is a universal language that lets users describe resources in their own vocabularies – l The user can do so in RDF Schema using: – – – 32 RDF does not assume, nor does it define semantics of any particular application domain Classes and Properties Class Hierarchies and Inheritance Property Hierarchies
Classes and their Instances l We must distinguish between – – l l 33 Concrete “things” (individual objects) in the domain: Discrete Maths, David Billington etc. Sets of individuals sharing properties called classes: lecturers, students, courses etc. Individual objects that belong to a class are referred to as instances of that class The relationship between instances and classes in RDF is through rdf: type Chapter 3 A Semantic Web Primer
Inheritance in Class Hierarchies l l Range restriction: Courses must be taught by academic staff members only Michael Maher is a professor He inherits the ability to teach from the class of academic staff members This is done in RDF Schema by fixing the semantics of “is a subclass of” – 34 It is not up to an application (RDF processing software) to interpret “is a subclass of Chapter 3 A Semantic Web Primer
Property Hierarchies l Hierarchical relationships for properties – – l The converse is not necessarily true – – l 35 E. g. , “is taught by” is a subproperty of “involves” If a course C is taught by an academic staff member A, then C also involves Α E. g. , A may be the teacher of the course C, or a tutor who marks student homework but does not teach C P is a subproperty of Q, if Q(x, y) is true whenever P(x, y) is true Chapter 3 A Semantic Web Primer
RDF Schema in RDF l l The modeling primitives of RDF Schema are defined using resources and properties (RDF itself is used!) To declare that “lecturer” is a subclass of “academic staff member” – – – l 36 Define resources lecturer, academic. Staff. Member, and sub. Class. Of define property sub. Class. Of Write triple (lecturer, sub. Class. Of, academic. Staff. Member) We use the XML-based syntax of RDF Chapter 3 A Semantic Web Primer
Core Classes l rdfs: Resource, the class of all resources rdfs: Class, the class of all classes rdfs: Literal, the class of all literals (strings) rdf: Property, the class of all properties. rdf: Statement, the class of all reified statements l Example l l <rdfs: Class rdf: about="#lecturer"> <rdfs: sub. Class. Of rdf: resource="#staff. Member"/> </rdfs: Class> 37
Core Properties l l l 38 rdf: type, which relates a resource to its class – The resource is declared to be an instance of that class rdfs: sub. Class. Of, which relates a class to one of its superclasses – All instances of a class are instances of its superclass rdfs: sub. Property. Of, relates a property to one of its superproperties rdfs: domain, which specifies the domain of a property P – The class of those resources that may appear as subjects in a triple with predicate P – If the domain is not specified, then any resource can be the subject rdfs: range, which specifies the range of a property P – The class of those resources that may appear as values in a triple with predicate P <rdf: Property rdf: ID="phone"> <rdfs: domain rdf: resource="#staff. Member"/> <rdfs: range rdf: resource="http: //www. w 3. org/ 2000/01/rdf-schema#Literal"/> </rdf: Property>
l l l Semantics based on Inference Rules Semantics in terms of RDF triples instead of restating RDF in terms of firstorder logic with a sound and complete inference systems This inference system consists of inference rules of the form: IF E contains certain triples THEN add to E certain additional triples where E is an arbitrary set of RDF triples Examples IF E contains the triple (? x, ? p, ? y) THEN E also contains (? p, rdf: type, rdf: property) IF E contains the triples (? u, rdfs: sub. Class. Of, ? v) and (? v, rdfs: subclass. Of, ? w) THEN E also contains the triple (? u, rdfs: sub. Class. Of, ? w) IF E contains the triples (? x, rdf: type, ? u) and (? u, rdfs: sub. Class. Of, ? v) THEN E also contains the triple (? x, rdf: type, ? v) l Any resource ? y which appears as the value of a property ? p can be inferred to be a member of the range of ? p – This shows that range definitions in RDF Schema are not used to restrict the range of a property, but rather to infer the membership of the range IF E contains the triples (? x, ? p, ? y) and (? p, rdfs: range, ? u) THEN E also contains the triple (? y, rdf: type, ? u) 39
SPARQL RDF Query Language l l - l SPARQL is based on matching graph patterns The simplest graph pattern is the triple pattern : like an RDF triple, but with the possibility of a variable instead of an RDF term in the subject, predicate, or object positions Combining triple patterns gives a basic graph pattern, where an exact match to a graph is needed to fulfill a pattern
Summary l l l l 41 RDF provides a foundation for representing and processing metadata RDF has a graph-based data model RDF has an XML-based syntax to support syntactic interoperability – XML and RDF complement each other because RDF supports semantic interoperability RDF has a decentralized philosophy and allows incremental building of knowledge, and its sharing and reuse RDF is domain-independent - RDF Schema provides a mechanism for describing specific domains RDF Schema is a primitive ontology language – It offers certain modelling primitives with fixed meaning Key concepts of RDF Schema are class, subclass relations, property, subproperty relations, and domain and range restrictions There exist query languages for RDF and RDFS, including SPARQL
OWL Requirements for Ontology Languages l l Ontology languages allow users to write explicit, formal conceptualizations of domain models The main requirements are: – – – 42 a well-defined syntax efficient reasoning support a formal semantics sufficient expressive power convenience of expression
Reasoning About Knowledge in Ontology Languages l l l 43 Class membership – If x is an instance of a class C, and C is a subclass of D, then we can infer that x is an instance of D Equivalence of classes – If class A is equivalent to class B, and class B is equivalent to class C, then A is equivalent to C, too Consistency – X instance of classes A and B, but A and B are disjoint – This is an indication of an error in the ontology Classification – Certain property-value pairs are a sufficient condition for membership in a class A; if an individual x satisfies such conditions, we can conclude that x must be an instance of A Reasoning Support for OWL – Semantics is a prerequisite for reasoning support – Formal semantics and reasoning support are usually provided by mapping an ontology language to a known logical formalism; using automated reasoners that already exist for those formalisms – OWL is (partially) mapped on a description logic, and makes use of reasoners such as Fa. CT and RACER – Description logics are a subset of predicate logic for which efficient reasoning support is possible
Reasoning Support for OWL l l Semantics is a prerequisite for reasoning support Formal semantics and reasoning support are usually provided by – – l l 44 mapping an ontology language to a known logical formalism using automated reasoners that already exist for those formalisms OWL is (partially) mapped on a description logic, and makes use of reasoners such as Fa. CT and RACER Description logics are a subset of predicate logic for which efficient reasoning support is possible
Some Limitations of the Expressive Power of RDF Schema l l l 45 Local scope of properties – rdfs: range defines the range of a property (e. g. eats) for all classes – In RDF Schema we cannot declare range restrictions that apply to some classes only – E. g. we cannot say that cows eat only plants, while other animals may eat meat, too Disjointness of classes – Sometimes we wish to say that classes are disjoint (e. g. male and female) Boolean combinations of classes – Sometimes we wish to build new classes by combining other classes using union, intersection, and complement – E. g. person is the disjoint union of the classes male and female Cardinality restrictions – E. g. a person has exactly two parents, a course is taught by at least one lecturer Special characteristics of properties – Transitive property (like “greater than”) – Unique property (like “is mother of”) – A property is the inverse of another property (like “eats” and “is eaten by”)
Three Species of OWL l l l 46 W 3 C’s. Web Ontology Working Group defined OWL as three different sublanguages: – OWL Full – OWL DL – OWL Lite Each sublanguage geared toward fulfilling different aspects of requirements OWL uses XML and RDF for syntax OWL is based on Description Logic is a fragment of first-order logic OWL inherits from Description Logic – The open-world assumption – The non-unique-name assumption
OWL l OWL Full – – – l OWL DL (Description Logic) – – l It is a sublanguage of OWL Full that restricts application of the constructors from OWL and RDF Application of OWL’s constructors’ to each other is disallowed; Therefore it corresponds to a well studied description logic OWL DL permits efficient reasoning support; But we lose full compatibility with RDF Not every RDF document is a legal OWL DL document. Every legal OWL DL document is a legal RDF document. OWL-Lite: – – – 47 It uses all the OWL languages primitives and allows the combination of these primitives in arbitrary ways with RDF and RDF Schema OWL Full is fully upward-compatible with RDF, both syntactically and semantically OWL Full is so powerful that it is undecidable; No complete (or efficient) reasoning support Even further restriction limits OWL DL to a subset of the language constructors OWL Lite excludes enumerated classes, disjointness statements, and arbitrary cardinality. The advantage of this is a language that is easier to grasp (for users, for tool builders) The disadvantage is restricted expressivity
owl: Ontology <owl: Ontology rdf: about=""> <rdfs: comment>An example OWL ontology </rdfs: comment> <owl: prior. Version rdf: resource="http: //www. mydomain. org/uni-ns-old"/> <owl: imports rdf: resource="http: //www. mydomain. org/persons"/> <rdfs: label>University Ontology</rdfs: label> </owl: Ontology> l 48 owl: imports is a transitive property
Classes l l Classes are defined using owl: Class – owl: Class is a subclass of rdfs: Class Disjointness is defined using owl: disjoint. With <owl: Class rdf: about="#associate. Professor"> <owl: disjoint. With rdf: resource="#professor"/> <owl: disjoint. With rdf: resource="#assistant. Professor"/> </owl: Class> l owl: equivalent. Class defines equivalence of classes <owl: Class rdf: ID="faculty"> <owl: equivalent. Class rdf: resource= "#academic. Staff. Member"/> </owl: Class> l 49 l owl: Thing is the most general class, which contains everything owl: Nothing is the empty class
Properties l In OWL there are two kinds of properties – Object properties, which relate objects to other objects l E. g. is-Taught. By, supervises – Data type properties, which relate objects to datatype values l l E. g. phone, title, age, etc. Data Type Properties: OWL makes use of XML Schema data types, using the layered architecture of the SW <owl: Datatype. Property rdf: ID="age"> <rdfs: range rdf: resource= "http: //www. w 3. org/2001/XLMSchema #non. Negative. Integer"/> </owl: Datatype. Property> l 50 User-defined data types: Object Properties <owl: Object. Property rdf: ID="is. Taught. By"> <owl: domain rdf: resource="#course"/> <owl: range rdf: resource= "#academic. Staff. Member"/> <rdfs: sub. Property. Of rdf: resource="#involves"/> </owl: Object. Property>
An African Wildlife Ontology – Properties <owl: Transitive. Property rdf: ID="is-part-of"/> <owl: Object. Property rdf: ID="eats"> <rdfs: domain rdf: resource="#animal"/> </owl: Object. Property> <owl: Object. Property rdf: ID="eaten-by"> <owl: inverse. Of rdf: resource="#eats"/> </owl: Object. Property> 51
An African Wildlife Ontology – Plants and Trees <owl: Class rdf: ID="plant"> <rdfs: comment>Plants form a class disjoint from animals. </rdfs: comment> <owl: disjoint. With rdf: resource="#animal"/> </owl: Class> <owl: Class rdf: ID="tree"> <rdfs: comment>Trees are a type of plant. </rdfs: comment> <rdfs: sub. Class. Of rdf: resource="#plant"/> </owl: Class> 52
An African Wildlife Ontology – Branches <owl: Class rdf: ID="branch"> <rdfs: comment>Branches are parts of trees. </rdfs: comment> <rdfs: sub. Class. Of> <owl: Restriction> <owl: on. Property rdf: resource="#is-part-of"/> <owl: all. Values. From rdf: resource="#tree"/> </owl: Restriction> </rdfs: sub. Class. Of> </owl: Class> 53
An African Wildlife Ontology – Leaves <owl: Class rdf: ID="leaf"> <rdfs: comment>Leaves are parts of branches. </rdfs: comment> <rdfs: sub. Class. Of> <owl: Restriction> <owl: on. Property rdf: resource="#is-part-of"/> <owl: all. Values. From rdf: resource="#branch"/> </owl: Restriction> </rdfs: sub. Class. Of> </owl: Class> 54
An African Wildlife Ontology – Carnivores <owl: Class rdf: ID="carnivore"> <rdfs: comment>Carnivores are exactly those animals that eat animals. </rdfs: comment> <owl: intersection. Of rdf: parsetype="Collection"> <owl: Class rdf: about="#animal"/> <owl: Restriction> <owl: on. Property rdf: resource="#eats"/> <owl: some. Values. From rdf: resource="#animal"/> </owl: Restriction> </owl: intersection. Of> </owl: Class> 55
An African Wildlife Ontology – Giraffes <owl: Class rdf: ID="giraffe"> <rdfs: comment>Giraffes are herbivores, and they eat only leaves. </rdfs: comment> <rdfs: sub. Class. Of rdf: type="#herbivore"/> <rdfs: sub. Class. Of> <owl: Restriction> <owl: on. Property rdf: resource="#eats"/> <owl: all. Values. From rdf: resource="#leaf"/> </owl: Restriction> </rdfs: sub. Class. Of> </owl: Class> 56
Summary l l 57 OWL is the proposed standard for Web ontologies OWL builds upon RDF and RDF Schema: – (XML-based) RDF syntax is used – Instances are defined using RDF descriptions – Most RDFS modeling primitives are used Formal semantics and reasoning support is provided through the mapping of OWL on logics – Predicate logic and description logics have been used for this purpose While OWL is sufficiently rich to be used in practice, extensions are in the making – They will provide further logical features, including rules
RULES Semantic Web Rules Language l l 58 A rule in SWRL has the form – B 1, … , Bn A 1, … , Am – Commas denote conjunction on both sides – A 1, … , Am, B 1, … , Bn can be of the form C(x), P(x, y), same. As(x, y), or different. From(x, y) where C is an OWL description, P is an OWL property, and x, y are Datalog variables, OWL individuals, or OWL data values If the head of a rule has more than one atom, the rule can be transformed to an equivalent set of rules with one atom in the head Expressions, such as restrictions, can appear in the head or body of a rule This feature adds significant expressive power to OWL, but at the high price of undecidability
Non-monotonic Rules l l l In nonmonotonic rule systems, a rule may not be applied even if all premises are known because we have to consider contrary reasoning chains Now we consider defeasible rules that can be defeated by other rules Negated atoms may occur in the head and the body of rules, to allow for conflicts – – 59 p(X) q(X) r(X) ¬q(X)
The Potential Buyer Carlos Requirements – – – l Carlos is willing to pay: – – – l l l 60 At least 45 sq m with at least 2 bedrooms Elevator if on 3 rd floor or higher Pet animals must be allowed $ 300 for a centrally located 45 sq m apartment $ 250 for a similar flat in the suburbs An extra $ 5 per square meter for a larger apartment An extra $ 2 per square meter for a garden He is unable to pay more than $ 400 in total If given the choice, he would go for the cheapest option His second priority is the presence of a garden His lowest priority is additional space
Formalization of Carlos’s Requirements – Rules r 1: acceptable(X) r 2: bedrooms(X, Y), Y < 2 ¬acceptable(X) r 3: size(X, Y), Y < 45 ¬acceptable(X) r 4: ¬pets(X) ¬acceptable(X) r 5: floor(X, Y), Y > 2, ¬lift(X) ¬acceptable(X) r 6: price(X, Y), Y > 400 ¬acceptable(X) r 2 > r 1, r 3 > r 1, r 4 > r 1, r 5 > r 1, r 6 > r 1 r 7: size(X, Y), Y ≥ 45, garden(X, Z), central(X) offer(X, 300 + 2*Z + 5*(Y − 45)) r 8: size(X, Y), Y ≥ 45, garden(X, Z), ¬central(X) offer(X, 250 + 2*Z + 5(Y − 45)) r 9: offer(X, Y), price(X, Z), Y < Z ¬acceptable(X) r 9 > r 1 61
Representation of Available Apartments Flat Size Central Floor Lift Pets Garden Price a 1 1 50 yes 1 no yes 0 300 a 2 2 45 yes 0 no yes 0 335 a 3 2 65 no 2 no yes 0 350 a 4 2 55 no 1 yes no 15 330 a 5 3 55 yes 0 no yes 15 350 a 6 2 60 yes 3 no no 0 370 a 7 62 Bedrooms 3 65 yes 1 no yes 12 375
Determining Acceptable Apartments l l l 63 If we match Carlos’s requirements and the available apartments, we see that flat a 1 is not acceptable because it has one bedroom only (rule r 2) flats a 4 and a 6 are unacceptable because pets are not allowed (rule r 4) for a 2, Carlos is willing to pay $ 300, but the price is higher (rules r 7 and r 9) flats a 3, a 5, and a 7 are acceptable (rule r 1)
Summary l l l l 64 Horn logic is a subset of predicate logic that allows efficient reasoning, orthogonal to description logics Horn logic is the basis of monotonic rules DLP and SWRL are two important ways of combining OWL with Horn rules DLP is essentially the intersection of OWL and Horn logic, whereas SWRL is a much richer language Nonmonotonic rules are useful in situations where the available information is incomplete They are rules that may be overridden by contrary evidence Priorities are used to resolve some conflicts between rules Representation XML-like languages is straightforward
57ca7cf0306c3d15b3f5f85867521fbd.ppt