-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlinkml_common.py
4888 lines (3467 loc) · 207 KB
/
linkml_common.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Auto generated from linkml_common.yaml by pythongen.py version: 0.0.1
# Generation date: 2024-07-03T10:12:22
# Schema: linkml-common
#
# id: https://w3id.org/linkml/linkml-common
# description: Common Data Model Elements
# license: MIT
import dataclasses
import re
from jsonasobj2 import JsonObj, as_dict
from typing import Optional, List, Union, Dict, ClassVar, Any
from dataclasses import dataclass
from datetime import date, datetime
from linkml_runtime.linkml_model.meta import EnumDefinition, PermissibleValue, PvFormulaOptions
from linkml_runtime.utils.slot import Slot
from linkml_runtime.utils.metamodelcore import empty_list, empty_dict, bnode
from linkml_runtime.utils.yamlutils import YAMLRoot, extended_str, extended_float, extended_int
from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs
from linkml_runtime.utils.formatutils import camelcase, underscore, sfx
from linkml_runtime.utils.enumerations import EnumDefinitionImpl
from rdflib import Namespace, URIRef
from linkml_runtime.utils.curienamespace import CurieNamespace
from linkml_runtime.linkml_model.types import Date, Datetime, Decimal, Float, Integer, String, Time, Uri, Uriorcurie
from linkml_runtime.utils.metamodelcore import Decimal, URI, URIorCURIE, XSDDate, XSDDateTime, XSDTime
metamodel_version = "1.7.0"
version = None
# Overwrite dataclasses _init_fn to add **kwargs in __init__
dataclasses._init_fn = dataclasses_init_fn_with_kwargs
# Namespaces
BFO = CurieNamespace('BFO', 'http://purl.obolibrary.org/obo/BFO_')
ENVO = CurieNamespace('ENVO', 'http://purl.obolibrary.org/obo/ENVO_')
IAO = CurieNamespace('IAO', 'http://purl.obolibrary.org/obo/IAO_')
OBI = CurieNamespace('OBI', 'http://purl.obolibrary.org/obo/OBI_')
ORGANIZATIONPERSONNELRELATIONSHIPENUM = CurieNamespace('OrganizationPersonnelRelationshipEnum', 'http://example.org/UNKNOWN/OrganizationPersonnelRelationshipEnum/')
PATO = CurieNamespace('PATO', 'http://purl.obolibrary.org/obo/PATO_')
PERSONINROLE = CurieNamespace('PersonInRole', 'http://example.org/UNKNOWN/PersonInRole/')
UCUM = CurieNamespace('UCUM', 'http://unitsofmeasure.org/')
UO = CurieNamespace('UO', 'http://purl.obolibrary.org/obo/UO_')
BIOLINK = CurieNamespace('biolink', 'https://w3id.org/biolink/')
DCTERMS = CurieNamespace('dcterms', 'http://purl.org/dc/terms/')
EXAMPLE = CurieNamespace('example', 'https://example.org/')
FHIR = CurieNamespace('fhir', 'http://hl7.org/fhir/')
FIBO = CurieNamespace('fibo', 'https://spec.edmcouncil.org/fibo/ontology/FBC')
FIBO_DATESANDTIMES = CurieNamespace('fibo_DatesAndTimes', 'https://www.omg.org/spec/Commons/DatesAndTimes/')
FIBO_QUANTITIESANDUNITS = CurieNamespace('fibo_QuantitiesAndUnits', 'https://www.omg.org/spec/Commons/QuantitiesAndUnits/')
FIBO_COMMONS_PARTIESANDSITUATIONS = CurieNamespace('fibo_commons_PartiesAndSituations', 'https://spec.edmcouncil.org/fibo/ontology/FBC/ommons/PartiesAndSituations/')
LINKML = CurieNamespace('linkml', 'https://w3id.org/linkml/')
LINKML_COMMON = CurieNamespace('linkml_common', 'https://w3id.org/linkml-common/')
NMDCSCHEMA = CurieNamespace('nmdcschema', 'https://w3id.org/nmdc/')
OMOPSCHEMA = CurieNamespace('omopschema', 'http://example.org/omop/')
PROV = CurieNamespace('prov', 'http://www.w3.org/ns/prov#')
QUDT = CurieNamespace('qudt', 'http://qudt.org/vocab/unit/')
RDF = CurieNamespace('rdf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#')
RDFS = CurieNamespace('rdfs', 'http://www.w3.org/2000/01/rdf-schema#')
SCHEMA = CurieNamespace('schema', 'http://schema.org/')
XSD = CurieNamespace('xsd', 'http://www.w3.org/2001/XMLSchema#')
DEFAULT_ = LINKML_COMMON
# Types
class CountScalar(Integer):
type_class_uri = XSD["integer"]
type_class_curie = "xsd:integer"
type_name = "CountScalar"
type_model_uri = LINKML_COMMON.CountScalar
# Class references
class IdentifiedId(URIorCURIE):
pass
class PhysicalEntityId(URIorCURIE):
pass
class ConceptId(URIorCURIE):
pass
class InformationEntityId(URIorCURIE):
pass
class PhysicalDeviceId(PhysicalEntityId):
pass
class PhysicalSystemId(PhysicalEntityId):
pass
class SpecificationId(InformationEntityId):
pass
class ProcedureId(SpecificationId):
pass
class PublicationId(InformationEntityId):
pass
class DatasetId(InformationEntityId):
pass
class BuiltEnvironmentFeatureId(PhysicalEntityId):
pass
class FacilityId(BuiltEnvironmentFeatureId):
pass
class BuildingId(FacilityId):
pass
class BuiltSystemId(BuiltEnvironmentFeatureId):
pass
class ClinicalCohortId(PhysicalEntityId):
pass
class ClinicalCohortDefinitionId(InformationEntityId):
pass
class EconomicSystemId(PhysicalSystemId):
pass
class EngineeringSpecificationId(ProcedureId):
pass
class RawMaterialId(PhysicalEntityId):
pass
class EquipmentId(PhysicalEntityId):
pass
class PowerPlantId(BuildingId):
pass
class PowerPlantTypeId(ConceptId):
pass
class FossilFuelPlantId(PowerPlantId):
pass
class NuclearPlantId(PowerPlantId):
pass
class RenewablePlantId(PowerPlantId):
pass
class HydroelectricPlantId(RenewablePlantId):
pass
class SolarPlantId(RenewablePlantId):
pass
class WindFarmId(RenewablePlantId):
pass
class ElectricalGridId(BuiltSystemId):
pass
class ExtractiveIndustryFacilityId(FacilityId):
pass
class MiningFacilityId(ExtractiveIndustryFacilityId):
pass
class WellFacilityId(ExtractiveIndustryFacilityId):
pass
class QuarryFacilityId(ExtractiveIndustryFacilityId):
pass
class ExtractiveIndustryEquipmentId(EquipmentId):
pass
class ExtractiveIndustryProductId(ConceptId):
pass
class ExtractiveIndustryWasteId(ConceptId):
pass
class EnvironmentalSystemId(PhysicalSystemId):
pass
class ClimateId(EnvironmentalSystemId):
pass
class CurrencyConceptId(ConceptId):
pass
class FoodRecipeId(ProcedureId):
pass
class FoodTypeConceptId(ConceptId):
pass
class BasicFoodTypeId(FoodTypeConceptId):
pass
class CompositeFoodTypeId(FoodTypeConceptId):
pass
class PlaceId(PhysicalEntityId):
pass
class EnvironmentalSiteId(PlaceId):
pass
class LandformId(PlaceId):
pass
class AstronomicalBodyId(PlaceId):
pass
class HealthcareSiteId(PlaceId):
pass
class InvestigativeProtocolId(ProcedureId):
pass
class StudyHypothesisId(InformationEntityId):
pass
class StudyDesignId(ProcedureId):
pass
class StudyResultId(InformationEntityId):
pass
class SampleMaterialId(PhysicalEntityId):
pass
class QuantityKindId(ConceptId):
pass
class UnitConceptId(ConceptId):
pass
class OrganizationId(PhysicalEntityId):
pass
class FinancialOrganizationId(OrganizationId):
pass
class HealthcareOrganizationId(OrganizationId):
pass
class OrgChartId(InformationEntityId):
pass
class AutomatedAgentId(PhysicalEntityId):
pass
class CreativeWorkId(PhysicalEntityId):
pass
class EventId(URIorCURIE):
pass
class ClinicalCohortEnrollmentId(EventId):
pass
class EngineeringProcessId(EventId):
pass
class HealthcareEncounterId(EventId):
pass
class HealthcareConditionOccurrenceId(EventId):
pass
class InvestigationId(EventId):
pass
class ObservationId(EventId):
pass
class MeasurementId(ObservationId):
pass
class QualitativeObservationId(ObservationId):
pass
class LifeEventId(EventId):
pass
class ExecutionOfProcedureId(EventId):
pass
class PlannedProcessId(ExecutionOfProcedureId):
pass
class FoodPreparationId(PlannedProcessId):
pass
class InvestigativeProcessId(PlannedProcessId):
pass
class SampleCollectionProcessId(InvestigativeProcessId):
pass
class DataGenerationFromSampleId(InvestigativeProcessId):
pass
class ComputationalPlannedProcessId(PlannedProcessId):
pass
class MaterialCollectionId(PlannedProcessId):
pass
class MaterialProcessingId(PlannedProcessId):
pass
class EngineeringMaterialProcessingId(MaterialProcessingId):
pass
class FoodProcessingId(MaterialProcessingId):
pass
class SampleProcessingId(MaterialProcessingId):
pass
class IndividualOrganismId(PhysicalEntityId):
pass
class PersonId(IndividualOrganismId):
pass
class VeterinaryAnimalId(IndividualOrganismId):
pass
@dataclass
class Identified(YAMLRoot):
_inherited_slots: ClassVar[List[str]] = []
class_class_uri: ClassVar[URIRef] = LINKML_COMMON["Identified"]
class_class_curie: ClassVar[str] = "linkml_common:Identified"
class_name: ClassVar[str] = "Identified"
class_model_uri: ClassVar[URIRef] = LINKML_COMMON.Identified
id: Union[str, IdentifiedId] = None
name: Optional[str] = None
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
if self._is_empty(self.id):
self.MissingRequiredField("id")
if not isinstance(self.id, IdentifiedId):
self.id = IdentifiedId(self.id)
if self.name is not None and not isinstance(self.name, str):
self.name = str(self.name)
super().__post_init__(**kwargs)
@dataclass
class Typed(YAMLRoot):
_inherited_slots: ClassVar[List[str]] = []
class_class_uri: ClassVar[URIRef] = LINKML_COMMON["Typed"]
class_class_curie: ClassVar[str] = "linkml_common:Typed"
class_name: ClassVar[str] = "Typed"
class_model_uri: ClassVar[URIRef] = LINKML_COMMON.Typed
type: Optional[str] = None
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
self.type = str(self.class_name)
super().__post_init__(**kwargs)
def __new__(cls, *args, **kwargs):
type_designator = "type"
if not type_designator in kwargs:
return super().__new__(cls,*args,**kwargs)
else:
type_designator_value = kwargs[type_designator]
target_cls = cls._class_for("class_name", type_designator_value)
if target_cls is None:
raise ValueError(f"Wrong type designator value: class {cls.__name__} "
f"has no subclass with ['class_name']='{kwargs[type_designator]}'")
return super().__new__(target_cls,*args,**kwargs)
@dataclass
class Entity(YAMLRoot):
"""
A physical, digital, conceptual, or other kind of thing with some common characteristics
"""
_inherited_slots: ClassVar[List[str]] = []
class_class_uri: ClassVar[URIRef] = SCHEMA["Thing"]
class_class_curie: ClassVar[str] = "schema:Thing"
class_name: ClassVar[str] = "Entity"
class_model_uri: ClassVar[URIRef] = LINKML_COMMON.Entity
type: Optional[str] = None
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
self.type = str(self.class_name)
super().__post_init__(**kwargs)
def __new__(cls, *args, **kwargs):
type_designator = "type"
if not type_designator in kwargs:
return super().__new__(cls,*args,**kwargs)
else:
type_designator_value = kwargs[type_designator]
target_cls = cls._class_for("class_name", type_designator_value)
if target_cls is None:
raise ValueError(f"Wrong type designator value: class {cls.__name__} "
f"has no subclass with ['class_name']='{kwargs[type_designator]}'")
return super().__new__(target_cls,*args,**kwargs)
class Intangible(Entity):
"""
An entity that is not a physical object, process, or information
"""
_inherited_slots: ClassVar[List[str]] = []
class_class_uri: ClassVar[URIRef] = SCHEMA["Intangible"]
class_class_curie: ClassVar[str] = "schema:Intangible"
class_name: ClassVar[str] = "Intangible"
class_model_uri: ClassVar[URIRef] = LINKML_COMMON.Intangible
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
super().__post_init__(**kwargs)
self.type = str(self.class_name)
@dataclass
class PhysicalEntity(Entity):
_inherited_slots: ClassVar[List[str]] = []
class_class_uri: ClassVar[URIRef] = LINKML_COMMON["PhysicalEntity"]
class_class_curie: ClassVar[str] = "linkml_common:PhysicalEntity"
class_name: ClassVar[str] = "PhysicalEntity"
class_model_uri: ClassVar[URIRef] = LINKML_COMMON.PhysicalEntity
id: Union[str, PhysicalEntityId] = None
classification: Optional[Union[str, ConceptId]] = None
ontology_types: Optional[Union[Union[str, ConceptId], List[Union[str, ConceptId]]]] = empty_list()
description: Optional[str] = None
name: Optional[str] = None
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
if self._is_empty(self.id):
self.MissingRequiredField("id")
if not isinstance(self.id, PhysicalEntityId):
self.id = PhysicalEntityId(self.id)
if self.classification is not None and not isinstance(self.classification, ConceptId):
self.classification = ConceptId(self.classification)
if not isinstance(self.ontology_types, list):
self.ontology_types = [self.ontology_types] if self.ontology_types is not None else []
self.ontology_types = [v if isinstance(v, ConceptId) else ConceptId(v) for v in self.ontology_types]
if self.description is not None and not isinstance(self.description, str):
self.description = str(self.description)
if self.name is not None and not isinstance(self.name, str):
self.name = str(self.name)
super().__post_init__(**kwargs)
self.type = str(self.class_name)
@dataclass
class Concept(Intangible):
_inherited_slots: ClassVar[List[str]] = []
class_class_uri: ClassVar[URIRef] = LINKML_COMMON["Concept"]
class_class_curie: ClassVar[str] = "linkml_common:Concept"
class_name: ClassVar[str] = "Concept"
class_model_uri: ClassVar[URIRef] = LINKML_COMMON.Concept
id: Union[str, ConceptId] = None
name: Optional[str] = None
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
if self._is_empty(self.id):
self.MissingRequiredField("id")
if not isinstance(self.id, ConceptId):
self.id = ConceptId(self.id)
if self.name is not None and not isinstance(self.name, str):
self.name = str(self.name)
super().__post_init__(**kwargs)
self.type = str(self.class_name)
@dataclass
class InformationEntity(Intangible):
"""
An entity that describes some information
"""
_inherited_slots: ClassVar[List[str]] = []
class_class_uri: ClassVar[URIRef] = LINKML_COMMON["InformationEntity"]
class_class_curie: ClassVar[str] = "linkml_common:InformationEntity"
class_name: ClassVar[str] = "InformationEntity"
class_model_uri: ClassVar[URIRef] = LINKML_COMMON.InformationEntity
id: Union[str, InformationEntityId] = None
describes: Optional[Union[dict, "Any"]] = None
name: Optional[str] = None
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
if self._is_empty(self.id):
self.MissingRequiredField("id")
if not isinstance(self.id, InformationEntityId):
self.id = InformationEntityId(self.id)
if self.name is not None and not isinstance(self.name, str):
self.name = str(self.name)
super().__post_init__(**kwargs)
self.type = str(self.class_name)
@dataclass
class PhysicalDevice(PhysicalEntity):
_inherited_slots: ClassVar[List[str]] = []
class_class_uri: ClassVar[URIRef] = LINKML_COMMON["PhysicalDevice"]
class_class_curie: ClassVar[str] = "linkml_common:PhysicalDevice"
class_name: ClassVar[str] = "PhysicalDevice"
class_model_uri: ClassVar[URIRef] = LINKML_COMMON.PhysicalDevice
id: Union[str, PhysicalDeviceId] = None
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
if self._is_empty(self.id):
self.MissingRequiredField("id")
if not isinstance(self.id, PhysicalDeviceId):
self.id = PhysicalDeviceId(self.id)
super().__post_init__(**kwargs)
self.type = str(self.class_name)
class StructuredValue(Intangible):
"""
A value that is a structured collection of other values
"""
_inherited_slots: ClassVar[List[str]] = []
class_class_uri: ClassVar[URIRef] = SCHEMA["StructuredValue"]
class_class_curie: ClassVar[str] = "schema:StructuredValue"
class_name: ClassVar[str] = "StructuredValue"
class_model_uri: ClassVar[URIRef] = LINKML_COMMON.StructuredValue
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
super().__post_init__(**kwargs)
self.type = str(self.class_name)
class Role(Intangible):
_inherited_slots: ClassVar[List[str]] = []
class_class_uri: ClassVar[URIRef] = SCHEMA["Role"]
class_class_curie: ClassVar[str] = "schema:Role"
class_name: ClassVar[str] = "Role"
class_model_uri: ClassVar[URIRef] = LINKML_COMMON.Role
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
super().__post_init__(**kwargs)
self.type = str(self.class_name)
@dataclass
class Relationship(Intangible):
_inherited_slots: ClassVar[List[str]] = []
class_class_uri: ClassVar[URIRef] = LINKML_COMMON["Relationship"]
class_class_curie: ClassVar[str] = "linkml_common:Relationship"
class_name: ClassVar[str] = "Relationship"
class_model_uri: ClassVar[URIRef] = LINKML_COMMON.Relationship
subject: Optional[Union[dict, Entity]] = None
predicate: Optional[Union[str, ConceptId]] = None
object: Optional[Union[dict, Entity]] = None
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
if self.subject is not None and not isinstance(self.subject, Entity):
self.subject = Entity(**as_dict(self.subject))
if self.predicate is not None and not isinstance(self.predicate, ConceptId):
self.predicate = ConceptId(self.predicate)
if self.object is not None and not isinstance(self.object, Entity):
self.object = Entity(**as_dict(self.object))
super().__post_init__(**kwargs)
self.type = str(self.class_name)
@dataclass
class PhysicalSystem(PhysicalEntity):
_inherited_slots: ClassVar[List[str]] = []
class_class_uri: ClassVar[URIRef] = LINKML_COMMON["PhysicalSystem"]
class_class_curie: ClassVar[str] = "linkml_common:PhysicalSystem"
class_name: ClassVar[str] = "PhysicalSystem"
class_model_uri: ClassVar[URIRef] = LINKML_COMMON.PhysicalSystem
id: Union[str, PhysicalSystemId] = None
components: Optional[Union[Union[str, PhysicalEntityId], List[Union[str, PhysicalEntityId]]]] = empty_list()
events: Optional[Union[Union[dict, Entity], List[Union[dict, Entity]]]] = empty_list()
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
if self._is_empty(self.id):
self.MissingRequiredField("id")
if not isinstance(self.id, PhysicalSystemId):
self.id = PhysicalSystemId(self.id)
if not isinstance(self.components, list):
self.components = [self.components] if self.components is not None else []
self.components = [v if isinstance(v, PhysicalEntityId) else PhysicalEntityId(v) for v in self.components]
if not isinstance(self.events, list):
self.events = [self.events] if self.events is not None else []
self.events = [v if isinstance(v, Entity) else Entity(**as_dict(v)) for v in self.events]
super().__post_init__(**kwargs)
self.type = str(self.class_name)
class Location(StructuredValue):
_inherited_slots: ClassVar[List[str]] = []
class_class_uri: ClassVar[URIRef] = LINKML_COMMON["Location"]
class_class_curie: ClassVar[str] = "linkml_common:Location"
class_name: ClassVar[str] = "Location"
class_model_uri: ClassVar[URIRef] = LINKML_COMMON.Location
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
super().__post_init__(**kwargs)
self.type = str(self.class_name)
class PointLocation(Location):
_inherited_slots: ClassVar[List[str]] = []
class_class_uri: ClassVar[URIRef] = LINKML_COMMON["PointLocation"]
class_class_curie: ClassVar[str] = "linkml_common:PointLocation"
class_name: ClassVar[str] = "PointLocation"
class_model_uri: ClassVar[URIRef] = LINKML_COMMON.PointLocation
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
super().__post_init__(**kwargs)
self.type = str(self.class_name)
@dataclass
class Specification(InformationEntity):
"""
A specification of a thing
"""
_inherited_slots: ClassVar[List[str]] = []
class_class_uri: ClassVar[URIRef] = LINKML_COMMON["Specification"]
class_class_curie: ClassVar[str] = "linkml_common:Specification"
class_name: ClassVar[str] = "Specification"
class_model_uri: ClassVar[URIRef] = LINKML_COMMON.Specification
id: Union[str, SpecificationId] = None
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
if self._is_empty(self.id):
self.MissingRequiredField("id")
if not isinstance(self.id, SpecificationId):
self.id = SpecificationId(self.id)
super().__post_init__(**kwargs)
self.type = str(self.class_name)
@dataclass
class Procedure(Specification):
"""
A canonical series of actions conducted in a certain order or manner
"""
_inherited_slots: ClassVar[List[str]] = []
class_class_uri: ClassVar[URIRef] = LINKML_COMMON["Procedure"]
class_class_curie: ClassVar[str] = "linkml_common:Procedure"
class_name: ClassVar[str] = "Procedure"
class_model_uri: ClassVar[URIRef] = LINKML_COMMON.Procedure
id: Union[str, ProcedureId] = None
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
if self._is_empty(self.id):
self.MissingRequiredField("id")
if not isinstance(self.id, ProcedureId):
self.id = ProcedureId(self.id)
super().__post_init__(**kwargs)
self.type = str(self.class_name)
@dataclass
class EntitySet(Intangible):
"""
A group of things. The collection may be heterogeneous or homogeneous.
"""
_inherited_slots: ClassVar[List[str]] = []
class_class_uri: ClassVar[URIRef] = LINKML_COMMON["EntitySet"]
class_class_curie: ClassVar[str] = "linkml_common:EntitySet"
class_name: ClassVar[str] = "EntitySet"
class_model_uri: ClassVar[URIRef] = LINKML_COMMON.EntitySet
members: Optional[Union[Union[dict, Entity], List[Union[dict, Entity]]]] = empty_list()
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
if not isinstance(self.members, list):
self.members = [self.members] if self.members is not None else []
self.members = [v if isinstance(v, Entity) else Entity(**as_dict(v)) for v in self.members]
super().__post_init__(**kwargs)
self.type = str(self.class_name)
Any = Any
@dataclass
class Publication(InformationEntity):
_inherited_slots: ClassVar[List[str]] = []
class_class_uri: ClassVar[URIRef] = LINKML_COMMON["Publication"]
class_class_curie: ClassVar[str] = "linkml_common:Publication"
class_name: ClassVar[str] = "Publication"
class_model_uri: ClassVar[URIRef] = LINKML_COMMON.Publication
id: Union[str, PublicationId] = None
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
if self._is_empty(self.id):
self.MissingRequiredField("id")
if not isinstance(self.id, PublicationId):
self.id = PublicationId(self.id)
super().__post_init__(**kwargs)
self.type = str(self.class_name)
@dataclass
class Dataset(InformationEntity):
_inherited_slots: ClassVar[List[str]] = []
class_class_uri: ClassVar[URIRef] = LINKML_COMMON["Dataset"]
class_class_curie: ClassVar[str] = "linkml_common:Dataset"
class_name: ClassVar[str] = "Dataset"
class_model_uri: ClassVar[URIRef] = LINKML_COMMON.Dataset
id: Union[str, DatasetId] = None
collected_as_part_of: Optional[Union[Union[str, InvestigationId], List[Union[str, InvestigationId]]]] = empty_list()
title: Optional[str] = None
abstract: Optional[str] = None
rights: Optional[str] = None
creators: Optional[Union[Union[str, PhysicalEntityId], List[Union[str, PhysicalEntityId]]]] = empty_list()
contributors: Optional[Union[Union[str, PhysicalEntityId], List[Union[str, PhysicalEntityId]]]] = empty_list()
contacts: Optional[Union[Union[str, PhysicalEntityId], List[Union[str, PhysicalEntityId]]]] = empty_list()
keywords: Optional[Union[str, List[str]]] = empty_list()
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
if self._is_empty(self.id):
self.MissingRequiredField("id")
if not isinstance(self.id, DatasetId):
self.id = DatasetId(self.id)
if not isinstance(self.collected_as_part_of, list):
self.collected_as_part_of = [self.collected_as_part_of] if self.collected_as_part_of is not None else []
self.collected_as_part_of = [v if isinstance(v, InvestigationId) else InvestigationId(v) for v in self.collected_as_part_of]
if self.title is not None and not isinstance(self.title, str):
self.title = str(self.title)
if self.abstract is not None and not isinstance(self.abstract, str):
self.abstract = str(self.abstract)
if self.rights is not None and not isinstance(self.rights, str):
self.rights = str(self.rights)
if not isinstance(self.creators, list):
self.creators = [self.creators] if self.creators is not None else []
self.creators = [v if isinstance(v, PhysicalEntityId) else PhysicalEntityId(v) for v in self.creators]
if not isinstance(self.contributors, list):
self.contributors = [self.contributors] if self.contributors is not None else []
self.contributors = [v if isinstance(v, PhysicalEntityId) else PhysicalEntityId(v) for v in self.contributors]
if not isinstance(self.contacts, list):
self.contacts = [self.contacts] if self.contacts is not None else []
self.contacts = [v if isinstance(v, PhysicalEntityId) else PhysicalEntityId(v) for v in self.contacts]
if not isinstance(self.keywords, list):
self.keywords = [self.keywords] if self.keywords is not None else []
self.keywords = [v if isinstance(v, str) else str(v) for v in self.keywords]
super().__post_init__(**kwargs)
self.type = str(self.class_name)
@dataclass
class BuiltEnvironmentFeature(PhysicalEntity):
_inherited_slots: ClassVar[List[str]] = []
class_class_uri: ClassVar[URIRef] = LINKML_COMMON["BuiltEnvironmentFeature"]
class_class_curie: ClassVar[str] = "linkml_common:BuiltEnvironmentFeature"
class_name: ClassVar[str] = "BuiltEnvironmentFeature"
class_model_uri: ClassVar[URIRef] = LINKML_COMMON.BuiltEnvironmentFeature
id: Union[str, BuiltEnvironmentFeatureId] = None
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
if self._is_empty(self.id):
self.MissingRequiredField("id")
if not isinstance(self.id, BuiltEnvironmentFeatureId):
self.id = BuiltEnvironmentFeatureId(self.id)
super().__post_init__(**kwargs)
self.type = str(self.class_name)
@dataclass
class Facility(BuiltEnvironmentFeature):
_inherited_slots: ClassVar[List[str]] = []
class_class_uri: ClassVar[URIRef] = LINKML_COMMON["Facility"]
class_class_curie: ClassVar[str] = "linkml_common:Facility"
class_name: ClassVar[str] = "Facility"
class_model_uri: ClassVar[URIRef] = LINKML_COMMON.Facility
id: Union[str, FacilityId] = None
located_at_place: Optional[Union[str, PlaceId]] = None
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
if self._is_empty(self.id):
self.MissingRequiredField("id")
if not isinstance(self.id, FacilityId):
self.id = FacilityId(self.id)
if self.located_at_place is not None and not isinstance(self.located_at_place, PlaceId):
self.located_at_place = PlaceId(self.located_at_place)
super().__post_init__(**kwargs)
self.type = str(self.class_name)
@dataclass
class Building(Facility):
_inherited_slots: ClassVar[List[str]] = []
class_class_uri: ClassVar[URIRef] = LINKML_COMMON["Building"]
class_class_curie: ClassVar[str] = "linkml_common:Building"
class_name: ClassVar[str] = "Building"
class_model_uri: ClassVar[URIRef] = LINKML_COMMON.Building
id: Union[str, BuildingId] = None
located_at_place: Optional[Union[str, PlaceId]] = None
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
if self._is_empty(self.id):
self.MissingRequiredField("id")
if not isinstance(self.id, BuildingId):
self.id = BuildingId(self.id)
if self.located_at_place is not None and not isinstance(self.located_at_place, PlaceId):
self.located_at_place = PlaceId(self.located_at_place)
super().__post_init__(**kwargs)
self.type = str(self.class_name)
@dataclass
class BuiltSystem(BuiltEnvironmentFeature):
_inherited_slots: ClassVar[List[str]] = []
class_class_uri: ClassVar[URIRef] = LINKML_COMMON["BuiltSystem"]
class_class_curie: ClassVar[str] = "linkml_common:BuiltSystem"
class_name: ClassVar[str] = "BuiltSystem"
class_model_uri: ClassVar[URIRef] = LINKML_COMMON.BuiltSystem
id: Union[str, BuiltSystemId] = None
def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
if self._is_empty(self.id):