rubensworks / GraphQL-LD.js

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

@optional not working #6

Closed pheyvaer closed 5 years ago

pheyvaer commented 5 years ago

@optional does not work with the following:

Context:

{
    "name":  { "@id": "http://schema.org/name" },
    "start":  { "@id": "http://schema.org/startDate" }
  }

Query:

{
  name @optional @single
  start @single
}

Data:

@prefix schema: <http://schema.org/> .
@prefix : <http://example.com/>.

:test1 schema:startDate "2019-03-23"^^schema:Date;
  <http://schema.org/name> "test".

:test2 schema:startDate "2019-03-24"^^schema:Date.

Actual result:

[ { name: 'test', start: '2019-03-23' } ]

Expected result:

[ { name: 'test', start: '2019-03-23' }, { start: '2019-03-24' }  ]

The code to execute the query is reused from the README and the data is hosted via the latest version of ldf-server.