[OPEN-ILS-DEV] Re: Feature Request: Roaming Items, Automatic Item Location Changing

Paul Waak ptwaak at gmail.com
Sat May 31 07:24:45 EDT 2008


Yes, this does answer my questions. -Paul

On Fri, May 30, 2008 at 08:41, "Mike Rylander" <mrylander at gmail.com>  
wrote:
> The schema relevant to org_lassos currently looks like this:
>
> CREATE TABLE actor.org_lasso (
>     id      SERIAL  PRIMARY KEY,
>     name    TEXT    UNIQUE
> );
>
> CREATE TABLE actor.org_lasso_map (
>     id          SERIAL  PRIMARY KEY,
>     lasso       INT     NOT NULL REFERENCES actor.org_lasso (id) ON
> DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
>     org_unit    INT     NOT NULL REFERENCES actor.org_unit (id) ON
> DELETE CASCADE DEFERRABLE INITIALLY DEFERRED
> );
> CREATE UNIQUE INDEX ou_lasso_lasso_ou_idx ON actor.org_lasso_map
> (lasso, org_unit);
>
> That schema will be fleshed out over time to include ownership
> information and usage metadata.
>
> Both the org_unit and org_lasso objects have a numeric id field which
> is constrained to positive numbers.  Since those two object types
> represent mutually exclusive ways of grouping libraries
> (organizational units) together -- strict hierarchy of parent-child
> relationships on the org unit vs arbitrary grouping by lasso -- we use
> the negated value of the lasso id to signal that the group in question
> is, in fact, a lasso instead of an org unit (which would have its
> natural, positive value).
>
> Because an org unit by itself can be treated as a grouping mechanism
> for all of its descendants (and the lassos have (for the purpose here)
> grouping as their main property), we can simplify the code by having a
> single function return the list of inferred locations that interprets
> the value based on its sign.
>
> So, to answer your original question (I'm long-winded even in
> email...), when we need a defined group of locations we pass around is
> the id field from either the actor.org_unit or actor.org_lasso.
> (Also, just to complicate things a bit, org units also have an
> associated tree depth, and you can use that to ask for an ancestor of
> the context org unit (at the requested depth) and its children instead
> of the specific context org unit you have in hand.  That's how we do
> ranged searches in the OPAC, where you can focus on a branch but
> search the entire system -- Branch context org with System depth.  Org
> lassos do not have such a hierarchy, so no depth there.)
>
> Does that answer your questions?
>
> -- 
> Mike Rylander
>  | VP, Research and Design
>  | Equinox Software, Inc. / The Evergreen Experts
>  | phone: 1-877-OPEN-ILS (673-6457)
>  | email: miker at esilibrary.com
>  | web: http://www.esilibrary.com




More information about the Open-ils-dev mailing list