Skip to content

Commit 73a7f66

Browse files
matentzngouttegd
andauthored
Add new "literal profile" solution based on "subject_label" and "object_label" (#384)
Resolves #234 This PR introduces an alternative model to the "literal mapping" proposal we have previously added. It is built on the following principles: - Introducing a profile causes a needless overhead which requires specialised tooling - We can achieve the same functionality with a _very_ minimal intervention in the main metadata model I do understand that there are various opposing views on the need for a "literal" profile, but I think this super minimal intervention will satisfy both sides. In essence, we do not have a literal profile; we have a convention that allows us to represent an "entity" by its label (subject_label) rather than by a semantic identifier. This means we do not need specialised tooling and documentation (nor training). Huge thanks to @gouttegd 🙏 who managed to steer this massive carrier ship after it had left the harbor. This is rarely successful and needed a huge amount of thought, testing, and patience (mostly with me and my constant questions), and I am supremely happy we managed to make it! --------- Co-authored-by: Damien Goutte-Gattat <[email protected]> Co-authored-by: Damien Goutte-Gattat <[email protected]>
1 parent 81fe996 commit 73a7f66

File tree

6 files changed

+70
-20
lines changed

6 files changed

+70
-20
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- Add the concept of "propagatable slots".
66
- Add the `curie_map` to the model (instead of it being a specificity of the SSSOM/TSV format).
77
- Add the concept of "extension slots".
8+
- Add the concept of "literal mappings".
89
- Add the entity reference `sssom:NoTermFound` to express the concept of an "unmapped entity" ([issue](https://github.com/mapping-commons/sssom/issues/28))
910
- Replace `semantic_similarity_score` with `similarity_score` and `semantic_similarity_measure` with `similarity_measure` in the data model ([issue](https://github.com/mapping-commons/sssom/issues/385))
1011

examples/schema/literals.sssom.tsv

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#curie_map:
2+
# COMENT: https://example.com/entities/
3+
#mapping_set_id: https://example.org/sets/literal-mappings
4+
#license: https://creativecommons.org/licenses/by/4.0/
5+
subject_label predicate_id object_id object_label mapping_justification subject_type
6+
alice skos:closeMatch COMENT:0011 alpha semapv:ManualMappingCuration rdfs literal
7+
bob skos:closeMatch COMENT:0012 beta semapv:ManualMappingCuration rdfs literal
8+
daphne skos:closeMatch COMENT:0014 delta semapv:ManualMappingCuration rdfs literal
9+
eve skos:closeMatch COMENT:0015 epsilon semapv:ManualMappingCuration rdfs literal

mkdocs.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ nav:
3333
- Introduction: spec-model.md
3434
- Applying Chaining Rules: chaining-rules.md
3535
- LinkML documentation: linkml-index.md
36-
- SSSOM profiles: sssom-profiles.md
3736
- Serialisations:
3837
- Introduction: spec-formats.md
3938
- SSSOM/TSV serialisation: spec-formats-tsv.md

src/docs/spec-model.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,25 @@ In addition, predicates from the following sources MAY also be encouraged:
9292
* any relation under [skos:mappingRelation](http://www.w3.org/2004/02/skos/core#mappingRelation) in the [Semantic Mapping Vocabulary](https://mapping-commons.github.io/semantic-mapping-vocabulary/).
9393

9494

95+
## Literal mappings
96+
97+
<a id="literal-mappings"></a>
98+
99+
The SSSOM model is primarily intended to represent mappings between semantic entities. However, it may also be used to represent mappings where at least one side is a literal string that does not have an identifier of its own. Any such mapping is henceforth called a _literal mapping_.
100+
101+
To represent a mapping whose subject (resp. object) is a literal:
102+
103+
* the `subject_type` (resp. `object_type`) slot MUST be set to `rdfs literal`;
104+
* the `subject_label` (resp. `object_label`) slot MUST be set to the literal itself;
105+
* the `subject_id` (resp. `object_id`) slot MAY be left empty.
106+
107+
The last point is an exception to the normal rules about required slots, which state that a mapping must always have a `subject_id` and an `object_id`. Implementations MUST accept a mapping without a `subject_id` (resp. `object_id`) _if and only if_ the `subject_type` (resp. `object_type`) slot is set to `rdfs literal`.
108+
109+
All other slots in the `Mapping` class may be used normally in a literal mapping, with the same meaning as for a non-literal mapping.
110+
111+
When computing the cardinality of mappings in a set (e.g. to set the value of the `mapping_cardinality` slot), if the mapping has a literal subject (resp. object), then the `subject_label` (resp. `object_label`) slot must be used for determining the number of occurrences of the subject (resp. object) in the set.
112+
113+
95114
## Representing unmapped entities
96115

97116
The special value `sssom:NoTermFound` MAY be used as the `object_id` of a mapping to explicitly state that the subject of said mapping cannot be mapped to any entity in the domain represented by the `object_source` slot.

src/docs/sssom-profiles.md

Lines changed: 0 additions & 17 deletions
This file was deleted.

src/sssom_schema/schema/sssom_schema.yaml

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,16 @@ enums:
4545
meaning: rdfs:Class
4646
rdfs literal:
4747
meaning: rdfs:Literal
48+
description: This value indicate that the entity being mapped is not a semantic entity with a distinct identifier, but is instead represented entirely by its literal label. This value MUST NOT be used in the predicate_type slot.
49+
see_also:
50+
- https://mapping-commons.github.io/sssom/spec-model/#literal-mappings
51+
- https://github.com/mapping-commons/sssom/issues/234
52+
- https://github.com/mapping-commons/sssom/blob/master/examples/schema/literals.sssom.tsv
4853
rdfs datatype:
4954
meaning: rdfs:Datatype
5055
rdf property:
5156
meaning: rdf:Property
57+
5258
predicate_modifier_enum:
5359
permissible_values:
5460
Not: Negating the mapping predicate. The meaning of the triple becomes subject_id is not a predicate_id match to object_id.
@@ -132,7 +138,6 @@ slots:
132138
subject_id:
133139
description: The ID of the subject of the mapping.
134140
range: EntityReference
135-
required: true
136141
mappings:
137142
- owl:annotatedSource
138143
slot_uri: owl:annotatedSource
@@ -231,7 +236,6 @@ slots:
231236
mappings:
232237
- owl:annotatedTarget
233238
range: EntityReference
234-
required: true
235239
slot_uri: owl:annotatedTarget
236240
examples:
237241
- value: HP:0009894
@@ -689,6 +693,41 @@ classes:
689693
- other
690694
- comment
691695
class_uri: owl:Axiom
696+
rules:
697+
- preconditions:
698+
slot_conditions:
699+
subject_type:
700+
equals_string: "rdfs literal"
701+
postconditions:
702+
slot_conditions:
703+
subject_label:
704+
required: true
705+
- preconditions:
706+
slot_conditions:
707+
subject_type:
708+
none_of:
709+
equals_string: "rdfs literal"
710+
postconditions:
711+
slot_conditions:
712+
subject_id:
713+
required: true
714+
- preconditions:
715+
slot_conditions:
716+
object_type:
717+
equals_string: "rdfs literal"
718+
postconditions:
719+
slot_conditions:
720+
object_label:
721+
required: true
722+
- preconditions:
723+
slot_conditions:
724+
object_type:
725+
none_of:
726+
equals_string: "rdfs literal"
727+
postconditions:
728+
slot_conditions:
729+
object_id:
730+
required: true
692731
mapping registry:
693732
description: A registry for managing mapping sets. It holds a set of
694733
mapping set references, and can import other registries.

0 commit comments

Comments
 (0)