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

[Experimental] Related instance API allow traversal of instance in forward/backward/both directions #609

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

khanaffan
Copy link
Contributor

@khanaffan khanaffan commented Feb 8, 2024

[Experimental] & [Wip]

The API allows the generically traverse of a graph of instances using relationships

The API introduces a virtual class that takes an instance key and direction and will return a table of related instances along with relationship ID and direction.

rel1.related_instances(<instanceid>, <eclassid>, 'forward' | 'backward' | 'both')

Related instances use internally cached ECSQL statements to give you related instances and can be slow at first when these statements get prepared. The performance also varies depending on the number of relationships for a given instance key.

It can be used in conjunction with other classes in ECSQL as follows.

 SELECT
    Bis.Element.ECInstanceId, 
    g.* 
 FROM
     Bis.Element e, 
     rel1.related_instances(Bis.Element.ECInstanceId, Bis.Element.ECClassId) g
 WHERE Bis.Element.ECINstanceId = 0x30000001ddf;

Table

ECInstanceId ECInstanceId ECClassId RelECClassId Direction
0x30000001ddf 1 244 91 1
0x30000001ddf 3298534891276 252 160 1
0x30000001ddf 3298534890841 211 164 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant