Download Building Ontologies for Artificial Intelligence: A Step-by-Step Guide and more Study notes Computer Science in PDF only on Docsity! Artificial Intelligence Programming Ontologies Chris Brooks Department of Computer Science University of San Francisco Department of Computer Science — University of San Francisco – p.1/?? 11-0: Review of FOL Some more FOL samples ... Department of Computer Science — University of San Francisco – p.2/?? 11-1: Knowledge Engineering FOL gives us an answer to how to say things. It doesn’t tell us what to say. In large domains, this is the hard part. We need to include enough knowledge to allow our system to answer all queries of interest. The process of building a knowledge base is referred to as knowledge engineering. Department of Computer Science — University of San Francisco – p.3/?? 11-2: Knowledge Engineering A knowledge engineering process typically consists of the following steps: 1. Determine allowable queries and types of facts that will be available. For example, will the agent need to select actions or make conclusions, or just answer questions? 2. Gather the relevant knowledge. Interview experts, find out how the domain works 3. Select a vocabulary or predicates, functions, and constants. This is called an ontology. 4. Encode general knowledge about the domain. Formally represent the knowledge gathered in step 2. This may require revisiting step 3. 5. Encode specific queries or problems that are to be solved. Return to steps 3 and 4 as needed. Department of Computer Science — University of San Francisco – p.4/?? 11-3: Ontologies An ontology is a vocabulary that describes all the objects of interest in the domain and the relations between them. Ontologies allow knowledge about a domain to be shared between agents (including humans) Allows knowledge to be re-used more easily.. Allows an agent to perform inference about current knowledge. Department of Computer Science — University of San Francisco – p.5/?? 11-4: Vocabulary An ontology consists of: A set of concepts or classes Professor(Brooks), ∀ x Professor(x) → USFEmployee(x) Features or attributes of these classes, often called slots or properties or roles. Salary(Brooks, $500), Name(Brooks,′ Chris′) Restrictions on slots (sometimes called facets) ∀x, y Professor(x) ∧ Salary(x, y) → x < $1000 Instances of classes. Department of Computer Science — University of San Francisco – p.6/?? 11-5: Ontologies vs OO design Classes are the focus of ontology design. In many ways, this looks like object-oriented design. We have classes and subclasses, and properties of classes that look like data members. However, slots have richer semantics than data members. A slot may attach to several classes at once. We can specify constraints on the values in a slot’s range. Slots can exist without being assigned to a class. Department of Computer Science — University of San Francisco – p.7/?? 11-6: Graphical representations Logic is a very powerful representation language, but it can be difficult for humans to work with. In addition, the lack of structure between sentences in a KB can make inference difficult. A semantic network is a way to graphically represent and reason about some logical concepts. Department of Computer Science — University of San Francisco – p.8/?? 11-7: Semantic Net example SisterOf(Mary, John) Female(Mary) ∀xFemale(x) → Person(x) Male(John) ∀xMale(x) → Person(x) ∀xPerson(x) → Mammal(x) ∀xPerson(x) → DefaultNumberOfLegs(x, 2) legs(John, 1) Department of Computer Science — University of San Francisco – p.9/?? 11-8: Inference in a Semantic Net Inference becomes easy in a semantic net; to answer questions about John, we follow the labeled edges emanating from the John node. This is the same sort of inference done by modern OO languages to resolve inheritance. Strengths: Knowledge is easily visualized, relationships between objects are clearer. Weaknesses: only binary relations, no negation, disjunction, or existential quantifiers. We can extend semantic nets to include these features, but we lose the transparency. Instead, use a semantic net to model class/slot relations, and FOL (or something similar) to model rules. Department of Computer Science — University of San Francisco – p.10/?? 11-9: Protege Protege is a Java-based graphical tool for constructing ontologies. Has plugins for Jess (a rule-based inference engine) and Jython Can export data in RDF and OWL for use with the Semantic Web. Department of Computer Science — University of San Francisco – p.11/?? 11-10: Using Protege to build a simple ontology Let’s make a simple ontology to describe the USF CS department. We begin by asking competency questions - these are questions we’d like our KB to be able to answer. Who is taking CS662? Which professors teach classes on Monday? How many students are taking both CS662 and CS601? What classes should one take before taking CS662? Which professors assign the most work? Department of Computer Science — University of San Francisco – p.12/??