I have to work with JSON-LD data and to provide SPARQL endpoint as well. For that, I used Virtuoso, and successfully managed to store JSON-LD data chunks in Virtuoso using the instructions from JSON-LD, Jena, Virtuoso and Named Graphs.
{
"@context": "http://myweb.com/city-traffic/contexts/system.jsonld",
"id": "http://myweb.com/city-traffic",
"type": "city:System",
"name": "City Live Traffic Data",
"description": "This is sample desc.",
"operator": "abc@email.com",
"serviceArea": "http://dbpedia.org/page/City",
"status": "city:Available",
"services": [
"http://myweb.com/city-traffic/service/configuration",
"http://myweb.com/city-traffic/service/monitoring",
"http://myweb.com/city-traffic/service/observation"
],
"sensors": [
"http://myweb.com/city-traffic/sensor/2-F",
"http://myweb.com/city-traffic/sensor/3-F",
"http://myweb.com/city-traffic/sensor/monitoring"
]
}
However, using SPARQL, I can query the data using Jena ARQ but it does add extra keys to the original JSON-LD data chunk.
{
"@graph" : [ {
"@id" : "_:t1",
"rdf:type" : {
"@id" : "rs:ResultSet"
},
"rs:resultVariable" : [ "p", "o", "s" ],
"rs:size" : {
"@type" : "xsd:int",
"@value" : "14"
},
"solution" : [ "_:t2", "_:t3", "_:t4", "_:t5", "_:t6", "_:t7", "_:t8", "_:t9", "_:t10", "_:t11", "_:t12", "_:t13", "_:t14", "_:t15" ]
}, {
"@id" : "_:t10",
"binding" : [ "_:t41", "_:t42", "_:t43" ]
}, {
"@id" : "_:t11",
"binding" : [ "_:t30", "_:t31", "_:t32" ]
}, {
"@id" : "_:t12",
"binding" : [ "_:t38", "_:t39", "_:t40" ]
}, {
"@id" : "_:t13",
"binding" : [ "_:t45", "_:t46", "_:t47" ]
}, {
"@id" : "_:t14",
"binding" : [ "_:t29", "_:t56", "_:t57" ]
}, {
"@id" : "_:t15",
"binding" : [ "_:t44", "_:t36", "_:t20" ]
}, {
"@id" : "_:t16",
"value" : "http://dmsexample.com/abc@email.com",
"rs:variable" : "o"
}, {
"@id" : "_:t17",
"value" : "http://myweb.com/ontology/ns/operator",
"rs:variable" : "p"
}, {
"@id" : "_:t18",
"value" : "http://104.131.128.70:8080/istanbul-traffic",
"rs:variable" : "s"
}, {
"@id" : "_:t19",
"value" : "http://example.com/arou@ait.edu.gr",
"rs:variable" : "o"
}, {
"@id" : "_:t2",
"binding" : [ "_:t16", "_:t17", "_:t18" ]
}, {
"@id" : "_:t20",
"value" : "http://myweb.com/city-traffic",
"rs:variable" : "s"
}, {
"@id" : "_:t21",
"value" : "http://myweb.com/city-traffic/sensor/3-F",
"rs:variable" : "o"
}, {
"@id" : "_:t22",
"value" : "http://myweb.com/ontology/ns/managesSensor",
"rs:variable" : "p"
}, {
"@id" : "_:t23",
"value" : "http://myweb.com/city-traffic",
"rs:variable" : "s"
}, {
"@id" : "_:t24",
"value" : "http://www.w3.org/2000/01/rdf-schema#label",
"rs:variable" : "p"
}, {
"@id" : "_:t25",
"value" : "http://myweb.com/city-traffic/service/monitoring",
"rs:variable" : "o"
}, {
"@id" : "_:t26",
"value" : "http://myweb.com/ontology/ns/providesService",
"rs:variable" : "p"
}, {
"@id" : "_:t27",
"value" : "http://myweb.com/city-traffic",
"rs:variable" : "s"
}, {
"@id" : "_:t28",
"value" : "http://myweb.com/city-traffic/service/configuration",
"rs:variable" : "o"
}, {
"@id" : "_:t29",
"value" : "http://myweb.com/city-traffic/sensor/monitoring",
"rs:variable" : "o"
}, {
"@id" : "_:t3",
"binding" : [ "_:t19", "_:t48", "_:t49" ]
}, {
"@id" : "_:t30",
"value" : "http://myweb.com/ontology/ns/IotSystem",
"rs:variable" : "o"
}, {
"@id" : "_:t31",
"value" : "rdf:type",
"rs:variable" : "p"
}, {
"@id" : "_:t32",
"value" : "http://myweb.com/city-traffic",
"rs:variable" : "s"
}, {
"@id" : "_:t33",
"value" : "_:t53",
"rs:variable" : "o"
}, {
"@id" : "_:t34",
"value" : "http://myweb.com/ontology/ns/operator",
"rs:variable" : "p"
}, {
"@id" : "_:t35",
"value" : "http://myweb.com/city-traffic",
"rs:variable" : "s"
}, {
"@id" : "_:t36",
"value" : "http://myweb.com/ontology/ns/status",
"rs:variable" : "p"
}, {
"@id" : "_:t37",
"rs:value" : "City Live Traffic Data",
"rs:variable" : "o"
}, {
"@id" : "_:t38",
"value" : "http://myweb.com/city-traffic/service/observation",
"rs:variable" : "o"
}, {
"@id" : "_:t39",
"value" : "http://myweb.com/ontology/ns/providesService",
"rs:variable" : "p"
}, {
"@id" : "_:t4",
"binding" : [ "_:t28", "_:t54", "_:t55" ]
}, {
"@id" : "_:t40",
"value" : "http://myweb.com/city-traffic",
"rs:variable" : "s"
}, {
"@id" : "_:t41",
"value" : "http://dbpedia.org/page/City",
"rs:variable" : "o"
}, {
"@id" : "_:t42",
"value" : "http://myweb.com/ontology/ns/serviceArea",
"rs:variable" : "p"
}, {
"@id" : "_:t43",
"value" : "http://myweb.com/city-traffic",
"rs:variable" : "s"
}, {
"@id" : "_:t44",
"value" : "http://myweb.com/ontology/ns/Available",
"rs:variable" : "o"
}, {
"@id" : "_:t45",
"rs:value" : "This is sample desc.",
"rs:variable" : "o"
}, {
"@id" : "_:t46",
"value" : "http://www.w3.org/2000/01/rdf-schema#comment",
"rs:variable" : "p"
}, {
"@id" : "_:t47",
"value" : "http://myweb.com/city-traffic",
"rs:variable" : "s"
}, {
"@id" : "_:t48",
"value" : "http://myweb.com/ontology/ns/operator",
"rs:variable" : "p"
}, {
"@id" : "_:t49",
"value" : "http://myweb.com/city-traffic",
"rs:variable" : "s"
}, {
"@id" : "_:t5",
"binding" : [ "_:t37", "_:t24", "_:t58" ]
}, {
"@id" : "_:t50",
"value" : "http://myweb.com/city-traffic/sensor/2-F",
"rs:variable" : "o"
}, {
"@id" : "_:t51",
"value" : "http://myweb.com/ontology/ns/managesSensor",
"rs:variable" : "p"
}, {
"@id" : "_:t52",
"value" : "http://myweb.com/city-traffic",
"rs:variable" : "s"
}, {
"@id" : "_:t54",
"value" : "http://myweb.com/ontology/ns/providesService",
"rs:variable" : "p"
}, {
"@id" : "_:t55",
"value" : "http://myweb.com/city-traffic",
"rs:variable" : "s"
}, {
"@id" : "_:t56",
"value" : "http://myweb.com/ontology/ns/managesSensor",
"rs:variable" : "p"
}, {
"@id" : "_:t57",
"value" : "http://myweb.com/city-traffic",
"rs:variable" : "s"
}, {
"@id" : "_:t58",
"value" : "http://myweb.com/city-traffic",
"rs:variable" : "s"
}, {
"@id" : "_:t6",
"binding" : [ "_:t50", "_:t51", "_:t52" ]
}, {
"@id" : "_:t7",
"binding" : [ "_:t21", "_:t22", "_:t23" ]
}, {
"@id" : "_:t8",
"binding" : [ "_:t33", "_:t34", "_:t35" ]
}, {
"@id" : "_:t9",
"binding" : [ "_:t25", "_:t26", "_:t27" ]
} ],
"@context" : {
"solution" : {
"@id" : "http://www.w3.org/2001/sw/DataAccess/tests/result-set#solution",
"@type" : "@id"
},
"resultVariable" : {
"@id" : "http://www.w3.org/2001/sw/DataAccess/tests/result-set#resultVariable",
"@type" : "@id"
},
"size" : {
"@id" : "http://www.w3.org/2001/sw/DataAccess/tests/result-set#size",
"@type" : "@id"
},
"binding" : {
"@id" : "http://www.w3.org/2001/sw/DataAccess/tests/result-set#binding",
"@type" : "@id"
},
"value" : {
"@id" : "http://www.w3.org/2001/sw/DataAccess/tests/result-set#value",
"@type" : "@id"
},
"variable" : {
"@id" : "http://www.w3.org/2001/sw/DataAccess/tests/result-set#variable",
"@type" : "@id"
},
"rs" : "http://www.w3.org/2001/sw/DataAccess/tests/result-set#",
"rdf" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"xsd" : "http://www.w3.org/2001/XMLSchema#"
}
}
My Question is, how can I get the same data-format of ResultSet as of Original Data was pushed? Or, what are other work around for similar idea? To use other Datastore? or to put SPARQL over MongoDB?