cpsc 312 functional and logic programming
play

CPSC 312 Functional and Logic Programming Project #2 - should be - PowerPoint PPT Presentation

CPSC 312 Functional and Logic Programming Project #2 - should be underway.... Talk to a TA if you want to change your project, or it has drifted from what was origianlly proposed. In Prolog, as in most halfway decent programming


  1. CPSC 312 — Functional and Logic Programming Project #2 - should be underway.... Talk to a TA if you want to change your project, or it has drifted from what was origianlly proposed. “In Prolog, as in most halfway decent programming languages, there is no tension between writing a beautiful program an writing an efficient program. If your Prolog code is ugly, the chances are that you either don’t understand your problem or don’t understand your programming language, and in neither case does your code stand much chance of being efficient. In order to ensure your program is efficient, you need to know what it is doing, and if your code is ugly, you will find it hard to analyse.” Richard A. O’Keefe, “The Craft of Prolog”, 1990. � D. Poole 2018 c CPSC 312 — Lecture 30 1 / 18

  2. Plan Last time difference lists definite clause grammars natural language interfaces to databases computer algebra and calculus Knowledge graphs Today Semantic web � D. Poole 2018 c CPSC 312 — Lecture 30 2 / 18

  3. Knowledge Sharing Idea: Let’s better represent an intended interpretation, so that computers as well as people can understand it. A conceptualization is a map from the problem domain into the representation. A conceptualization specifies: ◮ What sorts of individuals are being modeled ◮ The vocabulary for specifying individuals, relations and properties ◮ The meaning or intention of the vocabulary If more than one person is building a knowledge base, they must be able to share the conceptualization. → challenge: inter-operability of separately designed − knowledge bases An ontology is a specification of a conceptualization. An ontology specifies the meanings of the symbols in an information system. � D. Poole 2018 c CPSC 312 — Lecture 30 3 / 18

  4. Mapping from a conceptualization to a symbol � D. Poole 2018 c CPSC 312 — Lecture 30 4 / 18

  5. Semantic Web Ontologies are published on the web (often in machine readable form). Builders of knowledge bases or web sites adhere to and refer to a published ontology: ◮ a symbol defined by an ontology means the same thing across web sites that obey the ontology. ◮ if someone wants to refer to something not defined, they publish an ontology defining the terminology. Others adopt the terminology by referring to the new ontology. In this way, ontologies evolve. ◮ Separately developed ontologies can have mappings between them published. � D. Poole 2018 c CPSC 312 — Lecture 30 5 / 18

  6. Interoperability How can we represent “David went to “Bean Around World” yesterday at 3:00pm”? How can we ensure that this has meaning for other knowledge bases? See http://schema.org/ArriveAction http://schema.org/CafeOrCoffeeShop See: http://schema.org/docs/full.html � D. Poole 2018 c CPSC 312 — Lecture 30 6 / 18

  7. Clicker Question To use schema.org ontology in an application you need to A use the terms such as ’http://schema.org/ArriveAction’ consistently with the definitions B Download the schema.org HTML and parse it in Prolog C Create new definitions from the schema.org definitions D You can’t use it in applications as none of the classes are actually defined. � D. Poole 2018 c CPSC 312 — Lecture 30 7 / 18

  8. Challenges of building ontologies They can be huge: finding the appropriate terminology for a concept may be difficult. How one divides the world can depend on the application. Different ontologies describe the world in different ways. People can fundamentally disagree about an appropriate structure. Different knowledge bases can use different ontologies. To allow KBs based on different ontologies to inter-operate, there must be mapping between ontologies. It has to be in user’s interests to use an ontology. The computer doesn’t understand the meaning of the symbols. The formalism can constrain the meaning, but can’t define it. � D. Poole 2018 c CPSC 312 — Lecture 30 8 / 18

  9. Main Components of an Ontology Individuals the things / objects in the world (not usually specified as part of the ontology) Classes sets of individuals Properties between individuals and their values � D. Poole 2018 c CPSC 312 — Lecture 30 9 / 18

  10. Individuals Individuals are things in the world that can be named. (Concrete, abstract, concepts, reified). Unique names assumption (UNA): different names refer to different individuals. The UNA is not an assumption we can universally make: “The Queen”, “Elizabeth Windsor”, etc. Without the determining equality, we can’t count! Joe’s mother was in the room. Sam’s cousin was there. Chris’s football coach was there. How many people were in the room? In OWL we can specify: rdf ( i 1 , ’owl:SameIndividual’ , i 2 ) rdf ( i 1 , ’owl:DifferentIndividuals’ , i 3 ) � D. Poole 2018 c CPSC 312 — Lecture 30 10 / 18

  11. Classes A class is a set of individuals. E.g., house, building, officeBuilding One class can be a subclass of another rdf ( house , ’owl:SubClassOf’ , building ) rdf ( officeBuilding , ’owl:SubClassOf’ , building ) (or ’rdfs:subClassOf’) The most general class is ’owl:Thing’. Classes can be declared to be the same or to be disjoint: rdf ( house , ’owl:EquivalentClasses’ , singleFamilyDwelling ) rdf ( house , ’owl:DisjointClasses’ , officeBuilding ) Different classes are not necessarily disjoint. E.g., a building can be both a commercial building and a residential building. see http://www.cs.ubc.ca/~poole/cs312/2018/prolog/sem_ web_schema.pl � D. Poole 2018 c CPSC 312 — Lecture 30 11 / 18

  12. Properties A property is between an individual and a value. A property has a domain and a range. rdf ( livesIn , ’rdfs:domain’ , person ) rdf ( livesIn , ’rdfs:range’ , placeOfResidence ) The meaning can be defined by the rules: % type(I,T) means I has type T type(I,T) :- rdf(I,P,_), rdf(P,’rdfs:domain’,T). type(I,T) :- rdf(_,P,I), rdf(P,’rdfs:range’,T). � D. Poole 2018 c CPSC 312 — Lecture 30 12 / 18

  13. Properties An ObjectProperty is a property whose range is an individual. A DatatypeProperty is one whose range isn’t an individual, e.g., is a number or string. There can also be property hierarchies: owl:subPropertyOf( livesIn , enclosure ) owl:subPropertyOf( principalResidence , livesIn ) � D. Poole 2018 c CPSC 312 — Lecture 30 13 / 18

  14. Clicker Question Suppose we are given the following facts as true: prop(years_eligibility, ’rdfs:domain’, student). prop(sam, years_eligibility, 3). Which is the following can we infer A Sam is a student B Sam could a student (but maybe isn’t) C All students have value 3 for years_eligibility D We can infer nothing about whether Sam is a student � D. Poole 2018 c CPSC 312 — Lecture 30 14 / 18

  15. Clicker Question Suppose we are given the following facts as true: prop(years_eligibility, ’rdfs:domain’, student). prop(years_eligibility, ’rdfs:domain’, athlete). prop(sam, years_eligibility, 3). Which is the following is true A Sam is both a student and an athlete. B Sam could be either student or an athlete. C We can infer nothing about whether Sam is an athlete or a student D There are no student athletes. E The facts are inconsistent, and couldn’t possible all be true � D. Poole 2018 c CPSC 312 — Lecture 30 15 / 18

  16. Clicker Question RDF-schema provides a vocabulary for classes and properties. RDF-schema has a syntax for domain and range of a property. schema.org does not use rdfs:domain and rdfs:range. Why? A The scheme.org designers didn’t know about it even though they used other terminology from RDF-schema B The scheme.org designers didn’t care about domains and ranges because they just wanted to define a vocabulary. C schema.org does not define anything, and so does not need domain and ranges D The scheme.org designers did not want the meaning associated with RDF-schema’s domain and range. � D. Poole 2018 c CPSC 312 — Lecture 30 16 / 18

  17. Knowledge Sharing One ontology typically imports and builds on other ontologies. OWL provides facilities for version control. Tools for mapping one ontology to another allow inter-operation of different knowledge bases. The semantic web promises to allow two pieces of information to be combined if ◮ they both adhere to an ontology ◮ these are the same ontology or there is a mapping between them. � D. Poole 2018 c CPSC 312 — Lecture 30 17 / 18

  18. Aristotelian definitions Aristotle [350 B.C.] suggested the definition if a class C in terms of: Genus: the super-class Differentia: the attributes that make members of the class C different from other members of the super-class “If genera are different and co-ordinate, their differentiae are themselves different in kind. Take as an instance the genus ’animal’ and the genus ’knowledge’. ’With feet’, ’two-footed’, ’winged’, ’aquatic’, are differentiae of ’animal’; the species of knowledge are not distinguished by the same differentiae. One species of knowledge does not differ from another in being ’two-footed’.” Aristotle, Categories , 350 B.C. � D. Poole 2018 c CPSC 312 — Lecture 30 18 / 18

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend