Besides the hierarchical structure in Concepts and creating Parent-Child relations, the WEM Ontology feature also allows you to create Custom Relations between Concepts, making cross-references possible. You can create a very intricate "model" of a specific "reality".
On this page we will explore what relations are, how to use them and how to create your own custom relation types. By understanding and utilizing relations in your projects, you will be able to incorporate dynamic multi and single select fields, as well as subsets of concepts from different levels on the hierarchy tree. To properly utilize concept relations, it is crucial to comprehend and apply several important components. We will first explain these key components and then provide a step-by-step guide using two examples.
First, it is important to understand what concepts are, you can read up on them here. When you add concepts to the project you create a static hierarchy visualized by the different levels in the tree view. This establishes a connection between the concepts and their higher levels.
In the example above you have the models of cars with a connection to the above brand level because they are a part of that concept. However, there is no connection between the car types and the models. This issue can be resolved through concept relations. The relations in the image are of one type and can not be changed later. The 'polo' concept will always be under Volkswagen, you cannot just move it around to create relations with different concepts.
Before you start connecting concepts and set up new relations, you need a way to define the type of relation. There are a few default relation types that are already defined when a project is created. One such type is the 'is parent of'
relation. The 'is parent'
relation type is one you automatically use, when you look at the image above, the concept Toyota is parent of the concept Yaris. In this case you go from lower level up to a higher level above, you can also look at it from the other side, The Yaris concept 'is child of'
the Toyota concept, 'is child of'
is the inverse name of 'is parent of'
. In this case, the relation type is not symmetric; the meaning changes depending on the direction of traversal (up to down or down to up).
To add a relation type you go to the concept and concept queries tab in the resource pane on the left and find the folder concept relation types. When you expand the folder you will see the types of relations already made. Open the context menu of this folder by selecting the three dots or right click on the relations folder, this will open a context menu with a the options to create relation types and a option to open the concept relations overview of this project.
Name - The name given to the relation type. It is strongly advised to have a name that properly matches its function.
Inverse Name -*asymmetric - The name of the inverse type, when the relation inverses. Read more about what this means in the expandable above.
Symmetric - Toggle this when a type functions the same both ways.
* only when the symmetric option is toggled off.
The concept relations in your project are managed from the Concept relation page, you can create new relations with the green button on the right. Below the green button you find a filter to make finding the right relations easier, when you go to this page from a concept this is filled in to just show relations with that concept. In the image below you will see what this page looks like the first time you go to this page and it is still empty. When you are sure you added a relation but cant find it in this screen make sure the filter is reset, this can be easy to miss.
From Concept - The starting point of the relation, interpret the relation type name from this concept.
Relation type - The type of relation you want to make,
Show the inverted... - For asymmetric relations you can use this toggle switch to the inverted or other side of the relation.
To concept(s) - This is the other side of the relations, Here you can add one or more concepts to apply the relation to. When making one to many relations this can speed up the process. This is where it can be useful to use the show inverted option.
Once a relation is created, it appears on the concept relations screen. The concept from which the relation is interpreted is shown on the left. The relation type is displayed in the middle, with the other side of the relation on the right. On the far right, you can still see the properties used to create these relations. Even though we selected a set in the 'To concept' field, three rows are added to the concept relations screen.
A Concept Query is a Definition that will yield a collection of concepts. It can be used in Expressions as being a List of Concepts (similar to a Concept-Set or Multi-Select). Or it can be used as Source for Single/Multi Select Input fields, to present a specifically filtered list of options to choose from. The Concept Query contains of certain Nodes, Annotations/Indicators and Relations to form the Definition by which the Concepts are checked and collected to be presented as the result. If you don't know what concepts queries are or how they work we advice you to first read more about concept queries.
Open the context menu of concept queries and create a new query, this opens the concept queries designer. For this example we will use a multi-select datafield to manipulate the concepts available in a multi-select. So in this case depending on the selected option in the multi select we expect to get the concepts back that have a relation with the selected concept.
The last part is to add the ontology query to a interaction screen or implement it in an expression. Most common and easy way is to add to a multi select field. In the image below the query is added to the Month multi select, this is what is affected by the query.
You can also use concept queries in expressions, like this for example:
This expression will generate a list of months that are associated with the selected quarters.
A rental company wants a be able to filter their available cars list. They want to be able to filter on model type and be able to select the models that fit the earlier selected type. They are going to use multi-select fields to make the filter options. In the video below you see the the result we want to work towards.
The concepts for the brands and its models are already made and a new concept for the type of model is added, this is the hierarchy we are going to use:
In the images you can see the ontology or the levels the concepts are added. The brand of a car and the model has a parent child relation because they are part of the same hierarchy. The type concept is in the cars level and does not have a relation with the model concepts (yet).
The next step is making the filter fields. In this case we want a field to select the type and fields for the different brands to select the possible models for that brand.
We have everything we need to start working on the relations now. First we want to create the relation type. This is the type of relation between the model type and the specific models. Go to the concept relation types folder in the concept and concept queries in the resource pane. Open the context menu and select new relation type. We look at this relation form the model type concept, this is what we use as starting point for the name. So in this case we will call the relation 'type of the models'. The reverse name is going to be 'Model of the Type'. The meaning of the relation changes depending on what you look at, so this relation is asymmetric.
Open the Concept relation overview and add the relations between the model type and the models. In the image below you can see the first relations between the Hot Hatch type and the models is already added and the properties for the Coupe and its models is filled in the new relation form. Do this every model you want to be able to filter on.
The next step is creating the concept query, for this you go to the concept queries in concepts and concept queries, and open the context menu to select new concept query. Give the query a fitting name and it will then open the concept query designer. The first thing we need to add is the search field, in this case add a multi select datafield and select the type multi select field. Add the unknown concept for the other side of the relation and select one of the brands. Last step is to draw the 'relation line' between the two nodes and select the right relation type, in this case type of the models. (In the multi select you choose the type of models that the concept should return.)
Last step is making the interaction screen and adding the concept queries to the right fields. In the image you can see the result and below that the steps to create it.
Adaptive column to divide the page for a search filter and the list that is filtered.
Panel with the multi select filter options in the left cell and the datagrid in the right.
First multi select it the model types as filter options
A conditional, this is to show all options when the type doesn't have a selection, when a type is selected the condition goes to false and form in the bottom picture is shown.
The multi select for every brand of cars is added, this is the important part. On the right side of the image you can see the Ontology query field, in this form the query we made is added. Now the options that are shown are only those with a relation to the selected model type.
To finish it up a filter is added to the datagrid to only show cars that comply with the selected filter options.
In the concept query for the example we added an relation for every brand separately. For brand concept you need a new relation with the multi select datafield. There is also a ways to do this with one relation. When you select a level higher as unknown concept and select the depth to all descendants you get every concept back under brand. This way you can use one multi select in the interface and don't need to add every brand to the query separately. This will work best if you use the type options of concept to filter out the models from the brands, when using the all descendants options you also get the brand name as a concept back.
You can also use the concept query with relations in expressions, this gives you the ability to use it in filters or use it in labels. This label creates a list that returns the months in the a selected quarter.
The short answer is everywhere where concepts are used. This article mostly showed it in use for filters.
It can also be used in giving user rolls specific rights which fit their access level, through using custom relations between the rights and access levels.
When the button is selected it is replaced by the new relation form, here you set up the relation Properties. The form looks like this:
This means we need a multi-select datafield in the query (), andweI need to add the concept we want to manipulate as a unknown concept (The concept changes depending on the multi-select so unknown). Now we can use the relation by dragging a line from the multi-select to the the concept we want to manipulate and select the relation between them. In the case of the image below we want a set of months depending on what quarter is selected in the application. The relation is that a quarter holds specific months, so in this case we drag a line from quarters (the multi-select that sets the condition) to the concept of months and select right concept type. In this case 'Contains the months', a relation type made for this use-case. What is left before this query is ready is telling if the children of the concepts (months) to be included or excluded, in this case included.
etc.