- Количество слайдов: 101
SEMANTIC WEB, OWL & PROTÉGÉ Matthew J Wood CS 570 – Topics in Artificial Intelligence Spring 2013
Today’s Web l Most of today’s Web content is suitable for human consumption l l Even Web content that is generated automatically from databases is usually presented without the original structural information found in databases Typical Web uses today people’s l seeking and making use of information, searching for and getting in touch with other people, reviewing catalogs of online stores and ordering products by filling out forms 2
Keyword-Based Search Engines l Current Web activities are not particularly well supported by software tools l l Except for keyword-based search engines (e. g. Google, Alta. Vista, Yahoo) The Web would not have been the huge success it was, were it not for search engines 3
Problems of Keyword-Based Search Engines l l l High recall, low precision. Low or no recall Results are highly sensitive to vocabulary Results are single Web pages Human involvement is necessary to interpret and combine results Results of Web searches are not readily accessible by other software tools 4
The Key Problem of Today’s Web l l The meaning of Web content is not machineaccessible: lack of semantics It is simply difficult to distinguish the meaning between these two sentences: I am a professor of computer science, you may think. Well, . . . 5
The Semantic Web Approach l l l Represent Web content in a form that is more easily machine-processable. Use intelligent techniques to take advantage of these representations. The Semantic Web will gradually evolve out of the existing Web, it is not a competition to the current WWW 6
What is Semantic Web? Semantic web is a term used more specifically to refer to format and technologies that enable it. It defines the collection, structuring and recovery of linked data that are enabled by the technologies that provide a formal description of concepts, terms, and relationships within a given knowledge domain.
What is Semantic Web? Sematic Web is the extension of the World Wide Web that enables people to share content beyond the boundaries of applications and websites Semantic web was term coined by Tim Berners. Lee, the inventor of World Wide Web and the director of the World Wide Web Consortium. He defines it as “a web of data that can be processed directly and indirectly by machines.
Why Semantic Web? Semantic Web is about common formats for integration and combination of data from diverse sources. Secondly, it is about language for recording the relationship data and the real world objects.
Semantic Web Components Resource Description Framework (RDF) RDF Schema (RDFS) Simple Knowledge Organization System (SKOS) SPARQL, an RDF query language Notation 3 (N 3) N-Triples Turtle (Terse RDF Triple Language) Web Ontology Language (OWL)
Explicit Metadata l l This representation is far more easily processable by machines Metadata: data about data l l Metadata capture part of the meaning of data Semantic Web does not rely on text-based manipulation, but rather on machineprocessable metadata 11
On HTML l l l Web content is currently formatted for human readers rather than programs HTML is the predominant language in which Web pages are written (directly or using tools) Vocabulary describes presentation 12
An HTML Example
But note that we do not offer consultation during the weeks of the State Of Origin games. 13
Problems with HTML l l Humans have no problem with this Machines (software agents) do: l l l How distinguish therapists from the secretary, How determine exact consultation hours They would have to follow the link to the State Of Origin games to find when they take place. 14
XML (e. Xtended Markup Language) l l l A better representation of data XML is a flexible text format that is widely used to structure, store, and transport data. XML is different from HTML because it is not about displaying data. In XML (differently from HTML) you create your own tags to annotate data. XML is used to create other languages such as: XHTML, RSS, RDF, OWL, etc. 15
RDF (Resource Description Framework) l l l l RDF: a standard for describing resources on the Web The meaning of data is encoded in sets of triples. Triples are “subject, predicate, object” statements. Each element of a triple is identified by a URIs represent both resources and relations. RDF is written in XML RDF is to Semantic Web what HTML was to the Web. Harry Potter has as author J. K. Rowling. 17
An RDF Example http: //en. wikipedia. org/wiki/J. _K. _Rowling dc: creator http: //en. wikipedia. org/wiki/ Harry_Potter
Ontologies and OWL l l l An ontology is an explicit description of things and their relations. OWL serves to write ontologies for the Web. OWL is written in XML and built on top of RDF. You can think of OWL as an object-oriented language that defines classes, hierarchy of classes, attributes, relations, etc. OWL is designed to support inference (subsumption and classification) OWL is more expressive than RDF. 19
Typical Components of Ontologies l Terms denote important concepts (classes of objects) of the domain l l e. g. professors, staff, students, courses, departments Relationships between these terms: typically class hierarchies l l a class C to be a subclass of another class C' if every object in C is also included in C' e. g. all professors are staff members 20
Further Components of Ontologies l Properties: l l Value restrictions l l e. g. only faculty members can teach courses Disjointness statements l l e. g. X teaches Y e. g. faculty and general staff are disjoint Logical relationships between objects l e. g. every department must include at least 10 faculty 21
Example of a Class Hierarchy 22
The Role of Ontologies on the Web l Ontologies provide a shared understanding of a domain: semantic interoperability l l l overcome differences in terminology mappings between ontologies Ontologies are useful for the organization and navigation of Web sites 23
The Role of Ontologies in Web Search l Ontologies are useful for improving the accuracy of Web searches l l search engines can look for pages that refer to a precise concept in an ontology Web searches can exploit generalization/ specialization information l l If a query fails to find any relevant documents, the search engine may suggest to the user a more general query. If too many answers are retrieved, the search engine may suggest to the user some specializations. 24
Web Ontology Languages (2) OWL l A richer ontology language l relations between classes l l cardinality l l l e. g. , disjointness e. g. “exactly one” richer typing of properties characteristics of properties (e. g. , symmetry) 25
Software Agents l Software agents work autonomously and proactively l l They evolved out of object oriented and compontent-based programming A personal agent on the Semantic Web will: l l receive some tasks and preferences from the person seek information from Web sources, communicate with other agents compare information about user requirements and preferences, make certain choices give answers to the user 26
Intelligent Personal Agents A Semantic Web Primer 27
Semantic Web Agent Technologies l Metadata l l Ontologies l l l Identify and extract information from Web sources Web searches, interpret retrieved information Communicate with other agents Logic l Process retrieved information, draw conclusions 28
Drawbacks of XML l l XML is a universal metalanguage for defining markup It provides a uniform framework 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 l It is up to each application to interpret the nesting. 29
Requirements for Ontology Languages l l Ontology languages allow users to write explicit, formal conceptualizations of domain models The main requirements are: l l l a well-defined syntax efficient reasoning support a formal semantics sufficient expressive power convenience of expression 30
Tradeoff between Expressive Power and Efficient Reasoning Support l l l The richer the language is, the more inefficient the reasoning support becomes Sometimes it crosses the border of noncomputability We need a compromise: l l A language supported by reasonably efficient reasoners A language that can express large classes of ontologies and knowledge. 31
Reasoning About Knowledge in Ontology Languages l Class membership l l 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 l If class A is equivalent to class B, and class B is equivalent to class C, then A is equivalent to C, too 32
Reasoning About Knowledge in Ontology Languages (2) l Consistency l l l X instance of classes A and B, but A and B are disjoint This is an indication of an error in the ontology Classification l 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 33
Uses for Reasoning l Reasoning support is important for l l checking the consistency of the ontology and the knowledge checking for unintended relationships between classes automatically classifying instances in classes Checks like the preceding ones are valuable for l l designing large ontologies, where multiple authors are involved integrating and sharing ontologies from various sources 34
Reasoning Support for OWL l l Semantics is a prerequisite for reasoning support Formal semantics and reasoning support are usually provided by l l 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 35
Three Species of OWL l W 3 C’s. Web Ontology Working Group defined OWL as three different sublanguages: l l OWL Full OWL DL OWL Lite Each sublanguage geared toward fulfilling different aspects of requirements 36
OWL DL OWL DL is so named due to its correspondence with description logic. Description logic (DL) is a family of formal knowledge representation languages. It is more expressive than propositional logic It models concepts, roles and individuals, and their relationships It is used in AI formal reasoning on the concept of application domain known as Terminological knowledge
What is protege? l l l Protege is a free, open-source platform to construct domain models and knowledge-based applications with ontologies. Ontologies range from taxonomies, classifications, database schemas to fully axiomatized theories. Ontologies are now central to many applications such as scientific knowledge portals, information management and integration systems, electronic commerce and web services
What can you do with Protégé? l l l Create a new ontology from scratch Download and extend an existing ontology Export ontologies in a variety of formats l l l OWL RDF XML Schema
How it works l l Objects in the domain are expressed through a series of interrelated classes Class hierarchy is similar to that used by objectoriented languages such as Java l l l Superclasses Subclasses Sibling Classes Ancestor Classes, etc. Heavy reliance on inheritance l Unlike Java, Protégé supports multiple inheritance
Individuals and Properties l l l Individual domain objects are expressed as class members Class members have object properties that relate them to members of the same class or other classes Also have data properties l l Expressed by data type – integer, String, etc. If particular data property does not fit a predefined data type it can be entered as text l Ex. Members of the class Soccer_Players have ‘has fanpage’ data property that is expressed as a URL
Annotations l l Provide definitions and comments on the ontology and its contents Can provide annotations for the entire ontology, a specific class, a member of a class, etc.
How It Works (cont. ) l l Using Protégé in conjunction with Graph. Viz software allows users to view the ontology as a semantic network Protégé relies on semantic reasoners to implement description logic
Semantic Reasoners l l l Inference engine for description logics Inference process is carried out via forward and backward chaining Protégé supports various reasoners such as Fa. CT++ and Hermi. T
Fa. CT++ l l Semantic reasoner used for OWL DL ontologies Implemented in C++ and supported by Protege Converts the KB into an internal representation using various optimization techniques Uses dependency directed backtracking to check satisfiability of the KB
Install Protege l l l Go to http: //protege. stanford. edu/doc/owl/gettingstarted. html to download protege (version 3. x) Protege OWL editor is built with the full installation of protege platform. During the install process, choose the “Basic+OWL” option. For more details: http: //protege. stanford. edu/doc/owl/gettingstarted. html
Protege l There are two main ways of modelling ontologies: l l l Frame-based OWL Each has its own user interface l Protege Frames editor: enables users to build and populate ontologies that are frame-based, in accordance with OKBC (Open Knowledge Base Connectivity Protocol). l l Classes Slots for properties and relationships Instances for class Protege OWL editor: enables users to build ontology for the Semantic Web, in particular to OWL l l Classes Properties Instances reasoning
Building an OWL Ontology l E 2: Create a new OWL project l l Start protege File – New Project – OWL/RDF files – Ontology URI (http: //www. pizza. com/ontologies/pizza. owl) – OWL DL – Properties View A new empty Protege-OWL project has been created. Save it in your local file as pizza. owl
Named Classes l l Go to OWL Classes tab The empty class tree contains one class called owl: Thing, which is superclass of everything. E 3: Create subclasses Pizza, Pizza. Topping and Pizza. Base. They are subclasses of owl: Thing. Naming convention l l no special naming convention consistency
Disjoint classes l E 4: How to say that Pizza, Pizza. Topping and Pizza. Base classes are disjoint. 1. Select the class Pizza 2. Press “add siblings” button on the disjoint classes widget 3. Add Pizza. Base and Pizza. Topping 4. Select the class Pizza. Topping, 5. Add Pizza and Pizza. Base to the disjoint class
E 5: Create group of classes l l Create Thin. And. Crisy. Base and Deep. Pan. Base as the subclasses of Pizza. Base, and each of them are disjointed. Select Pizza. Base, right click the mouse, select “create subclasses” Follow the wizard to create these two disjoint classes. It will save lots of time when there is need to create lots of disjoint classes.
E 6: Create some subclasses of Pizza. Topping l Select Pizza. Topping, l l Select the class Meat. Topping, l l Create subclaesses as Meat. Topping, Vegetable. Topping, Cheese. Topping and Seafood. Topping. Make sure that these classes are disjoint to each other. Add disjoint subclasses: Spicy. Beef. Topping, Pepperoni. Topping, Salami. Topping and Ham. Topping Select Vegetable. Topping: l Add disjoint subclasses: Tomato. Topping, Olive. Topping, Mushroom. Topping, Pepper. Topping, Onion. Topping, Caper. Topping
E 6: Creating disjoint subclasses l Select Pepper. Topping l l Select Cheese. Topping l l Add disjoint subclasses: Red. Pepper. Topping, Green. Pepper. Topping, Jalapeno. Pepper. Topping Add disjoint subclasses: Mozzarella. Topping, Parmezan. Topping Select Seafood. Topping l Add disjoint subclasses: Tuna. Topping, Anchovy. Topping and Prawn. Topping
OWL Properties l l OWL Properties represent relationships between two objects. There are two main properties: l l l Object properties: link object to object datatype properties: link object to XML Schema datatype or rdf: literal OWL has another property – Annotation properties, to be used to add annotation information to classes, individuals, and properties
E 7: Create an object property l l l Switch to the “Properties” tab, Use “Create Object Property” button to create a new object property. Rename it to has. Ingredient
E 8: Creating sub-properties l Select has. Ingredient property l Add has. Topping and has. Base as the subproperties
Inverse Properties l l Each object property may have a corresponding inverse property. If some property links individual a to individual b, then its inverse property will link individual b to individual a.
E 9: Create inverse properties l Create a new object property called is. Ingredient. Of l l Select has. Base l l l Press “Set inverse property” button, Select “has. Ingredient” Then the inverse relation has been set up. Create the is. Base. Of as the inverse property of has. Base is. Base. Of is the subproperty of is. Ingredient. Of Select has. Topping l l create is. Topping. Of as the inverse property. is. Topping. Of is the subproperty of is. Ingredient. Of
Functional Properties l If a property is functional, for a given individual, there can only be at most one individual to be related via this property. l l For a given domain, range must be unique Functional properties are also known as single valued properties.
Inverse Functional Properties l If a property is inverse functional, then its inverse property is functional. l For a given range, domain must be unique.
Functional vs. inverse functional properties l Functional. Property vs Inverse. Functional. Property domain range example Functional Property For a given domain Range is unique has. Father: A has. Father B, A has. Father C B=C Inverse. Functional Property Domain is unique For a given range has. ID: A has. ID B, C has. ID B A=C
Transitive Properties l If a property is transitive, and the property related individual a to individual b, and also individual b to individual c, then we can infer that individual a is related to individual c via property P.
Symmetric Properties l If a property P is symmetric, and the property relates individual a to individual b, then individual b is also related to individual a via property P.
E 10: Make the has. Ingredient property transitive l l l Select the has. Ingredient property Tick the transitive tick box Select the is. Ingredient. Of property, make sure that the transitive tick box is ticked.
E 11: Make the has. Base property functional l Select the has. Base property Tick the “functional” tick box OWL-DL does not allow datatype properties to be transitive, symmetric or have inverse properties.
Property domains and ranges l l Properties link individuals from the domain to individuals from the range. OWL uses domain and range as axioms in reasoning.
E 12: Specify the range of has. Topping l Select has. Topping l l l Press range button Select Pizza. Topping Press OK button Pizza. Topping should be displayed in the range list. When multiple classes are added to the range, they represent the union of all classes.
E 13: Specify Pizza as the domain of the has. Topping property l Select has. Topping property l l l Press add domain button Select Pizza Press OK Pizza is displayed in the domain list. When multiple classes are added as domain, they represent as the union of these classes.
E 14: Specify the domain and range for the is. Topping. Of property l l l Select the is. Topping. Of property Set the domain of the is. Topping. Of property to Pizza. Topping Set the range of the is. Topping. Of property to Pizza.
E 15: Specify the domain and range for the has. Base property and its inverse property is. Base. Of l Select the has. Base property l l l Specify the domain as Pizza Specify the range as Pizza. Base Select the is. Base. Of property l l Specify the domain as Pizza. Base Specify the range as Pizza
Property restrictions l l l In OWL, properties are used to create restrictions. Restrictions are used to restrict the individuals that belong to a class Three restrictions: l l l Quantifier restrictions l Existential quantifier ( l Universal quantifier ( Cardinality restrictions has. Value restrictions ) )
E 16: Add a restriction to Pizza l Add a restriction to Pizza that specifies a Pizza must have a Pizza. Base l l l Select Pizza Select Necessary header to create a necessary condition Select create a restriction wizard l l l Select has. Base as restricted property Select some. Value. From as restriction Put Pizza. Base into the filler
Add a restriction to Pizza
E 18: Creating different kinds of Pizzas l l Create a subclass of Pizza called Named. Pizza, and a subclass of Named. Pizza called Margherita. Pizza. Add comment to Margherita. Pizza: A pizza that only has Mozarella and Tomato toppings
E 19: Adding restrictions to Margherita. Pizza l To specify that Margherita. Pizza has at least one Mozzarella. Topping. l l l Select Margherita. Pizza Go to “Asserted Conditions”, create new restriction. Select some. Value. From Select has. Topping as the property to be restricted. Enter Mozzarella. Topping as the filler Press OK button
E 20: Adding restrictions to Margherita. Pizza l To specify that Margherita. Pizza has at least one Tomato. Topping. l l l Select Margherita. Pizza Go to “Asserted Conditions”, create new restriction. Select some. Value. From Select has. Topping as the property to be restricted. Enter Tomato. Topping as the filler Press OK button
E 21: Create American. Pizza l l Create American. Pizza with toppings of pepperoni, mozzarella and tomato. Through cloning and modifying the description of Margherita. Pizza. l l l Select Margherita. Pizza Select create clone Add additional restriction to Americana. Pizza l l Adding Pepperoni. Topping Press OK.
E 22: Create an American. Hot. Pizza and a Soho. Pizza l l An American. Hot. Pizza is almost the same as an Americana. Pizza, but has Jalapeno. Pepper. Topping on it. A Soho. Pizza is almost the same as a Margherita. Pizza, but has additional Olive. Topping and Parmezan. Topping
E 23: Make subclasses of Named. Pizza disjoint from each other l l Select Margherita. Pizza Press “add all siblings” button on the “Disjoints widget” to make the pizzas disjoint from each other.
Using a reasoner l l l Ontology described in OWL-DL can be processed by a reasoner. l Go to owl—preference, to make sure that OWL-DL is selected. The main services offered by a reasoner is to test whether or not one class is a subclass of another class. By performing such tests on all of the classes, it is possible for a reasoner to compute the inferred ontology class hierarchy. Another reasoning service is consistency checking – to check whether or not it is possible for the class to have any instances. A class is deemed to be inconsistent if it cannot possibly have any instances.
Using Racer l l In order to reason over the ontology in Protege-OWL, a DIG compliant reasoner should be installed and started. In this example, we use Racer, l l Download at: http: //www. racersystems. com/products/download/index. phtml Double click Racer. Pro to start Racer.
Invoking the reasoner l l l Having started Racer, the ontology can be sent to the reasoner to automatically compute the classification hierarchy, and also check the logical consistency of the ontology. In Protege, the manually constructed class hierarchy is called the asserted hierarchy. The automatically computed by the reasoner is called the inferred hierarchy. Go to OWL – classify taxonomy – to invoke the reasoner l If a class has been reclassified, then the class name will appear in a blue color in the inferred hierarchy. Go to OWL – Check consistency – to invoke the reasoner l If a class has been found to be inconsistent, it’s icon will be circled in red color. Computing the inferred class hierarchy is also known as classifying the ontology.
Invoke the reasoner
E 24: Inconsistent classes l In order to demonstrate the use of the reasoner to detect inconsistencies in the ontology, we will create a class Probe. Inconsistent. Topping, l l l Which is the subclass of Cheese. Topping Select Probe. Inconsistent. Topping, go to asserted condition to add named classes, select Vegetable. Topping and then press OK. Go to OWL – check consistency
E 25: Classify the ontology again l To see Probe. Inconsistent. Topping is inconsistent.
E 26: Remove the disjoint statement l Between Cheese. Topping and Vegetable. Topping to see what happens l l l Select Cheese. Topping Go to Disjoint part Select Vegetable. Topping, right click and “Delete the selected row”. Classify taxonomy The inconsistency no longer exists.
E 27: Fix the ontology l By making Cheese. Topping and Vegetable. Topping disjoint from each other.
SPORTS ONTOLOGICAL EXTENSION IN PROTÉGÉ
Project #1 l l l Used Protégé to extend a general sports ontology (sptcsem. owl) Focused on adding classes, individuals, and properties related to the game of soccer Used Fact++ for DL queries