Download - Of 20 Naive Evaluation q(f(a), a), q(a,c), q(f(c),c), r(a, c), r(c, d), r(e,f) p(X, Y) q(f(X), X) r(X, Y) p(X, c) f(X) X f(a) f(c) a c X Y a c c d X Y.

Transcript
Page 1: Of 20 Naive Evaluation q(f(a), a), q(a,c), q(f(c),c), r(a, c), r(c, d), r(e,f) p(X, Y) q(f(X), X) r(X, Y) p(X, c) f(X) X f(a) f(c) a c X Y a c c d X Y.

<Nr.> of 20

<is web> Naive EvaluationNaive Evaluation

q(f(a), a), q(a,c), q(f(c),c), r(a, c), r(c, d), r(e,f)p(X, Y) q(f(X), X) r(X, Y)

p(X, c)

f(X) X

f(a)

f(c)

a

c

X Y

a

c

c

d

X Y

a c

c d

e fa c

Page 2: Of 20 Naive Evaluation q(f(a), a), q(a,c), q(f(c),c), r(a, c), r(c, d), r(e,f) p(X, Y) q(f(X), X) r(X, Y) p(X, c) f(X) X f(a) f(c) a c X Y a c c d X Y.

<Nr.> of 20

<is web> Immediate ConsequenceImmediate Consequence

Given an interpretation IµBP.

T is defined by:

T (I) = {H σ | H <- B1 Λ.. Λ Bn. and Biσ I} ,

σ is a variable substitution.

T1(I) = T(T(T(….(I)….)))

Page 3: Of 20 Naive Evaluation q(f(a), a), q(a,c), q(f(c),c), r(a, c), r(c, d), r(e,f) p(X, Y) q(f(X), X) r(X, Y) p(X, c) f(X) X f(a) f(c) a c X Y a c c d X Y.

<Nr.> of 20

<is web> Semantics without NegationSemantics without Negation

If a n exists:

Tn(I) = Tn+1(I)

then

G = Tn(I) = I1

Is the set of concluded facts (without negation)

Page 4: Of 20 Naive Evaluation q(f(a), a), q(a,c), q(f(c),c), r(a, c), r(c, d), r(e,f) p(X, Y) q(f(X), X) r(X, Y) p(X, c) f(X) X f(a) f(c) a c X Y a c c d X Y.

<Nr.> of 20

<is web> ExampleExample

p(a). p(b). q(a).

r(X) q(X).

t(X) p(X) and r(X).

I = {p(a), p(b), q(a)}

T(I) = {r(a)} {p(a), p(b), q(a)}

T(T(I)) = {r(a), t(a), p(a), p(b), q(a)}

= T(T(T(I))) = T(T(T(….(I)….)))

Page 5: Of 20 Naive Evaluation q(f(a), a), q(a,c), q(f(c),c), r(a, c), r(c, d), r(e,f) p(X, Y) q(f(X), X) r(X, Y) p(X, c) f(X) X f(a) f(c) a c X Y a c c d X Y.

<Nr.> of 20

<is web> Stratification: ExampleStratification: Example

p(a). p(b). q(a).

r(X) q(X). Level 1

t(X) p(X) and not r(X). Level 2

I0 = {p(a), p(b), q(a)}

T(I0) = {r(a)} {p(a), p(b), q(a)} = I1

T(I1) = {t(b), r(a), p(a), p(b), q(a)} = I2

Page 6: Of 20 Naive Evaluation q(f(a), a), q(a,c), q(f(c),c), r(a, c), r(c, d), r(e,f) p(X, Y) q(f(X), X) r(X, Y) p(X, c) f(X) X f(a) f(c) a c X Y a c c d X Y.

<Nr.> of 20

<is web> What about the following?What about the following?

person(somebody).

woman(X) <- person(X) and not man(X).

man(X) <- person(X) and not woman(X).

Page 7: Of 20 Naive Evaluation q(f(a), a), q(a,c), q(f(c),c), r(a, c), r(c, d), r(e,f) p(X, Y) q(f(X), X) r(X, Y) p(X, c) f(X) X f(a) f(c) a c X Y a c c d X Y.

<Nr.> of 20

<is web> Alternating Fixed Point (Well-Founded Alternating Fixed Point (Well-Founded Semantics)Semantics)

Van Gelder et al., JACM 1991, http://citeseer.nj.nec.com/gelder91wellfounded.html

If there exists some n:

Tn+1(I) = Tn-1(I) and

Tn+2(I) = Tn(I)

Then the true facts are defined by the

smaller sets of Tn-1(I) and Tn(I)

Unknown facts are given by set difference.

Page 8: Of 20 Naive Evaluation q(f(a), a), q(a,c), q(f(c),c), r(a, c), r(c, d), r(e,f) p(X, Y) q(f(X), X) r(X, Y) p(X, c) f(X) X f(a) f(c) a c X Y a c c d X Y.

<Nr.> of 20

<is web> Alternating Fixed Point: ExampleAlternating Fixed Point: Example

person(sb).

woman(X) <- person(X) and not man(X).

man(X) <- person(X) and not woman(X).

T(I={person{sb}}) = {woman(sb), man(sb), person(sb)}

T(T(I)) = {person(sb)}

T(T(T(I))) = {woman(sb), man(sb), person(sb)}

T(T(T(T(I)))) = {person(sb)}

True Facts = {person(sb)}

Unknown Facts = {woman(sb), man(sb)}

Page 9: Of 20 Naive Evaluation q(f(a), a), q(a,c), q(f(c),c), r(a, c), r(c, d), r(e,f) p(X, Y) q(f(X), X) r(X, Y) p(X, c) f(X) X f(a) f(c) a c X Y a c c d X Y.

<Nr.> of 20

<is web>

F-LogicF-Logic

Thanks to Jürgen AngeleThanks to Jürgen Angele

Page 10: Of 20 Naive Evaluation q(f(a), a), q(a,c), q(f(c),c), r(a, c), r(c, d), r(e,f) p(X, Y) q(f(X), X) r(X, Y) p(X, c) f(X) X f(a) f(c) a c X Y a c c d X Y.

ISWeb - Information Systems & Semantic Web

Steffen [email protected]

Foundations of Logic Programming11 of 32

<is web>

F-Logic (Syntax)

Kifer, Lausen, Wu, Journal of the ACM, 42:741–843, 1995.

Page 11: Of 20 Naive Evaluation q(f(a), a), q(a,c), q(f(c),c), r(a, c), r(c, d), r(e,f) p(X, Y) q(f(X), X) r(X, Y) p(X, c) f(X) X f(a) f(c) a c X Y a c c d X Y.

ISWeb - Information Systems & Semantic Web

Steffen [email protected]

Foundations of Logic Programming12 of 32

<is web> F - LogicF - Logic

Object Oriented (Frame Based) Logic

Well-Defined Semantics (Well-Founded Semantics)

Efficient Evaluation Strategy Turing-Complete

Page 12: Of 20 Naive Evaluation q(f(a), a), q(a,c), q(f(c),c), r(a, c), r(c, d), r(e,f) p(X, Y) q(f(X), X) r(X, Y) p(X, c) f(X) X f(a) f(c) a c X Y a c c d X Y.

ISWeb - Information Systems & Semantic Web

Steffen [email protected]

Foundations of Logic Programming13 of 32

<is web> Concepts and Subconcept RelationshipConcepts and Subconcept Relationship

Person::OBJECT.

Man:: Person.Woman::Person.Employee::Person.Professor::Employee.Student::Person.PhDStudent::Student.

AcademicInstitution::Object.University::AcademicInstitution.

Objects are identified using unique Ids

http://www.projecthalo.com/-> downloads-> Halo pilot downloads-> Ontoprise Halo Improved download (Format: EXE/78 MB)

Page 13: Of 20 Naive Evaluation q(f(a), a), q(a,c), q(f(c),c), r(a, c), r(c, d), r(e,f) p(X, Y) q(f(X), X) r(X, Y) p(X, c) f(X) X f(a) f(c) a c X Y a c c d X Y.

ISWeb - Information Systems & Semantic Web

Steffen [email protected]

Foundations of Logic Programming14 of 32

<is web>Conceptual ModelingConceptual Modeling

Person[hasName=>>STRING;hasBirthdate=>DATE;hasWeight=>NUMBER;......].

AcademicInstitution[hasName=>>STRING;hasAddress=>>STRING;…].

Student[studiesAt=>AcademicInstitution;…].

Define Range of Attributes:

Page 14: Of 20 Naive Evaluation q(f(a), a), q(a,c), q(f(c),c), r(a, c), r(c, d), r(e,f) p(X, Y) q(f(X), X) r(X, Y) p(X, c) f(X) X f(a) f(c) a c X Y a c c d X Y.

ISWeb - Information Systems & Semantic Web

Steffen [email protected]

Foundations of Logic Programming15 of 32

<is web> Instances and AttributesInstances and Attributes

Schmidt:Student.Schmidt[hasName->>“Stefan Schmidt";

studiesAt->>UKoLd;hasBirthdate->1985-0707;hasWeight->75.0].

UKoLd:University.UKoLd[hasName->>“Universität Koblenz-Landau";

hasAddress->>“Isaac-Fulda-Allee 3, Mainz";…].

Assign values to Attributes :

Page 15: Of 20 Naive Evaluation q(f(a), a), q(a,c), q(f(c),c), r(a, c), r(c, d), r(e,f) p(X, Y) q(f(X), X) r(X, Y) p(X, c) f(X) X f(a) f(c) a c X Y a c c d X Y.

ISWeb - Information Systems & Semantic Web

Steffen [email protected]

Foundations of Logic Programming16 of 32

<is web> Rules & QueriesRules & Queries

// All students at UKoLdFORALL S <- S:Student[studiesAt->>UKoLd].

// Student at Academic Institutions of some state are students educated at the costs of this state

Rule PaysFor: FORALL C,S,A,L

C[paysEducationCostsOf->>S]<- S:Student[studiesAt->>A:AcademicInstitution]

AND A[hasAddress->L] AND partOf(L,C) AND C:State.

Page 16: Of 20 Naive Evaluation q(f(a), a), q(a,c), q(f(c),c), r(a, c), r(c, d), r(e,f) p(X, Y) q(f(X), X) r(X, Y) p(X, c) f(X) X f(a) f(c) a c X Y a c c d X Y.

ISWeb - Information Systems & Semantic Web

Steffen [email protected]

Foundations of Logic Programming17 of 32

<is web> QuantifierQuantifier

Quantifiers can range over concepts and attributes– FORALL X,Y <- X::Y.

– FORALL X,R <- X[hasName=>>R].

– FORALL A,R <- University[A=>R].

Page 17: Of 20 Naive Evaluation q(f(a), a), q(a,c), q(f(c),c), r(a, c), r(c, d), r(e,f) p(X, Y) q(f(X), X) r(X, Y) p(X, c) f(X) X f(a) f(c) a c X Y a c c d X Y.

ISWeb - Information Systems & Semantic Web

Steffen [email protected]

Foundations of Logic Programming18 of 32

<is web> F-MoleculeF-Molecule

…can be split into multiple F-Atoms: Schmidt:Student.Schmidt[hasName->>“Stefan Schmidt"].Schmidt[studiesAt->>UKoLd]. Schmidt[hasBirthdate->1985-07-07].Schmidt[hasWeight->75.0].

An F-MoleculeSchmidt:Student[hasName->>“Stefan Schmidt";

studiesAt->>UKoLd; hasBirthdate->1985-07-07;

hasWeight->75.0].

Page 18: Of 20 Naive Evaluation q(f(a), a), q(a,c), q(f(c),c), r(a, c), r(c, d), r(e,f) p(X, Y) q(f(X), X) r(X, Y) p(X, c) f(X) X f(a) f(c) a c X Y a c c d X Y.

ISWeb - Information Systems & Semantic Web

Steffen [email protected]

Foundations of Logic Programming19 of 32

<is web> Parametrised AttributesParametrised Attributes

Schmidt:Student[studiesAt(UKoLd)->>”Computer Science”;studiesAt(FernUHagen)->>”Philosophy”

].

Page 19: Of 20 Naive Evaluation q(f(a), a), q(a,c), q(f(c),c), r(a, c), r(c, d), r(e,f) p(X, Y) q(f(X), X) r(X, Y) p(X, c) f(X) X f(a) f(c) a c X Y a c c d X Y.

ISWeb - Information Systems & Semantic Web

Steffen [email protected]

Foundations of Logic Programming20 of 32

<is web> PredicatesPredicates

Instead of

Schmidt:Student[

studies(UKoLd)->>”Computer Science”;

studies(FernUHagen)->>”Philosophy”].

We can also write

studies(Schmidt,UKoLd,”Computer Science”).studies(Schmidt,FernUHagen,”Philosophy”).

Page 20: Of 20 Naive Evaluation q(f(a), a), q(a,c), q(f(c),c), r(a, c), r(c, d), r(e,f) p(X, Y) q(f(X), X) r(X, Y) p(X, c) f(X) X f(a) f(c) a c X Y a c c d X Y.

ISWeb - Information Systems & Semantic Web

Steffen [email protected]

Foundations of Logic Programming21 of 32

<is web> BuiltinsBuiltins

isString(<arg>) concat(<string 1 > , <string 2 > , <string 3 >) cut(<string>,<n>,<variable>)tokenize(<string>,<delimiters>,<variable>) tokenizen(<string>,<n>,<delimiters>,<variab

le>) tolower(<string>,<variable>) toupper(<string>,<variable>) regexp(<regular

expression>,<string1>,<string2>)constant2string(<function>,<string>)string2number(<string>,<number>)sin,cos,tan,asin,acos,ceil,floor,exp,rint,sqrt,round,max,min,pow

Page 21: Of 20 Naive Evaluation q(f(a), a), q(a,c), q(f(c),c), r(a, c), r(c, d), r(e,f) p(X, Y) q(f(X), X) r(X, Y) p(X, c) f(X) X f(a) f(c) a c X Y a c c d X Y.

ISWeb - Information Systems & Semantic Web

Steffen [email protected]

Foundations of Logic Programming22 of 32

<is web> Builtin ExamplesBuiltin Examples

• tolower:FORALL X <- tolower(“I Love Ontologies!”,X).

• is, equals:FORALL B,C,A <- (B is A+1) AND (C is A+2) AND

equals(A,1).

• dbaccessuser2, concat:FORALL X, PROJECTID, PROJECTNAME X:Project[name->> PROJECTNAME] <-dbaccessuser2(“table_projects",F(“projectID",PROJECTID, “project_name",PROJECTNAME),"mssqlserver2000",“database_projects",“computer_xyz:1433", "zope","zope") AND concat(“project", PROJECTID,X).

Page 22: Of 20 Naive Evaluation q(f(a), a), q(a,c), q(f(c),c), r(a, c), r(c, d), r(e,f) p(X, Y) q(f(X), X) r(X, Y) p(X, c) f(X) X f(a) f(c) a c X Y a c c d X Y.

ISWeb - Information Systems & Semantic Web

Steffen [email protected]

Foundations of Logic Programming23 of 32

<is web> ListsLists

[a, b, c, d, e]

[a, b, c, d | Tail]

[Head | Tail]

Page 23: Of 20 Naive Evaluation q(f(a), a), q(a,c), q(f(c),c), r(a, c), r(c, d), r(e,f) p(X, Y) q(f(X), X) r(X, Y) p(X, c) f(X) X f(a) f(c) a c X Y a c c d X Y.

ISWeb - Information Systems & Semantic Web

Steffen [email protected]

Foundations of Logic Programming25 of 32

<is web> NegationNegation

FORALL SS:NonTechnicalStudent<-S:Student[studiesAt->>UKoLd] ANDNOT S[studies(UKoLd)->>”Computer

Science”].

Page 24: Of 20 Naive Evaluation q(f(a), a), q(a,c), q(f(c),c), r(a, c), r(c, d), r(e,f) p(X, Y) q(f(X), X) r(X, Y) p(X, c) f(X) X f(a) f(c) a c X Y a c c d X Y.

ISWeb - Information Systems & Semantic Web

Steffen [email protected]

Foundations of Logic Programming26 of 32

<is web> NamespacesNamespaces

<ns ontons:cars="www.cars-r-us.tv" ontons:finance="www.financeWorld.tv"ontons="www.myDomain.tv/private">

cars#Car[cars#driver => cars#Person; cars#passenger =>>

cars#Person;cars#seats => NUMBER].

cars#Person[cars#name => STRING].</ns>

To distinguish objects in different ontologies:

Page 25: Of 20 Naive Evaluation q(f(a), a), q(a,c), q(f(c),c), r(a, c), r(c, d), r(e,f) p(X, Y) q(f(X), X) r(X, Y) p(X, c) f(X) X f(a) f(c) a c X Y a c c d X Y.

ISWeb - Information Systems & Semantic Web

Steffen [email protected]

Foundations of Logic Programming27 of 32

<is web> NamespacesNamespaces

<ns ontons:cars="www.cars-r-us.tv" ontons:finance="www.financeWorld.tv"ontons="www.myDomain.tv/private">

cars#Car[cars#driver => cars#Person; cars#passenger =>> cars#Person;cars#seats => NUMBER].

cars#Person[cars#name => STRING].</ns>

Translated into

obj(„www.cars-r-us.tv“,car)[obj(„www.cars-r-us.tv“,driver)=> obj(„www.cars-r-us.tv“,Person),

….]

To distinguish objects in different ontologies:

Page 26: Of 20 Naive Evaluation q(f(a), a), q(a,c), q(f(c),c), r(a, c), r(c, d), r(e,f) p(X, Y) q(f(X), X) r(X, Y) p(X, c) f(X) X f(a) f(c) a c X Y a c c d X Y.

ISWeb - Information Systems & Semantic Web

Steffen [email protected]

Foundations of Logic Programming28 of 32

<is web>MetamodellingMetamodelling

InstitutionType[hasInstantiations->Number].University:InstitutionType.Fachhochschule:InstitutionType.University[hasInstations->2].Fachhochschule[hasInstantiations->1]

Institution[hasName=>>String].University::Institution.

UKoLd:University[hasName->>”Universitaet Koblenz-Landau”].

UMainz:University[hasName->>”Universitaet Mainz”].FHKoblenz:Fachhochschule[

hasName->>”Fachhochschule Koblenz”]

.

Page 27: Of 20 Naive Evaluation q(f(a), a), q(a,c), q(f(c),c), r(a, c), r(c, d), r(e,f) p(X, Y) q(f(X), X) r(X, Y) p(X, c) f(X) X f(a) f(c) a c X Y a c c d X Y.

ISWeb - Information Systems & Semantic Web

Steffen [email protected]

Foundations of Logic Programming29 of 32

<is web> Complex RulesComplex Rules

p(1).p(2).p(3).

FORALL X maximum(X)<- p(X) AND FORALL Y (p(Y) ->

lessorequal(Y,X)).

Arbitrary First Order Formula

Page 28: Of 20 Naive Evaluation q(f(a), a), q(a,c), q(f(c),c), r(a, c), r(c, d), r(e,f) p(X, Y) q(f(X), X) r(X, Y) p(X, c) f(X) X f(a) f(c) a c X Y a c c d X Y.

ISWeb - Information Systems & Semantic Web

Steffen [email protected]

Foundations of Logic Programming30 of 32

<is web> Lloyd-Topor TransformationLloyd-Topor Transformation

FORALL X maximum(X)<- p(X) AND FORALL Y (p(Y) ->

lessorequal(Y,X)).

FORALL X,Y maximum(X)<- p(X) AND (NOT p(Y) OR lessorequal(Y,X)).

FORALL X,Y q(X)<- p(Y) AND NOT

lessorequal(Y,X).

FORALL X maximum(X)<- p(X) AND NOT

q(X).

Page 29: Of 20 Naive Evaluation q(f(a), a), q(a,c), q(f(c),c), r(a, c), r(c, d), r(e,f) p(X, Y) q(f(X), X) r(X, Y) p(X, c) f(X) X f(a) f(c) a c X Y a c c d X Y.

ISWeb - Information Systems & Semantic Web

Steffen [email protected]

Foundations of Logic Programming31 of 32

<is web>Transformation from F-Logic to Horn-LogicTransformation from F-Logic to Horn-Logic

a:C

A::B

A[B=>C]

A[B=>>C]

a[B->c]

a[B->>c]

isa_(a,C)

sub_(A,B)

atttype_(A,B,C)

setatttype_(A,B,C)

att_(a,B,c)

setatt_(a,B,c)

Page 30: Of 20 Naive Evaluation q(f(a), a), q(a,c), q(f(c),c), r(a, c), r(c, d), r(e,f) p(X, Y) q(f(X), X) r(X, Y) p(X, c) f(X) X f(a) f(c) a c X Y a c c d X Y.

ISWeb - Information Systems & Semantic Web

Steffen [email protected]

Foundations of Logic Programming32 of 32

<is web> Transformation from F-Logic to Horn-LogicTransformation from F-Logic to Horn-Logic

FORALL X,Y,Z X[ancestor->>Y] <- X[father->Z] AND Z[ancestor->>Y].

FORALL X,Y,Z setatt_(X,ancestor,Y) <- setatt_(X,father,Z) AND setatt_(Z,ancestor,Y).