[redland-dev] Raptor parser behaviour with with namespace handler set
Dave Beckett
dave at dajobe.org
Tue Oct 12 16:12:14 CEST 2010
On 10/12/10 6:21 AM, Svatopluk Šperka wrote:
> Hi,
>
> thank you very much for answering but I guess you don't understand what the
> problem is.
>
> I'm loading schemas for RDF and RDFS where namespaces are defined - they are
> correct documents and I'm able to load them without problem when there's no
> handler for namespace declaration registered (qnames get expanded to URIs).
> When I register a handler, two types of error appear:
>
> 1) URI file:///Users/beho/Projects/connexion/./import/22-rdf-syntax-ns:7
> raptor error - The namespace prefix in "owl:Ontology" was not declared.
> 2) URI file:///Users/beho/Projects/connexion/./import/22-rdf-syntax-ns:8
> raptor warning - Using node element 'Ontology' without a namespace is
> forbidden.
>
> My interpretation, without knowing internals of raptor, would be that when
> custom handler is registered, the default one is not which is why raptor
> does not know about declared namespaces when parsing triples.
>
> I could paste a piece of code if it would help.
Please file a bug at http://bugs.librdf.org/ with the example code and data
that shows the problem.
Thanks
Dave
>
> Thanks again.
>
> Svatopluk Šperka
>
> On 10/12/10 7:53 , Dave Beckett wrote:
>> 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