|
1 | 1 | .. _QueryHandling:
|
2 | 2 |
|
3 |
| -VSS query recognition and mapping |
| 3 | +VSS query parsing and mapping |
4 | 4 | =====================================
|
5 | 5 |
|
6 |
| -Obviously, each node has it's own database structure. |
7 |
| -In order to fetch data requested by the NodeSoftware client, |
8 |
| -incoming query needs to be mapped into one or multiple queries to the node database. |
| 6 | +Vamdc nodes are queried using a common SQL-like keyword-based query language. |
| 7 | +A typical query looks like:: |
| 8 | + |
| 9 | + SELECT * WHERE (keyword1=value or keyword2=value2) and keyword3='value3' |
| 10 | + |
| 11 | +where the keywords correspond to the different parts of the XSAMS document |
| 12 | +and are defined in the VAMDC Dictionary [VAMDCDict]_ as Restrictable keywords. |
| 13 | +Since every VAMDC node has a specific database structure, |
| 14 | +the incoming query keywords need to be mapped to |
| 15 | +the database fields in order to fetch the data corresponding to the query. |
9 | 16 | Java Node software tries to make the process of query mapping as simple and sophisticated as possible.
|
10 | 17 |
|
11 | 18 |
|
12 | 19 | Query keywords tree
|
13 | 20 | -----------------------
|
14 | 21 |
|
15 |
| -First, as Java node software receives a query, it validates it and parses into a tree of objects. |
16 |
| -Intermediate nodes of that tree are representing boolean relations and leafs keep the information about |
17 |
| -the query keywords, comparison operator and values. |
18 |
| - |
19 |
| -For example, query:: |
| 22 | +As a first step, on query reception the Java Node Software parses the query into a tree of objects |
| 23 | +using the **vamdctap-queryparser** library. |
| 24 | +Leaf nodes of that tree of objects represent the individual keyword expressions. |
| 25 | +The root node and the branches are reflecting the boolean relations between the leaves. |
| 26 | +For instance, a query:: |
20 | 27 |
|
21 | 28 | SELECT * WHERE reactant1.AtomSymbol = 'C' AND reactant2.AtomSymbol = 'O'
|
22 | 29 | AND (CollisionCode='inel' or CollisionCode='elas')
|
23 | 30 |
|
24 |
| -would map into a tree |
| 31 | +would map into the tree |
25 | 32 |
|
26 | 33 | .. image:: img/queryTree.png
|
27 | 34 |
|
28 | 35 |
|
29 |
| - |
30 | 36 | Tree objects
|
31 | 37 | ---------------------
|
32 | 38 |
|
|
0 commit comments