On 04/02/13 15:09, Martynas Jusevičius wrote:
Hey list,
I have queries that follow this pattern:
DESCRIBE <http://localhost> ?var
{
SELECT ?var
{
?var a ?type
}
OFFSET 0 LIMIT 20
}
They're used to query the contents of a page in one go -- that is,
combine the description of the page (<http://localhost> has some
metadata) with the descriptions of the "records" that are shown on it
(paginated).
This works fine over a local Model, but in a more realistic setup the
records are in a remote endpoint (while the page metadata is still in
the local Model). So I tried to turn the query into a federated one
simply by adding SERVICE:
DESCRIBE <http://localhost> ?var
{
SERVICE <http://remote/sparql>
{
SELECT ?var
{
?var a ?type
}
OFFSET 0 LIMIT 20
}
}
But this doesn't seem to work -- I can see the SELECT being executed
remotely, but the record descriptions are not in the result. On a
second thought, this makes sense, as decriptions would probably take
another remote query.
Can this be solved with one federated query or should I just split
them and do a local DESCRIBE <http://localhost> separately?
Yes - the DESCRIBE is fulfilled using the local dataset.
You can combine local and remote:
DESCRIBE <http://localhost> ?var
{
{ SERVICE <http://remote/sparql> .... }
UNION
{ local ?var .... }
}
What may be useful to you if you want remote information is to use a
SERVICE followed by a CONSTRUCT.
CONSTRUCT { ?var ?p ?o }
{
SERVICE <http://remote/sparql>
{
{ SELECT ?var
{
?var a ?type
}
OFFSET 0 LIMIT 20 }
?var ?p ?o
}
}
Andy