[redland-dev] Raptor parser behaviour with with namespace handler set

Dave Beckett dave at dajobe.org
Tue Oct 12 07:53:59 CEST 2010


On 10/11/10 2:32 AM, Svatopluk Šperka wrote:
> Hi,
> 
> I use raptor to parse RDF and transform it to my internal representation 
> and now I decided to use declared namespaces to optimise this 
> representation for space.
> 
> Problem is that after setting namespace handler using 
> raptor_set_namespace_handler (version 1.4.19 is used) parser complains 
> "namespace prefix in ... was not declared". I guess I should register 
> the namespace somehow for the parser but I couldn't figure out how from 
> the documentation. Could someone give me a clue ?
> 
> Thanks in advance for any help.

In RDF syntaxes, namespaces are an abbreviation mechanism for URIs,
sometimes called QNames or Curies.

In a parser - syntax->RDF triples - the mapping is defined by the syntax
specifications, there is no API to allow illegal syntax with undefined
prefixes.  Syntaxes are intended to be portable representations of RDF triples.

In a serializer - RDF triples->syntax - you can declare namespaces since the
user has a choice of how the output format looks.

That's raptor_serialize_set_namespace() as documented in
http://librdf.org/raptor/api-1.4/raptor-section-serializer.html#raptor-serialize-set-namespace

Dave


More information about the redland-dev mailing list