Вы находитесь на странице: 1из 4

Deduction in a GEFRED database using Datalog

Ignacio J. Blanco Olga Pons, Jose M. Serrano, and M. Amparo Vila


Dept. Languages and Computer Science Dept. Computer Science and Artificial Intelligence
University of Almerı́a University of Granada
Carretera de Sacramento S/N Periodista Daniel Saucedo Aranda S/N
La Cañada de San Urbano, 04120, Almerı́a, SPAIN 18071, Granada, SPAIN

iblanco@ual.es opc,jmserrano,vila @decsai.ugr.es

Abstract This fusion process requires the extension of the con-


cept of rule used by the FREDDI architecture. These
generalization of rule was introduced by Blanco et al.
In this paper, some considerations on ex-
[5]. This extension does not focus on the domains
tension of the Datalog language are pro-
but on predicates and relations among them. The
posed in order to apply this language on
FREDDI Architecture has to be modified so that new
a GEFRED fuzzy relational database. For
types of conditions, added by the GEFRED Model,
this integration, we use some extended com-
can be represented in order to soften the relations
parators from the GEFRED model and an
among predicates in the rule. An approach to the mod-
existing generalization of the concept of
ification can be found in Blanco[1].
rule to work with flexible values.
As a result of this fusion, Blanco et al. [5] have pro-
Keywords: Datalog, Fuzzy Relational
posed a concrete algorithm (intuitively based on the
Database, GEFRED Model, Logical
Prolog mechanism) to deduce new data from impre-
Database.
cise or incomplete information stored in a GEFRED
database.

1 Introduction This approach is based on the application of all predi-


cates of a rule to an empty tuple. When all predicates
The GEFRED Model was introduced by Medina et are applied, the calculated set of values (the string
al. [9] to integrate several previous proposals which of instantiation) is a fact of the calculated predicate.
extend the Relational Model with capabilities of han- Nevertheless, this approach focus on data and not on
dling and storing imprecise and incomplete informa- the structure of rules when the algorithm explores the
tion by the extension of the concepts of domain and expansion tree.
relation so imprecise and incomplete information can An alternative point of view is Datalog[6]. This ap-
be represented. Because of the difficulty when doing proach is based on the translation of rules into rela-
a low-level handling on these extended relations and tional languages in order to apply them on a relational
domains, Galindo et al. [7] and Blanco et al. [4] de- database. In this paper, we try to extend this transla-
veloped an extended SQL language. tion so it can be used on a GEFRED database.
At the same time, Pons et al. introduced FREDDI[8, In section 2 we resume briefly the Datalog Model, the
10], an architecture to represent logical information generalized concept of rule to be translated and the
(rules in clausal form) into the Relational Model. concepts of the GEFRED Model that determine this
Using these extensions as an starting point, Pons et translation. In section 3, we present our proposal for
al. [8, 10] and Blanco et al. [3, 2, 5] considered the extension of Datalog. Finally, in section 4, we
that merging them can give the capability of making explain the conclusions and the future work to develop
classical deductions on flexible data in the Relational a complete extension for Datalog.
Model.
2 Previous models and concepts where Ψ is a formula:
Ψ  Xi αi  j k Y j k  
In this section, we resume some important concepts to
Y j k β j k l p Yl p   (2)
extend the Datalog language.
 φ j k l p Θθj k l p Y j k Yl p γ j k l p 
2.1 GEFRED concepts and where:
The GEFRED Model extends the concept of domain   Ai represents A1  A2    An summarized,
so imprecise or incomplete information can be repre-
sented. In the same way, the concept of comparison  conditions Xi α   Y j k  refer to variables
i jk
operator has to be modified in order to work with this shared between a predicate in the body of the rule
kind of domains. and the predicate in the head,
An extended fuzzy comparator θ is a fuzzy relation  conditions Y j k β    Yl p  refer
jkl p
to variables
defined on the domain of discourse U as follows:
θ : U U  0  1
 shared between two predicates in the body of the
rule,
θ ui  u j   a  expressions φ j k l p Θθj k l p Y j k Yl p γ j k l p  re-
Let be D a fuzzy domain on U and a function Θθ de- fer to comparisons explicitly introduced by the
fined as follows: user to constraint the rule meaning. In those
Θθ : D D  0  1
 ones, φ j k l p is the threshold function for the
comparison degree, Θθj k l p is a generalized fuzzy
Θθ d˜1  d˜2   0  1
comparator defined on the classical comparator
Then Θθ is named a generalized fuzzy comparator θ, and γ j k l p is the minimum degree for the com-
on D and generated by the extended comparator θ if it parison to be evaluated to true.
verifies:  every variable in the head of the rule is linked to
Θθ d˜1  d˜2   θ d1  d2  d1  d2
U one or more variables in the body of the rule, and
 every variable in the body of the rule is linked to
1 d dand
where 1 d defined on the values d and d ,
˜1 and d˜2 are the possibility distributions
1 2 1 2 a variable in the head or in the body of the rule.
respectively.
2.3 The Datalog Language
2.2 Generalized rule for deduction with flexible
data Datalog is a logic programming language that was
designed to be used as a language for querying
Let be: databases[6]. It is a non procedural, set-oriented and
 P a n-ary predicate and Qi i
1 m ni -ary non order-sensitive (with respect to the predicates in a
rule) language with no special predicates nor function
predicates. symbols. Although it is syntactically equal to Prolog,
 Xi i
1 n and Y j k  j
1 m k
the evaluation of the pair of rules shown in expression
1 n variables having their values in
j
(3) does not lead to an endless loop.

domains D X  i
1  n and
GEFRED ancestor X Y   ancestor Z Y  parent X  Z 
Y j k  j
1  m  k
1  n j .
i

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.

[4] I. Blanco, N. Marı́n, O. Pons, and M. A. Vila.


When calculating facts satisfying a rule, Datalog
An extension of data description language (ddl)
translates every rule in a joint operation so the result
for fuzzy data handling. In Larsen, Kacprzyk,
if this translation is an only joint operation containing
Zadrozny, Andreasen, and Christiansen, editors,
others. But when solving this query, deeper predicates
Flexible Query Answering Systems, Recent Ad-
are calculated earlier. With this consideration, con-
vances, Advances in Soft Computing, pages 54–
ditions in sub-formula ΨX could not be applied until
64. Physica-Verlag, 2000.
values of variables Xi are known, so translation would
be re-written as shown in expression (9). [5] I. Blanco, M. J. Martı́n-Bautista, O. Pons, and
M. A. Vila. A mechanism for deduction in a
σΨX Π X1 X2 Xn  σΨC Rx  (9) fuzzy relational database. In Proceedings of
the 9th Information Processing and Manage-
4 Conclusion and future work ment of Uncertainty in Knowledge-based Sys-
tems IPMU 2002 Conference, pages 291–298,
In the present work, we have shown a first approach Annecy, France, July 2002.
to an extension of Datalog so it can be applied on a
GEFRED database. This extension have been built [6] S. Ceri, G. Gottlob, and L. Tanca, editors. Logic
on the basis of the GEFRED Model, an extension of Programming and Databases. Surveys in Com-
logical rules for a relational deductive database and puter Science. Springer-Verlag, 1990.
the Datalog language. [7] J. Galindo. Tratamiento de la Imprecisión en
As seen in section 3, the evaluation of some condi- Bases de Datos Relacionales: Extensión del
tions have to be delayed so it would be interesting to modelo y adaptación de los SGBD actuales. PhD
study the order when applying all conditions in the thesis, Department of Computer Science and
translated query. Artificial Intelligence, University of Granada,
España, 1999.
Furthermore, when working on imprecise values, val-
ues are not completely equal, so the equality degree [8] J. M. Medina, O. Pons, J. C. Cubero, and M. A.
has to be represented and operated in order to give an Vila. Freddi: A fuzzy relational deductive
imprecision degree with the resulting fact. database interface. International Journal of In-
telligent Systems, 12:597–613, 1997.
References
[9] J. M. Medina, O. Pons, and M. A. Vila. Gefred. a
[1] I. Blanco. Deducción en Bases de Datos Re- generalized model of fuzzy relational databases.
lationales Difusas. PhD thesis, E. T. S. I. In- Information Sciences, 1994.
formática, Universidad de Granada, Spain, 2001. [10] O. Pons, J. M. Medina, J. C. Cubero, and A. Vila.
An architecture for a deductive fuzzy relational
[2] I. Blanco, J. C. Cubero, O. Pons, and M. A.
database. In Z.W. Ras and M. Michaliewicz, ed-
Vila. An implementation for fuzzy relational
itors, Foundations of Intelligent Systems, volume
databases. In G. Bordogna and G. Passi, edi-
1079 of Lectures Notes in Artificial Intelligence.
tors, Recent Research Issues on the Management
Springer, 1996.
of Fuzziness in Databases, Studies in Fuzziness
and Soft Computing, pages 183–207. Physica-
Verlag, 2000.

[3] I. Blanco, F. Cuenca, O. Pons, and M. A.


Vila. Implementation of an inference engine
for fuzzy databases. In Proceedings of the

Вам также может понравиться