When generating JSON-LD, when the predicate is rdf:type, the @type keyword must not be used if the object is a literal. Instead, the property key rdf:type should be used (provided that the context defines the rdf prefix -- otherwise, the whole IRI should be used as the property key).
Granted, literals as the object of rdf:type are a bit of a corner case, but they are valid RDF.
Issue Description:
Sometimes, Corese produces invalid JSON-LD. More specifically, it uses
@type
with a value object as its value.Steps to Reproduce:
Submit the following SPARQL query, requesting the result in
application/ld+json
:CONSTRUCT { <tag:s> a 42 } {}
Expected Behavior:
The result should be (something like)
Actual Behavior:
The result is
which is invalid.
Note to Developers:
When generating JSON-LD, when the predicate is
rdf:type
, the@type
keyword must not be used if the object is a literal. Instead, the property keyrdf:type
should be used (provided that the context defines therdf
prefix -- otherwise, the whole IRI should be used as the property key).Granted, literals as the object of
rdf:type
are a bit of a corner case, but they are valid RDF.