Hi everybody,

I would like to know if there is a way (a function?) to specify row numbers
in a Sparql result.

On a given RDF graph :

prefix ex: <http://example.com/>

ex:idA ex:name "product A" ;
ex:storedTime "2014-08-*11*T10:00:00.000Z"^^xsd:dateTime .

ex:idB ex:name "product B" ;
ex:storedTime "2014-08-*12*T10:00:00.000Z"^^xsd:dateTime .

ex:idC ex:name "product C" ;
ex:storedTime "2014-08-*10*T10:00:00.000Z"^^xsd:dateTime .


I want to obtain an index (when ordering on other variables) integrated in
results :

-----------------------------------
| index | productId | name        |
===================================
|   1   | ex:idC    | "product C" |
|   2   | ex:idA    | "product A" |
|   3   | ex:idB    | "product B" |
-----------------------------------

Is there a rownum() function or something to do that?

SELECT (row_number() as ?index) ?productId ?name
WHERE {

?productId ex:name ?name ;
ex:storedTime ?storedTime .

}
ORDER BY ASC(?storedTime)

Until now I searched on the web (and
http://jena.apache.org/documentation/query/library-function.html ;
http://www.w3.org/TR/2010/WD-sparql11-query-20100126/#aggregateFunctions)
without success.

Thank you,
Ioan

Reply via email to