Professional Documents
Culture Documents
Deduction in A GEFRED Database Using Datalog: Ignacio J. Blanco Olga Pons, Jose M. Serrano, and M. Amparo Vila
Deduction in A GEFRED Database Using Datalog: Ignacio J. Blanco Olga Pons, Jose M. Serrano, and M. Amparo Vila
ancestor X Y parent X Y
(3)
We define a generalized rule for deduction with
fuzzy data, or simply a generalized rule, a rule with A base conjunction is a list of predicates of the
the following structure: database and arithmetic predicates, as an instance, the
one shown in expression (4).
P X1 X2 Xn :
Q1 Y1 1 Y1 2 Y1 n1 (1) bc1 : db1 X1 a X3 db2 X3 X4 X5 X4 b
Qm Ym 1 Ym 2 Ym nm Ψ db3 X5 X6 X7 X6 c
(4)
A base conjunction can be a part of a Prolog rule or X X schemes
where of relations R 1 , R2 and R3 are
a set of Prolog rules, as seen in the translation of ex- 1 2 X3
, X3 X4 X5
and X5 X6 X7
, respec-
pression (4) into the expression (5). tively.
go1 X1 X4 : db1 X1 a X3 p1 X3 X4
p1 Y1 Y4 : db2 Y1 Y2 Y3 Y2 b p2 Y3 Y4 3 The Datalog Extension
p2 Z1 Z3 : db3 Z1 Z2 Z3 Z2 c
(5) The aim of this work is to extend the Datalog language
in order to be applied on a fuzzy relational database
A connected conjunction is a base conjunction that based on the GEFRED Model.
can not be divided in two parts with no common
variables. A string is a connected conjunction only As seen in section 2.3, a rule can be translated into
if there exists an internal sequence of predicates a join sentence, based on the selection and the pro-
db1 dbn where the predicate dbi i
2 n jection operations. The first problem when trying to
1
only has shared variables with predicates dbi 1 apply this translation to generalized rules shown in
and dbi 1 . A cyclic conjunction is a string where section 2.2 is the type of conditions that can be repre-
the predicate dbn has shared variables with dbn 1 and sented in the selection. The classical comparison op-
db1 . erators are not suitable when working with imprecise
values. We propose to extend the set of possible com-
A shared variable in a base conjunction is a variable parators with the ones introduced in GEFRED and in-
that is shared with other predicates that are in the rule corporated to generalization of the concept of rule.
and not in the base conjunction.
A generalized rule as seen in expression (1) is trans-
Finally, a base conjunction is equivalent to a join lated into the query shown in expression (7). The
operation in the database, that represented in the Re- formula Ψ, shown in expression (2), can be seen as
lational Algebra is an expression including the follow- Ψ ΨX ΨY ΨC , where ΨX is the sub-formula con-
ing elements: taining all comparison predicates that relate variables
selection on relations corresponding to predi-
in the head and the body of the rule, ΨY is the sub-
formula containing those ones that relate variables in
cates in the database when there are variables
the body of the rule, and ΨC is the sub-formula con-
which value has been fixed with another variable
taining all comparison predicates that establish con-
or variables appearing in an arithmetic predicate:
straints on the resulting set of facts.
R X a σY a R
Π X1 X2 Xn σΨX ΨC Rx
join of relations corresponding to predicates in (7)
the database having shared variables: The relation Rx is a relation obtained by the query:
R X Y S Y Z R S
Ry Rz
a projection applied on the attributes correspond- Rx Π Yi 1 Yi 2 Yi ni Qi
(8)
ing to the shared variables of the base conjunc-
tion. that is, the relation Rx can be:
For example, let us suppose a rules go1 having a base a relation Π Y Y Y Q1 corresponding to
11 12 1 n1
conjunction bc1 as shown in expression (6). the predicate in a rule with an only predicate,
go1 X1 X7 : bc1 X1 X7 a
bc1 X1 X7 : db1 X1 a X3 db2 X3 b X5
relation corresponding to a joint operation
Π Yi 1 Yi 2 Yi ni Qi Π Y j 1 Y j 2 Y j n j Q j where
(6)
db3 X5 c X7
k
1 ni
l
1 n j
Yi k βi k j l Y j l
If the translation of base conjunctions is applied to is a sub-formula within ΨY , or
these rules we obtain: a relation corresponding to a joint operation Ry
jc1 : ΠX1 X7 σX2 a R1 σX4 b R2 σX6 c R3 Rz where schemes of relations Ry and Rz have
shared variables. Two variables Yi k and Y j l in EUSFLAT/ESTYLF 99 Joint Conference, pages
the scheme of relations Ry and Rz , respectively, 493–496. European Society for Fuzzy Logic and
are shared only if Yi k βi k j l Y j l is in ΨY . Technology, 1999.