Skip to content

Programming Model: Data Addressing

Chris Russell edited this page Sep 23, 2013 · 27 revisions

See also: ONMjs.Address (address class reference)
See also: ONMjs.AddressToken (address token class reference) See also: ONMjs.address.* (address function reference)

Getting Started

ONMjs addresses are most easily understood by analogy:

Consider that you're an architect charged with creating the design for a new apartment complex comprising many buildings that are all identical save for the fact that they're not to be built in exactly the same location. Within each building are a number of different apartment configurations: some are large, others small. Some have a fireplace and walk-in closets, while others have fewer amenities.

In drawing up the design plans to be given to the construction crew, it's necessary to specify directions for each apartment. However, you don't need to duplicate this effort for each building to be constructed because all the buildings are identical. So you draw up a single generic design plan that omits the building numbers and address each apartment using a simple scheme that identifies each by its floor and unit number.

Relating this back to ONMjs:

An ONMjs data model is like your generic design plan for an apartment building.

An ONMjs object store is like a specific apartment building.

An ONMjs address is like the floor/unit number of an apartment.

And finally, actual run-time data is like the actual contents of a specific apartment in a specific apartment building once its built and someone has moved in.

Address Space Concept

The term "address space" is a just a fancy way of talking about the set of all possible addresses. In our apartment building analogy, the "address space" is the set containing all apartment units within a specific building as specified in the building's design plan. Similarly, an ONMjs address space is the set of all possible namespace addresses specified by your declared data model.

The salient point here is that an "address space" is something that's defined at design-time. Specifically, an ONMjs address space is defined when you declare your data model declaration. We'll use this term subsequently as shorthand for discussing the set of legal addresses.

Note that unlike the "address space" of an apartment building, ONMjs address spaces may be, and typically are, infinite sets due to the common use extension point/component namespaces, and less frequently recursively-declared namespace hierarchies.

We'll start with the simple cases where our apartment building analogy holds, and progress to the more complicated cases where the analogy breaks down.

Root Component Addressing

Fundamentally, an ONMjs.Store class instance manages a single Javascript object on behalf of your application. As discussed in the [Data Modeling

Creating Address Objects

Accessing Namespaces

Sub-Component Addressing

Address Tokens

Qualified vs. Unqualified Addresses

Creating Sub-Components

Removing Sub-Components

Addressing Recursively-Declared Components

Address Hash Strings, URI, URN, and URL's

Address Space and Scope of Uniqueness

Uniform Resource Identifiers (URI)

Uniform Resource Names (URN)

Uniform Resource Locators (URL)


Copyright (C) 2013 Christopher D. Russell