예제 #1
0
        private bool FinalizeSelection()
        {
            // get the IRDI
            var si = EntityList.SelectedItem as EclassUtils.SearchItem;

            if (si == null)
            {
                return(false);
            }

            // simply put the IRDI
            this.ResultIRDI = si.IRDI;

            // special case: property selected
            if (si.Entity == "prop")
            {
                var input = new List <EclassUtils.SearchItem>();
                input.Add(si);
                foreach (EclassUtils.SearchItem di in EntityList.Items)
                {
                    if (di != null && di.Entity == si.Entity && di.IRDI == si.IRDI && si != di)
                    {
                        input.Add(di);
                    }
                }

                // own function
                this.ResultCD = EclassUtils.GenerateConceptDescription(input, si.IRDI);
            }

            // ok
            return(true);
        }
            public SetOfNameplate(AasxDefinitionBase bs)
            {
                this.SM_Nameplate = bs.RetrieveReferable <AdminShell.Submodel>("SM_Nameplate");

                this.CD_ManufacturerName = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_ManufacturerName");
                this.CD_ManufacturerProductDesignation = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_ManufacturerProductDesignation");
                this.CD_PhysicalAddress           = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_PhysicalAddress");
                this.CD_CountryCode               = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_CountryCode");
                this.CD_Street                    = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_Street");
                this.CD_Zip                       = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_Zip");
                this.CD_CityTown                  = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_CityTown");
                this.CD_StateCounty               = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_StateCounty");
                this.CD_ManufacturerProductFamily = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_ManufacturerProductFamily");
                this.CD_SerialNumber           = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_SerialNumber");
                this.CD_BatchNumber            = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_BatchNumber");
                this.CD_ProductCountryOfOrigin = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_ProductCountryOfOrigin");
                this.CD_YearOfConstruction = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_YearOfConstruction");
                this.CD_ProductMarking         = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_ProductMarking");
                this.CD_CEQualificationPresent = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_CEQualificationPresent");
                this.CD_File = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_File");
                this.CD_CRUUSLabelingPresent = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_CRUUSLabelingPresent");
            }
예제 #3
0
            public SetOfDefs(AasxDefinitionBase bs)
            {
                this.SM_TechnicalData = bs.RetrieveReferable <AdminShell.Submodel>("SM_TechnicalData");

                this.CD_GeneralInformation = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_GeneralInformation");
                this.CD_ManufacturerName = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_ManufacturerName");
                this.CD_ManufacturerLogo = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_ManufacturerLogo");
                this.CD_ManufacturerProductDesignation = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_ManufacturerProductDesignation");
                this.CD_ManufacturerPartNumber = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_ManufacturerPartNumber");
                this.CD_ManufacturerOrderCode = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_ManufacturerOrderCode");
                this.CD_ProductImage           = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_ProductImage");
                this.CD_ProductClassifications = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_ProductClassifications");
                this.CD_ProductClassificationItem = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_ProductClassificationItem");
                this.CD_ClassificationSystem = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_ClassificationSystem");
                this.CD_SystemVersion       = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_SystemVersion");
                this.CD_ProductClass        = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_ProductClass");
                this.CD_TechnicalProperties = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_TechnicalProperties");
                this.CD_NonstandardizedProperty = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_NonstandardizedProperty");
                this.CD_MainSection        = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_MainSection");
                this.CD_SubSection         = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_SubSection");
                this.CD_FurtherInformation = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_FurtherInformation");
                this.CD_TextStatement = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_TextStatement");
                this.CD_ValidDate     = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_ValidDate");
            }
 public DefinitionsPackageExplorer()
 {
     CD_AasxLoadedNavigateTo = CreateSparseConceptDescription("en", "IRI",
                                                              "AasxLoadedNavigateTo",
                                                              "http://admin-shell.io/aasx-package-explorer/main/AasxLoadedNavigateTo/1/0",
                                                              "Specifies a ReferenceElement, to which the Package Explorer will refer directly " +
                                                              "after loading. Can be situated in any Submodel, but on first hierarchy level.");
 }
        private bool MatchEntity(AdminShell.ConceptDescription cd, string preset, string cell)
        {
            // access
            if (cd == null || preset == null || cell == null)
            {
                return(false);
            }

            // lambda trick to save lines of code
            var res = false;
            Func <string, string> commit = (s) => { res = true; return(s); };

            if (preset == "preferredName")
            {
                cd.IEC61360Content.preferredName = new AdminShell.LangStringSetIEC61360(
                    AdminShell.ListOfLangStr.Parse(commit(cell)));
            }

            if (preset == "shortName")
            {
                cd.IEC61360Content.shortName = new AdminShell.LangStringSetIEC61360(
                    AdminShell.ListOfLangStr.Parse(commit(cell)));
            }

            if (preset == "definition")
            {
                cd.IEC61360Content.definition = new AdminShell.LangStringSetIEC61360(
                    AdminShell.ListOfLangStr.Parse(commit(cell)));
            }

            if (preset == "unit")
            {
                cd.IEC61360Content.unit = commit(cell);
            }

            if (preset == "unitId")
            {
                cd.IEC61360Content.unitId = AdminShell.UnitId.CreateNew(
                    AdminShell.Reference.Parse(commit(cell)));
            }

            if (preset == "sourceOfDefinition")
            {
                cd.IEC61360Content.sourceOfDefinition = commit(cell);
            }

            if (preset == "symbol")
            {
                cd.IEC61360Content.symbol = commit(cell);
            }

            if (preset == "dataType")
            {
                cd.IEC61360Content.dataType = commit(cell);
            }

            return(res);
        }
 public ExportTableAasEntitiesItem(
     int depth, AdminShell.Submodel sm = null, AdminShell.SubmodelElement sme = null,
     AdminShell.ConceptDescription cd  = null)
 {
     this.depth = depth;
     this.sm    = sm;
     this.sme   = sme;
     this.cd    = cd;
 }
            public SetOfIdentification(AasxDefinitionBase bs)
            {
                this.SM_Identification = bs.RetrieveReferable <AdminShell.Submodel>("SM_Identification");

                this.CD_ManufacturerName  = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_ManufacturerName");
                this.CD_GLNOfManufacturer = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_GLNOfManufacturer");
                this.CD_SupplierOfTheIdentifier = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_SupplierOfTheIdentifier");
                this.CD_MAN_PROD_NUM = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_MAN_PROD_NUM");
                this.CD_ManufacturerProductDesignation = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_ManufacturerProductDesignation");
                this.CD_ManufacturerProductDescription = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_ManufacturerProductDescription");
                this.CD_NameOfSupplier     = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_NameOfSupplier");
                this.CD_GLNOfSupplier      = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_GLNOfSupplier");
                this.CD_SupplierIdProvider = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_SupplierIdProvider");
                this.CD_SUP_PROD_NUM = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_SUP_PROD_NUM");
                this.CD_SupplierProductDesignation = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_SupplierProductDesignation");
                this.CD_SupplierProductDescription = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_SupplierProductDescription");
                this.CD_ManufacturerProductFamily = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_ManufacturerProductFamily");
                this.CD_ClassificationSystem = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_ClassificationSystem");
                this.CD_SecondaryKeyTyp      = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_SecondaryKeyTyp");
                this.CD_TypThumbnail         = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_TypThumbnail");
                this.CD_AssetId              = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_AssetId");
                this.CD_SerialNumber         = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_SerialNumber");
                this.CD_BatchNumber          = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_BatchNumber");
                this.CD_SecondaryKeyInstance = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_SecondaryKeyInstance");
                this.CD_DateOfManufacture = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_DateOfManufacture");
                this.CD_DeviceRevision          = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_DeviceRevision");
                this.CD_SoftwareRevision        = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_SoftwareRevision");
                this.CD_HardwareRevision        = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_HardwareRevision");
                this.CD_QrCode                  = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_QrCode");
                this.CD_OrganisationContactInfo = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_OrganisationContactInfo");
                this.CD_ContactInfo_Role = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_ContactInfo_Role");
                this.CD_PhysicalAddress  = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_PhysicalAddress");
                this.CD_CountryCode      = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_CountryCode");
                this.CD_Street           = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_Street");
                this.CD_Zip         = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_Zip");
                this.CD_CityTown    = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_CityTown");
                this.CD_StateCounty = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_StateCounty");
                this.CD_Email       = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_Email");
                this.CD_URL         = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_URL");
                this.CD_PhoneNumber = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_PhoneNumber");
                this.CD_Fax         = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_Fax");
                this.CD_CompanyLogo = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_CompanyLogo");
            }
            public SetOfDocumentation(AasxDefinitionBase bs)
            {
                this.SM_Document = bs.RetrieveReferable <AdminShell.Submodel>("SM_Document");

                this.CD_DocumentationItem = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_DocumentationItem");
                this.CD_DocumentType           = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_DocumentType");
                this.CD_VDI2770_DomainId       = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_VDI2770_DomainId");
                this.CD_VDI2770_IdType         = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_VDI2770_IdType");
                this.CD_DocumentId             = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_DocumentId");
                this.CD_DocumentDomainId       = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_DocumentDomainId");
                this.CD_VDI2770_Role           = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_VDI2770_Role");
                this.CD_VDI2770_OrganisationId = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_OrganisationId");
                this.CD_VDI2770_OrganisationName = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_OrganisationName");
                this.CD_VDI2770_OrganisationOfficialName = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_OrganisationOfficialName");
                this.CD_VDI2770_Description = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_Description");
                this.CD_DocumentPartId = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_DocumentPartId");
                this.CD_DocumentClassification_ClassId = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_DocumentClassification_ClassId");
                this.CD_VDI2770_ClassName = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_ClassName");
                this.CD_VDI2770_ClassificationSystem = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_ClassificationSystem");
                this.CD_DocumentVersionId = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_DocumentVersionId");
                this.CD_DocumentVersion_LanguageCode = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_DocumentVersion_LanguageCode");
                this.CD_VDI2770_Title       = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_VDI2770_Title");
                this.CD_VDI2770_Summary     = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_VDI2770_Summary");
                this.CD_VDI2770_Keywords    = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_VDI2770_Keywords");
                this.CD_VDI2770_StatusValue = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_StatusValue");
                this.CD_VDI2770_SetDate          = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_VDI2770_SetDate");
                this.CD_VDI2770_Purpose          = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_VDI2770_Purpose");
                this.CD_VDI2770_BasedOnProcedure = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_BasedOnProcedure");
                this.CD_VDI2770_Comments = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_VDI2770_Comments");
                this.CD_VDI2770_ReferencedObject_Type = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_ReferencedObject_Type");
                this.CD_VDI2770_ReferencedObject_RefType = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_ReferencedObject_RefType");
                this.CD_VDI2770_ReferencedObject_ObjectId = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_ReferencedObject_ObjectId");
                this.CD_VDI2770_FileId     = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_VDI2770_FileId");
                this.CD_VDI2770_FileName   = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_VDI2770_FileName");
                this.CD_VDI2770_FileFormat = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_FileFormat");
                this.CD_File = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_DigitalFile");
            }
        public void Index(AdminShell.ConceptDescription cd)
        {
            // access
            if (cd == null)
            {
                return;
            }

            // make curr ref and index
            var currRef = cd.GetReference();

            dict.Add(ComputeHashOnReference(currRef), cd);
        }
 public void Clear()
 {
     ParentElemName   = "";
     SmeElemName      = "";
     ParentParentName = "";
     SmeParentName    = "";
     ParentValue      = "";
     SmeValue         = "";
     Parent           = new AdminShell.SubmodelElement();
     Sme = new AdminShell.SubmodelElement();
     CD  = new AdminShell.ConceptDescription();
     CD.identification = null;
     CD.CreateDataSpecWithContentIec61360();
 }
예제 #11
0
        public AasEvents()
        {
            // info
            this.DomainInfo = "AAS Events";

            // definitons
            CD_UpdateValueOutwards = CreateSparseConceptDescription("en", "IRI",
                                                                    "UpdateValueOutwards",
                                                                    "https://admin-shell.io/tmp/AAS/Events/UpdateValueOutwards",
                                                                    @"TBD.");

            // reflect
            AddEntriesByReflection(this.GetType(), useAttributes: false, useFieldNames: true);
        }
예제 #12
0
        public static string EvalDisplayText(
            string minmalText, AdminShell.SubmodelElement sme,
            AdminShell.ConceptDescription cd = null,
            bool addMinimalTxt = false,
            string defaultLang = null,
            bool useIdShort    = true)
        {
            var res = "" + minmalText;

            if (sme != null)
            {
                // best option: description of the SME itself
                string better = sme.description?.GetDefaultStr(defaultLang);

                // if still none, simply use idShort
                // SME specific non-multi-lang found better than CD multi-lang?!
                if (!better.HasContent() && useIdShort)
                {
                    better = sme.idShort;
                }

                // no? then look for CD information
                if (cd != null)
                {
                    if (!better.HasContent())
                    {
                        better = cd.GetDefaultPreferredName(defaultLang);
                    }
                    if (!better.HasContent())
                    {
                        better = cd.idShort;
                    }
                    if (better.HasContent() && true == cd.IEC61360Content?.unit.HasContent())
                    {
                        better += $" [{cd.IEC61360Content?.unit}]";
                    }
                }

                if (better.HasContent())
                {
                    res = better;
                    if (addMinimalTxt)
                    {
                        res += $" ({minmalText})";
                    }
                }
            }
            return(res);
        }
예제 #13
0
 public VisualElementConceptDescription(VisualElementGeneric parent, TreeViewLineCache cache, AdminShell.AdministrationShellEnv env, AdminShell.ConceptDescription cd)
     : base()
 {
     this.Parent     = parent;
     this.Cache      = cache;
     this.theEnv     = env;
     this.theCD      = cd;
     this.Background = (SolidColorBrush)(new BrushConverter().ConvertFrom("#D0D0D0"));
     this.Border     = (SolidColorBrush)(new BrushConverter().ConvertFrom("#606060"));
     this.TagString  = "CD";
     this.TagBg      = (SolidColorBrush)(new BrushConverter().ConvertFrom("#707070"));;
     this.TagFg      = Brushes.White;
     RefreshFromMainData();
     RestoreFromCache();
 }
예제 #14
0
        public PackageExplorer()
        {
            // info
            this.DomainInfo = "AASX Package Explorer";

            // Referable
            CD_AasxLoadedNavigateTo = CreateSparseConceptDescription("en", "IRI",
                                                                     "AasxLoadedNavigateTo",
                                                                     "http://admin-shell.io/aasx-package-explorer/main/AasxLoadedNavigateTo/1/0",
                                                                     "Specifies a ReferenceElement, to which the Package Explorer will refer directly " +
                                                                     "after loading. Can be situated in any Submodel, but on first hierarchy level.");

            // reflect
            AddEntriesByReflection(this.GetType(), useAttributes: false, useFieldNames: true);
        }
        public ImageMap()
        {
            // info
            this.DomainInfo = "Plugin ImageMap";

            // Referable
            SEM_ImageMapSubmodel = new AdminShell.SemanticId(
                AdminShell.Key.CreateNew(
                    type: "Submodel",
                    local: false,
                    idType: "IRI",
                    value: "http://admin-shell.io/aasx-package-explorer/plugins/ImageMap/Submodel/1/0"));

            CD_ImageFile = CreateSparseConceptDescription("en", "IRI",
                                                          "ImageFile",
                                                          "http://admin-shell.io/aasx-package-explorer/plugins/ImageMap/ImageFile/1/0",
                                                          @"File element with the image to be displayed.");

            CD_EntityOfImageMap = CreateSparseConceptDescription("en", "IRI",
                                                                 "EntityOfImageMap",
                                                                 "http://admin-shell.io/aasx-package-explorer/plugins/ImageMap/EntityOfImageMap/1/0",
                                                                 @"States, that the Entity is part of an image map definition.");

            CD_RegionRect = CreateSparseConceptDescription("en", "IRI",
                                                           "RegionRect",
                                                           "http://admin-shell.io/aasx-package-explorer/plugins/ImageMap/RegionRect/1/0",
                                                           @"Definition of a rectangular region in JSON format [ x0, y0, x1, y1 ].");

            CD_RegionCircle = CreateSparseConceptDescription("en", "IRI",
                                                             "RegionCircle",
                                                             "http://admin-shell.io/aasx-package-explorer/plugins/ImageMap/RegionCircle/1/0",
                                                             @"Definition of a circular region in JSON format [ x0, y0, radius ].");

            CD_RegionPolygon = CreateSparseConceptDescription("en", "IRI",
                                                              "RegionPolygon",
                                                              "http://admin-shell.io/aasx-package-explorer/plugins/ImageMap/RegionPolygon/1/0",
                                                              @"Definition of a polygon region in JSON format [ x0, y0, x1, y1, .. ].");

            CD_NavigateTo = CreateSparseConceptDescription("en", "IRI",
                                                           "NavigateTo",
                                                           "http://admin-shell.io/aasx-package-explorer/plugins/ImageMap/NavigateTo/1/0",
                                                           @"If ReferenceElement subordinate to Entity, overrules Entity AssetId and navigates to value " +
                                                           "reference .");

            // reflect
            AddEntriesByReflection(this.GetType(), useAttributes: false, useFieldNames: true);
        }
예제 #16
0
            public SetOfDefsVDI2770(AasxDefinitionBase bs)
            {
                this.SM_VDI2770_Documentation = bs.RetrieveReferable <AdminShell.Submodel>("SM_VDI2770_Documentation");

                this.CD_VDI2770_Document        = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_VDI2770_Document");
                this.CD_VDI2770_DocumentIdValue = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_DocumentIdValue");
                this.CD_VDI2770_DocumentClassId = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_DocumentClassId");
                this.CD_VDI2770_DocumentClassName = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_DocumentClassName");
                this.CD_VDI2770_DocumentClassificationSystem = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_DocumentClassificationSystem");
                this.CD_VDI2770_OrganizationName = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_OrganizationName");
                this.CD_VDI2770_OrganizationOfficialName = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_OrganizationOfficialName");
                this.CD_VDI2770_DocumentVersion = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_DocumentVersion");
                this.CD_VDI2770_Language = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_VDI2770_Language");
                this.CD_VDI2770_Title    = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_VDI2770_Title");
                this.CD_VDI2770_Date     = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_VDI2770_Date");
                this.CD_VDI2770_DocumentVersionIdValue = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_DocumentVersionIdValue");
                this.CD_VDI2770_DigitalFile = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_DigitalFile");

                /* new, Birgit */
                this.CD_VDI2770_DocumentId = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_DocumentId");
                this.CD_VDI2770_IsPrimaryDocumentId = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_IsPrimaryDocumentId");
                this.CD_VDI2770_DocumentVersionId = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_DocumentVersionId");
                this.CD_VDI2770_Summary     = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_VDI2770_Summary");
                this.CD_VDI2770_Keywords    = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_VDI2770_Keywords");
                this.CD_VDI2770_StatusValue = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_StatusValue");
                this.CD_VDI2770_Role             = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_VDI2770_Role");
                this.CD_VDI2770_DomainId         = bs.RetrieveReferable <AdminShell.ConceptDescription>("CD_VDI2770_DomainId");
                this.CD_VDI2770_ReferencedObject = bs.RetrieveReferable <AdminShell.ConceptDescription>(
                    "CD_VDI2770_ReferencedObject");
            }
예제 #17
0
        public AasEvents()
        {
            // info
            this.DomainInfo = "AAS Events";

            // definitons
            CD_StructureChangeOutwards = CreateSparseConceptDescription("en", "IRI",
                                                                        "StructureChangeOutwards",
                                                                        "https://admin-shell.io/tmp/AAS/Events/StructureChangeOutwards",
                                                                        @"Events emitted by the AAS if AAS elements are created, modified or deleted.");

            CD_UpdateValueOutwards = CreateSparseConceptDescription("en", "IRI",
                                                                    "UpdateValueOutwards",
                                                                    "https://admin-shell.io/tmp/AAS/Events/UpdateValueOutwards",
                                                                    @"Events emitted by the AAS if the value of an AAS element is changed.");

            // reflect
            AddEntriesByReflection(this.GetType(), useAttributes: false, useFieldNames: true);
        }
예제 #18
0
            public ModuleTypePackage(AasxDefinitionBase bs)
            {
                SEM_MtpSubmodel = new AdminShell.SemanticId(
                    AdminShell.Key.CreateNew(
                        type: "Submodel",
                        local: false,
                        idType: "IRI",
                        value: "http://www.admin-shell.io/mtp/v1/submodel"));

                SEM_MtpInstanceSubmodel = new AdminShell.SemanticId(
                    AdminShell.Key.CreateNew(
                        type: "Submodel",
                        local: false,
                        idType: "IRI",
                        value: "http://www.admin-shell.io/mtp/v1/mtp-instance-submodel"));

                CD_MtpTypeSubmodel = CreateSparseConceptDescription("en", "IRI",
                                                                    "MtpTypeSubmodel",
                                                                    "http://www.admin-shell.io/mtp/v1/New/MtpTypeSubmodel",
                                                                    @"Direct Reference to MTP Type Submodel.");

                CD_SourceList = CreateSparseConceptDescription("en", "IRI",
                                                               "SourceList",
                                                               "http://www.admin-shell.io/mtp/v1/MTPSUCLib/CommunicationSet/SourceList",
                                                               @"Collects source of process data for MTP.");

                CD_SourceOpcUaServer = CreateSparseConceptDescription("en", "IRI",
                                                                      "SourceOpcUaServer",
                                                                      "http://www.admin-shell.io/mtp/v1/MTPCommunicationSUCLib/ServerAssembly/OPCUAServer",
                                                                      "Holds infomation on a single data source, which is an OPC UA server.");

                CD_Endpoint = CreateSparseConceptDescription("en", "IRI",
                                                             "Endpoint",
                                                             "http://www.admin-shell.io/mtp/v1/MTPCommunicationSUCLib/ServerAssembly/OPCUAServer/Endpoint",
                                                             "URL of OPC UA server for data source.");

                CD_MtpFile = CreateSparseConceptDescription("en", "IRI",
                                                            "MtpFile",
                                                            "http://www.admin-shell.io/mtp/v1/MTPSUCLib/ModuleTypePackage",
                                                            "Specifies a File, which contains MTP information in MTP/ AutmationML format." +
                                                            "File may be zipped.");
            }
예제 #19
0
        public SmdExporter()
        {
            // info
            this.DomainInfo = "Plugin SmdExporter";

            // Referable
            SEM_SmdExporterSubmodel = new AdminShell.SemanticId(
                AdminShell.Key.CreateNew(
                    type: "Submodel",
                    local: false,
                    idType: "IRI",
                    value: "http://admin-shell.io/aasx-package-explorer/plugins/SmdExporter/Submodel/1/0"));

            // dummy .. to be replaced later
            CD_Dummy = CreateSparseConceptDescription("en", "IRI",
                                                      "Dummy",
                                                      "http://admin-shell.io/aasx-package-explorer/plugins/SmdExporter/Dummy/1/0",
                                                      @"TBD.");

            // reflect
            AddEntriesByReflection(this.GetType(), useAttributes: false, useFieldNames: true);
        }
예제 #20
0
        private void ButtonTabPanels_Click(object sender, RoutedEventArgs e)
        {
            if (sender == ButtonCreateDoc)
            {
                // show the edit panel
                OuterTabControl.SelectedItem = TabPanelEdit;
                ButtonAddUpdateDoc.Content   = "Add";

                //// TODO (MIHO, 2020-09-29): if the V1.1 template works and is adopted, the old
                //// V1.0 shall be removed completely (over complicated) */
                //// make a template description for the content (remeber it)
                var desc = theOptions.FormVdi2770;
                if (desc == null)
                {
                    desc = DocumentShelfOptions.CreateVdi2770TemplateDesc(theOptions);
                }

                // latest version (from resources)
                if (this.CheckBoxLatestVersion.IsChecked == true)
                {
                    desc = DocumentShelfOptions.CreateVdi2770v11TemplateDesc();
                }

                this.currentFormDescription = desc;
                formInUpdateMode            = false;
                updateSourceElements        = null;

                // take over existing data
                this.currentFormInst = new FormInstanceSubmodelElementCollection(null, currentFormDescription);
                this.currentFormInst.PresetInstancesBasedOnSource(updateSourceElements);
                this.currentFormInst.outerEventStack = theEventStack;

                // bring it to the panel
                var elementsCntl = new FormListOfDifferentControl();
                elementsCntl.ShowHeader  = false;
                elementsCntl.DataContext = this.currentFormInst;
                ScrollViewerForm.Content = elementsCntl;
            }

            if (sender == ButtonAddUpdateDoc)
            {
                // add
                if (this.currentFormInst != null && this.currentFormDescription != null &&
                    thePackage != null &&
                    theOptions != null && theOptions.SemIdDocument != null &&
                    theSubmodel != null)
                {
                    // on this level of the hierarchy, shall a new SMEC be created or shall
                    // the existing source of elements be used?
                    AdminShell.SubmodelElementWrapperCollection currentElements = null;
                    if (formInUpdateMode && updateSourceElements != null)
                    {
                        currentElements = updateSourceElements;
                    }
                    else
                    {
                        currentElements = new AdminShell.SubmodelElementWrapperCollection();
                    }

                    // create a sequence of SMEs
                    try
                    {
                        this.currentFormInst.AddOrUpdateDifferentElementsToCollection(
                            currentElements, thePackage, addFilesToPackage: true);
                    }
                    catch (Exception ex)
                    {
                        Log.Error(ex, "when adding Document");
                    }

                    // the InstSubmodel, which started the process, should have a "fresh" SMEC available
                    // make it unique in the Documentens Submodel
                    var newSmc = this.currentFormInst?.sme as AdminShell.SubmodelElementCollection;

                    // if not update, put them into the Document's Submodel
                    if (!formInUpdateMode && currentElements != null && newSmc != null)
                    {
                        // make newSmc unique in the cotext of the Submodel
                        FormInstanceHelper.MakeIdShortUnique(theSubmodel.submodelElements, newSmc);

                        // add the elements
                        newSmc.value = currentElements;

                        // add the whole SMC
                        theSubmodel.Add(newSmc);
                    }

#if __may_be_not__
                    // save directly to ensure consistency
                    try
                    {
                        if (thePackage.Filename != null)
                        {
                            thePackage.SaveAs(thePackage.Filename);
                        }
                    }
                    catch (Exception ex)
                    {
                        if (theLogger != null)
                        {
                            theLogger.Log(
                                $"Saving package {thePackage.Filename} failed for adding Document " +
                                $"and gave: {ex.Message}");
                        }
                    }
#endif
                }
                else
                {
                    Log.Error("Preconditions for adding Document not met.");
                }

                // change back
                OuterTabControl.SelectedItem = TabPanelList;

                // re-display
                ParseSubmodelToListItems(
                    this.theSubmodel, this.theOptions, theViewModel.TheSelectedDocClass,
                    theViewModel.TheSelectedLanguage, theViewModel.TheSelectedListType);

                // re-display also in Explorer
                var evt = new AasxPluginResultEventRedrawAllElements();
                if (theEventStack != null)
                {
                    theEventStack.PushEvent(evt);
                }
            }

            if (sender == ButtonCancel)
            {
                OuterTabControl.SelectedItem = TabPanelList;
            }

            if (sender == ButtonFixCDs)
            {
                // check if CDs are present
                var theDefs = new AasxPredefinedConcepts.DefinitionsVDI2770.SetOfDefsVDI2770(
                    new AasxPredefinedConcepts.DefinitionsVDI2770());
                var theCds = theDefs.GetAllReferables().Where(
                    (rf) => { return(rf is AdminShell.ConceptDescription); }).ToList();

                // v11
                if (CheckBoxLatestVersion.IsChecked == true)
                {
                    theCds = AasxPredefinedConcepts.VDI2770v11.Static.GetAllReferables().Where(
                        (rf) => { return(rf is AdminShell.ConceptDescription); }).ToList();
                }

                if (theCds.Count < 1)
                {
                    Log.Error(
                        "Not able to find appropriate ConceptDescriptions in pre-definitions. " +
                        "Aborting.");
                    return;
                }

                // check for Environment
                var env = this.thePackage?.AasEnv;
                if (env == null)
                {
                    Log.Error(
                        "Not able to access AAS environment for set of Submodel's ConceptDescriptions. Aborting.");
                    return;
                }

                // be safe?
                if (MessageBoxResult.Yes != MessageBox.Show(
                        "Add missing ConceptDescriptions to the AAS?", "Question",
                        MessageBoxButton.YesNo, MessageBoxImage.Warning))
                {
                    return;
                }

                // ok, check
                int nr = 0;
                foreach (var x in theCds)
                {
                    var cd = x as AdminShell.ConceptDescription;
                    if (cd == null || cd.identification == null)
                    {
                        continue;
                    }
                    var cdFound = env.FindConceptDescription(cd.identification);
                    if (cdFound != null)
                    {
                        continue;
                    }
                    // ok, add
                    var newCd = new AdminShell.ConceptDescription(cd);
                    env.ConceptDescriptions.Add(newCd);
                    nr++;
                }

                // ok
                Log.Info("In total, {0} ConceptDescriptions were added to the AAS environment.", nr);
            }

            if (sender == ButtonCreateEntity)
            {
                // show the edit panel
                OuterTabControl.SelectedItem = TabPanelEntity;
            }

            if (sender == ButtonCancelEntity)
            {
                OuterTabControl.SelectedItem = TabPanelList;
            }

            if (sender == ButtonAddEntity &&
                this.theSubmodel != null &&
                TextBoxEntityIdShort.Text.Trim().HasContent())
            {
                // add entity
                this.theSubmodel.SmeForWrite.CreateSMEForCD <AdminShell.Entity>(
                    AasxPredefinedConcepts.VDI2770v11.Static.CD_DocumentedEntity,
                    idShort: "" + TextBoxEntityIdShort.Text.Trim(),
                    addSme: true);

                // switch back
                OuterTabControl.SelectedItem = TabPanelList;

                // re-display also in Explorer
                var evt = new AasxPluginResultEventRedrawAllElements();
                if (theEventStack != null)
                {
                    theEventStack.PushEvent(evt);
                }
            }
        }
예제 #21
0
파일: EclassUtils.cs 프로젝트: KOpenMOS/Mos
        public static AdminShell.ConceptDescription GenerateConceptDescription(
            List <EclassUtils.SearchItem> input, string targetIrdi)
        {
            // access
            if (input == null || input.Count < 1)
            {
                return(null);
            }

            // new cd
            var res = new AdminShell.ConceptDescription();

            // MIHO 2020-10-02: fix bug, create IEC61360 content
            var eds = AdminShell.EmbeddedDataSpecification.CreateIEC61360WithContent();

            res.IEC61360DataSpec = eds;
            var ds = eds.GetIEC61360();

            // over all, first is significant
            for (int i = 0; i < input.Count; i++)
            {
                // only accept property nodes, which are targetIrdi
                var si = input[i];
                if (si.Entity != "prop" || si.IRDI.ToLower().Trim() != targetIrdi.ToLower().Trim())
                {
                    continue;
                }
                var node = si.ContentNode;
                if (node == null)
                {
                    continue;
                }

                // first is significant
                if (i == 0)
                {
                    // identification
                    res.identification.idType = AdminShell.Identification.IRDI;
                    res.identification.id     = input[i].IRDI;

                    // isCase of
                    res.AddIsCaseOf(AdminShell.Reference.CreateIrdiReference(input[i].IRDI));

                    // administration
                    res.administration = new AdminShell.Administration();
                    var n1 = node.SelectSingleNode("revision");
                    if (n1 != null)
                    {
                        res.administration.revision = "" + n1.InnerText;
                    }

                    // short name -> TBD in future
                    FindChildLangStrings(node, "short_name", "label", "language_code", (ls) =>
                    {
                        ds.shortName = new AdminShellV20.LangStringSetIEC61360("EN?", ls.str);
                        res.idShort  = ls.str;
                    });

                    // guess data type
                    var nd = node.SelectSingleNode("domain");
                    if (nd != null)
                    {
                        var ndt = GetAttributeByName(nd, "xsi:type");
                        if (ndt != null)
                        {
                            // try find a match
                            foreach (var dtn in AdminShell.DataSpecificationIEC61360.DataTypeNames)
                            {
                                if (ndt.ToLower().Trim().Contains(dtn.ToLower().Trim()))
                                {
                                    ds.dataType = dtn;
                                }
                            }
                        }
                    }

                    // unit
                    var ndu = node.SelectSingleNode("domain/unit");
                    if (ndu != null)
                    {
                        var urefIrdi = GetAttributeByName(ndu, "unit_ref");
                        if (urefIrdi != null)
                        {
                            foreach (var xi in input)
                            {
                                if (xi.IRDI.ToLower().Trim() == urefIrdi.ToLower().Trim() && xi.ContentNode != null)
                                {
                                    foreach (var xiun in GetChildNodesByName(xi.ContentNode, "unitsml:UnitName"))
                                    {
                                        if (xiun != null)
                                        {
                                            ds.unitId = AdminShell.UnitId.CreateNew(
                                                "GlobalReference", false,
                                                AdminShell.Identification.IRDI, urefIrdi.Trim());
                                            ds.unit = xiun.InnerText.Trim();
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                // all have language texts
                FindChildLangStrings(node, "preferred_name", "label", "language_code", (ls) =>
                {
                    if (ds.preferredName == null)
                    {
                        ds.preferredName = new AdminShell.LangStringSetIEC61360();
                    }
                    ds.preferredName.Add(ls);
                });

                FindChildLangStrings(node, "definition", "text", "language_code", (ls) =>
                {
                    if (ds.definition == null)
                    {
                        ds.definition = new AdminShell.LangStringSetIEC61360();
                    }
                    ds.definition.Add(ls);
                });

                // <domain xsi:type="ontoml:REAL_MEASURE_TYPE_Type">
                //   <unit unit_ref="0173-1#05-AAA351#002"/>
                // </domain >
                // <unitsml:Unit dimensionURL="0173-1#Z2-AAA173#001" xml:id="id0173-1x05-AAA351x002">
                //   <unitsml:UnitName xml:lang="de-DE">Hz</unitsml:UnitName>
                //   <unitsml:UnitName xml:lang="en-US">Hz</unitsml:UnitName>
                //   <unitsml:UnitSymbol type="ASCII">Hz</unitsml:UnitSymbol>
                //   <unitsml:CodeListValue codeListName="IRDI" unitCodeValue="0173-1#05-AAA351#002" />
                // <unitsml:Quantity dimensionURL="0173-1#Z2-AAA173#001" xml:id="id0173-1xZ4-BAJ257x001">
                //   <unitsml:QuantityName xml:lang="de-DE">Frequenz</unitsml:QuantityName>
                //   <unitsml:QuantityName xml:lang="en-US">frequency</unitsml:QuantityName>
                //   <unitsml:QuantitySymbol type="IRDI">0173-1#Z4-BAJ257#001</unitsml:QuantitySymbol>
                //   <unitsml:UnitReference xml:lang="en-US" name="hertz" url="0173-1#05-AAA351#002" />
                //   <unitsml:UnitReference xml:lang="en-US" name="megahertz" url="0173-1#05-AAA581#002" />
                //   <unitsml:UnitReference xml:lang="en-US" name="terahertz" url="0173-1#05-AAA190#002" />
                //   <unitsml:UnitReference xml:lang="en-US" name="gigahertz" url="0173-1#05-AAA505#002" />
                //   <unitsml:UnitReference xml:lang="en-US" name="kilohertz" url="0173-1#05-AAA033#002" />
            }

            // Phase 2: fix some shortcomings
            //

            // ReSharper disable EmptyGeneralCatchClause
            try
            {
                if (ds.shortName == null || ds.shortName.Count < 1) // TBD: multi-language short name?!
                {
                    if (ds.preferredName != null && !ds.preferredName.IsEmpty)
                    {
                        var found = false;
                        foreach (var pn in ds.preferredName)
                        {
                            // let have "en" always have precedence!
                            if (found && !pn.lang.ToLower().Trim().Contains("en"))
                            {
                                continue;
                            }
                            // ok
                            found = true;
                            // Array of words
                            var words = pn.str.Split(
                                new[] { ' ', '\t', '-', '_' },
                                StringSplitOptions.RemoveEmptyEntries);
                            var sn = "";
                            foreach (var w in words)
                            {
                                var part = w.ToLower().Trim();
                                if (part.Length > 3)
                                {
                                    part = part.Substring(0, 3);
                                }
                                if (part.Length > 0)
                                {
                                    part = Char.ToUpperInvariant(part[0]) + part.Substring(1);
                                }
                                sn += part;
                            }
                            // set it
                            ds.shortName = new AdminShellV20.LangStringSetIEC61360("EN?", sn);
                        }
                    }
                }
            }
            catch { }
            // ReSharper enable EmptyGeneralCatchClause

            // ok
            return(res);
        }
예제 #22
0
        private void ButtonTabPanels_Click(object sender, RoutedEventArgs e)
        {
            if (sender == ButtonUpdate)
            {
                // add
                if (this.currentFormInst != null &&
                    thePackage != null &&
                    theOptions != null &&
                    theSubmodel != null)
                {
                    // on this level of the hierarchy, shall a new SMEC be created or shall
                    // the existing source of elements be used?
                    AdminShell.SubmodelElementWrapperCollection currentElements = null;
                    if (formInUpdateMode && updateSourceElements != null)
                    {
                        currentElements = updateSourceElements;
                    }
                    else
                    {
                    }

                    // create a sequence of SMEs
                    try
                    {
                        this.currentFormInst.AddOrUpdateDifferentElementsToCollection(
                            currentElements, thePackage, addFilesToPackage: true, editSource: true);
                    }
                    catch (Exception ex)
                    {
                        Log.Error(ex, "when adding Document");
                    }

#if __may_be_not__
                    // save directly to ensure consistency
                    try
                    {
                        if (thePackage.Filename != null)
                        {
                            thePackage.SaveAs(thePackage.Filename);
                        }
                    }
                    catch (Exception ex)
                    {
                        if (theLogger != null)
                        {
                            theLogger.Log(
                                $"Saving package {thePackage.Filename} failed for adding Document " +
                                $"and gave: {ex.Message}");
                        }
                    }
#endif
                }
                else
                {
                    Log.Error("Preconditions for adding entities from GenericForm not met.");
                }

                // re-display
                DisplaySubmodel();

                // re-display also in Explorer
                var evt = new AasxPluginResultEventRedrawAllElements();
                if (theEventStack != null)
                {
                    theEventStack.PushEvent(evt);
                }
            }

            if (sender == ButtonFixCDs)
            {
                // check if CDs are present
                if (currentFormRecord == null || currentFormRecord.ConceptDescriptions == null ||
                    currentFormRecord.ConceptDescriptions.Count < 1)
                {
                    Log.Error(
                        "Not able to find appropriate ConceptDescriptions in the GeneralForm option records. " +
                        "Aborting.");
                    return;
                }

                // check for Environment
                var env = this.thePackage?.AasEnv;
                if (env == null)
                {
                    Log.Error(
                        "Not able to access AAS environment for set of Submodel's ConceptDescriptions. Aborting.");
                    return;
                }

                // be safe?
                if (MessageBoxResult.Yes != MessageBox.Show(
                        "Add missing ConceptDescriptions to the AAS?", "Question",
                        MessageBoxButton.YesNo, MessageBoxImage.Warning))
                {
                    return;
                }

                // ok, check
                int nr = 0;
                foreach (var cd in currentFormRecord.ConceptDescriptions)
                {
                    if (cd == null || cd.identification == null)
                    {
                        continue;
                    }
                    var cdFound = env.FindConceptDescription(cd.identification);
                    if (cdFound != null)
                    {
                        continue;
                    }
                    // ok, add
                    var newCd = new AdminShell.ConceptDescription(cd);
                    env.ConceptDescriptions.Add(newCd);
                    nr++;
                }

                // ok
                Log.Info("In total, {0} ConceptDescriptions were added to the AAS environment.", nr);
            }
        }
예제 #23
0
        private void worker_RunWorkerCompleted(object sender,
                                               RunWorkerCompletedEventArgs e)
        {
            //update ui once worker complete his work
            SearchProgress.Value = 100;

            // access
            var a = (e.Result as BackgroundWorkerArgs);

            if (a == null)
            {
                return;
            }

            // search text!
            if (a.jobType == 1)
            {
                // may be inform upon too many elements
                if (a.jobData.tooMany)
                {
                    MessageBox.Show(
                        this,
                        "Too many search result. Search aborted!", "Search entities",
                        MessageBoxButton.OK, MessageBoxImage.Exclamation);
                }

                // sort
                a.jobData.items.Sort(delegate(EclassUtils.SearchItem si1, EclassUtils.SearchItem si2)
                {
                    if (si1.Entity != si2.Entity)
                    {
                        return(String.Compare(si1.Entity, si2.Entity, StringComparison.Ordinal));
                    }
                    else
                    {
                        return(String.Compare(si1.IRDI, si2.IRDI, StringComparison.Ordinal));
                    }
                });

                // re-fill into the UI list
                EntityList.Items.Clear();
                foreach (var it in a.jobData.items)
                {
                    EntityList.Items.Add(it);
                }
            }

            if (a.jobType == 2 && a.jobData != null && a.jobData.searchIRDIs.Count == 1)
            {
                // 1st pass already done, the jobData items already containing all required information to
                // generate a proper content description

                // own function
                var resIrdi = a.jobData.searchIRDIs[0].ToUpper();
                this.ResultCD   = EclassUtils.GenerateConceptDescription(a.jobData.items, resIrdi);
                this.ResultIRDI = resIrdi;

                // success -> auto close
                if (this.ResultCD != null)
                {
                    this.DialogResult = true;
                }
            }
        }
예제 #24
0
        private AdminShell.ConceptDescription GenerateConceptDescription(List <SelectItem> input)
        {
            // access
            if (input == null || input.Count < 1)
            {
                return(null);
            }

            // new cd
            var res = new AdminShell.ConceptDescription();

            var ds = new AdminShell.DataSpecificationIEC61360();

            res.embeddedDataSpecification.dataSpecificationContent.dataSpecificationIEC61360 = ds;

            // over all, first is significant
            for (int i = 0; i < input.Count; i++)
            {
                var node = input[i].ContentNode;
                if (node == null)
                {
                    continue;
                }

                XmlNode n1;

                // first is significant
                if (i == 0)
                {
                    res.identification.idType = "IRDI";
                    res.identification.id     = input[i].IRDI;

                    res.AddIsCaseOf(AdminShell.Reference.CreateIrdiReference(input[i].IRDI));

                    res.administration = new AdminShell.Administration();
                    n1 = node.SelectSingleNode("revision");
                    if (n1 != null)
                    {
                        res.administration.revision = "" + n1.InnerText;
                    }

                    FildChildLangStrings(node, "short_name", "label", "language_code", (ls) =>
                    {
                        ds.shortName = ls.str;
                        res.idShort  = ls.str;
                    });
                }

                // all have language texts
                FildChildLangStrings(node, "preferred_name", "label", "language_code", (ls) =>
                {
                    if (ds.preferredName == null)
                    {
                        ds.preferredName = new AdminShell.LangStringIEC61360();
                    }
                    ds.preferredName.langString.Add(ls);
                });

                FildChildLangStrings(node, "definition", "text", "language_code", (ls) =>
                {
                    if (ds.definition == null)
                    {
                        ds.definition = new AdminShell.LangStringIEC61360();
                    }
                    ds.definition.langString.Add(ls);
                });
            }

            // ok
            return(res);
        }
예제 #25
0
        public override void RefreshFromMainData()
        {
            if (theWrapper != null)
            {
                var sme = theWrapper.submodelElement;
                var ci  = sme.ToCaptionInfo();
                this.Caption = "" + ci.Item1;
                this.Info    = ci.Item2;

                if (sme is AdminShell.Property)
                {
                    var smep = sme as AdminShell.Property;
                    if (smep.value != null && smep.value != "")
                    {
                        this.Info += "= " + smep.value;
                    }
                    else if (smep.valueId != null && !smep.valueId.IsEmpty)
                    {
                        this.Info += "<= " + smep.valueId.ToString();
                    }

                    // cache ConceptDescription?
                    if (sme.semanticId != null && sme.semanticId.Keys != null)
                    {
                        if (this.cachedCD == null)
                        {
                            this.cachedCD = this.theEnv.FindConceptDescription(sme.semanticId.Keys);
                        }
                        if (this.cachedCD != null && this.cachedCD.embeddedDataSpecification != null &&
                            this.cachedCD.embeddedDataSpecification.dataSpecificationContent != null &&
                            this.cachedCD.embeddedDataSpecification.dataSpecificationContent.dataSpecificationIEC61360 != null)
                        {
                            var iecprop = this.cachedCD.embeddedDataSpecification.dataSpecificationContent.dataSpecificationIEC61360;
                            if (iecprop.unit != null && iecprop.unit != "")
                            {
                                this.Info += " [" + iecprop.unit + "]";
                            }
                        }
                    }
                }

                if (sme is AdminShell.File)
                {
                    var smef = sme as AdminShell.File;
                    if (smef.value != null && smef.value != "")
                    {
                        this.Info += "-> " + smef.value;
                    }
                }

                if (sme is AdminShell.ReferenceElement)
                {
                    var smere = sme as AdminShell.ReferenceElement;
                    if (smere.value != null && !smere.value.IsEmpty)
                    {
                        this.Info += "~> " + smere.value.ToString();
                    }
                }

                if (sme is AdminShell.SubmodelElementCollection)
                {
                    var smesec = sme as AdminShell.SubmodelElementCollection;
                    if (smesec.value != null)
                    {
                        this.Info += "(" + smesec.value.Count + " elements)";
                    }
                }
            }
        }
        public override void RefreshFromMainData()
        {
            if (theWrapper != null)
            {
                var sme = theWrapper.submodelElement;
                var ci  = sme.ToCaptionInfo();
                this.Caption = ((sme.kind != null && sme.kind.IsTemplate) ? "<T> " : "") + ci.Item1;
                this.Info    = ci.Item2;

                var showCDinfo = false;

                switch (sme)
                {
                case AdminShell.Property smep:
                    if (smep.value != null && smep.value != "")
                    {
                        this.Info += "= " + smep.value;
                    }
                    else if (smep.valueId != null && !smep.valueId.IsEmpty)
                    {
                        this.Info += "<= " + smep.valueId.ToString();
                    }
                    showCDinfo = true;
                    break;

                case AdminShell.Range rng:
                    var txtMin = rng.min == null ? "{}" : rng.min.ToString();
                    var txtMax = rng.max == null ? "{}" : rng.max.ToString();
                    this.Info += $"= {txtMin} .. {txtMax}";
                    showCDinfo = true;
                    break;

                case AdminShell.MultiLanguageProperty mlp:
                    if (mlp.value != null)
                    {
                        this.Info += "-> " + mlp.value.GetDefaultStr();
                    }
                    break;

                case AdminShell.File smef:
                    if (smef.value != null && smef.value != "")
                    {
                        this.Info += "-> " + smef.value;
                    }
                    break;

                case AdminShell.ReferenceElement smere:
                    if (smere.value != null && !smere.value.IsEmpty)
                    {
                        this.Info += "~> " + smere.value.ToString();
                    }
                    break;

                case AdminShell.SubmodelElementCollection smc:
                    if (smc.value != null)
                    {
                        this.Info += "(" + smc.value.Count + " elements)";
                    }
                    break;
                }

                // Show CD / unikts ..
                if (showCDinfo)
                {
                    // cache ConceptDescription?
                    if (sme.semanticId != null && sme.semanticId.Keys != null)
                    {
                        if (this.cachedCD == null)
                        {
                            this.cachedCD = this.theEnv.FindConceptDescription(sme.semanticId.Keys);
                        }
                        var iecprop = this.cachedCD?.GetIEC61360();
                        if (iecprop != null)
                        {
                            if (iecprop.unit != null && iecprop.unit != "")
                            {
                                this.Info += " [" + iecprop.unit + "]";
                            }
                        }
                    }
                }

                // Qualifiers?
                if (sme.qualifiers != null && sme.qualifiers.Count > 0)
                {
                    foreach (var q in sme.qualifiers)
                    {
                        var qt = q.type ?? "";
                        if (qt == "" && q.semanticId != null)
                        {
                            qt = "semId";
                        }
                        var qv = q.value ?? "";
                        if (qv == "" && q.valueId != null)
                        {
                            qv = "valueId";
                        }
                        if (qv != "")
                        {
                            qv = "=" + qv;
                        }
                        this.Info += " @{" + qt + qv + "}";
                    }
                }
            }
        }
예제 #27
0
        private bool FinalizeSelection(EclassUtils.SearchItem si, bool twoPass)
        {
            // access
            if (si == null)
            {
                return(false);
            }

            // simply put the IRDI
            this.ResultIRDI = si.IRDI;

            // special case: unit .. try correct from unit id to unitCodeValue for IRDI
            if (si.Entity == "unit")
            {
                var x = EclassUtils.GetIrdiForUnitSearchItem(si);
                if (x != null)
                {
                    this.ResultIRDI = x;
                }
            }

            // one or two passes?
            if (!twoPass)
            {
                // special case: property selected
                if (si.Entity == "prop" && selectMode != SelectMode.IRDI)
                {
                    var input = new List <EclassUtils.SearchItem>();
                    input.Add(si);
                    foreach (EclassUtils.SearchItem di in EntityList.Items)
                    {
                        if (di != null && di.Entity == si.Entity && di.IRDI == si.IRDI && si != di)
                        {
                            input.Add(di);
                        }
                    }

                    // own function
                    this.ResultCD = EclassUtils.GenerateConceptDescription(input, si.IRDI);
                }
            }
            else
            {
                if (si.Entity == "prop" && si.ContentNode != null)
                {
                    var irdi = EclassUtils.GetAttributeByName(si.ContentNode, "id");
                    if (irdi != null)
                    {
                        if (!worker.IsBusy && eclassFullPath != null)
                        {
                            SearchProgress.Value = 0;
                            EntityList.Items.Clear();
                            EntityContent.Text = "";

                            var args = new BackgroundWorkerArgs();
                            args.jobData = InitJobData();
                            args.jobData.searchIRDIs.Add(irdi.Trim().ToLower());
                            args.jobType = 2;

                            // start second pass!
                            worker.RunWorkerAsync(args);
                            return(false);
                        }
                    }
                }
            }

            // generally ok
            return(true);
        }
예제 #28
0
        public override void RefreshFromMainData()
        {
            if (theWrapper != null)
            {
                var sme = theWrapper.submodelElement;
                var ci  = sme.ToCaptionInfo();
                this.Caption = ((sme.kind != null && sme.kind.IsTemplate) ? "<T> " : "") + ci.Item1;
                this.Info    = ci.Item2;

                if (sme is AdminShell.Property)
                {
                    var smep = sme as AdminShell.Property;
                    if (smep.value != null && smep.value != "")
                    {
                        this.Info += "= " + smep.value;
                    }
                    else if (smep.valueId != null && !smep.valueId.IsEmpty)
                    {
                        this.Info += "<= " + smep.valueId.ToString();
                    }

                    // cache ConceptDescription?
                    if (sme.semanticId != null && sme.semanticId.Keys != null)
                    {
                        if (this.cachedCD == null)
                        {
                            this.cachedCD = this.theEnv.FindConceptDescription(sme.semanticId.Keys);
                        }
                        var iecprop = this.cachedCD?.GetIEC61360();
                        if (iecprop != null)
                        {
                            if (iecprop.unit != null && iecprop.unit != "")
                            {
                                this.Info += " [" + iecprop.unit + "]";
                            }
                        }
                    }
                }

                if (sme is AdminShell.MultiLanguageProperty)
                {
                    var mlp = sme as AdminShell.MultiLanguageProperty;
                    if (mlp.value != null)
                    {
                        this.Info += "-> " + mlp.value.GetDefaultStr();
                    }
                }

                if (sme is AdminShell.File)
                {
                    var smef = sme as AdminShell.File;
                    if (smef.value != null && smef.value != "")
                    {
                        this.Info += "-> " + smef.value;
                    }
                }

                if (sme is AdminShell.ReferenceElement)
                {
                    var smere = sme as AdminShell.ReferenceElement;
                    if (smere.value != null && !smere.value.IsEmpty)
                    {
                        this.Info += "~> " + smere.value.ToString();
                    }
                }

                if (sme is AdminShell.SubmodelElementCollection)
                {
                    var smesec = sme as AdminShell.SubmodelElementCollection;
                    if (smesec.value != null)
                    {
                        this.Info += "(" + smesec.value.Count + " elements)";
                    }
                }

                // Qualifiers?
                if (sme.qualifiers != null && sme.qualifiers.Count > 0)
                {
                    foreach (var q in sme.qualifiers)
                    {
                        var qt = q.type ?? "";
                        if (qt == "" && q.semanticId != null)
                        {
                            qt = "semId";
                        }
                        var qv = q.value ?? "";
                        if (qv == "" && q.valueId != null)
                        {
                            qv = "valueId";
                        }
                        if (qv != "")
                        {
                            qv = "=" + qv;
                        }
                        this.Info += " @{" + qt + qv + "}";
                    }
                }
            }
        }
예제 #29
0
            public InteropRelations()
            {
                // info
                this.DomainInfo = "Interoperable Relations (experimental)";

                // Referable
                CD_FileToNavigateElement = CreateSparseConceptDescription("en", "IRI",
                                                                          "FileToNavigateElement",
                                                                          "http://admin-shell.io/sandbox/CompositeComponent/General/FileToNavigateElement/1/0",
                                                                          @"Links fragments of a File to an arbitrary element in an AAS. A environment for maintaining 
                    AAS information shall be commanded to navigate to this element.");

                CD_FileToEntity = CreateSparseConceptDescription("en", "IRI",
                                                                 "FileToEntity",
                                                                 "http://admin-shell.io/sandbox/CompositeComponent/General/FileToEntity/1/0",
                                                                 "Links fragments of a File to an Entity element in the AAS.");

                CD_IsPartOfForBOM = CreateSparseConceptDescription("en", "IRI",
                                                                   "IsPartOfForBOM",
                                                                   "http://admin-shell.io/sandbox/CompositeComponent/General/IsPartOfForBOM/1/0",
                                                                   "States a general is-part-of-relationship, which is not further constrained, but used for " +
                                                                   "organizing the BOM in multiple manageable parts.");

                CD_EntityOfElectricalEngineering = CreateSparseConceptDescription("en", "IRI",
                                                                                  "EntityOfElectricalEngineering",
                                                                                  "http://admin-shell.io/sandbox/CompositeComponent/Electrical/EntityOfElectricalEngineering/1/0",
                                                                                  @"States, that the Entity is part of the model for Electrical engineering.
                    Note: Any Entity with a certain meaning to the Electrical engineering might be 
                    declared as EntityOfElectricalEngineering.");

                CD_ElectricSinglePoleConnection = CreateSparseConceptDescription("en", "IRI",
                                                                                 "SinglePoleConnection",
                                                                                 "http://admin-shell.io/sandbox/CompositeComponent/Electrical/SinglePoleConnection/1/0",
                                                                                 "States, that there is a single pole connection between two Electrical Entities. Without loss " +
                                                                                 "of generality, the connection points first/ second will share the same electrical properties.");

                CD_EntityOfFluidicEngineering = CreateSparseConceptDescription("en", "IRI",
                                                                               "EntityOfFluidicEngineering",
                                                                               "http://admin-shell.io/sandbox/CompositeComponent/Fluidic/EntityOfFluidicEngineering/1/0",
                                                                               "States, that the Entity is part of the model for Fluidic engineering");

                CD_ConnectorTubePipe = CreateSparseConceptDescription("en", "IRI",
                                                                      "ConnectorTubePipe",
                                                                      "http://admin-shell.io/sandbox/CompositeComponent/Fluidic/ConnectorTubePipe/1/0",
                                                                      "Establishes a Property, which represents an connector (port, position for fitting) as a " +
                                                                      "specific feature of an EntityOfFluidicEngineering.");

                CD_TubePipeConnection = CreateSparseConceptDescription("en", "IRI",
                                                                       "TubePipeConnection",
                                                                       "http://admin-shell.io/sandbox/CompositeComponent/Fluidic/TubePipeConnection/1/0",
                                                                       "States, that there is a fludic connection between two Electrical Entities. Without loss " +
                                                                       "of generality, the connection points first/ second will share the same material flow.");

                CD_TubePipeConnectionPneumatic = CreateSparseConceptDescription("en", "IRI",
                                                                                "TubePipeConnectionPneumatic",
                                                                                "http://admin-shell.io/sandbox/CompositeComponent/Fluidic/TubePipeConnectionPneumatic/1/0",
                                                                                "States, that there is a pneumatic connection between two Electrical Entities.",
                                                                                isCaseOf: CD_TubePipeConnection.GetReference());

                CD_TubePipeConnectionHydraulic = CreateSparseConceptDescription("en", "IRI",
                                                                                "TubePipeConnectionHydraulic",
                                                                                "http://admin-shell.io/sandbox/CompositeComponent/Fluidic/TubePipeConnectionHydraulic/1/0",
                                                                                "States, that there is a hydraulic connection between two Electrical Entities.",
                                                                                isCaseOf: CD_TubePipeConnection.GetReference());

                // reflect
                AddEntriesByReflection(this.GetType(), useAttributes: false, useFieldNames: true);
            }
예제 #30
0
 private void ButtonClose_Click(object sender, RoutedEventArgs e)
 {
     this.ResultIRDI = null;
     this.ResultCD   = null;
     ControlClosed?.Invoke();
 }