Logics for Data and Knowledge Representation Exercise 1

  • Slides: 30
Download presentation
Logics for Data and Knowledge Representation Exercise 1: Model and Language

Logics for Data and Knowledge Representation Exercise 1: Model and Language

Outline q Modeling q Logical Modeling q What and How q Exercises q Languages

Outline q Modeling q Logical Modeling q What and How q Exercises q Languages q BNF q Exercises 2

Modeling (Abstraction) Modeling The World Representation Model Realization Interpretation Language + Theory Monkey Banana

Modeling (Abstraction) Modeling The World Representation Model Realization Interpretation Language + Theory Monkey Banana Box … 3

Logical Modeling 4

Logical Modeling 4

What? q Domain (D) = the chosen objects from the world who can figure

What? q Domain (D) = the chosen objects from the world who can figure out the domain of the LDKR course? q From the person point of view: q students, professor; q Italian, Chinese, … q white-haired, black-eyed, … q From the material point of view: q courseware, homework, exam, … q logics, modeling, … q From … ? 5

What else? q Language (L) = a logical language q Syntax 1. 2. L’s

What else? q Language (L) = a logical language q Syntax 1. 2. L’s alphabet of symbols Σ contains at least one of the logical symbols: ∧, ∨, ¬, →, ∀, ∃; L has clear formation rules formulas. q Formal Syntax: the set of “rules” saying how to construct the expressions of the language from the alphabet of symbols, (i. e. , the syntax) is a grammar (i. e. , formal). q Semantics q Interpretation (I) = a mapping of L into D. q Formal Semantics: the relationship between syntactic constructs and the elements of an universe of meanings is a function in mathematical sense. 6

How? q Model (M) = the abstract (mathematical sense) representation of the intended truths

How? q Model (M) = the abstract (mathematical sense) representation of the intended truths via interpretation I of language L. M is called Lmodel of D. q M |=A q reads? q satisfies, yields, holds, is true. q Theory (T, also L-Theory) = set of facts of L. q A fact defines a piece of knowledge (about D), something true in the model. q A finite theory T is called a knowledge base (KB). 7

Modeling Exercises q Select from the following domain to model (5 minutes preparation) Classroom

Modeling Exercises q Select from the following domain to model (5 minutes preparation) Classroom Student, Master & Doctor, Professor, Assistant, … 2. Family Parent, Grandparent, Male, Female, Sibling, … 3. Friend Close, Hiking, Chess, Forum, … 1. 8

Possible Solutions 1 q Classroom Ph. D Student Master 9 Professor Person

Possible Solutions 1 q Classroom Ph. D Student Master 9 Professor Person

Possible Solutions 2 q Family Grandparent Male Brother 10 Parent Female Sibling Sister

Possible Solutions 2 q Family Grandparent Male Brother 10 Parent Female Sibling Sister

Possible Solutions 3 q Friend Hiking Chess Friend Close Forum 11

Possible Solutions 3 q Friend Hiking Chess Friend Close Forum 11

A Database q Let’s look at this sheet in a DB: ID Name Nationality

A Database q Let’s look at this sheet in a DB: ID Name Nationality Hair Color Affiliation 1 Fausto Italian White Professor 2 Enzo Italian Black Ph. D 3 Rui Chinese Black T. A. 4 … 5 … … … Italian Black Hair LDKR Master q What’s it like? 12

Closed world vs. Open world q DB follows CWA, which assumes negative when no

Closed world vs. Open world q DB follows CWA, which assumes negative when no record found. q Closed word assumption (CWA) is the presumption that what is not currently known to be true, is false. q In contrast, Class. L assumes OWA, which allows ‘new’ knowledge emerges. q Open world assumption (OWA) is the assumption that the truth-value of a statement is independent of whether or not it is known by any single observer or agent to be true. q NOTE: In general no single agent or observer has complete knowledge, and therefore cannot make the closed world assumption. 13

Example q Recall the DB table in previous slide: ID Name Nationality Hair Color

Example q Recall the DB table in previous slide: ID Name Nationality Hair Color Affiliation 1 Fausto Italian White Professor 2 Enzo Italian Black Ph. D 3 Rui Chinese Black T. A. 4 … 5 … … … q A theory of this world in Class. L: T={}, A={Italian(Fausto), Italian(Enzo), Chinese(Rui), White-Hair(Fausto), Black-Hair(Enzo), Black. Hair(Rui), Professor(Fausto), Ph. D(Enzo), TA(Rui), …} 14

Outline q Modeling q Logical Modeling q What and How q Exercises q Languages

Outline q Modeling q Logical Modeling q What and How q Exercises q Languages q BNF q Exercises 15

Backus–Naur Form (BNF) q In computer science, Backus–Naur Form (BNF) is a syntax used

Backus–Naur Form (BNF) q In computer science, Backus–Naur Form (BNF) is a syntax used to express context-free grammars: that is, a formal way to describe formal languages. q Optional items enclosed in square brackets []. q Items repeating 0 or more times are enclosed in curly brackets or suffixed with an asterisk. {} or * q Items repeating 1 or more times are followed by a '+' q Terminals may appear in bold and Non. Terminals in plain text rather than using italics and angle brackets <>. q Alternative choices in a production are separated by the ‘|’ symbol. q Where items need to be grouped they are enclosed in simple parentheses (). 16

Example of BNF q Who can give examples of the above syntaxes? q An

Example of BNF q Who can give examples of the above syntaxes? q An example of mathematical expression 1. 2. 3. 4. 5. 6. 17 <expression>: : =<value> [<operator> <expression>] <value > : : = [<sign>] <unsigned> [. <unsigned>] <unsigned> : : =<digit> {<digit>}* <digit> : : =0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 <sign> : : =+ | - <operator> : : =+ | - | * | /

Exercises of BNF q Is the following a well-formed formula of expression? 1. 2.

Exercises of BNF q Is the following a well-formed formula of expression? 1. 2. 3. 4. 00123 199+299 +20*200 345/(123+456 -789) q Recall the BNF of PL, and differentiate WFFs from others below. 1. 2. 3. 4. 5. 18 A⊔B⊒A A⊓B⊑B A∧¬B→A A∧B⊨A∨B ¬A∨B⊢A→B

Something challenging q Can we build the BNF of ER diagram? q What about

Something challenging q Can we build the BNF of ER diagram? q What about the BNF of natural language of English? 19

Recall: ER Diagram q In software engineering, an Entity-Relationship Model (ERM) is an abstract

Recall: ER Diagram q In software engineering, an Entity-Relationship Model (ERM) is an abstract and conceptual representation of data. q The basic components of ER in Lecture 2: q Entity q Relation Monkey 0. . 1 Climb 0. . n Box q Cardinality of Relation q Cardinality of Attribute Banana q Attribute q Primary Key 20 ID Height

BNF of ER Diagram q Build the Backus–Naur Form (BNF) of ER diagram system.

BNF of ER Diagram q Build the Backus–Naur Form (BNF) of ER diagram system. <Entity>: : = <Relation>: : = <Attribute>: : = Entity Relation Attribute <Unsigned>”. . “ n | m <Connector>: : = <Diagram>: : ={<Entity>}| <Entity>+[<connector ><Relation><connector>]<Entity>+| Entity+[<connector>< Attribute>] 21

BNF of Yahoo Directories q The Yahoo! Directory is an online guide to the

BNF of Yahoo Directories q The Yahoo! Directory is an online guide to the World Wide Web. It is a catalog of sites created by a staff of editors who visit and evaluate web sites, and then organize them into subject-based categories and sub -categories. q Yahoo! editors distinguish between a number of factors when organizing web sites, including commercial vs. non-commercial, regional vs. global, and so forth. All of the site listings in the Directory are contained in an appropriate place within the 14 main categories seen on the front page of the Yahoo! Directory. 22

So take a look! 23

So take a look! 23

Preliminaries: Open/Close Word Class q In linguistics, an open class (or open word class)

Preliminaries: Open/Close Word Class q In linguistics, an open class (or open word class) is a word class that accepts the addition of new items, through such processes as compounding, derivation, coining, borrowing, etc. Typical open word classes are nouns, verbs and adjectives. q A closed class (or closed word class) is a word class to which no new items can normally be added, and that usually contains a relatively small number of items. Typical closed classes found in many languages are adpositions (prepositions and postpositions), determiners, conjunctions, and pronouns. 24

Parts of Speech Open class WORD CLASS EXAMPLE JJ//Adjective blue green soft NN//Noun, singular

Parts of Speech Open class WORD CLASS EXAMPLE JJ//Adjective blue green soft NN//Noun, singular or mass apple sugar NNS//Noun, plural apples NNP//Proper noun, singular Rui RB//Adverb slowly VB//Verb, base form go VBD//Verb, past tense went VBZ//Verb, 3 rd person singular present goes 25

Parts of Speech (2) Closed class WORD CLASS EXAMPLE CC//Coordinating conjunction and or CD//Cardinal

Parts of Speech (2) Closed class WORD CLASS EXAMPLE CC//Coordinating conjunction and or CD//Cardinal number DT//Determiner the an a IN//Preposition or subordinating conjunction in for but POS//Possessive ending TO//to 26

BNF for Yahoo Directory (1) Forward. Phrase: : = [VB] [IN] Dis. Phrase {Conn

BNF for Yahoo Directory (1) Forward. Phrase: : = [VB] [IN] Dis. Phrase {Conn } Dis. Phrase (2) Dis. Phrase: : = Phrase [“(”Proper. Dis | Noun. Dis“)”] [“(”Period“)”][“: ” Phrase] (3) Phrase: : =[DT] Adjectives [Nouns] | [Proper] Nouns (4) Adjectives: : = Adjective|CD {[CC] Adjective} (5) Nouns: : = Noun {Noun} (6) Conn: : = Conjunction. Conn | Preposition. Conn (7) Noun: : = NN [POS] | NNS [POS] 27

BNF for Yahoo Directory (2) (8) (9) (10) (11) (12) (13) (14) (15) 28

BNF for Yahoo Directory (2) (8) (9) (10) (11) (12) (13) (14) (15) 28 Adjective: : = JJ Conjunction. Conn: : = CC | “, ” Preposition. Conn: : = IN | TO Proper: : = NNP {NNP|POS} Noun. Dis: : = Period|Nouns|Adjectives [Nouns] Proper. Dis: : = Proper. Seq [CC Proper. Seq] Period: : = [NN] CD [“-”] [CD] [NN] Proper. Seq: : = Proper [“, ” Proper]

Example: Provinces and Districts Forward. Phrase Dis. Phrase 29 Conn Conjunction. Conn CC Forward.

Example: Provinces and Districts Forward. Phrase Dis. Phrase 29 Conn Conjunction. Conn CC Forward. Phrase Dis. Phrase Nouns Noun NNS

Exercises q Directory > Science > Computer Science > Artificial Intelligence > Natural Language

Exercises q Directory > Science > Computer Science > Artificial Intelligence > Natural Language Processing > Web Directories q Computer Science NN NN q Artificial Intelligence JJ NN q Natural Language Processing JJ NN VBG q Web Directories NN NNS 30