-
Notifications
You must be signed in to change notification settings - Fork 10
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
Improved representation of blank nodes #283
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.
Looks nice. Smart to put the get_unabbreviated_triples in world.
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.
Cheers @jesper-friis.
I'd like to propose writing out BNode to BlankNode to not confuse with "binary" or something else.
I've tried to add a bit more description to it as well, feel free to adapt it as you please.
One final thing: It's quite unclear to me what blank_node
can be in the get_unabbreviated_triples()
methods. Should it be a string (as you do in __eq__()
or should it be a BlankNode
type? I'm pretty sure some of the code only works with one or the other - specifically the internal _unabbreviate()
function.
ontopy/ontology.py
Outdated
|
||
|
||
class BNode: | ||
"""Represents a blank node.""" |
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.
"""Represents a blank node.""" | |
"""A blank node. | |
A blank node is an ontology triple without any explicit content. | |
It is similar to the concept of programmatically allocating memory for a variable by first initiating it as an empty variable of the desired type. | |
""" |
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.
A bnode is a node, not a triple. I have pushed an updated description.
ontopy/ontology.py
Outdated
if i >= 0: | ||
return self._unabbreviate(i) | ||
elif bnode is None: | ||
return BNode(self, i) |
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.
return BNode(self, i) | |
return BlankNode(self, i) |
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.
Re-adding the now outdated comments from my recent review.
The idea is to represent blank nodes as BNode objects. However, since bnodes are local, it becomes tricky to compare them across imported ontologies. The purpose of introducing the |
@CasperWA @jesper-friis Please decide on whether we should have bnode or blank_node as variable, just make sure that we are consistent. I do not really have very strong preferences. I agree that blank_node is more understandable, but I do not like to long variable names as I find codes more difficult to read when they become long. The reason the tests fails now is because bnode is only changed to blank_node in one place. |
I tried to accept Casper's suggestions about renaming bnode to blank_node. The last inconsistencies are now removed. @CasperWA, are you happy to merge now? I kept |
Yes, please update this to |
Done. Changed "label" |
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.
Thanks @jesper-friis - I'll merge this in now.
Fixed inconsistensies in naming of blank nodes. Co-authored-by: Casper Welzel Andersen <43357585+CasperWA@users.noreply.github.com>
Description:
Ontology.__eq__()
.Type of change:
Checklist:
This checklist can be used as a help for the reviewer.
Comments: