]> matita.cs.unibo.it Git - helm.git/blob - helm/mathql/doc/mathql_introduction_core.tex
updating and structuring
[helm.git] / helm / mathql / doc / mathql_introduction_core.tex
1 \subsection{The core language} 
2
3 {\MathQL}.4 consists of a core language and of a basic library. Other
4 user-defined libraries can be added at will. The core language includes the
5 \TT{property} operator mentioned in \subsecref{HighAccess} that queries the
6 underlying {\RDF} database and the infrastructure to post-process the
7 query results. The components of this infrastructure are listed below:
8
9 \begin{itemize}
10
11 \item 
12 Explicit sets of attributed values.
13
14 An explicit {\av} set can be placed in a query in two forms: 
15 as a single quoted string, like \verb+"this is a query result"+, that
16 evaluates in a single {\av} with that value and no attributes, or as a full
17 {\av} set in the syntax shown in the previous sections but sorrounded by
18 square brackets, like \verb+["head" attr {"attribute-name" = "contents"}]+.
19 \newline
20 In the second form, the contents of an attribute can be the result of a query,
21 like
22 \verb+["head" attr {"attribute-name" = property /"metadata" of "resource"}]+.
23 \newline
24 In this case the contents of the attribute are the head strings of the query
25 result, whose attributes (if any) are discarded. 
26
27 \item 
28 Variable assignment.
29
30 Variables for {\av} sets (called \emph{set variables}) can be assigned using
31 a standard \emph{let-in} construction and may appear wherever an {\av} set
32 ({\ie} a query result) is allowed.  
33 \newline
34 The assignment has the form: 
35 \TT{let \$}\EM{variable} \TT{=} \EM{av-set} \TT{in} \EM{av-set}
36 so we can write:
37 \newline
38 \verb+let $var = "contents" in ["head" attr {"attribute-name" = $var}]+.
39
40 The scope rules of {\MathQL} variables are tipical for an imperative
41 programming language and any case of assignment propagation will be indicated.
42
43 \item 
44 Sequential composition.
45
46 This construction has the form: \EM{av-set} \TT{;;} \EM{av-set} and works as
47 follows: the two {\av} sets are evaluated one after the other and the first
48 one is discarded but the variables assigned in the first {\av} set are
49 available to the second one.  
50
51 \item 
52 Bounded iteration.
53
54
55 \end{itemize}
56
57 \xcomment {
58
59 Attributed values can be used to store any auxiliary information needed during
60 query execution.
61 In particular, {\MathQL} provides variables for {\av}'s which, in its textual
62 syntax, are identifiers%
63 \footnote{To be understood as in programming languages.}
64 preceded by the @ sign, as in \TT{@variable}, and that are introduced by the
65 \TT{for} and \TT{select} constructions to be explained below.
66
67 } % \xcomment