[redland-dev] Ensuring distinct bnodes across multiple invocations of rapper

Dave Beckett dave at dajobe.org
Fri Jun 15 20:00:19 EDT 2012


On 6/15/12 7:31 AM, Tim rdf wrote:
> redland-dev,
> 
> I'm not sure if this is the right list, so if not please point me to a
> more appropriate place to ask.
> 
> I'm trying to build up a big ntriples from a few turtle files, but the
> following runs the risk of creating the same bnode identifiers in c.nt
> for different bnodes that come from a.ttl and b.ttl.
> 
> for ttl in a.ttl b.ttll; do
>    rapper -g -o ntriples $ttl >> c.nt;
> done
> 
> Is there a way to avoid this bnode collision?
> 
> I would think having a param that would be appended (or such) to the
> bnode ID in the output would avoid the collision. Or, a param that
> indicates to use the filename to ensure distinct bnode IDs.
> 
> How is this handled?

Raptor (rapper) is not intended to handle this kind of thing - it's
a syntax to/from sequence of triples library.  If you want to load
them into an RDF graph with those semantics you need to use
Redland librdf which does do bnode modifying to avoid this issue
when loading into the same graph.  There is a tool 'rdfproc' that
comes with Redland librdf that can help so the pattern above is
similar but with rdfproc in the loop

http://librdf.org/utils/rdfproc.html

You can then serialize it to ntriples if you want.

Dave



More information about the redland-dev mailing list