Early Access: The content on this website is provided for informational purposes only in connection with pre-General Availability Qlik Products. All content is subject to change and is provided without warranty.
The semantic load prefix creates a special type of field that can be used in Qlik Sense to connect and manage relational data, such as tree structures, self-referencing parent-child structured data and/or data that can be described as a graph.
Note that the semantic load can function similarly to the Hierarchy and HierarchyBelongsTo prefixes. All three prefixes can be used as building blocks in effective front-end solutions for traversing relational data.
Syntax:
Semantic( loadstatement
| selectstatement)
A semantic load expects an input that is exactly three or four fields wide with a strict definition of what each ordered field represents, as shown in the table below:
Semantic load fields
Field name
Field description
1st Field:
This tag is a representation of the first of two objects between which there is a relationship.
2nd Field:
This tag will be used to describe the “forward” relationship between the first and second object. If the first object is a child and the second object is a parent, you can create a relationship tab that states “parent” or “parent of” as if you are following the relationship from child to parent.
3rd Field:
This tag is a representation of the second of two objects between which there is a relationship.
4th Field:
This field is optional. This tag describes the “backward” or “inverse” relationship between the first and second object. If the first object is a child and the second object is a parent, a relationship tab could state “child” or “child of” as if you are following the relationship from parent to child. If you do not add a fourth field, then the second field tag will be used to describe the relationship in either direction. In that case, an arrow symbol is automatically added as part of the tag.
The following code is an example of the semantic prefix.
Semantic
Load
Object,
‘Parent’ AS Relationship,
NeighbouringObject AS Object,
‘Child’ AS Relationship
from graphdata.csv;
Information noteIt is allowed and typical practice to label the third field the same as the first field. This creates a self-referencing lookup, so that you can follow object(s) to the related object(s) one relationship step away at a time. If the 3rd field does not carry the same name, then the end result will be a simple lookup from an object(s) to its direct relational neighbor(s) one step away only, which is an output of little practical use.
Regional settings
Unless otherwise specified, the examples in this topic use the following date format: MM/DD/YYYY. The date format is specified in the SET DateFormat statement in your data load script. The default date formatting may be different in your system, due to your regional settings and other factors. You can change the formats in the examples below to suit your requirements. Or you can change the formats in your load script to match these examples. For more information, see Modifying regional settings for apps and scripts.
Default regional settings in apps are based on the user profile. These regional format settings are not related to the language displayed in the Qlik Cloud user interface. Qlik Cloud will be displayed in the same language as the browser you are using.
The HierarchyBelongsTo load prefix is used to locate and organize the ancestors of parent-child and other graph-like data structures and transform them into tables.
Example - Creating a special field for connecting relationships using the semantic prefix
Overview
Open the Data load editor and add the load script below to a new tab.
The load script contains:
A dataset representing geography relation records which is loaded into a table named GeographyTree.
Each entry has an ID at the beginning of the line and a ParentID at the end of the line.
The semantic prefix which will add one special behavior field labeled, Relation.
Load script
GeographyTree:
LOAD
ID,
Geography,
if(ParentID='',null(),ParentID) AS ParentID
INLINE [
ID,Geography,ParentID
1,World
2,Europe,1
3,Asia,1
4,North America,1
5,South America,1
6,UK,2
7,Germany,2
8,Sweden,2
9,South Korea,3
10,North Korea,3
11,China,3
12,London,6
13,Birmingham,6
];
SemanticTable:
Semantic Load
ID as ID,
'Parent' as Relation,
ParentID as ID,
'Child' as Relation
resident GeographyTree;
Results
Load the data and open a sheet. Create a new table and add these fields as dimensions.
Id
Geography
Then, create a filter pane with Relation as a dimension. Click Done editing.
Results table
Id
Geography
1
World
2
Europe
3
Asia
4
North America
5
South America
6
UK
7
Germany
8
Sweden
9
South Korea
10
North Korea
11
China
12
London
13
Birmingham
Filter pane
Relation
Child
Parent
Click Europe from the Geography dimension in the table and click Child from the Relation dimension in the filter pane. Note the expected result in the table:
Results table showing "children" of Europe
Id
Geography
6
UK
7
Germany
8
Sweden
Clicking Child again will show places that are "children" of the UK, one step further down.
Results table showing "children" of UK
Id
Geography
12
London
13
Birmingham
Field
A field contains values, loaded from a data source. At a basic level, a field corresponds to a column in a table. Fields are used to create dimensions and measures in visualizations.
The term dataset is sometimes synonymous with table. It can refer to the original source table, the table after undergoing transformations, or the fact and dimension tables in a data mart.
It can also refer to a logical table, where there are several instance tables and views:
Current data
History, which holds previous versions of the table
Sheets are components of Qlik Sense apps. They present visualizations to app users so they can explore, analyze, and discover data. Sheets can be public or private.
A dimension is an entity used to categorize data in a chart. For example, the slices in a pie chart or the bars of a bar chart represent individual values in a dimension. Dimensions are often a single field with discrete values, but can also be calculated in an expression.
A dimension is a dataset in a data mart that forms part of the star schema. Dimension datasets hold the descriptive information for all related fields that are included in the fact table’s records. A few common examples of dimension datasets are Customer and Product. Since the data in a dimension dataset is often denormalized, dimension datasets have a large number of columns.
A dimension is an entity used to categorize data in a chart. For example, the slices in a pie chart or the bars of a bar chart represent individual values in a dimension. Dimensions are often a single field with discrete values, but can also be calculated in an expression.
A dimension is a dataset in a data mart that forms part of the star schema. Dimension datasets hold the descriptive information for all related fields that are included in the fact table’s records. A few common examples of dimension datasets are Customer and Product. Since the data in a dimension dataset is often denormalized, dimension datasets have a large number of columns.