SemQL is a language to express declarative rules in Semarchy xDM in the form of SQL-Like clauses.
It is used to define:
Enrichers, Matchers, Validations and Survivorship Rules involved in the Certification Process.
Conditions in workflow definitions.
Composite and transformed attributes in form and collections appearing in the applications.
Filters when browsing data in the Data Hub.
The charcateristics of the SemQL language are:
The syntax of the SemQL language is similar to that of the SQL language. Most SemQL functions map to database functions.
SemQL is converted on the fly and is executed by the data hub database.
SemQL uses Qualified Attribute Names instead of columns names. This makes the SemQL code independent from the underlying implementation.
The SemQL language allows users to define SQL-like clauses. Depending on the context, the clauses can be:
Conditions: Clauses that return a boolean result from the evaluation of expressions using operators. A condition can be used for filtering or validating data records. For example, if the clause is false, then the record is filtered out or considered invalid.
Expressions: Clauses that return a value. In the context of a SemQL Enricher, an expression transforms, standardizes and enriches source attributes.
Order By Clauses: Clauses used to sort records. In consolidation rules, such clauses are used to manage the consolidation conflicts. For example, consider a consolidation made by Most Frequent Value. When multiple values occur with equal frequency, the SemQL in the Ranking Expression determines that value that is used.
SemQL is only used for expressions, conditions and order by clauses. The language neither supports the
INSERT queries nor joins, sub-queries, aggregates, in-line views, and set operators.
|Even though SemQL looks like SQL, SemQL expressions are entirely parsed and rewritten by the Semarchy xDM platform as SQL before their execution by the hub database. A simple SemQL expression may result into a complex SQL statement. Hence, it is not recommended to inject SQL statements within SemQL expressions.
SemQL clauses manipulate attributes, variables and parameters defined in objects of the Semarchy xDM model.
firstNameattribute of the
productFamilyNameparameter of the
Attributes are accessed through an unambiguous Qualified Attribute Name. The qualified attribute name is the path to an attribute from the entity being processed.
This path allows you to navigate the references that link the entities of a model. For example,
manager.lastName returns the last name of the manager of an employee record.
You can use built-in functions in SemQL. Most of these functions map directly to functions of the hub’s database. Other functions (for example, matching functions) are specific to Semarchy xDM.
In SemQL, you can also use customized functions implemented in the database.
The SemQL editor is used in Application Builder and in Workflow Builder.
In Application Builder, the SemQL editor is used to write SemQL conditions, expressions, and clauses.
The editor lists the attributes, variables, parameters as well as all built-in and customized SemQL funxqctions with their syntax.
The editor is organized as follows:
Attributes available for the expression appear in left panel. Double-click an attribute to add it to the expression.
Functions declared in SemQL appear in the left bottom panel, grouped in function groups. Double-click a function to add it to the expression.
Variables available for the expression appear in the bottom center panel.
Messages appear in the right bottom panel, showing parsing errors and warnings.
Description for the selected function or attribute appear at the bottom of the editor.
The Toolbar allows to indent the code or hide/display the various panels of the editor and to undo/redo code edits.
In Workflow Builder, the SemQL editor is used to write SemQL conditions and expressions.
The editor lists the attributes, variables as well as all built-in and customized SemQL functions with their syntax.
The editor is organized as follows:
Attributes, functions, and variables available for the current statement appear in the left panel. Double-click an element to add it to the condition or the expression.
To switch between attributes, functions, and variables, select the corresponding element in the action menu above the tree view. You can enter text in the input field to search among elements of the selected type.
Problems appear in the right bottom panel, showing parsing errors and warnings.