Skip to content

Commit af7a7b4

Browse files
committed
registry data model
1 parent f9dc3b4 commit af7a7b4

File tree

2 files changed

+359
-0
lines changed

2 files changed

+359
-0
lines changed
Lines changed: 244 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,244 @@
1+
# Auto generated from registry_schema.yaml by pythongen.py version: 0.9.0
2+
# Generation date: 2022-09-05T18:53:50
3+
# Schema: ontology_registry
4+
#
5+
# id: https://w3id.org/semsql/registry
6+
# description: Ontology Registry
7+
# license: https://creativecommons.org/publicdomain/zero/1.0/
8+
9+
import dataclasses
10+
import sys
11+
import re
12+
from jsonasobj2 import JsonObj, as_dict
13+
from typing import Optional, List, Union, Dict, ClassVar, Any
14+
from dataclasses import dataclass
15+
from linkml_runtime.linkml_model.meta import EnumDefinition, PermissibleValue, PvFormulaOptions
16+
17+
from linkml_runtime.utils.slot import Slot
18+
from linkml_runtime.utils.metamodelcore import empty_list, empty_dict, bnode
19+
from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str, extended_float, extended_int
20+
from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs
21+
from linkml_runtime.utils.formatutils import camelcase, underscore, sfx
22+
from linkml_runtime.utils.enumerations import EnumDefinitionImpl
23+
from rdflib import Namespace, URIRef
24+
from linkml_runtime.utils.curienamespace import CurieNamespace
25+
from linkml_runtime.linkml_model.types import Integer, String
26+
27+
metamodel_version = "1.7.0"
28+
version = None
29+
30+
# Overwrite dataclasses _init_fn to add **kwargs in __init__
31+
dataclasses._init_fn = dataclasses_init_fn_with_kwargs
32+
33+
# Namespaces
34+
LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/')
35+
SEMSQL_REGISTRY = CurieNamespace('semsql_registry', 'https://w3id.org/semsql/registry')
36+
XSD = CurieNamespace('xsd', 'http://www.w3.org/2001/XMLSchema#')
37+
DEFAULT_ = SEMSQL_REGISTRY
38+
39+
40+
# Types
41+
class Identifier(String):
42+
type_class_uri = XSD.string
43+
type_class_curie = "xsd:string"
44+
type_name = "identifier"
45+
type_model_uri = SEMSQL_REGISTRY.Identifier
46+
47+
48+
class HttpsIdentifier(String):
49+
type_class_uri = XSD.string
50+
type_class_curie = "xsd:string"
51+
type_name = "https identifier"
52+
type_model_uri = SEMSQL_REGISTRY.HttpsIdentifier
53+
54+
55+
class HttpIdentifier(String):
56+
type_class_uri = XSD.string
57+
type_class_curie = "xsd:string"
58+
type_name = "http identifier"
59+
type_model_uri = SEMSQL_REGISTRY.HttpIdentifier
60+
61+
62+
# Class references
63+
class OntologyId(extended_str):
64+
pass
65+
66+
67+
class PrefixMapPrefix(extended_str):
68+
pass
69+
70+
71+
class RegistryId(extended_str):
72+
pass
73+
74+
75+
@dataclass
76+
class Ontology(YAMLRoot):
77+
_inherited_slots: ClassVar[List[str]] = []
78+
79+
class_class_uri: ClassVar[URIRef] = SEMSQL_REGISTRY.Ontology
80+
class_class_curie: ClassVar[str] = "semsql_registry:Ontology"
81+
class_name: ClassVar[str] = "Ontology"
82+
class_model_uri: ClassVar[URIRef] = SEMSQL_REGISTRY.Ontology
83+
84+
id: Union[str, OntologyId] = None
85+
description: Optional[str] = None
86+
url: Optional[Union[str, Identifier]] = None
87+
has_imports: Optional[int] = None
88+
jsonld_context: Optional[Union[str, HttpsIdentifier]] = None
89+
prefixmap: Optional[Union[Union[str, PrefixMapPrefix], List[Union[str, PrefixMapPrefix]]]] = empty_list()
90+
named_prefixmaps: Optional[Union[str, List[str]]] = empty_list()
91+
format: Optional[str] = None
92+
compression: Optional[Union[str, "CompressionEnum"]] = None
93+
94+
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
95+
if self._is_empty(self.id):
96+
self.MissingRequiredField("id")
97+
if not isinstance(self.id, OntologyId):
98+
self.id = OntologyId(self.id)
99+
100+
if self.description is not None and not isinstance(self.description, str):
101+
self.description = str(self.description)
102+
103+
if self.url is not None and not isinstance(self.url, Identifier):
104+
self.url = Identifier(self.url)
105+
106+
if self.has_imports is not None and not isinstance(self.has_imports, int):
107+
self.has_imports = int(self.has_imports)
108+
109+
if self.jsonld_context is not None and not isinstance(self.jsonld_context, HttpsIdentifier):
110+
self.jsonld_context = HttpsIdentifier(self.jsonld_context)
111+
112+
if not isinstance(self.prefixmap, list):
113+
self.prefixmap = [self.prefixmap] if self.prefixmap is not None else []
114+
self.prefixmap = [v if isinstance(v, PrefixMapPrefix) else PrefixMapPrefix(v) for v in self.prefixmap]
115+
116+
if not isinstance(self.named_prefixmaps, list):
117+
self.named_prefixmaps = [self.named_prefixmaps] if self.named_prefixmaps is not None else []
118+
self.named_prefixmaps = [v if isinstance(v, str) else str(v) for v in self.named_prefixmaps]
119+
120+
if self.format is not None and not isinstance(self.format, str):
121+
self.format = str(self.format)
122+
123+
if self.compression is not None and not isinstance(self.compression, CompressionEnum):
124+
self.compression = CompressionEnum(self.compression)
125+
126+
super().__post_init__(**kwargs)
127+
128+
129+
@dataclass
130+
class PrefixMap(YAMLRoot):
131+
_inherited_slots: ClassVar[List[str]] = []
132+
133+
class_class_uri: ClassVar[URIRef] = SEMSQL_REGISTRY.PrefixMap
134+
class_class_curie: ClassVar[str] = "semsql_registry:PrefixMap"
135+
class_name: ClassVar[str] = "PrefixMap"
136+
class_model_uri: ClassVar[URIRef] = SEMSQL_REGISTRY.PrefixMap
137+
138+
prefix: Union[str, PrefixMapPrefix] = None
139+
prefix_value: Optional[Union[str, HttpIdentifier]] = None
140+
141+
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
142+
if self._is_empty(self.prefix):
143+
self.MissingRequiredField("prefix")
144+
if not isinstance(self.prefix, PrefixMapPrefix):
145+
self.prefix = PrefixMapPrefix(self.prefix)
146+
147+
if self.prefix_value is not None and not isinstance(self.prefix_value, HttpIdentifier):
148+
self.prefix_value = HttpIdentifier(self.prefix_value)
149+
150+
super().__post_init__(**kwargs)
151+
152+
153+
@dataclass
154+
class Registry(YAMLRoot):
155+
_inherited_slots: ClassVar[List[str]] = []
156+
157+
class_class_uri: ClassVar[URIRef] = SEMSQL_REGISTRY.Registry
158+
class_class_curie: ClassVar[str] = "semsql_registry:Registry"
159+
class_name: ClassVar[str] = "Registry"
160+
class_model_uri: ClassVar[URIRef] = SEMSQL_REGISTRY.Registry
161+
162+
id: Union[str, RegistryId] = None
163+
description: Optional[str] = None
164+
license: Optional[str] = None
165+
ontologies: Optional[Union[Dict[Union[str, OntologyId], Union[dict, Ontology]], List[Union[dict, Ontology]]]] = empty_dict()
166+
167+
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
168+
if self._is_empty(self.id):
169+
self.MissingRequiredField("id")
170+
if not isinstance(self.id, RegistryId):
171+
self.id = RegistryId(self.id)
172+
173+
if self.description is not None and not isinstance(self.description, str):
174+
self.description = str(self.description)
175+
176+
if self.license is not None and not isinstance(self.license, str):
177+
self.license = str(self.license)
178+
179+
self._normalize_inlined_as_dict(slot_name="ontologies", slot_type=Ontology, key_name="id", keyed=True)
180+
181+
super().__post_init__(**kwargs)
182+
183+
184+
# Enumerations
185+
class FormatEnum(EnumDefinitionImpl):
186+
187+
n3 = PermissibleValue(text="n3",
188+
description="n3")
189+
190+
_defn = EnumDefinition(
191+
name="FormatEnum",
192+
)
193+
194+
class CompressionEnum(EnumDefinitionImpl):
195+
196+
gzip = PermissibleValue(text="gzip",
197+
description="gzip")
198+
199+
_defn = EnumDefinition(
200+
name="CompressionEnum",
201+
)
202+
203+
# Slots
204+
class slots:
205+
pass
206+
207+
slots.description = Slot(uri=SEMSQL_REGISTRY.description, name="description", curie=SEMSQL_REGISTRY.curie('description'),
208+
model_uri=SEMSQL_REGISTRY.description, domain=None, range=Optional[str])
209+
210+
slots.url = Slot(uri=SEMSQL_REGISTRY.url, name="url", curie=SEMSQL_REGISTRY.curie('url'),
211+
model_uri=SEMSQL_REGISTRY.url, domain=None, range=Optional[Union[str, Identifier]])
212+
213+
slots.id = Slot(uri=SEMSQL_REGISTRY.id, name="id", curie=SEMSQL_REGISTRY.curie('id'),
214+
model_uri=SEMSQL_REGISTRY.id, domain=None, range=URIRef)
215+
216+
slots.has_imports = Slot(uri=SEMSQL_REGISTRY.has_imports, name="has_imports", curie=SEMSQL_REGISTRY.curie('has_imports'),
217+
model_uri=SEMSQL_REGISTRY.has_imports, domain=None, range=Optional[int])
218+
219+
slots.jsonld_context = Slot(uri=SEMSQL_REGISTRY.jsonld_context, name="jsonld_context", curie=SEMSQL_REGISTRY.curie('jsonld_context'),
220+
model_uri=SEMSQL_REGISTRY.jsonld_context, domain=None, range=Optional[Union[str, HttpsIdentifier]])
221+
222+
slots.prefixmap = Slot(uri=SEMSQL_REGISTRY.prefixmap, name="prefixmap", curie=SEMSQL_REGISTRY.curie('prefixmap'),
223+
model_uri=SEMSQL_REGISTRY.prefixmap, domain=None, range=Optional[Union[Union[str, PrefixMapPrefix], List[Union[str, PrefixMapPrefix]]]])
224+
225+
slots.named_prefixmaps = Slot(uri=SEMSQL_REGISTRY.named_prefixmaps, name="named_prefixmaps", curie=SEMSQL_REGISTRY.curie('named_prefixmaps'),
226+
model_uri=SEMSQL_REGISTRY.named_prefixmaps, domain=None, range=Optional[Union[str, List[str]]])
227+
228+
slots.format = Slot(uri=SEMSQL_REGISTRY.format, name="format", curie=SEMSQL_REGISTRY.curie('format'),
229+
model_uri=SEMSQL_REGISTRY.format, domain=None, range=Optional[str])
230+
231+
slots.compression = Slot(uri=SEMSQL_REGISTRY.compression, name="compression", curie=SEMSQL_REGISTRY.curie('compression'),
232+
model_uri=SEMSQL_REGISTRY.compression, domain=None, range=Optional[Union[str, "CompressionEnum"]])
233+
234+
slots.prefix = Slot(uri=SEMSQL_REGISTRY.prefix, name="prefix", curie=SEMSQL_REGISTRY.curie('prefix'),
235+
model_uri=SEMSQL_REGISTRY.prefix, domain=None, range=URIRef)
236+
237+
slots.prefix_value = Slot(uri=SEMSQL_REGISTRY.prefix_value, name="prefix_value", curie=SEMSQL_REGISTRY.curie('prefix_value'),
238+
model_uri=SEMSQL_REGISTRY.prefix_value, domain=None, range=Optional[Union[str, HttpIdentifier]])
239+
240+
slots.license = Slot(uri=SEMSQL_REGISTRY.license, name="license", curie=SEMSQL_REGISTRY.curie('license'),
241+
model_uri=SEMSQL_REGISTRY.license, domain=None, range=Optional[str])
242+
243+
slots.ontologies = Slot(uri=SEMSQL_REGISTRY.ontologies, name="ontologies", curie=SEMSQL_REGISTRY.curie('ontologies'),
244+
model_uri=SEMSQL_REGISTRY.ontologies, domain=None, range=Optional[Union[Dict[Union[str, OntologyId], Union[dict, Ontology]], List[Union[dict, Ontology]]]])
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
id: https://w3id.org/semsql/registry
2+
name: ontology_registry
3+
description: Ontology Registry
4+
imports:
5+
- linkml:types
6+
prefixes:
7+
linkml: https://w3id.org/linkml/
8+
semsql_registry: https://w3id.org/semsql/registry
9+
default_prefix: semsql_registry
10+
types:
11+
identifier:
12+
typeof: string
13+
https identifier:
14+
typeof: string
15+
http identifier:
16+
typeof: string
17+
enums:
18+
format_enum:
19+
permissible_values:
20+
n3:
21+
description: n3
22+
compression_enum:
23+
permissible_values:
24+
gzip:
25+
description: gzip
26+
slots:
27+
description:
28+
examples:
29+
- value: Monarch Phenomics Integrated Ontology
30+
range: string
31+
url:
32+
examples:
33+
- value: https://lov.linkeddata.es/lov.n3.gz
34+
range: identifier
35+
id:
36+
examples:
37+
- value: lov
38+
identifier: true
39+
range: string
40+
has_imports:
41+
examples:
42+
- value: 'True'
43+
range: integer
44+
jsonld_context:
45+
examples:
46+
- value: https://biolink.github.io/biolink-model/context.jsonld
47+
range: https identifier
48+
prefixmap:
49+
examples:
50+
- value: '[''$ref:Prefixmap'', ''$ref:Prefixmap'']'
51+
multivalued: true
52+
range: PrefixMap
53+
named_prefixmaps:
54+
examples:
55+
- value: '[''sweet'', ''prefixcc'']'
56+
multivalued: true
57+
range: string
58+
format:
59+
examples:
60+
- value: n3
61+
#range: format_enum
62+
compression:
63+
examples:
64+
- value: gzip
65+
range: compression_enum
66+
prefix:
67+
examples:
68+
- value: fix
69+
identifier: true
70+
range: string
71+
prefix_value:
72+
examples:
73+
- value: http://purl.org/obo/owl/FIX#
74+
range: http identifier
75+
license:
76+
examples:
77+
- value: CC0
78+
range: string
79+
ontologies:
80+
examples:
81+
- value: '[''$ref:Ontology'', ''$ref:Ontology'', ''$ref:Ontology'', ''$ref:Ontology'',
82+
''$ref:Ontology'', ''$ref:Ontology'', ''$ref:Ontology'', ''$ref:Ontology'',
83+
''$ref:Ontology'', ''$ref:Ontology'', ''$ref:Ontology'', ''$ref:Ontology'',
84+
''$ref:Ontology'']'
85+
multivalued: true
86+
inlined: true
87+
inlined_as_list: false
88+
range: Ontology
89+
suppress:
90+
range: boolean
91+
classes:
92+
Ontology:
93+
slots:
94+
- description
95+
- url
96+
- id
97+
- has_imports
98+
- jsonld_context
99+
- prefixmap
100+
- named_prefixmaps
101+
- format
102+
- compression
103+
- suppress
104+
PrefixMap:
105+
slots:
106+
- prefix
107+
- prefix_value
108+
Registry:
109+
slots:
110+
- id
111+
- description
112+
- license
113+
- ontologies
114+
tree_root: true
115+

0 commit comments

Comments
 (0)