]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/mathql/doc/mathql_introduction_avsets.tex
ocaml 3.09 transition
[helm.git] / helm / mathql / doc / mathql_introduction_avsets.tex
index d9943f1cf95fecb16ea8b8a9aff10c62a0cb014b..20e826403421c1b501b9509c327edc7dd155e540 100644 (file)
@@ -1,4 +1,4 @@
-\subsection {Sets of attributed values.}
+\subsection {Sets of attributed values.} \label{AVSets}
 
 The data representation model used by {\MathQL} relies on the notion of 
 \emph{set of attributed values} ({\av} set for short) that is, in practice,
 
 The data representation model used by {\MathQL} relies on the notion of 
 \emph{set of attributed values} ({\av} set for short) that is, in practice,
@@ -10,7 +10,7 @@ should be driven from the {\RDFS} class system. This may be a future
 improvement.}
 Each {\av} in an {\av} set consists of a string% 
 \footnote{When we say \emph{string}, we mean a finite sequence of characters.}
 improvement.}
 Each {\av} in an {\av} set consists of a string% 
 \footnote{When we say \emph{string}, we mean a finite sequence of characters.}
-(that we call the \emph{head string} or \emph{value}) and a (possibly emty)
+(that we call the \emph{head string} or \emph{value}) and a (possibly empty)
 multiset of named attributes whose content is a set of strings.
 Attribute names are made of a (possibly empty) list of string components, so
 they can be hierarchically structured. 
 multiset of named attributes whose content is a set of strings.
 Attribute names are made of a (possibly empty) list of string components, so
 they can be hierarchically structured. 
@@ -18,7 +18,7 @@ Moreover the attributes of a value are partitioned into a set of \emph{groups}
 ({\ie} subsets) to improve its structure.
 
 In the above description a \emph{set} is an \emph{unordered} finite
 ({\ie} subsets) to improve its structure.
 
 In the above description a \emph{set} is an \emph{unordered} finite
-sequence \emph{without} repetitions wheras a \emph{multiset} is an
+sequence \emph{without} repetitions whereas a \emph{multiset} is an
 \emph{unordered} finite sequence \emph{with} repetitions.
 
 In the present context repetitions are defined as follows:
 \emph{unordered} finite sequence \emph{with} repetitions.
 
 In the present context repetitions are defined as follows:
@@ -33,7 +33,7 @@ definition of an {\av} set is just the right one among the many alternatives
 that were tried.} 
 
 As we said, {\MathQL}.4 uses {\av} sets to represent many kinds of
 that were tried.} 
 
 As we said, {\MathQL}.4 uses {\av} sets to represent many kinds of
-information, namely:
+information:
 
 \begin{enumerate}
 
 
 \begin{enumerate}
 
@@ -50,26 +50,25 @@ objects of repeated predicates.
 Moreover structured attribute names can encode various components of
 structured properties preserving their semantics.
 
 Moreover structured attribute names can encode various components of
 structured properties preserving their semantics.
 
-\begin{figure}[ht]
+\begin{figure}
 \begin{footnotesize} \begin{verbatim}
 The RDF triples:
 \begin{footnotesize} \begin{verbatim}
 The RDF triples:
-("http://www.w3.org/2002/01/rdf-databases/protocol", "dc:creator", "Sandro Hawke")
-("http://www.w3.org/2002/01/rdf-databases/protocol", "dc:creator", "Eric Prud'hommeaux")
-("http://www.w3.org/2002/01/rdf-databases/protocol", "dc:date", "2002-01-08")
+ ("protocol", "dc:creator", "Sandro Hawke")
+ ("protocol", "dc:creator", "Eric Prud'hommeaux")
+ ("protocol", "dc:date", "2002-01-08")
 
 The corresponding attributed value:
 
 The corresponding attributed value:
-"http://www.w3.org/2002/01/rdf-databases/protocol" attr
-             {"dc:creator" = {"Sandro Hawke", "Eric Prud'hommeaux"}; "dc:date" = "2002-01-08"}
+ "protocol" attr {/"dc:creator" = {"Sandro Hawke", "Eric Prud'hommeaux"};
+                  /"dc:date" = "2002-01-08"}
 \end{verbatim} \end{footnotesize}
 \end{verbatim} \end{footnotesize}
-\vskip-1pc
+\vspace{-1pc}
 \caption{The representation of a pool of {\RDF} triples} \label{AVOne}
 \end{figure}
 
 \figref{AVOne} shows how a set of triples can be coded in an {\av}.
 \caption{The representation of a pool of {\RDF} triples} \label{AVOne}
 \end{figure}
 
 \figref{AVOne} shows how a set of triples can be coded in an {\av}.
-Note that the word \emph{attr} separates the head string from its attributes,
+Note that the word \TT{attr} separates the head string from its attributes,
 braces enclose an attribute group in which attributes are separated by
 braces enclose an attribute group in which attributes are separated by
-semicolons, and an equal sign separates an attribute name from its contents
-(see \subsecref{Textual} for the complete {\av} syntax).
+semicolons, and an equal sign separates an attribute name from its contents.
 
 In this setting the grouping feature can be used to separate semantically
 different classes of properties associated to a resource (as for instance
 
 In this setting the grouping feature can be used to separate semantically
 different classes of properties associated to a resource (as for instance
@@ -77,7 +76,7 @@ Dublin Core metadata, Euler metadata and user-defined metadata).
 
 \item
 A pool of arbitrarily chosen {\RDF} triples is encoded in an {\av} set 
 
 \item
 A pool of arbitrarily chosen {\RDF} triples is encoded in an {\av} set 
-placing different {\av}'s the subset of triples sharing the same subject.
+placing in each {\av} the subset of triples sharing the same head string.
 
 Note that the use of {\av} sets to build query results allows {\MathQL} queries
 to return sets of {\RDF} triples instead of mere sets of resources, in the
 
 Note that the use of {\av} sets to build query results allows {\MathQL} queries
 to return sets of {\RDF} triples instead of mere sets of resources, in the
@@ -90,22 +89,19 @@ which holds the head strings).
 \figref{Table} shows an {\av} set describing the properties of two resources
 ``A'' and ``B'' giving its table representation, in which the columns
 corresponding to attributes in the same group are clustered between
 \figref{Table} shows an {\av} set describing the properties of two resources
 ``A'' and ``B'' giving its table representation, in which the columns
 corresponding to attributes in the same group are clustered between
-double-line delimiters%
+double-line delimiters.%
 \footnote{A table with grouped labelled columns like the one above resembles a
 \footnote{A table with grouped labelled columns like the one above resembles a
-set of relational database tables.}.   
+set of relational database tables.}   
 
 
-%Another possible use of a {\MathQL} query result is for the encoding of a
-%relational database table: in this sense the indexed column is stored in the
-%subject strings, the names of the other columns are stored in attribute names
-%and cell contents are stored in attribute values.
-
-\begin{figure}[ht]
+\begin{figure}
 \begin{footnotesize} \begin{verbatim}
 \begin{footnotesize} \begin{verbatim}
-"A" attr {"major" = "1"; "minor" = "2"}, {"first" = "2002-01-01"; "modified" = "2002-03-01"};
-"B" attr {"major" = "1"; "minor" = "7"}, {"first" = "2002-02-01"; "modified" = "2002-04-01"}
+"A" attr {/"major" = "1"; /"minor" = "2"}, 
+         {/"first" = "2002-01-01"; /"modified" = "2002-03-01"};
+"B" attr {/"major" = "1"; /"minor" = "7"}, 
+         {/"first" = "2002-02-01"; /"modified" = "2002-04-01"}
 \end{verbatim}
 \begin{center} \begin{tabular}{|c||c|c||c|c||}
 \end{verbatim}
 \begin{center} \begin{tabular}{|c||c|c||c|c||}
-\hline   & {\bf ``major''} & {\bf ``minor''} & {\bf ``first''} & {\bf ``modified''} \\
+\hline   & \textbf{``major''} & \textbf{``minor''} & \textbf{``first''} & \textbf{``modified''} \\
 \hline ``A'' & ``1'' & ``2'' & ``2002-01-01'' & ``2002-03-01'' \\
 \hline ``B'' & ``1'' & ``7'' & ``2002-02-01'' & ``2002-04-01'' \\
 \hline
 \hline ``A'' & ``1'' & ``2'' & ``2002-01-01'' & ``2002-03-01'' \\
 \hline ``B'' & ``1'' & ``7'' & ``2002-02-01'' & ``2002-04-01'' \\
 \hline
@@ -118,15 +114,14 @@ a query result) which fits in 4 dimensions: namely we can extend independently
 the set of the head strings (dimension 1), the attributes in each group
 (dimension 2), the groups in each {\av} (dimension 3) and the contents of each
 attribute (dimension 4).
 the set of the head strings (dimension 1), the attributes in each group
 (dimension 2), the groups in each {\av} (dimension 3) and the contents of each
 attribute (dimension 4).
-
 The metadata defined in the table of \figref{Table} will be used in subsequent
 examples.
 The metadata defined in the table of \figref{Table} will be used in subsequent
 examples.
-For this purpose assume that \TT{first} and \TT{modified} are the components
-of a structured property \TT{date} available for the resources ``A'' and ``B''.
+For this purpose assume that ``first'' and ``modified'' are the components
+of a structured property ``date'' available for the resources ``A'' and ``B''.
 
 \item
 
 \item
-The value of an {\RDF} property is encoded in a single {\av} distinguishing
-three situations:
+The value of an {\RDF} property is encoded in an {\av} distinguishing three
+cases:
 
 \begin{itemize}
 
 
 \begin{itemize}
 
@@ -142,49 +137,49 @@ the content of this component is placed in the {\av} head string and the
 other components are stored in the {\av} attributes as in the case 1.
 
 \item
 other components are stored in the {\av} attributes as in the case 1.
 
 \item
-If the property is structured and its value does not have a main component,
-the {\av} head string is empty and the components are stored in the
-attributes.
+For the value of a structured property without a main component, the head
+string is empty and the components are stored in the attributes.
 
 \end{itemize}
 
 
 \end{itemize}
 
-\begin{figure}[ht]
+\begin{figure}
 \begin{footnotesize} \begin{verbatim}
 First example, one instance:
 \begin{footnotesize} \begin{verbatim}
 First example, one instance:
-"" attr {"major" = "1"; "minor" = "2"};  no main component
-"1" attr {"minor" = "2"};                main component is "major"
-"2" attr {"major" = "1"}                 main component is "minor"
+ "" attr {/"major" = "1"; /"minor" = "2"} no main component
+ "1" attr {/"minor" = "2"} main component is "major"
+ "2" attr {/"major" = "1"} main component is "minor"
 
 Second example: two separate instances:
 
 Second example: two separate instances:
-"" attr {"major" = "1"; "minor" = "2"}, {"major" = "1"; "minor" = "7"}; no main component
-"1" attr {"minor" = "2"}, {"minor" = "7"}                            main component is "major"
+ "" attr {/"major" = "1"; /"minor" = "2"}, 
+         {/"major" = "1"; /"minor" = "7"} no main component
+ "1" attr {/"minor" = "2"}, {/"minor" = "7"} main component is "major"
 
 Third example: two mixed instances:
 
 Third example: two mixed instances:
-"" attr {"major" = "3", "6"; "minor" = "4", "9"} no main component
+ "" attr {/"major" = "3", "6"; /"minor" = {"4", "9"}} no main component
 \end{verbatim} \end{footnotesize}
 \end{verbatim} \end{footnotesize}
-\vskip-1pc
+\vspace{-1pc}
 \caption{The representation of the structured value of a property}
 \label{AVTwo}
 \end{figure}
 
 \figref{AVTwo} (first example) shows three possible ways of representing in
 \caption{The representation of the structured value of a property}
 \label{AVTwo}
 \end{figure}
 
 \figref{AVTwo} (first example) shows three possible ways of representing in
-{\av}'s an instance of a structured property \TT{id} whose value has two
-fields ({\ie} properties) \TT{major} and \TT{minor}.
-In this instance, \TT{major} is set to ``1'' and \TT{minor} is set to ``2''.
-The representations depend on which component of \TT{id} is chosen as the
-main component (none, \TT{major} or \TT{minor} respectively).
+{\av}'s an instance of a structured property ``id'' whose value has two
+fields ({\ie} properties) ``major'' and ``minor''.
+In this instance, ``major'' is set to ``1'' and ``minor'' is set to ``2''.
+The representations depend on which component of ``id'' is chosen as the
+main component (none, ``major'' or ``minor'' respectively).
 Several structured property values sharing a common main component can be
 encodes in a single {\av} exploiting the grouping facility: in this case the
 attributes of every instance are enclosed in separate groups.
 \figref{AVTwo} (second example) shows the representations of two instances of
 Several structured property values sharing a common main component can be
 encodes in a single {\av} exploiting the grouping facility: in this case the
 attributes of every instance are enclosed in separate groups.
 \figref{AVTwo} (second example) shows the representations of two instances of
-\TT{id}: the previous one and a new one for which \TT{major} is ``1'' and
-\TT{minor} is ``7''.
+``id'': the former and a new one for which ``major'' is ``1'' and ``minor'' is
+``7''.
 
 Note that if the attributes of the two groups are encoded in a single group,
 the notion of which components belong to the same property value can not be
 recovered in the general case because the values of an attribute form a set
 
 Note that if the attributes of the two groups are encoded in a single group,
 the notion of which components belong to the same property value can not be
 recovered in the general case because the values of an attribute form a set
-and thus are unordered. \newline
-As an example think of two instances of \TT{id} encoded as in \figref{AVTwo}
+and thus are unordered.
+As an example think of two instances of ``id'' encoded as in \figref{AVTwo}
 (third example).
 
 \item
 (third example).
 
 \item
@@ -199,7 +194,7 @@ head string and no attributes.
 
 \end{enumerate}
 
 
 \end{enumerate}
 
-{\MathQL} defines five binary operations on {\av} sets: two unions, two
+{\MathQL} defines five core binary operations on {\av} sets: two unions, two
 intersections and a difference. The first four are defined in terms of an
 operation, that we call \emph{addition}, involving two {\av}'s with the same
 head string.
 intersections and a difference. The first four are defined in terms of an
 operation, that we call \emph{addition}, involving two {\av}'s with the same
 head string.
@@ -209,47 +204,47 @@ two ways to compose the attribute groups:
 \begin{itemize}
 
 \item
 \begin{itemize}
 
 \item
-With the \emph{set-theoretic} addition, the set of attribute groups in the
+with the \emph{set-theoretic} addition, the set of attribute groups in the
 resulting {\av} is the set-theoretic union of the sets of attribute groups in
 resulting {\av} is the set-theoretic union of the sets of attribute groups in
-the operands.
+the operands;
 
 \item
 
 \item
-With the \emph{distributive} addition, the set of attribute groups in the
+with the \emph{distributive} addition, the set of attribute groups in the
 resulting {\av} is the ``Cartesian product'' of the sets of attribute groups
 in the two operands. 
 resulting {\av} is the ``Cartesian product'' of the sets of attribute groups
 in the two operands. 
-In this context, an element of the ``Cartesian product'' is not a pair of
-groups but it is the set-theoretic union of these groups where the contents of
-homonymous attributes are clustered together using set-theoretic unions.
+Here an element of the ``Cartesian product'' is not a pair of groups but it is
+the set-theoretic union of these groups where the contents of homonymous
+attributes are clustered together using set-theoretic unions.
 
 \end{itemize}
 
 \figref{Addition} shows an example of the two kinds of addition.
 
 
 \end{itemize}
 
 \figref{Addition} shows an example of the two kinds of addition.
 
-\begin{figure}[ht]
+\begin{figure}
 \begin{footnotesize} \begin{verbatim}
 Attributed values used as operands for the addition:
 \begin{footnotesize} \begin{verbatim}
 Attributed values used as operands for the addition:
-"1" attr {"A" = "a"}, {"B" = "b1"}
-"1" attr {"A" = "a"}, {"B" = "b2"}
+ "1" attr {/"A" = "a"}, {/"B" = "b1"}
+ "1" attr {/"A" = "a"}, {/"B" = "b2"}
 
 Set-theoretic addition:
 
 Set-theoretic addition:
-"1" attr {"A" = "a"}, {"B" = "b1"}, {"B" = "b2"}
+" 1" attr {/"A" = "a"}, {/"B" = "b1"}, {/"B" = "b2"}
 
 Distributive addition:
 
 Distributive addition:
-"1" attr {"A" = "a"}, {"A" = "a"; "B" = "b2"}, {"B" = "b1"; "A" = "a"}, {"B" = {"b1", "b2"}}
+ "1" attr {/"A" = "a"}, {/"A" = "a"; /"B" = "b2"}, 
+          {/"B" = "b1"; /"A" = "a"}, {/"B" = {"b1", "b2"}}
 \end{verbatim} \end{footnotesize}
 \end{verbatim} \end{footnotesize}
-\vskip-1pc
+\vspace{-1pc}
 \caption{The addition of attributed values}
 \label{Addition}
 \end{figure}
 
 \caption{The addition of attributed values}
 \label{Addition}
 \end{figure}
 
-Now we can discuss the five operations between {\av} sets that we mentioned
-above:
+Now we can discuss the five operations between {\av} sets:
 
 \begin{itemize}
 
 \item
 
 \begin{itemize}
 
 \item
-The two unions ocorresponds to the set-theoretic union of their operand where
-the {\av}'s sharing the head string are are added either set-theoretically or
+The two unions corresponds to the set-theoretic union of their operand where
+the {\av}'s sharing the head string are added either set-theoretically or
 distributively as explained above (thus we have a set-theoretic union and a
 distributive union in the two cases). In this context the empty {\av} set
 plays the role of the neutral element. 
 distributively as explained above (thus we have a set-theoretic union and a
 distributive union in the two cases). In this context the empty {\av} set
 plays the role of the neutral element. 
@@ -258,8 +253,8 @@ compose the attributes of the operands preserving their group structure.
 
 \item
 The two intersections are the dual of the above unions: they contain the
 
 \item
 The two intersections are the dual of the above unions: they contain the
-{\av}'s whose head string appears in each argument where {\av}'s sharing the
-head string are added either set-theoretically or distributively as before.
+{\av}'s whose head string appears in each argument where the {\av}'s sharing
+the head string are added either set-theoretically or distributively as before.
 
 The distributive intersection has the double benefit of filtering the
 common values of the given {\av} sets, and of merging their attribute groups
 
 The distributive intersection has the double benefit of filtering the
 common values of the given {\av} sets, and of merging their attribute groups
@@ -274,28 +269,28 @@ argument whose head string does not appear in the second argument.
 
 \figref{Binary} shows how the above operations work in a simple example.
 
 
 \figref{Binary} shows how the above operations work in a simple example.
 
-\begin{figure}[ht]
+\begin{figure}
 \begin{footnotesize} \begin{verbatim}
 Sets of attributed values used as operands for the operations:
 \begin{footnotesize} \begin{verbatim}
 Sets of attributed values used as operands for the operations:
-"1" attr {"A" = "a"}; "2" attr {"B" = "b1"} 
-"2" attr {"B" = "b2"}
+ "1" attr {/"A" = "a"}; "2" attr {/"B" = "b1"} 
+ "2" attr {/"B" = "b2"}
 
 Set-theoretic union:
 
 Set-theoretic union:
-"1" attr {"A" = "a"}; "2" attr {"B" = "b1"}, {"B" = "b2"}
+ "1" attr {/"A" = "a"}; "2" attr {/"B" = "b1"}, {/"B" = "b2"}
 
 Distributive union:
 
 Distributive union:
-"1" attr {"A" = "a"}; "2" attr {"B" = {"b1", "b2"}}
+ "1" attr {/"A" = "a"}; "2" attr {/"B" = {"b1", "b2"}}
 
 Set-theoretic intersection:
 
 Set-theoretic intersection:
-"2" attr {"B" = "b1"}, {"B" = "b2"}
+ "2" attr {/"B" = "b1"}, {/"B" = "b2"}
 
 Distributive intersection:
 
 Distributive intersection:
-"2" attr {"B" = {"b1", "b2"}}
+ "2" attr {/"B" = {"b1", "b2"}}
 
 Difference:
 
 Difference:
-"1" attr {"A" = "a"}
+ "1" attr {/"A" = "a"}
 \end{verbatim} \end{footnotesize}
 \end{verbatim} \end{footnotesize}
-\vskip-1pc
+\vspace{-1pc}
 \caption{The binary operations on sets of attributed values}
 \label{Binary}
 \end{figure}
 \caption{The binary operations on sets of attributed values}
 \label{Binary}
 \end{figure}