Project

rdf-gzip

0.0
No commit activity in last 3 years
No release in over 3 years
Gzip file support for RDF.rb readers and writers.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 0.3.1
 Project Readme
rdf-gzip: gzip support for rdf.rb readers and writers

Usage:

	require 'rdf'
	require 'rdf/ntriples'
	require 'rdf/json' # or whatever serialization
	require 'rdf/gzip'
	
	graph = RDF::Graph.new
	
	RDF::Reader.for(:ntriples).gzopen("/path/to/rdf.nt.gz") do | reader |
		reader.each_statement do | statement |
			graph << statement
		end
	end
	
	RDF::JSONWriter.gzopen("/path/to/rdf.json.gz") do | writer |
	  graph.each_statement do | statement |
			writer << statement
		end
	end
	
That is to say, exactly like how you would normally user RDF::Reader and RDF::Writer, but use gzopen rather than open.  The format needs to be called explicitly (that is, no file format detection) due to the fact that the file suffix may not exist in the file name anywhere.