30
Complex Reasoning with Logic Database Languages F. Giannotti 1 , A. Raffaetà 2 and C. Renso 1 1 CNUCE - CNR Italy 2 Dep. Computer Science - University of Pisa Italy

Complex Reasoning with Logic Database Languages F. Giannotti 1, A. Raffaetà 2 and C. Renso 1 1 CNUCE - CNR Italy 2 Dep. Computer Science - University of

  • View
    213

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Complex Reasoning with Logic Database Languages F. Giannotti 1, A. Raffaetà 2 and C. Renso 1 1 CNUCE - CNR Italy 2 Dep. Computer Science - University of

Complex Reasoning with Logic Database Languages

F. Giannotti1, A. Raffaetà2 and C. Renso1

1 CNUCE - CNR Italy2 Dep. Computer Science - University of Pisa Italy

Page 2: Complex Reasoning with Logic Database Languages F. Giannotti 1, A. Raffaetà 2 and C. Renso 1 1 CNUCE - CNR Italy 2 Dep. Computer Science - University of

Revigis Meeting, Quebec 2

Plan of the talk

Spatio-temporal reasoning in GIS: The logical language MuTACLP

Informal definition of the language Design of architecture

The case study: animal behavior analysis

Uncertainty handling with MuTACLP

Page 3: Complex Reasoning with Logic Database Languages F. Giannotti 1, A. Raffaetà 2 and C. Renso 1 1 CNUCE - CNR Italy 2 Dep. Computer Science - University of

Revigis Meeting, Quebec 3

Activity context

Study of formalisms for spatial data handling Formalisms for spatio-temporal reasoning [DeduGIS]

AIM: design of an architecture where the logic component of spatio-temporal reasoning is integrated with existing GIS technologies.

Issues of imperfection (uncertainty/imprecision/qualitative reasoning) in spatial data [Revigis] AIM: extension of existing formalisms to deal with these aspects

Page 4: Complex Reasoning with Logic Database Languages F. Giannotti 1, A. Raffaetà 2 and C. Renso 1 1 CNUCE - CNR Italy 2 Dep. Computer Science - University of

Revigis Meeting, Quebec 4

The idea of the formalism

modularity features in (Constraint) Logic Programming

We allow meta-level combination of knowledge represented as (constraint) logic programs.

spatio-temporal representation

The logic language provides support for spatio-temporal handling.

Page 5: Complex Reasoning with Logic Database Languages F. Giannotti 1, A. Raffaetà 2 and C. Renso 1 1 CNUCE - CNR Italy 2 Dep. Computer Science - University of

Revigis Meeting, Quebec 5

Modularity: Meta-Level Composition of KBs

Union of Knowledge Bases

KB 1 KB 2 KB1KB2 =

KB 1 KB 2 KB1KB2=

Intersection of Knowledge Bases

Message Passing

KB1

KB2

wrt

Page 6: Complex Reasoning with Logic Database Languages F. Giannotti 1, A. Raffaetà 2 and C. Renso 1 1 CNUCE - CNR Italy 2 Dep. Computer Science - University of

Revigis Meeting, Quebec 6

The spatio-temporal language MuTACLP

Knowledge is represented by rules.Each atom in rules can have an annotation that represents temporal information. Each rule can have a constraint component to represent spatial objects.

habitat(hares,X,Y) th [april, october] ←

vegetables(oil_seed, X,Y) wrt VEGETATION,…

lake(X,Y) ← X ≤ 100, Y ≥ 25, …..

Page 7: Complex Reasoning with Logic Database Languages F. Giannotti 1, A. Raffaetà 2 and C. Renso 1 1 CNUCE - CNR Italy 2 Dep. Computer Science - University of

Revigis Meeting, Quebec 7

Application: Spatio-Temporal analysis of geographical data

Typical geographical analysis queries:

Where can a road/hospital/building be built?

Find a favorable habitat for a given animal depending on the season.

Page 8: Complex Reasoning with Logic Database Languages F. Giannotti 1, A. Raffaetà 2 and C. Renso 1 1 CNUCE - CNR Italy 2 Dep. Computer Science - University of

Revigis Meeting, Quebec 8

The Analysis Process

The analysis process is based on the criteria used by the expert of the domain.

Such criteria can be encoded as rules and grouped in knowledge bases.

Page 9: Complex Reasoning with Logic Database Languages F. Giannotti 1, A. Raffaetà 2 and C. Renso 1 1 CNUCE - CNR Italy 2 Dep. Computer Science - University of

Revigis Meeting, Quebec 9

Spatio-Temporal analysis of geographical data

Queries

Analysis rules

GIS

Find the favourable habitat for an animal A in winter

An area X is good for the animal A during winter if it contains vegetation Y, water and no predators

Page 10: Complex Reasoning with Logic Database Languages F. Giannotti 1, A. Raffaetà 2 and C. Renso 1 1 CNUCE - CNR Italy 2 Dep. Computer Science - University of

Revigis Meeting, Quebec 10

Spatio-Temporal analysis of geographical data (cont’d)

We express both queries and spatio-temporal

rules in the MuTACLP language

Queries

Analysis rules

GIS

?- habitat(animal, X) th[nov,mar]

habitat(Animal,X) th[nov, mar] vegetation(X,corn), near_water(X,100), nopredators(X)

Page 11: Complex Reasoning with Logic Database Languages F. Giannotti 1, A. Raffaetà 2 and C. Renso 1 1 CNUCE - CNR Italy 2 Dep. Computer Science - University of

Revigis Meeting, Quebec 11

Architecture

Logical representation of geographical data. Data are translated into a constraint data model.

Invocation of GIS functions Data are kept in the GIS and system functions are invoked

from the logical programs expressing analysis rules

Towards the design of an integrated architecture that includes both these approaches

Add a ST reasoning component to current GIS technology

Page 12: Complex Reasoning with Logic Database Languages F. Giannotti 1, A. Raffaetà 2 and C. Renso 1 1 CNUCE - CNR Italy 2 Dep. Computer Science - University of

Revigis Meeting, Quebec 12

Logical Representation of Spatial Data

User

KB1KB2

KB3 Analysis Rules

Translation process

GIS

Constraint-based model

2-spaghetti model

Page 13: Complex Reasoning with Logic Database Languages F. Giannotti 1, A. Raffaetà 2 and C. Renso 1 1 CNUCE - CNR Italy 2 Dep. Computer Science - University of

Revigis Meeting, Quebec 13

Direct invocation of GIS functions

GIS

KB1KB2

KB3

User

Mapping

Primitives

Page 14: Complex Reasoning with Logic Database Languages F. Giannotti 1, A. Raffaetà 2 and C. Renso 1 1 CNUCE - CNR Italy 2 Dep. Computer Science - University of

Revigis Meeting, Quebec 14

Implementation and use of the language

The language MuTACLP has been implemented in Sicstus Prolog

It has been used within the DeduGIS European WG to model spatio-temporal reasoning in a real application on animal behavior (in collaboration with A. Massolo of University of Siena).

Page 15: Complex Reasoning with Logic Database Languages F. Giannotti 1, A. Raffaetà 2 and C. Renso 1 1 CNUCE - CNR Italy 2 Dep. Computer Science - University of

Revigis Meeting, Quebec 15

Crested PorcupineHabitat use and mating systemA. Massolo University of Siena, Dept. of Evolutionary Biology

OPEN QUESTIONS

MATING SYSTEM: Monogamy ?Is the crested porcupine a

territorial species ?If so, which are the critical

resources ?

Study Area: Natural Park of Maremma

Page 16: Complex Reasoning with Logic Database Languages F. Giannotti 1, A. Raffaetà 2 and C. Renso 1 1 CNUCE - CNR Italy 2 Dep. Computer Science - University of

Revigis Meeting, Quebec 16

Animal localization- Radio tracking

Page 17: Complex Reasoning with Logic Database Languages F. Giannotti 1, A. Raffaetà 2 and C. Renso 1 1 CNUCE - CNR Italy 2 Dep. Computer Science - University of

Revigis Meeting, Quebec 17

Data Sources and Methods

ANIMAL LOCALIZATION DATAData about localization is collected in a table that represent FIX data

Fix(date, hour, Animal ID, coordinates X Y, other data of interest)

DENS

BIMONTHLY homing in

HABITAT CHARACTERISATIONFeatures (spatial objects) from digitised raster imagesAttributes from field data collection

SPATIAL ANALYSESESRI ArcView 3.1 (Spatial Analyst, Movement, etc.)

ERROR ESTIMATETrials on Radio-collars(25 positions; >400 bearings) Direction: -/+ 5°; distance: 62 m

Page 18: Complex Reasoning with Logic Database Languages F. Giannotti 1, A. Raffaetà 2 and C. Renso 1 1 CNUCE - CNR Italy 2 Dep. Computer Science - University of

Revigis Meeting, Quebec 18

Spatio-Temporal Queries

Deduce the localization of dens in periods of time when there is no “homing in”.Identification of the changes in home range estimates (T overlap).

What are the ST relationships between individuals (sex, reproductive pairs, etc.) in contemporary fixes (15/20 minutes).

ST distance (mt, dd) of individuals to ST defined events (e.g. changes in environment: rain events, cultivated lands)

MuTACLP

Arc View

Page 19: Complex Reasoning with Logic Database Languages F. Giannotti 1, A. Raffaetà 2 and C. Renso 1 1 CNUCE - CNR Italy 2 Dep. Computer Science - University of

Revigis Meeting, Quebec 19

An Example of ST Query in MuTACLP

Deduce the localization of dens in periods of time when there is no “homing in”.

An animal is inside or very close to the den during the day and at dawn/sunset

User

Expert

Page 20: Complex Reasoning with Logic Database Languages F. Giannotti 1, A. Raffaetà 2 and C. Renso 1 1 CNUCE - CNR Italy 2 Dep. Computer Science - University of

Revigis Meeting, Quebec 20

An Example of ST Query in MuTACLP (cont’d)

Analysisprob_den(Id,Rad,Prob,L) in [T1,T2] :- possible_loc(Id,Lloc) in [T1,T2], neighbour_list(Lloc,Rad,Prob,L).

possible_loc(Id,Lloc) th [T,T] :- constr(( findall(loc(X,Y), demo(dataPor+sun+aux,(fix(Id,X,Y,Hour) th [T,T], dawn_sunset(Hour)th[T,T])), Lloc))).

Query

?- prob_den(Id, Rad, Prob, L) th [T,T]

Knowledge is structured in different programs

Page 21: Complex Reasoning with Logic Database Languages F. Giannotti 1, A. Raffaetà 2 and C. Renso 1 1 CNUCE - CNR Italy 2 Dep. Computer Science - University of

Revigis Meeting, Quebec 21

An Example of ST Query in MuTACLP (cont’d)

Sun dawn_sunset(Hour) th [T,T] :- light(D,S) th [T,T], constr((T1 is T mod 365+1)), between_ds(D,S,Hour).

light(25470,63910) th [[1,1,1998],[31,1,1998]]. light(25530,62820) th [[1,12,1999],[31,12,1999]].

dataPor fix(f1,62060.0,1669490.0,4724115.0) th

[[01,01,1998],[01,01,1998]]. fix(f3,62120.0,1669740.0,4724100.0) th

[[01,01,1998],[01,01,1998]].

Page 22: Complex Reasoning with Logic Database Languages F. Giannotti 1, A. Raffaetà 2 and C. Renso 1 1 CNUCE - CNR Italy 2 Dep. Computer Science - University of

Revigis Meeting, Quebec 22

Aim: to experiment standard GIS technologies to deal with spatio-temporal applications - PorcupineSoftware: Arc View 3.1 (ESRI) + Spatial Analyst + Movement (USGS Alaska)

Developed with the Arc View script language Avenue Allows the programmer to personalize the Arc View application

(menu…) and offers some primitives to manipulate (spatial) data

As expected, it offers Efficient spatial computation and good visualization features

...but… Programming ST queries in Avenue is extremely complex because of the lack of high level programming primitives It is an on-going work of A. Brandini for his Master thesis.

Experimenting Arc View in Porcupine Application

Page 23: Complex Reasoning with Logic Database Languages F. Giannotti 1, A. Raffaetà 2 and C. Renso 1 1 CNUCE - CNR Italy 2 Dep. Computer Science - University of

Revigis Meeting, Quebec 23

Uncertainty and Qualitative Reasoning

Our activity in Revigis follows three main directions:

Uncertainty handling: Use of the annotation framework to express deductive rules with levels of certainty (fuzzy logic).

Revision/amalgamation issues: The composition mechanism already provides forms of merging or updating, (preference on atoms - amalgamation by Subrahmanian). Study how to handle conflicts.

Qualitative Reasoning: Investigate how to represent with this formalism the qualitative “nearness” relation introduced by Mike Worboys.

Page 24: Complex Reasoning with Logic Database Languages F. Giannotti 1, A. Raffaetà 2 and C. Renso 1 1 CNUCE - CNR Italy 2 Dep. Computer Science - University of

Revigis Meeting, Quebec 24

Uncertainty handling with annotations

ACL language: Annotations instantiated to elements of uncertainty lattices Lattice ([0,1],) represents fuzzy logic

Each numeric annotation represents degree of certainty of the atom.

den(m15, X, Y):0.3 means that a den for animal m15 is a location

X,Y with 0.3 level of certainty.This language has an immediate implementation

by means of a meta-interpreter.

Page 25: Complex Reasoning with Logic Database Languages F. Giannotti 1, A. Raffaetà 2 and C. Renso 1 1 CNUCE - CNR Italy 2 Dep. Computer Science - University of

Revigis Meeting, Quebec 25

Example

rain:0.9 <- grass_wet:0.8rain: V <- clouds:Vgrass_wet:1.0 <-clouds:0.5 <-If we want to know which is the certainty level of

rain, we ask the system the query ?- rain: V

We obtain the answerV = max(0.9,0.5)

Page 26: Complex Reasoning with Logic Database Languages F. Giannotti 1, A. Raffaetà 2 and C. Renso 1 1 CNUCE - CNR Italy 2 Dep. Computer Science - University of

Revigis Meeting, Quebec 26

Conflict handling

The composition mechanisms offer a way to combine knowledge represented in several knowledge bases.

What about possible conflicts?

Conflicts can arise: information has different certainty levels in

different KBs Inconsistent information coming from

different KBs

Page 27: Complex Reasoning with Logic Database Languages F. Giannotti 1, A. Raffaetà 2 and C. Renso 1 1 CNUCE - CNR Italy 2 Dep. Computer Science - University of

Revigis Meeting, Quebec 27

Example

KB1rain:0.9 <- grass_wet:0.8rain: V <- clouds:Vgrass_wet:1.0 <-clouds:0.5 <-

KB2rain:0.3 <- humidity:0.1humidity:0.1 <-

rain:max(0.9,0.5)

rain:0.3

Query rain:V ?

Page 28: Complex Reasoning with Logic Database Languages F. Giannotti 1, A. Raffaetà 2 and C. Renso 1 1 CNUCE - CNR Italy 2 Dep. Computer Science - University of

Revigis Meeting, Quebec 28

Definition of conflict handling policies

Combination of annotations to define the conflict resolution policyThe most certain: MaxThe less certain: MinBoth: AverageGive more relevance to one data source respect to the other one: weighted average

Examplerain:max(V1,V2) <- rain:V1 wrt KB1, rain:V2 wrt KB2rain:V<-V=op(V1,V2), rain:V1 wrt KB1, rain:V2 wrt

KB2

Page 29: Complex Reasoning with Logic Database Languages F. Giannotti 1, A. Raffaetà 2 and C. Renso 1 1 CNUCE - CNR Italy 2 Dep. Computer Science - University of

Revigis Meeting, Quebec 29

Towards qualitative reasoning

Nearness relation proposed by M. WorboysThis relation is characterized by weak forms of

symmetry and transitivityThree approaches have been proposed to model

experimental data:Three-valued logics (T,N,F)Fuzzy logicsFour-valued logics (T, N, B, F)

We are investigating how to represent both the relations and the models in our language to provide a reasoning mechanism

Page 30: Complex Reasoning with Logic Database Languages F. Giannotti 1, A. Raffaetà 2 and C. Renso 1 1 CNUCE - CNR Italy 2 Dep. Computer Science - University of

Revigis Meeting, Quebec 30

Applications

Flood application We are studying how to represent the Flood

application in Constraint Logic Programming (with uncertainty?)

Other applications to test our MuTACLP formalism???