You could always add some dummy data returned by the CONSTRUCT query.
Whether it's worth doing so, I don't know.
Otherwise, maybe, there are already some options in the JSON-LD API to
change the behaviour. If not, simply change the JSON-LD serializer as
long as you're not doing changes which violate the specs.
On 28.02.2018 17:47, Laura Morales wrote:
> JSON-LD. If a CONSTRUCT query returns zero nodes, only @context is returned,
> and not @graph:
>
> {
> "@context" : {
> "schema" : "http://schema.org/",
> }
> }
>
> If a CONSTRUCT query returns one node, @context is returned, and all the node
> properties are defined in the root object:
>
> {
> "@id": ....
> "schema:name": ...
> "@context" : {
> "schema" : "http://schema.org/",
> }
> }
>
> If a CONSTRUCT query returns multiple nodes, both @context and @graph are
> defined, the latter containing all the nodes.
>
> {
> "@graph": [{...}, {...}, {...}, ... ],
> "@context" : {
> "schema" : "http://schema.org/",
> }
> }
>
> Is there a way to force @graph always in the output? That is an empty array
> "@graph": [] for the first case, and an array with one object "@graph":
> [{...}] for the second case?
>
> Thanks.