Refactoring of repository-attribute handling
- 主要言語
- Python
- スター
- 25
- フォーク
- 30
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
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
```
コントリビューションガイド
評価
この issue はまだ評価されていません。