Search code examples
javaxquerysemanticsmarklogic

MarkLogic sem: function group in MarkLogic Java API


I am looking for information around the MarkLogic Java API, precisely I tried to find Java equivalent to the sem: xquery function group. I was not able to find anything in the docs so I thought you guys might have a better idea. What I need to do exactly is transform rdf/turtle to the ML triples, I understand that XQuery would be ideal for that but I can't use it because of the requirements, and once again I know it's not too clever but I can't change that. Any help would be greatly appreciated. All I found in the documentation was around three ways of loading triples (https://docs.marklogic.com/guide/semantics/loading#id_81259):

  1. Loading triples with mlcp,
  2. Loading Triples with XQuery,
  3. Loading Triples Using the REST API.

Solution

  • One more suggestion. Some of the REST API's endpoints support the Graph Store Protocol and the SPARQL Protocol. You can send turtle to the graph store protocol with any HTTP client... here's the curl for it:

    curl -Hcontent-type:text/turtle \ -d@'nameofturtlefile.ttl' \ -X PUT URLFORHOST/v1/graphs?graph=nameofgraph.

    That endpoint takes care of the translation to sem:triple elements; you should never have to see that XML representation of triples.

    Translate the curl call to Apache HTTP Client and you have a way to ingest turtle. I've also used the Jena API (look up riot) to save turtle to MarkLogic.