142
Omar Boucelma, Mehdi Essid, and Yassine Lassoued
Spatial operators are applied to sequences. A sample of operators are described
below:
• operators that return numeric values:
area, length : sequence = (node) → numeric value where node is a GML data
node.
• operators that return GML values:
convexhull, centroid : sequence = (node) → node
• operators that return Boolean values:
equal, within, touches : sequence = (node, node) → boolean
Each result of a GQuery expression is part of the data model. The input and
output of every query or subexpression within a query is an instance of the data
model. GQuery is closed under this query data model. When computing area(node),
if node is a Polygon, the function returns a numeric value, otherwise it raises an
error. In both cases, results are instances of the data model. Spatial operators can
be nested.
7.5.3 Obtaining a Global Execution Plan
The GEP is obtained in decomposing the user query into a set of ESQs expressed
in terms of the global schema. Actually, data sources are queried through a WFS
interface. Although providing easy access to any geographical repository, WFS is
unable to handle complex queries and does not provide support for data integration.
Thus execution plans are a combination (join, union, and operation) of elementary
queries, each of them being posed against a single feature.
As an example, let us consider query of Fig. 7.7 (denoted Q 0 in the sequel) which
consists in extracting all two-lane roads crossing bridges and having a length up to
1000 meters.
As we can see, this query involves two features (bridge and road) and three conditions. The condition (cross(x/geometry,y/geometry)) is a complex one because it
involves two attributes from two different features. Consequently, Q 0 is split into
three subqueries as illustrated in Fig. 7.8. The first subquery consists in extracting all
two-lane roads having length up to 1000 metres. The second one consists in extracting all the bridges and the last one consists in joining the first query and the second
one with the condition cross(x/geometry,y/geometry) = true.
The execution plan is represented as an XML document, where nodes describe
queries: a priority attribute indicates the query execution order. For example, query0
and query1 are executed first, followed by query2, and so on.
for $x in document(bridge), $y in document(road)
where cross( $x/geometry, $y/geometry) = true
and $x/length > 1000 and $x/NbLanes = 2 return $x
Fig. 7.7. User-query example
Omar Boucelma, Mehdi Essid, and Yassine Lassoued
Spatial operators are applied to sequences. A sample of operators are described
below:
• operators that return numeric values:
area, length : sequence = (node) → numeric value where node is a GML data
node.
• operators that return GML values:
convexhull, centroid : sequence = (node) → node
• operators that return Boolean values:
equal, within, touches : sequence = (node, node) → boolean
Each result of a GQuery expression is part of the data model. The input and
output of every query or subexpression within a query is an instance of the data
model. GQuery is closed under this query data model. When computing area(node),
if node is a Polygon, the function returns a numeric value, otherwise it raises an
error. In both cases, results are instances of the data model. Spatial operators can
be nested.
7.5.3 Obtaining a Global Execution Plan
The GEP is obtained in decomposing the user query into a set of ESQs expressed
in terms of the global schema. Actually, data sources are queried through a WFS
interface. Although providing easy access to any geographical repository, WFS is
unable to handle complex queries and does not provide support for data integration.
Thus execution plans are a combination (join, union, and operation) of elementary
queries, each of them being posed against a single feature.
As an example, let us consider query of Fig. 7.7 (denoted Q 0 in the sequel) which
consists in extracting all two-lane roads crossing bridges and having a length up to
1000 meters.
As we can see, this query involves two features (bridge and road) and three conditions. The condition (cross(x/geometry,y/geometry)) is a complex one because it
involves two attributes from two different features. Consequently, Q 0 is split into
three subqueries as illustrated in Fig. 7.8. The first subquery consists in extracting all
two-lane roads having length up to 1000 metres. The second one consists in extracting all the bridges and the last one consists in joining the first query and the second
one with the condition cross(x/geometry,y/geometry) = true.
The execution plan is represented as an XML document, where nodes describe
queries: a priority attribute indicates the query execution order. For example, query0
and query1 are executed first, followed by query2, and so on.
for $x in document(bridge), $y in document(road)
where cross( $x/geometry, $y/geometry) = true
and $x/length > 1000 and $x/NbLanes = 2 return $x
Fig. 7.7. User-query example
