You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Lewis John Mcgibbney <le...@gmail.com> on 2013/08/05 05:17:13 UTC
Pinpointing Fuseki results stream in Eclipse
Hi,
I've been jumping in and around jena-fuseki in Eclipse; getting to know it
a 'bit' better.
Recent feedback has really helped me to move on with this.
I've found myself in a scenario where I need to:
* submit queries to an in memory dataset in Fuseki and get a results stream
* manipulate the results stream on the server side. An example of this
would be the following: say I 'know' what will be in the results stream. I
can pull out elements from the stream and use them for specific tasks. The
purpose of this is explained next.
* use individual values from the results stream as input to web service(s).
Again, it is NOT OK for me to have unknown, inconsistent, non-uniform
values within the results stream. If I 'know' what is in the results stream
then my logic for assigning the correct value as the correct input for a
particular web service works fine.
My current focus is therefore pinpointing which object holds the results
stream once a query has been submitted and the Fuseki server has done it's
magic. Right now I'm am assuming I would need to register a new Servlet to
store and manage the above workflow.
This object which stores the results stream is my priority right now. Can
anyone help me pin point it please?
Thankyou v much.
Lewis
--
*Lewis*
Re: Pinpointing Fuseki results stream in Eclipse
Posted by Andy Seaborne <an...@apache.org>.
On 05/08/13 04:39, Lewis John Mcgibbney wrote:
> The magic happens in SPARQL_Query#sendResults(HttpAction action,
> SPARQLResult result, Prologue qPrologue)
> ...
> if ( result.isResultSet() )
> ResponseResultSet.doResponseResultSet(action,
> result.getResultSet(), qPrologue) ;
>
> which eventually leads me to
>
> 94: ResponseResultSet#doResponseResultSet$(HttpAction action, ResultSet
> resultSet, Boolean booleanResult, Prologue qPrologue)
> ...
> blah blah blah
> ...
> if ( equal(serializationType, WebContent.contentTypeResultsXML) )
> sparqlXMLOutput(action, contentType, resultSet, stylesheetURL,
> booleanResult) ;
> else if ( equal(serializationType,
> WebContent.contentTypeResultsJSON) )
> jsonOutput(action, contentType, resultSet, booleanResult) ;
> else if ( equal(serializationType, WebContent.contentTypeTextPlain)
> )
> textOutput(action, contentType, resultSet, qPrologue,
> booleanResult) ;
> else if ( equal(serializationType, WebContent.contentTypeTextCSV) )
> csvOutput(action, contentType, resultSet, booleanResult) ;
> else if (equal(serializationType, WebContent.contentTypeTextTSV) )
> tsvOutput(action, contentType, resultSet, booleanResult) ;
> else
> errorBadRequest("Can't determine output serialization:
> "+serializationType) ;
>
> Right now I'm putting my bets on the resultSet above... which is
> subsequently ServletOutputStream object being the golden snitch I am
> looking for. It feeds down until I eventually I find
>
> ServletOutputStream out = action.response.getOutputStream() ;
>
> I am hoping that this out object is the one I am after.
> It would be nice if it was :0)
Probably :-)
Are you using a servlet filter to intercept the call to Fuseki code? Or
calling over the network? Or subclassing the servlet class, in which
case you can catch sendResults.
If it's the servlet filter case, then yuyr right - you need to catch the
ServletOutputStream but that will be serialized bytes.
Do you need to manipulate things server-side or could you do it client
side? Make query, get Fuseki result set, process into a new result set
and return the modified one to the application code.
Andy
> Lewis
>
>
>
>
>
> On Sun, Aug 4, 2013 at 8:17 PM, Lewis John Mcgibbney <
> lewis.mcgibbney@gmail.com> wrote:
>
>> Hi,
>> I've been jumping in and around jena-fuseki in Eclipse; getting to know it
>> a 'bit' better.
>> Recent feedback has really helped me to move on with this.
>> I've found myself in a scenario where I need to:
>> * submit queries to an in memory dataset in Fuseki and get a results stream
>> * manipulate the results stream on the server side. An example of this
>> would be the following: say I 'know' what will be in the results stream. I
>> can pull out elements from the stream and use them for specific tasks. The
>> purpose of this is explained next.
>> * use individual values from the results stream as input to web
>> service(s). Again, it is NOT OK for me to have unknown, inconsistent,
>> non-uniform values within the results stream. If I 'know' what is in the
>> results stream then my logic for assigning the correct value as the correct
>> input for a particular web service works fine.
>>
>> My current focus is therefore pinpointing which object holds the results
>> stream once a query has been submitted and the Fuseki server has done it's
>> magic. Right now I'm am assuming I would need to register a new Servlet to
>> store and manage the above workflow.
>>
>> This object which stores the results stream is my priority right now. Can
>> anyone help me pin point it please?
>>
>> Thankyou v much.
>> Lewis
>>
>> --
>> *Lewis*
>>
>
>
>
Re: Pinpointing Fuseki results stream in Eclipse
Posted by Lewis John Mcgibbney <le...@gmail.com>.
The magic happens in SPARQL_Query#sendResults(HttpAction action,
SPARQLResult result, Prologue qPrologue)
...
if ( result.isResultSet() )
ResponseResultSet.doResponseResultSet(action,
result.getResultSet(), qPrologue) ;
which eventually leads me to
94: ResponseResultSet#doResponseResultSet$(HttpAction action, ResultSet
resultSet, Boolean booleanResult, Prologue qPrologue)
...
blah blah blah
...
if ( equal(serializationType, WebContent.contentTypeResultsXML) )
sparqlXMLOutput(action, contentType, resultSet, stylesheetURL,
booleanResult) ;
else if ( equal(serializationType,
WebContent.contentTypeResultsJSON) )
jsonOutput(action, contentType, resultSet, booleanResult) ;
else if ( equal(serializationType, WebContent.contentTypeTextPlain)
)
textOutput(action, contentType, resultSet, qPrologue,
booleanResult) ;
else if ( equal(serializationType, WebContent.contentTypeTextCSV) )
csvOutput(action, contentType, resultSet, booleanResult) ;
else if (equal(serializationType, WebContent.contentTypeTextTSV) )
tsvOutput(action, contentType, resultSet, booleanResult) ;
else
errorBadRequest("Can't determine output serialization:
"+serializationType) ;
Right now I'm putting my bets on the resultSet above... which is
subsequently ServletOutputStream object being the golden snitch I am
looking for. It feeds down until I eventually I find
ServletOutputStream out = action.response.getOutputStream() ;
I am hoping that this out object is the one I am after.
It would be nice if it was :0)
Lewis
On Sun, Aug 4, 2013 at 8:17 PM, Lewis John Mcgibbney <
lewis.mcgibbney@gmail.com> wrote:
> Hi,
> I've been jumping in and around jena-fuseki in Eclipse; getting to know it
> a 'bit' better.
> Recent feedback has really helped me to move on with this.
> I've found myself in a scenario where I need to:
> * submit queries to an in memory dataset in Fuseki and get a results stream
> * manipulate the results stream on the server side. An example of this
> would be the following: say I 'know' what will be in the results stream. I
> can pull out elements from the stream and use them for specific tasks. The
> purpose of this is explained next.
> * use individual values from the results stream as input to web
> service(s). Again, it is NOT OK for me to have unknown, inconsistent,
> non-uniform values within the results stream. If I 'know' what is in the
> results stream then my logic for assigning the correct value as the correct
> input for a particular web service works fine.
>
> My current focus is therefore pinpointing which object holds the results
> stream once a query has been submitted and the Fuseki server has done it's
> magic. Right now I'm am assuming I would need to register a new Servlet to
> store and manage the above workflow.
>
> This object which stores the results stream is my priority right now. Can
> anyone help me pin point it please?
>
> Thankyou v much.
> Lewis
>
> --
> *Lewis*
>
--
*Lewis*