Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle namespaces that end in an underscore in turtle serializer #632

Closed
kshefchek opened this issue May 14, 2016 · 2 comments
Closed

Handle namespaces that end in an underscore in turtle serializer #632

kshefchek opened this issue May 14, 2016 · 2 comments
Assignees
Labels
enhancement New feature or request serialization Related to serialization.

Comments

@kshefchek
Copy link

kshefchek commented May 14, 2016

Consider the following:

   from rdflib import Graph, URIRef

   graph = Graph()
   graph.bind('GENO', 'http://purl.obolibrary.org/obo/GENO_')
   graph.bind('RO', 'http://purl.obolibrary.org/obo/RO_')

   graph.add((URIRef('http://example.org'),
                     URIRef('http://purl.obolibrary.org/obo/RO_0002200'),
                     URIRef('http://purl.obolibrary.org/obo/GENO_0000385')))

   print(graph.serialize(format='turtle'))

Outputs:

    @prefix GENO: <http://purl.obolibrary.org/obo/GENO_> .
    @prefix RO: <http://purl.obolibrary.org/obo/RO_> .
    @prefix ns1: <http://purl.obolibrary.org/obo/> .
    @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
    @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
    @prefix xml: <http://www.w3.org/XML/1998/namespace> .
    @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

   <http://example.org> ns1:RO_0002200 ns1:GENO_0000385 .

This appears to be handled in the namespace module: https://github.com/RDFLib/rdflib/blob/master/rdflib/namespace.py#L485

Is this a bug or am I misunderstanding the turtle specs?

@satra
Copy link
Contributor

satra commented Oct 19, 2016

this is also the same issue reported here: trungdong/prov#96

@kshefchek
Copy link
Author

this looks to be fixed in 5.0 via #649

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request serialization Related to serialization.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants