You can edit almost every page by Creating an account and confirming your email.

OttoQL

From EverybodyWiki Bios & Wiki



OttoQL is a universal QueryLanguage for tables and documents, which was implemented initially for XML. It has a very simple syntax (kind of writing). The operations are generally applied sequentially to all corresponding tuples or subtuples. In the following example, an XML document is presented as a table:

BMI Example in OttoQL

<<L(NAME, LENGTH, L(AGE, WEIGHT))::
     Klaus      1.68      18     61
                          30     65  
                          56     80
     Rolf       1.78      40     72
     Kathi      1.70      18     55 
                          40     70
     Valerie    1.00       3     16
     Viktoria   1.61      13     51
     Bert       1.72      18     66
                          30     70 >>
 with NAME: AGE>20                           # selection
 ext BMI:=(WEIGHT div LENGTH**2)            # introduction of a new column
 gib BMIAVG,M(AGE,BMIAVG,B(BMI,NAME)) &&    # give me; && connects two lines to a logical unit
    BMIAVG:=avg(BMI)
 round 2

It is also apparent, without tags, that the tuple for Klaus ends with 80 and that Klaus has three subtuples. In this structure, for example, AGE is subordinate to NAME. In the gib part, this hierarchy is inverted by simply providing the schema, or generally the DTD (Document Type Definition), of the desired XML document. Here, M (German for set), B for bag, and L for list. However, a selection is first applied in the example above. Instead of with, also without can be used. The above selection discards all tuples without an AGE entry greater than 20. These are Valerie and Viktoria. The first subtuple of Klaus remains, because NAME: indicates that we select only complete tuples, not subtuples. If we want to omit subtuples, we have to replace NAME with AGE or WEIGHT. The following two conditions select in both lists: with NAME, AGE: AGE>20 resp. with AGE>20. By an ext part, the table is extended by a new column (extension). Without introducing variables, column names of different levels can be used. To the right of WEIGHT, the Body-Mass-Index column is introduced. Note that BMI values are calculated not only for length 1.68 and weight 61, but also for 1.68 and the second row (65). Besides restructurings in non-recursive DTDs, a gib part can also accomplish the following tasks:

  • sort (M, B) (by the first fields of the collections) (M-, B-: descending)
  • aggregate (simultaneously horizontally and vertically)
  • eliminate duplicates (M, M-)
  • joins and unions
  • projections
  • group by and nest
  • unnest
  • tag

The last operation (round) rounds all numbers in the result of the gib part to 2 digits after the decimal point. Binary operations are written in infix notation in OttoQL. Therefore, the above program implements the following query: Find the average BMI, the BMI per age level, and the BMI of each person older than 20. Sort by age and within an age group by BMI. The result is a table:

 <<BMIAVG,M(AGE,   BMIAVG, B(BMI,  NAME))::
   23.12    18     20.98     19.03 Kathi
                             21.61 Klaus
                             22.31 Bert
            30     23.34     23.03 Klaus
                             23.66 Bert
            40     23.47     22.72 Rolf
                             24.22 Kathi
            56     28.34     28.34 Klaus>>

Independence from Data Structure

The OttoQL operations require a DTD because the system needs to identify collections and tuples. However, the crucial operations of OttoQL are largely independent of the DTD. The above BMI example also works if the given table is flat (L(NAME, LENGTH, AGE, WEIGHT)) or inversely structured (M(WEIGHT, L(NAME, LENGTH, AGE))). This property is important if OttoQL is to be used by search engines.

Development

The fundamental ideas behind the most important OttoQL operations are presented in.[1] The ideas have been extended in [2] and.[3] But these publications do not yet encompass a generalization to XML. Andreas Hauptmann, Martin Schnabel, and Dmitri Schamschurko made significant contributions to the current implementation. The algebraic foundation of OttoQL can be found in Reichel's paper.[4]

References

  1. Klaus Benecke, "Hierarchische Datenstrukturen" (Hierarchical Data Structures)(German), Dissertation B, Technische Universität "Otto von Guericke", Magdeburg, May 1987
  2. Klaus Benecke, "Strukturierte Tabellen - Ein neues Paradigma für Datenbank- und Programmiersprachen" (Structured Tables - A new Paradigm for Databases and Programming Languages) (German), Deutscher Universitätsverlag, Wiesbaden 1998, ISBN 3-8244-2099-6
  3. Klaus Benecke, "A powerful Tool for Object Oriented Manipulation", in Object-Oriented Databases: Analysis, Design & Construction (DS-4), R. A. Meersman, W. Kent, S. Khosla (Editors), North-Holland 1991, pp.95-122
  4. Horst Reichel, "Initial Computebility, Algebraic Specifications, and Partial Algebras", Oxford University Press, Oxford 1987 ISBN 0-19-853806-5

External links


This article "OttoQL" is from Wikipedia. The list of its authors can be seen in its historical. Articles copied from Draft Namespace on Wikipedia could be seen on the Draft Namespace of Wikipedia and not main one.