Open MuhammadShafaatKhan13 opened 1 year ago
Thanks for reporting Can you give some more information :
Thanks for responding.
rdflib version is 2.2.32, node version is 19.9.0
Below is the code for creating the store and getting jsonld object from it.
var testStore2 = $rdf.graph()
let playBackUsedBnode = $rdf.blankNode()
testStore2.add(playBackUsedBnode, $rdf.sym('https://w3id.org/tern/ontologies/tern/hasSimpleValue'), $rdf.lit(true, '', 'http://www.w3.org/2001/XMLSchema#boolean'))
$rdf.serialize(null, testStore2, null, 'application/ld+json')
This is not a jsonld issues. Samething arise with text/turtle.
There are already some issues related to boolean value issues.
Apparently the only way to get true
is to set the value to 1
http://www.w3.org/2001/XMLSchema#boolean
using true, false or 0
all return false
Apparently the only way to get true
is to set the value to 1
lit(1, 'http://www.w3.org/2001/XMLSchema#boolean'),
lit(true) => true
lit(false) => false
my store is:
{ "termType": "Graph", "classOrder": 4, "value": "", "statements": [{ "subject": { "termType": "BlankNode", "classOrder": 6, "value": "n0", "isBlank": 1, "isVar": 1 }, "predicate": { "termType": "NamedNode", "classOrder": 5, "value": "https://w3id.org/tern/ontologies/tern/hasSimpleValue" }, "object": { "termType": "Literal", "classOrder": 1, "value": "true", "datatype": { "termType": "NamedNode", "classOrder": 5, "value": "http://www.w3.org/2001/XMLSchema#boolean" }, "isVar": 0, "language": "" }, "graph": { "termType": "NamedNode", "classOrder": 5, "value": "http://graph-species-obs-for-entry-0-of-bird_survey_observation-number-0" } }], "constraints": [], "initBindings": [], "optional": [], "isVar": 0, "rdfFactory": { "supports": { "COLLECTIONS": true, "DEFAULT_GRAPH_TYPE": false, "EQUALS_METHOD": true, "IDENTITY": false, "ID": true, "REVERSIBLE_ID": false, "VARIABLE_TYPE": true } }, "namespaces": {}, "classActions": {}, "propertyActions": { "<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>": [null] }, "redirections": [], "aliases": [], "HTTPRedirects": [], "subjectIndex": [], "predicateIndex": [], "objectIndex": [], "whyIndex": [], "index": [ [], [], [], [] ], "features": [] }
But through
$rdf.serialize(null, testStore2, null, 'application/ld+json')
I am getting following jsonLD object which has hasSimpleValue as false, where as store has it as true.JSON-LD object:
{ "@context": { "tern": "https://w3id.org/tern/ontologies/tern/" }, "tern:hasSimpleValue": false }