Skip to content

[rdf] Changes to core#113

Merged
mpsonntag merged 4 commits into
G-Node:dev-odml-rdffrom
rickskyy:core-changes
Jul 20, 2017
Merged

[rdf] Changes to core#113
mpsonntag merged 4 commits into
G-Node:dev-odml-rdffrom
rickskyy:core-changes

Conversation

@rickskyy

@rickskyy rickskyy commented Jul 18, 2017

Copy link
Copy Markdown
Collaborator

This PR mainly includes some changes to doc, section, property and format modules.

  1. add uuids to the model
  2. add format.rdf_map for binding namespaces for predicates' creation.
  3. some relevant changes to xmlparser.py
  4. add rdflib to setup.py and travis.yml

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.4%) to 76.88% when pulling 1c80fd9 on rickskyy:core-changes into f204696 on G-Node:dev-odml-rdf.

@achilleas-k achilleas-k left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a comment regarding setting IDs.

Comment thread odml/doc.py Outdated

@id.setter
def id(self, new_value):
self._id = new_value

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the id setter check if new_value is a valid UUID4, or are we OK with it being anything?

More generally, do we even need a setter? I generally find that setting unique identifiers, especially ones that aren't exposed for normal use (i.e., we don't expect users to be manipulating IDs; they're just used internally for identification of objects), shouldn't be settable. They are generated on instantiation and beyond that they're read-only. There may be cases where setting is desirable, but I'd like to hear arguments for that. Also, since this is python, if one really really wants to set an ID (say, for testing) it's still possible by simply accessing the private member. By not having a property setter, we'd be signalling that IDs shouldn't be changed.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you are right, we do not need the setter so far. While developing I used to think we would use it, but now it is clear that it is redundant.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only problem is that than the xmlparser should be modified. Since it uses setattr(obj, k, v), we should include special case for ids.

Comment thread .travis.yml

after_success:
- if [ $COVERALLS = 1 ]; then coveralls; fi;
- if [ $COVERALLS = 1 ]; then coveralls; fi; No newline at end of file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep the newline at the end of each file. :)

@mpsonntag mpsonntag Jul 18, 2017

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aaaah, thats not PEP8 conform, never mind then, my bad, ignore comment!

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.3%) to 76.816% when pulling fba563c on rickskyy:core-changes into f204696 on G-Node:dev-odml-rdf.

Comment thread odml/doc.py

def __init__(self, author=None, date=None, version=None, repository=None):
def __init__(self, author=None, date=None, version=None, repository=None, id=None):
super(BaseDocument, self).__init__()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any passed id is actually ignored, isn't it? Same for BaseSection/Document the id is always initialized with a fresh uuid.uuid4()

@rickskyy rickskyy Jul 19, 2017

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, yes, I think I should remove them from all constructors, since we are only passing ids through parsers. Am I right? I added them to constructor when I was using setters, so now they do not make sense. The general question though - could users actually create objects with their ids?

@mpsonntag mpsonntag merged commit 89e7c80 into G-Node:dev-odml-rdf Jul 20, 2017
@rickskyy rickskyy deleted the core-changes branch August 7, 2017 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants