On 18/02/14 11:12, Ankur Padia wrote:
Hi,

     Consider the following example.

I have a querystring = "select ?customerName where {?customerName
ns:purchased "AndroidPhone"^^xsd:String}"

Query = QueryFactory.create(queryString);
qexec = QueryExecutionFactory.create(queryString, model)
     // assume model is defined previously

*resultSet = qexec.execSelect();*

I'm agree with Rob - this is not an example of why you want to change something and what constraints your operating under.

As a result of execution, answer will be stored in resultSet. Question that
I am trying to answer is, after calling execSelect() function (which means
the given query graph or query algebra would be generated and is going to
be executed against dataset to fetch answer). Is it possible to change the
query. i.e say "customerName" is to "customer" (before generation of query
algebra or query graph) and then allow engine to generate query algebra for
the same and let it get executed.

- Ankur Padia.


Variables in SPARQL don't correspond to column names like they do in SQL. You can:

+ Change the query string
+ Change the query object
+ Use "select (?customerName AS ?customer) where ..."
+ Use the suggestion of ResultSet wrapper
+ Modify the execution itself

but it all comes down to what you're trying to achieve and why.

What's wrong with changing the query before or after parsing? The results? The code processing the result set?

A lot of this in the documentation and javadoc, including in links I gave you.

        Andy









On Tue, Feb 18, 2014 at 4:24 PM, Andy Seaborne <[email protected]> wrote:

On 18/02/14 10:02, Ankur Padia wrote:

Hello everyone,


What are you trying to do? A concrete example would help.

       I am new to ARQ (SPARQL Engine) of Jena. I wanted to know is it
possible to manipulate the subject or object part of the triple after
calling execute function (e.g. execSelect) and before getting result.


If you just want to modify the results, then write a ResultSet
implementation that takes the underlying one and rewrites the part of
result row each time.

You could intercept the execution of the query either at the algebra or
evaluation changes

http://jena.apache.org/documentation/query/algebra.html
http://jena.apache.org/documentation/query/arq-query-eval.html

Depending on what you are trying to do, that may be a somewhat complicated
way to go about it.

         Andy

  Moreover, is there any documentation that describes query life cycle i.e
form the query string how each part of the query is handled.

Thanking you, in advance.

- Ankur Padia.





Reply via email to