Skip to content

Commit 5859f8b

Browse files
authored
Merge pull request #196 from linkml/issue-2142
Adding type_mappings to metamodel
2 parents 52dd79e + eb3e959 commit 5859f8b

File tree

2 files changed

+88
-0
lines changed

2 files changed

+88
-0
lines changed

linkml_model/model/schema/meta.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,14 @@ slots:
464464
description: >-
465465
The relationship between an element and its alias.
466466
467+
alias_contexts:
468+
alias: contexts
469+
domain: structured_alias
470+
range: uri
471+
multivalued: true
472+
description: >-
473+
The context in which an alias should be applied
474+
467475
in_language:
468476
slot_uri: schema:inLanguage
469477
range: string
@@ -2131,6 +2139,27 @@ slots:
21312139
in_subset:
21322140
- SpecificationSubset
21332141

2142+
type_mappings:
2143+
range: type_mapping
2144+
description: >-
2145+
A collection of type mappings that specify how a slot's range should be mapped or
2146+
serialized in different frameworks
2147+
multivalued: true
2148+
2149+
framework_key:
2150+
range: string
2151+
alias: framework
2152+
key: true
2153+
description: >-
2154+
The name of a format that can be used to serialize LinkML data.
2155+
The string value should be a code from the LinkML frameworks vocabulary,
2156+
but this is not strictly enforced
2157+
2158+
mapped_type:
2159+
range: type_definition
2160+
alias: type
2161+
description: >-
2162+
type to coerce to
21342163
21352164
# -----------------------------------
21362165
# Slots for type definition
@@ -2763,6 +2792,7 @@ classes:
27632792
- literal_form
27642793
- alias_predicate
27652794
- categories
2795+
- alias_contexts
27662796
slot_usage:
27672797
categories:
27682798
description: >-
@@ -2919,6 +2949,7 @@ classes:
29192949
- disjoint_with
29202950
- children_are_mutually_disjoint
29212951
- union_of
2952+
- type_mappings
29222953
slot_usage:
29232954
is_a:
29242955
range: slot_definition
@@ -3181,6 +3212,20 @@ classes:
31813212
- BasicSubset
31823213
- RelationalModelProfile
31833214

3215+
type_mapping:
3216+
rank: 21
3217+
description: Represents how a slot or type can be serialized to a format.
3218+
mixins:
3219+
- extensible
3220+
- annotatable
3221+
- common_metadata
3222+
slots:
3223+
- framework_key
3224+
- mapped_type
3225+
- string_serialization
3226+
in_subset:
3227+
- SpecificationSubset
3228+
31843229
# ==================================
31853230
# Enumerations #
31863231
# ==================================
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
id: https://example.org/serializations
2+
name: serializations_example
3+
title: Serializaations Example
4+
description: |-
5+
Example LinkML schema to demonstrate serialization exceptions.
6+
7+
8+
prefixes:
9+
linkml: https://w3id.org/linkml/
10+
example: https://example.org/
11+
12+
default_prefix: example
13+
14+
imports:
15+
- linkml:types
16+
17+
classes:
18+
19+
A:
20+
attributes:
21+
my_big_integer:
22+
range: integer
23+
type_mappings:
24+
JSON:
25+
type: string
26+
description: we serialize this as a string because some json implementations may implement as doubles
27+
PROTOBUF:
28+
type: int64
29+
my_date:
30+
range: date
31+
type_mappings:
32+
PYTHON:
33+
type: string
34+
examples:
35+
- object:
36+
my_big_integer: 12345678901234567890
37+
my_date: 2021-01-01
38+
39+
40+
41+
42+
43+

0 commit comments

Comments
 (0)