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

## Presentation on theme: "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."— Presentation transcript:

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 ac cd efac

of 20 Immediate Consequence Given an interpretation IµB P. T is defined by: T (I) = {H σ | H <- B 1 Λ.. Λ B n. and B i σ I}, σ is a variable substitution. T 1 (I) = T(T(T(….(I)….)))

of 20 Semantics without Negation If a n exists: T n (I) = T n+1 (I) then G = T n (I) = I 1 Is the set of concluded facts (without negation)

of 20 Example 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)….)))

of 20 T Operator with Negation Let I be an interpretation, Iµ B P The direct successor operator T is defined as: T (I) = {H σ | H <- B 1 Λ.. Λ B n Λ N 1 Λ.. Λ N n. and B i σ I and N j σ I }, σ is a variable substitution.

of 20 Stratification: Example p(a). p(b). q(a). r(X) q(X).Level 1 t(X) p(X) and not r(X).Level 2 I 0 = {p(a), p(b), q(a)} T(I 0 ) = {r(a)} {p(a), p(b), q(a)} = I 1 T(I 1 ) = {t(b), r(a), p(a), p(b), q(a)} = I 2

of 20 What about the following? person(somebody). woman(X) <- person(X) and not man(X). man(X) <- person(X) and not woman(X).

of 20 Alternating Fixed Point (Well-Founded Semantics) Van Gelder et al., JACM 1991, http://citeseer.nj.nec.com/gelder91wellfounded.html If there exists some n: T n+1 (I) = T n-1 (I) and T n+2 (I) = T n (I) Then the true facts are defined by the smaller sets of T n-1 (I) and T n (I) Unknown facts are given by set difference.

of 20 Alternating 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)}

of 20 F-Logic Thanks to Jürgen Angele

ISWeb - Information Systems & Semantic Web Steffen Staab staab@uni-koblenz.de Foundations of Logic Programming 11 of 32 F-Logic (Syntax) Kifer, Lausen, Wu, Journal of the ACM, 42:741–843, 1995.

ISWeb - Information Systems & Semantic Web Steffen Staab staab@uni-koblenz.de Foundations of Logic Programming 12 of 32 F - Logic Object Oriented (Frame Based) Logic Well-Defined Semantics (Well-Founded Semantics) Efficient Evaluation Strategy Turing-Complete

ISWeb - Information Systems & Semantic Web Steffen Staab staab@uni-koblenz.de Foundations of Logic Programming 14 of 32 Conceptual Modeling Person[hasName=>>STRING; hasBirthdate=>DATE; hasWeight=>NUMBER;......]. AcademicInstitution[hasName=>>STRING; hasAddress=>>STRING; …]. Student[studiesAt=>AcademicInstitution; …]. Define Range of Attributes:

ISWeb - Information Systems & Semantic Web Steffen Staab staab@uni-koblenz.de Foundations of Logic Programming 15 of 32 Instances 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 :

ISWeb - Information Systems & Semantic Web Steffen Staab staab@uni-koblenz.de Foundations of Logic Programming 16 of 32 Rules & Queries // All students at UKoLd FORALL S >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] >A:AcademicInstitution] AND A[hasAddress->L] AND partOf(L,C) AND C:State.

ISWeb - Information Systems & Semantic Web Steffen Staab staab@uni-koblenz.de Foundations of Logic Programming 17 of 32 Quantifier Quantifiers can range over concepts and attributes –FORALL X,Y <- X::Y. –FORALL X,R >R]. –FORALL A,R R].

ISWeb - Information Systems & Semantic Web Steffen Staab staab@uni-koblenz.de Foundations of Logic Programming 18 of 32 F-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-Molecule Schmidt:Student[hasName->>Stefan Schmidt"; studiesAt->>UKoLd; hasBirthdate->1985-07-07; hasWeight->75.0].

ISWeb - Information Systems & Semantic Web Steffen Staab staab@uni-koblenz.de Foundations of Logic Programming 19 of 32 Parametrised Attributes Schmidt:Student[ studiesAt(UKoLd)->>Computer Science; studiesAt(FernUHagen)->>Philosophy ].

ISWeb - Information Systems & Semantic Web Steffen Staab staab@uni-koblenz.de Foundations of Logic Programming 20 of 32 Predicates Instead of Schmidt:Student[ studies(UKoLd)->>Computer Science; studies(FernUHagen)->>Philosophy ]. We can also write studies(Schmidt,UKoLd,Computer Science). studies(Schmidt,FernUHagen,Philosophy).

ISWeb - Information Systems & Semantic Web Steffen Staab staab@uni-koblenz.de Foundations of Logic Programming 21 of 32 Builtins isString( ) concat(,, ) cut(,, ) tokenize(,, ) tokenizen(,,, ) tolower(, ) toupper(, ) regexp(,, ) constant2string(, ) string2number(, ) sin,cos,tan,asin,acos,ceil,floor,exp, rint,sqrt,round,max,min,pow

ISWeb - Information Systems & Semantic Web Steffen Staab staab@uni-koblenz.de Foundations of Logic Programming 22 of 32 Builtin 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).

ISWeb - Information Systems & Semantic Web Steffen Staab staab@uni-koblenz.de Foundations of Logic Programming 23 of 32 Lists [a, b, c, d, e] [a, b, c, d | Tail] [Head | Tail]

ISWeb - Information Systems & Semantic Web Steffen Staab staab@uni-koblenz.de Foundations of Logic Programming 24 of 32 Nesting and Path Expressions Sodiumlactate[isSaltOf-> Lactic[hasFormula->>"HC3H5O3"; hasName->>"Lactic Acid"; hasKa1->>1.4E-4]]. FORALL X,Y X[hasName->>Y]. FORALL Y >Y].

ISWeb - Information Systems & Semantic Web Steffen Staab staab@uni-koblenz.de Foundations of Logic Programming 25 of 32 Negation FORALL S S:NonTechnicalStudent <- S:Student[studiesAt->>UKoLd] AND NOT S[studies(UKoLd)->>Computer Science].

ISWeb - Information Systems & Semantic Web Steffen Staab staab@uni-koblenz.de Foundations of Logic Programming 26 of 32 Namespaces <nsontons: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]. To distinguish objects in different ontologies:

ISWeb - Information Systems & Semantic Web Steffen Staab staab@uni-koblenz.de Foundations of Logic Programming 27 of 32 Namespaces <nsontons: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]. 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:

ISWeb - Information Systems & Semantic Web Steffen Staab staab@uni-koblenz.de Foundations of Logic Programming 28 of 32 Metamodelling 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].

ISWeb - Information Systems & Semantic Web Steffen Staab staab@uni-koblenz.de Foundations of Logic Programming 29 of 32 Complex Rules p(1). p(2). p(3). FORALL X maximum(X) lessorequal(Y,X)). Arbitrary First Order Formula

ISWeb - Information Systems & Semantic Web Steffen Staab staab@uni-koblenz.de Foundations of Logic Programming 30 of 32 Lloyd-Topor Transformation FORALL X maximum(X) 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).

ISWeb - Information Systems & Semantic Web Steffen Staab staab@uni-koblenz.de Foundations of Logic Programming 31 of 32 Transformation 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)

ISWeb - Information Systems & Semantic Web Steffen Staab staab@uni-koblenz.de Foundations of Logic Programming 32 of 32 Transformation from F-Logic to Horn-Logic FORALL X,Y,Z X[ancestor->>Y] Z] AND Z[ancestor->>Y]. FORALL X,Y,Z setatt_(X,ancestor,Y) <- setatt_(X,father,Z) AND setatt_(Z,ancestor,Y).

Similar presentations