diff --git a/demos/demo2/demo2_dzwald.py b/demos/demo2/demo2_dzwald.py index 675907d166504ec0b3528f258d86d7238e41c341..50305af51703a1185497ffc894b3d6adafd4651b 100644 --- a/demos/demo2/demo2_dzwald.py +++ b/demos/demo2/demo2_dzwald.py @@ -5,14 +5,10 @@ from typing import List import basyx from basyx.aas import model from basyx.aas.adapter.json import json_serialization -from s3i import IdentityProvider, TokenType, Directory import asyncio import logging import datetime -import api -import broker_api -import helpers currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) parentdir = os.path.dirname(currentdir) @@ -33,14 +29,6 @@ forestmanager_hmi_id = "s3i:e8ef672c-109b-4c36-8999-f4ababa0bffc" forstify_hmi_id = "s3i:8a8ee1ab-63d2-42ea-92d1-1ae682a55e7a" -def authenticate(): - idp = IdentityProvider( - grant_type="client_credentials", - client_id=dzwald_id, - client_secret=dzwald_secret, - ) - return idp - def create_sortiment(): sortiment = models.Sortiment( @@ -440,41 +428,7 @@ def write_aas(): json_serialization.write_aas_json_file(file, objstore) -def main(): - # obtain access token - idp = authenticate() - access_token = idp.get_token(TokenType.ACCESS_TOKEN) - - # update policy for other things to read the S3I-Directory entry of your thing - # view helpers.py for a better insight - # function call is commented because it needs to be done a single time - s3i_dir = Directory("https://dir.s3i.vswf.dev/api/2/", access_token) - # helpers.grant_entry_read_permissions(s3i_dir, dzwald_id, [forestmanager_hmi_id, forstify_hmi_id]) - - # create AAS - aas, submodels = create_aas() - - # update S3I-Directory entry to include a short description of your AAS - helpers.add_aas_to_dir_entry(aas, s3i_dir, dzwald_id) - - # wrap them into a ModelProvider to expose an Interface of type 2 - provider = api.ModelProvider(aas, submodels) - - # now the REST API definded in DAAS-2 can be used - # the following example will print all submodel references to the console - # corrosponding to GetAllSubmodelReferences: - print(provider.getValue("/aas/submodels")) - - # now create a server instance that will translate incoming S3I-B messages - # to methods exposed by the ModelProvider - loop = asyncio.get_event_loop() - server = broker_api.S3IBServer(access_token, provider, dzwald_id, loop) - - try: - server.run() - except KeyboardInterrupt: - loop.stop() - if __name__ == "__main__": - main() + write_aas() + # main() diff --git a/demos/demo2/demo2_dzwald_example.json b/demos/demo2/demo2_dzwald_example.json index b3849e7819a0039b06fa3fea475766e0d684653a..40a737e6bc80a07436ddb78e0293bcc8abe60ebb 100644 --- a/demos/demo2/demo2_dzwald_example.json +++ b/demos/demo2/demo2_dzwald_example.json @@ -313,7 +313,7 @@ }, "qualifiers": [ { - "value": "One", + "value": "ZeroToOne", "kind": "ConceptQualifier", "valueType": "xs:string", "type": "Cardinality" @@ -382,7 +382,7 @@ }, "qualifiers": [ { - "value": "One", + "value": "ZeroToOne", "kind": "ConceptQualifier", "valueType": "xs:string", "type": "Cardinality" @@ -405,7 +405,7 @@ }, "qualifiers": [ { - "value": "One", + "value": "ZeroToOne", "kind": "ConceptQualifier", "valueType": "xs:string", "type": "Cardinality" @@ -1957,6 +1957,14 @@ } ] }, + "qualifiers": [ + { + "value": "ZeroToOne", + "kind": "ConceptQualifier", + "valueType": "xs:string", + "type": "Cardinality" + } + ], "value": [ { "idShort": "Name", @@ -2557,6 +2565,14 @@ } ] }, + "qualifiers": [ + { + "value": "ZeroToOne", + "kind": "ConceptQualifier", + "valueType": "xs:string", + "type": "Cardinality" + } + ], "value": [ { "idShort": "Name", @@ -4408,7 +4424,7 @@ }, "qualifiers": [ { - "value": "One", + "value": "ZeroToOne", "kind": "ConceptQualifier", "valueType": "xs:string", "type": "Cardinality" @@ -4477,7 +4493,7 @@ }, "qualifiers": [ { - "value": "One", + "value": "ZeroToOne", "kind": "ConceptQualifier", "valueType": "xs:string", "type": "Cardinality" @@ -5677,7 +5693,7 @@ }, "qualifiers": [ { - "value": "One", + "value": "ZeroToOne", "kind": "ConceptQualifier", "valueType": "xs:string", "type": "Cardinality" @@ -5700,7 +5716,7 @@ }, "qualifiers": [ { - "value": "One", + "value": "ZeroToOne", "kind": "ConceptQualifier", "valueType": "xs:string", "type": "Cardinality" @@ -5708,6 +5724,50 @@ ], "value": "in", "valueType": "xs:string" + }, + { + "idShort": "Sortimentstyp", + "modelType": "Property", + "semanticId": { + "type": "GlobalReference", + "keys": [ + { + "type": "GlobalReference", + "value": "https://admin-shell.io/kwh40/forestml40/Holzliste/0/1/Preismatrix/Preismatrixeintrag/Sortimentstyp" + } + ] + }, + "qualifiers": [ + { + "value": "ZeroToOne", + "kind": "ConceptQualifier", + "valueType": "xs:string", + "type": "Cardinality" + } + ], + "valueType": "xs:string" + }, + { + "idShort": "Sorte", + "modelType": "Property", + "semanticId": { + "type": "GlobalReference", + "keys": [ + { + "type": "GlobalReference", + "value": "https://admin-shell.io/kwh40/forestml40/Holzliste/0/1/Preismatrix/Preismatrixeintrag/Sorte" + } + ] + }, + "qualifiers": [ + { + "value": "One", + "kind": "ConceptQualifier", + "valueType": "xs:string", + "type": "Cardinality" + } + ], + "valueType": "xs:string" } ] }, @@ -5815,7 +5875,7 @@ }, "qualifiers": [ { - "value": "One", + "value": "ZeroToOne", "kind": "ConceptQualifier", "valueType": "xs:string", "type": "Cardinality" @@ -5838,7 +5898,7 @@ }, "qualifiers": [ { - "value": "One", + "value": "ZeroToOne", "kind": "ConceptQualifier", "valueType": "xs:string", "type": "Cardinality" @@ -5846,6 +5906,50 @@ ], "value": "a", "valueType": "xs:string" + }, + { + "idShort": "Sortimentstyp", + "modelType": "Property", + "semanticId": { + "type": "GlobalReference", + "keys": [ + { + "type": "GlobalReference", + "value": "https://admin-shell.io/kwh40/forestml40/Holzliste/0/1/Preismatrix/Preismatrixeintrag/Sortimentstyp" + } + ] + }, + "qualifiers": [ + { + "value": "ZeroToOne", + "kind": "ConceptQualifier", + "valueType": "xs:string", + "type": "Cardinality" + } + ], + "valueType": "xs:string" + }, + { + "idShort": "Sorte", + "modelType": "Property", + "semanticId": { + "type": "GlobalReference", + "keys": [ + { + "type": "GlobalReference", + "value": "https://admin-shell.io/kwh40/forestml40/Holzliste/0/1/Preismatrix/Preismatrixeintrag/Sorte" + } + ] + }, + "qualifiers": [ + { + "value": "One", + "kind": "ConceptQualifier", + "valueType": "xs:string", + "type": "Cardinality" + } + ], + "valueType": "xs:string" } ] } @@ -6791,7 +6895,7 @@ }, "qualifiers": [ { - "value": "One", + "value": "ZeroToOne", "kind": "ConceptQualifier", "valueType": "xs:string", "type": "Cardinality" @@ -6814,7 +6918,7 @@ }, "qualifiers": [ { - "value": "One", + "value": "ZeroToOne", "kind": "ConceptQualifier", "valueType": "xs:string", "type": "Cardinality" @@ -6822,6 +6926,50 @@ ], "value": "in", "valueType": "xs:string" + }, + { + "idShort": "Sortimentstyp", + "modelType": "Property", + "semanticId": { + "type": "GlobalReference", + "keys": [ + { + "type": "GlobalReference", + "value": "https://admin-shell.io/kwh40/forestml40/Verkaufslos/0/1/Preismatrix/Preismatrixeintrag/Sortimentstyp" + } + ] + }, + "qualifiers": [ + { + "value": "ZeroToOne", + "kind": "ConceptQualifier", + "valueType": "xs:string", + "type": "Cardinality" + } + ], + "valueType": "xs:string" + }, + { + "idShort": "Sorte", + "modelType": "Property", + "semanticId": { + "type": "GlobalReference", + "keys": [ + { + "type": "GlobalReference", + "value": "https://admin-shell.io/kwh40/forestml40/Verkaufslos/0/1/Preismatrix/Preismatrixeintrag/Sorte" + } + ] + }, + "qualifiers": [ + { + "value": "One", + "kind": "ConceptQualifier", + "valueType": "xs:string", + "type": "Cardinality" + } + ], + "valueType": "xs:string" } ] }, @@ -6929,7 +7077,7 @@ }, "qualifiers": [ { - "value": "One", + "value": "ZeroToOne", "kind": "ConceptQualifier", "valueType": "xs:string", "type": "Cardinality" @@ -6952,7 +7100,7 @@ }, "qualifiers": [ { - "value": "One", + "value": "ZeroToOne", "kind": "ConceptQualifier", "valueType": "xs:string", "type": "Cardinality" @@ -6960,6 +7108,50 @@ ], "value": "a", "valueType": "xs:string" + }, + { + "idShort": "Sortimentstyp", + "modelType": "Property", + "semanticId": { + "type": "GlobalReference", + "keys": [ + { + "type": "GlobalReference", + "value": "https://admin-shell.io/kwh40/forestml40/Verkaufslos/0/1/Preismatrix/Preismatrixeintrag/Sortimentstyp" + } + ] + }, + "qualifiers": [ + { + "value": "ZeroToOne", + "kind": "ConceptQualifier", + "valueType": "xs:string", + "type": "Cardinality" + } + ], + "valueType": "xs:string" + }, + { + "idShort": "Sorte", + "modelType": "Property", + "semanticId": { + "type": "GlobalReference", + "keys": [ + { + "type": "GlobalReference", + "value": "https://admin-shell.io/kwh40/forestml40/Verkaufslos/0/1/Preismatrix/Preismatrixeintrag/Sorte" + } + ] + }, + "qualifiers": [ + { + "value": "One", + "kind": "ConceptQualifier", + "valueType": "xs:string", + "type": "Cardinality" + } + ], + "valueType": "xs:string" } ] } @@ -7490,6 +7682,14 @@ } ] }, + "qualifiers": [ + { + "value": "ZeroToOne", + "kind": "ConceptQualifier", + "valueType": "xs:string", + "type": "Cardinality" + } + ], "value": [ { "idShort": "Name", diff --git a/model/configs.py b/model/configs.py index 89a096c6420ebd366e06e89ebd1ffaeec3ce1bf3..44c7b25a2cafdcf330c268d2e21c54c8a431de73 100644 --- a/model/configs.py +++ b/model/configs.py @@ -82,6 +82,7 @@ STEHENDER_BAUM = "StehenderBaum" BHD = "bhd" HOEHE = "Hoehe" SORTIMENTSTYP = "Sortimentstyp" +SORTIMENTSTYP_OPTIONAL = "Sortimentstyp" STEHENDER_BAUM_BAUMART = "StehenderBaumBaumart" BAUMART = "Baumart" @@ -90,6 +91,7 @@ BAUMART = "Baumart" HOLZLISTE = "Holzliste" HOLZART = "Holzart" SORTE = "Sorte" +SORTE_OPTIONAL = "Sorte" # Verkaufslos HOLZLISTEN = "Holzlisten" @@ -210,34 +212,34 @@ KWARGS = { # ID_SHORT will be that of the provided KONTAKTROLLE # ID_SHORT: KONTAKT, DESCRIPTION: None, - SEMANTIC_ID: b4f_semantic_id_ref("Kontakt"), + SEMANTIC_ID: None, QUALIFIER: tuple([]), }, FIRMENNAME: { ID_SHORT: FIRMENNAME, DESCRIPTION: None, - SEMANTIC_ID: eclass_semantic_id_ref("0173-1#02-AAW001#001"), + SEMANTIC_ID: None, VALUE_TYPE: str, QUALIFIER: tuple([optional_qualifier()]), }, ANREDE: { ID_SHORT: ANREDE, DESCRIPTION: None, - SEMANTIC_ID: eclass_semantic_id_ref("0173-1#02-AAO208#003"), + SEMANTIC_ID: None, VALUE_TYPE: str, QUALIFIER: tuple([optional_qualifier()]), }, VORNAME: { ID_SHORT: VORNAME, DESCRIPTION: None, - SEMANTIC_ID: eclass_semantic_id_ref("0173-1#02-AAO206#002"), + SEMANTIC_ID: None, VALUE_TYPE: str, QUALIFIER: tuple([optional_qualifier()]), }, NACHNAME: { ID_SHORT: NACHNAME, DESCRIPTION: None, - SEMANTIC_ID: eclass_semantic_id_ref("0173-1#02-AAO205#002"), + SEMANTIC_ID: None, VALUE_TYPE: str, QUALIFIER: tuple([optional_qualifier()]), }, @@ -256,7 +258,7 @@ KWARGS = { TELEFON: { ID_SHORT: TELEFON, DESCRIPTION: None, - SEMANTIC_ID: eclass_semantic_id_ref("0173-1#02-AAO136#002"), + SEMANTIC_ID: None, VALUE_TYPE: str, QUALIFIER: tuple([iterable_optional_qualifier()]), }, @@ -268,7 +270,7 @@ KWARGS = { EMAIL: { ID_SHORT: EMAIL, DESCRIPTION: None, - SEMANTIC_ID: eclass_semantic_id_ref("0173-1#02-AAO198#002"), + SEMANTIC_ID: None, VALUE_TYPE: str, QUALIFIER: tuple([iterable_optional_qualifier()]), }, @@ -299,7 +301,7 @@ KWARGS = { ID_SHORT: UMRING, DESCRIPTION: None, SEMANTIC_ID: None, - QUALIFIER: tuple([]), + QUALIFIER: tuple([optional_qualifier()]), }, NAME: { ID_SHORT: NAME, @@ -463,19 +465,19 @@ KWARGS = { LIEFERANT: { ID_SHORT: LIEFERANT, DESCRIPTION: None, - SEMANTIC_ID: b4f_semantic_id_ref("Kontakt"), + SEMANTIC_ID: None, QUALIFIER: tuple([optional_qualifier()]), }, KAEUFER: { ID_SHORT: KAEUFER, DESCRIPTION: None, - SEMANTIC_ID: b4f_semantic_id_ref("Kontakt"), + SEMANTIC_ID: None, QUALIFIER: tuple([optional_qualifier()]), }, FUHRMANN: { ID_SHORT: FUHRMANN, DESCRIPTION: None, - SEMANTIC_ID: b4f_semantic_id_ref("Kontakt"), + SEMANTIC_ID: None, QUALIFIER: tuple([optional_qualifier()]), }, @@ -558,7 +560,7 @@ KWARGS = { ID_SHORT: POLTER_LISTE, DESCRIPTION: None, SEMANTIC_ID: None, - QUALIFIER: tuple([mandatory_qualifier()]), + QUALIFIER: tuple([optional_qualifier()]), }, POLTER: { ID_SHORT: POLTER, @@ -649,6 +651,13 @@ KWARGS = { VALUE_TYPE: str, QUALIFIER: tuple([mandatory_qualifier()]), }, + SORTIMENTSTYP_OPTIONAL: { + ID_SHORT: SORTIMENTSTYP, + DESCRIPTION: None, + SEMANTIC_ID: None, + VALUE_TYPE: str, + QUALIFIER: tuple([optional_qualifier()]), + }, # Holzliste HOLZLISTE: { @@ -670,6 +679,13 @@ KWARGS = { VALUE_TYPE: str, QUALIFIER: tuple([mandatory_qualifier()]), }, + SORTE_OPTIONAL: { + ID_SHORT: SORTE, + DESCRIPTION: None, + SEMANTIC_ID: None, + VALUE_TYPE: str, + QUALIFIER: tuple([mandatory_qualifier()]), + }, HOLZPREISBEREICH_BAUMART: { ID_SHORT: BAUMART, DESCRIPTION: None, @@ -807,14 +823,14 @@ KWARGS = { DESCRIPTION: None, SEMANTIC_ID: None, VALUE_TYPE: str, - QUALIFIER: tuple([mandatory_qualifier()]), + QUALIFIER: tuple([optional_qualifier()]), }, GUETEKLASSE_BIS: { ID_SHORT: GUETEKLASSE_BIS, DESCRIPTION: None, SEMANTIC_ID: None, VALUE_TYPE: str, - QUALIFIER: tuple([mandatory_qualifier()]), + QUALIFIER: tuple([optional_qualifier()]), }, LAENGE_VON: { ID_SHORT: LAENGE_VON, diff --git a/model/generic_model.py b/model/generic_model.py index cbb3f8ed6e3eb5c45fe42ce8e177b3b9feaf7f40..d41b97645090aac9a1cfb8a8e205dce3650ce57a 100644 --- a/model/generic_model.py +++ b/model/generic_model.py @@ -440,7 +440,7 @@ class Arbeitsauftrag(Submodel): Qualifier( type_="Cardinality", value_type=str, - value="One", + value="ZeroToOne", value_id=None, kind=QualifierKind.CONCEPT_QUALIFIER, semantic_id=None, @@ -617,7 +617,7 @@ class Arbeitsauftrag(Submodel): Qualifier( type_="Cardinality", value_type=str, - value="One", + value="ZeroToOne", value_id=None, kind=QualifierKind.CONCEPT_QUALIFIER, semantic_id=None, @@ -676,7 +676,7 @@ class Arbeitsauftrag(Submodel): Qualifier( type_="Cardinality", value_type=str, - value="One", + value="ZeroToOne", value_id=None, kind=QualifierKind.CONCEPT_QUALIFIER, semantic_id=None, @@ -2156,17 +2156,17 @@ class Arbeitsauftrag(Submodel): def __init__( self, nummer: Union[int, Nummer], - sortimentstyp: Union[str, Sortimentstyp], sorte: Union[str, Sorte], holzart: Union[str, Holzart], - gueteklasseVon: Union[str, GueteklasseVon], - gueteklasseBis: Union[str, GueteklasseBis], laengeVon: Union[float, LaengeVon], laengeBis: Union[float, LaengeBis], mindestzopf: Union[float, Mindestzopf], maxDurchmesser: Union[float, MaxDurchmesser], laengenzugabe: Union[float, Laengenzugabe], mengenschaetzung: Union[float, Mengenschaetzung], + sortimentstyp: Optional[Union[str, Sortimentstyp]] = None, + gueteklasseVon: Optional[Union[str, GueteklasseVon]] = None, + gueteklasseBis: Optional[Union[str, GueteklasseBis]] = None, bemerkung: Optional[Union[str, Bemerkung]] = None, ergebnis: Optional[Ergebnis] = None, kaeufer: Optional[Kaeufer] = None, @@ -5868,7 +5868,17 @@ class Beobachtung(Submodel): embedded_data_specifications: Iterable[EmbeddedDataSpecification] = None, ): if qualifier is None: - qualifier = () + qualifier = ( + Qualifier( + type_="Cardinality", + value_type=str, + value="ZeroToOne", + value_id=None, + kind=QualifierKind.CONCEPT_QUALIFIER, + semantic_id=None, + supplemental_semantic_id=(), + ), + ) if embedded_data_specifications is None: embedded_data_specifications = [] @@ -6375,7 +6385,7 @@ class Beobachtung(Submodel): id_: str, name: Union[str, Name], beschreibung: Union[str, Beschreibung], - umring: Umring, + umring: Optional[Umring] = None, position: Optional[Position] = None, id_short: str = "Beobachtung", display_name: Optional[LangStringSet] = None, @@ -6994,7 +7004,17 @@ class Bestandesdaten(Submodel): embedded_data_specifications: Iterable[EmbeddedDataSpecification] = None, ): if qualifier is None: - qualifier = () + qualifier = ( + Qualifier( + type_="Cardinality", + value_type=str, + value="ZeroToOne", + value_id=None, + kind=QualifierKind.CONCEPT_QUALIFIER, + semantic_id=None, + supplemental_semantic_id=(), + ), + ) if embedded_data_specifications is None: embedded_data_specifications = [] @@ -8065,7 +8085,7 @@ class Bestandesdaten(Submodel): def __init__( self, id_: str, - umring: Umring, + umring: Optional[Umring] = None, waldbesitzer: Optional[Waldbesitzer] = None, baumarten: Optional[Union[Iterable[str], Baumarten]] = None, id_short: str = "Bestandesdaten", @@ -11156,7 +11176,7 @@ class Holzliste(Submodel): Qualifier( type_="Cardinality", value_type=str, - value="One", + value="ZeroToOne", value_id=None, kind=QualifierKind.CONCEPT_QUALIFIER, semantic_id=None, @@ -12031,7 +12051,7 @@ class Holzliste(Submodel): Qualifier( type_="Cardinality", value_type=str, - value="ZeroToOne", + value="One", value_id=None, kind=QualifierKind.CONCEPT_QUALIFIER, semantic_id=None, @@ -12991,7 +13011,7 @@ class Holzliste(Submodel): Qualifier( type_="Cardinality", value_type=str, - value="One", + value="ZeroToOne", value_id=None, kind=QualifierKind.CONCEPT_QUALIFIER, semantic_id=None, @@ -13247,7 +13267,7 @@ class Holzliste(Submodel): Qualifier( type_="Cardinality", value_type=str, - value="One", + value="ZeroToOne", value_id=None, kind=QualifierKind.CONCEPT_QUALIFIER, semantic_id=None, @@ -13300,6 +13320,124 @@ class Holzliste(Submodel): embedded_data_specifications: Iterable[ EmbeddedDataSpecification ] = None, + ): + if qualifier is None: + qualifier = ( + Qualifier( + type_="Cardinality", + value_type=str, + value="ZeroToOne", + value_id=None, + kind=QualifierKind.CONCEPT_QUALIFIER, + semantic_id=None, + supplemental_semantic_id=(), + ), + ) + + if embedded_data_specifications is None: + embedded_data_specifications = [] + + super().__init__( + value=value, + id_short=id_short, + value_type=value_type, + value_id=value_id, + display_name=display_name, + category=category, + description=description, + semantic_id=semantic_id, + qualifier=qualifier, + kind=kind, + extension=extension, + supplemental_semantic_id=supplemental_semantic_id, + embedded_data_specifications=embedded_data_specifications, + ) + + class Sortimentstyp(Property): + def __init__( + self, + value: str, + id_short: str = "Sortimentstyp", + value_type: DataTypeDefXsd = str, + value_id: Optional[Reference] = None, + display_name: Optional[LangStringSet] = None, + category: Optional[str] = None, + description: Optional[LangStringSet] = None, + semantic_id: Optional[Reference] = GlobalReference( + key=( + Key( + type_=KeyTypes.GLOBAL_REFERENCE, + value="https://admin-shell.io/kwh40/forestml40/Holzliste/0/1/Preismatrix/Preismatrixeintrag/Sortimentstyp", + ), + ), + referred_semantic_id=None, + ), + qualifier: Iterable[Qualifier] = None, + kind: ModelingKind = ModelingKind.INSTANCE, + extension: Iterable[Extension] = (), + supplemental_semantic_id: Iterable[Reference] = (), + embedded_data_specifications: Iterable[ + EmbeddedDataSpecification + ] = None, + ): + if qualifier is None: + qualifier = ( + Qualifier( + type_="Cardinality", + value_type=str, + value="ZeroToOne", + value_id=None, + kind=QualifierKind.CONCEPT_QUALIFIER, + semantic_id=None, + supplemental_semantic_id=(), + ), + ) + + if embedded_data_specifications is None: + embedded_data_specifications = [] + + super().__init__( + value=value, + id_short=id_short, + value_type=value_type, + value_id=value_id, + display_name=display_name, + category=category, + description=description, + semantic_id=semantic_id, + qualifier=qualifier, + kind=kind, + extension=extension, + supplemental_semantic_id=supplemental_semantic_id, + embedded_data_specifications=embedded_data_specifications, + ) + + class Sorte(Property): + def __init__( + self, + value: str, + id_short: str = "Sorte", + value_type: DataTypeDefXsd = str, + value_id: Optional[Reference] = None, + display_name: Optional[LangStringSet] = None, + category: Optional[str] = None, + description: Optional[LangStringSet] = None, + semantic_id: Optional[Reference] = GlobalReference( + key=( + Key( + type_=KeyTypes.GLOBAL_REFERENCE, + value="https://admin-shell.io/kwh40/forestml40/Holzliste/0/1/Preismatrix/Preismatrixeintrag/Sorte", + ), + ), + referred_semantic_id=None, + ), + qualifier: Iterable[Qualifier] = None, + kind: ModelingKind = ModelingKind.INSTANCE, + extension: Iterable[Extension] = (), + supplemental_semantic_id: Iterable[Reference] = (), + embedded_data_specifications: Iterable[ + EmbeddedDataSpecification + ] = None, ): if qualifier is None: qualifier = ( @@ -13336,14 +13474,16 @@ class Holzliste(Submodel): def __init__( self, preis: Union[float, Preis], - gueteklasseVon: Union[str, GueteklasseVon], - gueteklasseBis: Union[str, GueteklasseBis], + sorte: Union[str, Sorte], mittendurchmesserVon: Optional[ Union[float, MittendurchmesserVon] ] = None, mittendurchmesserBis: Optional[ Union[float, MittendurchmesserBis] ] = None, + gueteklasseVon: Optional[Union[str, GueteklasseVon]] = None, + gueteklasseBis: Optional[Union[str, GueteklasseBis]] = None, + sortimentstyp: Optional[Union[str, Sortimentstyp]] = None, id_short: str = "Preismatrixeintrag", display_name: Optional[LangStringSet] = None, category: Optional[str] = None, @@ -13409,6 +13549,14 @@ class Holzliste(Submodel): if gueteklasseBis and not isinstance(gueteklasseBis, SubmodelElement): gueteklasseBis = self.GueteklasseBis(gueteklasseBis) + # Build a submodel element if a raw value was passed in the argument + if sortimentstyp and not isinstance(sortimentstyp, SubmodelElement): + sortimentstyp = self.Sortimentstyp(sortimentstyp) + + # Build a submodel element if a raw value was passed in the argument + if sorte and not isinstance(sorte, SubmodelElement): + sorte = self.Sorte(sorte) + # Add all passed/initialized submodel elements to a single list embedded_submodel_elements = [] for se_arg in [ @@ -13417,6 +13565,8 @@ class Holzliste(Submodel): mittendurchmesserBis, gueteklasseVon, gueteklasseBis, + sortimentstyp, + sorte, ]: if se_arg is None: continue @@ -13525,10 +13675,10 @@ class Holzliste(Submodel): self, id_: str, kopfdaten: Kopfdaten, - sortimentstyp: Union[str, Sortimentstyp], sorte: Union[str, Sorte], holzart: Union[str, Holzart], - polterListe: PolterListe, + sortimentstyp: Optional[Union[str, Sortimentstyp]] = None, + polterListe: Optional[PolterListe] = None, preismatrix: Optional[Preismatrix] = None, id_short: str = "Holzliste", display_name: Optional[LangStringSet] = None, @@ -15974,7 +16124,7 @@ class Verkaufslos(Submodel): Qualifier( type_="Cardinality", value_type=str, - value="One", + value="ZeroToOne", value_id=None, kind=QualifierKind.CONCEPT_QUALIFIER, semantic_id=None, @@ -16027,6 +16177,124 @@ class Verkaufslos(Submodel): embedded_data_specifications: Iterable[ EmbeddedDataSpecification ] = None, + ): + if qualifier is None: + qualifier = ( + Qualifier( + type_="Cardinality", + value_type=str, + value="ZeroToOne", + value_id=None, + kind=QualifierKind.CONCEPT_QUALIFIER, + semantic_id=None, + supplemental_semantic_id=(), + ), + ) + + if embedded_data_specifications is None: + embedded_data_specifications = [] + + super().__init__( + value=value, + id_short=id_short, + value_type=value_type, + value_id=value_id, + display_name=display_name, + category=category, + description=description, + semantic_id=semantic_id, + qualifier=qualifier, + kind=kind, + extension=extension, + supplemental_semantic_id=supplemental_semantic_id, + embedded_data_specifications=embedded_data_specifications, + ) + + class Sortimentstyp(Property): + def __init__( + self, + value: str, + id_short: str = "Sortimentstyp", + value_type: DataTypeDefXsd = str, + value_id: Optional[Reference] = None, + display_name: Optional[LangStringSet] = None, + category: Optional[str] = None, + description: Optional[LangStringSet] = None, + semantic_id: Optional[Reference] = GlobalReference( + key=( + Key( + type_=KeyTypes.GLOBAL_REFERENCE, + value="https://admin-shell.io/kwh40/forestml40/Verkaufslos/0/1/Preismatrix/Preismatrixeintrag/Sortimentstyp", + ), + ), + referred_semantic_id=None, + ), + qualifier: Iterable[Qualifier] = None, + kind: ModelingKind = ModelingKind.INSTANCE, + extension: Iterable[Extension] = (), + supplemental_semantic_id: Iterable[Reference] = (), + embedded_data_specifications: Iterable[ + EmbeddedDataSpecification + ] = None, + ): + if qualifier is None: + qualifier = ( + Qualifier( + type_="Cardinality", + value_type=str, + value="ZeroToOne", + value_id=None, + kind=QualifierKind.CONCEPT_QUALIFIER, + semantic_id=None, + supplemental_semantic_id=(), + ), + ) + + if embedded_data_specifications is None: + embedded_data_specifications = [] + + super().__init__( + value=value, + id_short=id_short, + value_type=value_type, + value_id=value_id, + display_name=display_name, + category=category, + description=description, + semantic_id=semantic_id, + qualifier=qualifier, + kind=kind, + extension=extension, + supplemental_semantic_id=supplemental_semantic_id, + embedded_data_specifications=embedded_data_specifications, + ) + + class Sorte(Property): + def __init__( + self, + value: str, + id_short: str = "Sorte", + value_type: DataTypeDefXsd = str, + value_id: Optional[Reference] = None, + display_name: Optional[LangStringSet] = None, + category: Optional[str] = None, + description: Optional[LangStringSet] = None, + semantic_id: Optional[Reference] = GlobalReference( + key=( + Key( + type_=KeyTypes.GLOBAL_REFERENCE, + value="https://admin-shell.io/kwh40/forestml40/Verkaufslos/0/1/Preismatrix/Preismatrixeintrag/Sorte", + ), + ), + referred_semantic_id=None, + ), + qualifier: Iterable[Qualifier] = None, + kind: ModelingKind = ModelingKind.INSTANCE, + extension: Iterable[Extension] = (), + supplemental_semantic_id: Iterable[Reference] = (), + embedded_data_specifications: Iterable[ + EmbeddedDataSpecification + ] = None, ): if qualifier is None: qualifier = ( @@ -16063,14 +16331,16 @@ class Verkaufslos(Submodel): def __init__( self, preis: Union[float, Preis], - gueteklasseVon: Union[str, GueteklasseVon], - gueteklasseBis: Union[str, GueteklasseBis], + sorte: Union[str, Sorte], mittendurchmesserVon: Optional[ Union[float, MittendurchmesserVon] ] = None, mittendurchmesserBis: Optional[ Union[float, MittendurchmesserBis] ] = None, + gueteklasseVon: Optional[Union[str, GueteklasseVon]] = None, + gueteklasseBis: Optional[Union[str, GueteklasseBis]] = None, + sortimentstyp: Optional[Union[str, Sortimentstyp]] = None, id_short: str = "Preismatrixeintrag", display_name: Optional[LangStringSet] = None, category: Optional[str] = None, @@ -16136,6 +16406,14 @@ class Verkaufslos(Submodel): if gueteklasseBis and not isinstance(gueteklasseBis, SubmodelElement): gueteklasseBis = self.GueteklasseBis(gueteklasseBis) + # Build a submodel element if a raw value was passed in the argument + if sortimentstyp and not isinstance(sortimentstyp, SubmodelElement): + sortimentstyp = self.Sortimentstyp(sortimentstyp) + + # Build a submodel element if a raw value was passed in the argument + if sorte and not isinstance(sorte, SubmodelElement): + sorte = self.Sorte(sorte) + # Add all passed/initialized submodel elements to a single list embedded_submodel_elements = [] for se_arg in [ @@ -16144,6 +16422,8 @@ class Verkaufslos(Submodel): mittendurchmesserBis, gueteklasseVon, gueteklasseBis, + sortimentstyp, + sorte, ]: if se_arg is None: continue @@ -18358,7 +18638,17 @@ class ZuFaellendeBaeume(Submodel): embedded_data_specifications: Iterable[EmbeddedDataSpecification] = None, ): if qualifier is None: - qualifier = () + qualifier = ( + Qualifier( + type_="Cardinality", + value_type=str, + value="ZeroToOne", + value_id=None, + kind=QualifierKind.CONCEPT_QUALIFIER, + semantic_id=None, + supplemental_semantic_id=(), + ), + ) if embedded_data_specifications is None: embedded_data_specifications = [] @@ -19665,7 +19955,7 @@ class ZuFaellendeBaeume(Submodel): self, id_: str, beschreibung: Union[str, Beschreibung], - umring: Umring, + umring: Optional[Umring] = None, position: Optional[Position] = None, baumliste: Optional[Baumliste] = None, id_short: str = "ZuFaellendeBaeume", diff --git a/model/models.py b/model/models.py index ca01fe1481048756ebcd65997204a1b40f2a85da..8d6947b870e4e9772c0433b2daf75a8f55484b09 100644 --- a/model/models.py +++ b/model/models.py @@ -117,7 +117,9 @@ class Preismatrixeintrag(SubmodelElementCollection): mittendurchmesser_von: Optional[float] = None, mittendurchmesser_bis: Optional[float] = None, gueteklasse_von: Optional[enums.Gueteklasse] = enums.OptionalEnum, - gueteklasse_bis: Optional[enums.Gueteklasse] = enums.OptionalEnum + gueteklasse_bis: Optional[enums.Gueteklasse] = enums.OptionalEnum, + sortimentstyp: Optional[enums.Sortimentstyp] = enums.OptionalEnum, + sorte: Optional[enums.Sorte] = enums.OptionalEnum ): super().__init__(**deepcopy(KWARGS[PREISMATRIXEINTRAG])) self.add_referable(Property(value=preis, **deepcopy(KWARGS[PREIS]))) @@ -125,6 +127,8 @@ class Preismatrixeintrag(SubmodelElementCollection): self.add_referable(Property(value=mittendurchmesser_bis, **deepcopy(KWARGS[MITTENDURCHMESSER_BIS]))) self.add_referable(Property(value=gueteklasse_von.value, **deepcopy(KWARGS[GUETEKLASSE_VON_PREISMATRIX]))) self.add_referable(Property(value=gueteklasse_bis.value, **deepcopy(KWARGS[GUETEKLASSE_BIS_PREISMATRIX]))) + self.add_referable(Property(value=sortimentstyp.value, **deepcopy(KWARGS[SORTIMENTSTYP_OPTIONAL]))) + self.add_referable(Property(value=sorte.value, **deepcopy(KWARGS[SORTE_OPTIONAL]))) class Kopfdaten(SubmodelElementCollection): diff --git a/modellierung/holzliste.puml b/modellierung/holzliste.puml index a549c84c5240fda6a24cbb6b07e2ce6cd3fcc6f4..bf80956aa79cf3c747410abba6193d88d5cb8f73 100644 --- a/modellierung/holzliste.puml +++ b/modellierung/holzliste.puml @@ -59,7 +59,7 @@ class Beobachtung <<Submodel>>{ class ZuFaellendeBaeume <<Submodel>>{ Beschreibung: String [1] - Umring: SEC.Umring [1] + Umring: SEC.Umring [0..1] Position: SEC.Standort [0..1] Baumliste: SEList.SEC.StehenderBaum [0..*] }