[redland-dev] Perl API Serializer, File Only?

Dave Beckett dave.beckett at bristol.ac.uk
Mon Oct 18 11:51:25 BST 2004


On Mon, 18 Oct 2004 02:21:28 -0700, Kip Hampton <khampton at totalcinema.com> wrote:

> Howdy Redlanders,
> 
> I'm just digging into evaluating redland for an upcoming (perl-based) 
> project. I see that RDF::Redland::Serializer implements 
> serialize_model_to_file() btu my app will be returning content 
> dynamically so writing out to a file isn't waht i need.
> 
> How does one go about serializing a model to a string? Am I missing 
> something obvious?

No you aren't.

Iit doesn't exist yet for a variety of reasons ;)

This is one of those cases where the resulting
end user functionality looks quite small:
  $foo=$serializer->model_as_string($model)
but the code to do the internals is much larger.

The main blocker is that I need to create a cross-language I/O
abstraction (aka stream in java, I/O stream in C++) so that instead
of doing fprintf(fh, ...) I use iostream->printf(...) and then the
right magic happens so that it goes to a stream or string, as appropriate.

  Aside: 
  Perl is actually one of the problems here, since it has a PerlIO
  abstraction that is not C standard I/O.  So I already can't use
  FILE* across languages for serializing to already existing open files.

  I know some systems have smarter libc I/O that can present FILE* to
  in-memory buffers, but it isn't portable or usable across languages
  (see above).

So I have to refactor all existing serializing I/O code to use that
new code by adding wrappers to make it work as before, and then go on
to add the as_string() support.  I also will be creating a
raptor_serializer class and methods to do the work and move all
syntax writing code there.

I do have some code for the beginings of the I/O work and
raptor_serializer classes but it's not anywhere complete.

It could be one of those cases where this is actually easier than it
looks and some weekend I'll just be able to do it all :)  No promises!

Dave




More information about the redland-dev mailing list