• Tidak ada hasil yang ditemukan

The Abstract Syntax as Ontology

N/A
N/A
Protected

Academic year: 2019

Membagikan "The Abstract Syntax as Ontology"

Copied!
56
0
0

Teks penuh

(1)

The Abstract Syntax as Ontology

Krasimir Angelov

Chalmers University of Technology

(2)

1 Introduction

2 Types, Dependent Types and Reasoning

3 Semantic Web

4 Ratatui’s Ontology

(3)

1 Introduction

2 Types, Dependent Types and Reasoning

3 Semantic Web

4 Ratatui’s Ontology

(4)

What is ontology?

Ontology is the philosophical study of the nature of being, existence or reality in general, as well as of the basic categoriesof being and their relations. Traditionally listed as a part of the major branch of philosophy known as metaphysics, ontology deals with questions concerning what entities exist or can be said to exist, and how such entities can be grouped, related within a hierarchy, and subdivided according to similarities and differences.

(5)

Ontologies in C++

The Object Oriented Modeling is building an Ontologies for some concrete domain.

C++

classShape {. . .}

classTriangle : Shape { . . .} classRectangle : Shape {. . .} classSquare : Rectangle { . . .}

(6)

Ontological Relations

Classes have properties, members, fields they define relations between entities in the ontology.

C++

(7)

Ontologies in Relational Databases

(8)

Ontologies in Semantic Web

Object models could be defined in a family of languages RDF, RDFS, OWL Lite, OWL Full

<shapes:Rectangle rdf:about=”#R123”> <shapes:topleft>

<shapes:Point>

<shapes:x>10</shapes:x> <shapes:y>10</shapes:y> </shapes:Point>

</shapes:topleft> <shapes:bottomright>

<shapes:Point>

<shapes:x>100</shapes:x> <shapes:y>100</shapes:y> </shapes:Point>

</shapes:bottomright> </shapes:Rectangle>

(9)

Ontologies in First-Order Logic

Suggested Upper Merged Ontology (SUMO)

The biggest open source ontology - 20000 concepts and 70000 axioms

(10)

Ontologies in Type Theory

Dependently Types Languages - GF, Agda, Epigram, Coq . . .

cat Shape; Triangle; Rectangle; Point;

funtriangle :Point →Point →Point →Triangle; rectangle:Point →Point →Rectangle;

(11)

Why Ontology Matters in Linguistics?

WordNet

every synset is a semantic concept hierarchy of hypernyms and hyponyms other relations - meronym/holonym VerbNet

primary valency dictionary . . . but also sortal restrictions FrameNet

(12)

Ontology vs Knowledge Base

Ontology vs Knowledge Base

The ontology is the schema - definition of classes and properties

The knowledge base is a set of instances, related by properties

(13)

1 Introduction

2 Types, Dependent Types and Reasoning

3 Semantic Web

4 Ratatui’s Ontology

(14)

Simple Types

The simple types are well known from every programming language

Types in Syntax

cat NP,VP,S;

funeveryone NP :NP; someone NP :NP;

Types in Semantics

catHuman,Company;

funjohn H :Human; google H :Company;

(15)

Dependent Types

The dependent types are types indexed by some value. The dependency could be used to enforce semantic conditions.

Example:

Simply Typed

cat Array;

funplus :Array →Array →Array

Dependently Typed

catArray Int;

(16)

Reasoning

Knowledge about the world could be encoded in the abstract syntax

Travels Map

cat City;

Route City City;

fungothenburg C :City stockholm C :City london C :City

(17)

Reasoning

We need one more function to make transfers

Travels Map

fun join: (c1,c2,c3:City)

→ Route c1 c2 → Route c2 c3 → Route c1 c3

Travels Map

(18)

Computation

Every route has a distance which could be computed

Distance

fundist : (c1,c2 :City)→Route c1 c2→Int;

def dist c1 c2 got2stk R = 110; dist c1 c2 stk2lon R = 420;

(19)

1 Introduction

2 Types, Dependent Types and Reasoning

3 Semantic Web

4 Ratatui’s Ontology

(20)

RDF/RDFS in five sentences

RDF/RDFS describes

resources

Every resource belongs to some

class

The descriptions are composed of

statements

which are the atomic units

Every statement is a tripple of subject (resource), predicate (

property

) and object (

value

).

(21)

RDF/RDFS in four sentences

cat Resource (c :Class); Class;

Statement;

Property (domain,range :Class);

funclass:Class →Resource class C;

statement:Statement→Resource statement C;

(22)

Example Resources

Abstract Syntax

fun organization C,sector C :Class

digitalgrammars R:Resource organization C; grammars sector R :Resource sector C;

activeInSector P:Property organization C sector C

Concrete Syntax

lincatResource,Class=Str;

linorganization C = ”http://. . . /protont#Organization”; sector C = ”http://. . . /protonu#IndustrySector”;

digitalgrammars R = ”http://www.digitalgrammars.com”;

(23)

RDF/RDFS in four sentences

The statements are also known as assertions in logic:

fun assert : (d,r :Class)→

Resource d →Property d r →Value r →Statement;

here the value category is needed because the object could be a literal also:

cat Value (c :Class);

(24)

Example Statement

English

Digital Grammars is active in sector grammars.

RDF Abstract Syntax

assert organization C sector C digitalgrammars R activeInSector P grammars sector R

RDF Concrete Syntax

(25)

Class Hierarchy in OWL

Inheritance and Type Casting

cat SubClass Class Class; Inheritance Class Class;

(26)

1 Introduction

2 Types, Dependent Types and Reasoning

3 Semantic Web

4 Ratatui’s Ontology

(27)

The Receipe

INGREDIENTS

1/4 cup finely chopped onion 1 tablespoon butter or margarine 1/4 teaspoon dried basil

1/4 teaspoon paprika 1/8 teaspoon garlic powder 1 can condensed tomato soup 1 cup milk

DIRECTIONS

(28)

The Receipe

INGREDIENTS

1/4 cup finely chopped onion

1 tablespoonbutter or margarine

1/4 teaspoondried basil

1/4 teaspoonpaprika

1/8 teaspoongarlic powder

1 can condensed tomato soup

1 cupmilk DIRECTIONS

(29)

The Ontology

cat Quantity;

fun whole:Int →Quantity; - - 1

fraction:Int→Int →Quantity; - - 1/2 whole plus :Int→Int →Int→Quantity; - - 1 1/2

cat Unit;

fun cup,tablespoon,teaspoon,can:Unit;

cat Measure;

(30)

The Receipe

INGREDIENTS

1/4 cup finely chopped onion 1 tablespoonbutteror margarine 1/4 teaspoondriedbasil

1/4 teaspoonpaprika 1/8 teaspoongarlic powder 1 can condensed tomatosoup 1 cupmilk

DIRECTIONS

(31)

The Ontology

cat Product;

funonion,butter,margarine,

(32)

The Receipe

INGREDIENTS

1/4 cup finely chopped onion 1 tablespoon butteror margarine 1/4 teaspoondriedbasil

1/4 teaspoon paprika 1/8 teaspoongarlic powder 1 can condensedtomato soup 1 cup milk

DIRECTIONS

(33)

The Ontology

cat Product;

fun onion,butter,margarine,

basil,paprika,milk,garlic,tomato:Product;

(34)

The Receipe

INGREDIENTS

1/4 cup finely chopped onion 1 tablespoon butteror margarine 1/4 teaspoondriedbasil

1/4 teaspoon paprika 1/8 teaspoon garlic powder 1 can condensedtomato soup 1 cup milk

DIRECTIONS

(35)

The Ontology

(36)

The Receipe

INGREDIENTS

1/4 cup finelychopped onion 1 tablespoon butter or margarine 1/4 teaspoondriedbasil

1/4 teaspoon paprika 1/8 teaspoon garlic powder 1 can condensedtomato soup 1 cup milk

DIRECTIONS

(37)

The Ontology

cat Preparation;

funchopped,dried,condensed :Preparation;

(38)

The Receipe

INGREDIENTS

1/4 cup finelychopped onion 1 tablespoon butter or margarine 1/4 teaspoon dried basil

1/4 teaspoon paprika 1/8 teaspoon garlic powder 1 can condensed tomato soup 1 cup milk

DIRECTIONS

(39)

The Ontology

cat PreparationMod;

funfinely :PreparationMod;

(40)

The Receipe

INGREDIENTS

1/4 cup finely chopped onion 1 tablespoon butter or margarine 1/4 teaspoon dried basil

1/4 teaspoon paprika 1/8 teaspoon garlic powder 1 can condensed tomato soup 1 cup milk

DIRECTIONS

(41)

The Ontology

catIngredient;

funingredient :Measure→Product →Ingredient;

(42)

The Receipe

INGREDIENTS

1/4 cup finely chopped onion 1 tablespoon butter or margarine 1/4 teaspoon dried basil

1/4 teaspoon paprika 1/8 teaspoon garlic powder 1 can condensed tomato soup 1 cup milk

DIRECTIONS

(43)

The Ontology

Directions:

catDirection;

funaction:Action→Direction;

(44)

The Ontology

Actions:

catAction;

(45)

The Ontology

Operations:

cat Operation;

fun soute:Product→Product→Operation; stir in:Product→Operation;

cook :Temperature→Operation;

cat Temperature;

fun celsius :Int →Temperature;

(46)

The Receipe

INGREDIENTS

1/4 cup finely chopped onion 1 tablespoon butter or margarine 1/4 teaspoon dried basil

1/4 teaspoon paprika 1/8 teaspoon garlic powder 1 can condensed tomato soup 1 cup milk

DIRECTIONS

(47)

The Ontology

catDuration;

fununtil :Condition→Duration;

for time :Int →TimeUnit→Duration;

catCondition;

funtender,blended,heated :Condition;

catTimeUnit;

(48)

The Receipe

INGREDIENTS

1/4 cup finely chopped onion 1 tablespoon butter or margarine 1/4 teaspoon dried basil

1/4 teaspoon paprika 1/8 teaspoon garlic powder 1 can condensed tomato soup 1 cup milk

DIRECTIONS

(49)

The Ontology

(50)

The Receipe

INGREDIENTS

1/4 cup finely chopped onion 1 tablespoon butter or margarine 1/4 teaspoon dried basil

1/4 teaspoon paprika 1/8 teaspoon garlic powder 1 can condensed tomato soup 1 cup milk

DIRECTIONS

(51)

The Ontology

cat Receipe;

(52)

Defects in Ratatui

The ontology permits some expressions which are syntactically correct but not semantically consistent.

soute onion garlic soute onion in garlic stir in paprika stir in paprika

(53)

Ratatui with Dependent Types

cat Kind;

funliquid,oil,firm:Kind;

cat Product Kind;

funalternative,

composite: (k :Kind)→Product k →Product k →Product k;

funadd : (k :Kind)→Product k →Direction;

(54)

Things that are not covered

Some product could be mentioned in the description only if it is also declared in the ingredients

(55)

Ratatui to RDF

RDF Concrete Syntax

gf2rdf :Resource measure C→Measure→[Statement] gf2rdf id(whole v) =

[assert ? ?id hasValue(lit(int v)) ]

gf2rdf id(fraction m n) =

[assert ? ?id hasNomValue (lit(int m))

,assert ? ?id hasDenomValue(lit(int n)) ]

gf2rdf id(whole plus v m n) = [assert ? ?id hasValue(lit(int n))

,assert ? ?id hasNomValue (lit(int m))

(56)

Thank You

Referensi

Dokumen terkait

Berdasarkan observasi dan wawancara di atas dapat penulis ambil pemahaman bahwa di antara aktivitas latihan dalam proses pembelajaran bidang studi Quran Hadis di MAN

komunitas global dalam bidang ilmu pengetahuan, (4) peningkatan budaya ilmiah masyarakat Indonesia, dan (5) pelaksanaan dukungan manajemen. 2) Indikator jumlah industri

(5) Untuk kepentingan pemeriksaan di pengadilan dalam perkara pidana atau perdata, atas permintaan hakim sesuai dengan Hukum Acara Pidana dan Hukum Acara Perdata,

Dimana dalam tahap ini sumber-sumber yang telah terkumpul dilakukan kritik, baik itu kritik internal maupun kritik eksternel.Kritik internal merupakan kritik yang dilakukan

Teknik pengumpulan data dilakukan dengan menggunakan rekaman video, wawancara dan observasi kegiatan guru dan siswa.Teknik analisis data yang digunakan dalam

sehingga elevasi penambahan endapan sedimen maksimal yang boleh terjadi di Bendung Sei Tibun sampai elevasi pintu pengambilan adalah -0,10 m; (2) Sedimen suspensi

Dua dari lima genotip tersebut, BTM 2064 dan BTM 867, memiliki karakter jumlah cabang produktif, jumlah bunga per tanaman, jumlah tandan bunga per tanaman,

Alasan peneliti memilih lokasi Pondok Pesantren Al Akhlakul Karimah Budi Mulyo yaitu pertama, Pondok Pesantren Al Akhlakul Akrimah Budi Mulyo merupaka pesantren yang tidak