rubensworks / GraphQL-LD.js

Linked Data Querying with GraphQL
https://gist.github.com/rubensworks/9d6eccce996317677d71944ed1087ea6
MIT License
103 stars 7 forks source link

Query stops suddenly, but works with comunica-sparql #29

Closed pheyvaer closed 3 years ago

pheyvaer commented 4 years ago

The following code stops before the query returns the results.

const {Client} = require("graphql-ld");
const {QueryEngineComunica} = require( "graphql-ld-comunica");

main();

async function main() {
// Define a JSON-LD context
const context = {
            "@context": {
              "KNOWS": "https://data.knows.idlab.ugent.be/person/office/#",
              "schema": "http://schema.org/",
              "type": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
              "name": "schema:name",
              "description": "schema:description",
              "Tutorial": "schema:HowTo",
              "hasTutorial": {"@reverse": "schema:contributor"},
              "url": "schema:url"
            }
          };

// Create a GraphQL-LD client based on a client-side Comunica engine over 2 sources
const comunicaConfig = {
  sources: [ "https://pieterheyvaert.com/",  "https://data.knows.idlab.ugent.be/person/office/tutorials.ttl", "https://data.knows.idlab.ugent.be/person/office/#" ],
};
const client = new Client({ context, queryEngine: new QueryEngineComunica(comunicaConfig) });

// Define a query
const query = `
{
            id(_:KNOWS)
            hasTutorial {
              type (_:Tutorial)
              description @single @optional
              name @single
              url @single
            }
          }

`;

const { data } = await client.query({ query });
};

When using comunica-sparql with the following details it works.

| software            | version
| ------------------- | -------
| Comunica Init Actor | 1.16.2 
| node                | v14.9.0
| npm                 | 6.14.8
| yarn                | 1.21.1
| Operating System    | linux (Linux 4.15.0-117-generic)

I used the following command.

comunica-sparql https://pieterheyvaert.com/ https://data.knows.idlab.ugent.be/person/office/tutorials.ttl https://data.knows.idlab.ugent.be/person/office/# -f my-query.query -c config.json -i graphql
rubensworks commented 4 years ago

Thanks for reporting.

For reference, possibly caused by https://github.com/comunica/comunica/issues/724.

rubensworks commented 3 years ago

Should be fixed thanks to comunica/comunica#724