rubensworks / GraphQL-LD.js

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

Query with vcard:title returns no results #23

Closed pheyvaer closed 4 years ago

pheyvaer commented 4 years ago

The following code does not provide results while it should

const context = {
  "@context": {
    "vcard": "http://www.w3.org/2006/vcard/ns#",
    "schema": "http://schema.org/",
    "employee": "schema:employee",
    "title": "vcard:title",
    "KNOWS": "http://knows.proxy.ilabt.imec.be/person/office/#"
  }
};

const comunicaConfig = {
  sources: [
    "http://knows.proxy.ilabt.imec.be/person/office/employees.ttl",
    "https://ben.de-meester.org/#me"
  ],
};
const client = new Client({ context, queryEngine: new QueryEngineComunica(comunicaConfig) });

const query = `
{
  id(_:KNOWS)
  employee {
    id @single
    title @single
  }
}`;

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

The corresponding use of communica-sparql works

comunica-sparql http://knows.proxy.ilabt.imec.be/person/office/employees.ttl https://ben.de-meester.org/#me 'SELECT * WHERE { ?s <http://schema.org/employee> ?person. ?person <http://www.w3.org/2006/vcard/ns#title> ?title.}'

I tried with other predicates and those work. The issue seems to be related to vcard:title.

rubensworks commented 4 years ago

Are you sure it's not a problem with the data? Because that query will convert to this SPARQL query, which also doesn't return results: http://query.linkeddatafragments.org/#datasources=http%3A%2F%2Fknows.proxy.ilabt.imec.be%2Fperson%2Foffice%2Femployees.ttl;https%3A%2F%2Fben.de-meester.org%2F%23me&query=PREFIX%20vcard%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2006%2Fvcard%2Fns%23%3E%0APREFIX%20schema%3A%20%3Chttp%3A%2F%2Fschema.org%2F%3E%0ASELECT%20*%20WHERE%20%7B%0A%20%20%3Chttp%3A%2F%2Fknows.proxy.ilabt.imec.be%2Fperson%2Foffice%2F%23%3E%20schema%3Aemployee%20%3Fe.%0A%20%20%3Fe%20vcard%3Atitle%20%3Ftitle.%0A%7D&httpProxy=http%3A%2F%2Fproxy.linkeddatafragments.org%2F

pheyvaer commented 4 years ago

The query you use works with comunica-sparql though :thinking:

| software            | version
| ------------------- | -------
| Comunica Init Actor | 1.10.0 (dev)
| node                | v12.16.1
| npm                 | 6.13.4
| yarn                | 1.21.1
| Operating System    | linux (Linux 4.15.0-96-generic)
rubensworks commented 4 years ago

1.12.0 is the latest: https://github.com/comunica/comunica/blob/master/CHANGELOG.md#v1120---2020-04-03

rubensworks commented 4 years ago

Ah, I see the problem. Comunica has updated to JSON-LD 1.1, but Ben's profile contains incorrect JSON-LD 1.1, as it requires a @prefix: true entry in the vcard prefix entry.