1

Is there a way to convert N-Triples to N-Quads, or Turtle to TriG, by specifying named graph URI as the parameter? Preferably using riot or rapper.

  • 2
    not with RIOT, but you could use in-memory TDB database like `tdb2.tdbloader --loc /tmp/tdb --graph http://example.org/graph /tmp/data.nt && tdb2.tdbdump --loc /tmp/tdb > /tmp/data.nq && rm -r /tmp/tdb` ? – UninformedUser Aug 18 '20 at 14:27

1 Answers1

3

I have been working on a tool based on Jena that simplifies working with streams of named graphs from the command line. Its name 'ngs' stands for 'named graph streams' and it is available as a runnable jar from the release section and the Java build creates a debian package.

https://github.com/SmartDataAnalytics/RdfProcessingToolkit/blob/master/README-NGS.md

Your use case is supported via ngs map --graph 'http://your.graph' data.trig It also supports mapping into the default graph and reading from stdin such as cat data.trig | ngs map --dg

With ngs map --sparql 'CONSTRUCT WHERE { GRAPH ?g { ?s ?p ?o } } its also possible to perform general transformations on each consecutive sequence of quads having the same graph.

raven_arkadon
  • 390
  • 1
  • 5
  • 11