Knowledgebase:
Exporting triples from MarkLogic
23 September 2022 08:39 PM

The best available way for exporting triples from MarkLogic at the moment is via the /v1/rows (POST) endpoint. You can  make an HTTP POST call to this endpoint to which you would attach an op.fromSPARQL query to return the desired set of triples and select the output format (Accept request header or row-format? url parameter) of your choice.

  • Sample op.fromSPARQL payload:
    • op.fromSPARQL('SELECT * FROM <collection_name> WHERE {?s ?p ?o.}')
  • Sample curl POST command:
    • curl --anyauth --user <user_name>:<password> -i -X POST  -H "Content-type: application/vnd.marklogic.querydsl+javascript" -H "Accept: <output_type>" http://<host_name>:8000/v1/rows -d @./<payload_file_name>

Alternative ways to export triples:

  • MLCP currently doesn’t offer a way to export triples but if you are okay with exporting them as XML files (through a collection name - for managed triples, graph name can be used as a collection name), you can do so by exporting those documents as files through MLCP
    • Note:  If you are working with embedded/unmanaged triples, there is a possibility of the resulting XML files consisting of XML elements that are not triples if you go with this alternative
  • You can also use the /v1/graphs endpoint to export triples but this endpoint only returns managed triples and if you need to export unmanaged triples, this is not an option
    • Note: This is not efficient in terms of performance when working with large sets of data

Further reading:

(1 vote(s))
Helpful
Not helpful

Comments (0)