FSQL (Fuzzy SQL)
A Fuzzy Query Language
We have developed a FSQL Server for a Fuzzy Relational Database (FRDB).
The FSQL language (Fuzzy SQL) is an extension of the SQL language that
allows us to write flexible conditions in our queries.
This Server has been depeloped for Oracle, following the model GEFRED,
a theoric model for FRDB that includes fuzzy attributes to store vague
information in the tables.
The FSQL Server allows us to make flexible queries about traditional
(crisp) or fuzzy attributes and we can use linguistic labels defined
on any attribute.
The FSQL language extends the SQL language to allow
flexible queries. We have extended the SELECT command in order for
it to express flexible queries and, due to its complex format, we only
show here an abstract with the main extensions to this command:
- Linguistic Labels: If an attribute is capable of fuzzy
treatment then linguistic labels can be defined on it.
These labels will be preceded with the symbol $ to
distinguish them easily.
There are two types of labels and they will be used in different fuzzy attribute
types:
- Labels for attributes with an ordered underlined fuzzy domain:
Every label of this type has asociated a trapezoidal possibility
distribution.
- Labels for attributes with an non ordered fuzzy domain.
Here, there is a similarity relation defined between each two labels
in the domain. The similarity degree is in the interval [0,1].
- Fuzzy Comparators:
Besides the typical comparators (=, >...), FSQL
includes the fuzzy comparators in the following table.
Like in SQL, fuzzy comparators may compare one column with one constant
or two columns of the same type.
Comparator for Possibility
| Comparator for Necessity
| Significance
|
---|
FEQ | NFEQ | Fuzzy EQual (Possibly/Necessarily Equal)
|
FGT | NFGT | Fuzzy Greater Than
|
FGEQ | NFGEQ | Fuzzy Greater or Equal
|
FLT | NFLT | Fuzzy Less Than
|
FLEQ | NFLEQ | Fuzzy Less or Equal
|
MGT | NMGT | Much Greater Than
|
MLT | NMLT | Much Less Than
|
Possibility comparators are more general than necessity comparators are.
Then, necessity comparators retrieve less tuples and these
comply with the conditions necessarily.
- Fulfilment thresholds (T):
For each simple condition a fulfilment threshold may be established
(default is 1). with the format:
condition THOLD T
indicating that the condition must be satisfied with minimum
degree T in [0,1] to be considered. The reserved word
THOLD is optional and may be substitute for a traditional crisp
comparator (=, <...), modifying the query meaning.
The word THOLD is equivalent to using the crisp comparator greater
or equal.
Example:
Give me all persons with fair hair (in minimum degree 0.5) that
they are possibly taller than label $Tall (in minimum degree 0.8):
SELECT | * FROM Person
|
WHERE | Hair FEQ $Fair THOLD 0.5 AND
|
| Height FGT $Tall THOLD 0.8
|
- Function CDEG(attribute): It shows
a column with the fulfilment degree of the condition of the query,
for a specific attribute, which is expressed between brackets as the argument.
If logic operators appear, the calculation of this compatibility degree
is carried out in the following way:
We use the minimum T-norm and the maximum T-conorm, but the user may
change these values by default modifying only a view (FSQL_NOTANDOR).
In this view the user can set the function to use for every logic operator
(NOT, AND, OR). Obviously, that function must be implemented in the FSQL Server or
may be implemented by the user himself.
If the argument of the function CDEG is an attribute,
then the function CDEG only
uses the conditions that includes that attribute.
We can use CDEG(*) to obtain the fulfilment degree of each tuple
(with all of its attributes, not just one of them) in the condition.
- Character %: It is similar to the character * of SQL but
this one also includes the columns for the fulfilment degrees of the attributes in which
they are relevant. In the result you will also find the function CDEG applied to
each and every one of the fuzzy attributes which appear in the condition. If we wanted to obtain
in previous example two more columns with the degrees of
CDEG(Hair) and CDEG(Height), we would only have to replace * by %.
Of course, this character may be also used with the format [[scheme.]table.]%,
as for example: Person.%.
- Fuzzy Constants: In FSQL we can use the fuzzy constants
as detailled in
table:
Fuzzy Constant | Significance
|
---|
UNKNOWN | Unknown value but the attribute is applicable
|
UNDEFINED | The attribute is not applicable or it is meaningless
|
NULL | Total ignorance: We know nothing about it
|
$[a,b,c,d] | Fuzzy trapezium (a<=b<=c<=d)
|
$label | Linguistic Label: It may be a trapezium or a scalar
(defined in FMB).
|
[n,m] | Interval "Between \texttt{n} and \texttt{m}" (a=b=n and c=d=m).
|
#n | Fuzzy value "Approximately \texttt{n}"
(b=c=n and n-a=d-n=margin).
|
-
Condition with IS: Another kind of condition
we can use has the next format:
IS [NOT] (UNKNOWN | UNDEFINED | NULL)
Remarks concerning the condition with IS:
- This condition (without NOT) will be true if the left
fuzzy attribute value
(Fuzzy_Attribute) is the fuzzy constant situated on the right.
- If the attribute is not fuzzy and the constant is
NULL, this constant will be
understood in the way given by the DBMS.
- If FEQ is used instead of IS, the compatibility
degree between attribute and constant is compared
and not only when the attribute is equal to the constant.
References
- The most international publications about FSQL are:
- :
Galindo J., Urrutia A., Piattini M., "Fuzzy Databases: Modeling, Design and Implementation". To publish by Idea Group Publishing Hershey, USA, 2005.
- J. Galindo, J.M. Medina, O. Pons, J.C. Cubero, "A Server
for Fuzzy SQL Queries", en "Flexible Query Answering Systems", eds. T.
Andreasen, H. Christiansen and H.L. Larsen, Lecture Notes in Artificial
Intelligence (LNAI) 1495, pp. 164-174. Ed. Springer, 1998.
Abstract:
The client-server model is being used mostly in the actual
DataBase Management Systems (DBMS). However, these DBMS do not
allow either to make flexible queries to the database
or to store vague information in it.
We have developed a FSQL Server for a Fuzzy Relational Database (FRDB).
The FSQL language (Fuzzy SQL) is an extension of the SQL language that
allows us to write flexible conditions in our queries.
This Server has been developed for Oracle, following the model GEFRED,
a theoric model for FRDB that includes fuzzy attributes to store vague
information in the tables.
The FSQL Server allows us to make flexible queries about traditional
(crisp) or fuzzy attributes and we can use linguistic labels defined
on any attribute.
- J. Galindo, J.M. Medina, J.C. Cubero, M.T. García, "Relaxing the Universal Quantifier of
the Division in Fuzzy Relational Databases".
International Journal of Intelligent Systems, Vol. 16-6, pp. 713-742, 2001.
- J. Galindo, M.C. Aranda, J.L. Caro, A.Guevara, A.Aguayo, "Applying Fuzzy Databases and
FSQL to the Management of Rural Accommodation". Tourism Management, Vol. 23-6, pp. 623-629, 2002.
- Barranco C.D. , Campaña J., Medina J.M. , Pons O. (2004): "ImmoSoftWeb: a Web Based Fuzzy Application for Real Estate Management". In Lecture Notes in Computer Science Volume 3034 "Advances in Web Intelligence: Second International Atlantic Web Intelligence Conference, AWIC 2004", pp. 196-206. Springer-Verlag Heidelberg. ISSN: 0302-9743. ISBN: 3-540-22009-7.
-
More References (download and related links).
Download
- FSQL Server (only for Oracle).
- FQ, a SQL/FSQL client application (for Windows, 3.2MB):
- PhD Thesis (in spanish language): "Tratamiento de la
Imprecisión en Bases de Datos Relacionales: Extensión del Modelo y
Adaptación de los SGBD Actuales". University of Granada, 1999 (PostScript: 988KB).
- Others FSQL Clients (all in spanish language):
- Visual FSQL: Gestión Visual de Bases de Datos Difusas en ORACLE a través de Internet usando FSQL (Visual FSQL: Visual Fuzzy Database Management in ORACLE through Internet):
- Recuperación de Imágenes Usando Atributos Difusos (Image Retrieval using Fuzzy Attributes):