Greetings All,
We have an app where we use MarkLogic Java client API to communicate with
MarkLogic DB.
We are working on converting JSON documents to triples data as and when the
JSON doc is ingested.
We are achieving this via below steps.
1. Suppose the incoming JSON is as below:
{"id":"100", "name":"john"}
2. Convert this into NT format like below. Please note that no tools
are used for this conversion. The properties are read and set to Java
Strings.
a. Read the JSON string and set it to Person object
b. Get the values and set it in below string
String triple = "<http://dbpedia.org/resource/" + person.getID() + ">
<http://dbpedia.org/ontology/name> <http://dbpedia.org/resource/" +
person.getName() + "> .";
3. Now use StringHandle using which the triples data is ingested into
MarkLogic DB using graphManager.write() method.
StringHandle handle = new
StringHandle(triple).withMimetype(RDFMimeTypes.NTRIPLES);
Using this approach we are able to see the triples data
(http://localhost:8000/v1/graphs/things) as expected.
The question is: is this the right approach to dynamically convert JSON to
triples? Or is there any better way to do this, say using XQuery or
Javascript functions/scripts?
Any guidance is much appreciated!
Thanks,
Arun
_______________________________________________
General mailing list
[email protected]
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general