I know how to parse a query with jena and convert it to a query algebra. but i
don't know how to get triple patterns from the algebra and how to get query
operators from it for evaluation.
Example: i hava a query like this:
PREFIX info: <http://somewhere/peopleInfo#> PREFIX vcard:
<http://www.w3.org/2001/vcard-rdf/3.0#> SELECT ?name ?age
WHERE
{ ?person vcard:FN ?name . OPTIONAL { ?person info:age ?age . } FILTER (
!bound(?age) || ?age > 24 )
}
i convert query to a algebra:
Query q=QueryFactory.create(queryStr);
Op op = Algebra.compile(q) ;
the result is this algebra:
(project (?name ?age) (filter (|| (! (bound ?age)) (> ?age 24)) (leftjoin (bgp
(triple ?person <http://www.w3.org/2001/vcard-rdf/3.0#FN> ?name)) (bgp (triple
?person <http://somewhere/peopleInfo#age> ?age)))))
now what i want is to get operators from this algebra in a iterative manner
from bottom to top. for example : bgp 1 -> bgp 2-> leftjoin -> filter -> project
can you give me an example for doing this?