<?xml version="1.0" encoding="UTF-8"?>
  <!--
    Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE
    file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file
    to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
    the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
    applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language
    governing permissions and limitations under the License.
  -->
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "document-v20-mak.dtd">
<document>
  <header>
    <title>Makumba Documentation - Query Languages</title>
  </header>
  <body>
    <p>
      Makumba supports mainly two query languages: the native
      <a href="#MQL">Makumba Query Language (MQL)</a>
      and the
      <a href="#HQL">Hibernate Query Language (HQL)</a>.
    </p>
    <p>
      In the earlier versions, Makumba was using the
      <a href="#OQL">Object Query Language (OQL)</a>
      designed by the
      <a href="ext:odmg">Object Data Management Group</a>.
    </p>
    <section id="MQL">
      <title>MQL</title>
      <fixme author="manu">Put a link to the Pointer once we have the doc</fixme>
      <p>
        MQL was developed as a sum of the most useful aspects of OQL and HQL. As such is it based on HQL in many regards
        (see the
        <a href="ext:hql">reference documentation</a>
        ), except following:
        </p>
        <ul>
          <li>it accepts boolean projections: SELECT a=1 AS col1 ... etc</li>
          <li>selecting an object will lead in selecting the external form of its Makumba pointer</li>
          <li>
            it works with
            <a href="datadefs.html">Makumba Data Definitions</a>
            instead of Hibernate mappings
          </li>
          <li>
            like HQL, it supports subqueries in the style of e.g. <a href="ext:mysql-subqueries">MySQL</a>
          </li>
          <li>since Makumba only has set (equivalent of Hibernate bag), some of the HQL constructs like indices()
            don't make sense.</li>
          <li>some of the HQL functions are not yet implemented (e.g. current_date())</li>
        </ul>
    </section>
    <section id="HQL">
      <title>HQL</title>
      <p>Makumba supports HQL as a query language. Please check its <a href="ext:hql">reference documentation</a>.</p>
      <p>In order to use HQL in Makumba JSPs pages, the following TLD declaration should be used:
      <code>&lt;%@taglib uri="http://www.makumba.org/view-hql" prefix="mak" %&gt;</code>
      
      </p>
    </section>
    <section id="OQL">
      <title>OQL</title>
      <note>OQL is not any longer used in Makumba, but here is the previous documentation as support for earlier
        Makumba versions.</note>
      <p>
        The database can be interrogated using the following language ( [] means optional, {} means any number of
        repetitions). OQL is similar to SQL, a specification can be found at
        <a href="ext:odmg">http://www.odmg.org</a>
        (or check
        <a href="oql-manual.pdf">this PDF</a>
        ). Makumba recognizes a subset of OQL at the moment, which it translates to the host SQL when necessary.
      </p>
      <source>
SELECT expression [[AS] label] {, expression [[AS] label] }
FROM {type [AS] label | label.field{.field} [AS] label }
[   WHERE expression
    [    GROUP BY expression {,expression}
        [  HAVING expression {,expression}  ]
    ]
]
[ORDER BY expression {,expression} [(ASC|DESC)] ]
      </source>
    </section>
  </body>
</document>