Technologies for the Semantic Web OWL Basics COMP60421 Sean Bechhofer University of Manchester sean.bechhofer@manchester.ac.uk Metadata Resources are marked-up with descriptions of their content. No good unless everyone speaks the same language; Terminologies provide shared and common vocabularies of a domain, so search engines, agents, authors and users can communicate. No good unless everyone means the same thing; Ontologies provide a shared and common understanding of a domain that can be communicated across people and applications, and will play a major role in supporting information exchange and discovery. 1 2 Building a Semantic Web Ontology Annotation Associating metadata with resources Integration Integrating information sources Inference Reasoning over the information we have. Could be light-weight (taxonomy) Could be heavy-weight (logic-style) Interoperation and Sharing are key goals A representation of the shared background knowledge for a community Providing the intended meaning of a formal vocabulary used to describe a certain conceptualisation of objects in a domain of interest In CS, ontology taken to mean an engineering artefact A vocabulary of terms plus explicit characterisations of the assumptions made in interpreting those terms Nearly always includes some notion of hierarchical classification (is-a) Richer languages allow the definition of classes through description of their characteristics Introduce the possibility of using inference to help in management and deployment of the knowledge. 3 4
Toward Formalization What is a Taxonomy? Acquisition Process Elicit tacit knowledge A Set of terms/concepts More explicit information Hierarchy and other relations Categorizing (modifiers) Constraints and definitions An organisation of entities Typically hierarchical subclass relationships Organisationally Rigid Things must be put in their proper place. Multiple places for things? Mammal Animal Domestic Hierarchical Relations Nodes/Arcs representing a relationship (default IS-A) What IS-A Is and Isn t: An Analysis of Taxonomic Links in Semantic Networks (Brachman) 5 Cat Cow Dog Person Pet Farmed Impoverished descriptions Cats are carnivores Why? What is it to be a Carnivore? Cat Dog Cow What if we say something is a Carnivore and a Herbivore? 6 More Expressivity Structure of an Ontology Not just term-term relationships Definitions A carnivore is an an animal that eats only meat Constraints Carnivores are not herbivores (and vice versa) What Entailments can we make? Carnivores eat only Meat Cats eat only Mice Mice are Meat Thus Cats are Carnivores! Ontologies typically have two distinct components: Names for important concepts in the domain Paper is a concept whose members are papers. Person is a concept whose members are persons Background knowledge/constraints on the domain A Paper is a kind of ArgumentativeDocument All participants in a Workshop must be Persons. No individual can be both an InProceedings and a Journal Syntax required to allow us to state/express/write down this information Operators that allow us to describe complex expressions 7 8
Object Oriented Models Formal Languages Many languages use an object oriented model with Objects/Instances/Individuals Elements of the domain of discourse Possibly allowing descriptions of classes Types/Classes/Concepts Sets of objects sharing certain characteristics Relations/Properties/Roles Sets of pairs (tuples) of objects Such languages are/can be: Well understood Formally specified (Relatively) easy to use Amenable to machine processing The degree of formality of ontology languages varies widely Increased formality makes languages more amenable to machine processing (e.g. automated reasoning). The formal semantics provides an unambiguous interpretation of the descriptions. 9 10 Why Semantics? What does an expression in an ontology language mean? The semantics of a language can tell us precisely how to interpret a complex expression. Well defined semantics are vital if we are to support machine interpretability They remove ambiguities in the interpretation of the descriptions. Telephone? Black 11 OWL: The Web Ontology Language The W3C OWL 2 Web Ontology Language (OWL) is a Semantic Web language designed to represent rich and complex knowledge about things, groups of things, and relations between things. OWL is a computational logicbased language such that knowledge expressed in OWL can be reasoned with by computer programs either to verify the consistency of that knowledge or to make implicit knowledge explicit. OWL documents, known as ontologies, can be published in the World Wide Web and may refer to or be referred from other OWL ontologies. OWL is part of the W3C's Semantic Web technology stack, which includes RDF [RDF Concepts] and SPARQL [SPARQL]. http://www.w3.org/tr/owl-primer/ 12
OWL Ontologies Diversion: Semantics and Model Theories Classes, Properties and Individuals Individuals Elements in the domain Things, objects Classes Collections of things Primitive, named classes Class descriptions built up from other classes using class forming operators. Properties (Binary) Relations between objects Axioms represent background knowledge/constraints Ontology/KR languages aim to model (part of) world Terms in language correspond to entities in world Meaning given by, e.g.: Mapping to another formalism, such as FOL, with own well defined semantics or a bespoke Model Theory (MT) MT defines relationship between syntax and interpretations Can be many interpretations (models) of one piece of syntax Models supposed to be analogue of (part of) world! E.g., elements of model correspond to objects in world Formal relationship between syntax and models! Structure of models reflect relationships specified in syntax Inference can then be defined in terms of this Model Theory 13 14 Set Based Model Theory Set Based Model Theory Example Many logics (including standard First Order Logic) use a model theory based on Zermelo-Frankel set theory The domain of discourse (i.e., the part of the world being modelled) is represented as a set (often referred to as!) Objects in the world are interpreted as elements of! Classes/concepts (unary predicates) are subsets of! Properties/roles (binary predicates) are subsets of!!! (i.e.,! 2 ) Ternary predicates are subsets of! 3 etc. The sub-class relationship between classes can be interpreted as set inclusion World Model Daisy:Cow Cow kindof Animal Mary: Person Person kindof Animal Interpretation a! Z123ABC: Car Mary drives Z123ABC b {"a,b#, } $!!! 15 16
Set Based Model Theory Example Formally, the vocabulary is the set of names we use in our model of (part of) the world {Daisy, Cow, Animal, Mary, Person, Z123ABC, Car, drives, } An interpretation I is a tuple <!,I>! is the domain (a set) I is a mapping that maps! Names of objects to elements of!! Names of unary predicates (classes/concepts) to subsets of!! Names of binary predicates (properties/roles) to subsets of! X!! And so on for higher arity predicates (if any) Direct OWL Semantics OWL semantics defined by interpretations: <!,I>, where! is the domain (a non-empty set) I is an interpretation function that maps:! Class name A % subset A I of!! Property name R % binary relation R I over!! Individual name i % i I element of! Interpretation function I tells us how to interpret atomic classes, properties and individuals. The semantics of class operators is given by extending the interpretation function in an obvious way. 17 18 OWL Class Constructors OWL Class Constructors Constructor Example Interpretation Constructor Example Interpretation Atomic Class Human Human I and Human and Male Human I & Male I or Doctor or Lawyer Doctor I ' Lawyer I R some C haschild some Lawyer {x (y."x,y#)haschild I * y)lawyer I } R only C haschild only Doctor {x +y."x,y#)haschild I, y)doctor I } R min n haschild min 2 {x #"x,y#)haschild I - 2} not not Male! \ Male I R max n haschild max 2 {x #"x,y#)haschild I. 2} {} {john,mary} {john I, mary I } 19 20
Interpretation Example OWL Knowledge Bases (Ontologies) A I = {v, w, x} B I = {x, y} R I = {(v, w), (v, x), (y, x), (x, z)} not B = A and B = not A or B = R some B = R only B = R some (R some A) = R some not(a or B) = R min 1 = R max 1 = y v x w z A I B I An OWL ontology is a collection of axioms that describe the model. Axioms allow us to add further statements about arbitrary concept expressions and properties An Ontology/Knowledge Base is often split into two parts T-box is a set of axioms of the form:! C SubClassOf D (subclass)! C EquivalentTo D (class equivalence)! R SubPropertyOf S (subproperty)! R EquivalentTo S (property equivalence)!... A-box is a set of axioms of the form! x Type: C (concept instantiation)! "x,y# ) R (role instantiation) OWL doesn t formally make this distinction 21 22 Ontology Semantics OWL Class Axioms The interpretation function I can be extended to axioms. An interpretation I then satisfies (models) an axiom A iff the interpretation of the axiom holds in the interpretation I satisfies an ontology O iff I satisfies every axiom A in O Axiom Example Interpretation SubClassOf Human subclassof: Animal Human I $ Animal I The collection of axioms constrain the possible interpretations that can be made. EquivalentTo Man EquivalentTo: Human and Male Man I = Human I & Male I DisjointWith Animal DisjointWith: Plant Animal I & Plant I = / 23 24
OWL Individual Axioms OWL Property Axioms Axiom Example Interpretation Axiom Example Interpretation Types Sean Types: Human Sean I ) Human I SubPropertyOf: hasmother SubPropertyOf: hasparent hasmother I $ hasparent I Facts Sean Facts: workswith Bijan "Sean I,Bijan I #)workswith I functional employedby Characteristics: Functional +x,y,z. ("x,y#)employedby I * "x,z#)employedby I ), y = z DifferentFrom Sean DifferentFrom: Bijan Sean I " Bijan I domain owns Domain: Person +x."x,y#)owns I, x)person I SameAs GeorgeWBush SameAs: PresidentBush GeorgeWBush I = PresidentBush I range employs Range: Person +y."x,y#)employs I, y)person I transitivity haspart Characteristics: Transitive +x,y,z. ("x,y#)haspart I * "y,z#)haspart I ), "x,z#)haspart I 25 26 Multiple Models -v- Single Model Example of Multiple Models KB = {} An OWL Ontology doesn t define a single model, it is a set of constraints that define a set of possible models No constraints (empty Ontology) means any model is possible More constraints means fewer models Too many constraints may mean no possible model (inconsistent Ontology) In contrast, DBs (and frame/rule KR systems) make assumptions such that DB/KB defines a single model Unique name assumption! Different names always interpreted as different individuals Closed world assumption! Domain consists only of individuals named in the DB/KB Minimal models! Extensions are as small as possible KB = {a:c, b:d, c:c, d:e} KB = {a:c, b:d, c:c, d:e, b:c} KB = {a:c, b:d, c:c, d:e, b:c D subclassof C} KB = {a:c, b:d, c:c, d:e, b:c D subclassof C, E subclassof C} KB = {a:c, b:d, c:c, d:e, b:c D subclassof C E subclassof C, d: not C} I 1 : C I = {v, w, y} D I = {x, y} E I = {z} a I = v b I = x c I = w d I = y I 3 : C I = {v, w, y} D I = {x, y} E I = {z} a I = v b I = y c I = w d I = z I 2 : C I = {v, w, y} D I = {x, y} E I = {z} a I = v b I = x c I = w d I = z I 4 : C I = {v, w, x, y} D I = {x, y} E I = {z} a I = v b I = x c I = y d I = z 27 28
Example of Single Model Single Model -v- Multiple Model KB = {} KB = {a:c, b:d, c:c, d:e} KB = {a:c, b:d, c:c, d:e, b:c} KB = {a:c, b:d, c:c, d:e, b:c E subclassof C} I:! = {} I:! = {a, b, c, d} C I = {a, b, c} D I = {b} E I = {d} a I = a b I = b c I = c d I = d I:! = {a, b, c, d} C I = {a, c} D I = {b} E I = {d} a I = a b I = b c I = c d I = d I:! = {a, b, c, d} C I = {a, b, c, d} D I = {b} E I = {d} a I = a b I = b c I = c d I = d Multiple models: Expressively powerful Boolean connectives, including not and or Can capture incomplete information E.g., using or and some Monotonic Adding information preserves truth Reasoning (e.g., querying) is hard/slow Queries may give counterintuitive results in some cases Single model: Expressively weaker (in most respects) No negation or disjunction Can t capture incomplete information Nonmonotonic Adding information does not preserve truth Reasoning (e.g., querying) is easy/fast Queries may give counterintuitive results in some cases 29 30 Inference Reasoning An OWL Ontology is a set of constraints that define a set of possible models We may be able to determine that particular properties must hold of this set of models. This allows us to draw inferences. Knowledge is correct (captures intuitions) D subsumes C w.r.t. O iff for every model I of O, C I $ D I Knowledge is minimally redundant (no unintended synonyms) C is equivalent to D w.r.t. O iff for every model I of O, C I = D I Knowledge is meaningful (classes can have instances) C is satisfiable w.r.t. O iff there exists some model I of O s.t. C I " / Querying knowledge x is an instance of C w.r.t. O iff for every model I of O, x I ) C I <x,y> is an instance of R w.r.t. K iff for, every model I of O, (x I,y I ) ) R I Ontology consistency An ontology O is consistent iff there exists some model I of O 31 Tableau algorithms used to test satisfiability (consistency) Try to build a tree-like model I of the input concept C Decompose C syntactically Apply tableau expansion rules Infer constraints on elements of model Tableau rules correspond to constructors in logic (and, or etc) Some rules are nondeterministic (e.g., or, min) In practice, this means search Stop when no more rules applicable or clash occurs Clash is an obvious contradiction, e.g., A(x), not A(x) Cycle check (blocking) may be needed for termination C satisfiable iff rules can be applied such that a fully expanded clash free tree is constructed 32
Defining OWL OWL Resources OWL is defined via a Structural Specification http://www.w3.org/tr/owl2-syntax/ Defines language independently of concrete syntaxes Conceptual structure and abstract syntax UML diagrams and functional-style syntax used to define the language Mappings to concrete syntaxes then given. The structural specification provides the foundation for implementations (e.g. OWL API as discussed later) The OWL Technical Documentation is all available online from the W3C site. http://www.w3.org/tr/owl2-overview/ All the OWL documents are relevant, but in particular the Overview, Primer, Reference Guide and Manchester Syntax Guide will help you in the initial stages. 33 34