{-
 Copyright (C) 2012 Jimmy Liang <http://gsd.uwaterloo.ca>

 Permission is hereby granted, free of charge, to any person obtaining a copy of
 this software and associated documentation files (the "Software"), to deal in
 the Software without restriction, including without limitation the rights to
 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
 of the Software, and to permit persons to whom the Software is furnished to do
 so, subject to the following conditions:

 The above copyright notice and this permission notice shall be included in all
 copies or substantial portions of the Software.

 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 SOFTWARE.
-}
module Language.Clafer.Generator.Schema where
xsd :: String
xsd = concat [ ""
  , "<!-- ........................................................................ *\n"
  , "  *   Clafer Project                                                          *\n"
  , "  *   http://clafer.org                                                       *\n"
  , "  *                                                                           *\n"
  , "  *   File description: XML schema of Clafer intermediate representation (IR) *\n"
  , "  *   Depends on: Haskell IR data types defined for clafer                    *\n"
  , "  *   Author: Leonardo Passos <lpassos@gsd.uwaterloo.ca>                      *\n"
  , "  *   Contributors: Jimmy Liang <jliang@gsd.uwaterloo.ca>                     *\n"
  , "  *   Date: October 19th, 2011                                                *\n"
  , "  *   Last update: April 16th, 2012                                           *\n"
  , "  *                                                                           *\n"
  , "  *   Generate scala classes with:                                            *\n"
  , "  *   scalaxb -p gsd.clafer.ir ClaferIR.xsd                                   *\n"
  , "  *           - -protocol-file ClaferIR_XmlProtocol.scala                     *\n"
  , "  * ......................................................................... *\n"
  , "  */\n"
  , "-->\n"
  , "<xs:schema targetNamespace=\"http://clafer.org/ir\"\n"
  , "           elementFormDefault=\"qualified\"\n"
  , "           xmlns=\"http://clafer.org/ir\"\n"
  , "           xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"\n"
  , "           xmlns:cl=\"http://clafer.org/ir\">\n"
  , "\n"
  , "  <!-- . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .-->\n"
  , "  <!--\n"
  , "    data IType = TBoolean\n"
  , "                 | TString\n"
  , "                 | TInteger\n"
  , "                 | TReal\n"
  , "                 | TClafer\n"
  , "  -->\n"
  , "  <xs:complexType name=\"IType\" abstract=\"true\"/>\n"
  , "  <xs:element name=\"Type\" type=\"cl:IType\"/>\n"
  , "\n"
  , "  <xs:complexType name=\"IBoolean\">\n"
  , "      <xs:complexContent>\n"
  , "          <xs:extension base=\"cl:IType\"/>\n"
  , "      </xs:complexContent>\n"
  , "  </xs:complexType>\n"
  , "\n"
  , "  <xs:complexType name=\"IString\">\n"
  , "      <xs:complexContent>\n"
  , "          <xs:extension base=\"cl:IType\"/>\n"
  , "      </xs:complexContent>\n"
  , "  </xs:complexType>\n"
  , "\n"
  , "  <xs:complexType name=\"IInteger\">\n"
  , "      <xs:complexContent>\n"
  , "          <xs:extension base=\"cl:IType\"/>\n"
  , "      </xs:complexContent>\n"
  , "  </xs:complexType>\n"
  , "  \n"
  , "  <xs:complexType name=\"IReal\">\n"
  , "      <xs:complexContent>\n"
  , "          <xs:extension base=\"cl:IType\"/>\n"
  , "      </xs:complexContent>\n"
  , "  </xs:complexType>\n"
  , "\n"
  , "  <xs:complexType name=\"ISet\">\n"
  , "      <xs:complexContent>\n"
  , "          <xs:extension base=\"cl:IType\"/>\n"
  , "      </xs:complexContent>\n"
  , "  </xs:complexType>\n"
  , "\n"
  , "  <!-- . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .-->\n"
  , "  <!-- data IModule = IModule {\n"
  , "      mName :: String,\n"
  , "      mDecls :: [IElement]\n"
  , "    }\n"
  , "  -->\n"
  , "\n"
  , "  <xs:complexType name=\"IModule\">\n"
  , "      <xs:sequence>\n"
  , "          <xs:element name=\"Name\" type=\"xs:string\"/>\n"
  , "          <xs:element ref=\"Declaration\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n"
  , "      </xs:sequence>\n"
  , "  </xs:complexType>\n"
  , "\n"
  , "  <xs:element name=\"Module\" type=\"cl:IModule\"/>\n"
  , "\n"
  , "  <!-- . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .-->\n"
  , "  <!-- data IClafer =\n"
  , "       IClafer {\n"
  , "          isAbstract :: Bool,     - determines whether it's abstract\n"
  , "          gcard :: Maybe IGCard,  - group cardinality\n"
  , "          ident :: String,        - name\n"
  , "          uid :: String,          - (o) unique identifier\n"
  , "          super:: ISuper,         - superclafers\n"
  , "          card :: Maybe Interval, - cardinality\n"
  , "          glCard :: Interval,     - (o) global cardinality\n"
  , "          elements :: [IElement]  - subclafers or constraints specified in the context of given clafer\n"
  , "        }\n"
  , "  -->\n"
  , "  <xs:complexType name=\"IClafer\">\n"
  , "      <xs:complexContent>\n"
  , "          <xs:extension base=\"IElement\">\n"
  , "            <xs:sequence>\n"
  , "                <xs:element name=\"Position\">\n"
  , "                  <xs:complexType>\n"
  , "                      <xs:sequence>\n"
  , "                          <xs:element name=\"Start\">\n"
  , "                              <xs:complexType>\n"
  , "                                  <xs:sequence>\n"
  , "                                      <xs:element ref=\"IntLiteral\" minOccurs=\"2\" maxOccurs=\"2\"/>\n"
  , "                                  </xs:sequence>\n"
  , "                              </xs:complexType>\n"
  , "                          </xs:element>\n"
  , "                          <xs:element name=\"End\">\n"
  , "                              <xs:complexType>\n"
  , "                                  <xs:sequence>\n"
  , "                                      <xs:element ref=\"IntLiteral\" minOccurs=\"2\" maxOccurs=\"2\"/>\n"
  , "                                  </xs:sequence>\n"
  , "                              </xs:complexType>\n"
  , "                          </xs:element>\n"
  , "                      </xs:sequence>\n"
  , "                  </xs:complexType>\n"
  , "                </xs:element>\n"
  , "                <xs:element name=\"IsAbstract\" type=\"xs:boolean\"/>\n"
  , "                <xs:element name=\"GroupCard\"  type=\"cl:IGroupCard\" minOccurs=\"0\" maxOccurs=\"1\"/>\n"
  , "                <xs:element name=\"Id\"         type=\"xs:string\"/>\n"
  , "                <xs:element name=\"UniqueId\"   type=\"xs:string\"/>\n"
  , "                <xs:element name=\"Supers\"     type=\"cl:ISuper\"/>\n"
  , "                <xs:element name=\"Card\"       type=\"cl:IInterval\" minOccurs=\"0\" maxOccurs=\"1\"/>\n"
  , "                <xs:element name=\"GlobalCard\" type=\"cl:IInterval\"/>\n"
  , "                <xs:element ref=\"Declaration\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n"
  , "            </xs:sequence>\n"
  , "          </xs:extension>\n"
  , "      </xs:complexContent>\n"
  , "  </xs:complexType>\n"
  , "\n"
  , "  <!-- . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .-->\n"
  , "  <!-- data IElement =\n"
  , "       IEClafer IClafer\n"
  , "     | IEConstraint {\n"
  , "          isHard :: Bool,\n"
  , "          cpexp :: PExp\n"
  , "        }\n"
  , "     | IEGoal {\n"
  , "       isMaximize :: Bool,\n"
  , "       cpexp :: PExp\n"
  , "       }\n"
  , "   -->\n"
  , "\n"
  , "  <xs:complexType name=\"IElement\" abstract=\"true\"/>\n"
  , "  <xs:element name=\"Declaration\" type=\"IElement\"/>\n"
  , "\n"
  , "  <!-- No need to create IEClafer type. IClafer is already a subtype\n"
  , "       of IElement\n"
  , "    -->\n"
  , "\n"
  , "  <xs:complexType name=\"IConstraint\">\n"
  , "    <xs:complexContent>\n"
  , "      <xs:extension base=\"cl:IElement\">\n"
  , "          <xs:sequence>\n"
  , "              <xs:element name=\"IsHard\"    type=\"xs:boolean\"/>\n"
  , "              <xs:element name=\"ParentExp\" type=\"cl:IParentExp\"/>\n"
  , "          </xs:sequence>\n"
  , "      </xs:extension>\n"
  , "\n"
  , "    </xs:complexContent>\n"
  , "  </xs:complexType>\n"
  , "\n"
  , "  <xs:complexType name=\"IGoal\">\n"
  , "    <xs:complexContent>\n"
  , "      <xs:extension base=\"cl:IElement\">\n"
  , "          <xs:sequence>\n"
  , "              <xs:element name=\"IsMaximize\"    type=\"xs:boolean\"/>\n"
  , "              <xs:element name=\"ParentExp\" type=\"cl:IParentExp\"/>\n"
  , "          </xs:sequence>\n"
  , "      </xs:extension>\n"
  , "\n"
  , "    </xs:complexContent>\n"
  , "  </xs:complexType>\n"
  , "\n"
  , "  <!-- . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .-->\n"
  , "  <!-- data ISuper =\n"
  , "       ISuper {\n"
  , "          isOverlapping :: Bool,\n"
  , "          supers :: [PExp]\n"
  , "        }\n"
  , "  -->\n"
  , "  <xs:complexType name=\"ISuper\">\n"
  , "    <xs:sequence>\n"
  , "        <xs:element name=\"IsOverlapping\" type=\"xs:boolean\"/>\n"
  , "        <xs:element name=\"Super\"         type=\"cl:IParentExp\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n"
  , "    </xs:sequence>\n"
  , "  </xs:complexType>\n"
  , "\n"
  , "  <!-- . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .-->\n"
  , "  <!-- data IGCard =\n"
  , "      IGCard {\n"
  , "          isKeyword :: Bool,\n"
  , "          interval :: Interval\n"
  , "        }\n"
  , "  -->\n"
  , "\n"
  , "  <xs:complexType name=\"IGroupCard\">\n"
  , "    <xs:sequence>\n"
  , "        <xs:element name=\"IsKeyword\" type=\"xs:boolean\"/>\n"
  , "        <xs:element name=\"Interval\"  type=\"cl:IInterval\"/>\n"
  , "    </xs:sequence>\n"
  , "  </xs:complexType>\n"
  , "\n"
  , "  <!-- . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .-->\n"
  , "  <!-- type Interval = (Integer, ExInteger) -->\n"
  , "\n"
  , "  <xs:complexType name=\"IInterval\">\n"
  , "      <xs:sequence>\n"
  , "          <xs:element name=\"Min\">\n"
  , "            <xs:complexType>\n"
  , "                <xs:sequence>\n"
  , "                    <xs:element ref=\"IntLiteral\"/>\n"
  , "                </xs:sequence>\n"
  , "            </xs:complexType>\n"
  , "          </xs:element>\n"
  , "          <xs:element name=\"Max\">\n"
  , "            <xs:complexType>\n"
  , "                <xs:sequence>\n"
  , "                    <xs:element ref=\"IntLiteral\"/>\n"
  , "                </xs:sequence>\n"
  , "            </xs:complexType>\n"
  , "          </xs:element>\n"
  , "      </xs:sequence>\n"
  , "  </xs:complexType>\n"
  , "\n"
  , "  <!-- . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .-->\n"
  , "  <!-- data PExp = PExp {\n"
  , "      iType :: Maybe IType,\n"
  , "      pid :: String,\n"
  , "      exp :: IExp\n"
  , "    }\n"
  , "  -->\n"
  , "\n"
  , "  <xs:complexType name=\"IParentExp\">\n"
  , "      <xs:sequence>\n"
  , "          <xs:element name=\"Type\"     type=\"cl:IType\" minOccurs=\"0\" maxOccurs=\"1\"/>\n"
  , "          <xs:element name=\"ParentId\" type=\"xs:string\" minOccurs=\"0\" maxOccurs=\"1\"/>\n"
  , "          <xs:element name=\"Position\">\n"
  , "              <xs:complexType>\n"
  , "                  <xs:sequence>\n"
  , "                      <xs:element name=\"Start\">\n"
  , "                          <xs:complexType>\n"
  , "                              <xs:sequence>\n"
  , "                                  <xs:element ref=\"IntLiteral\" minOccurs=\"2\" maxOccurs=\"2\"/>\n"
  , "                              </xs:sequence>\n"
  , "                          </xs:complexType>\n"
  , "                      </xs:element>\n"
  , "                      <xs:element name=\"End\">\n"
  , "                          <xs:complexType>\n"
  , "                              <xs:sequence>\n"
  , "                                  <xs:element ref=\"IntLiteral\" minOccurs=\"2\" maxOccurs=\"2\"/>\n"
  , "                              </xs:sequence>\n"
  , "                          </xs:complexType>\n"
  , "                      </xs:element>\n"
  , "                  </xs:sequence>\n"
  , "              </xs:complexType>\n"
  , "          </xs:element>\n"
  , "          <xs:element name=\"Exp\"      type=\"cl:IExp\"/>\n"
  , "      </xs:sequence>\n"
  , "  </xs:complexType>\n"
  , "\n"
  , "\n"
  , "  <!-- ......................................................................-->\n"
  , "  <!--\n"
  , "    data IExp =\n"
  , "       - quantified expression  declarations\n"
  , "       IDeclPExp {quant :: IQuant, oDecls :: [IDecl], bpexp :: PExp}\n"
  , "     | IFunExp {op :: String, exps :: [PExp]}\n"
  , "     | IInt Integer                  - integer number\n"
  , "     | IDouble Double                - real number\n"
  , "     | IStr String                   - string\n"
  , "     | IClaferId {                   - clafer name\n"
  , "          modName :: String,         - module name\n"
  , "          sident :: String,          - name\n"
  , "          isTop :: Bool              - identifier refers to a top-level definition\n"
  , "        }\n"
  , "   -->\n"
  , "  <xs:complexType name=\"IExp\" abstract=\"true\"/>\n"
  , "\n"
  , "  <xs:complexType name=\"IDeclarationParentExp\">\n"
  , "      <xs:complexContent>\n"
  , "          <xs:extension base=\"cl:IExp\">\n"
  , "              <xs:sequence>\n"
  , "                  <xs:element name=\"Quantifier\"    type=\"cl:IQuantifier\"/>\n"
  , "                  <xs:element name=\"Declaration\"   type=\"cl:IDeclaration\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n"
  , "                  <xs:element name=\"BodyParentExp\" type=\"cl:IParentExp\"/>\n"
  , "              </xs:sequence>\n"
  , "          </xs:extension>\n"
  , "      </xs:complexContent>\n"
  , "  </xs:complexType>\n"
  , "\n"
  , "  <xs:complexType name=\"IFunctionExp\">\n"
  , "      <xs:complexContent>\n"
  , "          <xs:extension base=\"IExp\">\n"
  , "              <xs:sequence>\n"
  , "                  <xs:element name=\"Operation\" type=\"xs:string\"/>\n"
  , "                  <xs:element name=\"Argument\" minOccurs=\"0\" maxOccurs=\"unbounded\" type=\"IParentExp\"/>\n"
  , "              </xs:sequence>\n"
  , "          </xs:extension>\n"
  , "      </xs:complexContent>\n"
  , "  </xs:complexType>\n"
  , "\n"
  , "  <xs:complexType name=\"IIntExp\">\n"
  , "      <xs:complexContent>\n"
  , "          <xs:extension base=\"IExp\">\n"
  , "              <xs:sequence>\n"
  , "                 <xs:element ref=\"IntLiteral\"/>\n"
  , "              </xs:sequence>\n"
  , "          </xs:extension>\n"
  , "      </xs:complexContent>\n"
  , "  </xs:complexType>\n"
  , "\n"
  , "  <xs:complexType name=\"IDoubleExp\">\n"
  , "      <xs:complexContent>\n"
  , "          <xs:extension base=\"IExp\">\n"
  , "              <xs:sequence>\n"
  , "                 <xs:element ref=\"DoubleLiteral\"/>\n"
  , "              </xs:sequence>\n"
  , "          </xs:extension>\n"
  , "      </xs:complexContent>\n"
  , "  </xs:complexType>\n"
  , "\n"
  , "  <xs:complexType name=\"IStringExp\">\n"
  , "      <xs:complexContent>\n"
  , "          <xs:extension base=\"IExp\">\n"
  , "              <xs:sequence>\n"
  , "                 <xs:element ref=\"StringLiteral\"/>\n"
  , "              </xs:sequence>\n"
  , "          </xs:extension>\n"
  , "      </xs:complexContent>\n"
  , "  </xs:complexType>\n"
  , "\n"
  , "\n"
  , "  <xs:complexType name=\"IClaferId\">\n"
  , "      <xs:complexContent>\n"
  , "          <xs:extension base=\"IExp\">\n"
  , "              <xs:sequence>\n"
  , "                  <xs:element name=\"ModuleName\" type=\"xs:string\" minOccurs=\"0\" maxOccurs=\"1\"/>\n"
  , "                  <xs:element name=\"Id\"         type=\"xs:string\" />\n"
  , "                  <xs:element name=\"IsTop\"      type=\"xs:boolean\"/>\n"
  , "              </xs:sequence>\n"
  , "          </xs:extension>\n"
  , "      </xs:complexContent>\n"
  , "  </xs:complexType>\n"
  , "\n"
  , "  <!-- ......................................................................-->\n"
  , "  <!-- data IDecl =\n"
  , "       IDecl {\n"
  , "          isDisj :: Bool,     - is disjunct\n"
  , "          decls :: [String],  - a list of local names\n"
  , "          body :: PExp        - set to which local names refer to\n"
  , "        }\n"
  , "    -->\n"
  , "\n"
  , "   <xs:complexType name=\"IDeclaration\">\n"
  , "       <xs:sequence>\n"
  , "           <xs:element name=\"IsDisjunct\"       type=\"xs:boolean\"/>\n"
  , "           <xs:element name=\"LocalDeclaration\" type=\"xs:string\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n"
  , "           <xs:element name=\"Body\"             type=\"cl:IParentExp\"/>\n"
  , "       </xs:sequence>\n"
  , "   </xs:complexType>\n"
  , "\n"
  , "  <!-- ......................................................................-->\n"
  , "  <!-- data IQuant =\n"
  , "        INo\n"
  , "        | ILone\n"
  , "        | IOne\n"
  , "        | ISome\n"
  , "        | IAll\n"
  , "   -->\n"
  , "\n"
  , "   <xs:complexType name=\"IQuantifier\" abstract=\"true\"/>\n"
  , "\n"
  , "   <xs:complexType name=\"INo\">\n"
  , "       <xs:complexContent>\n"
  , "           <xs:extension base=\"cl:IQuantifier\"/>\n"
  , "       </xs:complexContent>\n"
  , "   </xs:complexType>\n"
  , "\n"
  , "   <xs:complexType name=\"ILone\">\n"
  , "       <xs:complexContent>\n"
  , "           <xs:extension base=\"cl:IQuantifier\"/>\n"
  , "       </xs:complexContent>\n"
  , "   </xs:complexType>\n"
  , "\n"
  , "   <xs:complexType name=\"IOne\">\n"
  , "       <xs:complexContent>\n"
  , "           <xs:extension base=\"cl:IQuantifier\"/>\n"
  , "       </xs:complexContent>\n"
  , "   </xs:complexType>\n"
  , "\n"
  , "   <xs:complexType name=\"ISome\">\n"
  , "       <xs:complexContent>\n"
  , "           <xs:extension base=\"cl:IQuantifier\"/>\n"
  , "       </xs:complexContent>\n"
  , "   </xs:complexType>\n"
  , "\n"
  , "   <xs:complexType name=\"IAll\">\n"
  , "       <xs:complexContent>\n"
  , "           <xs:extension base=\"cl:IQuantifier\"/>\n"
  , "       </xs:complexContent>\n"
  , "   </xs:complexType>\n"
  , "\n"
  , " <!-- ......................................................................-->\n"
  , "\n"
  , " <xs:element name=\"IntLiteral\"    type=\"xs:integer\"/>\n"
  , " <xs:element name=\"DoubleLiteral\" type=\"xs:double\"/>\n"
  , " <xs:element name=\"StringLiteral\" type=\"xs:string\"/>\n"
  , "\n"
  , "</xs:schema>\n"
  , ""]