[redland-dev] API change proposal: raptor_uri_handlers, rdf_concepts

Lauri Aalto laalto at gmail.com
Mon Nov 12 08:35:43 GMT 2007


On 11/9/07, Dave Beckett <dave at dajobe.org> wrote:
> On Wed, 7 Nov 2007, Lauri Aalto wrote:
> > I propose two relatively small API changes to Raptor
> > raptor_uri_handlers and librdf rdf_concepts.
> >
> > If nobody screams, I will submit these changes to svn.librdf.org
> > repository soonish, let's say next week. (I have the changes already
> > in my private development branch.)
> >
> > Motivation for both source compatibility breaks is the same: moving
> > Redland libraries to re-entrant direction with no writable (non-const)
> > static data.
> >
> >
> > 1. const raptor_uri_handler
> >
> > Raptor currently has no need to touch raptor_uri_handler structs
> > passed to it. raptor_uri_handlers should be flagged as const in the
> > API to enforce compile-time constness checking and to avoid casting
> > const data to non-const.
> >
> > This would change raptor_uri_handler argument to const
> > raptor_uri_handler in the following 5 raptor.h public functions:
> >
> > raptor_uri_set_handler()
> > raptor_uri_get_handler()
> > raptor_new_namespaces()
> > raptor_namespaces_init()
> > raptor_new_xml_writer()
>
> This change will have to be reverted since a writable uri handler
> is needed to handle the change to the structure to add the uri_compare
> factory method.

As discussed on IRC, this is not an issue - raptor does not need
writable uri handler structs anymore.

> > 2. rdf_concepts
> >
> > All non-const static data should be moved from rdf_concepts.c to
> > librdf_world struct. Accessing it would require changes to all public
> > API macros in rdf_concepts.h - practically they need a pointer to a
> > librdf_world object. For example:
> >
> >  #define LIBRDF_MS_Alt librdf_concept_resources[LIBRDF_CONCEPT_MS_Alt]
> >
> > would change to
> >
> >  #define LIBRDF_MS_Alt(world) world->concept_resources[LIBRDF_CONCEPT_MS_Alt]
> >
> > (The underlying change would also fix
> > http://bugs.librdf.org/mantis/view.php?id=213 in a better way.)
>
> This one is OK by me.  I bet this isn't widely known/used.

This needs some further engineering but no further changes to the
rdf_concepts.h public API.

librdf_world_s internals are not accessible from the public API and
macros like these would only work internally.

I plan to introduce two new librdf API functions

  librdf_node *librdf_get_concept_resource_by_index(librdf_world*,
librdf_concepts_index);
  librdf_uri *librdf_get_concept_uri_by_index(librdf_world*,
librdf_concepts_index);

and map the rdf_concepts.h public macros to these.

Lauri


More information about the redland-dev mailing list