Path: csiph.com!news.mixmin.net!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.050 X-Spam-Evidence: '*H*': 0.90; '*S*': 0.00; 'hierarchical': 0.07; 'subject:How': 0.09; 'message-id:@4ax.com': 0.09; 'objects.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'thu,': 0.15; 'drag': 0.16; 'postgres,': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'set,': 0.16; 'two,': 0.16; 'umbrella': 0.16; 'alex': 0.18; 'tree': 0.18; 'url:home': 0.18; '2015': 0.20; 'aug': 0.20; '(the': 0.22; 'select': 0.23; 'split': 0.23; 'sort': 0.25; 'subject:list': 0.26; 'header:X-Complaints- To:1': 0.26; 'repair': 0.29; 'subject:that': 0.29; "i'm": 0.30; 'probably': 0.31; 'common': 0.33; '-0700': 0.33; 'lets': 0.33; 'this?': 0.34; 'worked': 0.34; 'add': 0.34; 'but': 0.36; 'instead': 0.36; 'smaller': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'received:org': 0.37; 'charset :us-ascii': 0.37; 'list.': 0.37; 'anything': 0.38; 'someone': 0.38; 'why': 0.39; 'data': 0.39; 'subject:the': 0.39; 'rather': 0.39; 'to:addr:python.org': 0.40; 'where': 0.40; 'called': 0.40; 'company': 0.60; 'collection': 0.60; 'more': 0.63; 'within': 0.64; 'air': 0.65; 'life': 0.67; 'family': 0.68; 'records': 0.70; 'wish': 0.71; 'hoping': 0.77; 'entity,': 0.84; 'folders.': 0.84; 'dennis': 0.91; 'inefficient': 0.91; 'marriage': 0.91; 'birth': 0.93; 'oil': 0.93; 'ultimate': 0.93; 'imagine': 0.96 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dennis Lee Bieber Subject: Re: How to model government organization hierarchies so that the list can expand and compress Date: Fri, 14 Aug 2015 19:38:16 -0400 Organization: IISS Elusive Unicorn References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: adsl-108-68-178-61.dsl.klmzmi.sbcglobal.net X-Newsreader: Forte Agent 6.00/32.1186 X-No-Archive: YES 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: 41 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1439595502 news.xs4all.nl 2831 [2001:888:2000:d::a6]:34830 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:95382 On Thu, 13 Aug 2015 12:10:12 -0700 (PDT), Alex Glaros declaimed the following: >It's like the desktop folder/directory model where you can create unlimited 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. Then 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_higher_level_parent that lets children records keep track of parent record, it's hard for me to imagine anything but an inefficient bubble sort to produce a hierarchical organizational list. Am using Postgres, not graph database. > >I'm hoping someone else has worked on this problem, probably not with government agency names, but perhaps the same principle with other objects. > Practically any Genealogy program (though the best two, IMNSHO, have both been discontinued -- Ultimate Family Tree and The Master Genealogist; both were "event based" rather than the common "family based" types [families in UFT/TMG result from the event of a birth event, whereas others present a form that is based upon two parents automatically]). I keep joking that I'm going to put the life of Standard Oil into TMG (the split up would be lots of children "born" at the same time the parent company "died"; mergers would be "marriages" with/without a change of name event and death of one of the marriage partners). If you are using a database, why do you envision a bubble sort in use... select the top-level entities -- sorted by the database engine. Loop over the result set, for each entity perform a select of the children of that entity, again sorted by the DBMS. Perform this recursively until no more grandchildren are found... >Thanks! > >Alex Glaros -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/