[redland-dev] Usage of Abbreviated RDFXML Serializer

Seb Rose redland at claysnow.co.uk
Fri Feb 19 10:30:22 CET 2010


I'm new to Raptor, and I can't find the answer to the following in the
examples/documentation, so I'm posting here.

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?

        char* data = NULL;
        size_t length = 0;

        raptor_serialize_start_to_string(getSerializer(), base_uri,
(void**)&data, &length);

        /* Write the triples */
        RaptorStatementCollection::const_iterator it;
        for (it=statements.begin(); it!=statements.end(); ++it)
        {
            raptor_serialize_statement(getSerializer(), (*it)->getStatement());
        }

        raptor_serialize_end(getSerializer());

        // Copy buffer out
        std::copy(data, data+length-1, std::back_inserter(rdfBuffer));

        // Free buffer
        raptor_free_memory(data);


Thanks
Seb

-- 
ACCU - http://www.accu.org/ - Professionalism in Programming


More information about the redland-dev mailing list