Federated query with local reasoning only

Hi,
I would like to run a federated query where reasoning happens only on the local db.

I start with sth like that:

SELECT * WHERE {
?s :someRelation ?o .
SERVICE <someExternalSprqlEndpoint> {
?o :someOtherRelation ?p . }
}

it works nicely but only to the point where the triple <?s :someRelation ?o> is part of my local graph and no reasoning is enabled. However, in cases where <?s :someRelation ?o> is a conclusion of some rule deployed locally and when reasoning is enabled for the query Stardog starts to reason over someExternalSprqlEndpoint and fails in case the query on the service is a bit more complicated.

In fact what i would like to achive is that stardog reasons only locally and uses the results found for ?o to query the external sparql end point.

It tried to run the query with no reasoning (but enabling it directly by a service call), but then stardog returns no results.

SELECT * WHERE {
SERVICE <http://admin:admin@localhost:5820/mdDB/query/reasoning> 
{?s :someRelation ?o .}
SERVICE <someExternalSprqlEndpoint> {
?o :someOtherRelation ?p . }
}

Any hints?

You can try using the #pragma.reasoning.off query hint Inference Engine | Stardog Documentation Latest . This may require and extra {} around the service query.

Alternatively you can disable virtual graph reasoning. (this will disable reasoning for virtual graphs and service queries)

Thanks! I used #pragma.reasoning.off and:

  • no error returned so it really looks like service query runs w/o reasoning
  • unfortunately, the query returns the empty set -> similar result as in my approach.

Turning off the virual graph reasoning did the trick. Sufficient for my PoC but it would be nice to have a solution which does not require global change for the whole db.

Please paste the query with the hint and the query plan (the output of stardog query explain or by pressing Show Plan in Studio, after switching it to the text form).

Cheers,
Pavel

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.