You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by maorellana92 <ma...@gmail.com> on 2015/01/25 02:19:00 UTC

parse large rdf file

Hi,
I need to convert a large rdf file using jena, so I can't load it in the 
main memory.
There is a way to read and write each triple directly in other rdf file?

Actually, i only have used    FileManager.get().loadModel(String 
filename)   that return a Model m, then I do m.write(OutputStream out, 
String lang) to change the model syntax, but this load the entire file.

I read about StreamRDF, but i have not found a good example. Do you have 
any idea?

Re: parse large rdf file

Posted by Andy Seaborne <an...@apache.org>.
On 25/01/15 01:19, maorellana92 wrote:
> Hi,
> I need to convert a large rdf file using jena, so I can't load it in the
> main memory.
> There is a way to read and write each triple directly in other rdf file?
>
> Actually, i only have used    FileManager.get().loadModel(String
> filename)   that return a Model m, then I do m.write(OutputStream out,
> String lang) to change the model syntax, but this load the entire file.
>
> I read about StreamRDF, but i have not found a good example. Do you have
> any idea?

See RDFDataMgr for using StreamRDF and StreamRDFLib for ways to get a 
StreamRDF.

If you just want to change the format of a large file, you can do:

<Jena>/bin/riot --out=LANG File1 File1 ...

(or riot.bat)

where LANG is a streamed output format.  There various variants on, say, 
Turtle, that are output streaming style.  The default is Ntriples/NQuads.

(or use the usually tools and use a large heap)

	Andy