7 A Quality-enabled Spatial Integration System
143
for $x in document(road) where $x/length > 1000 and $x/NbLanes = 2
return $x
for $x in document(bridge)
return $x
for $x in document(query0), $y in document(query1) where
cross($x/geometry,$y/geometry) = true return $x
Fig. 7.8. Global execution plan for Q 0
Input
: User Query Q 0
Output
: Global Execution Plan
Algorithm :
ExecutionPlan EP
SimpleQueries SQ = ExtractSimpleQueries(Q 0 )
QueryCpt = 0
For each Q in SQ Do
Q.setId("query"+ QueryCpt)
QueryCpt++
EP.AddQuery(Q)
End For
RemoveSimpleConditions(Q 0 )
ReplaceFeatureByQueryID(Q 0 )
EP.AddQuery(Q 0 )
Fig. 7.9. Decomposition algorithm
The decomposition algorithm, illustrated in Fig. 7.9, relies mainly on three functions which are described below:
• ExtractSimpleQueries: extracts simple queries as well as their simple conditions (queries consisting in extracting features) from the user query.
• RemoveSimpleConditions: removes all the simple conditions from the user
query because they have already been treated in the simple queries.
• ReplaceFeatureByQueryID: replaces the features by the id of their corresponding simple query.
7.5.4 Obtaining a Final Execution Plan
Assuming that the GEP contains N + 1 subqueries, we rewrite each of the first N
subqueries in terms of the local schemas, the last one being used to compute the final
result. To this purpose, we adapted the approach described in [1]. For each query,
we start in computing its binding. A binding of a basic query is the set of mappings
that support (totally or partially) the feature of the query. When a source supports
all the attributes of the query (totally), we say that this query has a full-binding with
this source. The binding of the query allows query rewriting into a set of subqueries
expressed in terms of the local schemas.
143
for $x in document(road) where $x/length > 1000 and $x/NbLanes = 2
return $x
for $x in document(bridge)
return $x
for $x in document(query0), $y in document(query1) where
cross($x/geometry,$y/geometry) = true return $x
Fig. 7.8. Global execution plan for Q 0
Input
: User Query Q 0
Output
: Global Execution Plan
Algorithm :
ExecutionPlan EP
SimpleQueries SQ = ExtractSimpleQueries(Q 0 )
QueryCpt = 0
For each Q in SQ Do
Q.setId("query"+ QueryCpt)
QueryCpt++
EP.AddQuery(Q)
End For
RemoveSimpleConditions(Q 0 )
ReplaceFeatureByQueryID(Q 0 )
EP.AddQuery(Q 0 )
Fig. 7.9. Decomposition algorithm
The decomposition algorithm, illustrated in Fig. 7.9, relies mainly on three functions which are described below:
• ExtractSimpleQueries: extracts simple queries as well as their simple conditions (queries consisting in extracting features) from the user query.
• RemoveSimpleConditions: removes all the simple conditions from the user
query because they have already been treated in the simple queries.
• ReplaceFeatureByQueryID: replaces the features by the id of their corresponding simple query.
7.5.4 Obtaining a Final Execution Plan
Assuming that the GEP contains N + 1 subqueries, we rewrite each of the first N
subqueries in terms of the local schemas, the last one being used to compute the final
result. To this purpose, we adapted the approach described in [1]. For each query,
we start in computing its binding. A binding of a basic query is the set of mappings
that support (totally or partially) the feature of the query. When a source supports
all the attributes of the query (totally), we say that this query has a full-binding with
this source. The binding of the query allows query rewriting into a set of subqueries
expressed in terms of the local schemas.
