I don't believe this is possible in ITQL - I'm less sure about SPARQL but I
can't see anything useful there.
 
Is it not possible for you to number your results outside of your query
results - eg in whatever is processing those results?  For instance if your
results were formatted in XML you could have a stylesheet that used the
XPath position() function to do this I think.
 
(note that it is possible to ensure consistency in the order of the result
set by using an ITQL "order by" clause; and you can "page" through result
sets using the "limit" and "offset" clauses - not sure if that's useful to
you or not)
 
Steve

-----Original Message-----
From: Stephen Keegan [mailto:keega...@tcd.ie] 
Sent: 28 July 2011 09:41
To: fedora-commons-users@lists.sourceforge.net
Subject: [fcrepo-user] Returning row position in ITQL (or SparQL) query


Hi, 

I have an ITQL issue that someone might be able to help me with. I'm running
a query like this:


select $obj $memberTitle $modified  from <#ri>
where $obj <fedora-model:hasModel>  <info:fedora/dris:folder=775>
and    $obj <fedora-view:lastModifiedDate> $modified
and    $obj                        <dc:title>                   $memberTitle
order by $obj


This returns results like this:


"obj","memberTitle","modified"

info:fedora/dris:OLS-CARI-ROB_0000,,2011-06-30T18:57:17.987Z

info:fedora/dris:OLS-CARI-ROB_0001,Reformation or the Wonderful Effects of
Proclamation!!!,2011-06-30T18:57:20.844Z

info:fedora/dris:OLS-CARI-ROB_0002,End of the Irish Invasion:_or_The
Destruction of the French Armada,2011-06-30T18:57:23.692Z

info:fedora/dris:OLS-CARI-ROB_0003,Revenue Officers nabbing a
smuggler,2011-06-30T18:57:26.596Z

info:fedora/dris:OLS-CARI-ROB_0004,Pity the Sorrows of a poor old
man,2011-06-30T18:57:29.536Z

info:fedora/dris:OLS-CARI-ROB_0005,The Irish Howl or the Catholics in
Fitz!,2011-06-30T18:57:32.4Z
....
....



However, I would like to get a counter to indicate the row number so that
the results would look something like this: 




"obj","memberTitle","modified","rowcounter"

info:fedora/dris:OLS-CARI-ROB_0000,,2011-06-30T18:57:17.987Z, 0

info:fedora/dris:OLS-CARI-ROB_0001,Reformation or the Wonderful Effects of
Proclamation!!!,2011-06-30T18:57:20.844Z, 1

info:fedora/dris:OLS-CARI-ROB_0002,End of the Irish Invasion:_or_The
Destruction of the French Armada,2011-06-30T18:57:23.692Z, 2

info:fedora/dris:OLS-CARI-ROB_0003,Revenue Officers nabbing a
smuggler,2011-06-30T18:57:26.596Z, 3

info:fedora/dris:OLS-CARI-ROB_0004,Pity the Sorrows of a poor old
man,2011-06-30T18:57:29.536Z, 4

info:fedora/dris:OLS-CARI-ROB_0005,The Irish Howl or the Catholics in
Fitz!,2011-06-30T18:57:32.4Z, 5



Basically, I'd like to achieve something like this
<http://databases.aspfaq.com/database/how-do-i-return-row-numbers-with-my-qu
ery.html> . Does anybody how this might be done in ITQL? (or SparQL)


Stephen.

------------------------------------------------------------------------------
Got Input?   Slashdot Needs You.
Take our quick survey online.  Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey
_______________________________________________
Fedora-commons-users mailing list
Fedora-commons-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fedora-commons-users

Reply via email to