Overview ► Pizzas – Card Sorting A Practical Introduction to Ontologies & OWL Session 1: Primitive Classes in OWL ► Protégé Introduction ► Subsumption ► Creating a Class Hierarchy ► Consistency ► Disjointness ► Relationships & Properties ► Restrictions ► Polyhierarchies - Issues O p enGA LEN BioHealth Informatics Group Copyright © 2006, The University of Manchester Copyright © 2006, The University of Manchester Our Domain Introduction to Ontologies Tutorial You are the Expert ► Pizzas have been used in Manchester tutorials for years. ► Pizzas were selected as a domain for several reasons: ► They are fun ► Most often it is not the domain expert that formalises their knowledge – because of the complexity of the modelling it is normally a specialist “knowledge engineer” Hopefully, as tools get easier to use, this will change ► They are internationally known ► Having access to experts is critical for most domains ► They are highly compositional ► Luckily, we are all experts in Pizzas, so we just need some material to verify our knowledge… ► They have a natural limit to their scope ► They are fairly neutral ► Although arguments still break out over representation ► Even pizzas can do this - its an inevitable part of knowledge modelling ► ARGUING IS NOT BAD! Copyright © 2006, The University of Manchester Introduction to Ontologies Tutorial Copyright © 2006, The University of Manchester Introduction to Ontologies Tutorial Reference Materials Our Ontology ► Having references to validate decisions, and act as provenance can be useful for maintaining an ontology ► Mistakes, omissions and intentions can be more easily traced if a reference can be made ► When building, we highly recommend documenting your model as you go – keeping provenance information is a good way of doing this ► We have provided you with a pizza menu and several cards with ingredients on Copyright © 2006, The University of Manchester Introduction to Ontologies Tutorial Our Application ► When building an ontology we need an application in mind – ontologies should not be built for the sake of it ► Keep the application in mind when creating concepts – this should help you scope the project ► The PizzaFinder application has been developed so that you can plug your ontology in at the end of the day and see it in action Copyright © 2006, The University of Manchester Introduction to Ontologies Tutorial Exercise 1: Card Sorting ► You have been given a selection of pizza toppings from a takeway menu ► Group the toppings into several piles ► What similarities and differences are there between the different piles? ► Are there any concepts missing? ► If you can, regroup the toppings into different piles ► Feel free to add you own toppings to the cards www.co-ode.org/downloads/pizzafinder/ Copyright © 2006, The University of Manchester Introduction to Ontologies Tutorial Copyright © 2006, The University of Manchester Introduction to Ontologies Tutorial Card Sorting - Issues … ► different viewpoints ► Tomato – Vegetable or Fruit? ► Is a knowledge modelling environment ► culinary vs biological ► Is free, open source software ► Ambiguity ► Is developed by Stanford / Manchester ► words not concepts ► Has a large user community (approx 30k) ► Missing Knowledge ► What is peperonata? ► multiple classifications (2+ parents) ► lots of missing categories (superclasses?) ► competency questions ► What are we likely to want to “ask” our ontology? ► bear the application in mind Copyright © 2006, The University of Manchester Introduction to Ontologies Tutorial Copyright © 2006, The University of Manchester Introduction to Ontologies Tutorial Protégé-4 … ► Protégé 4 (alpha) Built solely on OWL modelling language ► Supports development of plugins to allow backend / interface extensions So let’s have a look… Copyright © 2006, The University of Manchester Introduction to Ontologies Tutorial Copyright © 2006, The University of Manchester Introduction to Ontologies Tutorial Class Hierarchy Subsumption Subsumption hierarchy Structure as asserted by the ontology engineer ► Superclass/subclass relationship, “is-a” ► All members of a subclass can be inferred to be members of its superclasses Thing: superclass of all OWL Classes A B • A subsumes B • A is a superclass of B • B is a subclass of A • All members of B are also members of A Thing is the root class Copyright © 2006, The University of Manchester Introduction to Ontologies Tutorial Exercise 2: Create Class Hierarchy Using your groups from exercise 1, create your class hierarchy in Protégé following the steps shown in the demo. Copyright © 2006, The University of Manchester Introduction to Ontologies Tutorial Exercise 2: Create Class Hierarchy ► You will notice that we use naming conventions for our ontology entities ► Typically, we use CamelNotation with a starting capital for Classes ► Use whatever conventions you like ► It is helpful to be consistent – especially when trying to find things in your ontology Copyright © 2006, The University of Manchester Introduction to Ontologies Tutorial Copyright © 2006, The University of Manchester Introduction to Ontologies Tutorial Create a Class Hierarchy Saving OWL Files OWL = easy to make mistakes = save regularly ► Start with your empty ontology… 1. Select File Æ Save Project As A dialog (as shown) will pop up 2. Select a directory by using the Browse button An OWL file is created in the specified directory .owl – the OWL file this is where your ontology is stored in RDF/OWL format 3. Copyright © 2006, The University of Manchester Introduction to Ontologies Tutorial Labels – so what? Copyright © 2006, The University of Manchester Introduction to Ontologies Tutorial Disjointness ► Humans might be able to interpret what the labels mean and how they are defined, but the computer cannot. ► OWL assumes that classes overlap MeatTopping Pizza A Click OK B PizzaBase C PizzaTopping VegetableTopping = individual D ► This means an individual could be both a MeatTopping and a VegetableTopping at the same time ► We want to state this is not the case Copyright © 2006, The University of Manchester Introduction to Ontologies Tutorial Copyright © 2006, The University of Manchester Introduction to Ontologies Tutorial Disjointness Consistency Checking ► We’ve just created a class that doesn’t really make sense ► If we state that classes are disjoint MeatTopping ► What is a MeatyVegetableTopping? VegetableTopping ► We’d like to be able to check the logical consistency of our model = individual ► This means an individual cannot be both a MeatTopping and a VegetableTopping at the same time ► We must do this explicitly in the interface Copyright © 2006, The University of Manchester Introduction to Ontologies Tutorial Reasoners ► Being able to use a reasoner is one of the main advantages of using a logic-based formalism such as OWL (and why we are using OWL-DL) Copyright © 2006, The University of Manchester Introduction to Ontologies Tutorial Reasoners and Protégé ► Reasoners are used to infer information that is not explicitly contained within the ontology ► You may also hear them being referred to as Classifiers ► Standard reasoner services are: ► Protégé-OWL supports the use of reasoners implementing the DIG interface ► This means that the reasoner you choose is independent of the ontology editor, so you can choose the implementation you want depending on your needs (e.g., some may be more optimised for speed/memory, others may have more features) ► Consistency Checking ► Subsumption Checking ► Equivalence Checking ► Instantiation Checking ► Reasoners can be used at runtime in applications as a querying mechanism (esp useful for smaller ontologies) ► We will use one during development as an ontology “compiler”. A well designed ontology can be compiled to check its meaning is that intended Copyright © 2006, The University of Manchester ► This is one of the tasks that can be done automatically by software known as a Reasoner Introduction to Ontologies Tutorial ► These reasoners typically set up a service running locally or on a remote server – Protégé-OWL can only connect to reasoners over an http:// connection Copyright © 2006, The University of Manchester Introduction to Ontologies Tutorial Why is MeatyVegetableTopping Inconsistent? Other Inconsistencies? ► Your ontology is likely to have several classes with multiple parents ► We have asserted that a MeatyVegetableTopping is a subclass of two classes we have stated are disjoint ► The disjoint means nothing can be a MeatTopping and a VegetableTopping at the same time ► This means that MeatyVegetableTopping can never contain any individuals ► We call this a tangle ► As we have seen, a class cannot have 2 disjoint parents – it will be inconsistent ► To remove other inconsistencies you will have to be careful about where your disjoints are – remove disjoints between multiple parents by hand ► This is obviously an awkward thing to manage – we will later show you how to manage your tangle to simplify these issues ► The class is therefore inconsistent ► This is what we expect! ► It can be useful to create classes we expect to be inconsistent to “test” your model – often we refer to these classes as “probes” – generally it is a good idea to document them as such to avoid later confusion Copyright © 2006, The University of Manchester Introduction to Ontologies Tutorial What have we got? Copyright © 2006, The University of Manchester Introduction to Ontologies Tutorial Relationships in OWL ► We’ve created a tangled graph (not a tree – multiple parents) of mostly disjoint classes ► In OWL-DL, relationships can only be formed between Individuals or between an Individual and a data value. ► Disjoints are inherited down the subsumption hierarchy ► Relationships are formed along Properties (In OWL-Full, Classes can be related, but this cannot be reasoned with) e.g., something that is a TomatoTopping cannot be a Pizza because its superclass, PizzaTopping, is disjoint from Pizza ► You should now be able to select every class and see its siblings in the disjoints widget (if it has any) Copyright © 2006, The University of Manchester Introduction to Ontologies Tutorial ► We can restrict how these Properties are used: ► Globally – by stating things about the Property itself ► Or locally – by restricting their use for a given Class Copyright © 2006, The University of Manchester Introduction to Ontologies Tutorial OWL Properties Types of Properties ► Object Property – relates Individuals hasParent ► Inverse ► Datatype Property – relates Individuals to data (int, string, float etc) Matthew Dorothy hasChild ► Functional hasBir er thMoth Peggy Implies that Peggy and Margaret are the same individual Dorothy hasBirthMothe r Margaret Copyright © 2006, The University of Manchester Introduction to Ontologies Tutorial Copyright © 2006, The University of Manchester Introduction to Ontologies Tutorial Types of Properties ► Inverse Functional r Of Mothe isBirth Peggy isBirthMotherO f Margaret Peter ► Antisymmetric isChildOf isChildOf David Robert William Ian isChildOf hasAncestor Copyright © 2006, The University of Manchester Gemma hasSibling hasAncestor hasAncestor Matthew Matthew Implies that Peggy and Margaret are the same individual Dorothy ► Transitive hasSibling ► Symmetric X Introduction to Ontologies Tutorial Copyright © 2006, The University of Manchester Introduction to Ontologies Tutorial Properties cntd. know s Of ► Reflexive Describing Classes using Properties ► We now have a property we want to use to describe Pizza individuals ► To do this, we must go back to the Pizza class and add some further information knowsOf George ► Irreflexive Simon ► This comes in the form of Restrictions ► We create Restrictions using the Class Description Frame ► Conditions can be any kind of Class – you have already added Named superclasses in the Class Description Frame. Restrictions are a type of Anonymous Class motherOf Georgina Copyright © 2006, The University of Manchester Simon Introduction to Ontologies Tutorial Creating Properties Copyright © 2006, The University of Manchester Introduction to Ontologies Tutorial Existential Restrictions ► We tend to name properties using camelNotation with a lowercase letter to begin ► We often create properties using 2 standard naming patterns: ► has… (e.g., hasColour) Existential, someValuesFrom “Some”, “At least one” Describe classes of individuals that participate in at least one relationship along a specified property to individuals that are members of a specified class. ► is…Of (e.g., isTeacherOf) or other suffixes (e.g., …In …To) ► This has several advantages: ► It is easier to find properties ► It is easier for tools to generate a more readable form (see tooltips on the classes in the hierarchy later) ► Inverses properties typically follow this pattern e.g., hasPart, isPartOf ► Our example hasBase fits into this (we will not create the inverse in this tutorial) Copyright © 2006, The University of Manchester Introduction to Ontologies Tutorial Copyright © 2006, The University of Manchester Introduction to Ontologies Tutorial Domain and Range Named Classes ► Properties link individuals from the domain to individuals from the range. hasTopping PizzaTopping Pizza = individual Professor Professor Copyright © 2006, The University of Manchester Introduction to Ontologies Tutorial Intersection Classes Copyright © 2006, The University of Manchester Introduction to Ontologies Tutorial Union Classes ►Intersection Classes are formed by combining two or more classes with the intersection (AND) operator. ►Union Classes are formed using the union (OR) operator with two or more classes. In description logics (and in Protege-OWL) we use the union symbol ⊔ In description logics (and in Protege-OWL) we use the intersection symbol ⊓) Human ⊓ Female JavaProgrammer ⊔ CProgrammer JavaProgrammer Copyright © 2006, The University of Manchester Person Person Introduction to Ontologies Tutorial Copyright © 2006, The University of Manchester CProgrammer Introduction to Ontologies Tutorial Complement Classes Exercise 4: Properties & Restrictions ►A complement class is specified by negating another class. It will contain the individuals that are not in the negated class. In Description Logics (and in Protege-OWL) the negation symbol ¬ is used. ¬ Professor ⊓ Woman Woman Professor Copyright © 2006, The University of Manchester Introduction to Ontologies Tutorial Primitive Classes Copyright © 2006, The University of Manchester Introduction to Ontologies Tutorial Asserted Polyhierarchies We believe asserting polyhierarchies is bad ► All classes in our ontology so far are Primitive ► We lose some encapsulation of knowledge ► We describe primitive pizzas ► Why is this class a subclass of that one? ► Primitive Class = only Necessary Conditions ► They are marked as plain orange circles in the class hierarchy ► Difficult to maintain ► Adding new classes becomes difficult because all subclasses may need to be updated ► Extracting from a graph is harder than from a tree We condone building a disjoint tree of primitive classes let the reasoner do it! Copyright © 2006, The University of Manchester Introduction to Ontologies Tutorial Copyright © 2006, The University of Manchester Introduction to Ontologies Tutorial Summary Polyhierarchies ► By the end of this tutorial we intent to create a VegetarianPizza You should now be able to: ► Some of our existing Pizzas should be types of VegetarianPizza ► However, they could also be types of SpicyPizza or CheeseyPizza ► extract Knowledge (and act as an expert) ► identify components of the Protégé-OWL Interface ► We need to be able to give them multiple parents in a principled way ► create Primitive Classes ► We could just assert multiple parents like we did with MeatyVegetableTopping (without disjoints) ► create Properties ► create some basic Restrictions on a Class using Existential qualifiers BUT… Copyright © 2006, The University of Manchester Introduction to Ontologies Tutorial Copyright © 2006, The University of Manchester Introduction to Ontologies Tutorial