|
| 1 | +# Auto generated from linkml_issue_497.yaml by pythongen.py version: 0.9.0 |
| 2 | +# Generation date: 2021-12-03T15:03:07 |
| 3 | +# Schema: test-inherited-ranges |
| 4 | +# |
| 5 | +# id: https://example.com/test-inherited-ranges |
| 6 | +# description: a simple schema for testing if the range for base class propogates to the inherited class |
| 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 String |
| 26 | + |
| 27 | +metamodel_version = "1.7.0" |
| 28 | + |
| 29 | +# Overwrite dataclasses _init_fn to add **kwargs in __init__ |
| 30 | +dataclasses._init_fn = dataclasses_init_fn_with_kwargs |
| 31 | + |
| 32 | +# Namespaces |
| 33 | +DCTERMS = CurieNamespace('dcterms', 'http://purl.org/dc/terms/') |
| 34 | +LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/') |
| 35 | +DEFAULT_ = CurieNamespace('', 'https://example.com/test-inherited-ranges/') |
| 36 | + |
| 37 | + |
| 38 | +# Types |
| 39 | + |
| 40 | +# Class references |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | +class NamedThing(YAMLRoot): |
| 45 | + """ |
| 46 | + a databased entity or concept/class |
| 47 | + """ |
| 48 | + _inherited_slots: ClassVar[List[str]] = [] |
| 49 | + |
| 50 | + class_class_uri: ClassVar[URIRef] = URIRef("https://example.com/test-inherited-ranges/NamedThing") |
| 51 | + class_class_curie: ClassVar[str] = None |
| 52 | + class_name: ClassVar[str] = "named thing" |
| 53 | + class_model_uri: ClassVar[URIRef] = URIRef("https://example.com/test-inherited-ranges/NamedThing") |
| 54 | + |
| 55 | + |
| 56 | +@dataclass |
| 57 | +class BiosampleProcessing(NamedThing): |
| 58 | + """ |
| 59 | + A process that takes one or more biosamples as inputs and generates one or as outputs. Examples of outputs include |
| 60 | + samples cultivated from another sample or data objects created by instruments runs. |
| 61 | + """ |
| 62 | + _inherited_slots: ClassVar[List[str]] = [] |
| 63 | + |
| 64 | + class_class_uri: ClassVar[URIRef] = URIRef("https://example.com/test-inherited-ranges/BiosampleProcessing") |
| 65 | + class_class_curie: ClassVar[str] = None |
| 66 | + class_name: ClassVar[str] = "biosample processing" |
| 67 | + class_model_uri: ClassVar[URIRef] = URIRef("https://example.com/test-inherited-ranges/BiosampleProcessing") |
| 68 | + |
| 69 | + has_input: Optional[Union[Union[dict, "Biosample"], List[Union[dict, "Biosample"]]]] = empty_list() |
| 70 | + |
| 71 | + def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): |
| 72 | + if not isinstance(self.has_input, list): |
| 73 | + self.has_input = [self.has_input] if self.has_input is not None else [] |
| 74 | + self.has_input = [v if isinstance(v, Biosample) else Biosample(**as_dict(v)) for v in self.has_input] |
| 75 | + |
| 76 | + super().__post_init__(**kwargs) |
| 77 | + |
| 78 | + |
| 79 | +@dataclass |
| 80 | +class OmicsProcessing(BiosampleProcessing): |
| 81 | + _inherited_slots: ClassVar[List[str]] = [] |
| 82 | + |
| 83 | + class_class_uri: ClassVar[URIRef] = URIRef("https://example.com/test-inherited-ranges/OmicsProcessing") |
| 84 | + class_class_curie: ClassVar[str] = None |
| 85 | + class_name: ClassVar[str] = "omics processing" |
| 86 | + class_model_uri: ClassVar[URIRef] = URIRef("https://example.com/test-inherited-ranges/OmicsProcessing") |
| 87 | + |
| 88 | + has_input: Optional[Union[Union[dict, NamedThing], List[Union[dict, NamedThing]]]] = empty_list() |
| 89 | + has_output: Optional[Union[Union[dict, NamedThing], List[Union[dict, NamedThing]]]] = empty_list() |
| 90 | + |
| 91 | + def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): |
| 92 | + if not isinstance(self.has_input, list): |
| 93 | + self.has_input = [self.has_input] if self.has_input is not None else [] |
| 94 | + self.has_input = [v if isinstance(v, NamedThing) else NamedThing(**as_dict(v)) for v in self.has_input] |
| 95 | + |
| 96 | + if not isinstance(self.has_output, list): |
| 97 | + self.has_output = [self.has_output] if self.has_output is not None else [] |
| 98 | + self.has_output = [v if isinstance(v, NamedThing) else NamedThing(**as_dict(v)) for v in self.has_output] |
| 99 | + |
| 100 | + super().__post_init__(**kwargs) |
| 101 | + |
| 102 | + |
| 103 | +class Biosample(NamedThing): |
| 104 | + """ |
| 105 | + A material sample. It may be environmental (encompassing many organisms) or isolate or tissue. An environmental |
| 106 | + sample containing genetic material from multiple individuals is commonly referred to as a biosample. |
| 107 | + """ |
| 108 | + _inherited_slots: ClassVar[List[str]] = [] |
| 109 | + |
| 110 | + class_class_uri: ClassVar[URIRef] = URIRef("https://example.com/test-inherited-ranges/Biosample") |
| 111 | + class_class_curie: ClassVar[str] = None |
| 112 | + class_name: ClassVar[str] = "biosample" |
| 113 | + class_model_uri: ClassVar[URIRef] = URIRef("https://example.com/test-inherited-ranges/Biosample") |
| 114 | + |
| 115 | + |
| 116 | +# Enumerations |
| 117 | + |
| 118 | + |
| 119 | +# Slots |
| 120 | +class slots: |
| 121 | + pass |
| 122 | + |
| 123 | +slots.id = Slot(uri=DEFAULT_.id, name="id", curie=DEFAULT_.curie('id'), |
| 124 | + model_uri=DEFAULT_.id, domain=None, range=URIRef) |
| 125 | + |
| 126 | +slots.name = Slot(uri=DEFAULT_.name, name="name", curie=DEFAULT_.curie('name'), |
| 127 | + model_uri=DEFAULT_.name, domain=None, range=Optional[str]) |
| 128 | + |
| 129 | +slots.description = Slot(uri=DEFAULT_.description, name="description", curie=DEFAULT_.curie('description'), |
| 130 | + model_uri=DEFAULT_.description, domain=None, range=Optional[str]) |
| 131 | + |
| 132 | +slots.has_input = Slot(uri=DEFAULT_.has_input, name="has input", curie=DEFAULT_.curie('has_input'), |
| 133 | + model_uri=DEFAULT_.has_input, domain=NamedThing, range=Optional[Union[Union[dict, "NamedThing"], List[Union[dict, "NamedThing"]]]]) |
| 134 | + |
| 135 | +slots.has_output = Slot(uri=DEFAULT_.has_output, name="has output", curie=DEFAULT_.curie('has_output'), |
| 136 | + model_uri=DEFAULT_.has_output, domain=NamedThing, range=Optional[Union[Union[dict, "NamedThing"], List[Union[dict, "NamedThing"]]]]) |
| 137 | + |
| 138 | +slots.biosample_processing_has_input = Slot(uri=DEFAULT_.has_input, name="biosample processing_has input", curie=DEFAULT_.curie('has_input'), |
| 139 | + model_uri=DEFAULT_.biosample_processing_has_input, domain=BiosampleProcessing, range=Optional[Union[Union[dict, "Biosample"], List[Union[dict, "Biosample"]]]]) |
0 commit comments