Alex W
Alex W

Reputation: 3373

Example of using default-graph-uri query parameter in MarkLogic Rest API

According to the document here, it is possible to use named graph as a query parameter. However, I am having problem getting it to work. I am wondering if anyone has a working example using one or more named graphs for the query. I have tried the following without success,

http://localhost:9001/v1/graphs/sparql?default-graph-uri="<http://www.my.org/concept>"&query=select * where {?s ?p ?o FILTER ( ?s = <http://www.my.org/concept/concept_data%23WXYX_00000> ) }

The request returns empty. Without the default-graph-uri parameter, the request returns data. The following query returns data in the query console as well as using the REST api:

select * 
FROM <http://www.my.org/concept>
where 
{?s ?p ?o 
 FILTER ( ?s = <http://www.my.org/concept/concept_data#WXYZ_00000> )}

This test uses only one named graph but I would like to be able to use multiple default graphs.

I tried named-graph-uri parameter as well without success.

Upvotes: 1

Views: 477

Answers (2)

Florent Georges
Florent Georges

Reputation: 2327

Remove the <, > and " from the parameter value, just use the, well, URI.

Use the parameter several times to provide several values.

Upvotes: 3

Not sure what might be wrong with the named-graph-uri parameter..

But.. Have you simply tried the query defining the graph in the from clause? This is also valid via t rest endpoint instead of the parameter.

Upvotes: 0

Related Questions