Skip to content

Turtle serializer auto-generates prefixes for predicates containing the base URI #3237

@bulricht

Description

@bulricht
from rdflib import Graph, Namespace, URIRef mns = Namespace("http://my-namespace.net/") g = Graph(base="http://my-base.net/") g.add((mns.foo, URIRef("http://my-base.net/my-predicate"), mns.bar)) print(g.serialize(format="text/turtle"))

Prints the following (with redundant ns1 prefix):

@base <http://my-base.net/> . @prefix ns1: <http://my-base.net/> . <http://my-namespace.net/foo> <my-predicate> <http://my-namespace.net/bar> .

While the expected output is:

@base <http://my-base.net/> . <http://my-namespace.net/foo> <my-predicate> <http://my-namespace.net/bar> .

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