QlikView Backus Naur Form – Example of BNF in QlikView

FREE Online Courses: Click for Success, Learn for Free - Start Now!

In our last tutorial, we discussed QlikView Publisher Repository. Now, we will learn Backus Naur Form, in which we studied example of QlikView BNF. Along with this, we will learn what is QlikView Backus Naur Formalism.

An important part of QlikView functioning is the QlikView scripting as nearly all the operations being performed on the data or on the application are done through script commands. You must have seen and dealt with commands and scripting before while working with any computer language.

Now a thing to wonder is how these computer languages are formulated. It is done by setting standardized forms like Backus Naur form (BNF).

So, let’s start QlikView Backus Naur Form Tutorial.

What is Backus Naur Form (BNF)?

Backus Naur Form is a metalanguage. Metalanguages are the languages which are used to explain other natural or computer languages. Any metalanguage follows a specific notation technique or metasyntax through which rules of a language are defined and explained.

In the world of computing, there are several widely used metalanguages are Backus Naur Form (BNF), Extended Backus Naur Form (EBNF), Augmented Backus Naur Form (ABNF).

Formulating a language for computers in a well-defined and formatted structure is very important for the language to properly convert into a machine language during execution.

Do you know What is QlikView Web Server (QVWS)?

The Backus Naur Form is designed in a specific way with a set of derivation rules expressed as,

<symbol> ::= __expression__

Every BNF statement follows this rule, where the symbol is a value defined using ‘::=’ sign and the __expression__ are the possible and valid variables that can take up for the defined value. Let us understand this by dividing the above statement into a right half and a left half. The right half has a Non-terminal value and the left half has Terminal values.

  • Non-Terminals- The Non-terminals are syntactic or lexical entities that use to define a symbol to be used in a language abiding the formal grammar rules. These are always enclosed in <>.
  • Terminals- The Terminals are symbols/values that are the probable outcomes of the defined (non-terminal entity/symbol) as per the rule. These values are not susceptible to change by the rule.

In an expression, let’s suppose that we are defining an entity <digit> then on the right side of the expression will be all the terminal values i.e. the possible values that can be taken up by the system as Digits like 0,1,2,3.. etc.

QlikView Backus Naur Form - Example of BNF

QlikView Backus Naur Form

The values or symbol sequences defined on the right are separated by “|”, in case of more than one values. A Non-Terminal can also be defined in or replaced by one or more Non-Terminals on the right side. For instance, if after defining <digits> we want to define <integer> we can do it by creating a rule so that integer is replaced by one or more digits.

<integer> ::= <digit> | <digit><digit>

Here, both <integer> and <digit> are Non-Terminals and will give an output like,

<integer> ::= 5

<integer> ::= 86

Follow this link to know about QlikView SNMP

QlikView Backus Naur Form Examples

Let us gain a better understanding of Backus Naur Form through some examples of statements used commonly. Like the BNF is given for a postal address can see below.

<postal-address> ::= <name-part> <street-address> <zip-part>

<name-part> ::= <persona1-part> (last-name> <opt-suffix-part> <EOL>

| <personal-part> <name-part>

<personal-part> ::= <initial> “.” | <first-name>

<street-address> ::= <house-num> <5treet-name> <opt-apt-num> <EOL>

<zip-part> ::= <town-name> “,” <5tate-code> <ZIP-code> <EOL>

<opt-suffix-part> ::= “Sr.” | “Jr.” | <roman-numeral> | “”

<opt-apt-num> ::= <apt-num> | “”

Here, if we translate the given BNF line by line into English, then it will be something like this. The first line states that the postal address (non-terminal) will consist of parts like name, street, zip-part. Then the name part can be a personal-part followed by last-name followed further by an optional suffix like Mr. Mrs. etc., (the EOL defines the ending of a line) or it can be just personal part and name part.

Defining further, the personal part may consist of an initial followed by a dot or just be the first name. The same logic follows for the other lines for street address, zip part. The opt-suffix-part defines all the possible values that can be taken up as a suffix while writing the address. The opt-apt-num is the optional apartment number string.

The entire block of code is called the syntax and a complete statement is known as a rule. A rule in this example is <postal-address> statement, <name-part> statement and so on. On the right of these rule, statements are the expressions which count as two or more lists separated by a pipe |.

In the information provided in the image below, Backus Naur Form syntax express by BNF rules.

<Synta> ::= (rule) | <rule> <Syntax>

<rule> ::= <opt-whitespace> ”<” <ru1e-name> ”>” <opt-whitespace> “::=” <opt-whitespace> <expression> <1ine-end>

<opt-whitespace> ::= ” ” <opt-whitespace) | “”

<expression> ::= <list> | <list> <opt-whitespace> “|” <opt-whitespace> <expression>

<line-end> ::= <opt-whitespace> <EOL> | <line-end> <line-end>

<list> ::= <term> | <term> <opt-whitespace> <1ist>

<term> ::= <1iteral> | “<” <ru1e-name> “>”

<literal> ::= ‘”’ <text1> ‘”’ | “’” <text2> “’”

<text1> ::= “” | <character1> <text1>

<text2> ::= “” | <character2> <text2>

<character> ::= <letter> | <digit> | <symbol>

<letter> ::= “A” | “B” | “C” | “D” | “E” | “F” | “G” | ”H” | ”I” | “J” | “K” | “L” | ”M” | “N” | “O” | “P” | ”Q” | ”R” | “S” | ”T” | “U” | “V” | “W” | ”X“ | ”Y” | “Z”

<digit> ::= ”0” | ”1″ | “2” | ”3” | “4” | ”5” | ”6” | “7” | ”8” | “9”

<symbol> ::= ”|“ | ” ” | ”!“ | ”#” | “$” | ”%“ | ”&” | ”(“ | ”)” | “*” | “+” | “,” | “-“ | “.” | “/” | “:” | “;” | “>” | “=” | “<” | “?” | “@” | “[” | “\” | “]” | “^” | “_” | “`” | “{” | “}” | “~”

<character1> ::= <character> | “’”

<character2> ::= <character> | ‘”’

<ru1e-name> ::= <letter> | <rule-name> <rule-char>

<rule-char> ::= <letter> | <digit> | “-“

Have a look at – Different Types of Operators in QlikView

As you can see, every rule is defined in Backus Naur Form using proper symbols and syntax. Almost all the important things like character, letter, list, digit, symbol, rule etc., demonstrate through Backus Naur Form for the machine to convert and read the code in machine language efficiently.

QlikView Backus Naur Formalism

QlikView script syntax also follows the notation techniques of Backus Naur Form code. The commonly used command syntax symbols are given in the table below.

  • l Logical OR is comparison symbol which can be used on either side of the expression values.

  • () Parentheses defining precedence: It is used for structuring the BNF syntax.

  • [ ] Square brackets: It is used for making items optional by keeping them in square brackets.

  • { } Braces: The items enclosed in braces may be repeated zero or more times.

  • Symbol: It is a non-terminal syntactic symbol that can be divided further into other symbols. Other non-terminal symbols like, text strings, and so on.

  • ::= It marks the beginning of a block that defines a symbol.

  • LOAD: It is a terminal symbol which consists of a text string. It should be written as it is into the script.

Certain things to keep in mind with the Backus Naur Formalism in QlikView is that in a command statement, non-terminals are written in italic and terminals are written in bold. Let us understand this by defining an alias statement used in QlikView for giving a temporary name in a table. The statement can be described as,

aliasfieldnameasaliasname { , fieldname as aliasname}

Here, in the statement syntax, bold-faced symbols are terminals and italic values are non-terminal. The interpretation of this statement will be that alias followed by fieldname that is to be changed followed by as followed by aliasname that is the name which will be replacing the fieldname. The expression enclosed by {} brackets can be repeated zero or more time as required.

Also, Read QlikView November 2017 – Features of QlikView Version 12.2

The expressions following the above syntax will be-

alias a as Name;

alias a as Name, b as Address;

alias a as Name, b as Address, c as PhoneNumber;

Hence, the column names a, b and c will be changed temporarily to Name, Address, PhoneNumber by using an alias, respectively.

So, this was all about QlikView Backus Naur Form Tutorial. Hope you like our explanation.

Conclusion

Hence, we learned all the command line syntax’s logic comes from the QlikView Backus Naur Form coding system and so to understand QlikView scripting and syntax properly, you must have good knowledge of what is Backus Naur Form. Hope you find this explanation useful. In case of any queries or suggestions, comment in the comment box below.

Related Topic – QlikView Silent Installation

Reference

Did we exceed your expectations?
If Yes, share your valuable feedback on Google

follow dataflair on YouTube

Leave a Reply

Your email address will not be published. Required fields are marked *