6
6
# description: Annotations mixin
7
7
# license: https://creativecommons.org/publicdomain/zero/1.0/
8
8
9
- import dataclasses
10
- import re
11
- from jsonasobj2 import JsonObj , as_dict
12
- from typing import Optional , List , Union , Dict , ClassVar , Any
9
+ from typing import Optional , Union , ClassVar , Any
13
10
from dataclasses import dataclass
14
11
15
12
from linkml_runtime .utils .slot import Slot
16
- from linkml_runtime .utils .metamodelcore import empty_list , empty_dict , bnode
17
- from linkml_runtime .utils .yamlutils import YAMLRoot , extended_str , extended_float , extended_int
18
- from linkml_runtime .utils .dataclass_extensions_376 import dataclasses_init_fn_with_kwargs
19
- from linkml_runtime .utils .formatutils import camelcase , underscore , sfx
20
- from linkml_runtime .utils .enumerations import EnumDefinitionImpl
21
- from rdflib import Namespace , URIRef
13
+ from linkml_runtime .utils .metamodelcore import empty_dict
14
+ from linkml_runtime .utils .yamlutils import YAMLRoot
15
+ from rdflib import URIRef
22
16
from linkml_runtime .utils .curienamespace import CurieNamespace
23
17
from .extensions import AnyValue , Extension , ExtensionTag
24
- from .types import Uriorcurie
25
- from linkml_runtime .utils .metamodelcore import URIorCURIE
26
18
27
19
metamodel_version = "1.7.0"
28
20
version = "2.0.0"
29
21
30
- # Overwrite dataclasses _init_fn to add **kwargs in __init__
31
- dataclasses ._init_fn = dataclasses_init_fn_with_kwargs
32
-
33
22
# Namespaces
34
23
LINKML = CurieNamespace ('linkml' , 'https://w3id.org/linkml/' )
35
24
DEFAULT_ = LINKML
@@ -47,16 +36,16 @@ class Annotatable(YAMLRoot):
47
36
"""
48
37
mixin for classes that support annotations
49
38
"""
50
- _inherited_slots : ClassVar [List [str ]] = []
39
+ _inherited_slots : ClassVar [list [str ]] = []
51
40
52
41
class_class_uri : ClassVar [URIRef ] = LINKML ["Annotatable" ]
53
42
class_class_curie : ClassVar [str ] = "linkml:Annotatable"
54
43
class_name : ClassVar [str ] = "annotatable"
55
44
class_model_uri : ClassVar [URIRef ] = LINKML .Annotatable
56
45
57
- annotations : Optional [Union [Dict [Union [str , AnnotationTag ], Union [dict , "Annotation" ]], List [Union [dict , "Annotation" ]]]] = empty_dict ()
46
+ annotations : Optional [Union [dict [Union [str , AnnotationTag ], Union [dict , "Annotation" ]], list [Union [dict , "Annotation" ]]]] = empty_dict ()
58
47
59
- def __post_init__ (self , * _ : List [str ], ** kwargs : Dict [str , Any ]):
48
+ def __post_init__ (self , * _ : list [str ], ** kwargs : dict [str , Any ]):
60
49
self ._normalize_inlined_as_dict (slot_name = "annotations" , slot_type = Annotation , key_name = "tag" , keyed = True )
61
50
62
51
super ().__post_init__ (** kwargs )
@@ -67,7 +56,7 @@ class Annotation(Extension):
67
56
"""
68
57
a tag/value pair with the semantics of OWL Annotation
69
58
"""
70
- _inherited_slots : ClassVar [List [str ]] = []
59
+ _inherited_slots : ClassVar [list [str ]] = []
71
60
72
61
class_class_uri : ClassVar [URIRef ] = LINKML ["Annotation" ]
73
62
class_class_curie : ClassVar [str ] = "linkml:Annotation"
@@ -76,9 +65,9 @@ class Annotation(Extension):
76
65
77
66
tag : Union [str , AnnotationTag ] = None
78
67
value : Union [dict , AnyValue ] = None
79
- annotations : Optional [Union [Dict [Union [str , AnnotationTag ], Union [dict , "Annotation" ]], List [Union [dict , "Annotation" ]]]] = empty_dict ()
68
+ annotations : Optional [Union [dict [Union [str , AnnotationTag ], Union [dict , "Annotation" ]], list [Union [dict , "Annotation" ]]]] = empty_dict ()
80
69
81
- def __post_init__ (self , * _ : List [str ], ** kwargs : Dict [str , Any ]):
70
+ def __post_init__ (self , * _ : list [str ], ** kwargs : dict [str , Any ]):
82
71
if self ._is_empty (self .tag ):
83
72
self .MissingRequiredField ("tag" )
84
73
if not isinstance (self .tag , AnnotationTag ):
@@ -97,4 +86,4 @@ class slots:
97
86
pass
98
87
99
88
slots .annotations = Slot (uri = LINKML .annotations , name = "annotations" , curie = LINKML .curie ('annotations' ),
100
- model_uri = LINKML .annotations , domain = None , range = Optional [Union [Dict [Union [str , AnnotationTag ], Union [dict , "Annotation" ]], List [Union [dict , "Annotation" ]]]])
89
+ model_uri = LINKML .annotations , domain = None , range = Optional [Union [dict [Union [str , AnnotationTag ], Union [dict , "Annotation" ]], list [Union [dict , "Annotation" ]]]])
0 commit comments