29 April 2014

How Metrici is structured

By Andrew Clifford

Everything in Metrici is built on a simple, self-defining structure.

Last week I showed how to create a simple web app in Metrici. If you haven't already, do have a look at the your first web app video. This week I will cover how Metrici is structured. You might like to check out the short video on the node store which supports this newsletter.

Node, Member, Node Type and Member Type
Node, Member, Node Type and Member Type

Metrici is structured around a small number of concepts:

Nodes are the basic unit of data within Metrici. They are equivalent to objects in an object-oriented system. Everything is represented as nodes: data such as people and places, web pages, images, and so on.

Information about the node is held in members. Each piece of information is held as a separate member. For example, the "London" node could have one member to indicate that its name is "London" and another member to indicate that its population is 13,000,000.

Members are the triples that we covered a couple of weeks ago. Each member identifies its owning node (subject), what type of member it is (predicate), and its content (object). The content can be any combination of text, number or a link to another node. Members of the same type can repeat to create lists.

Different nodes have different members. Each node links to a node type which lists the types of members that the node can use. The node type for "London" might be "Place", with allows "Name" and "Population" members.

Each member type defines which of text, number and link are allowed, and whether members repeat. For example, the "Name" member type uses just text and does not repeat; "Population" uses just a number.

Node types and member types are themselves nodes. The list of member types that node type allows is held a list of members which link to member types. A member type has members which indicate which of the text, number and link are allowed, and whether the members can repeat.

Because they are just nodes, node types and member types have types themselves. There are type types that define types, and member type types that define member types.

This same structure is used for all data within Metrici. There are additional members on node types and member types to control how data is displayed, and members that hold scripts to perform calculations and to provide additional formatting. But all of this is held in same structure.

You can examine the structure of nodes from within Metrici. If you haven't already done so, register at www.metrici.com. When you are signed in, use the More link at the top of any page to pull down a menu panel. This has a link to the node's node type. Click on this to see the definition of the node type. The node type will list the member types. Click on these to see the definition of the member types. If you keep going, you'll find that all links eventually end at the same Type node, which defines itself and forms the basis of everything in Metrici.