On 08/01/14 19:53, Tim Harsch wrote:
Hi,
I'm trying to write a transformer on a spatial property function. For example:
The following algbra
(propfunc <http://jena.apache.org/spatial#withinBox>
?s (37.6315270872214 -122.52347356152336 37.81401629628255
-122.35095387768547)
(table unit)
)
Comes in to:
public Op transform(OpPropFunc opPropFunc, Op subOp)
as
(propfunc <http://jena.apache.org/spatial#withinBox>
?s (37.6315270872214 -122.52347356152336 37.81401629628255
-122.35095387768547)
(table unit)
)
for opPropFunc
and
(table unit)
for subOp
I don't really understand why some transforms have a subOp and some don't
It's not specific to property functions. They appear all over the place
but are often trimmed as the last step of algebra generation and it's
called "simplifcation" in the spec.
The original query was something like:
{ ?s spatial:withinBox
( 37.6315270872214 -122.52347356152336
37.81401629628255 -122.35095387768547 )
... more ...
}
A propfunc is a function to be called on the output of graph pattern
matching i.e. an iterator over some earlier results in the query.
There is always a graph pattern.
When you have { ... }, the SPARQL spec says to start with the empty
pattern. Sometimes, it can't be removed as it's necessary. The empty
graph pattern - a BGP of zero triple patterns - appears when no pattern.
{ FILTER(true) }
becomes
(filter true
(table unit))
{ OPTIONAL { ?s ?p ?o } }
becomes
(leftjoin
(table unit)
(bgp (triple ?s ?p ?o)))
It evaluates to a table of one row and no columns. So there is a table
of one row and no columns. That is the join identity in SPARQL.
(table unit)
forall X . I join X = X
so removal is possible when it leaves a pattern behind otherwise it remains.
Andy