G-Node / G-Node/python-odml

Refactoring of repository-attribute handling

Open
#133 0 comments 0 reactions 0 assignees View on GitHub
terminology
Dominant language
Python
Stars
25
Forks
30
PR merge metrics
No merged PRs in 30d

Description

The repository attribute should be handled automatically and not manually.
In the current implementation the repository can anyway only be used as an attribute in the generation function of a document and not of a section or property. A repository of a section or property can only be set by `object.repository = repo`.

A solution here is tightly connected to the suggested changes in how to access and use terminologies in #131. The behaviour I would like to have would look like the following (note: the following example is based on the example in #74):

```python
import odml.terminologies as term
doc1 = odml.Document("my_empty_doc")
doc1.repository
# output: nothing, because it can't be set manually
doc2 = term.get_terminology('http://portal.g-node.org/odml/terminologies/v1.0/terminologies.xml')
doc2.repository
# output: 'http://portal.g-node.org/odml/terminologies/v1.0/terminologies.xml'
doc2.sections[0].repository
# output: 'http://portal.g-node.org/odml/terminologies/v1.0/subject/subject.xml'

# for getting section/property equivalents of a terminology
sec1 = odml.Section("Subject", type="subject")
sec1.get_terminology_equivalent(repository="http://portal.g-node.org/odml/terminologies/v1.0/terminologies.xml")
# output: clone of section object "Subject" of the terminology
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.