Class | Redland::Stream |
In: | rdf/redland/stream.rb |
Parent: | Object |
This module provides a method to generate a stream of statements, suitable for outputing from RDF/XML parsers, returning as the results of queries and serialising models in order to manipulate them or transform into another syntax.
stream | [RW] |
You shouldn’t use this. Used internally for cleanup.
# File rdf/redland/stream.rb, line 22 def Stream.create_finalizer(stream) proc {|id| "Finalizer on #{id}" # puts "closing model" Redland::librdf_free_model(stream) } end
Create a wrapper for a librdf_stream object (?? confirm)
# File rdf/redland/stream.rb, line 15 def initialize(object,model) @stream = object @model = model ObjectSpace.define_finalizer(self,Stream.create_finalizer(@stream)) end
Get the current Statement in the stram
# File rdf/redland/stream.rb, line 39 def current if not self.stream return nil end my_statement = Redland.librdf_stream_get_object(self.stream) unless my_statement return nil else return Statement.new(:from_object=>my_statement,:model=>@model) end end
Copyright 2004-2005 Dave Beckett, Institute for Learning and Research Technology, University of Bristol