ldk r logics for data and knowledge representation exercise 1: model and language

30
L Logics for D Data and K Knowledge R Representation Exercise 1: Model and Language

Upload: herbert-doyle

Post on 25-Dec-2015

228 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: LDK R Logics for Data and Knowledge Representation Exercise 1: Model and Language

LLogics for DData and KKnowledgeRRepresentation

Exercise 1: Model and Language

Page 2: LDK R Logics for Data and Knowledge Representation Exercise 1: Model and Language

Outline Modeling

Logical Modeling What and How Exercises

Languages BNF Exercises

2

Page 3: LDK R Logics for Data and Knowledge Representation Exercise 1: Model and Language

Modeling

3

The World

ModelLanguage

+Theory

(Abstraction)Modeling

Realization

Representation

Interpretation

MonkeyBanana

Box…

Page 4: LDK R Logics for Data and Knowledge Representation Exercise 1: Model and Language

Logical Modeling

4

Page 5: LDK R Logics for Data and Knowledge Representation Exercise 1: Model and Language

What? Domain (D) = the chosen objects from the world

who can figure out the domain of the LDKR course?

From the person point of view: students, professor; Italian, Chinese, … white-haired, black-eyed,…

From the material point of view: courseware, homework, exam,… logics, modeling, …

From … ?

5

Page 6: LDK R Logics for Data and Knowledge Representation Exercise 1: Model and Language

What else?Language (L) = a logical language

Syntax1. L’s alphabet of symbols Σ contains at least one of the logical

symbols: , , ¬, →, , ;∧ ∨ ∀ ∃2. L has clear formation rules for formulas.

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).

Semantics Interpretation (I) = a mapping of L into D.

Formal Semantics: the relationship between syntactic constructs and the elements of an universe of meanings is a function in mathematical sense.

6

Page 7: LDK R Logics for Data and Knowledge Representation Exercise 1: Model and Language

How? Model (M) = the abstract (mathematical sense)

representation of the intended truths via interpretation I of language L. M is called L-model of D.

M |=A reads? satisfies, yields, holds, is true.

Theory (T, also L-Theory) = set of facts of L. A fact defines a piece of knowledge (about D),

something true in the model. A finite theory T is called a knowledge base (KB).

7

Page 8: LDK R Logics for Data and Knowledge Representation Exercise 1: Model and Language

Modeling Exercises Select from the following domain to model (5

minutes preparation)

1. ClassroomStudent, Master & Doctor, Professor, Assistant,…

2. FamilyParent, Grandparent, Male, Female, Sibling,…

3. FriendClose, Hiking, Chess, Forum, …

8

Page 9: LDK R Logics for Data and Knowledge Representation Exercise 1: Model and Language

Possible Solutions 1 Classroom

9

PersonStudent

ProfessorPhD

Master

Page 10: LDK R Logics for Data and Knowledge Representation Exercise 1: Model and Language

Possible Solutions 2 Family

10

Male Female

ParentGrandparent

Brother SisterSibling

Page 11: LDK R Logics for Data and Knowledge Representation Exercise 1: Model and Language

Possible Solutions 3 Friend

11

FriendFriend

HikingChess

Forum

Close

Page 12: LDK R Logics for Data and Knowledge Representation Exercise 1: Model and Language

Let’s look at this sheet in a DB:

What’s it like?

A Database

12

ID Name Nationality Hair Color Affiliation

1 Fausto Italian White Professor

2 Enzo Italian Black PhD

3 Rui Chinese Black T.A.

4 …

5 …

… …

LDKR

ItalianBlack Hair

Master

Page 13: LDK R Logics for Data and Knowledge Representation Exercise 1: Model and Language

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

record found. Closed word assumption (CWA) is the presumption that

what is not currently known to be true, is false. In contrast, ClassL assumes OWA, which allows ‘new’

knowledge emerges. 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.

NOTE: In general no single agent or observer has complete knowledge, and therefore cannot make the closed world assumption.

13

Page 14: LDK R Logics for Data and Knowledge Representation Exercise 1: Model and Language

Example Recall the DB table in previous slide:

A theory of this world in ClassL:

T={}, A={Italian(Fausto), Italian(Enzo), Chinese(Rui), White-Hair(Fausto), Black-Hair(Enzo), Black-Hair(Rui), Professor(Fausto), PhD(Enzo), TA(Rui), …}

14

ID Name Nationality Hair Color Affiliation

1 Fausto Italian White Professor

2 Enzo Italian Black PhD

3 Rui Chinese Black T.A.

4 …

5 …

… …

Page 15: LDK R Logics for Data and Knowledge Representation Exercise 1: Model and Language

Outline Modeling

Logical Modeling What and How Exercises

Languages BNF Exercises

15

Page 16: LDK R Logics for Data and Knowledge Representation Exercise 1: Model and Language

Backus–Naur Form (BNF) 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. Optional items enclosed in square brackets []. Items repeating 0 or more times are enclosed in curly

brackets or suffixed with an asterisk. {} or * Items repeating 1 or more times are followed by a '+' Terminals may appear in bold and NonTerminals in plain

text rather than using italics and angle brackets <>. Alternative choices in a production are separated by the ‘|’

symbol. Where items need to be grouped they are enclosed in

simple parentheses ().16

Page 17: LDK R Logics for Data and Knowledge Representation Exercise 1: Model and Language

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

An example of mathematical expression

1. <expression> ::=<value> [<operator> <expression>]

2. <value  > ::= [<sign>] <unsigned> [ . <unsigned>]

3. <unsigned> ::=<digit> {<digit>}*

4. <digit> ::=0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9

5. <sign> ::=+ | -

6. <operator>::=+ | - | * | /

17

Page 18: LDK R Logics for Data and Knowledge Representation Exercise 1: Model and Language

Exercises of BNF Is the following a well-formed formula of expression?

1. 00123

2. 199+299

3. +20*200

4. 345/(123+456-789) Recall the BNF of PL, and differentiate WFFs from

others below.1. A⊔B⊒A

2. A⊓B⊑B

3. A∧¬B→A

4. A∧B⊨A∨B

5. ¬A∨B⊢A→B

18

Page 19: LDK R Logics for Data and Knowledge Representation Exercise 1: Model and Language

Something challenging Can we build the BNF of ER diagram?

What about the BNF of natural language of English?

19

Page 20: LDK R Logics for Data and Knowledge Representation Exercise 1: Model and Language

In software engineering, an Entity-Relationship Model (ERM) is an abstract and conceptual representation of data.

The basic components of ER in Lecture 2: Entity Relation Cardinality of Relation Cardinality of Attribute Attribute Primary Key

Recall: ER Diagram

20

Monkey Box Climb0..1 0..n

Banana Height

ID

Page 21: LDK R Logics for Data and Knowledge Representation Exercise 1: Model and Language

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

system.<Entity>::=

<Relation>::=

<Attribute>::=

<Connector>::=

<Diagram>::={<Entity>}|

<Entity>+[<connector ><Relation><connector>]<Entity>+|

Entity+[<connector>< Attribute>]

21

Entity

Relation

Attribute

<Unsigned>”.. “ n | m

Page 22: LDK R Logics for Data and Knowledge Representation Exercise 1: Model and Language

BNF of Yahoo Directories 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.

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

Page 23: LDK R Logics for Data and Knowledge Representation Exercise 1: Model and Language

So take a look!

23

Page 24: LDK R Logics for Data and Knowledge Representation Exercise 1: Model and Language

Preliminaries: Open/Close Word Class 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.

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

Page 25: LDK R Logics for Data and Knowledge Representation Exercise 1: Model and Language

Parts of SpeechOpen 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, 3rd person singular present

goes 25

Page 26: LDK R Logics for Data and Knowledge Representation Exercise 1: Model and Language

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

Page 27: LDK R Logics for Data and Knowledge Representation Exercise 1: Model and Language

BNF for Yahoo Directory

(1) ForwardPhrase::= [VB] [IN] DisPhrase {Conn } DisPhrase

(2) DisPhrase::= Phrase [“(”ProperDis | NounDis“)”] [“(”Period“)”][“:” Phrase]

(3) Phrase::=[DT] Adjectives [Nouns] | [Proper] Nouns

(4) Adjectives::= Adjective|CD {[CC] Adjective}

(5) Nouns::= Noun {Noun}

(6) Conn::= ConjunctionConn | PrepositionConn

(7) Noun::= NN [POS] | NNS [POS]

27

Page 28: LDK R Logics for Data and Knowledge Representation Exercise 1: Model and Language

BNF for Yahoo Directory (2)

(8) Adjective::= JJ

(9) ConjunctionConn::= CC | “,”

(10) PrepositionConn::= IN | TO

(11) Proper::= NNP {NNP|POS}

(12) NounDis::= Period|Nouns|Adjectives [Nouns]

(13) ProperDis::= ProperSeq [CC ProperSeq]

(14) Period::= [NN] CD [“-”] [CD] [NN]

(15) ProperSeq::= Proper [“,” Proper]

28

Page 29: LDK R Logics for Data and Knowledge Representation Exercise 1: Model and Language

Example: Provinces and Districts

ForwardPhrase Conn ForwardPhrase

DisPhrase ConjunctionConn DisPhrase

Phrase CC Phrase

Nouns Nouns

Noun Noun

NNS NNS29

Page 30: LDK R Logics for Data and Knowledge Representation Exercise 1: Model and Language

Exercises Directory > Science > Computer Science > Artificial

Intelligence > Natural Language Processing > Web Directories

Computer Science

NN NN Artificial Intelligence

JJ NN Natural Language Processing

JJ NN VBG Web Directories

NN NNS30