Skip to content

Commit 03a204a

Browse files
authored
Fix inversion of mappings containing subject_type or object_type slots. (#595)
* Add missing slots to COLUMN_INVERT_DICTIONARY. Mapping inversion requires, among other things, to know which are the slots whose value must be inverted. For example, knowing that `subject_id` must be inverted with `object_id`, `subject_label` must be inverted with `object_label`, and so on. This knowledge is provided, in SSSOM-Py, in the `COLUMN_INVERT_DICTIONARY` map in the `sssom.constants` module. That map is missing the `subject_type` and `object_type` slots, resulting in SSSOM-Py being unable to invert any mapping set that contains one of those slots. We add the missing entries to the `COLUMN_INVERT_DICTIONARY` map. closes #554 * Add all "asymmetric" slots to the asymmetric test case. The test supposed to ensure that "asymmetric" mapping sets (sets that contain some `subject_*` columns without their `object_*` counterparts, or the other way round) only contains a couple of asymmetric slots. As a result, it didn't catch the problem caused by the absence of `subject_type` and `object_type` in the COLUMN_INVERT_DICTIONARY map. We fill the `asymmetric.tsv` set so that it contains _all_ the slots that require switching when a mapping set is inverted.
1 parent 744a36d commit 03a204a

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/sssom/constants.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,15 @@
158158
SUBJECT_SOURCE: OBJECT_SOURCE,
159159
SUBJECT_PREPROCESSING: OBJECT_PREPROCESSING,
160160
SUBJECT_SOURCE_VERSION: OBJECT_SOURCE_VERSION,
161+
SUBJECT_TYPE: OBJECT_TYPE,
161162
OBJECT_ID: SUBJECT_ID,
162163
OBJECT_LABEL: SUBJECT_LABEL,
163164
OBJECT_CATEGORY: SUBJECT_CATEGORY,
164165
OBJECT_MATCH_FIELD: SUBJECT_MATCH_FIELD,
165166
OBJECT_SOURCE: SUBJECT_SOURCE,
166167
OBJECT_PREPROCESSING: SUBJECT_PREPROCESSING,
167168
OBJECT_SOURCE_VERSION: SUBJECT_SOURCE_VERSION,
169+
OBJECT_TYPE: SUBJECT_TYPE,
168170
}
169171

170172

tests/data/asymmetric.tsv

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
# - orcid:5678
1010
#license: https://creativecommons.org/publicdomain/zero/1.0/
1111
#mapping_date: 2020-05-30
12-
subject_id subject_label predicate_id object_id mapping_justification object_source confidence
13-
x:appendage appendage owl:equivalentClass y:appendage semapv:ManualMappingCuration y:example 0.841
14-
x:appendage appendage owl:equivalentClass z:appendage semapv:LexicalMatching z:example 0.882
15-
x:appendage appendage owl:equivalentClass z:appendage semapv:ManualMappingCuration z:example 0.841
16-
x:bone_element bone element owl:equivalentClass y:bone semapv:LexicalMatching y:example 0.739
17-
x:bone_element bone element owl:equivalentClass y:bone semapv:ManualMappingCuration y:example 0.535
12+
subject_id subject_label predicate_id object_id mapping_justification object_source confidence subject_type subject_category object_source_version subject_match_field subject_preprocessing
13+
x:appendage appendage owl:equivalentClass y:appendage semapv:ManualMappingCuration y:example 0.841 owl class some category http://example.org/y/1.0 rdfs:label z:foo_processing
14+
x:appendage appendage owl:equivalentClass z:appendage semapv:LexicalMatching z:example 0.882 owl class some category http://example.org/y/1.0 rdfs:label z:foo_processing
15+
x:appendage appendage owl:equivalentClass z:appendage semapv:ManualMappingCuration z:example 0.841 owl class some category http://example.org/y/1.0 rdfs:label z:foo_processing
16+
x:bone_element bone element owl:equivalentClass y:bone semapv:LexicalMatching y:example 0.739 owl class some category http://example.org/y/1.0 rdfs:label z:foo_processing
17+
x:bone_element bone element owl:equivalentClass y:bone semapv:ManualMappingCuration y:example 0.535 owl class some category http://example.org/y/1.0 rdfs:label z:foo_processing

0 commit comments

Comments
 (0)