Comments (2)
As a workaround you can write your second prefix directly into the default memory store.
from rdflib import Graph, Namespace, URIRef
EX = Namespace("http://example.org/")
g = Graph(bind_namespaces="none")
g.bind("ex", EX)
g.store._Memory__namespace["ex1"] = URIRef("http://example.org/")
print(list(g.namespaces()))
#[('ex', rdflib.term.URIRef('http://example.org/')), ('ex1', rdflib.term.URIRef('http://example.org/'))]
I havent tested this any further. So dont know if there will be any problems or other stores will behave in the same manner.
from rdflib.
The base issue could be a real one and I will look into it when I'm back from holidays in a few weeks.
But the multi prefixes one is not! Sure, it's not a violation to want to have multiple prefixes for the same namespace and you do see it in data but prefixes are just presentation conveniences and I think that too much catering for every possible use of them overemphasises their role. They are not real data things and a single prefix for a namespace will always work, even when multiple are originally supplied in the data, or defined as per your code above.
So I'm not motivated to solve this one. And there is indeed a work around.
If it's really important to you, @hsekol-hub, please feel free to create a Pull Request to address it yourself.
from rdflib.
Related Issues (20)
- Unable to embed rdflib in a python extension
- Bug when using FROM statements HOT 4
- Bug: Comparison and arithmetic on xsd:duration HOT 1
- SPARQL Subquey parse error HOT 5
- typo in Container method name: type_of_conatiner --> type_of_container
- Turning rdflib jsonld into a "full processor" (a.o. for schema.org compliance) HOT 3
- Incorrect working when deleting triplets in a BerkeleyDB store HOT 1
- Graph.parse: Guess format when remote source content type is "text/plain"
- Optional skolemize blank nodes on parse HOT 3
- json-ld serialize doesnt failt or raise warning, when producing invalid syntax; type is literal HOT 7
- FAILED test/test_misc/test_parse_file_guess_format.py::TestFileParserGuessFormat::test_warning HOT 2
- RFE: move away from deprecated `html5lib` HOT 1
- BUG : jsonld parser does not randomise bnodes when using local _prefixed identifiers `"@id": "_:mybnode01"` HOT 1
- Adding a value as a list to the graph HOT 4
- Bug in `longturtle` serialization HOT 2
- Unexpected recursive context inclusion exception HOT 2
- Bug: Unexpected namespace creation during turtle file serialization HOT 4
- Using `orjson` instead of default `json` library HOT 1
- Error when parsing turtle file
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rdflib.