Bulk Model Changes
search cancel

Bulk Model Changes

book

Article ID: 379269

calendar_today

Updated On:

Products

CA Plex

Issue/Introduction

Is it possible to execute a massive/bulk 'Implement No triple' addition to a model based on a list of multiple (i.e. 3000) implementation names?

Environment

CA Plex 7.x

Resolution

There is no mechanism from the CA Plex UI to achieve the requirement.

You can use the Plex API to update the model object(s) using the implementation name.

Here is an approach using a C# sample to massively update the function objects using implementation name via creating an external application using Plex API.

---------------------------------------

            int ObjId = 0, noObjId = 0;
            int isTrp = 0, newTrpl = 0, verbid = 0, verbidx = 0;
            int FNCTriples = 0, NoOfTriples = 0, MyTriple = 0, TRPSrcId = 0; 
            string ObjName = " ";

            _Plex = new PlexAPILib.PlexAPI();
            _Plex4 = (IPlexAPI4)_Plex;

            string flContents = File.ReadAllText(@"C:\MyWorkSpace\ImplNames.txt"); // List of implementation names seperated by COMMA.
            string[] implNameList = flContents.Split(','); // Tokenize the Implementation names.
            foreach (string implName in implNameList) // Iterate over each implementation name, get associated function object and then update 'Function -- Implement Sys -- No'.
            {
                _Plex.FindObj(implName, 12, ref ObjId); // Find Object using Implementation name, type name object - 12.
                if (ObjId != 0)
                {
                    _Plex.EnumTriplesByTarget(ObjId, 0, ref FNCTriples);
                    // Count the items in enumerator
                    _Plex.GetCountOfItemsInEnumerator(FNCTriples, ref NoOfTriples);
                    if (NoOfTriples != 0)
                    {
                        _Plex.GetNextTriple(FNCTriples, ref MyTriple);

                        // Get Triple Source
                        _Plex.GetTripleSource(MyTriple, ref TRPSrcId, ref isTrp);

                        // Get the function name 
                        _Plex.GetObjFullName(TRPSrcId, ref ObjName);
                        int srcObj = 0;
                        _Plex.FindObj(ObjName, 7, ref srcObj); //Function Type.

                        // Find 'No' object to be added as the target object for 'ImplSys - No' triple.
                        _Plex.FindObj("No", 22, ref noObjId); // Sytem Object type, 22.

                        _Plex.FindVerbByName("FncImplementSys", 3, ref verbid, ref verbidx); // Find Verb Name. 3 - SimpleName.

                        if (noObjId != 0 && srcObj != 0)
                            try
                            {
                                _Plex.AddTriple(srcObj, verbid, noObjId, ref newTrpl); // Add 'Function -- Implement Sys -- No' triple.
                            }
                            catch(Exception)
                            {
                                MessageBox.Show("Unable to add the triple for the function (implName) - " + ObjName + "( " +implName+ " )");
                            }
                    }                   
                }
                else
                {
                    MessageBox.Show("Unable to find the function with implementation name - " + implName);
                }
            }

---------------------------------------