pymetadata 0.5.5__tar.gz → 0.5.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of pymetadata might be problematic. Click here for more details.

Files changed (135) hide show
  1. {pymetadata-0.5.5 → pymetadata-0.5.7}/.bumpversion.toml +1 -1
  2. {pymetadata-0.5.5 → pymetadata-0.5.7}/PKG-INFO +3 -18
  3. {pymetadata-0.5.5 → pymetadata-0.5.7}/README.md +2 -17
  4. pymetadata-0.5.7/release-notes/0.5.6.md +10 -0
  5. pymetadata-0.5.7/release-notes/0.5.7.md +10 -0
  6. {pymetadata-0.5.5 → pymetadata-0.5.7}/src/pymetadata/__init__.py +1 -1
  7. {pymetadata-0.5.5 → pymetadata-0.5.7}/src/pymetadata/core/annotation.py +46 -35
  8. {pymetadata-0.5.5 → pymetadata-0.5.7}/tests/core/test_annotation.py +15 -0
  9. {pymetadata-0.5.5 → pymetadata-0.5.7}/.github/workflows/main.yml +0 -0
  10. {pymetadata-0.5.5 → pymetadata-0.5.7}/.github/workflows/mypy.yml +0 -0
  11. {pymetadata-0.5.5 → pymetadata-0.5.7}/.github/workflows/ruff.yml +0 -0
  12. {pymetadata-0.5.5 → pymetadata-0.5.7}/.gitignore +0 -0
  13. {pymetadata-0.5.5 → pymetadata-0.5.7}/.pre-commit-config.yaml +0 -0
  14. {pymetadata-0.5.5 → pymetadata-0.5.7}/.python-version +0 -0
  15. {pymetadata-0.5.5 → pymetadata-0.5.7}/.ruff.toml +0 -0
  16. {pymetadata-0.5.5 → pymetadata-0.5.7}/.zenodo.json +0 -0
  17. {pymetadata-0.5.5 → pymetadata-0.5.7}/LICENSE +0 -0
  18. {pymetadata-0.5.5 → pymetadata-0.5.7}/RELEASE.md +0 -0
  19. {pymetadata-0.5.5 → pymetadata-0.5.7}/docs/composite_annotations.md +0 -0
  20. {pymetadata-0.5.5 → pymetadata-0.5.7}/docs/images/favicon/about.txt +0 -0
  21. {pymetadata-0.5.5 → pymetadata-0.5.7}/docs/images/favicon/android-chrome-192x192.png +0 -0
  22. {pymetadata-0.5.5 → pymetadata-0.5.7}/docs/images/favicon/android-chrome-512x512.png +0 -0
  23. {pymetadata-0.5.5 → pymetadata-0.5.7}/docs/images/favicon/apple-touch-icon.png +0 -0
  24. {pymetadata-0.5.5 → pymetadata-0.5.7}/docs/images/favicon/favicon-16x16.png +0 -0
  25. {pymetadata-0.5.5 → pymetadata-0.5.7}/docs/images/favicon/favicon-32x32.png +0 -0
  26. {pymetadata-0.5.5 → pymetadata-0.5.7}/docs/images/favicon/favicon.ico +0 -0
  27. {pymetadata-0.5.5 → pymetadata-0.5.7}/docs/images/favicon/favicon_io.zip +0 -0
  28. {pymetadata-0.5.5 → pymetadata-0.5.7}/docs/images/favicon/pymetadata-100x100-300dpi.png +0 -0
  29. {pymetadata-0.5.5 → pymetadata-0.5.7}/docs/images/favicon/site.webmanifest +0 -0
  30. {pymetadata-0.5.5 → pymetadata-0.5.7}/pyproject.toml +0 -0
  31. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.0.10.md +0 -0
  32. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.0.11.md +0 -0
  33. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.0.12.md +0 -0
  34. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.0.13.md +0 -0
  35. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.0.14.md +0 -0
  36. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.0.15.md +0 -0
  37. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.0.16.md +0 -0
  38. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.0.17.md +0 -0
  39. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.0.18.md +0 -0
  40. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.0.19.md +0 -0
  41. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.0.2.md +0 -0
  42. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.0.20.md +0 -0
  43. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.0.21.md +0 -0
  44. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.0.22.md +0 -0
  45. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.0.3.md +0 -0
  46. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.0.4.md +0 -0
  47. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.0.5.md +0 -0
  48. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.0.6.md +0 -0
  49. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.0.7.md +0 -0
  50. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.0.8.md +0 -0
  51. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.0.9.md +0 -0
  52. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.1.0.md +0 -0
  53. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.2.1.md +0 -0
  54. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.2.10.md +0 -0
  55. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.2.2.md +0 -0
  56. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.2.3.md +0 -0
  57. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.2.4.md +0 -0
  58. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.2.5.md +0 -0
  59. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.2.6.md +0 -0
  60. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.2.7.md +0 -0
  61. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.2.8.md +0 -0
  62. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.2.9.md +0 -0
  63. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.3.0.md +0 -0
  64. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.3.1.md +0 -0
  65. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.3.10.md +0 -0
  66. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.3.11.md +0 -0
  67. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.3.2.md +0 -0
  68. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.3.3.md +0 -0
  69. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.3.4.md +0 -0
  70. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.3.5.md +0 -0
  71. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.3.6.md +0 -0
  72. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.3.7.md +0 -0
  73. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.3.8.md +0 -0
  74. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.3.9.md +0 -0
  75. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.4.0.md +0 -0
  76. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.4.1.md +0 -0
  77. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.4.2.md +0 -0
  78. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.4.3.md +0 -0
  79. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.4.4.md +0 -0
  80. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.5.0.md +0 -0
  81. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.5.1.md +0 -0
  82. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.5.2.md +0 -0
  83. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.5.3.md +0 -0
  84. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.5.4.md +0 -0
  85. {pymetadata-0.5.5 → pymetadata-0.5.7}/release-notes/0.5.5.md +0 -0
  86. {pymetadata-0.5.5 → pymetadata-0.5.7}/src/pymetadata/cache.py +0 -0
  87. {pymetadata-0.5.5 → pymetadata-0.5.7}/src/pymetadata/chebi.py +0 -0
  88. {pymetadata-0.5.5 → pymetadata-0.5.7}/src/pymetadata/console.py +0 -0
  89. {pymetadata-0.5.5 → pymetadata-0.5.7}/src/pymetadata/core/__init__.py +0 -0
  90. {pymetadata-0.5.5 → pymetadata-0.5.7}/src/pymetadata/core/creator.py +0 -0
  91. {pymetadata-0.5.5 → pymetadata-0.5.7}/src/pymetadata/core/synonym.py +0 -0
  92. {pymetadata-0.5.5 → pymetadata-0.5.7}/src/pymetadata/core/xref.py +0 -0
  93. {pymetadata-0.5.5 → pymetadata-0.5.7}/src/pymetadata/examples/__init__.py +0 -0
  94. {pymetadata-0.5.5 → pymetadata-0.5.7}/src/pymetadata/examples/cache_path_example.py +0 -0
  95. {pymetadata-0.5.5 → pymetadata-0.5.7}/src/pymetadata/examples/omex_example.py +0 -0
  96. {pymetadata-0.5.5 → pymetadata-0.5.7}/src/pymetadata/examples/results/test_from_files.omex +0 -0
  97. {pymetadata-0.5.5 → pymetadata-0.5.7}/src/pymetadata/examples/results/test_from_omex.omex +0 -0
  98. {pymetadata-0.5.5 → pymetadata-0.5.7}/src/pymetadata/examples/results/testomex/README.md +0 -0
  99. {pymetadata-0.5.5 → pymetadata-0.5.7}/src/pymetadata/examples/results/testomex/manifest.xml +0 -0
  100. {pymetadata-0.5.5 → pymetadata-0.5.7}/src/pymetadata/examples/results/testomex/models/omex_comp.xml +0 -0
  101. {pymetadata-0.5.5 → pymetadata-0.5.7}/src/pymetadata/examples/results/testomex/models/omex_comp_flat.xml +0 -0
  102. {pymetadata-0.5.5 → pymetadata-0.5.7}/src/pymetadata/examples/results/testomex/models/omex_minimal.xml +0 -0
  103. {pymetadata-0.5.5 → pymetadata-0.5.7}/src/pymetadata/examples/test.omex +0 -0
  104. {pymetadata-0.5.5 → pymetadata-0.5.7}/src/pymetadata/identifiers/__init__.py +0 -0
  105. {pymetadata-0.5.5 → pymetadata-0.5.7}/src/pymetadata/identifiers/miriam.py +0 -0
  106. {pymetadata-0.5.5 → pymetadata-0.5.7}/src/pymetadata/identifiers/registry.py +0 -0
  107. {pymetadata-0.5.5 → pymetadata-0.5.7}/src/pymetadata/log.py +0 -0
  108. {pymetadata-0.5.5 → pymetadata-0.5.7}/src/pymetadata/metadata/__init__.py +0 -0
  109. {pymetadata-0.5.5 → pymetadata-0.5.7}/src/pymetadata/metadata/eco.py +0 -0
  110. {pymetadata-0.5.5 → pymetadata-0.5.7}/src/pymetadata/metadata/kisao.py +0 -0
  111. {pymetadata-0.5.5 → pymetadata-0.5.7}/src/pymetadata/metadata/sbo.py +0 -0
  112. {pymetadata-0.5.5 → pymetadata-0.5.7}/src/pymetadata/omex.py +0 -0
  113. {pymetadata-0.5.5 → pymetadata-0.5.7}/src/pymetadata/omex_v2.py +0 -0
  114. {pymetadata-0.5.5 → pymetadata-0.5.7}/src/pymetadata/ontologies/__init__.py +0 -0
  115. {pymetadata-0.5.5 → pymetadata-0.5.7}/src/pymetadata/ontologies/ols.py +0 -0
  116. {pymetadata-0.5.5 → pymetadata-0.5.7}/src/pymetadata/ontologies/ontology.py +0 -0
  117. {pymetadata-0.5.5 → pymetadata-0.5.7}/src/pymetadata/py.typed +0 -0
  118. {pymetadata-0.5.5 → pymetadata-0.5.7}/src/pymetadata/resources/ontologies/README.md +0 -0
  119. {pymetadata-0.5.5 → pymetadata-0.5.7}/src/pymetadata/resources/templates/ontology_enum.pytemplate +0 -0
  120. {pymetadata-0.5.5 → pymetadata-0.5.7}/src/pymetadata/unichem.py +0 -0
  121. {pymetadata-0.5.5 → pymetadata-0.5.7}/tests/core/test_creator.py +0 -0
  122. {pymetadata-0.5.5 → pymetadata-0.5.7}/tests/data/omex/BIOMD0000000001.omex +0 -0
  123. {pymetadata-0.5.5 → pymetadata-0.5.7}/tests/data/omex/CombineArchiveShowCase.omex +0 -0
  124. {pymetadata-0.5.5 → pymetadata-0.5.7}/tests/data/omex/CombineArchiveShowCase_manifest.xml +0 -0
  125. {pymetadata-0.5.5 → pymetadata-0.5.7}/tests/data/omex/CompModels.omex +0 -0
  126. {pymetadata-0.5.5 → pymetadata-0.5.7}/tests/data/omex/CompModels_manifest.xml +0 -0
  127. {pymetadata-0.5.5 → pymetadata-0.5.7}/tests/data/omex/iCGB21FR.omex +0 -0
  128. {pymetadata-0.5.5 → pymetadata-0.5.7}/tests/test_chebi.py +0 -0
  129. {pymetadata-0.5.5 → pymetadata-0.5.7}/tests/test_ols.py +0 -0
  130. {pymetadata-0.5.5 → pymetadata-0.5.7}/tests/test_omex.py +0 -0
  131. {pymetadata-0.5.5 → pymetadata-0.5.7}/tests/test_ontology.py +0 -0
  132. {pymetadata-0.5.5 → pymetadata-0.5.7}/tests/test_registry.py +0 -0
  133. {pymetadata-0.5.5 → pymetadata-0.5.7}/tests/test_sbo_kisao.py +0 -0
  134. {pymetadata-0.5.5 → pymetadata-0.5.7}/tests/test_unichem.py +0 -0
  135. {pymetadata-0.5.5 → pymetadata-0.5.7}/tox.ini +0 -0
@@ -1,5 +1,5 @@
1
1
  [tool.bumpversion]
2
- current_version = "0.5.5"
2
+ current_version = "0.5.7"
3
3
  commit = true
4
4
  parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
5
5
  serialize = ["{major}.{minor}.{patch}"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pymetadata
3
- Version: 0.5.5
3
+ Version: 0.5.7
4
4
  Summary: pymetadata are python utilities for working with metadata.
5
5
  Author-email: Matthias König <konigmatt@googlemail.com>
6
6
  Maintainer-email: Matthias König <konigmatt@googlemail.com>
@@ -53,9 +53,9 @@ metadata in the context of COMBINE standards with source code available from
53
53
 
54
54
  Features include among others
55
55
 
56
- - [core](src/pymetadata/core)COMBINE archive version 1 support (OMEX)
56
+ - COMBINE archive version 1 support (OMEX)
57
57
  - annotation classes and helpers
58
- - SBO and KISAO ontology enums
58
+ - SBO, KISAO and ECO ontology enums
59
59
 
60
60
  If you have any questions or issues please [open an issue](https://github.com/matthiaskoenig/pymetadata/issues).
61
61
 
@@ -66,8 +66,6 @@ see [omex_example.py](src/pymetadata/examples/omex_example.py).
66
66
  # How to cite
67
67
  [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.5308801.svg)](https://doi.org/10.5281/zenodo.5308801)
68
68
 
69
- # Contributing
70
- Contributions are always welcome! Please read the [contributing guidelines](https://github.com/matthiaskoenig/pymetadata/blob/develop/.github/CONTRIBUTING.rst) to get started.
71
69
 
72
70
  # License
73
71
  - Source Code: [MIT](https://opensource.org/license/MIT)
@@ -84,19 +82,6 @@ can be installed via
84
82
  pip install pymetadata
85
83
  ```
86
84
 
87
- ## Develop version
88
- The latest develop version can be installed via
89
- ```bash
90
- pip install git+https://github.com/matthiaskoenig/pymetadata.git@develop
91
- ```
92
-
93
- Or via cloning the repository and installing via
94
- ```bash
95
- git clone https://github.com/matthiaskoenig/pymetadata.git
96
- cd pymetadata
97
- pip install -e .
98
- ```
99
-
100
85
  # Cache path
101
86
  `pymetadata` caches some information for faster retrieval. The cache path is set to
102
87
 
@@ -13,9 +13,9 @@ metadata in the context of COMBINE standards with source code available from
13
13
 
14
14
  Features include among others
15
15
 
16
- - [core](src/pymetadata/core)COMBINE archive version 1 support (OMEX)
16
+ - COMBINE archive version 1 support (OMEX)
17
17
  - annotation classes and helpers
18
- - SBO and KISAO ontology enums
18
+ - SBO, KISAO and ECO ontology enums
19
19
 
20
20
  If you have any questions or issues please [open an issue](https://github.com/matthiaskoenig/pymetadata/issues).
21
21
 
@@ -26,8 +26,6 @@ see [omex_example.py](src/pymetadata/examples/omex_example.py).
26
26
  # How to cite
27
27
  [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.5308801.svg)](https://doi.org/10.5281/zenodo.5308801)
28
28
 
29
- # Contributing
30
- Contributions are always welcome! Please read the [contributing guidelines](https://github.com/matthiaskoenig/pymetadata/blob/develop/.github/CONTRIBUTING.rst) to get started.
31
29
 
32
30
  # License
33
31
  - Source Code: [MIT](https://opensource.org/license/MIT)
@@ -44,19 +42,6 @@ can be installed via
44
42
  pip install pymetadata
45
43
  ```
46
44
 
47
- ## Develop version
48
- The latest develop version can be installed via
49
- ```bash
50
- pip install git+https://github.com/matthiaskoenig/pymetadata.git@develop
51
- ```
52
-
53
- Or via cloning the repository and installing via
54
- ```bash
55
- git clone https://github.com/matthiaskoenig/pymetadata.git
56
- cd pymetadata
57
- pip install -e .
58
- ```
59
-
60
45
  # Cache path
61
46
  `pymetadata` caches some information for faster retrieval. The cache path is set to
62
47
 
@@ -0,0 +1,10 @@
1
+ # Release notes for pymetadata 0.5.6
2
+ ![pymetadata](https://github.com/matthiaskoenig/pymetadata/raw/develop/docs/images/favicon/pymetadata-100x100-300dpi.png)
3
+
4
+ We are pleased to release the next version of pymetadata including the
5
+ following changes:
6
+
7
+ ## Features & fixes
8
+ - bugfix compact ids when id starts with namespace
9
+
10
+ Your pymetadata team
@@ -0,0 +1,10 @@
1
+ # Release notes for pymetadata 0.5.7
2
+ ![pymetadata](https://github.com/matthiaskoenig/pymetadata/raw/develop/docs/images/favicon/pymetadata-100x100-300dpi.png)
3
+
4
+ We are pleased to release the next version of pymetadata including the
5
+ following changes:
6
+
7
+ ## Features & fixes
8
+ - bugfix for doi of the form https://identifiers.org/DOI:10.1016/j.jtbi.2004.04.039
9
+
10
+ Your pymetadata team
@@ -3,7 +3,7 @@
3
3
  from pathlib import Path
4
4
 
5
5
  __author__ = "Matthias Koenig"
6
- __version__ = "0.5.5"
6
+ __version__ = "0.5.7"
7
7
 
8
8
 
9
9
  program_name: str = "pymetadata"
@@ -22,8 +22,12 @@ from pymetadata.ontologies.ols import ONTOLOGIES, OLSQuery
22
22
  OLS_QUERY = OLSQuery(ontologies=ONTOLOGIES)
23
23
 
24
24
  IDENTIFIERS_ORG_PREFIX: Final = "https://identifiers.org"
25
- IDENTIFIERS_ORG_PATTERN1: Final = re.compile(r"^https?://identifiers.org/(.+?)/(.+)")
26
- IDENTIFIERS_ORG_PATTERN2: Final = re.compile(r"^https?://identifiers.org/(.+)")
25
+ IDENTIFIERS_ORG_PATTERN_COMPACT: Final = re.compile(
26
+ r"^https?://identifiers.org/([a-zA-Z0-9.]+):(.+)"
27
+ )
28
+ IDENTIFIERS_ORG_PATTERN_CLASSIC: Final = re.compile(
29
+ r"^https?://identifiers.org/([a-zA-Z0-9.]+)/(.+)"
30
+ )
27
31
 
28
32
  BIOREGISTRY_PREFIX: Final = "https://bioregistry.io"
29
33
  BIOREGISTRY_PATTERN: Final = re.compile(r"^https?://bioregistry.io/(.+)")
@@ -62,7 +66,9 @@ class RDFAnnotation:
62
66
  "biomodels.sbo": "sbo",
63
67
  }
64
68
 
65
- def __init__(self, qualifier: Union[BQB, BQM], resource: str):
69
+ def __init__(
70
+ self, qualifier: Union[BQB, BQM], resource: str, validate: bool = True
71
+ ):
66
72
  """Initialize RDFAnnotation."""
67
73
  self.qualifier: Union[BQB, BQM] = qualifier
68
74
  self.collection: Optional[str] = None
@@ -87,28 +93,19 @@ class RDFAnnotation:
87
93
 
88
94
  # handle urls
89
95
  if resource.startswith("http"):
90
- match1 = IDENTIFIERS_ORG_PATTERN1.match(resource)
91
- if match1:
92
- # handle identifiers.org pattern
93
- self.collection, self.term = match1.group(1), match1.group(2)
96
+ # tests new compact patterns
97
+ match_compact = IDENTIFIERS_ORG_PATTERN_COMPACT.match(resource)
98
+ if match_compact:
99
+ self.collection = match_compact.group(1).lower()
100
+ self.term = f"{match_compact.group(1)}:{match_compact.group(2)}"
94
101
  self.provider = ProviderType.IDENTIFIERS_ORG
95
102
 
96
103
  if not self.collection:
97
- # tests new compact patterns
98
- match2 = IDENTIFIERS_ORG_PATTERN2.match(resource)
99
- if match2:
100
- tokens = match2.group(1).split(":")
101
- if len(tokens) == 2:
102
- self.collection = tokens[0].lower()
103
-
104
- # check if the namespace is embedded
105
- self.term = match2.group(1)
106
- self.provider = ProviderType.IDENTIFIERS_ORG
107
- else:
108
- logger.warning(
109
- f"Identifiers.org URL does not conform to new"
110
- f"short pattern: {resource}"
111
- )
104
+ match_classic = IDENTIFIERS_ORG_PATTERN_CLASSIC.match(resource)
105
+ if match_classic:
106
+ self.collection = match_classic.group(1).lower()
107
+ self.term = match_classic.group(2)
108
+ self.provider = ProviderType.IDENTIFIERS_ORG
112
109
 
113
110
  if not self.collection:
114
111
  # other urls are directly stored as resources without collection
@@ -119,7 +116,7 @@ class RDFAnnotation:
119
116
  console.print(self.provider)
120
117
  else:
121
118
  self.provider = ProviderType.NONE
122
- logger.warning(
119
+ logger.debug(
123
120
  f"{resource} does not conform to "
124
121
  f"http(s)://identifiers.org/collection/id or http(s)://identifiers.org/id or "
125
122
  f"https://bioregistry.io/id .",
@@ -173,7 +170,8 @@ class RDFAnnotation:
173
170
  if self.collection in self.replaced_collections:
174
171
  self.collection = self.replaced_collections[self.collection]
175
172
 
176
- self.validate()
173
+ if validate:
174
+ self.validate()
177
175
 
178
176
  @staticmethod
179
177
  def shorten_compact_term(term: str, collection: str) -> str:
@@ -184,7 +182,7 @@ class RDFAnnotation:
184
182
  namespace = REGISTRY.ns_dict.get(collection, None)
185
183
  if namespace and not namespace.namespaceEmbeddedInLui:
186
184
  # shorter term
187
- if term.lower().startswith(collection):
185
+ if term.lower().startswith(f"{collection}:"):
188
186
  tokens = term.split(":")
189
187
  term = ":".join(tokens[1:])
190
188
 
@@ -242,15 +240,14 @@ class RDFAnnotation:
242
240
  m = p.match(term)
243
241
  if not m:
244
242
  logger.error(
245
- f"Term `{term}` did not match pattern "
246
- f"`{namespace.pattern}` for collection `{collection}`."
243
+ f"Term `{term}` did not match pattern `{namespace.pattern}` for collection `{collection}`."
247
244
  )
248
245
  return False
249
246
 
250
247
  return True
251
248
 
252
249
  @staticmethod
253
- def check_qualifier(qualifier: Union[BQB, BQM]) -> None:
250
+ def check_qualifier(qualifier: Union[BQB, BQM]) -> bool:
254
251
  """Check that the qualifier is an allowed qualifier.
255
252
 
256
253
  :param qualifier:
@@ -259,17 +256,23 @@ class RDFAnnotation:
259
256
  if not isinstance(qualifier, (BQB, BQM)):
260
257
  supported_qualifiers = [e.value for e in BQB] + [e.value for e in BQM]
261
258
 
262
- raise ValueError(
263
- f"qualifier `{qualifier}` is not in supported qualifiers: "
264
- f"`{supported_qualifiers}`"
259
+ logger.error(
260
+ f"qualifier `{qualifier}` is not in supported qualifiers: '{supported_qualifiers}'."
265
261
  )
262
+ return False
266
263
 
267
- def validate(self) -> None:
264
+ return True
265
+
266
+ def validate(self) -> bool:
268
267
  """Validate annotation."""
268
+ valid_qualifier: bool = False
269
269
  if self.qualifier:
270
- self.check_qualifier(self.qualifier)
270
+ valid_qualifier = self.check_qualifier(self.qualifier)
271
+ valid_term: bool = True
271
272
  if self.collection and self.term:
272
- self.check_term(collection=self.collection, term=self.term)
273
+ valid_term = self.check_term(collection=self.collection, term=self.term)
274
+
275
+ return valid_qualifier and valid_term
273
276
 
274
277
 
275
278
  class RDFAnnotationData(RDFAnnotation):
@@ -399,10 +402,18 @@ if __name__ == "__main__":
399
402
  for annotation in [
400
403
  RDFAnnotation(
401
404
  qualifier=BQB.IS_VERSION_OF,
402
- resource="https://bioregistry.io/chebi:15996",
405
+ resource="https://identifiers.org/DOI:10.1016/j.jtbi.2004.04.039",
403
406
  ),
404
407
  # RDFAnnotation(
405
408
  # qualifier=BQB.IS_VERSION_OF,
409
+ # resource="hmdb/HMDB0000122",
410
+ # ),
411
+ # RDFAnnotation(
412
+ # qualifier=BQB.IS_VERSION_OF,
413
+ # resource="https://bioregistry.io/chebi:15996",
414
+ # ),
415
+ # RDFAnnotation(
416
+ # qualifier=BQB.IS_VERSION_OF,
406
417
  # resource="NCIT:C75913",
407
418
  # ),
408
419
  # RDFAnnotation(
@@ -9,6 +9,11 @@ from pymetadata.identifiers.miriam import BQB, BQM
9
9
 
10
10
 
11
11
  rdf_annotation_data = [
12
+ (
13
+ BQB.IS,
14
+ "https://identifiers.org/DOI:10.1016/j.jtbi.2004.04.039",
15
+ "RDFAnnotation(BQB.IS|doi|10.1016/j.jtbi.2004.04.039|identifiers.org)",
16
+ ),
12
17
  (
13
18
  BQB.IS,
14
19
  "NCIT:C75913",
@@ -144,6 +149,16 @@ rdf_annotation_data = [
144
149
  "https://bioregistry.io/chebi:15996",
145
150
  "RDFAnnotation(BQB.IS|None|https://bioregistry.io/chebi:15996|bioregistry.io)",
146
151
  ),
152
+ (
153
+ BQB.IS,
154
+ "hmdb/HMDB0000122",
155
+ "RDFAnnotation(BQB.IS|hmdb|HMDB0000122|identifiers.org)",
156
+ ),
157
+ (
158
+ BQB.IS,
159
+ "hmdb:HMDB0000122",
160
+ "RDFAnnotation(BQB.IS|hmdb|HMDB0000122|identifiers.org)",
161
+ ),
147
162
  ]
148
163
 
149
164
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes