Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add generated convenience method for directly referenced and connected things #142

Closed
3 tasks done
cozminvelciu opened this issue Oct 22, 2020 · 3 comments · Fixed by #143
Closed
3 tasks done

Add generated convenience method for directly referenced and connected things #142

cozminvelciu opened this issue Oct 22, 2020 · 3 comments · Fixed by #143
Assignees
Milestone

Comments

@cozminvelciu
Copy link
Contributor

cozminvelciu commented Oct 22, 2020

Prerequisites

  • I have written a descriptive issue title
  • I have verified that I am running the latest version of the CDP4-SDK
  • I have searched open and closed issues to ensure it has not already been reported

Description

Currently in the SDK it is possible to obtain containment information for a Thing via:

  • directly contained things through the this.ContainerLists property
  • containment tree through the QueryContainedThingsDeep() method

However, it is not possible to obtain objects referenced (but not contained) by a Thing. Additional helper properties/methods similar to the ones for containment are needed, possibly something like this:

  • directly referenced things through a new property: this.ReferenceLists
  • all referenced things from the containment tree through a new method: QueryReferencedThingsDeep()
    • this method would iterate through the QueryContainedThingsDeep() objects and create a list of all objects in the this.ReferenceLists

It is also needed to add a method that iterates both contained and referenced things, to have a complete tree of objects that are connected to a given thing, possibly named QueryConnectedThingsDeep().

As a summary (proposal only, names subject to change):

  • QueryContainedThingsDeep(): navigate recursively through this.ContainerLists and create a list of [these] contained objects
  • QueryReferencedThingsDeep(): navigate recursively through this.ContainerLists and create a list of referenced objects
  • QueryConnectedThingsDeep(): navigate recursively though this.ContainerLists joined with this.ReferenceLists, and create a list of these objects (both referenced and contained)

As a few examples of referenced things:

  • DomainOfExpertise: references Category
  • DomainOfExpertise: references Domain
  • ActualFiniteStateList: references ExcludeOption, Owner, PossibleFiniteStateList
@cozminvelciu
Copy link
Contributor Author

@alexatrhea or @lxatrhea: because I do not have access to the code generation code (and even though I am more than familiar with the codegen on OCDT, it would probably take a while to familiarise with the codegen here), I think one of you guys needs to take this one up.

The reason this is needed is that, in the Syncer tool, when "moving" certain objects from one model to another, you have to bring along all the connected things as well, and this includes references to objects that are not directly contained.

@cozminvelciu cozminvelciu added this to the sprint 19 milestone Oct 22, 2020
@samatstariongroup
Copy link
Member

Is the expected return type of QueryContainedThingsDeep(), QueryReferencedThingsDeep() and QueryConnectedThingsDeep() an IEnumerable<Thing>

@cozminvelciu
Copy link
Contributor Author

Is the expected return type of QueryContainedThingsDeep(), QueryReferencedThingsDeep() and QueryConnectedThingsDeep() an IEnumerable<Thing>

Yes, I would expect the new methods and properties to have the same return type as the already existing ones, so IEnumerable<Thing> for methods and IEnumerable<IEnumerable> for the properties.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
3 participants