Project

  - Introduction

  - Objectives

  - Documentation

  - User Guide

  - Use Case


  - About


  Download

  - Application

  - Applet

 

Documentation

1. Translation of Visual XQuery
The subset of XQuery adopted for the translation of Visual XQuery queries is defined in table 1. below by means of an EBNF grammar.

[1]  <query>

::= <for_clause> <where_clause>? <return_clause>

[2]  <for_clause>

::= ‘for’ <var_binding>+

[3]  <var_binding>

::= ‘$’<var_name> ‘in’ <path_expr>

[4]  <where_clause>

::= ‘where' <pred_term> ('and' <pred_term>)*

[5]  <pred_term>

::= <expression> <comparator> <expression>

[6]  <expression>

::= <const> | <variable> | <path_expr>

[7]  <comparator>

::= '=' | '<' | '>' | '<=' | '>=' | '!='

[8]  <return_clause>

::= 'return' (<variable> | <path_expr>)+

[9]  <path_expr>

::= XPath expression

[10] <variable>

::= any variable that has been already bound in an outer <var_binding>

[11] <const>

::= a text constant to be interpreted as a string or a numeric value

[12] <var_name>

::= a valid, automatically generated, unique name for a variable

Table 1. EBNF specification of XML Query normal form for Visual XQuery

In Visual XQuery, a query ([1]) consists of three clauses: for, where, return. A for clause must be present for any translation to take place. The for clause ([2]) contains a list of variable bindings ([3]) and variables are bound to a path expression ([9]). The where clause ([4]) is built by composing several propositional functions ([5]) consisting of comparisons of values or arithmetic expressions corresponding to a part of the graph. The return clause ([8]) consists of a list of path expression ([9]) and variables ([10]) and projects a list of elements extracted from the for clause.
The translation algorithm adopts a depth-first search tree pattern whose nodes are labeled by variable names and whose edges denotes the parent and child axes of XPath by means of an arrow direction.The algorithm is based upon the use of two functions: FindEdge() and FindNode() which works recursively together to visit the graph edges and nodes. For example, please see use case 1 and 2.

Visual XQuery also supports an additional feature called 'group node' which looks similar to an element node except that it is connected to an incoming edge that has no edge label. It is designed so that it do not affect Visual XQuery syntax and for the purpose of ease in visualization of the graph as the graph gets more complex with addition nodes and edges. An example is shown in use case 4.

 

2. Translation of XML
Importing XQuery file into Visual XQuery requires the XQuery file to comply with the supported XQuery syntax and query pattern specified in Table 4 below to be recognizable. XQuery codes are process line by line in sequential. Therefore, the binding and usage of variable must be in sequence spilt into fundamental expression using ‘,‘ and ‘\n’ delimiter and finally put through a pattern matching routine. The fundamental expressions are further tokenized using white space as the delimiter and then process by a pattern matching routine to create the relevant graph nodes and edges in the query.

Pattern Name

Pattern in java syntax

Example

For

\\Afor

for

Where

\\Awhere

where

Return

\\Areturn

Return

In

in

in

And

and

And

Variable

\\$\\D\\b

$a

Document

doc\\(\”\\S+\”\\)?\\S+

doc(“filename”)\path

Condition

\\W+

>=

Path

\\$\\D/\\S+

$a/book

Value1

\”\\w+\”

”Wiley”

Value2

\"\\w+

“Wiley

Value3

\\w+

Brothers

Value4

\\w+\"

Books”

Predefined Character sets
\D   This represents any character that is not a digit.
\w   This represents a word character.
\S   This represents any non-whitespace character.
\A   Specifies the beginning of the string being searched.
\b   Specifies a word boundary.

Table 4. XQuery Patterns

After the graph is created through pattern matching, the nodes and edges will need to be oriented for graphical display using a depth first recursive algorithm to traverse the graph and set the default width spacing between each node. Each node’s Y location will be fixed according to its level starting from the root node at level 1 and increases as the algorithm traverse downwards.  

For more details, please download the detail documentation.

 

Web site and all contents Copyright Visual XQuery 2007, All rights reserved.

Last Updated: 03 May 2007