|
| 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]]]]) |
0 commit comments