If you wish to fulfill the DESCRIBE using a remote endpoint then you would
need to create a custom DescribeHandler and DescribeHandlerFactory
implementations and register them with the DescribeHandlerRegistry.add()
method

You can probably just start with a copy of the standard
DescribeBNodeClosure implementation and change it slightly to execute the
queries to fulfill the DESCRIBE remotely.  Remember that QuerySolutionMap
isn't supported for remote queries AFAIK so you will need to use
ParameterizedSparqlString or similar to inject the constants into the
query.

Hope this helps,

Rob



On 2/4/13 5:39 PM, "Andy Seaborne" <[email protected]> wrote:

>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
>

Reply via email to