Skip to content

XML serialization with base=namespace uri Results in Empty vann:preferredNamespaceUri for Vocab Description #3412

@typinator

Description

@typinator

I've created a vocab description and use both the XML and Turtle serializations.

TRAK = Namespace('https://purl.org/trak/metamodel/vocab#')

The Turtle one (format='turtle', base = TRAK) is correct starting with (excerpt) :

@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix trak: <https://purl.org/trak/metamodel/vocab#> .
@prefix vann: <http://purl.org/vocab/vann/> .
 .

trak: a owl:Ontology ;
    vann:preferredNamespacePrefix "trak"^^xsd:string ;
    vann:preferredNamespaceUri trak: .

having sorted using the otsrdflib package to create a systematic and repeatable order.

The problem occurs with the XML version (format="pretty-xml", base=TRAK). This produces:

<?xml version='1.0' encoding='us-ascii'?>
<rdf:RDF  xmlns:ns1="http://www.w3.org/2002/07/owl#" xmlns:ns2="http://purl.org/vocab/vann/"  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xml:base="https://purl.org/trak/metamodel/vocab#">
  <ns1:Ontology rdf:about="">
    <ns2:preferredNamespacePrefix rdf:datatype="http://www.w3.org/2001/XMLSchema#string">trak</ns2:preferredNamespacePrefix>
    <ns2:preferredNamespaceUri rdf:resource="" />
    ...
  </ns1:Class> 

The problem is that the base namespace uri that formed the value for ns2:preferredNamespaceUri has been replaced leaving a null / empty value which isn't equivalent to the base uri.

How do I get around this to produce the equivalent of the Turtle vann:preferredNamespaceUri statement? I can obviously manually correct after output but this doesn't seem like the right approach.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions