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

Use own namespace for cuds object #739

Open
paulzierep opened this issue Dec 13, 2021 · 1 comment
Open

Use own namespace for cuds object #739

paulzierep opened this issue Dec 13, 2021 · 1 comment
Labels
❔ question 🌱 new feature Solving the issue involves the incorporation of a new feature. ⚡ breaking change Solution introduces incompatible API changes, MAJOR version number update. See https://semver.org.
Milestone

Comments

@paulzierep
Copy link

Is there a way to use a custom namespace for CUDS objects, or do they need to have the http://www.osp-core.com/cuds namespace ?

@kysrpex
Copy link
Contributor

kysrpex commented Dec 13, 2021

Yes and no.

The default namespace is not changeable, but you can achieve a similar effect with this code.

from uuid import uuid4

from osp.core.namespaces import city

unknown_city = city.City(name='Unknown city', 
                         iri=f'http://mysubdomain.example.org/cities#{uuid4()}')
unknown_city.iri
Out[2]: rdflib.term.URIRef('http://mysubdomain.example.org/cities#ee0e4a26-d0f7-4974-8880-b86abbcf0d4b')

I reckon that having to set the iri every time you create a new CUDS object is not ideal.

I will leave the issue open so that this is addressed in the future.

@kysrpex kysrpex added ❔ question 🌱 new feature Solving the issue involves the incorporation of a new feature. ⚡ breaking change Solution introduces incompatible API changes, MAJOR version number update. See https://semver.org. labels Dec 13, 2021
@kysrpex kysrpex added this to the v4.0.0 milestone Jan 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
❔ question 🌱 new feature Solving the issue involves the incorporation of a new feature. ⚡ breaking change Solution introduces incompatible API changes, MAJOR version number update. See https://semver.org.
Projects
None yet
Development

No branches or pull requests

2 participants