Hi Gary,
Yes, I think you are starting to see what I am looking for. Let me
put it in a different SPARQL statement with a nested select query:
construct {?s :comesafter previous(?s)}
where {
{select ?s ?last
where {
?s rdf:type :Person .
?s :lastName ?lastname .
BIND(last(?s) AS ?last)
} order by asc(?lastname)
}
}
- Erich
On 10/19/12 8:39 AM, Gary King wrote:
Hi Eric,
I agree with much of what you are saying but I think the important point is that
"Construct statements make a graphs of triples". Graphs don't have an order. If
you imagine that the CONSTRUCT pipeline is
SELECT a set of bindings (which could be ordered)
==> send these to the CONSTRUCT template to be converted into a graph
any ordering would be immediately lost in the second step.
OTOH, I can see where you might want to be able to use information in the
SELECTed results in the template. If SPARQL had a SEQUENCE function which
returned, for example, the next xsd:int starting at 0, you could do something
like:
CONSTRUCT {
?a ex:foo ?b .
?a ex:solutionNumber ?seq .
} WHERE {
?a ex:bar ?b .
BIND(SEQUENCE() AS ?seq)
} ORDER BY ?b
Is this the sort of thing you'd be interested in? I can certainly imagine that
it would be handy.
On Oct 18, 2012, at 6:45 PM, Erich Bremer <[email protected]> wrote:
Hi Gary,
Construct statements make a graphs of triples representing information.
Construct statements can be used to manipulate, subset, and create new data
derived from existing data. Temporal and sequential information being
important things in this world, it would make perfect sense to be able to do a
ORDER BY on a construct statement so that connecting triples can be generated
to make linked lists of ordered information. The problem is that there is no
way to reference the prior/next solution of the where clause in the construct
statement to create the appropriate triple pattern. Triple/quad stores do
order information in that triples/quads are indexed by their SPOG components to
allow for faster processing of graph patterns. Although what I am looking for
could be achieved in code, it would be beneficial to add a SPARQL feature
allowing the referencing of a prior/next solution. The use cases exist and I
don't see it being particularly difficult to implement -imho. - Erich
Erich Bremer
http://www.ebremer.com
On 10/17/12 10:22 AM, Gary King wrote:
Hi Erich,
There doesn't seem to be anyway to create a SPARQL construct statement like the
following:
I believe that the reasoning is that CONSTRUCT makes a _set_ of triples and
sets don't have an order. I.e., a triple-store is an unordered collection and
that it what CONSTRUCT constructs :-).
but I did not get anything that would work or seem remotely efficient. If this
is the case, why have order by in a construct statement at all if one cannot
capture this information as triples?
The ORDER clause in your example is essentially a no-op. Obviously, however, it
would be important if you also had a LIMIT.
HTH,
--
Gary Warren King, metabang.com
Cell: (413) 559 8738
Fax: (206) 338-4052
gwkkwg on Skype * garethsan on AIM * gwking on twitter
--
Gary Warren King, metabang.com
Cell: (413) 559 8738
Fax: (206) 338-4052
gwkkwg on Skype * garethsan on AIM * gwking on twitter