Logics for Data and Knowledge Representation Ontology Building
Logics for Data and Knowledge Representation Ontology Building using Protégé : A Tutorial Fausto Giunchiglia and Biswanath Dutta
Outline Introduction q Ontology q OWL Constructors q Protégé and Protégé-OWL q Ontology Building q q q q q 2 Class Hierarchy (subsumption) Disjoint Consistency Check Property Graphical representation Restriction Polyhierarchy Individuals
INTRODUCTION : : ONTOLOGY : : OWL CONSTRUCTORS : : PROTEGE : : ONTOLOGY BUILDING Description Logic (DL) Family There are many varieties of DL and there is an informal naming convention, roughly describing the operators allowed. q 3 OWL Mapping to equivalent DL q OWL Lite closely corresponds to SHIF(D) q OWL DL closely corresponds to SHOIN(D)
INTRODUCTION : : ONTOLOGY : : OWL CONSTRUCTORS : : PROTEGE : : ONTOLOGY BUILDING Terminology Box (TBox) q A terminology box (or TBox) is a set of definitions and specializations q Can be seen as a set of “schema” axioms (sentences) q Terminological axioms express constraints on the concepts of the language, i. e. they limit the possible models q The TBox is the set of all the constraints on the possible models Equivalence Equality axiom Definition Inclusion axiom Specialization TBOX Ph. D ≡ Postgraduate ⊓ ≥ 3 Publish. Paper Parent ≡ Person ⊓ ∃has. Child. Person has. Grand. Child ⊑ has. Child Subsumption 4
INTRODUCTION : : ONTOLOGY : : OWL CONSTRUCTORS : : PROTEGE : : ONTOLOGY BUILDING Assertion Box (ABox) q In an ABox one introduces individuals, by giving them names, and one asserts properties about them. q We denote individual names as a, b, c, … q An assertion with concept C is called concept assertion (or simply assertion) in the form: C(a), C(b), C(c), … q An assertion with Role R is called role assertion in the form: R(a, b), R(b, c), … q So, an ABox is a set of “data” axioms (ground facts) Student(paul) Professor(fausto) Teaches(Fausto, LDKR) 5
INTRODUCTION : : ONTOLOGY : : OWL CONSTRUCTORS : : PROTEGE : : ONTOLOGY BUILDING Knowledge Base (KB) q. A 6 Knowledge Base (KB) = TBox + Abox
INTRODUCTION : : ONTOLOGY : : OWL CONSTRUCTORS : : PROTEGE : : ONTOLOGY BUILDING Ontology q An ontology describes the concepts and relationships that are important in a particular domain, providing a vocabulary for that domain as well as a computerized specification of the meaning of terms used in the vocabulary q Ontologies are ranges from: taxonomies and classifications, q database schemas, q to fully axiomatized theories q q Used in many business and scientific communities as a way to share, reuse and process domain knowledge q Central to many applications such as, scientific knowledge portals, information management and integration systems, electronic commerce, semantic web services, and so forth 7
INTRODUCTION : : ONTOLOGY : : OWL CONSTRUCTORS : : PROTEGE : : ONTOLOGY BUILDING Ontology : Basic Principle q Ontology building is a fun!!! q Before starting modelling an ontology, we need an application in our mind 8
INTRODUCTION : : ONTOLOGY : : OWL CONSTRUCTORS : : PROTEGE : : ONTOLOGY BUILDING Naming Conventions q There are no such standard conventions q Different practices are found, like, q Human. Being q human. Being q Human_being q Use whatever you like q Important: try to be consistent 9
INTRODUCTION : : ONTOLOGY : : OWL CONSTRUCTORS : : PROTEGE : : ONTOLOGY BUILDING OWL Constructs: Classes q Classes (concept, category) are sets of Individuals q Membership of a class is depend on its logical description, NOT on its name q Classes do not have to be named – they can be logical expressions – e. g. , book with yellow cover page q A class is to be described in a way that it is possible for it to contain Individuals, except that you have some specific requirement where it is to represent the empty class q E. g. , Human being, Person, Building, Personal moment, Vacation, Religious residence 10
INTRODUCTION : : ONTOLOGY : : OWL CONSTRUCTORS : : PROTEGE : : ONTOLOGY BUILDING OWL Constructs: Properties q OWL defines the properties, Object property- relate individuals to other individuals (e. g. , is. Taught. By, supervises, is. Student. Of, is. Located. In) q Datatype property- relate individuals to datatype values (e. g. , author, title, phone, age, etc. ) q Annotation property- use to add uninterpreted information (e. g. , versioning information, comment) to classes, properties and individuals q Relationships in OWL are binary q N-ary relations? ? ? q 11
INTRODUCTION : : ONTOLOGY : : OWL CONSTRUCTORS : : PROTEGE : : ONTOLOGY BUILDING OWL Constructs: Individuals q Individuals (Instance, Object) are the objects in the domain q An individual may be (and are likely to be) a member of multiple Classes q E. g. , me, you, this tutorial, this room, this university, my house 12
INTRODUCTION : : ONTOLOGY : : OWL CONSTRUCTORS : : PROTEGE : : ONTOLOGY BUILDING Special Properties q owl: Transitive. Property (transitive property) q q owl: Symmetric. Property (symmetry) q q 13 E. g. “has same grade as”, “is sibling of” owl: Functional. Property defines a property that has at most one value for each object q q E. g. “has better grade than”, “is ancestor of” E. g. “age”, “height”, “direct. Supervisor” owl: Inverse. Functional. Property defines a property for which two different objects cannot have the same value
INTRODUCTION : : ONTOLOGY : : OWL CONSTRUCTORS : : PROTEGE : : ONTOLOGY BUILDING Restriction Types 14 Existential, some. Values. From “Some”, “At least one” Universal, all. Values. From “Only” has. Value “equals x” Cardinality “Exactly n” Max Cardinality “At most n” Min Cardinality “At least n”
INTRODUCTION : : ONTOLOGY : : OWL CONSTRUCTORS : : PROTEGE : : ONTOLOGY BUILDING Protégé Is developed by Stanford Medical Informatics (http: //protege. stanford. edu/) q Is a free, open-source software q Has large and growing user community base q Implements a rich set of knowledge-modeling structures q Supports the creation, visualization, and manipulation of ontologies in various representation formats q In core, Protégé is based on Frames (object oriented) modelling q Supports OWL through the Protégé-OWL plugin q Can be customized to provide domain-friendly support for creating knowledge models and entering data q Supports development of plugins to allow backend / interface extensions q 15
INTRODUCTION : : ONTOLOGY : : OWL CONSTRUCTORS : : PROTEGE : : ONTOLOGY BUILDING Protégé-OWL q The Protégé-OWL editor enables users to: q Load and save OWL and RDF ontologies q Edit and visualize classes, properties, and SWRL (Semantic Web Rule Language) rules q Define logical class characteristics as OWL expressions q Execute reasoners such as description logic classifiers q Edit OWL individuals for Semantic Web markup q Protégé 16 supports SHOIN(D)
INTRODUCTION : : ONTOLOGY : : OWL CONSTRUCTORS : : PROTEGE : : ONTOLOGY BUILDING Saving OWL Files Two files: . pprj – the project file stores information about the GUI and the workspace. owl – the OWL file actual ontology is stored in RDF/OWL format 17
INTRODUCTION : : ONTOLOGY : : OWL CONSTRUCTORS : : PROTEGE : : ONTOLOGY BUILDING Protégé-OWL : Metadata Window Ontology URI Ontology property Ontology(ies) Default Namespaces 18
INTRODUCTION : : ONTOLOGY : : OWL CONSTRUCTORS : : PROTEGE : : ONTOLOGY BUILDING Protégé-OWL : Class Building Window Asserted hierarchy as asserted by the ontology engineer owl: Thing, a root class Subsumption hierarchy Class-specific tools (find usage etc) 19 Class description widget Asserted Conditions Widget Disjoint widget
INTRODUCTION : : ONTOLOGY : : OWL CONSTRUCTORS : : PROTEGE : : ONTOLOGY BUILDING Ontology Building Basic infrastructure (recall!) Classes/ concepts Properties/ roles 20 Object property Datatype property Annotation property [optional] Individuals/ objects/ instances [mandatory ? ? ? ]
INTRODUCTION : : ONTOLOGY : : OWL CONSTRUCTORS : : PROTEGE : : ONTOLOGY BUILDING Basic Things Step 1: Open Protégé Create a new project Select OWL/RDF files as Project type Define the Ontology URI Select OWL DL as Language profile Click to Finish Save the project 21 Important: it is always good to save the ontology after each operation you do while building the ontology
INTRODUCTION : : ONTOLOGY : : OWL CONSTRUCTORS : : PROTEGE : : ONTOLOGY BUILDING Class Hierarchy (subsumption) Step 2: Go to the OWL Classes tab Create the following two classes: Add the following sub. Classes under the class Agent 22 Developer, Producer, Programmer Add the following sub. Classes under the class Mind. Product Agent, Mind. Product (as sub. Class of owl: Thing) Document, Music, Program, Song Under Document, create the following sub. Classes
INTRODUCTION : : ONTOLOGY : : OWL CONSTRUCTORS : : PROTEGE : : ONTOLOGY BUILDING Disjoint In the previous slide, we organized the kind-of classes in a hierarchy (subsumption) Note: human mind can easily process that, say, classes, Agent and Mind. Product are not the same kind-of objects (and that’s why we kept them separately) Step 3: We explicitly mention say the same, i. e. , Agent and Mind. Product are disjoint classes in our ontology using the disjoint wizard Select class Agent Click on Add all siblings in the Disjoints wizard Select Mutually between all siblings 23
INTRODUCTION : : ONTOLOGY : : OWL CONSTRUCTORS : : PROTEGE : : ONTOLOGY BUILDING Disjoint Similarly we make classes, i. e. , Developer, Producer, Programmer as disjoint classes In a similar way, we make the classes, Document, Music, Program, Song as disjoint classes Also make the classes, Book and Magazine as disjoint classes 24 E. g. ,
INTRODUCTION : : ONTOLOGY : : OWL CONSTRUCTORS : : PROTEGE : : ONTOLOGY BUILDING What is Next? So, what we have done till now: Created a new project file Gave a name to this new ontology and save into our local system Created the class hierarchies Explicitly stated the not-kind of classes (disjointness) So, what we do next 25 We first check the consistency of our ontology by running the reasoner Before check the consistency we do another step (see next slide)
INTRODUCTION : : ONTOLOGY : : OWL CONSTRUCTORS : : PROTEGE : : ONTOLOGY BUILDING Consistency Check Step 4: We add a new class, called, Inconsistent. Class_1 under the class Agent Make Inconsistent. Class_1 as disjoint class with all its siblings As per the inheritance rule, Inconsistence. Class_1 has a parent Agent Now make this class such that it has multi-parents To do this, Select class Inconsistent. Class_1 Click on the Add named classes from the Asserted Conditions widget Select the class Development from 26 list Add named classes
INTRODUCTION : : ONTOLOGY : : OWL CONSTRUCTORS : : PROTEGE : : ONTOLOGY BUILDING Consistency Check Now run the consistency check To do this we use the Pellet reasoner (integrated with the Protégé-OWL editor) Check consistency (for efficiency) Classify taxonomy (and check consistency) 27 Compute inferred types (for individuals)
INTRODUCTION : : ONTOLOGY : : OWL CONSTRUCTORS : : PROTEGE : : ONTOLOGY BUILDING Consistency Check Now make the classes Inconsistent. Class_1 and Developer as non-disjoint classes How to do this? 28 Select the class Inconsistent. Class_1 Go to the Disjoints widget and select the class Developer Click on “Delete selected row” Save the ontology Run the consistency check again
INTRODUCTION : : ONTOLOGY : : OWL CONSTRUCTORS : : PROTEGE : : ONTOLOGY BUILDING Next step? So, what is next? Step 5 : we add the following properties Object property Datatype property name, date. Of. Birth, title Annotation property write, download, produce dc: title, dc: creator, dc: date Set the domain and range of those properties Assign the special properties to those properties (wherever needed) 29
INTRODUCTION : : ONTOLOGY : : OWL CONSTRUCTORS : : PROTEGE : : ONTOLOGY BUILDING Object Property Range Domain Important: properties can also be built in a hierarchy (not shown here) 30
INTRODUCTION : : ONTOLOGY : : OWL CONSTRUCTORS : : PROTEGE : : ONTOLOGY BUILDING Datatype Property Range Domain 31
INTRODUCTION : : ONTOLOGY : : OWL CONSTRUCTORS : : PROTEGE : : ONTOLOGY BUILDING Annotation Property 32
INTRODUCTION : : ONTOLOGY : : OWL CONSTRUCTORS : : PROTEGE : : ONTOLOGY BUILDING Graphical View of the Asserted Classes The (Asserted) class hierarchy view OWL Viz 33
INTRODUCTION : : ONTOLOGY : : OWL CONSTRUCTORS : : PROTEGE : : ONTOLOGY BUILDING Restrictions 34 Next, we add class restrictions… (Step 6) This we do from the Asserted Conditions widget
INTRODUCTION : : ONTOLOGY : : OWL CONSTRUCTORS : : PROTEGE : : ONTOLOGY BUILDING Restrictions Restricted property Restriction Filler Create restriction Expression construct palette 35
INTRODUCTION : : ONTOLOGY : : OWL CONSTRUCTORS : : PROTEGE : : ONTOLOGY BUILDING Restrictions : Necessary Conditions We create the following condition: 36 Programmer ⊑ ∃write. Programs Producer ⊑ ∀produce. (Music ⊔ Song) Program ⊑ ∀download. Developer Important: Restrictions are a type of Anonymous Class Each class restrictions on a class become a superclass to that class In the above picture, produce(Music or Song) become a superclass of class Produce
INTRODUCTION : : ONTOLOGY : : OWL CONSTRUCTORS : : PROTEGE : : ONTOLOGY BUILDING What is Next? Now assume that, we have some few more agents, like, Hacker, Tracker, Computer Guru, Inventor We add these agents by creating a new class, called Mixed. Agent Why we are considering them as mixed, because of their following features 37 Hackers and Trackers are basically the Programmer Computer Guru - an authority on computers and computing Inventor - who is the first to think of or make something
INTRODUCTION : : ONTOLOGY : : OWL CONSTRUCTORS : : PROTEGE : : ONTOLOGY BUILDING Class Restrictions Now, from the newly added class description (see previous slide), we see that the classes, Hacker and Tracker are the programmers, which implies that they write Program We explicitly state this knowledge into our ontology in the form of restrictions 38
INTRODUCTION : : ONTOLOGY : : OWL CONSTRUCTORS : : PROTEGE : : ONTOLOGY BUILDING Polyhierarchy Now it is obvious that since Hacker and Tracker are the programmers, we can say that these two classes are also be the child of class Programmer BUT, we do not state this knowledge manually We will use reasoner to do this for us This leads to the polyhierarchy Let reasoner infer this knowledge automatically To get this job done by the reasoner, we need to do one more step 39
INTRODUCTION : : ONTOLOGY : : OWL CONSTRUCTORS : : PROTEGE : : ONTOLOGY BUILDING Polyhierarchy We make the following Necessary Condition as Necessary and Sufficient Condition Programmer ⊑ ∃write. Programs How to make this? Click on the class Programmer Select the following Necessary Condition (in the Asserted Condition widget) Drag and drop it to the Necessary and Sufficient Condition block 40
INTRODUCTION : : ONTOLOGY : : OWL CONSTRUCTORS : : PROTEGE : : ONTOLOGY BUILDING Polyhierarchy Now run the reasoner You see the following 41 In the Inferred Hierarchy window, classes with blue colors represent the newly REorganized classes Classify taxonomy (and check consistency)
INTRODUCTION : : ONTOLOGY : : OWL CONSTRUCTORS : : PROTEGE : : ONTOLOGY BUILDING REorganized Class Hierarchy 42
INTRODUCTION : : ONTOLOGY : : OWL CONSTRUCTORS : : PROTEGE : : ONTOLOGY BUILDING Individuals 43
- Slides: 43