-
Notifications
You must be signed in to change notification settings - Fork 555
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
Add fragment property to URIRef #1991
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm ok with this without tests as it's just passing on an existing function from urlparse().
I try to never use hash URIs with fragments but if you do use them, I can see this might be nice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup, straightforward enough to merge.
pre-commit.ci autofix |
for more information, see https://pre-commit.ci
aaaand ... nice work, btw 😄 |
Awesome! And now, when will this be merged? And released to pip? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this is useful, it is also a bit arbitrary, as we don't have scheme, netloc, path, params or query. But I think on balance it does not really do any harm to include it, and we can just deprecate it if it does cause problems down the line.
@ottokruse thanks for the PR, we plan to make the next release around the middle of July. |
Summary of changes
Added a property
fragment
toURIRef
so it is easy to access the URI's fragment:Why is this useful?
The non-fragment part of the URI often just serves a namespace purpose, e.g.
https://brickschema.org/schema/Brick#
.Actual "things" use that namespace, and have the "thing" name as the fragment, e.g.
https://brickschema.org/schema/Brick#Valve_Position_Sensor
For display purposes, it's nice to get to the "thing" name, i.e. the fragment easily.
TODO: update docs and tests. I'll do that if you deem this PR is useful.
Checklist
the same change.
so maintainers can fix minor issues and keep your PR up to date.