Skip to content

Commit 45d2a92

Browse files
gouttegdmatentznehartley
authored
Add 0:0 special cardinality value. (#480)
Resolves [#477] This PR adds a new cardinality value of `0:0`, to be used for mapping records where both the `subject_id` and the `object_id` are `sssom:NoTermFound`. Such records are allowed and may be used to represent the fact that there is no overlap between a subject vocabulary and an object vocabulary. The spec is updated to explain how mappings involved `sssom:NoTermFound` should be handled when computing cardinality values. We also try to explain a bit more what the different cardinality values mean exactly, and provide two examples: * one that illustrates all possible cardinality values between real mappings (1:1, 1:n, n:1, n:n); * one that illustrates the special cases where the subject_id and/or the object_id is sssom:NoTermFound. closes #477 --------- Co-authored-by: Nico Matentzoglu <[email protected]> Co-authored-by: Emily Hartley <[email protected]>
1 parent 05b2fd5 commit 45d2a92

File tree

5 files changed

+69
-13
lines changed

5 files changed

+69
-13
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
- Change all URI-typed slots to clarify that they expect _non-relative_ URIs as values ([issue](https://github.com/mapping-commons/sssom/issues/448)).
1515
- Add `curation_rule` and `curation_rule_text` to the `MappingSet` class and made propagatable ([issue](https://github.com/mapping-commons/sssom/issues/464)).
1616
- Add `cardinality_scope` slot ([issue](https://github.com/mapping-commons/sssom/issues/467)).
17+
- Add new value `0:0` to the `mapping_cardinality_enum` ([issue](https://github.com/mapping-commons/sssom/issues/477)).
1718

1819
## SSSOM version 1.0.0
1920

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#curie_map:
2+
# OBJ: https://example.org/object/
3+
# SRC: https://example.org/sources/
4+
# SUBJ: https://example.org/subject/
5+
#mapping_set_id: https://example.org/sets/cardinality-with-unmapped-entities
6+
#license: https://creativecommons.org/licenses/by/4.0/
7+
subject_id predicate_id object_id mapping_justification subject_source object_source mapping_cardinality comment
8+
SUBJ:0001 skos:exactMatch sssom:NoTermFound semapv:ManualMappingCuration SRC:A SRC:B 1:0 S1 in vocabulary A has no exact match in vocabulary B
9+
SUBJ:0001 skos:closeMatch OBJ:0001 semapv:ManualMappingCuration SRC:A SRC:B 1:1 S1 mapped only to O1, O1 mapped only to S1 -- the record involving sssom:NoTermFound does not count, as it is an absence of match rather than an actual mapping
10+
sssom:NoTermFound skos:exactMatch OBJ:0002 semapv:ManualMappingCuration SRC:C SRC:D 0:1 O2 in vocabulary D has no exact match in vocabulary C
11+
sssom:NoTermFound skos:exactMatch sssom:NoTermFound semapv:ManualMappingCuration SRC:E SRC:F 0:0 No exact match between any term from vocabulary E and any term for vocabulary F (in other words, the two vocabularies are completely disjoint, at least as far as exact matches are considered)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#curie_map:
2+
# OBJ: https://example.org/object/
3+
# SUBJ: https://example.org/subject/
4+
#mapping_set_id: https://example.org/sets/cardinality
5+
#license: https://creativecommons.org/licenses/by/4.0/
6+
subject_id predicate_id object_id mapping_justification mapping_cardinality comment
7+
SUBJ:0001 skos:exactMatch OBJ:0001 semapv:LexicalMatching 1:1 S1 and O1 only mapped to each other
8+
SUBJ:0001 skos:exactMatch OBJ:0001 semapv:MappingReview 1:1 S1 and O1 only mapped to each other
9+
SUBJ:0002 skos:exactMatch OBJ:0002 semapv:LexicalMatching 1:n S2 mapped to both O2 and O3, O2 mapped only to S2
10+
SUBJ:0002 skos:exactMatch OBJ:0003 semapv:LexicalMatching 1:n S2 mapped to both O2 and O3, O3 mapped only to S2
11+
SUBJ:0003 skos:exactMatch OBJ:0004 semapv:LexicalMatching n:1 S3 and S4 both mapped to only O4
12+
SUBJ:0004 skos:exactMatch OBJ:0004 semapv:LexicalMatching n:1 S3 and S4 both mapped to only O4
13+
SUBJ:0005 skos:exactMatch OBJ:0005 semapv:LexicalMatching n:n S5 mapped to O5 and O6, O5 mapped to S5 and S6
14+
SUBJ:0005 skos:exactMatch OBJ:0006 semapv:LexicalMatching 1:n S5 mapped to O5 and O6, O6 mapped only to S5
15+
SUBJ:0006 skos:exactMatch OBJ:0005 semapv:LexicalMatching n:1 S6 mapped only to O5, O5 mapped to both S5 and S6

src/docs/spec-model.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ The `sssom:NoTermFound` value MUST NOT be used in any other slot than `subject_i
128128

129129
The meaning of the NOT predicate modifier in a mapping that refers to `sssom:NoTermFound` is unspecified.
130130

131-
When computing cardinality values (to fill the `mapping_cardinality` slot), mappings that refer to `sssom:NoTermFound` MUST be ignored.
131+
When computing cardinality values (to fill the `mapping_cardinality` slot): (1) a mapping record with a `object_id` (respectively `subject_id`) of `sssom:NoTermFound` MUST be assigned a cardinality value of `1:0` (respectively `0:1`), regardless of any other record; (2) a mapping record with both the `subject_id` and the `object_id` set to `sssom:NoTermFound` MUST be assigned a cardinality value of `0:0`, regardless of any other record; (3) such records MUST be ignored when computing the cardinality of other records.
132132

133133

134134
## Mapping cardinality and cardinality scope
@@ -288,3 +288,4 @@ Not all changes can be annotated thusly in the LinkML model, though. For changes
288288
* The type of the `see_also` slot has been changed to `sssom:NonRelativeURI`. When parsing a SSSOM 1.0 set, implementations SHOULD accept arbitrary string values in that slot.
289289
* All slots that were typed as `xsd:anyURI` have been re-typed as `sssom:NonRelativeURI`. When parsing a SSSOM 1.0 set, implementations SHOULD accept relative URI values in those slots.
290290
* The `curation_rule` and `curation_rule_text` slots which previously only existed on the `Mapping` class, have been added to the `MappingSet` class. Both slots have now been typed [propagatable](#propagation-of-mapping-set-slots).
291+
* A new value `0:0` has been added to the `mapping_cardinality_enum`.

src/sssom_schema/schema/sssom_schema.yaml

Lines changed: 40 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,30 @@ enums:
7676
meaning: sssom:NegatedPredicate
7777
mapping_cardinality_enum:
7878
permissible_values:
79-
"1:1": One-to-one mapping
80-
"1:n": One-to-many mapping
81-
"n:1": Many-to-one mapping
82-
"1:0": One-to-none mapping
83-
"0:1": None-to-one mapping
84-
"n:n": Many-to-many mapping
79+
"1:1":
80+
description: Indicates the mapping record is about a one-to-one mapping, that is,
81+
the subject and the object are only mapped to each other, exclusive of any
82+
other subject or object.
83+
"1:n":
84+
description: Indicates the mapping record is about a one-to-many mapping, that
85+
is, the same subject is mapped to several different objects.
86+
"n:1":
87+
description: Indicates the mapping record is about a many-to-one mapping, that
88+
is, several different subjects are mapped to the same object.
89+
"n:n":
90+
description: Indicates the mapping record is about a many-to-many mapping, that
91+
is, the subject is mapped to several different objects and the object is
92+
mapped to several different subjects.
93+
"1:0":
94+
description: Indicates that the subject has no match in the object vocabulary.
95+
This value MUST only be used when the object_id is sssom:NoTermFound.
96+
"0:1":
97+
description: Indicates that the object has no match in the subject vocabulary.
98+
This value MUST only be used when the subject_id is sssom:NoTermFound.
99+
"0:0":
100+
description: Indicates that there is no match between the subject vocabulary
101+
and the object vocabulary. This value MUST only be used when both the
102+
subject_id and the object_id are sssom:NoTermFound.
85103

86104
types:
87105
EntityReference:
@@ -574,17 +592,27 @@ slots:
574592
- value: MONDO_MAPPINGS:mondo_exactmatch_ncit.sssom.tsv
575593
description: A reference to the mapping set that originally contained this mapping.
576594
mapping_cardinality:
577-
description: A string indicating whether this mapping is from a 1:1 (the subject_id
578-
maps to a single object_id), 1:n (the subject maps to more than one object_id),
579-
n:1, 1:0, 0:1 or n:n group. Note that this is a convenience field that should be derivable
580-
from the mapping set.
595+
description: A value indicating whether the subject (respectively object) of this
596+
mapping record is present in other records involving a different object
597+
(respectively subject), within the subset of records defined by the
598+
cardinality_scope slot (or within the entire mapping set if cardinality_scope
599+
is undefined).
600+
Note that this is a convenience field, whose values can always be derived from
601+
the mapping set.
581602
range: mapping_cardinality_enum
582603
examples:
583604
- value: "1:1"
584-
description: A one-to-one mapping.
605+
description: A one-to-one mapping. There are no other records in which the same
606+
subject is mapped to a different object, and no other records in which the
607+
same object is mapped to a different subject.
585608
- value: "1:n"
586-
description: A one-to-many mapping.
609+
description: A one-to-many mapping. There are other records in which the same
610+
subject is mapped to at least one different object than the object present in
611+
this record; there are no other records in which the object is mapped to a
612+
different subject.
587613
see_also:
614+
- https://github.com/mapping-commons/sssom/blob/master/examples/schema/cardinality.sssom.tsv
615+
- https://github.com/mapping-commons/sssom/blob/master/examples/schema/cardinality-with-unmapped-entities.sssom.tsv
588616
- https://github.com/mapping-commons/sssom/blob/master/examples/schema/cardinality-scope-empty.sssom.tsv
589617
cardinality_scope:
590618
description: A list of mapping slots that define the scope for the value found

0 commit comments

Comments
 (0)