hierarchical-data

How to store tree structures in Java?

Hierarchical data structures are often stored in relational databases. This kind of storage is flexible but flat, so the tree structure has to be build with each query. I want to store forum posts as a tree structure, but it should be possible to query efficiently, say for example selecting posts by date or author. I'd like to have an o...

Should core application configuration be stored in the database, and if so what should be done to secure them?

I'm writing an application around a lot of hierarchical data. Currently the hierarchy is fixed, but it's likely that new items will be added to the hierarchy in the future. (please let them be leaves) My current application and database design is fairly generic and nothing dealing with specific nodes in the hierarchy is hardcoded, with...

IHierarchyData and IHierarchicalEnumerable in Winforms

Hi! Currently,I know how to do a lazy implementation of the loading procedure of the nodes in a treeview control, and read the related questions in stackoverflow, but I'm also reading about IHierarchyData and IHierarchicalEnumerable interfaces in asp.net (I didn't know to code asp.net) that allow to bind a collection to a treeview in o...

What is the fastest/best optimized way to bind hierarchal data(Chart of Account) to a treeview?

For a Chart of Account, has the following structure, ID AccountName ParentID 1 Income - 2 Expense - 3 Assets - 4 Liabilities - 5 Current Assets 3 6 Fixed Assest 3 7 Cars 6 8 Treasury 7 9 Banks 8 10 National Bank 9 11 Customers 5 12 Ahmed 11 13 ...

Procedure to alter and update table on hierarchical relationship to see if there are any children

I have a hierarchical table on Oracle pl/sql. something like: create table hierarchical ( id integer primary key, parent_id references hierarchical , name varchar(100)); I need to create a procedure to alter that table so I get a new field that tells, for each node, if it has any children or not...

SQL Server 2005 database design - many-to-many relationships with hierarchy

Note I have completely re-written my original post to better explain the issue I am trying to understand. I have tried to generalise the problem as much as possible. Also, my thanks to the original people who responded. Hopefully this post makes things a little clearer. Context In short, I am struggling to understand the best way to...

SugarCRM - how to make users see only child users?

Hello, I want to change the behaviour of Sugar CRM community version. Here's what sugar currently does: 1) Admin logs into Sugar. 2) Admin clicks on Admin tab. 3) Admin creates a new user named George with admin access 4) Under user information section, Admin makes George report to Admin (in the database, it will show users.report_to...

Autoincrementing hierarchical IDs on SQL Server

Consider this table on SQL Server wordID aliasID value =========================== 0 0 'cat' 1 0 'dog' 2 0 'argh' 2 1 'ugh' WordID is a id of a word which possibly has aliases. AliasID determines a specific alias to a word. So above 'argh' and 'ugh' are aliases...

Is it a good idea to use MySQL and Neo4j together?

I will make an application with a lot of similar items (millions), and I would like to store them in a MySQL database, because I would like to do a lot of statistics and search on specific values for specific columns. But at the same time, I will store relations between all the items, that are related in many connected binary-tree-like ...

PHP Doctrine: Custom nested set?

Is it possible to have nested set capabilities in this somewhat custom setup? Consider these 4 tables: Object: (oid, name) contains: [1, 'Licence'] and [2, 'Exemption'] Licence: (lid, name) Exemption: (eid, name) Cost: (oid, oid_ref, cost_oid, cost_oid_ref) For: P = Licence with lid [1] R...

Django query to select parent with nonzero children

I have model with a Foreign Key to itself like this: class Concept(models.Model): name = models.CharField(max_length=200) category = models.ForeignKey('self') But I can't figure out how I can select all concepts that have nonzero children value. Is this possible with django QuerySet API or I must write custom SQL? ...

Get nested/hierarchical JSON from MySQL/PHP

I am using spacetree chart and I require JSON in hierarchical format. See sample required JSON format here. I have ID,ParentID,Name,Description fields in Mysql database table. Now How can I convert data in Hierarchical/nested JSON using PHP? I know json_encode($array). But, I require nested/Hierarchical php array for this. Let me know t...

Flex AdvancedDataGrid: Need to show a hand cursor when mousing over non-leaf nodes.

When using Adobe Flex (Version 3), how can I show a finger cursor (usually seen over links) when mousing over non-leaf nodes of an AdvancedDataGrid component that shows hierarchical data? I'm using AdvancedDataGridLinkRenderer as the groupItemRenderer. ...

is there a database that can easily digest hierarchical data besides XML?

It is very difficult for me to design the database because it requires a lot of recursion. I really can't use XML because it is just not practical for scalability and the amount of data I need to store. Do you guys know of a database that can be used to store hierarchical data? ...

HierarchicalDataBoundControl.PerformDataBinding not being called on postback.

The title says it all. I am binding to a SiteMapDataSource (hierarchical). I am overriding PerformDataBinding to grab the data from the datasource. Everything works great on page load. But when I perform a postback anywhere on the page, the PerformDataBinding method does not get called, and in effect, not rendering any menu items (Per...

How to find the parent using the hierarchyid data type

This code here does not work when I try to find a single parent node declare @val hierarchyid select @val = dbo.GetHierarchyIDbyID(30) --get the parent select * from NodeHierarchy where @val.GetAncestor(NodeHierarchyID) = 1 How would you go about finding the parent? ...

SQL 2008 HierarchyID - Select X descendants down

How can I query a table which has a column of data type HIERARCHYID and get a list of descendants X levels deep under an employee? Here is the current structure: CREATE TABLE [dbo].[Employees]( [NodeId] [hierarchyid] NOT NULL, [EmployeeId] [int] IDENTITY(1,1) NOT NULL, [FirstName] [varchar](120) NULL, [MiddleInitial] [...

Client-side caching/paging of *Large Hierarchical Data* (Large Tree Data)

Background: I am developing a client-server based WPF application which displays large result sets (millions of rows) from related ad-hoc SQL Server queries in a custom UI Tree/Grid View. The ad-hoc SQL queries, which are generated on the client through the user interface, are essentially nested 'master-detail' (related) queries which e...

Elegant way to aggregate multi-dimensional array by index key

How can I recursively find the total value of all children of an array that looks something like this? [0] => Array ( [value] => ? // 8590.25 + 200.5 + 22.4 [children] => Array ( [0] => Array ( [value] => ? // 8590.25 + 200.5 ...

Retrieving data with a hierarchical structure in MySQL

Given the following table id parentID name image 0 0 default.jpg 1 0 Jason 2 1 Beth b.jpg 3 0 Layla l.jpg 4 2 Hal 5 4 Ben I am wanting to do the following: If I search for Ben, I would like to find the image, if t...