Skip to content

Commit 8ac2004

Browse files
committed
Do not ignore module-level SLME parameters.
Declare the module-level `module_type_slme` and `slme_individuals` options to be None by default. This way, we can detect whether those options have been explicitly set for a given individual module, and if so, use their values instead of using the values from the group level. Then, we can detect whether the SLME type of an individual module is different from the group-level SLME type, and make sure we generate a specific rule for that module in that case. closes #1204
1 parent 3e5aa45 commit 8ac2004

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

odk/odk.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,13 @@ class ImportProduct(Product):
144144
module_type : Optional[str] = None
145145
"""Module type. Supported: slme, minimal, custom, mirror"""
146146

147-
module_type_slme : str = "BOT"
147+
module_type_slme : Optional[str] = None
148148
"""SLME module type. Supported: BOT, TOP, STAR"""
149149

150150
annotation_properties : List[str] = field(default_factory=lambda: ['rdfs:label', 'IAO:0000115', 'OMO:0002000'])
151151
"""Define which annotation properties to pull in."""
152152

153-
slme_individuals : str = "include"
153+
slme_individuals : Optional[str] = None
154154
"""See http://robot.obolibrary.org/extract#syntactic-locality-module-extractor-slme"""
155155

156156
use_base: bool = False
@@ -388,17 +388,22 @@ def _derive_fields(self):
388388
self.special_products = []
389389
for p in self.products:
390390
if p.module_type is None:
391-
# Use group-level parameters
391+
# Use group-level module type
392392
p.module_type = self.module_type
393-
p.module_type_slme = self.module_type_slme
394-
p.slme_individuals = self.slme_individuals
395393
elif p.module_type == 'fast_slme':
396394
# Accept fast_slme as a synonym for slme, for backwards
397395
# compatibility
398396
p.module_type = 'slme'
397+
if p.module_type == 'slme':
398+
# Use group-level SLME parameters unless overriden
399+
if p.module_type_slme is None:
400+
p.module_type_slme = self.module_type_slme
401+
if p.slme_individuals is None:
402+
p.slme_individuals = self.slme_individuals
399403
if p.base_iris is None:
400404
p.base_iris = [ 'http://purl.obolibrary.org/obo/' + p.id.upper() ]
401-
if p.is_large or p.module_type != self.module_type:
405+
if (p.is_large or p.module_type != self.module_type or
406+
(p.module_type == 'slme' and p.module_type_slme != self.module_type_slme)):
402407
# This module will require a distinct rule
403408
self.special_products.append(p)
404409

0 commit comments

Comments
 (0)