Skip to content

Turtle serializer outputs undeclared prefix with same domain base #3160

@rodrigosetti

Description

@rodrigosetti

Reproducing code (v8.0.0a0):

from rdflib import Graph, URIRef, Literal

g = Graph()
g.add(
    (
        URIRef("https://example.com/subject"),
        URIRef("https://example.com/p/predicate"),
        Literal("object"),
    )
)
print(g.serialize(format="turtle", base="https://example.com/"))
@base <[https://example.com/>](https://example.com/%3E) .
@prefix ns1: <[https://example.com/p/>](https://example.com/p/%3E) .

<subject> ns2:predicate "object" .

Please note "ns1" declared, but "ns2" used in the triple.

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