Well my usual use case is pagination, with the results sorted per page
by some variable. So my query is usually like this:
DESCRIBE ?thing
{
SELECT ?thing
{
?thing dct:title ?title
}
ORDER BY ?title
LIMIT 20
OFFSET 20
}
In this case we retrieve the second page (assuming 20 per page) of
resources ordered by title. But since the ordering is lost in Model, I
sort again when I'm transforming RDF/XML to XHTML, smth like this:
<xsl:template match="rdf:RDF">
<div>
<xsl:apply-templates> <!-- this will match rdf:Descriptions -->
<xsl:sort select="dct:title"/>
</xsl:apply-templates>
</div>
</xsl:tempate>
Notice <xsl:sort> with dct:title.
If this seems useful to you, check our Graphity Client on
http://graphity.org which has quite a few predefined XSLT templates
like this.
Martynas
graphityhq.com
On Thu, Feb 27, 2014 at 2:47 PM, mark <[email protected]> wrote:
> Hello Martynas
>
> many thanks for the swift response.
>
> When you say:
>> You can do post-processing to sort them the way you want
>
> are there tools to help me with this within fuseki and jena, or am I
> going to have to write my own sorting implementation on the output
> stream?
>
> thank you
> mark
>
> On Thu, 27 Feb 2014 14:34:49 +0100
> Martynas Jusevičius <[email protected]> wrote:
>
>> Mark,
>>
>> if you are using DESCRIBE or CONSTRUCT queries then the result you get
>> is a Model. And a model is a set of statements which is not ordered.
>> You can do post-processing to sort them the way you want, e.g. when
>> you are presenting data to the user.
>>
>> Martynas
>>
>> On Thu, Feb 27, 2014 at 2:29 PM, mark <[email protected]> wrote:
>> > Hello
>> >
>> > SPARQL and fuseki support results ordering using the 'order by'
>> > statements.
>> >
>> > Fuseki implement the ordering of results for SELECT queries
>> > in exactly the way I expect.
>> >
>> > However, if I put the same WHERE clause into a CONSTRUCT query
>> > (output="text") the results I get back are not ordered in a way I
>> > expect at all.
>> >
>> > The results appear to be consistently ordered for identical tdb
>> > content but any change to the tdb appears to lead to changes in
>> > ordering of the .ttl output.
>> >
>> > I do not see how this may be controlled or managed. I tripped over
>> > this, it came as something of a surprise to me.
>> >
>> > Is there a way to control the ordering of output via CONSTRUCT so
>> > that it is handled in the same way as for SELECT?
>> >
>> > This would be a very useful feature for me.
>> >
>> > many thanks
>> >
>> > mark
>