Thanks Holger, Scott, ?index tops:for (1 10) .
comes close. Actually since I need this feature for reporting only at the moment I can substitute the number generation in SPARQL with row.__rownum in BIRT. my plan originally was to generate an output similar to this simple example: http://www.1keydata.com/sql/sql-rank.html Best, Marco On Wed, Jun 3, 2009 at 12:18 PM, Holger Knublauch <[email protected]>wrote: > Hi Marco, > this goes beyond what SPARQL has been designed for. It would be doable if > SPARQL were an imperative programming language, but it's a query language. > You cannot even be sure in which order the various elements of a WHERE > clause are executed. It's therefore very difficult and "artificial" to > implement such an increment function. We would also need to store some > state, e.g. "previous iteration value" at execution time, and I don't yet > see how this could be done easily (think about multi-threading issues, > repeated execution etc). > > Having said all this, there is a property function tops:for that allows you > to do something like > > *SELECT* * > *WHERE* { > ?index tops:for (1 10) . > ... > } > > to bind ?index with all values from 1 to 10. However, this won't do what > you are looking for by itself, because it will return multiple bindings for > all combinations of result variables. Depending on the details of the where > clause in your query, you may be able to achieve what you want using > SPARQLMotion. > > Could you explain your use case so that we can brainstorm about possible > "clean" solutions? Thanks. > > Holger > > > > On Jun 3, 2009, at 6:37 AM, Marco Neumann wrote: > > Hi, > > Do we have a number generator available in the TBC SPARQL vocabulary that > allows me to prefix a result set with an incrementing number? > > Like > rank | name > -------------- > 1 | Mike > 2 | Paul > 3 | Liz > > Marco > > > > > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TopBraid Composer Users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/topbraid-composer-users?hl=en -~----------~----~----~----~------~----~------~--~---
