24 June 2014

Member storage model

By Andrew Clifford

Metrici has a versatile storage model based more on pragmatism and experience than on data theory.

In How Metrici is structured we covered the internal structure of Metrici. Over the next few weeks we are going to look at this in more detail and cover how to define new types of data.

To recap, in Metrici:

Node, Member, Node Type and Member Type

This week we are going to look at the storage of data in members.

Each member can hold three pieces of data:

Members with the same member type can repeat. The member type defines a minimum and maximum cardinality (number of repeats), though in 99.9% of cases we either set a maximum cardinality of 1 (no repeat) or unlimited. Members are inherently ordered.

You can therefore think of the members with the same member type as a table:

Value Scale Target
Member 1 value Member 1 scale Member 1 target
Member 2 value Member 2 scale Member 2 target
... etc ... etc ... etc

By varying which of the value, scale and target are used, and whether the members repeat, this structure can be used to hold pretty much any data. Here are some examples:

My name:

Value
Andrew

The country I live in:

Target
United Kingdom

The cost and currency of the printer I just bought:

ScaleTarget
162.00GBP

Latest results from the lottery:

Scale
5
15
25
38
49

Prioritised emergency call-out list:

Target
Superman
Ironman
Spiderman
Mario
Mr Bean

Grades and scores for assessing swimming pool water quality:

Scale Target
0 Brown and smelly
25 Green and cloudy
60 Mostly clear, some debris
100 Clear and sparkling

Notice how "things" like country, currency, superhero and water quality are all implemented as links to other nodes, not as names or references as they might be in a conventional database.

There is no theoretical basis for this storage model. We came up with the model by analysing the data structures within version 1 of Metrici (when it was just an assessment tool), and trying to come up with a model that would fit all of our data needs as efficiently as possible. Our subsequent experience has shown that this is a very versatile way of storing data, and copes easily with 99% of data requirements. It works well for structured data in databases and for less structured web content. It achieves some of the "attribute on link" capabilities of, for example, the associative model of data, without a significant increase in complexity. In comparison to a conventional triple store, it removes the need for a lot of link nodes that just exist to define the relationship between other nodes. It maps easily onto a conventional database.

Armed with this knowledge of the member storage model, next week we will cover how to define member types and node types to store any type of data.