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
.
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.