As per my knowledge, MarkLogic stores RDF as XMLs. But what if I need to use RDF in conjunction with JSON documents. How would I model my JSON documents with RDF? Also if this is possible how do I query JSON and RDF together? Thanks in advance.
The Using RDF in MarkLogic section of the Semantic Developer's Guide shows examples of representing triples in JSON. Your document would look like this:
{
"my" : "data",
"triple" : {
"subject": "http://xmlns.com/foaf/0.1/name/John Smith",
"predicate": "http://example.org/livesIn",
"object": { "value": "London", "datatype": "xs:string" }
}
}
or like this:
{
"my" : "data",
"triples" : [{
"subject": "http://xmlns.com/foaf/0.1/name/John Smith",
"predicate": "http://example.org/livesIn",
"object": { "value": "London", "datatype": "xs:string" }
},{
"subject": "http://xmlns.com/foaf/0.1/name/London",
"predicate": "http://example.org/isIn",
"object": { "value": "England", "datatype": "xs:string" }
},{
"subject": "http://xmlns.com/foaf/0.1/name/John Smith",
"predicate": "http://example.org/livesWith",
"object": { "value": "Jane Smith", "datatype": "xs:string" }
}]
}
Querying JSON and RDF together is the same as querying XML and RDF together. Take a look at the Using Semantics with cts Searches section, which shows how to use