Refactoring of repository-attribute handling
- Vorherrschende Sprache
- Python
- Sterne
- 25
- Forks
- 30
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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
```
Beitragsleitfaden
Bewertung
Dieses Issue wurde noch nicht bewertet.