Fuzzy databases manage imprecision in its schema and offer tools for flexible querying. A true standard does not exist. Relational databases are usually the base for the implementation of fuzzy databases. In this paper we propose a general model to represent and querying fuzzy types in any relational database. The model is implemented within the Hibernate Framework.
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Generalised fuzzy types and querying.Implementation within the Hibernate Framework
1. Generalised fuzzy types and Contents
Motivation
querying. Context
Proposal
Example
Implementation within the Comparison
Conclusions and . . .
Hibernate Framework. Home Page
Title Page
Jos´ Enrique Pons
e Olga Pons Capote
Ignacio Blanco Medina
Department of Computer Science and Artificial Intelligence
University of Granada, Spain
{jpons,opc,iblanco}@decsai.ugr.es Page 1 of 26
October 27, 2011 Go Back
Full Screen
Close
Quit
2. Contents
Motivation
1. Contents Context
Proposal
Example
The structure of the presentation is: Comparison
Conclusions and . . .
• Motivation. Home Page
• Context: Title Page
– Fuzzy relational databases.
– Hibernate Framework.
Page 2 of 26
• Proposal.
Go Back
• Comparison.
Full Screen
• Conclusions and future work. Close
Quit
3. Contents
Motivation
Context
2. Motivation Proposal
Example
Comparison
• A true standard for fuzzy databases does not ex- Conclusions and . . .
Home Page
ist.
Title Page
• Relational databases are usually the base for the
implementation of fuzzy databases.
• General model to represent and querying fuzzy
Page 3 of 26
types in any relational database.
Go Back
• Implementation within the Hibernate Frame-
Full Screen
work.
Close
Quit
4. Contents
Motivation
Context
Proposal
Example
3. Context Comparison
Conclusions and . . .
• 3.1 Fuzzy relational databases (FBD): Home Page
Title Page
– Representation: fuzzy data types.
– Querying: flexible querying.
• 3.2 Hibernate Framework:
Page 4 of 26
– Architecture. Go Back
– Querying in the Hibernate Framework Full Screen
Close
Quit
5. Contents
3.1. Fuzzy relational databases Motivation
Context
Proposal
Two main features: Example
Comparison
• Fuzzy representation Conclusions and . . .
”The restaurant X in the database is cheap in Home Page
average.” Title Page
”The restaurant X in the database is a ham-
burguer restaurant.”
• Flexible querying: Page 5 of 26
”The user wants to obtain a list with cheap
restaurants.” Go Back
Full Screen
Close
Quit
6. 3.1.1. Fuzzy data types
Two main types:
Contents
• Ordered underlying domain: Motivation
possibility
Context
Cheap Middle-price Expensive
1 Proposal
Example
Comparison
Conclusions and . . .
Home Page
Price
0
16 18 24 26
Title Page
This data type may be represented as a trapezoid
in the form: [α, β, γ, δ].
E.g. Middle-price = [16, 18, 24, 26]
Page 6 of 26
• Non-ordered underlying domain:
Fast food Hamburger Chinese Go Back
Fast food 1 0.8 0.6 Full Screen
Hamburger 0.8 1 0.2 Close
Chinese 0.6 0.2 1 Quit
7. 3.1.2. Flexible Querying
The user may query with vagueness in the database: Contents
”The user want to obtain a list of cheap restau- Motivation
Context
rants.” Proposal
Example
ID Name AVG Quality Comparison
Conclusions and . . .
001 Amadeus [15,10,20,5] 5 Home Page
002 Atlantis [11,5,17,6] 3 Title Page
003 Cafe Theatre [20,10,30,10] 2
004 De Graslei [23,18,28,5] 5
005 Pakhuis [13,11,15,2] 3
006 De 3 Biggetjes [45,25,65,20] 4 Page 7 of 26
possibility
Cheap Middle-price Expensive
1
Go Back
Full Screen
Price Close
0
16 18 24 26
Quit
8. Contents
Motivation
Context
Proposal
Example
The selected restaurants are: Comparison
Conclusions and . . .
Home Page
ID Name AVG Quality
001 Amadeus [15,10,20,5] 5 Title Page
002 Atlantis [11,5,17,6] 3
005 Pakhuis [13,11,15,2] 3
Page 8 of 26
Go Back
Full Screen
Close
Quit
9. Operators for fuzzy querying:
Contents
Possibility Necessity Possibly / Necessarily Motivation
FEQ NFEQ Fuzzy = Context
Proposal
FGT NFGT Fuzzy > Example
FGEQ NFGEQ Fuzzy ≥ Comparison
Conclusions and . . .
FLT NFLT Fuzzy.< Home Page
FLEQ NFLEQ Fuzzy ≤
Title Page
MGT NMGT Much >
MLT NMLT Much <
F EQ(p1, p2) = sup min(πp1(d), πp2(d)) (1)
d∈U Page 9 of 26
Where U is the underlying domain, p1, p2 are two Go Back
values of a given fuzzy type (e.g. fuzzy type 2) and Full Screen
πp1(d), πp2(d) are the associated possibility distribu- Close
tions.
Quit
10. Contents
Motivation
Context
Context Proposal
Example
• 3.1 Fuzzy relational databases (FBD): Comparison
Conclusions and . . .
– Representation: fuzzy data types. Home Page
– Querying: flexible querying. Title Page
• 3.2 Hibernate Framework:
– Architecture.
– Querying in the Hibernate Framework Page 10 of 26
Go Back
Full Screen
Close
Quit
11. Contents
Motivation
Context
3.2. Hibernate Framework Proposal
Example
The Hibernate Framework is a collection of open Comparison
Conclusions and . . .
source projects that enable developers to make Home Page
object-relational mapping. Features: Title Page
• Database independent by means of dialects.
• HQL: an object-oriented query language.
• Open source. Page 11 of 26
Go Back
Full Screen
Close
Quit
12. 3.2.1. Architecture Contents
Motivation
An application working with Hibernate has 3 layers: Context
Proposal
1. Application layer: CRUD (CReate,Update Example
Comparison
and Delete) operations: Conclusions and . . .
(a) Persistent Objects: A current database state. Home Page
(b) Transient Objects: These objects do not rep- Title Page
resent a current database state.
2. Hibernate layer: An abstraction layer be-
tween the DBMS and the application. Page 12 of 26
3. The database: The running DBMS: MySQL, Go Back
PostgreSQL, Oracle...etc. Full Screen
Close
Quit
13. Contents
Hibernate Architecture: Motivation
Context
Proposal
Example
Application
Comparison
Conclusions and . . .
Persistent Objects
Home Page
HIBERNATE
Title Page
hibernate.
XML mapping
properties
Page 13 of 26
Database
Go Back
Full Screen
Close
Quit
14. 3.2.2. Querying in Hibernate
1. Query by criteria: Contents
createCriteria(Person.class). Motivation
Add(Restrictions.eq(”login”,”lmmn”)); Context
Proposal
Example
Comparison
2. Query by example: Conclusions and . . .
Person p.login = ”lmmn”; Home Page
Title Page
3. HQL:
Select p from Person p where p.login =
”lmmn”; Page 14 of 26
Go Back
4. SQL: Full Screen
Select * from Person as p where p.login = Close
’lmmn’;
Quit
15. Contents
Motivation
Context
Proposal
Example
Comparison
4. Proposal Conclusions and . . .
Home Page
• Architecture for the general framework for: Title Page
– Fuzzy representation.
– Fuzzy querying.
Page 15 of 26
• Implementation within the Hibernate frame-
Go Back
work.
Full Screen
Close
Quit
16. Contents
Motivation
Context
4.1. Fuzzy Representation Proposal
Example
Conditions for portability: Comparison
Conclusions and . . .
1. The SQL standard is the interface. Home Page
Title Page
2. The fuzzy types are represented in the database
by basic SQL types.
3. The meta-data for managing properly the ex-
tended types relies outside the database catalog. Page 16 of 26
Go Back
Full Screen
Close
Quit
17. 4.1.1. Architecture for the general model
Contents
The architecture for a generalized object-oriented Motivation
model needs the following elements: Context
Proposal
Example
Object-Oriented Layer. Comparison
O1 ON (OORL) Conclusions and . . .
Home Page
Object-Oriented to Relational.
(OO2RL). Title Page
R1 RN Relational Layer.
(RRL)
Page 17 of 26
Conversion Layer. (CL)
Go Back
Full Screen
MySQL PostgreSQL Oracle
Close
Quit
18. 4.1.2. Implementation Contents
Motivation
The model has the following layers: Context
Proposal
Example
Application Comparison
Conclusions and . . .
Fuzzy Data Types Fuzzy Domains Fuzzy Representation Home Page
Constraint
Values Labels Constraint
Validator
Layer (OORL) F
S Title Page
Fuzzy Data Fuzzy Domain Q
Types Adaptor Adaptor Adaptation L
Layer (OO2RRL)
Type 2 Type 3 & (RRL)
Hibernate Core Page 18 of 26
Conversion
Go Back
Layer (CL)
Database
Full Screen
Close
Quit
19. 4.2. Fuzzy Querying
The model uses the following elements:
Contents
• Declarative implementation for each fuzzy Motivation
Context
operator. This implementation should be done Proposal
in the SQL language. Example
Comparison
• Abstract syntax tree (AST) representa- Conclusions and . . .
Home Page
tion for the query. These representation allows
a customization process done by the conversion Title Page
layer (CL).
• Conversion Layer: This layer customizes the
AST for the running database. Page 19 of 26
The implementation of the fuzzy querying is done by Go Back
modifying the HQL language. The fuzzy operators Full Screen
are implemented in a declarative way in the SQL Close
language. Quit
20. Query translation:
Contents
Select
Motivation
r
from
Context
Proposal
Restaurant where Example
Comparison
FEQ
Conclusions and . . .
r.priceAvg [15,10,20,5]
Home Page
Title Page
• The framework builds an abstract syntax tree
(AST) once the query passed lexical and syntac-
tical analysis.
• The AST represents tokens as nodes. The se- Page 20 of 26
mantic analyzer renders the tree in the into SQL Go Back
sentences. Then the dialect customizes the SQL Full Screen
sentence. Close
Quit
21. Example:
The user wants restaurants that have an average
price around 15 euro: Contents
Motivation
Context
SELECT r FROM Restaurant r WHERE Proposal
Example
r.PriceAvg FEQ [15, 10, 20, 5]; Comparison
Conclusions and . . .
The FEQ node is rendered to its implementation in Home Page
SQL: Title Page
SELECT * FROM Restaurant as r WHERE
1 < CASE WHEN (r.priceAvg.gamma <= beta2)
Page 21 of 26
OR (r.priceAvg.beta >= gamma2) THEN 0
WHEN (r.priceAvg.alpha = alpha2) THEN 1 Go Back
WHEN (r.priceAvg.gamma > beta2) AND (r.priceAvg.alpha < alpha2) Full Screen
THEN (r.priceAvg.gamma - beta2) / ( r.priceAvg.delta - delta2 )
Close
ELSE (gamma2 - r.priceAvg.beta) / ( r.priceAvg.delta + delta2 );
Quit
22. Contents
5. Comparison Motivation
Context
Proposal
Portability among the proposals: Example
Comparison
Conclusions and . . .
• FSQL server: The reference implementation of the FIRST inter- Home Page
face on the GEFRED model. The first implementation works with
Oracle database, although there is an implementation in Post- Title Page
greSQL.
• SQLfi: The implementation for the SQLf language.
• FDBLL: Fuzzy database language and library . A fuzzy SQL
Page 22 of 26
implementation in C language over a relational DBMS.
Go Back
• PSQL: An extension of the FSQL model. The main features are
the use of priority fuzzy logic and the portability. Full Screen
• Hibernate FSQL: The proposed implementation. Close
Quit
23. Comparison table:
Fuzzy DB Catalog Interface Query language Query Processor
FSQL Inside DB. FSQL client FSQL Procedural.
Contents
SQLfi Inside DB. Client app. SQLf Procedural.
FDBLL Inside DB. Client app. Fuzzy SQL Procedural. Motivation
PFSQL Inside DB. JDBC client PFSQL Procedural. Context
H. FSQL Outside DB. Entity Classes Fuzzy HQL Declarative. Proposal
Example
The main differences are:
Comparison
• The meta data for the fuzzy types are not stored in the database, therefore, Conclusions and . . .
to change the running database is as easy as changing some parameters in Home Page
the Hibernate configuration file.
Title Page
• There is no need to create or modify fuzzy meta tables in the DBMS catalog.
Page 23 of 26
Go Back
Full Screen
Close
Quit
24. Contents
Motivation
Context
6. Conclusions and Future Proposal
Example
Work Comparison
Conclusions and . . .
Home Page
• We introduced a general model for the represen- Title Page
tation of (fuzzy) types and for fuzzy querying.
• The implementation within Hibernate is based
on the portability.
Page 24 of 26
• The drawback for the portability is the depen- Go Back
dency between the application and the frame-
Full Screen
work.
Close
Quit
25. Contents
Motivation
Future work: Context
Proposal
• Fuzzy querying: bipolar specification in the Example
Comparison
queries Conclusions and . . .
• Practical applications with the proposed frame- Home Page
work. Title Page
• Fuzzy temporal representation: representation
for Fuzzy Validity Periods and implementation
of temporal comparisons within the Allen’s rela- Page 25 of 26
tions. Go Back
Full Screen
Close
Quit
26. Contents
Motivation
Context
Proposal
Thank you! Example
Comparison
Conclusions and . . .
Questions? Home Page
Title Page
Contact:
jpons@decsai.ugr.es
http://decsai.ugr.es/˜ jpons
Page 26 of 26
Go Back
Full Screen
Close
Quit