You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Jérôme <je...@unicaen.fr> on 2011/08/18 15:28:05 UTC

Matching string positions

Hello,

I am a new Jena/Joseki user and i would like to get matching string 
positions in order to highligth them.
Queries are LARQ queries.

Here the client side code:

         Query query = QueryFactory.create(queryString) ;
         QueryExecution qExec = QueryExecutionFactory.sparqlService(url, 
query);
         ResultSet set = qExec.execSelect();
         String xml = ResultSetFormatter.asXMLString(set) ;
         qExec.close();

I probably have to use an other way than the sparqlService method. I 
know that positions are available with Lucene, but how to recover this 
information with the Jena API ?

What is the a simple way to do that?

Thanks.

Jerome.

Re: Matching string positions

Posted by Paolo Castagna <ca...@googlemail.com>.
Jérôme wrote:
> Hello,
> 
> I am a new Jena/Joseki user and i would like to get matching string 
> positions in order to highligth them.
> Queries are LARQ queries.
> 
> Here the client side code:
> 
>         Query query = QueryFactory.create(queryString) ;
>         QueryExecution qExec = QueryExecutionFactory.sparqlService(url, 
> query);
>         ResultSet set = qExec.execSelect();
>         String xml = ResultSetFormatter.asXMLString(set) ;
>         qExec.close();
> 
> I probably have to use an other way than the sparqlService method. I 
> know that positions are available with Lucene, but how to recover this 
> information with the Jena API ?

Hi Jerome,
it is currently not possible to retrieve positions via LARQ.

I do not even know how to imagine doing this (syntactically) in
a SPARQL query, but if you or someone else have an idea on how
this might be possible we can discuss it.

> 
> What is the a simple way to do that?

One way to do it could be to use LARQ to perform a first search,
then retrieve the literal value and use Lucene, independently from
Jena, to perform the highlighting you want.

What do you think about this approach?

It's not ideal, I know... but it should be possible and easy.

Paolo

> 
> Thanks.
> 
> Jerome.