[redland-dev] Usage of Abbreviated RDFXML Serializer
laalto at gmail.com
Tue Feb 23 09:23:52 CET 2010
On Fri, Feb 19, 2010 at 11:30 AM, Seb Rose <redland at claysnow.co.uk> wrote:
> I'm using the following code (see below) to serialise triples to
> Abbreviated RDFXML. The first set of triples I serialise is fine. When
> I serialise the next set of triples, the serialisation includes data
> from the first set of triples too. (I have stepped through the
> iterator loop below, and only the set of triples that I want to
> serialise are passed to raptor_serialize_statement).
> Is there an additional call to reset the serialiser? Do I need to
> construct a new serialiser each time I want to serialise data? If the
> latter, is it also the case that I need to create a new parser each
> time I want to parse a new block of RDFXML?
Generally, Raptor serializers are not designed for reuse. Some of them
reset themselves to a reusable state when you call
raptor_serialize_end() but the rdfxml-abbrev serializer is not one of
them. So it's better you create a new serializer object for each
serialization. The serializer delete/create overhead is negligible
compared to what happens during the serialization itself.
It's the same story with parsers. They are generally not designed for
reuse. Some are able to parse many documents but in the generic case
you need a new parser object for each document you are parsing.
More information about the redland-dev