Query virtual graphs with graphql?

Hi,

I'm testing the stardog7 beta on ubuntu and am still failrly new to stardog.
I have figured out how to setup a virtual graph and how to query it from studio and via http.
I have managed to get a graphql query to work on a native graph (the documentation here https://www.stardog.com/docs/#_named_graphs seems to be missing the @config(dataset: whatever) command.

My question:
Id like to query a virtual graph with graphql. And putting the virtual://music in the dataset parameter seems to be illegal. Could you give me a hint here?

query MyQuery @config(dataset: virtual://music) {
ALBUM {
     pp_NAME
      }
}

thank you!

Hi Niko,

The @config parameter you need to specify is graph: "virtual://music". You can read more in the documentation.

Best,
Jess

1 Like

Hi jess,

thank you for your reply! Using graph: and quotes solved the issue that it wouldn't execute. One step further!
Unfortunately, I still don't get any data, even though the "Show Plan" button describes a valid sparql query that actually returns my desired data.

My GraphQL:

query MyQuery @config(graph: "virtual://music") {
ALBUM {
        name
    }
}

My minimal virtual Graph description:

PREFIX : <http://api.stardog.com>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX stardog: <tag:stardog:api:>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

MAPPING
FROM SQL {
  SELECT *
  FROM "DATA"."ALBUM"
  }
TO {
  ?subject :artist ?ARTIST .
  ?subject :name ?NAME .
  ?subject a :ALBUM
} WHERE {
  BIND(template(":/ALBUM/{ID}") AS ?subject)
}

I don't have an explicit GraphQL schema set up for the virtual graph.
Is there anything else I have to enable or to adjust to make this work?
GraphQL calls come back but with "data": []

Thank you again!

EDIT:
I did make it work finally by explicitly giving the prefixes used with the @prefix directive. From the documentation I expected that prefixes that are present in the graph wouldn't have to be declared? Any idea why that may be?

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