Plex 2E

Expand all | Collapse all

How do I get the keys for an owned by from the ModelAPI? I've spent a lot of time trying to figure this out and I'm at a complete loss.

  • 1.  How do I get the keys for an owned by from the ModelAPI? I've spent a lot of time trying to figure this out and I'm at a complete loss.

    Posted 11-17-2016 09:03 PM

    How do I get the keys for an owned by from the Model API?

     

    I have the Owned By triple and can't seem to figure out how to get the list of the primary keys (aka primary key fields (columns).

     

    I'm really anxious about this.

     

    Please someone help.

     

    Respectfully,

     

    Darryll



  • 2.  Re: How do I get the keys for an owned by from the ModelAPI? I've spent a lot of time trying to figure this out and I'm at a complete loss.

    Posted 11-18-2016 03:55 AM

    This is not easy!

     

    Depending on the use case. If you want a solution to work in all cases like replacement triples, continuation triples, shared triples etc etc then I have used model api to create a view on the entity you are interested in which contains keys only! Then delete the view! This was the simplest method See StellaTools List Objects - Stella Tools (CA Plex Developer Tools) 

     

    But if you have very simple use cases as an entity with known by and owned by you can use TriplesBySource see  TriplesForObject - Stella Tools (CA Plex Developer Tools)  which will give you the know by and the owned by enitty which you then use TriplesBySource to interogate the owner entity and get the known by triples....BUT this recursive method really becomes a pain for only the simplest use cases.

     

    WHY do you need this info as I would not discount creating a compiled solution using meta! See AutoTestBox - Stella Tools (CA Plex Developer Tools)  where obviously I needed to be sure I had the right keys and fields for interfaces.



  • 3.  Re: How do I get the keys for an owned by from the ModelAPI? I've spent a lot of time trying to figure this out and I'm at a complete loss.

    Posted 11-18-2016 09:42 AM

    I need to be able to do this in my own .NET code. 

     

    It's a long story and probably not worth the background.

     

     

    So have the Owned By and Known By objects for the 'starting' object. 

     

    I now get an enumeration by source using the Owned by. What verb ID am I interested in? Owned by? 

    At what point do I stop recursion and actually have fields (along with column number within the key (precedence?) and direction? Do I recurse to the top of the Owned by tree and then use the known by of the each successive level down the tree back to the original source object?

     

    I appreciate any help, code snippets, p-code, etc.

     

    Thank you!



  • 4.  Re: How do I get the keys for an owned by from the ModelAPI? I've spent a lot of time trying to figure this out and I'm at a complete loss.

    Posted 11-18-2016 01:52 PM

    download stellatools and have a look how i did what you are doing! Im sorry i dont have the patience or the time to write it all down.

     

    The back ground is important as maybe you should parse source instead of what you are doing...... 



  • 5.  Re: How do I get the keys for an owned by from the ModelAPI? I've spent a lot of time trying to figure this out and I'm at a complete loss.

    Posted 11-18-2016 04:40 PM

    What exactly am I looking for in the download?

     

    I see no source code and I'm not sure what exacttly you're telling me to have a look at.

     

    Thank you.



  • 6.  Re: How do I get the keys for an owned by from the ModelAPI? I've spent a lot of time trying to figure this out and I'm at a complete loss.

    Posted 11-19-2016 03:27 AM

    Darryll, sorry I assumed you were a Plex developer? Are you a .net developer then trying to use plex api to interrogate the ca plex local  model?



  • 7.  Re: How do I get the keys for an owned by from the ModelAPI? I've spent a lot of time trying to figure this out and I'm at a complete loss.

    Posted 11-19-2016 11:15 AM

    I am a SQL Server Data Architect. So yes, .NET with C# along with lots of others, but I am not a Plex dev.

     

    Thanks George!



  • 8.  Re: How do I get the keys for an owned by from the ModelAPI? I've spent a lot of time trying to figure this out and I'm at a complete loss.

    Posted 11-19-2016 03:25 PM

    ahhhh let me guess your site used plex for the db2 and you want to migrate the database to a sql server database but you want constraints?



  • 9.  Re: How do I get the keys for an owned by from the ModelAPI? I've spent a lot of time trying to figure this out and I'm at a complete loss.

    Posted 11-19-2016 03:44 PM

    My client is using Plex (v 6.1) with DDS.

     

    I am helping them create an Operational Data Store in SQL Server. We're using IIDR CDC to replicate from DB2 for i to SQL Server 2016. When a table is added to the ODS, I want to automatically create the FKs (defined by Owned By and Refers to) and matching IXs in SQL Server.

     

    I have figured out how to add the PKs by using DB2 system catalog metadata to find the matching real attributes view for any physical table being replicated and I create the PK from the real attribute view's corresponding unique key.

     

    But since DDS was used, there are no declared FKs in the DB2 system catalog, so I need to harvest the info from the Plex Model via the API.

     

    I've figured out how to get the refers to entities and find the corresponding foreign key view to get the foreign key fields no problem (I think).

     

    Owned by is a special type of foreign key situation.

     

    There are other things I want to harvest from Plex that I will store in a relational DB table for use in processes on the ODS.

     

    I cannot build to DDL (it's not an option for many reasons), nor can I export the Model to XML (it's not an option for many reasons).

     

    So now you have a little background.

     

    The question remains, can you help me? I've got the recursion working and I'm able to get all known by fields and can traverse the non-inherited owned by entities. I'm not quite sure what to do when I come to an owned by that has no known by fields like where inheritence is involved.



  • 10.  Re: How do I get the keys for an owned by from the ModelAPI? I've spent a lot of time trying to figure this out and I'm at a complete loss.

    Posted 11-19-2016 04:00 PM

    pretty good guess then!

    why cant you get a plex developer to generate and build the tables to sql server database with constraints on!

    i did this in 20 minutes for a developer the other day as he was more comfortable in sql server then db2.

    secondly the reason i created listObject using model api was that a customer was doimg exact
    y what you are doing as so he parsed the xml output to create his sql server schema.



  • 11.  Re: How do I get the keys for an owned by from the ModelAPI? I've spent a lot of time trying to figure this out and I'm at a complete loss.

    Posted 11-19-2016 04:11 PM

    But since DDS was used, there are no declared FKs in the DB2 system catalog,

     

     

    Is not strictly true, it is just the plex developers have not added constraints to the dds using the Add Physical File Constraint (ADDPFCST) command.



  • 12.  Re: How do I get the keys for an owned by from the ModelAPI? I've spent a lot of time trying to figure this out and I'm at a complete loss.

    Posted 11-19-2016 04:49 PM

    These are not options for reasons I cannot share.

     

    I appreciate your suggestions, but they're just not viable at this time.

     

    XML export is not an option.

    Adding physical file constraints to the DDS implementation is not an option.

    Building and generating a SQL Server schema using Plex is not an option.

     

    I really have to solve this from the ModelAPI perspective.



  • 13.  Re: How do I get the keys for an owned by from the ModelAPI? I've spent a lot of time trying to figure this out and I'm at a complete loss.

    Posted 11-19-2016 04:59 PM

    i dont get the secrecy as to use model api you have to have the plex ide and local model on your pc by definition! so you are a bright guy...generate it yourself to sql server....this is a walk in the park compared to the model api stuff which only a handful of plex developers have ever tried.



  • 14.  Re: How do I get the keys for an owned by from the ModelAPI? I've spent a lot of time trying to figure this out and I'm at a complete loss.

    Posted 11-19-2016 04:53 PM

    CA_Plex_SupportForModernizingIBM_DB2_for_i.pdf   should help your plex developers investigate ddl for db2 and lots more datacentric soultions which will make you as a sql server guy happier

     

    secondly get a plex developer to download my model api stuff and he can help you as it is all there but you have only just touched the surface depending on how the plex developers have modelled the database and the use of the more exotic ca plex data modeling triples

     

    you will need the plex developers after all they are the custodians of the data and they will changes the db2 files from time to time.

     

    but the quickest win for you is get a plex developer to gen the database for sql server with constaints on...simple and the power of plex.



  • 15.  Re: How do I get the keys for an owned by from the ModelAPI? I've spent a lot of time trying to figure this out and I'm at a complete loss.

    Posted 11-19-2016 05:12 PM

    Thank you for your interest in helping, but I am not at liberty to discuss my client or their environment and reasons why what you suggest is not an option in my environment.

     

    I am a quite capable developer and have already made very significant progress with the API.

     

    The fact it is very poorly documented and lacking in examples and the fact the help file does a very poor job of explaining the Plex model and the object hierarchies is likely why very few have made any effort to use it.

     

    And with respect to the modernization effort, again, for reasons I cannot share, a migration, even incrementally, from ,DS to DDS is not an option for the foreseeable future.

     

    So, can you help with the API or not?

     

    If you can't, can you refer someone who can?

     

    I am also going to resort to a DLL Spy tool to help figure out what's going on in the Plex GUI from the perspective of it's use of the Model API.



  • 16.  Re: How do I get the keys for an owned by from the ModelAPI? I've spent a lot of time trying to figure this out and I'm at a complete loss.

    Posted 11-20-2016 03:54 AM

    read this Lee Dare - Software Development Principles, Plex/2e and everything else in between.: Beginners Guide to the CA Plex Mode… and his follow his follow blogs on model api

     

    PlexAPILib30.IPlexAPI4.EnumSafearrayObjectAttributes https://support.ca.com/irj/portal/anonymous/kbproblem?productcd=CPLEX&problemnbr=1919  

     

    PlexAPILib20.IPlexAPI.EnumTriplesBySource  it shows the INHERITED triples! (solves your issue "I come to an owned by that has no known by fields like where inheritence is involved)

     

    I will say again the best bullet proof method to get the keys for entities that caters for ALL the data modelling triples available to plex developers is to create a view using model api on the fly! Then delete it after you have used it to determine exactly what the keys are to the entity...this way you dont have to understand and cater for sharing triples, continuation triples, seeks triples, replace triples, qualify triples, and on and on which you have no hope in coding for and why I also gave up!

     

    BUT again I say you have the Plex IDE and local model, you must have this inorder to use model api. Why cant I walk you through generating the database for SQL Server with constraints on, been done in 15 minutes and NO BUGS which is what you need for replicating a database...