Path: csiph.com!eternal-september.org!feeder.eternal-september.org!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.059 X-Spam-Evidence: '*H*': 0.88; '*S*': 0.00; 'hierarchical': 0.07; 'subject:How': 0.09; 'objects.': 0.09; 'example:': 0.10; 'subject: \n ': 0.15; 'thu,': 0.15; 'drag': 0.16; 'postgres,': 0.16; 'umbrella': 0.16; 'wrote:': 0.16; 'alex': 0.18; '2015': 0.20; 'aug': 0.20; 'header:In-Reply-To:1': 0.24; 'sort': 0.25; 'subject:list': 0.26; 'message-id:@mail.gmail.com': 0.27; '13,': 0.29; 'repair': 0.29; 'subject:that': 0.29; 'url:wikipedia': 0.29; "i'm": 0.30; 'url:wiki': 0.30; 'probably': 0.31; 'lets': 0.33; 'this?': 0.34; 'worked': 0.34; 'add': 0.34; 'received:google.com': 0.35; 'but': 0.36; 'instead': 0.36; 'url:org': 0.36; 'smaller': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'list.': 0.37; 'anything': 0.38; 'someone': 0.38; 'data': 0.39; 'url:en': 0.39; 'subject:the': 0.39; 'to:addr:python.org': 0.40; 'where': 0.40; 'called': 0.40; 'collection': 0.60; 'within': 0.64; 'air': 0.65; 'records': 0.70; 'wish': 0.71; 'hoping': 0.77; 'folders.': 0.84; 'to:name:python': 0.84; 'inefficient': 0.91; 'imagine': 0.96 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=urp9OSZ90AJU84JBBvZFaulzkZ1p6lLoyKTChu4VVE4=; b=RHONWyjG+Y4YF0vZAa274jNKkZgtUYRulEwWSXYDh20gi8rd8yuT3u4o4nW9L4eIGU K2p7DepZ64019LG7SmZkmMvFPr4WbsyNpsEPcHvVrkba0I4ReJeLzAA8vgAj5IrY1pJ0 LTjX2hYQTwqlr9eOdu4JzdLrkSKY1MUAYpAIpbpa5VLWE5hBtoZr0h/Mle/KzszJ8cc+ HkQq9z0pBpRLHOFiqxgAZqb44PBXBaulx0X4XkEOhoZWCq8+cCqNXEggVbhwGG2nSgFm EsXE89jZP8AKDDguTT9AfN8pxtHBuxqbf25YDuPmhzySJm2J5KBEsZKy+EYhX089YP6v wm4w== X-Received: by 10.107.17.68 with SMTP id z65mr1115502ioi.97.1439494018443; Thu, 13 Aug 2015 12:26:58 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: From: Ian Kelly Date: Thu, 13 Aug 2015 13:26:19 -0600 Subject: Re: How to model government organization hierarchies so that the list can expand and compress To: Python Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 25 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1439494025 news.xs4all.nl 2832 [2001:888:2000:d::a6]:52501 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:95355 On Thu, Aug 13, 2015 at 1:10 PM, Alex Glaros wrote: > It's like the desktop folder/directory model where you can create unlimit= ed folders and put folders within other folders. Instead of folders, I want= to use government organizations. > > Example: Let user create agency names: Air Force, Marines, Navy, Army. Th= en let them create an umbrella collection called "Pentagon", and let users = drag Air Force, Marines, Navy, etc. into the umbrella collection. > > User may wish to add smaller sub-sets of Army, such as "Army Jeep Repair = Services" > > User may also want to add a new collection "Office of the President" and = put OMB and Pentagon under that as equals. > > What would the data model look like for this? If I have a field: next_hi= gher_level_parent that lets children records keep track of parent record, i= t's hard for me to imagine anything but an inefficient bubble sort to produ= ce a hierarchical organizational list. Am using Postgres, not graph databas= e. > > I'm hoping someone else has worked on this problem, probably not with gov= ernment agency names, but perhaps the same principle with other objects. https://en.wikipedia.org/wiki/Tree_(data_structure)