Skip to content

Serialization shows only partial substitution of namespace. #977

@dannmartens

Description

@dannmartens

I noticed something strange when serializing a graph to turtle, after binding a namespace prefix in code, the output shows a mix of prefix notation and full IRIs. I am using 4.2.2. While developing this part of the app, I noticed that in the output, the substitution comes and goes in an unpredictable manner.

In code:

graph.namespace_manager.bind('mbse', URIRef('http://example.com/onto/v1/mbse#'))
graph.namespace_manager.bind('requirements', URIRef('http://example.com/api/v1/requirements/'))

Now, look at the "requirements" prefix:

@prefix co: <http://purl.org/co/> .
@prefix mbse: <http://example.com/onto/v1/mbse#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix requirements: <http://example.com/api/v1/requirements/> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<http://example.com/api/v1/requirements/92c6e875-c721-4b2c-82ab-076de020d97e> a mbse:Requirement,
        owl:NamedIndidual ;
    co:member <http://example.com/api/v1/requirements/131fe437-5b49-4ab0-bee5-5ad5b0aa7a2f>,
        <http://example.com/api/v1/requirements/238f0f5d-28d6-4349-861d-d1d3a0cb3ce6>,
        <http://example.com/api/v1/requirements/42d6cd38-6858-48a8-88a6-db886eaf3bea>,
        <http://example.com/api/v1/requirements/4e33d5ee-5494-48a6-8aaa-d86240eecfbe>,
        <http://example.com/api/v1/requirements/5990ebbb-7023-4a4e-9bb6-34aff2bb6599>,
        <http://example.com/api/v1/requirements/708ef762-0c7e-4a11-84a3-4f84ddd28d42>,
        <http://example.com/api/v1/requirements/78ea66bc-ff55-4ffc-8c3d-a931c52e6811>,
        <http://example.com/api/v1/requirements/7e24a77f-cf1b-4285-b53b-e86230927a74>,
        <http://example.com/api/v1/requirements/8e410082-b85b-4184-8728-75f404415469>,
        requirements:a130d8ff-4482-4ffa-89c1-93da3e9fdf75,
        requirements:f384f799-4eac-44f2-b131-c1d47672fb55,
        requirements:f5252fbf-fe18-4959-a4a5-1a9b7b18dd0b,
        requirements:ff701a5d-dad6-41e8-8601-6651826245d4 .

Only a few are substituted: I can't make any sense of this behaviour.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingserializationRelated to serialization.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions