An introduction to the WEM Modeler Ontology and use of Concepts.
Let's start with the question: what is Ontology. According to Wikipedia: "In computer science and information science, an ontology is a formal naming and definition of the types, properties, and interrelationships of the entities that really or fundamentally exist for a particular domain of discourse. It is thus a practical application of philosophical ontology, with a taxonomy". Sounds complex? Well, it can be. Ontology within WEM is one of the most powerful, but also complex concepts. In this article we will cover the basics, and we'll discuss the more complex aspects of the WEM Ontology in another article.
Many people use the Ontology to define and maintain picklists that are static. Some examples:
A list of all US states;
A list of the situations you have to use in your application;
A list of every possible status of a ticket in a helpdesk system;
Etc.
If you need a field in your WEM list from which you need to select pre-defined options (a single select
or multi-select
data field), you need to point that field to a list of values that is stored in the Ontology.
And this is the most basic use of the Ontology. It is also the way most modelers use the Ontology.
You can also have a hierarchy within a picklist. You could e.g. have a list of "Car brands" (BMW, Ford, Infinity, Nissan, Volkswagen, etc.), and for each car brand the car models (children of the parent Concept "Car brands"). You now have a simple hierarchy of car brands and car models.
Items in the Ontology are called Concept
s. So in the Ontology you find relations between Concepts
.
Every item in the Ontology is a Concept
. So when you want to maintain car brands, "Ford" would be a Concept. If there is a hierarchy, "Ford"."Mustang"
is also a Concept.
Note: "Mustang" is called a child
of "Ford". But it is still a Concept.
A Concept has information associated with it:
Local name
: This is the name of the name of the Concept;
Display Names
: If you have a multi-lingual application, you can specify what the Concept name is in the various languages you want to support;
Concept type
: Specify a new Concept type or select one from a list of existing Concept types. See below for an explanation of Concept types;
Description
: You can briefly describe a Concept;
Synonyms
: you can add one or more synonyms for a car. You can use this e.g. if you want to user to be able to search for a Concept, but you want "Volkswagen" and "VW" to point to the same Concept. You would add the Synonym "VW" to the "Volkswagen" Concept.
A Concept Type
is used to distinguish between Concepts. This is not limited to children of a single Concept. You could look at a Concept Type as being a label. Example: Let's say you want to be able to find all car models dat are SUVs. You could easily realize this by adding the Concept Type "SUV" to the car models that are SUVs. You now have created new relationship between the various Concepts, based on the Concept Type "SUV". In a list you could create a single-select field that would only show the car models of concept type "SUV".
The Concept Type is a very powerful way of adding an extra layer of relationships between Concepts.
To add a new Concept, first, go to the Ontology
section of your Project. Here you get an overview of all Concepts created in this project. To add a new Concept, simply select New child concept
from the context-menu:
Since you start at 'the top' of the Ontology hierarchy you start with creating a new child. Give this Concept a name (e.g. "Cars") and fill in the Concept details on the right hand side of the screen:
Besides the basic information that is associated with a Concept (see above), it is also possible to add one or more properties to a Concept. You can use these properties for whatever you want. E.g. maybe you want to add a car brand logo image to a Concept: just add a property of the type file
to the Concept. You can also use concept properties in expressions in labels or template properties this allows you to show a logo depending on sign in for example you can find a guide here.
To add a property to a Concept, select the Concept and click on the Properties
button in the menu-bar. You now get a list of all defined properties (this list is empty for a new Concept, of course), and you can New
, Edit
or Delete
a property.
Click on add
. You now get the properties form for the new property:
Once a property has been defined, you can change the details or value of that property through the detailed information of the descendant Concept Properties in the context menu. Now you can also assign a value to the added property by editing or adding a descendants (child) of the original concept by double clicking the concept or select edit from its context menu.
Concept properties and the value a concept property holds can be used in expressions throughout your application. You can use this by adding a colon (:
) and the name of the property in single quotes, here is an example of a concept with a property called 'Image'
and holds a file with a image belonging to the march property: 'Month'.'March':'Image'
Towards the end of this article, you can find simple steps on how to display a custom logo based on the signed-in user.
To add a children to a Concept, simply select New child
. A new child is now created as part of a Concept. All properties of the parent Concept are available, and the information details you needed to enter for the parent must/can also be specified for the child.
If you want to create a picklist that is rather long (e.g. all the Countries in the world, or all the US states), you may want to impor4t that data to create a list. To use the Import function you first select the Concept where you want to add all the children. Let's say you have a Concept called "Cars" and want to add a list of all car brands. Select "Cars" and click on the Import
button. You get the import screen:
Here you copy the list of car brands in the main container (see example above). This container has a dropdown list where you specify how you want to use this list. nN our example we select Local name
because we want all the children to use the name of the car brand as the local name. Other import options are:
Content type
Description
Synonym
Display name - you can select multiple display name if your application support multiple languages
Any property you may have defined for the Concept "Car"
You can also specify whether the copied list has a header or not. Is a separator used and if so: which one? What is the qualifier you want to use.
Now simply click on ok
, and the list is imported and your Concept "Cars" now has a complete list of child Concepts that each represent a car brand.
Concept properties can also be used in your template settings, in this example we will use the "Menu logo" setting to show a logo fitting the account.
Upload the different Logo image files to the file folder in the modeler.
Create a concept folder called Companies for example and add a property called 'Logo file'
Add the different Companies as concepts and add the logo files in their Logo File property.
Add a concept data field to select and hold the information for which Company a user works for in this case we can call it 'Company'. (You also need a field that holds the current user information)
There are 2 ways to execute the last part:
Create a calculated field that calculates the current logo and uses the calculated field in the template settings directly.
Add the expression directly to the template expressions.
All template settings are text fields this means you need to use the FileUrl() expression to convert the return type from a file to the direct Url from the file. This is not needed when you use property files in template interactions for example.
There are two areas that are for advanced use: Ontology Queries and Ontology Relations. These topics will be discussed in the next pages and makes concepts more powerful.
Item
Options
Name
The name you want to give this property.
Value type
- Text
- Numeric
- Boolean
- File
- Rich text
- Date
- Duration
The value type you want this property to have
Applies on
- Direct children
- All descendants
Specify if this property is available to only the direct children of a Concept, or to all children of all children.
Only concepts with type
If a property should only be available to concepts of a specific Concept type, you can specify that Concept type here.
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.
Advanced custom queries with the WEM Ontology tools
Concept Queries can be used to create custom filtered collections on the Concepts in your Project. This part is quite abstract and can be used in a complex concept-model with custom relations between the concepts and custom concept types. For the basic and more straightforward filtering of concepts, you could do a lot already with the available Concept-Functions in Expressions.
For the purposes of understanding this topic a little better, let us consider the following use case.
A Company has a page to add and manage users.
A User has a user name, a role, one or more functions and a location (country). In the screenshots below, you can see the Data Model and the Concepts tree.
Requirements:
A user with Role = Admin can be assigned one or all of the 4 functions - Add / Modify / Delete / View Users).
A user with Role = Advanced User can be assigned one or all of only 3 functions - Add / Modify / View Users).
A user with Role = Regular User can only be assigned one function - View users.
We will now show how the Requirements can be implemented using Concept Relations and Queries.
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.
To add a new Concept Query, you need to go to the Concepts and concept queries
section of your Project. To add a new Concept Query, right-click on Concept Queries
or click on the ...
to open the context-menu and click on New concept query
from the menu as shown below.
You are then prompted to enter a name for the Concept Query.
Once you name your Concept Query, you are presented with the concept query designer. On the screen, you can see the Concept Query editor menu at the top and more importantly, the concept query nodes at the left. Then you have the canvas where you would drag and drop nodes from the left, just as you would while working on a flowchart, and use the items in the editor at the top. This would create a concept query.
We'll first discuss the (greyish) Literal Nodes, before we get back to the first node (the Unknown Concept).
This node can be used to select one specific single concept item from your Concept tree.
Illustration 1.1:
Let us re-visit the use case that we had above and let's see how we can achieve this requirement using a concept query that uses a single-select literal - "A user with Role = Regular User can only be assigned one functions - View users."
Once you have added a new concept query and given it a name, drag the single-select node on to the canvas. This will bring up a prompt, where you need to select one and only one concept item. In our use case, we want to select 'View Users' under 'Functions'.
Once you do that, you will see something like the below. You may notice the Invalid
error on the editor menu (top).
2. The next step would be to click on node and then click on the Include
button on the editor menu. This will change the node as you can see below and the Invalid
error is no longer there.
3. The last step would be to use this concept query in an interaction node. In this example, we have a conditionals that would allow different configurations for the 'Functions' field, based on the value selected for 'Role'. For now, let us focus on the last one in the screenshot below. We have now applied the concept query to the single-select field 'Functions', if 'Role' = 'Regular User'.
Now, this is what you see as a result. As you can see, the 'Functions' has been filtered on one value that is configured in the ontology query.
Illustration 1.2:
Let's now try the next requirement - "A user with Role = Advanced User can be assigned one or all of only 3 functions - Add / modify / view users".
One of the ways this can be achieved is by using single-select literals as shown below. This illustrates that there can be more than one nodes in a query.
Note: There are better ways of handling this requirement using multi-select literals, which we will see shortly.
Just as the name suggests, this works the same way, except that it there can be multiple concept items assigned to the node.
Illustration 2.1:
Let's go back to the earlier requirement that we had fulfilled in Illustration 1.2 - "A user with Role = Advanced User can be assigned one or all of only 3 functions - Add / modify / view users".
Instead of using 3 single-select literals for 3 individual concept items, we could use one multi-select literal and assign all the 3 concept items for the same result. Notice the values assigned at the right-hand panel.
But there is yet another way of doing this.
Illustration 2.2:
We will learn about the Exclude
option in the editor menu now. So, instead of including 3 of the 4 concept items as we did in Illustration 2.1, we could also Include
all 4 concept item in one node and the Exclude
1 concept item in another node for the same result.
Note the Include
annotation on the first node that is assigned all 4 values and the Exclude
annotation on the second node that is assigned one value that we do not need.
This method could get unweildy when the full list of values that need to be included, get longer. We will shortly see yet another way of handling the same scenario.
The Unknown Concept node lets you define in a more dynamic way which concepts are part of this Node as opposed to the static Literal Concept nodes as discussed before. You can easily assign the entire pick-list to this node without having to select individual concept items under the list, just by indicating the Root Concept and the Depth.
Illustration 3.1:
Continuing from Illustration 2.2, we will now see how we could use the unknown concept to simplify the query.
As you can see from the right hand panel, we have assigned All Children
of the 'Functions' concept item to the unknown concept node. This will select only the direct children (all concepts of the single level below the chosen root concept). If there are deeper levels under the chosen root concept and you want all those concepts as well, the All Descendants option can be used.
The 'Type'-property in the right-hand panel can be used to filter the children further based on a concept type that exists and is defined on the concepts within the root.
Mind: the chosen root concept (in this case, 'Functions') is NOT part of the result...
While the Single Select literal node holds one specific concept item statically, a Single Select Data Field can be used to get a specific Concept Item that is defined at runtime in the User Session. This can make the Concept Query even more flexible and linked to any situation in Runtime.
Let's build upon the earlier use cases where we used different concept queries to add users to the database. Now, let's shift our focus to the User Summary screen that shows a list of all users. We would like to filter the users list based on a role. This can be achieved by creating a concept query with a single select data field.
Illustration 4.1:
To create this query, we need a single-select data field. Let's use the session data field 'Select user role' for this.
We now create a concept query and drag the node onto the canvas. This immediately prompts us to select a single-select data field. Another option is to directly drag the specific Single Select Data-field from the Data Model tree onto the Concept Query Canvas, and it will create the Single Select Data Field node.
Once that is done and the node annotated with Include
, the query is ready.
Next, we create a filter in the 'Users' table as shown below.
This approach does not really need a Concept Query, as you can also directly use the Select User Role data-field (holding the selected concept to filter) in the filter expression. In that case, you can just use [Users.Role] = [SelectUserRole]
in your expression, as they are both single select fields holding one specific concept.
This is just to illustrate a basic approach to using Concept Queries, which can be made more complex.
This is very similar to the above, except that the data field that is being used here is of multi-select data type. Again, also possible to achieve directly in Expression, but then you'll need something like[Users.Role] in [MultipleSelectedUserRoles]
in your expression, to check if the single User Role is part of the selected Roles in the Multi-Select.
Using the Concept Query always assumes that the result is a list of concepts, with 0, 1 or more concepts, so in expressions a Concept Query must always be treated as a Concept-List.
Text literal is a way to filter Ontology items (concepts) based on text matching exactly or containing or starting with or ending with a specific text, with an option to indicate whether or not the search should be case sensitive.
Illustration 6.1:
Let's consider a concept item consisting of a list of countries.
Now, say we would like to filter and show only the countries whose names start with 'U'.
We start by creating a new concept query and adding an unknown concept node and assigning it to the concept item 'Countries' and annotating it with Include
option.
We then drag the text literal on to the canvas.
As you can see, the right hand panel shows a field where you can enter the text that you would like to search, then the matching options (exact / contains / starts with / ends with) and an option box to indicate whether you want the search to be case sensitive or not. We fill these options as appropriate ( Starts With U, not case-sensitive).
Finally, we need to indicate that the condition that has been set in the literal node has to apply to the unknown concept query node. This is achieved by making a connection as shown below, with an arrow that allows you to select a Relation from the available options, to indicate whether the filter should be performed on:
alternative terms that are added to the Synonyms property in the concept items;
the display name property of the concept (language-sensitive);
the description property of the concept.
The final query in our illustration looks like this.
This can be read as: "Include all child concepts of Countries that have a Display Name that starts with U."
While the text literal that we saw in the previous section is set to a fixed text, we can also use Text Data Field to match with a text value from the User Session in Runtime. This last node allows you to select a Text Data Field from your Data Model to use, while you can also drag a Text Data Field from the Data Model tree directly onto the Concept Query Canvas and that will create the Text Data Field Node.
Now you've seen the basics for Concept Queries. In the next part we'll dive into the Concept Relations, that give even more possibilities to create complex Concept Queries, using pre-defined relations and even with your own Custom Relations between Concepts.
Toolbar button | Description |
---|---|
4. Single select data field
5. Multi select data field
6. Text literal
7. Text data field
Include
When a single/multi-select/concept element (refer to Concept Query nodes below) is Include
d, it indicates that the corresponding concepts will be included in the filtered results.
Exclude
When a single/multi-select/concept element (refer to Concept Query nodes below) is Exclude
d, it indicates that the corresponding concepts will be excluded from the filtered results.
Ignore
Use this button to clear selected concept-element from being either Included or Excluded from the result.
100%
This will reset the view of the flowchart to 100% and centered.
Zoom in
Zoom in on the flowchart (see less nodes but bigger).
Zoom out
Zoom out of the flowchart (see more nodes but smaller).
Invalid
You will see this error message when the concept query is incomplete or incorrect. When the query is complete and correct, this will be blank.