450 likes | 600 Views
L ogics for D ata and K nowledge R epresentation. Ontology Building using Protégé : A Tutorial. Fausto Giunchiglia and Biswanath Dutta. Outline. Introduction Ontology OWL Constructors Protégé and Protégé-OWL Ontology Building Class Hierarchy (subsumption) Disjoint
E N D
Logics for Data and KnowledgeRepresentation Ontology Building using Protégé : A Tutorial Fausto Giunchiglia and Biswanath Dutta
Outline • Introduction • Ontology • OWL Constructors • Protégé and Protégé-OWL • Ontology Building • Class Hierarchy (subsumption) • Disjoint • Consistency Check • Property • Graphical representation • Restriction • Polyhierarchy • Individuals 2
Description Logic (DL) Family INTRODUCTION :: ONTOLOGY :: OWL CONSTRUCTORS :: PROTEGE :: ONTOLOGY BUILDING There are many varieties of DL and there is an informal naming convention, roughly describing the operators allowed. • OWL Mapping to equivalent DL • OWL Lite closely corresponds to SHIF(D) • OWL DL closely corresponds to SHOIN(D) 3
Terminology Box (TBox) INTRODUCTION :: ONTOLOGY :: OWL CONSTRUCTORS :: PROTEGE :: ONTOLOGY BUILDING • A terminology box (or TBox) is a set of definitions and specializations • Can be seen as a set of “schema” axioms (sentences) • Terminological axioms express constraints on the concepts of the language, i.e. they limit the possible models • The TBox is the set of all the constraints on the possible models Equivalence TBOX Equality axiom Definition PhD ≡ Postgraduate ⊓ ≥3Publish.Paper Parent ≡ Person ⊓ ∃hasChild.Person hasGrandChild ⊑ hasChild Inclusion axiom Specialization Subsumption 4
Assertion Box (ABox) INTRODUCTION :: ONTOLOGY :: OWL CONSTRUCTORS :: PROTEGE :: ONTOLOGY BUILDING • In an ABox one introduces individuals, by giving them names, and one asserts properties about them. • We denote individual names as a, b, c,… • An assertion with concept C is called concept assertion (or simply assertion) in the form: C(a), C(b), C(c), … • An assertion with Role R is called role assertion in the form: R(a, b), R(b, c), … • So, an ABox is a set of “data” axioms (ground facts) Student(paul) Professor(fausto) Teaches(Fausto, LDKR) 5
Knowledge Base (KB) INTRODUCTION :: ONTOLOGY :: OWL CONSTRUCTORS :: PROTEGE :: ONTOLOGY BUILDING • A Knowledge Base (KB) = TBox + Abox 6
Ontology INTRODUCTION :: ONTOLOGY :: OWL CONSTRUCTORS :: PROTEGE :: ONTOLOGY BUILDING • 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 • Ontologies are ranges from: • taxonomies and classifications, • database schemas, • to fully axiomatized theories • Used in many business and scientific communities as a way to share, reuse and process domain knowledge • Central to many applications such as, scientific knowledge portals, information management and integration systems, electronic commerce, semantic web services, and so forth 7
Ontology : Basic Principle INTRODUCTION :: ONTOLOGY :: OWL CONSTRUCTORS :: PROTEGE :: ONTOLOGY BUILDING • Ontology building is a fun!!! • Before starting modelling an ontology, we need an application in our mind 8
Naming Conventions INTRODUCTION :: ONTOLOGY :: OWL CONSTRUCTORS :: PROTEGE :: ONTOLOGY BUILDING • There are no such standard conventions • Different practices are found, like, • HumanBeing • humanBeing • Human_being • Use whatever you like • Important: try to be consistent 9
OWL Constructs: Classes INTRODUCTION :: ONTOLOGY :: OWL CONSTRUCTORS :: PROTEGE :: ONTOLOGY BUILDING • Classes (concept, category) are sets of Individuals • Membership of a class is depend on its logical description, NOT on its name • Classes do not have to be named – they can be logical expressions – e.g., book with yellow cover page • 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 • E.g., Human being, Person, Building, Personal moment, Vacation, Religious residence 10
OWL Constructs: Properties INTRODUCTION :: ONTOLOGY :: OWL CONSTRUCTORS :: PROTEGE :: ONTOLOGY BUILDING • OWL defines the properties, • Object property- relate individuals to other individuals (e.g., isTaughtBy, supervises, isStudentOf, isLocatedIn) • Datatype property- relate individuals to datatype values (e.g. , author, title, phone, age, etc.) • Annotation property- use to add uninterpreted information (e.g., versioning information, comment) to classes, properties and individuals • Relationships in OWL are binary • N-ary relations??? 11
OWL Constructs: Individuals INTRODUCTION :: ONTOLOGY :: OWL CONSTRUCTORS :: PROTEGE :: ONTOLOGY BUILDING • Individuals (Instance, Object) are the objects in the domain • An individual may be (and are likely to be) a member of multiple Classes • E.g., me, you, this tutorial, this room, this university, my house 12
Special Properties INTRODUCTION :: ONTOLOGY :: OWL CONSTRUCTORS :: PROTEGE :: ONTOLOGY BUILDING • owl:TransitiveProperty (transitive property) • E.g. “has better grade than”, “is ancestor of” • owl:SymmetricProperty (symmetry) • E.g. “has same grade as”, “is sibling of” • owl:FunctionalProperty defines a property that has at most one value for each object • E.g. “age”, “height”, “directSupervisor” • owl:InverseFunctionalProperty defines a property for which two different objects cannot have the same value 13
Restriction Types INTRODUCTION :: ONTOLOGY :: OWL CONSTRUCTORS :: PROTEGE :: ONTOLOGY BUILDING 14
Protégé INTRODUCTION :: ONTOLOGY :: OWL CONSTRUCTORS :: PROTEGE :: ONTOLOGY BUILDING • Is developed by Stanford Medical Informatics (http://protege.stanford.edu/) • Is a free, open-source software • Has large and growing user community base • Implements a rich set of knowledge-modeling structures • Supports the creation, visualization, and manipulation of ontologies in various representation formats • In core, Protégé is based on Frames (object oriented) modelling • Supports OWL through the Protégé-OWL plugin • Can be customized to provide domain-friendly support for creating knowledge models and entering data • Supports development of plugins to allow backend / interface extensions 15
Protégé-OWL INTRODUCTION :: ONTOLOGY :: OWL CONSTRUCTORS :: PROTEGE :: ONTOLOGY BUILDING • The Protégé-OWL editor enables users to: • Load and save OWL and RDF ontologies • Edit and visualize classes, properties, and SWRL (Semantic Web Rule Language) rules • Define logical class characteristics as OWL expressions • Execute reasoners such as description logic classifiers • Edit OWL individuals for Semantic Web markup • Protégé supports SHOIN(D) 16
Saving OWL Files INTRODUCTION :: ONTOLOGY :: OWL CONSTRUCTORS :: PROTEGE :: ONTOLOGY BUILDING 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 Namespaces 18
Protégé-OWL : Class Building Window INTRODUCTION :: ONTOLOGY :: OWL CONSTRUCTORS :: PROTEGE :: ONTOLOGY BUILDING Asserted hierarchy as asserted by the ontology engineer Class description widget owl:Thing, a root class Subsumption hierarchy Asserted Conditions Widget Class-specific tools (find usage etc) Disjoint widget 19
Ontology Building INTRODUCTION :: ONTOLOGY :: OWL CONSTRUCTORS :: PROTEGE :: ONTOLOGY BUILDING • Basic infrastructure (recall!) • Classes/ concepts • Properties/ roles • Object property • Datatype property • Annotation property [optional] • Individuals/ objects/ instances [mandatory ???] 20
Basic Things INTRODUCTION :: ONTOLOGY :: OWL CONSTRUCTORS :: PROTEGE :: ONTOLOGY BUILDING • 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 • Important: it is always good to save the ontology after each operation you do while building the ontology 21
Class Hierarchy (subsumption) INTRODUCTION :: ONTOLOGY :: OWL CONSTRUCTORS :: PROTEGE :: ONTOLOGY BUILDING • Step 2: • Go to the OWL Classes tab • Create the following two classes: • Agent, MindProduct (as subClass of owl:Thing) • Add the following subClasses under the class Agent • Developer, Producer, Programmer • Add the following subClasses under the class MindProduct • Document, Music, Program, Song • Under Document, create the following subClasses • Book, Magazine 22
Disjoint INTRODUCTION :: ONTOLOGY :: OWL CONSTRUCTORS :: PROTEGE :: ONTOLOGY BUILDING • 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 MindProduct 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 MindProduct are disjoint classes in our ontology using the disjoint wizard • Select class Agent • Click on Add all siblings in the Disjoints wizard • SelectMutually between all siblings 23
Disjoint INTRODUCTION :: ONTOLOGY :: OWL CONSTRUCTORS :: PROTEGE :: ONTOLOGY BUILDING • 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 E.g., 24
What is Next? INTRODUCTION :: ONTOLOGY :: OWL CONSTRUCTORS :: PROTEGE :: ONTOLOGY BUILDING • 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 • We first check the consistency of our ontology by running the reasoner • Before check the consistency we do another step (see next slide) 25
Consistency Check INTRODUCTION :: ONTOLOGY :: OWL CONSTRUCTORS :: PROTEGE :: ONTOLOGY BUILDING Add named classes • Step 4: We add a new class, called, InconsistentClass_1 under the class Agent • Make InconsistentClass_1 as disjoint class with all its siblings • As per the inheritance rule, InconsistenceClass_1 has a parentAgent • Now make this class such that it has multi-parents • To do this, • Select class InconsistentClass_1 • Click on the Add named classes from the Asserted Conditions widget • Select the class Development from list • Press Ok 26
Consistency Check INTRODUCTION :: ONTOLOGY :: OWL CONSTRUCTORS :: PROTEGE :: ONTOLOGY BUILDING • Now run the consistency check • To do this we use the Pellet reasoner (integrated with the Protégé-OWL editor) Check consistency (for efficiency) Compute inferred types (for individuals) Classify taxonomy (and check consistency) 27
Consistency Check INTRODUCTION :: ONTOLOGY :: OWL CONSTRUCTORS :: PROTEGE :: ONTOLOGY BUILDING • Now make the classes InconsistentClass_1 and Developer as non-disjoint classes • How to do this? • Select the class InconsistentClass_1 • Go to the Disjoints widget and select the class Developer • Click on “Delete selected row” • Save the ontology • Run the consistency check again 28
Next step? INTRODUCTION :: ONTOLOGY :: OWL CONSTRUCTORS :: PROTEGE :: ONTOLOGY BUILDING • So, what is next? • Step 5 : we add the following properties • Object property • write, download, produce • Datatype property • name, dateOfBirth, title • Annotation property • dc:title, dc:creator, dc:date • Set the domain and range of those properties • Assign the special properties to those properties (wherever needed) 29
Object Property INTRODUCTION :: ONTOLOGY :: OWL CONSTRUCTORS :: PROTEGE :: ONTOLOGY BUILDING Domain Range • Important: properties can also be built in a hierarchy (not shown here) 30
Datatype Property INTRODUCTION :: ONTOLOGY :: OWL CONSTRUCTORS :: PROTEGE :: ONTOLOGY BUILDING Domain Range 31
Annotation Property INTRODUCTION :: ONTOLOGY :: OWL CONSTRUCTORS :: PROTEGE :: ONTOLOGY BUILDING 32
Graphical View of the Asserted Classes INTRODUCTION :: ONTOLOGY :: OWL CONSTRUCTORS :: PROTEGE :: ONTOLOGY BUILDING • The (Asserted) class hierarchy view OWL Viz 33
Restrictions INTRODUCTION :: ONTOLOGY :: OWL CONSTRUCTORS :: PROTEGE :: ONTOLOGY BUILDING • Next, we add class restrictions… (Step 6) • This we do from the Asserted Conditions widget 34
Restrictions INTRODUCTION :: ONTOLOGY :: OWL CONSTRUCTORS :: PROTEGE :: ONTOLOGY BUILDING Create restriction Filler Restricted property Restriction Expression construct palette 35
Restrictions : Necessary Conditions INTRODUCTION :: ONTOLOGY :: OWL CONSTRUCTORS :: PROTEGE :: ONTOLOGY BUILDING • We create the following condition: • 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 36
What is Next? INTRODUCTION :: ONTOLOGY :: OWL CONSTRUCTORS :: PROTEGE :: ONTOLOGY BUILDING • 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 MixedAgent • Why we are considering them as mixed, because of their following features • 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 37
Class Restrictions INTRODUCTION :: ONTOLOGY :: OWL CONSTRUCTORS :: PROTEGE :: ONTOLOGY BUILDING • 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
Polyhierarchy INTRODUCTION :: ONTOLOGY :: OWL CONSTRUCTORS :: PROTEGE :: ONTOLOGY BUILDING • 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 • This leads to the polyhierarchy • BUT, we do not state this knowledge manually • We will use reasoner to do this for us • Let reasoner infer this knowledge automatically • To get this job done by the reasoner, we need to do one more step 39
Polyhierarchy INTRODUCTION :: ONTOLOGY :: OWL CONSTRUCTORS :: PROTEGE :: ONTOLOGY BUILDING • 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
Polyhierarchy INTRODUCTION :: ONTOLOGY :: OWL CONSTRUCTORS :: PROTEGE :: ONTOLOGY BUILDING • Now run the reasoner • You see the following • In the Inferred Hierarchy window, classes with blue colors represent the newly REorganized classes Classify taxonomy (and check consistency) 41
REorganized Class Hierarchy INTRODUCTION :: ONTOLOGY :: OWL CONSTRUCTORS :: PROTEGE :: ONTOLOGY BUILDING 42
Individuals INTRODUCTION :: ONTOLOGY :: OWL CONSTRUCTORS :: PROTEGE :: ONTOLOGY BUILDING 43