# Module 1: Learning the basic concepts of GeoDMS

(Difference between revisions)
 Revision as of 12:54, 10 August 2020 (view source)Jip (Talk | contribs)← Older edit Revision as of 13:14, 10 August 2020 (view source)Jip (Talk | contribs) Newer edit → Line 25: Line 25: parameter some_example := 2f * 9f^2f + 3f * sqrt(4f); parameter some_example := 2f * 9f^2f + 3f * sqrt(4f); - =='''Try it yourself'''== + =='''Try it yourself!'''== + In this exercise, you will count the number of 4-digit-postcode (PC4) areas there are in a 2-digit-postcode area (PC2). + * Download a nearly empty configuration HERE and open basics.dms with a text editor. * Download a nearly empty configuration HERE and open basics.dms with a text editor. * In this file, create a container after the SourceData container, and mind the accolades! * In this file, create a container after the SourceData container, and mind the accolades! - * Here, create a string attribute that links to the postcode4-codes in the postcode4 point set. Give it an approriate name. Since you configure an attribute in a container (which does not have a domain unit itself), it does not automatically inherit a domain unit, so you must specify this yourself. + * Here, create a string attribute that links to the PC4-codes in the postcode4 point set. Give it an appropriate name. Since you configure an attribute in a container (which does not have a domain unit itself), it does not automatically inherit a domain unit, so you must specify this yourself. * Now we can do something pointless with this attribute. Create a new attribute which selects only the 2 left string characters. Look in [[String_functions]] for the appropriate operator to use, and figure out how this would be implemented. * Now we can do something pointless with this attribute. Create a new attribute which selects only the 2 left string characters. Look in [[String_functions]] for the appropriate operator to use, and figure out how this would be implemented. - * + * Next, try counting the number of postcode 4 areas there are per postcode-2 area. To do this, you can count the number of records in a domain over a relation. The relation in this case would be the PC2 attribute. However, if you count per PC2, you'll have to create a new domain that has only unique PC2-code. Use the [[unique]] operator for this. + If you can't figure it out yourself, here is a + {| role="presentation" class="wikitable mw-collapsible mw-collapsed" + | Lorem ipsum + |- + | Lorem ipsum dolor sit amet + |}

## Key concepts

Before we dig into the practical part, let's discuss some key concept which are fundamental to understanding GeoDMS and enables you to perform analyses. Every data item has a domain unit, which defines its entity. For example, we have a geographic data set with provinces in the Netherlands. The Netherlands has 12 provinces, so you could say that the domain unit has 12 rows, one row for each province. Within this domain we have information about each province: name, number of inhabitants, and geometry. Each information field is called an attribute: an attribute of the domain unit provinces. Each of those attributes holds information, and this can be numbers, text, or coordinates. However, we must tell GeoDMS what kind of information is being stored for each attribute, this is called the values unit. So, if we would see a data set as a table, the number of rows (and its fixed order) are called the domain unit and the columns represent attributes of that domain unit. You could also configure parameter values, these are special cases wherein the domain unit has just one row, and it can contain only one attribute. Thus, it contains only one value.

## GeoDMS GUI lay-out

Now we know that data needs to be configured in domain units and attributes. However, in most cases we would want to combine domains, or we simply want to structure data items. In such case we can uses containers, these are just like folders to hold all kinds of units or attributes and it has no domain of itself. When you open the GeoDMS GUI you'll see that it uses a folder structure just like you are used to on Windows computers. Wherein a folder can be either a container or a unit.

## Calculation rules

Configuring an item always consists of several components:

```attribute<value type> name (domain) := expression;
```

first you specify whether it is a unit, attribute, container of parameter. Then you must specify the value type. Then a name (which cannot contain non-alphanumerical values, or start with a number). Then the ':=' sign means that an expression is coming. Then the expression is formulated and you always close a parameter or attribute with a semi-colon ";".

For example:

```attribute<float32> nr_of_inhabitants (provinces) := provinces/nr_of_inhabitants;
```

In GeoDMS, calculation rules are defined using expressions. For each unit, attribute or parameter you have to specify an expression. In the example above, this attribute shows an attribute that is defined somewhere else and links to that. We could also define some constant factor to it:

```attribute<float32> nr_of_inhabitants (provinces) := const(100f, provinces);
```

Here each province get the value 100 for the attribute 'nr_of_inhabitants'. The 'f' after 100 is a short-hand for float32, as mentioned earlier you always have to specify what type of data you are using. So here, you say the value 100 has a float32 value type (by default the value type is uint32, so if you won't specify anything, this is assumed), for all values type, see here http://wiki.objectvision.nl/index.php/Value_Type). All kinds of calculation rules can be configured:

```parameter<float32> some_example := 2f * 9f^2f + 3f * sqrt(4f);
```

## Try it yourself!

In this exercise, you will count the number of 4-digit-postcode (PC4) areas there are in a 2-digit-postcode area (PC2).

• Download a nearly empty configuration HERE and open basics.dms with a text editor.
• In this file, create a container after the SourceData container, and mind the accolades!
• Here, create a string attribute that links to the PC4-codes in the postcode4 point set. Give it an appropriate name. Since you configure an attribute in a container (which does not have a domain unit itself), it does not automatically inherit a domain unit, so you must specify this yourself.
• Now we can do something pointless with this attribute. Create a new attribute which selects only the 2 left string characters. Look in String_functions for the appropriate operator to use, and figure out how this would be implemented.
• Next, try counting the number of postcode 4 areas there are per postcode-2 area. To do this, you can count the number of records in a domain over a relation. The relation in this case would be the PC2 attribute. However, if you count per PC2, you'll have to create a new domain that has only unique PC2-code. Use the unique operator for this.

If you can't figure it out yourself, here is a

 Lorem ipsum Lorem ipsum dolor sit amet