Data Models and Edge¶
Projects wanting to take advantage of the data management features in Edge are required to create a data model.
Data models objects in Edge are tree-like structures, which describe the properties of a real-world system (in our example below, a spin coating experiment). The individual properties (e.g. tensile strength of a polymer) are described by FactKinds, and related properties can be grouped together as part of the same FactNode. In our example the Tensile Strength FactKind belongs to the Mechanical Properties FactNode.
Creating a data model is probably the most important step when using the Edge Application, so getting the model design right is certainly worth spending some time over. While the design of this model will be driven by the structure of the project itself, it is also worth reviewing the components that these Data Models are built from (see data model, fact kind, fact node and configuration in the Glossary).
Data models are intended to be created infrequently, but used frequently as part of actions such as importing data or searching data. Data models can also be updated to a new version when project requirements change, though whether to update a model or create an entirely new one is left up to the user.
Creating a Data Model¶
As an example, we will create a data model for a polymer spin coating experiment. Our datasets include information about the polymer's general properties, experimental settings, plus results of measurements performed on the polymer film.
For our example, we're going to assume that this spreadsheet is representative of the data our experiments generate and build our data model accordingly.
Opening the Data Modeller¶
First, create a new data model by clicking the plus icon in the bottom left corner of the application and selecting "Data Model".
This can also be achieved by right clicking in the data manager to open a context menu...
... clicking on the Create a new data model button in the welcome panel...
... or navigating to File > New > Data Model in the menu bar.
Double click on the newly created data model in the data manager to open the data modeller tool
Editing the data model¶
In the data modeller tool, edit the data model name by typing into the "Data Model Name" text field.
After filling in a name for the data model, click on the root FactNode to bring up a new pane to the right. Here you can enter a description.
Now we can start creating the structure of the data model.
With reference to the design above we can start by creating the three FactNodes for Composition, Condition and Evaluation.
The nodes can be added via the + button next to "Child Nodes" in the right hand pane, or by right-clicking on the node in the left hand pane and selecting New > FactNode.
The properties of a FactNode or FactKind can be edited either by selecting its parent node...
...or selecting the object itself.
The Timestamp FactKind also needs to be added to the top level FactNode. Like FactNodes, this can be done either by right clicking on the root FactNode and using the context menu, or by clicking the + button next to "Fact Kinds" while the root FactNode is highlighted. There are a few further details required when setting up a FactKind, which are the data type (required) and the units (optional). There are also Configurables which can be associated with a FactKind, these are discussed here.
If a FactNode contains FactKinds with similar properties, the Set all types to context menu in the Fact Kinds box can be used to assign a type to all FactKinds. In our example, the Composition node contains two FactKinds describing the proportion of different materials in the polymer. These are both of the 'float' data type.
Preconfigured value(s) can be set for a FactKind by clicking on the "Preconfigured Values" column, and entering each value, separated by commas. Setting preconfigured values doesn't mean that a property has to be set to one of these defaults, but they will be selectable when manually entering data. This can save time if a property will normally be one of a limited set of values.
In our example data, the IR Spectrum row refers to a external file. Just uploading the filename as a text string is not so helpful, as the file may be moved or only stored on a specific machine. To get around this, we use the 'file_id' types available for FactKinds. Setting this type allows raw data files to be saved to the data catalog by using the File Upload tool.
FactKinds and Configurables¶
The Tensile Strength FactKind is an example of a measurement which may have multiple values, dependent on the measurement conditions. In particular, our example model takes into account that measurements will be taken across a range of different temperatures and relative humidities. If we have multiple tensile strength measurements, we need a way to match the recorded values with the measurement conditions.
Adding configurables to a FactKind allows us to do this. As with FactKinds, Configurables have a type and (optional) units - the main difference is just that they are limited in scope to their parent FactKind.
To add a configurable, select the appropriate FactKind, and either right click in the "Configuration" box to bring up "Add" in a context menu, or press the + button by the word "Configuration:"
Saving the Data Model¶
To save the data model to the Data Catalog, select the data model in the data manager, and either clicking the Save icon below the data manager, or right click to bring up a context menu, and click save.
This process will automatically abort with an error message if any required information is missing (e.g. FactKinds without a data type assigned).
When the item is saved, the black circle (●) next to it in the data manager will be cleared, until the item is edited again.
Updating a Data Model¶
Data models can also be updated in a limited number of ways. FactKinds cannot currently be edited, although they can be added or removed from an existing data model. The name of a Data Model also cannot be edited once it is saved for the first time.
Loading a data model, modifying it, and saving it means that the updated model will be saved as a new version, rather than an independent data model.