Spectrum Technology Platform

Expand all | Collapse all

Query tree structure from Data Hub.

  • 1.  Query tree structure from Data Hub.

    Posted 04-15-2019 06:58

    Hello everyone.

    For a project I need to read a tree hierarchy from the Data Hub.
    I provided you a picture with an example.
    I need every node of the tree, but only if the connecting relation fulfill a condition (= A).
    We do not know the actual depth of the tree.
    I tried to read this tree with the Query Hub stage.
    But i do not understand how to query multiple nodes on the same hierarchy level.
    Does anybody ever had this problem before and has a solution for his?
    Otherwise i have to write the query in gremlin.

    BR
    Max
    Tree Example



    ------------------------------
    Maximilian Zurek
    ADWEKO Consulting GmbH
    Walldorf/Baden
    ------------------------------


  • 2.  RE: Query tree structure from Data Hub.

    Pitney Bowes
    Posted 04-15-2019 10:43
    Hi Max,

    The Query Hub stage should be able to traverse the given tree by anchoring on the root entity and traversing the successors for a fixed depth. It does not however support traversing for an unknown depth. I am unsure I fully understand your query though. You can use Entity to Entity steps if all you are concerned with are entities. If you want to collect or filter based on relationship properties, you would need to use Entity to Relationship and Relationship to Entity steps. A pair of these steps would traverse as far as a single Entity to Entity step but allow for collecting the relationships and\or filtering (using conditions) against relationship properties. In addition to filtering using literals or input field values, you can also have conditions that compare a current steps property values against values collected in previous steps. These are available in the drop down that defaults to Literal when defining Conditions for all but the initial Root step.

    ------------------------------
    Luke Daugherty
    Knowledge Community Shared Account
    Shelton CT
    ------------------------------



  • 3.  RE: Query tree structure from Data Hub.

    Pitney Bowes
    Posted 04-15-2019 10:52
    You may want to also try using the partial traversals option. That way you could define a query to step out, for example, 10 steps but if the tree depth was only 5 it would still return.

    ------------------------------
    Luke Daugherty
    Knowledge Community Shared Account
    Shelton CT
    ------------------------------



  • 4.  RE: Query tree structure from Data Hub.

    Posted 04-26-2019 05:21
    Hi Luke.

    thanks for your reply.
    When I am sure the tree is definitely not deeper than X steps, I could use the suggested solution to build a pair of Entity to Relationship and Relationship to Entity steps and put this pair X times one after the other in the flow.
    But I do not have this information.
    The solution for that is not urgent and because of that I placed all nodes on the same hierarchy level.
    I will try to find an easy way in gremlin and will let you know.




    ------------------------------
    Maximilian Zurek
    ADWEKO Consulting GmbH
    Walldorf/Baden
    ------------------------------