G-Node / G-Node/python-odml

Refactoring of repository-attribute handling

Ouverte
#133 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
terminology
Langage dominant
Python
Étoiles
25
Forks
30
Métriques de merge des PR
Aucune PR mergée en 30 j

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
```

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.