Questions tagged [hierarchical-data]

Hierarchical data reflects a set of parent-child relationships. These can be found in a genealogy, a taxonomy, a list of requirements for parts assembly, and innumerably other instances. Methods for dealing with hierarchical data are often essential for data management and analysis.

Hierarchical data reflects a set of parent-child relationships. As Materials Resource Planning was developed by manufacturers in the 1950s, hierarchical data management emerged as a theoretical and practical discipline. A manufacturer uses the term Bill of Materials (BOM) for the set of items required to assemble a parent item; the term BOM was adopted by mathematicians and software developers, and it is used today in both realms.

Hierarchical data is ubiquitous and has called forth some of the most important and complex work of database management. It has also propelled object-oriented programming.

The key design element is recursion. Imagine starting at the trunk of a tree and visiting every leaf; this theoretical exercise would require an enormously large number of decision points occurring in a nested or recursive pattern. Requirements for this analysis are remarkably varied and have produced entire sub-disciplines of database design.

2030 questions
0
votes
1 answer

Getting the children, grand children in hierarchical structure

I am working with hierarchical data model with rails and gem called ltree_hierarchy(https://github.com/cfabianski/ltree_hierarchy). In that each node will have a parent id(which is an immediate parent of the current node). 1 2 …
Aarthi
  • 1,451
  • 15
  • 39
0
votes
1 answer

Is it possible to replace cursor in SQL when the query is hierarchical?

I have three tables in MsSQL to store data. First one is the Children contains the following rows ID, Name, Age, FatherID, SchoolID The second one contains the data of their fathers, like this FatherID, Name, Age The third one is the School with…
0
votes
1 answer

Using recursion with a self Foreign key

I'm using PostgreSQL 10, and I have the following structure: A table Type with a foreign key to itself. id name parent_id 1 namea Null 2 nameb Null 3 namea1 1 4 namea11 3 5 namea111 4 6 nameb1 2 …
user3541631
  • 3,686
  • 8
  • 48
  • 115
0
votes
1 answer

MySQL - Listing a parents children using the Materialised Path approach

As you'll see from the below example, I have a user table which has two important columns: ManagerUserId - the manager of that particular user. Lineage - this columns comes from the Materialised Path approach, good read if interested in another…
Troy Poulter
  • 677
  • 1
  • 8
  • 29
0
votes
1 answer

Can I add a comment line to a child node?

I need to build a XML file with the below format: XYOperating Time HR
NEW
Giuseppe
  • 1
  • 2
0
votes
0 answers

Recursive descendants from adjacency list table with unknown child depth and char type columns

I have an adjacency list model table with ID and ParentID columns respectively. Both columns are CHAR(32) as required by the client. There is a FK relationship between them. Unknown depths of descendants. The database is MySQL and the programming is…
user1730452
  • 155
  • 1
  • 8
0
votes
1 answer

How to get all parent id

I have a MySQL table contains a list of categories. category_id name parent_id -------------------------------------------------- 1 beverage NULL 2 Water …
apple_w
  • 51
  • 3
  • 5
0
votes
1 answer

Issue with itemEditor in AdvancedDataGrid when using hiearchical data as dataProvider

Following is the sample code. While I start editing either in optionId column or option column, the other rows of the same column are also get affected and reflecting the same value. But when I am editing in other columns it is working fine... Don't…
0
votes
1 answer

d3.js: Change (drill-down) data bound in selection.each()

I am making an organization chart in d3.js (version 5). I want it to be as dynamic as possible, so when there are changes, I can easily update the input files and it will re-render. I have a simplified reprex below and in this CodePen in which I…
twgardner2
  • 630
  • 1
  • 8
  • 27
0
votes
2 answers

Aggregate data in a SSAS hierarchy

I have a hierarchy in a dimension in my cube, and a fact table that references that dimension. Let's call that a hierarchy of departments and the fact table contains billing targets set for each department (on a record-per-day basis if that's of any…
Shvets
  • 71
  • 1
  • 8
0
votes
2 answers

How can I get certain levels of JSON in Python?

If my JSON data looks like this: { "name": "root", "children": [ { "name": "a", "children": [ { "name": "b", "children": [ { …
simeck
  • 3
  • 2
0
votes
0 answers

How to dynamically define a hierarchy in a JSON, in order to use it in a OrgChart JS Library?

I need to create an OrgChart which will take a JSON file locally as an input and display it as a dynamic orgchart by using javascript libraries. The problem is the JSON doesn't have a clear hierarchy defined like Id and Pid or parent-child…
0
votes
1 answer

SQL loop. I want to iterate through a loop containing SELECT results

From a table with column structure (parent, child) I need: For a particular parent I need all children. From the result of (1) I need the children's children too. For example for parent=1: parent|child parent|child parent|child 1 …
MAN
  • 1
0
votes
1 answer

How Do I Determine if a Child or GrandChild Class Needs a TenantId?

Let's say you have a Tenant that has many Users that have many Accounts that have many transactions. How far down the tree do you add a TenantId property? How far down do the tree do you add a UserId? Or do you only ever need to have the parent…
dapperdan1985
  • 3,132
  • 2
  • 15
  • 26
0
votes
1 answer

Parent child Hierarchy based on non unique order number

I have a table containing system and order number column which is not unique.I would like to connect the system based on the order number +----------------------+ ¦ system ¦OrderNo¦ ¦--------------+-------+ ¦ system1 ¦ 1 ¦ ¦…
xoanon
  • 195
  • 1
  • 10