Reputation: 13
We currently use mlcp to import Turtle files. We specify 'rdf' on import, which works fine.
However, there doesn't seem to be a way to specify this on export using mlcp. The documentation only mentions XML and JSON as formats.
Is exporting as RDF (and ideally serialized as Turtle) possible using mlcp?
We have specified a graph to export, but there doesn't seem to be arguments for specifying RDF/Turtle
Upvotes: 1
Views: 76
Reputation: 793
I think the problem is that there's no "one size fits all" approach to exporting triple data. I wrote a script that serves us well because we want to isolate all the assertions from a given document into its own ttl file output. The sem: library serializations didn't do exactly what I needed, so I wrote a simple script to serialize and output the ttl to a text document. One major thing I was able to handle with my custom script was using our custom prefixes...
It reads in all of the triples in the document and groups them by subject. I use sem:curie-shorten to cast the predicate and object iri's into curies based on the set of prefixes. Use fn:string-join($lines," ")
to get the text string pieces pulled together. There's some logic for handling different xs data types. The output has the prefixes listed, followed by the triples in ttl output-
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix foo: <http://purl.si.team/ontology/foo#> .
foo:2a25e557407562ee
rdf:type foo:MyRDFType ;
foo:hasOwner foo:_Organization_ClientCompany ;
foo:specifies foo:e2aa46e1fda1fe8b ;
foo:wasDerivedFrom foo:da6a5d3c0e2086f1 ;
foo:references foo:46e1bd26fe6fe11d ;
skos:exactMatch foo:ab3e5d379aac98b4
.
foo:46e1bd26fe6fe11d
rdf:type foo:AnotherThing ;
foo:hasLiteralValue "Some Sort of ID" ;
foo:isRelatedTo foo:241f7c25ac9a35c ;
.
Upvotes: 0
Reputation: 8422
Depending on the size of your graph (specifically, if you can do it in one transaction), you could use xdmp.save
on the results of sem.rdfSerialize
. If your graph is too big, then you'd need to split it, as Mads suggested.
Upvotes: 0
Reputation: 66723
No, I don't believe there is a way to export from MLCP in turtle format.
There is the sem:rdf-serialize()
function where you can specify turtle
in the options for the format.
You could instead export using CoRB and apply the sem:rdf-serialize()
within the process module to export turtle formatted results.
Upvotes: 0