--- mysql-dfsg-5.0-5.0.41/sparql/sparqlParser.yy	1970-01-01 01:00:00.000000000 +0100
+++ mysql-dfsg-5.0-5.0.41-spasql/sparql/sparqlParser.yy	2006-12-16 15:08:23.000000000 +0100
@@ -0,0 +1,2652 @@
+%{
+#define YY_sparqlParser_STYPE yy_sparqlParser_stype
+/* 
+$Id: mysql+sparql-server-5.0.41.patch,v 1.1 2007-09-05 19:20:45 eric Exp $
+
+TODO:
+research pre-existing var.jt in conjunction with trump
+
+OUTLINE:
+
+Some SPARQL graph pattern opperations correspond to SQL subselects. These create
+a new BindingContext, which keeps track of looks for table alias re-use
+opportunities. These occur in a given binding context where more than one
+subject/predicate pair is in the same table.  For instance, both (?s, T1.p1) and
+(?s, T1.p2) both map to the alias T1_0. (Ohterwise, you get needless joins like
+  FROM T1 AS T1_0 JOIN T1 AS T1_1 ON T1_0.id=T1_1.id
+ WHERE T1_0.p1=o1 AND T1_1.p1=o2
+
+sparqlFrob::object(subject, predicate, object)
+
+*/
+%}
+%name sparqlParser
+%define LSP_NEEDED
+%define ERROR_BODY =0
+%define LEX_BODY =0
+%header{
+#include <iostream>
+#include <string>
+using namespace std;
+#undef yyFlexLexer
+#define yyFlexLexer sparqlFlexLexer
+
+#ifndef FLEXFIX
+#define FLEXFIX YY_sparqlParser_STYPE *val
+#define FLEXFIX2 val
+#endif
+
+#define MYSQL_YACC
+#define YYINITDEPTH 100
+#define YYMAXDEPTH 3200				/* Because of 64K stack */
+#include "mysql_priv.h"
+#include "slave.h"
+#include "lex_symbol.h"
+#include "item_create.h"
+#include "sp_head.h"
+#include "sp_pcontext.h"
+#include "sp_rcontext.h"
+#include "sp.h"
+#include <myisam.h>
+#include <myisammrg.h>
+
+#include "sparqlFrob.h"
+#define YY_sparqlParser_PARSE_PARAM sparqlFrob *yySparqlFrob
+
+#define PLS_REPORT "Please report this bug, along with the query that triggered it."
+
+extern String Global_string; // call test->print(&Global_string); p Global_string.c_ptr(); call Global_string.free()
+
+/* DEBUGGING/DEVELOPMENT
+ *   aggregates a string representing the compiled string.
+ */
+class Buf {
+protected:
+  char* data;
+  int len;
+public:
+  Buf() {
+    len = 0;
+    data = 0;
+  }
+  Buf(char *str);
+  Buf(int count, ...);
+  ~Buf() {
+    if (data) delete[] data;
+  }
+  char *str() {return data;}
+};
+
+
+/* forward class declarations */
+class BindingContext;
+
+
+/* static function declarations */
+static const char* scan_string(THD *thd, LEX_STRING *lex_string, 
+			       const char *start, const char *end, 
+			       const char look_for);
+
+
+/* Item_POS: overload the mysql Item object for all the SPARQL parts
+ * of speach (URIs, bNodes, variables, and various forms of literal).
+ *
+ * Item overloads: bind_field
+ */
+class Item_POS
+{
+protected:
+  Item *item;
+public:
+  Item_POS (Item* item_arg) {item = item_arg;}
+  virtual ~Item_POS () {}
+  virtual void bind_field(const char *table_name, const char *alias, 
+			  const char *field_name_arg, bool trump, 
+			  THD *thd, TABLE_LIST *jt) = 0;
+  virtual bool is_URI () {return false;}
+  virtual bool is_variable () {return false;}
+  virtual bool is_blank_node () {return false;}
+  virtual bool is_string () {return false;}
+  Item* get_item () {return item;} // OK 'cause ALL Item_POS's are Items.
+};
+
+
+class Item_URI : public Item_field, public Item_POS
+{
+protected:
+  LEX_STRING table;
+  LEX_STRING field;
+  LEX_STRING value;
+
+public:
+  Item_URI(Name_resolution_context *context_arg, LEX_STRING uri, THD *thd);
+  virtual void bind_field(const char *table_name, const char *alias, 
+			  const char *field_name_arg, bool trump, 
+			  THD *thd, TABLE_LIST *jt);
+  virtual bool is_URI () {return true;}
+  LEX_STRING get_table () {return table;}
+  LEX_STRING get_field () {return field;}
+  LEX_STRING get_value () {return value;}
+  void print(String *str);
+};
+extern Item_URI *XSD_integer;
+extern Item_URI *XSD_float;
+extern Item_URI *XSD_decimal;
+
+
+/* Item_variable: represent SPARQL variable.
+ *
+ * includes the status of a variable's use in the current JOIN. A variable in
+ * a nested JOIN is different from a variable in an outer context (the
+ * UnionGraphContext::close handles the correlation (U0.foo=oldTable.oldField).
+ *
+ * Item_variable has the same virtual functions as an Item, but is never
+ * added to the SQL compile tree (for instance, in the form of a table
+ * constraint or a select item).
+ */
+class Item_variable : public Item_field, public Item_POS
+{
+private:
+  Name_resolution_context *nr_context;
+  GraphContext *gc;
+  bool bound;
+  bool primary_key;
+  TABLE_LIST *jt;
+  Item_variable *outer;
+  sparqlFrob *frob;
+  const char *real_table_name;
+  int ref_count;
+
+public:
+  Item_variable(Name_resolution_context *context_arg, 
+		const char *variable_name, Item_variable *outer_arg, 
+		sparqlFrob *frob_arg, int ref_count_arg);
+  virtual void bind_field(const char *table_name, const char *alias, 
+			  const char *field_name_arg, 
+			  bool trump, THD *thd, TABLE_LIST *jt);
+  Item* make_Item_field(Name_resolution_context *context_arg,
+			const char *db_arg, const char *table_name_arg,
+			const char *field_name_arg, 
+			const char* real_table_name);
+  const char* get_primary_key () {return frob->get_primary_key(real_table_name);}
+  virtual bool is_variable () {return true;}
+  bool same_variable (const char* variable_name) {
+    return !strcmp(orig_field_name, variable_name);
+  }
+  virtual bool fix_fields(THD *, Item **);
+  void add_ref_count (int ref_count_arg) {ref_count+= ref_count_arg;}
+  bool outer_has_no_refs () {return outer ? outer->ref_count == 0 : true;}
+  static Item_variable* 
+  match_var_in_list (List<Item_variable> *p_item_variables, const char *var);
+  Item* get_null_item();
+  virtual bool send(Protocol *protocol, String *buffer);
+  void print(String *str);
+};
+
+
+/* Item_blank_node: represent SPARQL bNode.
+ */
+class Item_blank_node : public Item_variable
+{
+public:
+  Item_blank_node (Name_resolution_context *context_arg, 
+		   const char *node_name, sparqlFrob *frob_arg) : 
+    Item_variable(context_arg, node_name, NULL, frob_arg, 0) {}
+  virtual bool is_blank_node () {return true;}
+  void print(String *str);
+};
+
+
+/* Item_literal_string: represent SPARQL xsd:string typed literal.
+ */
+class Item_literal_string : public Item_string, public Item_POS
+{
+private:
+  Item_POS *lang_or_datatype;
+public:
+  Item_literal_string (LEX_STRING string, 
+		       Item_POS *lang_or_datatype, CHARSET_INFO *charset) : 
+    Item_string(string.str, string.length, charset), Item_POS(this) {
+    this->lang_or_datatype = lang_or_datatype;
+  }
+  virtual void bind_field(const char *table_name, const char *alias, 
+			  const char *field_name_arg, bool trump, 
+			  THD *thd, TABLE_LIST *jt);
+  virtual bool is_string () {return true;}
+  Item_POS* get_language_or_datatype () {
+    return lang_or_datatype;
+  }
+  Item_URI* get_datatype () {
+    return lang_or_datatype && lang_or_datatype->is_URI() ? 
+      (Item_URI*)lang_or_datatype : NULL;
+  }
+  Item_literal_string* get_language () {
+    return lang_or_datatype && lang_or_datatype->is_string() ? 
+      (Item_literal_string*)lang_or_datatype : NULL;
+  }
+  void print(String *str);
+};
+
+
+/* Item_literal_int: represent SPARQL xsd:integer typed literal.
+ */
+class Item_literal_int : public Item_int, public Item_POS
+{
+public:
+  Item_literal_int (LEX_STRING string, 
+		   Item_POS *lang_or_datatype, CHARSET_INFO *charset) : 
+    Item_int(string.str), Item_POS(this) {}
+  virtual void bind_field(const char *table_name, const char *alias, 
+			  const char *field_name_arg, bool trump, 
+			  THD *thd, TABLE_LIST *jt);
+  virtual bool is_string () {return false;}
+  Item_URI* get_datatype () {return XSD_integer;}
+  Item_literal_string* get_language () {return NULL;}
+  void print(String *str);
+};
+
+
+/* Item_literal_decimal: represent SPARQL xsd:decimal typed literal.
+ */
+class Item_literal_decimal : public Item_decimal, public Item_POS
+{
+public:
+  Item_literal_decimal (LEX_STRING string, Item_POS *lang_or_datatype, CHARSET_INFO *charset) : 
+    Item_decimal(string.str, string.length, charset), Item_POS(this) {}
+  virtual void bind_field(const char *table_name, const char *alias, 
+			  const char *field_name_arg, bool trump, 
+			  THD *thd, TABLE_LIST *jt);
+  virtual bool is_string () {return false;}
+  Item_URI* get_datatype () {return XSD_decimal;}
+  Item_literal_string* get_language () {return NULL;}
+  void print(String *str);
+};
+
+
+/* Item_literal_float: represent SPARQL xsd:float typed literal.
+ */
+class Item_literal_float : public Item_float, public Item_POS
+{
+public:
+  Item_literal_float (LEX_STRING string, Item_POS *lang_or_datatype, CHARSET_INFO *charset) : 
+    Item_float(string.str, string.length), Item_POS(this) {}
+  virtual void bind_field(const char *table_name, const char *alias, 
+			  const char *field_name_arg, bool trump, 
+			  THD *thd, TABLE_LIST *jt);
+  virtual bool is_string () {return false;}
+  Item_URI* get_datatype () {return XSD_float;}
+  Item_literal_string* get_language() {return NULL;}
+  void print(String *str);
+};
+
+
+/* Item_primary_key_field: reference to an Item_field that is a primary key.
+ * Used to create foreign key/primary key constraints on joins.
+ */
+class Item_primary_key_field : public Item_field
+{
+protected:
+  sparqlFrob *frob;
+  const char* real_table_name;
+public:
+  Item_primary_key_field(Name_resolution_context *context_arg,
+			 const char *db_arg, const char *table_name_arg, 
+			 sparqlFrob *frob_arg, 
+			 const char* real_table_name_arg);
+  virtual bool fix_fields(THD *, Item **);
+};
+
+
+#if 0
+/* Item_func_call: not implemented
+ */
+class Item_func_call : public Item_POS
+{
+protected:
+  Item_POS* name;
+  List<Item>* args;
+public:
+  Item_func_call (Name_resolution_context *context_arg, 
+		  Item_POS* name, List<Item>* args) :
+    Item_POS(context_arg, "<Item_func_call>") {
+    this->name = name;
+    this->args = args;
+  }
+  ~Item_func_call() {}
+  void bind_field (const char *table_name, const char *alias, 
+		   const char *field_name_arg, bool trump, 
+		  T HD *thd, TABLE_LIST *jt) {}
+  bool fix_fields(THD *, Item **);
+};
+#endif
+
+
+
+
+
+/* Alias_info: aliases for a table, indexed by subject.
+ * If it's not in subjects, you need a new alias.
+ */
+class Alias_info {
+  friend class GraphContext;
+private:
+  LEX_STRING table;
+  List<Item_POS> subjects;
+public:
+  Alias_info(LEX_STRING table) {
+    this->table = table;
+  }
+  bool same_table(LEX_STRING table) {
+    return !strcmp(this->table.str, table.str);
+  }
+};
+
+
+/* BindingContext: SQL table aliases and constraints for a given
+ * SPARQL group graph pattern.
+ */
+class BindingContext {
+protected:
+  List<Item_variable> item_variables;
+  // All known table aliases for in the context.
+  List<Alias_info> aliases;
+  Name_resolution_context *name_res_context;
+  BindingContext *parent;
+  LEX *lex;
+  List<Item> *constraints;
+
+public:
+  BindingContext(GraphContext *gc_param, 
+		 BindingContext *parent_param, LEX *lex_param) {
+    parent= parent_param;
+    lex= lex_param;
+    //name_res_context= lex->current_context();
+  }
+  Item_variable* ensure_bound_item_variable(const char *name, 
+				    sparqlFrob *sparql_frob, int ref_count);
+  void select_star(THD *thd);
+  List<Item_variable>* get_item_variables () { return &item_variables; }
+  Alias_info* get_table_alias(THD *thd, Item_POS *s, Item_URI *p, Item_POS *o);
+  Item* get_bound_variable_constraints(Item *conjunction_constraints, 
+				       GraphContext *gc);
+  void start_constraints();
+  void end_and_check_constraints() {
+    assert(constraints == lex->select_lex.expr_list.pop());
+  }
+  Item* make_item_constraints() {
+    return constraints->elements ? new Item_cond_and(*constraints) : NULL;
+  }
+};
+
+
+/* GraphContext: corresponds to a SPARQL graph context.
+ */
+class GraphContext {
+protected:
+  GraphContext *parent;
+  THD *thd;
+  Buf *buf; // temporary
+
+public:
+  sparqlFrob *sparql_frob; // !!! should be protected
+  GraphContext (GraphContext *parent_param, sparqlFrob *sparql_frob_param) {
+    sparql_frob= sparql_frob_param;
+    parent= parent_param;
+    thd= sparql_frob->thd;
+    buf= NULL;
+  }
+  virtual ~GraphContext () {}
+  virtual void close () {
+    cout << "SPARQL: close {" << endl << buf->str() << "}" << endl;
+  }
+  virtual void no_right_union () {
+    cout << "SPARQL: non-UNION {" << endl << buf->str() << "}" << endl;
+  }
+  void set_Buf (Buf *buf_param) { buf= buf_param; }
+  Buf* get_Buf () { return buf; }
+  virtual bool is_optional () { return false; }
+  virtual BindingContext* get_binding_context () {
+    return parent->get_binding_context();
+  }
+  const char* get_alias_string(Alias_info *ai, Item_POS *s, THD *thd);
+};
+
+
+/* BindingGraphContext: the graph contexts that require a new BindingContext.
+ * Raison d'etre: factored common code from Union and Graph contexts.
+ */
+class BindingGraphContext : public GraphContext {
+  friend class Union2GraphContext; // why doesn't BindingGraphContext work here?
+protected:
+  BindingContext *bindings;
+  SELECT_LEX *current_select;
+  BindingGraphContext(GraphContext *parent_param, sparqlFrob *sparql_frob_param);
+public:
+  void select_var(Item_variable *var, bool exists);
+  virtual BindingContext* get_binding_context() { return bindings; }
+};
+
+
+/* RootGraphContext: the graph context just inside the WHERE.
+ */
+class RootGraphContext : public BindingGraphContext {
+public:
+  RootGraphContext(GraphContext *parent, sparqlFrob *sparql_frob);
+  virtual void close () {
+    bindings->end_and_check_constraints();
+  }
+};
+
+
+/* OptionalGraphContext: OPTIONAL {   }.
+ *                                 ^^^
+ */
+class OptionalGraphContext : public GraphContext {
+public:
+  OptionalGraphContext (GraphContext *parent, sparqlFrob *sparql_frob) : 
+    GraphContext(parent, sparql_frob) {
+    /* if (!(on_context= make_join_on_context(thd, $1, $3)))
+       assert(0);
+       thd->lex->push_context(on_context);
+    */
+  }
+  virtual void close () {
+    /* thd->lex->pop_context();
+     */
+  }
+  virtual bool is_optional () { return true; }
+};
+
+
+/* Union1GraphContext: {   } UNION {   }.
+ *                      ^^^
+ */
+class Union1GraphContext : public BindingGraphContext {
+public:
+  Union1GraphContext(GraphContext *parent, sparqlFrob *sparql_frob);
+  virtual void no_right_union () {
+    /* Just a spurious {} so copy the context up to the parent.
+       @@@ TODO
+    */
+    my_printf_error(1, "SPARQL: implementation limitation: not ready to deal with non-UNION %s. "PLS_REPORT, MYF(0), buf->str());
+  }
+  virtual void close();
+  Item* map_variables_to_outer_context () { // !!! does nothing
+    return NULL;
+  }
+};
+
+
+/* Union1GraphContext: {   } UNION {   }.
+ *                                  ^^^
+ */
+class Union2GraphContext : public BindingGraphContext {
+private:
+  BindingGraphContext *left; // left side of the UNION
+
+public:
+  Union2GraphContext(GraphContext *parent, sparqlFrob *sparql_frob);
+  virtual void close();
+};
+
+
+/* GraphGraphContext: GRAPH {   }.
+ *                           ^^^
+ */
+class GraphGraphContext : public BindingGraphContext {
+public:
+  GraphGraphContext (GraphContext *parent, sparqlFrob *sparql_frob) : 
+    BindingGraphContext(parent, sparql_frob) {}
+};
+
+
+%}
+
+%union {
+  int  num;
+  LEX_STRING lex_str;
+  Item *item;
+  List<Item> *item_list;
+  List<BindingGraphContext> *BindingGraphContext_list;
+  Item_POS *item_pos;
+  GraphContext *graph_context;
+  BindingGraphContext *binding_graph_context;
+  Buf *buf;
+}
+
+%token <buf> IT_BASE
+%token <buf> IT_PREFIX
+%token <buf> IT_SELECT
+%token <buf> IT_DISTINCT
+%token <buf> GT_TIMES
+%token <buf> IT_CONSTRUCT
+%token <buf> IT_DESCRIBE
+%token <buf> IT_ASK
+%token <buf> IT_FROM
+%token <buf> IT_NAMED
+%token <buf> IT_WHERE
+%token <buf> IT_ORDER
+%token <buf> IT_BY
+%token <buf> IT_ASC
+%token <buf> IT_DESC
+%token <buf> IT_LIMIT
+%token <buf> IT_OFFSET
+%token <buf> GT_LCURLEY
+%token <buf> GT_RCURLEY
+%token <buf> GT_DOT
+%token <buf> IT_OPTIONAL
+%token <buf> IT_GRAPH
+%token <buf> IT_UNION
+%token <buf> IT_FILTER
+%token <buf> GT_COMMA
+%token <buf> GT_LPAREN
+%token <buf> GT_RPAREN
+%token <buf> GT_SEMI
+%token <item_pos> IT_a
+%token <buf> GT_LBRACKET
+%token <buf> GT_RBRACKET
+%token <buf> GT_MINUS
+%token <buf> GT_PLUS
+%token <buf> GT_OR
+%token <buf> GT_AND
+%token <buf> GT_EQUAL
+%token <buf> GT_NEQUAL
+%token <buf> GT_LT
+%token <buf> GT_GT
+%token <buf> GT_LE
+%token <buf> GT_GE
+%token <buf> GT_DIVIDE
+%token <buf> GT_NOT
+%token <buf> IT_STR
+%token <buf> IT_LANG
+%token <buf> IT_LANGMATCHES
+%token <buf> IT_DATATYPE
+%token <buf> IT_BOUND
+%token <buf> IT_isIRI
+%token <buf> IT_isURI
+%token <buf> IT_isBLANK
+%token <buf> IT_isLITERAL
+%token <buf> IT_REGEX
+%token <buf> GT_DTYPE
+%token <item_pos> IT_true
+%token <item_pos> IT_false
+%token <lex_str> Q_IRI_REF
+%token <lex_str> QNAME_NS
+%token <lex_str> QNAME
+%token <lex_str> BLANK_NODE_LABEL
+%token <lex_str> VAR1
+%token <lex_str> VAR2
+%token <item_pos> LANGTAG
+%token <lex_str> INTEGER
+%token <lex_str> DECIMAL
+%token <lex_str> DOUBLE
+%token <lex_str> STRING_LITERAL1
+%token <lex_str> STRING_LITERAL2
+%token <lex_str> STRING_LITERAL_LONG1
+%token <lex_str> STRING_LITERAL_LONG2
+%token <item_pos> NIL
+%token <lex_str> ANON
+%type <buf> Query
+%type <buf> _O_QSelectQuery_E__Or__QConstructQuery_E__Or__QDescribeQuery_E__Or__QAskQuery_E__C
+%type <buf> Prolog
+%type <buf> _QBaseDecl_E_Opt
+%type <buf> _QPrefixDecl_E_Star
+%type <buf> BaseDecl
+%type <buf> PrefixDecl
+%type <buf> SelectQuery
+%type <buf> _QDISTINCT_E_Opt
+%type <buf> _QVar_E_Plus
+%type <buf> _O_QVar_E_Plus_Or__QTIMES_E__C
+%type <buf> _QDatasetClause_E_Star
+%type <buf> ConstructQuery
+%type <buf> DescribeQuery
+%type <buf> _QVarOrIRIref_E_Plus
+%type <buf> _O_QVarOrIRIref_E_Plus_Or__QTIMES_E__C
+%type <buf> _QWhereClause_E_Opt
+%type <buf> AskQuery
+%type <buf> DatasetClause
+%type <buf> _O_QDefaultGraphClause_E__Or__QNamedGraphClause_E__C
+%type <buf> DefaultGraphClause
+%type <buf> NamedGraphClause
+%type <buf> SourceSelector
+%type <buf> WhereClause
+%type <buf> _QWHERE_E_Opt
+%type <buf> SolutionModifier
+%type <buf> _QOrderClause_E_Opt
+%type <buf> _QLimitClause_E_Opt
+%type <buf> _QOffsetClause_E_Opt
+%type <buf> OrderClause
+%type <buf> _QOrderCondition_E_Plus
+%type <buf> OrderCondition
+%type <num> _O_QASC_E__Or__QDESC_E__C
+%type <buf> _O_QASC_E__Or__QDESC_E____QBrackettedExpression_E__C
+%type <item> _O_QFunctionCall_E__Or__QVar_E__Or__QBrackettedExpression_E__C
+%type <buf> LimitClause
+%type <buf> OffsetClause
+%type <graph_context> GroupGraphPattern
+%type <buf> GraphPattern
+%type <buf> _QDOT_E_Opt
+%type <buf> _O_QGraphPatternNotTriples_E____QDOT_E_Opt___QGraphPattern_E__C
+%type <buf> _Q_O_QGraphPatternNotTriples_E____QDOT_E_Opt___QGraphPattern_E__C_E_Opt
+%type <buf> FilteredBasicGraphPattern
+%type <buf> _QBlockOfTriples_E_Opt
+%type <buf> _O_QConstraint_E____QDOT_E_Opt___QFilteredBasicGraphPattern_E__C
+%type <buf> _Q_O_QConstraint_E____QDOT_E_Opt___QFilteredBasicGraphPattern_E__C_E_Opt
+%type <buf> BlockOfTriples
+%type <buf> _QTriplesSameSubject_E_Opt
+%type <buf> _O_QDOT_E____QTriplesSameSubject_E_Opt_C
+%type <buf> _Q_O_QDOT_E____QTriplesSameSubject_E_Opt_C_E_Star
+%type <buf> GraphPatternNotTriples
+%type <buf> OptionalGraphPattern
+%type <buf> GraphGraphPattern
+%type <buf> GroupOrUnionGraphPattern
+%type <binding_graph_context> _O_QUNION_E____QGroupGraphPattern_E__C
+%type <BindingGraphContext_list> _Q_O_QUNION_E____QGroupGraphPattern_E__C_E_Star
+%type <buf> Constraint
+%type <item> _O_QBrackettedExpression_E__Or__QBuiltInCall_E__Or__QFunctionCall_E__C
+%type <item> FunctionCall
+%type <item_list> ArgList
+%type <item> _O_QCOMMA_E____QExpression_E__C
+%type <NONE> _Q_O_QCOMMA_E____QExpression_E__C_E_Star
+%type <item_list> _O_QNIL_E__Or__QLPAREN_E____QExpression_E____QCOMMA_E____QExpression_E_Star___QRPAREN_E__C
+%type <buf> ConstructTemplate
+%type <buf> ConstructTriples
+%type <buf> _O_QDOT_E____QConstructTriples_E__C
+%type <buf> _Q_O_QDOT_E____QConstructTriples_E__C_E_Opt
+%type <buf> _O_QTriplesSameSubject_E____QDOT_E____QConstructTriples_E_Opt_C
+%type <buf> _Q_O_QTriplesSameSubject_E____QDOT_E____QConstructTriples_E_Opt_C_E_Opt
+%type <buf> TriplesSameSubject
+%type <buf> PropertyList
+%type <buf> _QPropertyListNotEmpty_E_Opt
+%type <buf> PropertyListNotEmpty
+%type <buf> _O_QSEMI_E____QPropertyList_E__C
+%type <buf> _Q_O_QSEMI_E____QPropertyList_E__C_E_Opt
+%type <buf> ObjectList
+%type <buf> _O_QCOMMA_E____QObjectList_E__C
+%type <buf> _Q_O_QCOMMA_E____QObjectList_E__C_E_Opt
+%type <item_pos> Verb
+%type <item_pos> TriplesNode
+%type <item_pos> BlankNodePropertyList
+%type <item_pos> Collection
+%type <buf> _QGraphNode_E_Plus
+%type <item_pos> GraphNode
+%type <item_pos> VarOrTerm
+%type <item_pos> VarOrIRIref
+%type <buf> VarOrBlankNodeOrIRIref
+%type <item_pos> Var
+%type <item_pos> GraphTerm
+%type <buf> _O_QMINUS_E__Or__QPLUS_E__C
+%type <buf> _Q_O_QMINUS_E__Or__QPLUS_E__C_E_Opt
+%type <item> Expression
+%type <item> ConditionalOrExpression
+%type <NONE> _O_QOR_E____QConditionalAndExpression_E__C
+%type <NONE> _Q_O_QOR_E____QConditionalAndExpression_E__C_E_Star
+%type <item> ConditionalAndExpression
+%type <NONE> _O_QAND_E____QValueLogical_E__C
+%type <NONE> _Q_O_QAND_E____QValueLogical_E__C_E_Star
+%type <item> ValueLogical
+%type <item> RelationalExpression
+%type <NONE> _O_QEQUAL_E____QNumericExpression_E__Or__QNEQUAL_E____QNumericExpression_E__Or__QLT_E____QNumericExpression_E__Or__QGT_E____QNumericExpression_E__Or__QLE_E____QNumericExpression_E__Or__QGE_E____QNumericExpression_E__C
+%type <NONE> _Q_O_QEQUAL_E____QNumericExpression_E__Or__QNEQUAL_E____QNumericExpression_E__Or__QLT_E____QNumericExpression_E__Or__QGT_E____QNumericExpression_E__Or__QLE_E____QNumericExpression_E__Or__QGE_E____QNumericExpression_E__C_E_Opt
+%type <item> NumericExpression
+%type <item> AdditiveExpression
+%type <NONE> _O_QPLUS_E____QMultiplicativeExpression_E__Or__QMINUS_E____QMultiplicativeExpression_E__C
+%type <NONE> _Q_O_QPLUS_E____QMultiplicativeExpression_E__Or__QMINUS_E____QMultiplicativeExpression_E__C_E_Star
+%type <item> MultiplicativeExpression
+%type <NONE> _O_QTIMES_E____QUnaryExpression_E__Or__QDIVIDE_E____QUnaryExpression_E__C
+%type <NONE> _Q_O_QTIMES_E____QUnaryExpression_E__Or__QDIVIDE_E____QUnaryExpression_E__C_E_Star
+%type <item> UnaryExpression
+%type <item> PrimaryExpression
+%type <item> BrackettedExpression
+%type <item> BuiltInCall
+%type <item> RegexExpression
+%type <item> _Q_O_QCOMMA_E____QExpression_E__C_E_Opt
+%type <item> IRIrefOrFunction
+%type <item_list> _QArgList_E_Opt
+%type <item_pos> RDFLiteral
+%type <item_pos> _O_QDTYPE_E____QIRIref_E__C
+%type <item_pos> _O_QLANGTAG_E__Or__QDTYPE_E____QIRIref_E__C
+%type <item_pos> _Q_O_QLANGTAG_E__Or__QDTYPE_E____QIRIref_E__C_E_Opt
+%type <item_pos> NumericLiteral
+%type <item_pos> BooleanLiteral
+%type <lex_str> String
+%type <item_pos> IRIref
+%type <item_pos> QName
+%type <item_pos> BlankNode
+%%
+
+Query:
+	{
+	  LEX *lex= yySparqlFrob->thd->lex;
+	  SELECT_LEX *sel= lex->current_select;
+	  lex->current_select->parsing_place = NO_MATTER;
+	  sel->offset_limit= NULL;
+	  sel->select_limit= NULL;
+	  // create root context right away so SELECTs have a context
+	  yySparqlFrob->push_context(
+	     new RootGraphContext(yySparqlFrob->head_context(), yySparqlFrob));
+	}
+	Prolog _O_QSelectQuery_E__Or__QConstructQuery_E__Or__QDescribeQuery_E__Or__QAskQuery_E__C
+	{
+	  Buf *b = new Buf(2, $2, $3);
+	  cout << "Query end -- " << b->str() << endl;
+	  delete b;
+	};
+
+_O_QSelectQuery_E__Or__QConstructQuery_E__Or__QDescribeQuery_E__Or__QAskQuery_E__C:
+    SelectQuery	{$$ = $1}
+    | ConstructQuery	{$$ = $1; YYABORT;}
+    | DescribeQuery	{$$ = $1; YYABORT;}
+    | AskQuery	{$$ = $1; YYABORT;};
+
+Prolog:
+    _QBaseDecl_E_Opt _QPrefixDecl_E_Star	{$$ = new Buf(2, $1, $2)};
+
+_QBaseDecl_E_Opt:
+    {$$ = new Buf()}
+    | BaseDecl	{$$ = $1};
+
+_QPrefixDecl_E_Star:
+    {$$ = new Buf()}
+    | _QPrefixDecl_E_Star PrefixDecl	{$$ = new Buf(2, $1, $2)};
+
+BaseDecl:
+    IT_BASE Q_IRI_REF	{$$ = new Buf(2, new Buf("BASE"), new Buf($2.str))};
+
+PrefixDecl:
+    IT_PREFIX QNAME_NS Q_IRI_REF	{$$ = new Buf(3, $1, new Buf($2.str), new Buf($3.str))};
+
+SelectQuery:
+    IT_SELECT
+	{
+	  LEX *lex= yySparqlFrob->lex;
+	  SELECT_LEX *sel= lex->current_select;
+
+	  sel->parsing_place = SELECT_LIST;
+	  lex->sql_command= SQLCOM_SELECT; // SQLCOM_EMPTY_QUERY;
+	}
+	_QDISTINCT_E_Opt _O_QVar_E_Plus_Or__QTIMES_E__C
+	{
+	  //SELECT_LEX *sel= yySparqlFrob->lex->current_select;
+
+	  //	  commented out 'cause the didn't seem to be needed - EGP 20060326
+	  //	  lex->create_view_select_start = $1->get_item()->name;
+	  //sel->parsing_place = NO_MATTER;
+	  //sel->set_braces(0);
+	}
+	_QDatasetClause_E_Star WhereClause SolutionModifier
+	{
+	  LEX *lex= yySparqlFrob->lex;
+	  SELECT_LEX *sel= lex->current_select;
+
+	  // Now that we have all the variables, fix up the SELECTs.
+	  yySparqlFrob->select_variables();
+
+	  sel->parsing_place = NO_MATTER;
+	  $$ = new Buf(6, new Buf("SELECT"), $3, $4, $6, $7, $8);
+	}
+	;
+
+_QDISTINCT_E_Opt:
+    {$$ = new Buf()}
+    | IT_DISTINCT
+	{
+	  yySparqlFrob->set_distinct(true);
+	  $$ = $1;
+	};
+
+_QVar_E_Plus:
+    Var
+	{
+	  THD *thd= yySparqlFrob->thd;
+	  LEX *lex= thd->lex;
+	  SELECT_LEX *sel= lex->current_select;
+	  sel->use_index_ptr=sel->ignore_index_ptr=0;
+	  sel->table_join_options= 0;
+	  if (add_item_to_list(thd, $1->get_item())) {
+	    YYABORT;
+	  }
+
+	  $$ = new Buf($1->get_item()->name);
+	}
+    | _QVar_E_Plus Var
+	{
+	  THD *thd= yySparqlFrob->thd;
+	  if (add_item_to_list(thd, $2->get_item())) {
+	    YYABORT;
+	  }
+	  $$ = new Buf(2, $1, new Buf($2->get_item()->name));
+	};
+
+_O_QVar_E_Plus_Or__QTIMES_E__C:
+    _QVar_E_Plus	{$$ = $1}
+    | GT_TIMES
+	{ $$ = $1; }
+	;
+
+_QDatasetClause_E_Star:
+    {$$ = new Buf()}
+    | _QDatasetClause_E_Star DatasetClause	{$$ = new Buf(2, $1, $2)};
+
+ConstructQuery:
+    IT_CONSTRUCT ConstructTemplate _QDatasetClause_E_Star WhereClause SolutionModifier	{$$ = new Buf(5, $1, $2, $3, $4, $5)};
+
+DescribeQuery:
+    IT_DESCRIBE _O_QVarOrIRIref_E_Plus_Or__QTIMES_E__C _QDatasetClause_E_Star _QWhereClause_E_Opt SolutionModifier	{$$ = new Buf(5, $1, $2, $3, $4, $5)};
+
+_QVarOrIRIref_E_Plus:
+    VarOrIRIref	{$$ = new Buf($1->get_item()->name)}
+    | _QVarOrIRIref_E_Plus VarOrIRIref	{$$ = new Buf(2, $1, new Buf($2->get_item()->name))};
+
+_O_QVarOrIRIref_E_Plus_Or__QTIMES_E__C:
+    _QVarOrIRIref_E_Plus	{$$ = $1}
+    | GT_TIMES	{$$ = $1};
+
+_QWhereClause_E_Opt:
+    {$$ = new Buf()}
+    | WhereClause	{$$ = $1};
+
+AskQuery:
+    IT_ASK _QDatasetClause_E_Star WhereClause	{$$ = new Buf(3, $1, $2, $3)};
+
+DatasetClause:
+    IT_FROM _O_QDefaultGraphClause_E__Or__QNamedGraphClause_E__C	{$$ = new Buf(2, $1, $2)};
+
+_O_QDefaultGraphClause_E__Or__QNamedGraphClause_E__C:
+    DefaultGraphClause	{$$ = $1}
+    | NamedGraphClause	{$$ = $1};
+
+DefaultGraphClause:
+    SourceSelector	{$$ = $1};
+
+NamedGraphClause:
+    IT_NAMED SourceSelector	{$$ = new Buf(2, $1, $2)};
+
+SourceSelector:
+    IRIref	{$$ = new Buf($1->get_item()->name)};
+
+WhereClause:
+    _QWHERE_E_Opt
+	{
+	  SELECT_LEX* sel = &yySparqlFrob->lex->select_lex;
+	  sel->parsing_place = IN_WHERE;
+
+	  /* we've been using a context (for SELECTs) but need
+	     to pop it so it can be pushed back on at the LCURLEY */
+	  yySparqlFrob->set_next_GC(yySparqlFrob->pop_context());
+	}
+	GroupGraphPattern
+	{
+	  GraphContext *gc= $3;
+	  SELECT_LEX* sel = &yySparqlFrob->lex->select_lex;
+	  BindingContext *bc= gc->get_binding_context();
+	  Item *constraints= bc->make_item_constraints();
+	  yySparqlFrob->add_root_constraints(bc->
+				   get_bound_variable_constraints(constraints, gc));
+	  Item *where = yySparqlFrob->get_root_constraints();
+	  if (where) {
+	    where->top_level_item();
+	    sel->where = where;
+	    String string;
+	    where->print(&string);
+	    $$ = new Buf(4, $1, $3->get_Buf(), new Buf("WHERE"), new Buf(string.c_ptr()));
+	  } else {
+	    $$ = new Buf(2, $1, $3->get_Buf());
+	  }
+	  sel->parsing_place= NO_MATTER;
+	};
+
+_QWHERE_E_Opt:
+    {$$ = new Buf()}
+    | IT_WHERE	{$$ = $1};
+
+SolutionModifier:
+    _QOrderClause_E_Opt _QLimitClause_E_Opt _QOffsetClause_E_Opt	{$$ = new Buf(3, $1, $2, $3)};
+
+_QOrderClause_E_Opt:
+    {$$ = new Buf()}
+    | OrderClause	{$$ = $1};
+
+_QLimitClause_E_Opt:
+    {$$ = new Buf();}
+    | LimitClause	{$$ = $1};
+
+_QOffsetClause_E_Opt:
+    {$$ = new Buf()}
+    | OffsetClause	{$$ = $1};
+
+OrderClause:
+    IT_ORDER IT_BY _QOrderCondition_E_Plus	{$$ = new Buf(3, $1, $2, $3)};
+
+_QOrderCondition_E_Plus:
+    OrderCondition	{$$ = $1}
+    | _QOrderCondition_E_Plus OrderCondition	{$$ = new Buf(2, $1, $2)};
+
+OrderCondition:
+    _O_QASC_E__Or__QDESC_E____QBrackettedExpression_E__C	{$$ = $1}
+    | _O_QFunctionCall_E__Or__QVar_E__Or__QBrackettedExpression_E__C	{$$ = new Buf("!!!")};
+
+_O_QASC_E__Or__QDESC_E__C:
+    IT_ASC	{$$ =1}
+    | IT_DESC	{$$ =0};
+
+_O_QASC_E__Or__QDESC_E____QBrackettedExpression_E__C:
+    _O_QASC_E__Or__QDESC_E__C BrackettedExpression
+	{
+	  if (add_order_to_list(yySparqlFrob->thd, $2, (bool) $1))
+	    YYABORT; 
+	  String string;
+	  $2->print(&string);
+	  $$ = new Buf(2, new Buf((char*)($1 ? "ASK" : "DESC")), new Buf(string.c_ptr()));
+	};
+
+_O_QFunctionCall_E__Or__QVar_E__Or__QBrackettedExpression_E__C:
+    FunctionCall	{$$ = $1}
+    | Var	{$$ = $1->get_item()}
+    | BrackettedExpression	{$$ = $1};
+
+LimitClause:
+    IT_LIMIT INTEGER
+	{
+	  SELECT_LEX *sel = &yySparqlFrob->lex->select_lex;
+	  sel->select_limit = new Item_uint($2.str, $2.length);
+	  sel->explicit_limit= 1;
+	  $$ = new Buf(2, $1, new Buf($2.str));
+	};
+
+OffsetClause:
+    IT_OFFSET INTEGER
+	{
+	  SELECT_LEX *sel = &yySparqlFrob->lex->select_lex;
+	  sel->offset_limit = new Item_uint($2.str, $2.length);
+	  sel->explicit_limit= 1;
+	  $$ = new Buf(2, $1, new Buf($2.str));
+	};
+
+GroupGraphPattern:
+    GT_LCURLEY
+	{
+	  GraphContext *gc = yySparqlFrob->was_next_GC();
+	  yySparqlFrob->push_context(gc ? gc : 
+			  new Union1GraphContext(yySparqlFrob->head_context(), yySparqlFrob));
+	}
+	GraphPattern GT_RCURLEY
+	{
+	  if (yySparqlFrob->get_distinct())
+	    yySparqlFrob->lex->current_select->options|= SELECT_DISTINCT;
+	  $$= yySparqlFrob->pop_context();
+	  $$->set_Buf(new Buf(3, $1, $3, $4));
+	  $$->close();
+	};
+
+GraphPattern:
+    FilteredBasicGraphPattern _Q_O_QGraphPatternNotTriples_E____QDOT_E_Opt___QGraphPattern_E__C_E_Opt	{$$ = new Buf(2, $1, $2)};
+
+_QDOT_E_Opt:
+    {$$ = new Buf()}
+    | GT_DOT	{$$ = $1};
+
+_O_QGraphPatternNotTriples_E____QDOT_E_Opt___QGraphPattern_E__C:
+    GraphPatternNotTriples _QDOT_E_Opt GraphPattern	{$$ = new Buf(3, $1, $2, $3)};
+
+_Q_O_QGraphPatternNotTriples_E____QDOT_E_Opt___QGraphPattern_E__C_E_Opt:
+    {$$ = new Buf()}
+    | _O_QGraphPatternNotTriples_E____QDOT_E_Opt___QGraphPattern_E__C	{$$ = $1};
+
+FilteredBasicGraphPattern:
+    _QBlockOfTriples_E_Opt _Q_O_QConstraint_E____QDOT_E_Opt___QFilteredBasicGraphPattern_E__C_E_Opt	{$$ = new Buf(2, $1, $2)};
+
+_QBlockOfTriples_E_Opt:
+    {$$ = new Buf()}
+    | BlockOfTriples	{$$ = $1};
+
+_O_QConstraint_E____QDOT_E_Opt___QFilteredBasicGraphPattern_E__C:
+    Constraint _QDOT_E_Opt FilteredBasicGraphPattern	{$$ = new Buf(3, $1, $2, $3)};
+
+_Q_O_QConstraint_E____QDOT_E_Opt___QFilteredBasicGraphPattern_E__C_E_Opt:
+    {$$ = new Buf()}
+    | _O_QConstraint_E____QDOT_E_Opt___QFilteredBasicGraphPattern_E__C	{$$ = $1};
+
+BlockOfTriples:
+    TriplesSameSubject _Q_O_QDOT_E____QTriplesSameSubject_E_Opt_C_E_Star	{$$ = new Buf(2, $1, $2)};
+
+_QTriplesSameSubject_E_Opt:
+    {$$ = new Buf()}
+    | TriplesSameSubject	{$$ = $1};
+
+_O_QDOT_E____QTriplesSameSubject_E_Opt_C:
+    GT_DOT _QTriplesSameSubject_E_Opt	{$$ = new Buf(2, $1, $2)};
+
+_Q_O_QDOT_E____QTriplesSameSubject_E_Opt_C_E_Star:
+    {$$ = new Buf()}
+    | _Q_O_QDOT_E____QTriplesSameSubject_E_Opt_C_E_Star _O_QDOT_E____QTriplesSameSubject_E_Opt_C	{$$ = new Buf(2, $1, $2)};
+
+GraphPatternNotTriples:
+    OptionalGraphPattern	{$$ = $1}
+    | GroupOrUnionGraphPattern	{$$ = $1}
+    | GraphGraphPattern	{$$ = $1};
+
+OptionalGraphPattern:
+    IT_OPTIONAL
+	{
+	  yySparqlFrob->lex->select_lex.init_nested_join(yySparqlFrob->thd);
+	  yySparqlFrob->set_next_GC(
+			new OptionalGraphContext(yySparqlFrob->head_context(), 
+						 yySparqlFrob));
+	}
+	GroupGraphPattern
+	{
+	  GraphContext *gc= $3;
+	  SELECT_LEX* sel= &yySparqlFrob->lex->select_lex;
+	  BindingContext *bc= gc->get_binding_context();
+	  Item *constraints= bc->make_item_constraints();
+	  Item *constraint= bc->get_bound_variable_constraints(constraints, gc);
+	  yySparqlFrob->add_root_constraints(constraint);
+
+	  String string;
+	  if (constraint)
+	    constraint->print(&string);
+
+	  yySparqlFrob->lex->select_lex.end_nested_join(yySparqlFrob->thd);
+
+	  $$ = new Buf(3, $1, $3->get_Buf(), new Buf(string.c_ptr()));
+	};
+
+GraphGraphPattern:
+    IT_GRAPH VarOrBlankNodeOrIRIref
+	{
+	  yySparqlFrob->set_next_GC(
+			   new GraphGraphContext(yySparqlFrob->head_context(), 
+						 yySparqlFrob));
+	}
+	GroupGraphPattern
+	{
+	  $$ = new Buf(3, $1, $2, $4->get_Buf());
+	};
+
+GroupOrUnionGraphPattern:
+    GroupGraphPattern
+	{
+	  cout << "look for UNIONs in     \"" << yySparqlFrob->lex->ptr << "\"?" << endl;
+	}
+	_Q_O_QUNION_E____QGroupGraphPattern_E__C_E_Star
+	{
+	  $$= $1->get_Buf();
+	  if ($3) {
+	    $3->push_front((BindingGraphContext*)$1);
+	    cout << "there were " << $3->elements << " UNION elements" << endl;
+
+	    yySparqlFrob->needs_select($3);
+
+	    // Maintain the Buf for debugging.
+	    cout << "0: " << (void*)$1 << ": " << $$->str() << endl;
+	    unsigned i= 1;
+	    List_iterator<BindingGraphContext> item_list_it(*$3);
+	    GraphContext* gc= item_list_it++;
+	    while ((gc= item_list_it++)) {
+	      cout << i++ << ": " << (void*)gc << ": " << gc->get_Buf()->str() << endl;
+	      $$= new Buf(3, $$, new Buf("UNION"), gc->get_Buf());
+	    }
+	  } else {
+	    $1->no_right_union();
+	  }
+	}; // !! check return
+
+_O_QUNION_E____QGroupGraphPattern_E__C:
+    IT_UNION
+	{
+	  yySparqlFrob->set_next_GC(
+			  new Union2GraphContext(yySparqlFrob->head_context(), 
+						 yySparqlFrob));
+	  //cout << " found UNION start    \"" << yySparqlFrob->lex->ptr << "\"?" << endl;
+	}
+	GroupGraphPattern
+	{
+	  $$ = (BindingGraphContext*)$3;
+	  //cout << " UNION end at         \"" << yySparqlFrob->lex->ptr << "\"?" << endl;
+	};
+
+_Q_O_QUNION_E____QGroupGraphPattern_E__C_E_Star:
+	{
+	  $$= NULL;
+	}
+    | _Q_O_QUNION_E____QGroupGraphPattern_E__C_E_Star _O_QUNION_E____QGroupGraphPattern_E__C
+	{
+	  //cout << " UNION found before   \"" << yySparqlFrob->lex->ptr << "\"?" << endl;
+	  $$= $1 ? $1 : new List<BindingGraphContext>;
+	  $$->push_back($2);
+	};
+
+Constraint:
+    IT_FILTER _O_QBrackettedExpression_E__Or__QBuiltInCall_E__Or__QFunctionCall_E__C
+	{
+	  LEX *lex = yySparqlFrob->lex;
+	  SELECT_LEX* sel = &lex->select_lex;
+	  sel->expr_list.head()->push_back($2);
+	  String string;
+	  $2->print(&string);
+	  $$ = new Buf(string.c_ptr());
+	};
+
+_O_QBrackettedExpression_E__Or__QBuiltInCall_E__Or__QFunctionCall_E__C:
+    BrackettedExpression	{$$ = $1}
+    | BuiltInCall	{$$ = $1}
+    | FunctionCall	{$$ = $1};
+
+FunctionCall:
+    IRIref ArgList	{$$ = NULL; // new Item_func_call(yySparqlFrob->lex->current_context(), $1, $2); 
+YYABORT /* !!! NI */};
+
+ArgList:
+    _O_QNIL_E__Or__QLPAREN_E____QExpression_E____QCOMMA_E____QExpression_E_Star___QRPAREN_E__C	{$$ = $1};
+
+_O_QCOMMA_E____QExpression_E__C:
+    GT_COMMA Expression	{$$ = $2};
+
+_Q_O_QCOMMA_E____QExpression_E__C_E_Star:
+    {}
+    | _Q_O_QCOMMA_E____QExpression_E__C_E_Star _O_QCOMMA_E____QExpression_E__C
+	{
+	  yySparqlFrob->lex->select_lex.expr_list.push_front(new List<Item>);
+	};
+
+_O_QNIL_E__Or__QLPAREN_E____QExpression_E____QCOMMA_E____QExpression_E_Star___QRPAREN_E__C:
+    NIL	{$$ = NULL}
+    | GT_LPAREN 
+	{
+	  yySparqlFrob->lex->select_lex.expr_list.push_front(new List<Item>);
+	}
+	Expression _Q_O_QCOMMA_E____QExpression_E__C_E_Star GT_RPAREN
+	{
+	  $$ = yySparqlFrob->lex->select_lex.expr_list.pop();
+	  $$->push_front($3);
+	};
+
+ConstructTemplate:
+    GT_LCURLEY ConstructTriples GT_RCURLEY	{$$ = new Buf(3, $1, $2, $3)};
+
+ConstructTriples:
+    _Q_O_QTriplesSameSubject_E____QDOT_E____QConstructTriples_E_Opt_C_E_Opt	{$$ = $1};
+
+_O_QDOT_E____QConstructTriples_E__C:
+    GT_DOT ConstructTriples	{$$ = new Buf(2, $1, $2)};
+
+_Q_O_QDOT_E____QConstructTriples_E__C_E_Opt:
+    {$$ = new Buf()}
+    | _O_QDOT_E____QConstructTriples_E__C	{$$ = $1};
+
+_O_QTriplesSameSubject_E____QDOT_E____QConstructTriples_E_Opt_C:
+    TriplesSameSubject _Q_O_QDOT_E____QConstructTriples_E__C_E_Opt	{$$ = new Buf(2, $1, $2)};
+
+_Q_O_QTriplesSameSubject_E____QDOT_E____QConstructTriples_E_Opt_C_E_Opt:
+    {$$ = new Buf()}
+    | _O_QTriplesSameSubject_E____QDOT_E____QConstructTriples_E_Opt_C	{$$ = $1};
+
+TriplesSameSubject:
+    VarOrTerm
+	{
+	  yySparqlFrob->push_subject($1);
+	}
+	PropertyListNotEmpty
+	{
+	  yySparqlFrob->pop_subject();
+	  $$ = new Buf(2, new Buf($1->get_item()->name), $3);
+	}
+    | TriplesNode
+	{
+	  yySparqlFrob->push_subject($1);
+	}
+	PropertyList
+	{
+	  yySparqlFrob->pop_subject();
+	  $$ = new Buf(2, new Buf($1->get_item()->name), $3);
+	};
+
+PropertyList:
+    _QPropertyListNotEmpty_E_Opt	{$$ = $1};
+
+_QPropertyListNotEmpty_E_Opt:
+    {$$ = new Buf()}
+    | PropertyListNotEmpty	{$$ = $1};
+
+PropertyListNotEmpty:
+    Verb
+	{
+	  yySparqlFrob->push_predicate($1);
+	}
+	ObjectList _Q_O_QSEMI_E____QPropertyList_E__C_E_Opt
+	{
+	  yySparqlFrob->pop_predicate();
+	  $$ = new Buf(3, new Buf($1->get_item()->name), $3, $4);
+	};
+
+_O_QSEMI_E____QPropertyList_E__C:
+    GT_SEMI PropertyList	{$$ = new Buf(2, $1, $2)};
+
+_Q_O_QSEMI_E____QPropertyList_E__C_E_Opt:
+    {$$ = new Buf()}
+    | _O_QSEMI_E____QPropertyList_E__C	{$$ = $1};
+
+ObjectList:
+    GraphNode
+	{
+	  if (yySparqlFrob->object($1))
+	    YYABORT;
+	}
+	_Q_O_QCOMMA_E____QObjectList_E__C_E_Opt	{$$ = new Buf(2, new Buf($1->get_item()->name), $3)};
+
+_O_QCOMMA_E____QObjectList_E__C:
+    GT_COMMA ObjectList	{$$ = new Buf(2, $1, $2)};
+
+_Q_O_QCOMMA_E____QObjectList_E__C_E_Opt:
+    {$$ = new Buf()}
+    | _O_QCOMMA_E____QObjectList_E__C	{$$ = $1};
+
+Verb:
+    VarOrIRIref	{$$ = $1}
+    | IT_a	{$$ = $1};
+
+TriplesNode:
+    Collection	{$$ = $1}
+    | BlankNodePropertyList	{$$ = $1};
+
+BlankNodePropertyList:
+    GT_LBRACKET
+	{
+	  yySparqlFrob->push_subject(yySparqlFrob->make_blank_node());
+	}
+	PropertyListNotEmpty GT_RBRACKET
+	{
+	  //Buf* t = new Buf(3, $1, $3, $4);
+	  $$ = yySparqlFrob->pop_subject();
+	};
+
+Collection:
+    GT_LPAREN
+	{
+	  yySparqlFrob->push_subject(yySparqlFrob->make_blank_node());
+	  if (yySparqlFrob->type_list())
+	    YYABORT
+	}
+	_QGraphNode_E_Plus GT_RPAREN
+	{
+	  //Buf *t = new Buf(3, $1, $3, $4);
+	  $$ = yySparqlFrob->pop_subject();
+	};
+
+_QGraphNode_E_Plus:
+    GraphNode
+	{
+	  if (yySparqlFrob->add_listElement($1))
+	    YYABORT;
+	}	
+    | _QGraphNode_E_Plus GraphNode
+	{
+	  if (yySparqlFrob->add_listElement($2))
+	    YYABORT;
+	  $$ = new Buf(2, $1, new Buf($2->get_item()->name));
+	};
+
+GraphNode:
+    VarOrTerm	{$$ = $1}
+    | TriplesNode	{$$ = $1};
+
+VarOrTerm:
+    Var	{$$ = $1}
+    | GraphTerm	{$$ = $1};
+
+VarOrIRIref:
+    Var	{$$ = $1}
+    | IRIref	{$$ = $1};
+
+VarOrBlankNodeOrIRIref:
+    Var	{$$ = new Buf($1->get_item()->name)}
+    | BlankNode	{$$ = new Buf($1->get_item()->name)}
+    | IRIref	{$$ = new Buf($1->get_item()->name)};
+
+Var:
+    VAR1
+	{
+	  $$ = yySparqlFrob->ensure_variable($1.str);
+	}
+    | VAR2
+	{
+	  $$ = yySparqlFrob->ensure_variable($1.str);
+	};
+
+GraphTerm:
+    IRIref	{$$ = $1}
+    | RDFLiteral	{$$ = $1}
+    | _Q_O_QMINUS_E__Or__QPLUS_E__C_E_Opt NumericLiteral	{$$ = $2 /* !!! */}
+    | BooleanLiteral	{$$ = $1}
+    | BlankNode	{$$ = $1}
+    | NIL	{$$ = $1};
+
+_O_QMINUS_E__Or__QPLUS_E__C:
+    GT_MINUS	{$$ = $1}
+    | GT_PLUS	{$$ = $1};
+
+_Q_O_QMINUS_E__Or__QPLUS_E__C_E_Opt:
+    {$$ = new Buf()}
+    | _O_QMINUS_E__Or__QPLUS_E__C	{$$ = $1};
+
+Expression:
+    ConditionalOrExpression {$$ = $1}
+
+ConditionalOrExpression:
+    ConditionalAndExpression
+	{
+	  yySparqlFrob->lex->select_lex.expr_list.push_front(new List<Item>);
+	}
+	_Q_O_QOR_E____QConditionalAndExpression_E__C_E_Star
+	{
+	  List<Item> *list= yySparqlFrob->lex->select_lex.expr_list.pop();
+	  if (list->elements)
+            {
+              list->push_front($1);
+              $$= new Item_cond_or(*list);
+            }
+	  else
+	    $$= $1;
+	  delete list;
+	};
+
+_O_QOR_E____QConditionalAndExpression_E__C:
+    GT_OR ConditionalAndExpression
+	{
+	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back($2);
+	};
+
+_Q_O_QOR_E____QConditionalAndExpression_E__C_E_Star:
+    {}
+    | _Q_O_QOR_E____QConditionalAndExpression_E__C_E_Star _O_QOR_E____QConditionalAndExpression_E__C	{};
+
+ConditionalAndExpression:
+    ValueLogical
+	{
+	  yySparqlFrob->lex->select_lex.expr_list.push_front(new List<Item>);
+	}
+	_Q_O_QAND_E____QValueLogical_E__C_E_Star
+	{
+	  List<Item> *list= yySparqlFrob->lex->select_lex.expr_list.pop();
+	  if (list->elements)
+            {
+              list->push_front($1);
+              $$= new Item_cond_and(*list);
+            }
+	  else
+	    $$= $1;
+	  delete list;
+	};
+
+_O_QAND_E____QValueLogical_E__C:
+    GT_AND ValueLogical
+	{
+	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back($2);
+	};
+
+_Q_O_QAND_E____QValueLogical_E__C_E_Star:
+    {}
+    | _Q_O_QAND_E____QValueLogical_E__C_E_Star _O_QAND_E____QValueLogical_E__C	{};
+
+ValueLogical:
+    RelationalExpression	{$$ = $1};
+
+RelationalExpression:
+    NumericExpression
+	{
+	  // Stick " = 3 " into two list elements in the expr_list.
+	  yySparqlFrob->lex->select_lex.expr_list.push_front(new List<Item>);
+	}
+	_Q_O_QEQUAL_E____QNumericExpression_E__Or__QNEQUAL_E____QNumericExpression_E__Or__QLT_E____QNumericExpression_E__Or__QGT_E____QNumericExpression_E__Or__QLE_E____QNumericExpression_E__Or__QGE_E____QNumericExpression_E__C_E_Opt
+	{
+	  List<Item> *list= yySparqlFrob->lex->select_lex.expr_list.pop();
+	  if (list->elements)
+            {
+	      chooser_compare_func_creator op = (chooser_compare_func_creator)list->pop();
+	      Item* value = list->pop();
+	      //  chooser_compare_func_creator eq = &comp_eq_creator;
+	      //  Item* test = eq(0)->create($1, value);
+	      $$= op(0)->create($1, value);
+            }
+	  else
+	    $$= $1;
+	  delete list;
+	};
+
+_O_QEQUAL_E____QNumericExpression_E__Or__QNEQUAL_E____QNumericExpression_E__Or__QLT_E____QNumericExpression_E__Or__QGT_E____QNumericExpression_E__Or__QLE_E____QNumericExpression_E__Or__QGE_E____QNumericExpression_E__C:
+    GT_EQUAL NumericExpression
+	{
+	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back((Item*)comp_eq_creator);
+	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back($2);
+	}
+    | GT_NEQUAL NumericExpression
+	{
+	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back((Item*)comp_ne_creator);
+	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back($2);
+	}
+    | GT_LT NumericExpression
+	{
+	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back((Item*)comp_lt_creator);
+	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back($2);
+	}
+    | GT_GT NumericExpression
+	{
+	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back((Item*)comp_gt_creator);
+	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back($2);
+	}
+    | GT_LE NumericExpression
+	{
+	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back((Item*)comp_le_creator);
+	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back($2);
+	}
+    | GT_GE NumericExpression
+	{
+	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back((Item*)comp_ge_creator);
+	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back($2);
+	};
+
+_Q_O_QEQUAL_E____QNumericExpression_E__Or__QNEQUAL_E____QNumericExpression_E__Or__QLT_E____QNumericExpression_E__Or__QGT_E____QNumericExpression_E__Or__QLE_E____QNumericExpression_E__Or__QGE_E____QNumericExpression_E__C_E_Opt:
+    {}
+    | _O_QEQUAL_E____QNumericExpression_E__Or__QNEQUAL_E____QNumericExpression_E__Or__QLT_E____QNumericExpression_E__Or__QGT_E____QNumericExpression_E__Or__QLE_E____QNumericExpression_E__Or__QGE_E____QNumericExpression_E__C	{};
+
+NumericExpression:
+    AdditiveExpression	{$$ = $1};
+
+AdditiveExpression:
+    MultiplicativeExpression
+	{
+	  // Stick " + 3 " into two list elements in the expr_list.
+	  yySparqlFrob->lex->select_lex.expr_list.push_front(new List<Item>);
+	}
+	_Q_O_QPLUS_E____QMultiplicativeExpression_E__Or__QMINUS_E____QMultiplicativeExpression_E__C_E_Star
+	{
+	  List<Item> *list= yySparqlFrob->lex->select_lex.expr_list.pop();
+	  if (list->elements)
+            {
+	      //	      chooser_compare_func_creator *op = (chooser_compare_func_creator*)list->pop();
+	      char *op = (char*)list->pop();
+	      Item* value = list->pop();
+	      if (op[0] == '+') {
+		$$= new Item_func_plus($1, value);
+	      } else {
+		$$= new Item_func_minus($1, value);
+	      }
+	      //	      $$= (*op)(0)->create($1, value);
+            }
+	  else
+	    $$= $1;
+	  delete list;
+	};
+
+_O_QPLUS_E____QMultiplicativeExpression_E__Or__QMINUS_E____QMultiplicativeExpression_E__C:
+    GT_PLUS MultiplicativeExpression
+	{
+	  //	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back((Item*)&comp_plus_creator);
+	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back((Item*)"+");
+	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back($2);
+	}
+    | GT_MINUS MultiplicativeExpression
+	{
+	  //	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back((Item*)&comp_minus_creator);
+	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back((Item*)"-");
+	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back($2);
+	};
+
+_Q_O_QPLUS_E____QMultiplicativeExpression_E__Or__QMINUS_E____QMultiplicativeExpression_E__C_E_Star:
+    {}
+    | _Q_O_QPLUS_E____QMultiplicativeExpression_E__Or__QMINUS_E____QMultiplicativeExpression_E__C_E_Star _O_QPLUS_E____QMultiplicativeExpression_E__Or__QMINUS_E____QMultiplicativeExpression_E__C	{};
+
+MultiplicativeExpression:
+    UnaryExpression
+	{
+	  // Stick " * 3 " into two list elements in the expr_list.
+	  yySparqlFrob->lex->select_lex.expr_list.push_front(new List<Item>);
+	}
+	_Q_O_QTIMES_E____QUnaryExpression_E__Or__QDIVIDE_E____QUnaryExpression_E__C_E_Star
+	{
+	  List<Item> *list= yySparqlFrob->lex->select_lex.expr_list.pop();
+	  if (list->elements)
+            {
+	      //	      chooser_compare_func_creator *op = (chooser_compare_func_creator*)list->pop();
+	      char *op = (char*)list->pop();
+	      Item* value = list->pop();
+	      if (op[0] == '*') {
+		$$= new Item_func_mul($1, value);
+	      } else {
+		$$= new Item_func_div($1, value);
+	      }
+	      //	      $$= (*op)(0)->create($1, value);
+            }
+	  else
+	    $$= $1;
+	  delete list;
+	};
+
+_O_QTIMES_E____QUnaryExpression_E__Or__QDIVIDE_E____QUnaryExpression_E__C:
+    GT_TIMES UnaryExpression
+	{
+	  //	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back((Item*)&comp_times_creator);
+	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back((Item*)"*");
+	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back($2);
+	}
+    | GT_DIVIDE UnaryExpression
+	{
+	  //	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back((Item*)&comp_divide_creator);
+	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back((Item*)"/");
+	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back($2);
+	};
+
+_Q_O_QTIMES_E____QUnaryExpression_E__Or__QDIVIDE_E____QUnaryExpression_E__C_E_Star:
+    {}
+    | _Q_O_QTIMES_E____QUnaryExpression_E__Or__QDIVIDE_E____QUnaryExpression_E__C_E_Star _O_QTIMES_E____QUnaryExpression_E__Or__QDIVIDE_E____QUnaryExpression_E__C	{};
+
+UnaryExpression:
+    GT_NOT PrimaryExpression
+	{
+	  new Item_func_not($2);
+	}
+    | GT_PLUS PrimaryExpression	{$$ = $2}
+    | GT_MINUS PrimaryExpression
+	{
+	  new Item_func_neg($2);
+	}
+    | PrimaryExpression	{$$ = $1};
+
+PrimaryExpression:
+    BrackettedExpression	{$$ = $1}
+    | BuiltInCall	{$$ = $1}
+    | IRIrefOrFunction	{$$ = $1}
+    | RDFLiteral	{$$ = $1->get_item()}
+    | NumericLiteral	{$$ = $1->get_item()}
+    | BooleanLiteral	{$$ = $1->get_item()}
+    | BlankNode	{$$ = $1->get_item()}
+    | Var	{$$ = $1->get_item()};
+
+BrackettedExpression:
+    GT_LPAREN Expression GT_RPAREN	{$$ = $2};
+
+BuiltInCall:
+    IT_STR GT_LPAREN Expression GT_RPAREN	{$$ = $3; YYABORT /* !!! NI */}
+    | IT_LANG GT_LPAREN Expression GT_RPAREN	{$$ = $3; YYABORT /* !!! NI */}
+    | IT_LANGMATCHES GT_LPAREN Expression GT_COMMA Expression GT_RPAREN	{$$ = $3; YYABORT /* !!! NI */}
+    | IT_DATATYPE GT_LPAREN Expression GT_RPAREN	{$$ = $3; YYABORT /* !!! NI */}
+    | IT_BOUND GT_LPAREN Var GT_RPAREN	{$$ = new Item_func_isnotnull($3->get_item());}
+    | IT_isIRI GT_LPAREN Expression GT_RPAREN	{$$ = $3; YYABORT /* !!! NI */}
+    | IT_isURI GT_LPAREN Expression GT_RPAREN	{$$ = $3; YYABORT /* !!! NI */}
+    | IT_isBLANK GT_LPAREN Expression GT_RPAREN	{$$ = $3; YYABORT /* !!! NI */}
+    | IT_isLITERAL GT_LPAREN Expression GT_RPAREN	{$$ = $3; YYABORT /* !!! NI */}
+    | RegexExpression	{$$ = $1};
+
+RegexExpression:
+    IT_REGEX GT_LPAREN Expression GT_COMMA Expression _Q_O_QCOMMA_E____QExpression_E__C_E_Opt GT_RPAREN	{$$ = $3; YYABORT /* !!! NI */};
+
+_Q_O_QCOMMA_E____QExpression_E__C_E_Opt:
+    {$$ = NULL}
+    | _O_QCOMMA_E____QExpression_E__C	{$$ = $1};
+
+IRIrefOrFunction:
+    IRIref _QArgList_E_Opt	{$$ = NULL; // new Item_func_call(yySparqlFrob->lex->current_context(), $1, $2); 
+YYABORT /* !!! NI */};
+
+_QArgList_E_Opt:
+    {$$ = NULL}
+    | ArgList	{$$ = $1};
+
+RDFLiteral:
+    String _Q_O_QLANGTAG_E__Or__QDTYPE_E____QIRIref_E__C_E_Opt	{$$ = yySparqlFrob->ensure_string($1, $2) /* !!! */};
+
+_O_QDTYPE_E____QIRIref_E__C:
+    GT_DTYPE IRIref	{$$ = $2};
+
+_O_QLANGTAG_E__Or__QDTYPE_E____QIRIref_E__C:
+    LANGTAG	{$$ = $1}
+    | _O_QDTYPE_E____QIRIref_E__C	{$$ = $1};
+
+_Q_O_QLANGTAG_E__Or__QDTYPE_E____QIRIref_E__C_E_Opt:
+    {$$ = NULL}
+    | _O_QLANGTAG_E__Or__QDTYPE_E____QIRIref_E__C	{$$ = $1};
+
+NumericLiteral:
+    INTEGER	{$$ = yySparqlFrob->ensure_int($1, NULL) /* !!! */}
+    | DECIMAL	{$$ = yySparqlFrob->ensure_decimal($1, NULL) /* !!! */}
+    | DOUBLE	{$$ = yySparqlFrob->ensure_float($1, NULL) /* !!! */};
+
+BooleanLiteral:
+    IT_true	{$$ = $1}
+    | IT_false	{$$ = $1};
+
+String:
+    STRING_LITERAL1	{$$ = $1}
+    | STRING_LITERAL2	{$$ = $1}
+    | STRING_LITERAL_LONG1	{$$ = $1}
+    | STRING_LITERAL_LONG2	{$$ = $1};
+
+IRIref:
+    Q_IRI_REF	{$$ = yySparqlFrob->ensure_URI($1)}
+    | QName	{$$ = $1};
+
+QName:
+    QNAME	{$$ = yySparqlFrob->ensure_URI($1)}
+    | QNAME_NS	{$$ = yySparqlFrob->ensure_URI($1)};
+
+BlankNode:
+    BLANK_NODE_LABEL	{$$ = yySparqlFrob->ensure_blank_node($1.str)}
+    | ANON	{$$ = yySparqlFrob->make_blank_node()};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+%%
+
+#define YY_DECL int yyFlexLexer::yylex(YY_sparqlParser_STYPE *val, void *yythd)
+    //int yylex(void *yylval, void *yythd);
+const LEX_STRING null_lex_str={0,0};
+
+
+// -------------------------------------- START
+#include "FlexLexer.h"
+// -------------------------------------- END
+
+class sparqlParserPackage : public sparqlParser
+{
+ private:
+  yyFlexLexer theScanner;
+  THD *thd;
+ public:
+  virtual int yylex();
+  virtual void yyerror(char *m);
+  sparqlParserPackage(THD *thd, char** ptr) : theScanner(thd, ptr) {
+    this->thd = thd;
+  };
+};
+
+int sparqlParserPackage::sparqllex()
+{
+ return theScanner.yylex(&yylval);
+}
+
+void sparqlParserPackage::yyerror(char *s)
+{
+  char *yytext= theScanner.get_last_word();
+  my_printf_error(ER_PARSE_ERROR,  ER(ER_PARSE_ERROR), MYF(0), s,
+                  (yytext ? (char*) yytext : ""),
+                  thd->lex->yylineno);
+}
+
+// Move this class definition into sparqlFrob.h and uncomment the #include
+// below. See http://www.w3.org/1999/02/26-modules/User/Yacker#encap for more
+// details.
+
+sparqlFrob::sparqlFrob(THD *thd, char** ptr)
+{
+  // stringstream* ss = new stringstream(buf, stringstream::in);
+  this->thd= thd;
+  lex= thd ? thd->lex : NULL;
+  distinct= false;
+  sparqlParserPackage* aCompiler= new sparqlParserPackage(thd, ptr);
+  parser= aCompiler;
+  next_union_alias_index= 0;
+}
+sparqlFrob::~sparqlFrob()
+{
+}
+
+int sparqlFrob::parse()
+{
+  sparqlParserPackage* aCompiler = (sparqlParserPackage*) parser;
+  return aCompiler->yyparse(this);
+}
+
+const char* sparqlFrob::get_primary_key(const char *table_name) {
+  TABLE_LIST *entry = thd->main_lex.select_lex.context.table_list;
+  while (entry) {
+    if (!strcmp(table_name, entry->table_name)) {
+      KEY *key= entry->table->key_info;
+
+      /* Search table structure for PRIMARY KEY.
+	 Taken from sql_show.cc::2905 get_schema_stat_record */
+      for (unsigned i= 0; i < entry->table->s->keys; i++) {
+	if (!strcmp(key[i].name, "PRIMARY")) {
+	  const char *ret = key[i].key_part->field->field_name;
+	  if (key[i].key_parts != 1)
+	    cout << "SPARQL: table \"" << table_name << "\" primary key has " <<
+	      key[i].key_parts << " parts -- using only 1st field, \"" << ret <<
+	      "\"" << endl;
+	  return ret;
+	}
+      }
+
+      // Couldn't find PRIMARY KEY
+      const char *ret = entry->table->s->fieldnames.type_names[0];
+      cout << "SPARQL: could not find " << table_name << ".<pk> -- trying " << ret << endl;
+      return ret;
+    }
+    entry= entry->next_global;
+  }
+  my_printf_error(1, "SPARQL: could not find table entry for %s. "PLS_REPORT, MYF(0), table_name);
+  return NULL;
+}
+LEX_STRING* sparqlFrob::next_union_alias () {
+  char space[3];
+  space[0]= 'U';
+  space[1]= '0'+next_union_alias_index++;
+  space[2]= 0;
+
+  LEX_STRING *alias = new LEX_STRING;
+  alias->str= thd->strmake(space, 3);
+  alias->length = 2;
+  return alias;
+}
+
+
+Item_variable* sparqlFrob::ensure_variable (const char *var) {
+  return head_context()->get_binding_context()->
+    ensure_bound_item_variable(var, this, 1);
+}
+
+Item_URI* sparqlFrob::ensure_URI (LEX_STRING uristr) {
+  Item_URI* ret;
+  List_iterator<Item_URI> item_list_it(uris);
+  while ((ret = item_list_it++))
+  {
+    if (!strcmp(ret->name, uristr.str)) { /* !!! */
+      return ret;
+    }
+      //    if (curr_item->eq(this, 1))
+      //      DBUG_RETURN(FALSE); /* Already in the set. */
+  }
+
+  ret = new Item_URI(lex->current_context(), uristr, thd);
+  uris.push_back(ret);
+  return ret;
+}
+
+Item_blank_node* sparqlFrob::make_blank_node () {
+  return new Item_blank_node(lex->current_context(), "", this);
+}
+
+Item_blank_node* sparqlFrob::ensure_blank_node (const char *label) {
+  Item_blank_node* ret;
+  List_iterator<Item_blank_node> item_list_it(blank_nodes);
+  while ((ret = item_list_it++))
+  {
+    if (!strcmp(ret->name, label)) {
+      return ret;
+    }
+      //    if (curr_item->eq(this, 1))
+      //      DBUG_RETURN(FALSE); /* Already in the set. */
+  }
+
+  ret = new Item_blank_node(lex->current_context(), label, this);
+  blank_nodes.push_back(ret);
+  return ret;
+}
+
+Item_primary_key_field::Item_primary_key_field (
+			 Name_resolution_context *context_arg,
+			 const char *db_arg, const char *table_name_arg, 
+			 sparqlFrob *frob_arg, 
+			 const char* real_table_name_arg) :
+  Item_field(context_arg, db_arg, table_name_arg, "<pk>") {
+  frob = frob_arg;
+  real_table_name= real_table_name_arg;
+}
+bool Item_primary_key_field::fix_fields(THD *thd, Item **reference) {
+  field_name = frob->get_primary_key(real_table_name);
+  return Item_field::fix_fields(thd, reference);
+}
+
+Item_literal_string* sparqlFrob::ensure_string (LEX_STRING str, Item_POS *lang_or_datatype) {
+  Item_literal_string* ret;
+  List_iterator<Item_literal_string> item_list_it(strings);
+  while ((ret = item_list_it++))
+    if (!strncmp(ret->name, str.str, str.length) && ret->get_language_or_datatype() == lang_or_datatype) // !!! check len or "foo1"="foo"
+      return ret;
+  ret = new Item_literal_string(str, lang_or_datatype, thd->charset());
+  strings.push_back(ret);
+  return ret;
+}
+Item_literal_int* sparqlFrob::ensure_int (LEX_STRING str, Item_POS *lang_or_datatype) {
+  Item_literal_int* ret;
+  List_iterator<Item_literal_int> item_list_it(ints);
+  while ((ret = item_list_it++))
+    if (!strncmp(ret->name, str.str, str.length)) // !!! check len or "foo1"="foo"
+      return ret;
+  ret = new Item_literal_int(str, lang_or_datatype, thd->charset());
+  ints.push_back(ret);
+  return ret;
+}
+Item_literal_decimal* sparqlFrob::ensure_decimal (LEX_STRING str, Item_POS *lang_or_datatype) {
+  Item_literal_decimal* ret;
+  List_iterator<Item_literal_decimal> item_list_it(decimals);
+  while ((ret = item_list_it++))
+    if (!strncmp(ret->name, str.str, str.length)) // !!! check len or "foo1"="foo"
+      return ret;
+  ret = new Item_literal_decimal(str, lang_or_datatype, thd->charset());
+  decimals.push_back(ret);
+  return ret;
+}
+Item_literal_float* sparqlFrob::ensure_float (LEX_STRING str, Item_POS *lang_or_datatype) {
+  Item_literal_float* ret;
+  List_iterator<Item_literal_float> item_list_it(floats);
+  while ((ret = item_list_it++))
+    if (!strncmp(ret->name, str.str, str.length)) // !!! check len or "foo1"="foo"
+      return ret;
+  ret = new Item_literal_float(str, lang_or_datatype, thd->charset());
+  floats.push_back(ret);
+  return ret;
+}
+
+void sparqlFrob::select_variables () {
+  SELECT_LEX *sel= lex->current_select;  
+  sel->parsing_place= SELECT_LIST;
+  BindingContext *bc = last_context()->get_binding_context();
+
+  // If nothing was selected, we know there was a "SELECT *".
+  bool select_star= !lex->current_select->item_list.elements;
+
+  /**************************
+   * Handle the subselects. *
+   **************************/
+
+  // Walk the list of GraphContext sets
+  List_iterator<List<BindingGraphContext> > list_it(need_selects);
+  List<BindingGraphContext> *list;
+  while ((list= list_it++)) {
+
+    // Assemble a list of selected variables.
+    List<Item_variable> selected_vars;
+
+    // List of BindingGraphContexts that need newly added vars (starts with ()).
+    List<BindingGraphContext> passed_gcs;
+
+    // For each BindingGraphContext...
+    List_iterator<BindingGraphContext> gc_it(*list);
+    BindingGraphContext *gc;
+    while ((gc= gc_it++)) {
+
+      // Walk variables bound in this context.
+      List<Item_variable> *known_vars= gc->get_binding_context()->get_item_variables();
+      List_iterator<Item_variable> known_vars_it(*known_vars);
+      Item_variable *known_var;
+      while ((known_var= known_vars_it++)) {
+
+	// If the variable has no in parents refs, skip it.
+	if (!select_star && known_var->outer_has_no_refs())
+	  continue;
+
+	// If the variable was already selected, skip it.
+	bool stupid_continue_flag= false; // C doesn't have a labeled continue.
+	List_iterator<Item_variable> selected_vars_it(selected_vars);
+	Item_variable *selected_var;
+	while ((selected_var= selected_vars_it++))
+	  if (selected_var->same_variable(known_var->name)) {
+	    stupid_continue_flag= true;
+	    break;
+	  }
+	if (stupid_continue_flag)
+	  continue;
+
+	// known_var is referenced in a parent context and not yet selected in
+	// this UNION.
+
+	// Select in this gc...
+	gc->select_var(known_var, true);
+	//                  ...and all passed...
+	List_iterator<BindingGraphContext> passed_gcs_it(passed_gcs);
+	BindingGraphContext *passed_gc;
+	while ((passed_gc= passed_gcs_it++))
+	  passed_gc->select_var(known_var, false);// also sets binding in parent.
+	//                                   ...and future gcs.
+	List_iterator<BindingGraphContext> future_gcs_it= gc_it; // @@@ ca marche?
+	BindingGraphContext *future_gc;
+	while ((future_gc= future_gcs_it++)) {
+	  bool exists= Item_variable::match_var_in_list(future_gc->get_binding_context()->get_item_variables(), known_var->name) != NULL;
+	  future_gc->select_var(known_var, exists);
+	}
+
+	selected_vars.push_front(known_var); // It's selected now.
+      }
+      
+      passed_gcs.push_front(gc);
+    }
+  }    
+
+  if (select_star)
+    // Select known vars and update reference counts.
+    bc->select_star(thd);
+
+  sel->parsing_place= NO_MATTER;
+}
+
+void sparqlFrob::push_subject (Item_POS *subject) {
+  subjects.push_front(subject);
+}
+
+Item_POS* sparqlFrob::pop_subject () {
+  return subjects.pop();
+}
+
+void sparqlFrob::push_predicate (Item_POS *predicate) {
+  predicates.push_front(predicate);
+}
+
+void sparqlFrob::pop_predicate () {
+  predicates.pop();
+}
+
+int Simple_error (const char *format) {
+  my_printf_error(1, format, MYF(0));
+  return 1;
+}
+
+int Item_error (const char *format, Item *item) {
+  String pString;
+  item->print(&pString);
+  my_printf_error(1, format, MYF(0), pString.c_ptr());
+  return 1;
+}
+
+const char* scan_string (THD *thd, LEX_STRING *lex_string, const char *start, 
+			 const char *end, const char look_for) {
+  const char *ptr = end;
+  lex_string->length = 0;
+  for (; ; ) {
+    if (ptr == start) {
+      if (look_for) {
+	// we didn't find it
+	ptr = NULL;
+	lex_string->length = 0;
+	return NULL;
+      } else {
+	lex_string->str = thd->strmake(ptr, lex_string->length);
+	return ptr;
+      }
+    }
+    if (*ptr == look_for) {
+      --lex_string->length;
+      lex_string->str = thd->strmake(ptr+1, lex_string->length);
+      return ptr;
+    }
+    --ptr;
+    ++lex_string->length;
+  }
+}
+
+bool sparqlFrob::object (Item_POS *object) {
+  Item_POS* subject = subjects.head();
+  if (!predicates.head()->is_URI())
+    return Item_error("predicate must be a URI, not \"%s\"", predicates.head()->get_item());
+  Item_URI* predicate = (Item_URI*)predicates.head();
+  BindingContext *bc= head_context()->get_binding_context();
+  Alias_info *ai= bc->get_table_alias(thd, subject, predicate, object);
+  const char *ptr = head_context()->get_alias_string(ai, subject, thd);
+  if (!ptr)
+    return true;
+
+  object->bind_field(predicate->get_table().str, ptr, predicate->get_field().str, false, thd, NULL);
+  return false;
+}
+
+bool sparqlFrob::type_list () {
+  return Simple_error("Lists not supported");
+}
+
+bool sparqlFrob::add_listElement (Item_POS *item) {
+  return Item_error("Lists not supported -- can't add \"%s\"", item->get_item());
+}
+
+
+/* <BindingContext> */
+void BindingContext::select_star (THD *thd) {
+  List_iterator<Item_variable> list_it(item_variables);
+  Item_variable *ptr;
+  while ((ptr= list_it++))
+    add_item_to_list(thd, ptr);
+}
+Alias_info* BindingContext::get_table_alias (THD *thd, Item_POS *s, Item_URI *p, Item_POS *o) {
+  LEX_STRING table = p->get_table();
+  Alias_info *ai = NULL;
+  List_iterator<Alias_info> item_list_it(aliases);
+  Alias_info *t;
+  while ((t = item_list_it++)) {
+    if (t->same_table(table)) {
+      ai = t;
+      break;
+    }
+  }
+  if (!ai) {
+    ai = new Alias_info(table);
+    aliases.push_front(ai);
+  }
+  return ai;
+}
+
+/* ref_count -- 
+		0: child context looking for the variable in a parent context.
+		1: normal use
+ */
+Item_variable* BindingContext::ensure_bound_item_variable (const char *var, sparqlFrob *sparql_frob, int ref_count) {
+  List_iterator<Item_variable> item_list_it(item_variables);
+  Item_variable* ret;
+  while ((ret= item_list_it++))
+    if (ret->same_variable(var)) {
+      ret->add_ref_count(ref_count);
+      return ret;
+    }
+
+  Item_variable *outer= parent ? parent->ensure_bound_item_variable(var, 
+						        sparql_frob, 0) : NULL;
+  ret= new Item_variable(name_res_context, var, outer, sparql_frob, ref_count);
+  item_variables.push_back(ret);
+
+  return ret;
+}
+
+Item* BindingContext::get_bound_variable_constraints (Item *conjunction_constraints, GraphContext *gc) {
+  // Will need to write down our created constraints
+  List<Item> nulls;
+  List<Item> notNulls;
+  //  return NULL;
+  // Walk the list of our introduced variables.
+  List_iterator<Item_variable> item_list_it(item_variables);
+  Item_variable *t;
+  while ((t = item_list_it++)) {
+    if (gc->is_optional()) {
+      nulls.push_front(new Item_func_isnull(t));
+    }
+    notNulls.push_front(new Item_func_isnotnull(t));
+  }
+  if (conjunction_constraints)
+    notNulls.push_front(conjunction_constraints);
+  Item *nulls_cond = nulls.elements ? new Item_cond_and(nulls) : NULL;
+  Item *notNulls_cond = notNulls.elements ? new Item_cond_and(notNulls) : NULL;
+  if (nulls_cond && notNulls_cond) {
+    List<Item> *or_cond = new List<Item>;
+    or_cond->push_front(nulls_cond);
+    or_cond->push_front(notNulls_cond);
+    return new Item_cond_or(*or_cond);
+  }
+  // It is impossible that we have nulls and no notNulls to return notNulls.
+  return notNulls_cond;
+}
+void BindingContext::start_constraints () {
+  mysql_init_select(lex);
+  name_res_context= lex->current_context();
+  constraints= new List<Item>;
+  lex->select_lex.expr_list.push_front(constraints); // current_select->
+}
+/* </BindingContext> */
+
+
+Item_URI::Item_URI(Name_resolution_context *context_arg, LEX_STRING uri, THD *thd) : 
+  Item_field(context_arg, NullS, NullS, uri.str), Item_POS(this) {
+  const char* ptr = scan_string(thd, &value, name, name + uri.length, '=');
+  if ((ptr = scan_string(thd, &field, name, ptr ? ptr : name + uri.length, '.'))) {
+    scan_string(thd, &table, name, ptr ? ptr : name + uri.length, 0);
+  }
+}
+void Item_URI::bind_field(const char *table_name, const char *alias, 
+			  const char *field_name_arg, bool trump, 
+			  THD *thd, TABLE_LIST *jt) {
+  LEX *lex= thd->lex;
+  SELECT_LEX *sel= lex->current_select;
+  chooser_compare_func_creator eq = &comp_eq_creator;
+  LEX_STRING value = get_value();
+  cout << "WHERE " << alias << "." << get_field().str << "=" << value.str << endl;
+  Item* idI = new Item_field(lex->current_context(), NullS, alias, get_field().str);
+  int error;
+  Item* val = new Item_int(value.str, (longlong) my_strtoll10(value.str, NULL, &error), value.length);
+  Item* test = eq(0)->create(idI, val);
+  sel->expr_list.head()->push_back(test);
+  test->top_level_item();
+  if (jt) {
+    SELECT_LEX *sel= lex->current_select;
+    sel->add_joined_table(jt);
+  }
+}
+void Item_URI::print(String *str)
+{
+  str->append('<');
+  str->append(name);
+  str->append('>');
+}
+
+
+/* <Item_variable> */
+Item_variable::Item_variable(Name_resolution_context *context_arg, 
+			     const char *variable_name, Item_variable *outer_arg, 
+			     sparqlFrob *frob_arg, int ref_count_arg) : 
+  Item_field(context_arg, NullS, NullS, variable_name), Item_POS(this) {
+  set_name(variable_name, strlen(variable_name), system_charset_info);
+  is_autogenerated_name= FALSE;
+  nr_context= context_arg;
+  bound= false;
+  outer= outer_arg;
+  frob= frob_arg;
+  primary_key= false;
+  gc= frob->head_context();
+  jt= NULL;
+  ref_count= ref_count_arg;
+}
+Item* Item_variable::make_Item_field(Name_resolution_context *context_arg,
+				     const char *db_arg,
+				     const char *table_name_arg,
+				     const char *field_name_arg, 
+				     const char* real_table_name) {
+  return field_name_arg ? new Item_field(context_arg, db_arg, 
+					 table_name_arg, field_name_arg) :
+    new Item_primary_key_field(context_arg, db_arg, 
+			       table_name_arg, frob, real_table_name);
+}
+void Item_variable::bind_field(const char *table_name_arg, const char *alias, 
+			       const char *field_name_arg, bool trump, 
+			       THD *thd, TABLE_LIST *jt_param) {
+  LEX *lex= thd->lex;
+  if (jt_param && (!jt || trump)) {
+    //    assert(!jt);
+    jt = jt_param;
+    SELECT_LEX *sel= lex->current_select;
+    sel->add_joined_table(jt);
+  }
+  if (jt && bound) {
+    cout << " ON " << table_name << "." << (primary_key ? "<pk>" : field_name) << " = " << alias << "." << (field_name_arg ? field_name_arg : "<pk>") << endl; // !!!
+    Item* l = make_Item_field(lex->current_context(), NullS, table_name, primary_key ? NULL : field_name, real_table_name);
+    Item* r = make_Item_field(lex->current_context(), NullS, alias, field_name_arg, table_name_arg);
+    chooser_compare_func_creator eq = &comp_eq_creator;
+    Item* on = eq(0)->create(l, r);
+    add_join_on(jt, on);
+  }
+  if (!bound || trump) {
+    cout << "  " << alias << "." << (field_name_arg ? field_name_arg : "<pk>") << " AS \"" << name << "\"" << endl;
+    table_name = (char*) alias;
+    if (field_name_arg) {
+      field_name = (char*) field_name_arg;
+      primary_key = false;
+    } else {
+      primary_key = true;
+      real_table_name = table_name_arg;
+    }
+    bound = true;
+    // name = (char*) field_name;
+  }
+}
+bool Item_variable::fix_fields(THD *thd, Item **reference) {
+  if (primary_key)
+    if (!(field_name = get_primary_key()))
+      return true; // signal an error
+  return Item_field::fix_fields(thd, reference);
+}
+Item_variable* Item_variable::match_var_in_list (List<Item_variable> *p_item_variables, const char *var) {
+  List_iterator<Item_variable> item_list_it(*p_item_variables);
+  Item_variable* ret;
+  while ((ret= item_list_it++))
+    if (ret->same_variable(var)) {
+      return ret;
+    }
+  return NULL;
+}
+Item* Item_variable::get_null_item() {
+  Item *ret= new Item_null();
+  ret->set_name(name, strlen(name), system_charset_info);
+  ret->is_autogenerated_name= FALSE;
+  return ret;
+}
+/* virtual overload of Item::send, which is called when serializing the results.
+ */
+bool Item_variable::send(Protocol *protocol, String *buffer)
+{
+  bool result;
+  String *res;
+  if (primary_key) {
+    if ((res=val_str(buffer))) {
+      // Return something in the form of "<Orders.id=2186>".
+      size_t len = 1+strlen(real_table_name)+1+strlen(field_name)+1+res->length()+1;
+      // Assume res->charset() is compatible with ASCII.
+      // Otherwise, we'd need to convert names et all to res->charset().
+      char space[len+1];
+      space[0] = '<';
+      strcpy(space+1, real_table_name);
+      strcat(space, ".");
+      strcat(space, field_name);
+      strcat(space, "=");
+      strncat(space, res->ptr(), res->length());
+      space[len-1] = '>';
+      space[len] = 0;
+      return protocol->store(space,len,res->charset());
+    } else
+      return protocol->store_null();
+  } else
+    return protocol->store(result_field);
+
+  //    return protocol->store(result_field);
+}
+void Item_variable::print(String *str)
+{
+  Item::print(str);
+  str->append("{?");
+  str->append(name);
+  str->append('}');
+}
+/* </Item_variable> */
+
+
+void Item_blank_node::print(String *str)
+{
+  Item::print(str);
+  str->append("[_:");
+  str->append(name);
+  str->append(']');
+}
+void Item_literal_string::bind_field(const char *table_name, const char *alias, 
+				     const char *field_name_arg, bool trump, 
+				     THD *thd, TABLE_LIST *jt) {
+  cout << "WHERE " << alias << "." << field_name_arg << "=\"" << name << "\"" << endl;
+  LEX *lex= thd->lex;
+  Item* idI = new Item_field(lex->current_context(), NullS, alias, field_name_arg);
+  chooser_compare_func_creator eq = &comp_eq_creator;
+  Item* test = eq(0)->create(idI, get_item());
+  SELECT_LEX *sel= lex->current_select;
+  sel->expr_list.head()->push_back(test);
+  test->top_level_item();
+  if (jt) {
+    sel->add_joined_table(jt);
+  }
+}
+void Item_literal_string::print(String *str)
+{
+  str->append('\'');
+  str->append(name);
+  str->append('\'');
+}
+void Item_literal_int::bind_field(const char *table_name, const char *alias, 
+				  const char *field_name_arg, bool trump, 
+				  THD *thd, TABLE_LIST *jt) {
+  cout << "WHERE " << alias << "." << field_name_arg << "=\"" << name << "\"" << endl;
+  LEX *lex= thd->lex;
+  Item* idI = new Item_field(lex->current_context(), NullS, alias, field_name_arg);
+  chooser_compare_func_creator eq = &comp_eq_creator;
+  Item* test = eq(0)->create(idI, get_item());
+  SELECT_LEX *sel= lex->current_select;
+  sel->expr_list.head()->push_back(test);
+  test->top_level_item();
+  if (jt) {
+    sel->add_joined_table(jt);
+  }
+}
+void Item_literal_int::print(String *str)
+{
+  str->append(name);
+}
+void Item_literal_decimal::bind_field(const char *table_name, const char *alias, 
+				      const char *field_name_arg, bool trump, 
+				      THD *thd, TABLE_LIST *jt) {
+  cout << "WHERE " << alias << "." << field_name_arg << "=\"" << name << "\"" << endl;
+  LEX *lex= thd->lex;
+  Item* idI = new Item_field(lex->current_context(), NullS, alias, field_name_arg);
+  chooser_compare_func_creator eq = &comp_eq_creator;
+  Item* test = eq(0)->create(idI, get_item());
+  SELECT_LEX *sel= lex->current_select;
+  sel->expr_list.head()->push_back(test);
+  test->top_level_item();
+  if (jt) {
+    sel->add_joined_table(jt);
+  }
+}
+void Item_literal_decimal::print(String *str)
+{
+  str->append(name);
+}
+void Item_literal_float::bind_field(const char *table_name, const char *alias, 
+				    const char *field_name_arg, bool trump, 
+				    THD *thd, TABLE_LIST *jt) {
+  cout << "WHERE " << alias << "." << field_name_arg << "=\"" << name << "\"" << endl;
+  LEX *lex= thd->lex;
+  Item* idI = new Item_field(lex->current_context(), NullS, alias, field_name_arg);
+  chooser_compare_func_creator eq = &comp_eq_creator;
+  Item* test = eq(0)->create(idI, get_item());
+  SELECT_LEX *sel= lex->current_select;
+  sel->expr_list.head()->push_back(test);
+  test->top_level_item();
+  if (jt) {
+    sel->add_joined_table(jt);
+  }
+}
+void Item_literal_float::print(String *str)
+{
+  str->append(name);
+}
+const char* GraphContext::get_alias_string (Alias_info *ai, Item_POS *s, THD *thd) {
+  List_iterator<Item_POS> item_list_it(ai->subjects);
+  Item_POS *t;
+  size_t i= 0;
+  bool found= false;
+  while ((t= item_list_it++)) {
+    if (t == s) {
+      found= true;
+      break;
+    }
+    ++i;
+  }
+  char space[ai->table.length+1+1+1];
+  strncpy(space, ai->table.str, ai->table.length);
+  space[ai->table.length]= '_';
+  space[ai->table.length+1]= '0'+i;
+  space[ai->table.length+2]= 0;
+  const char *ret= thd->strmake(space, ai->table.length+1+1+1);
+  if (!found) {
+    ai->subjects.push_front(s);
+    Table_ident* table_i= new Table_ident(ai->table);
+    LEX *lex= thd->lex;
+    SELECT_LEX* sel= lex->current_select; // &lex->select_lex;
+    LEX_STRING *alias= new LEX_STRING;
+    alias->str= (char*)ret;
+    alias->length= ai->table.length+2;
+    cout << "FROM " << ai->table.str << " AS " << alias->str << endl;
+    TABLE_LIST *jt= sel->add_table_to_list(lex->thd, table_i, alias,
+					   sel->get_table_join_options(),
+					   lex->lock_option,
+					   sel->get_use_index(),
+					   sel->get_ignore_index());
+    if (!jt)
+      return NULL;
+    if (is_optional())
+      jt->outer_join|=JOIN_TYPE_LEFT;
+    if (s->is_URI()) {
+      Item_URI *sURI= (Item_URI*)s;
+      chooser_compare_func_creator eq= &comp_eq_creator;
+      LEX_STRING value= sURI->get_value();
+      cout << "WHERE " << alias->str << "." << sURI->get_field().str << "=" << value.str << endl;
+      Item* idI= new Item_field(lex->current_context(), NullS, alias->str, sURI->get_field().str);
+      int error;
+      Item* val= new Item_int(value.str, (longlong) my_strtoll10(value.str, NULL, &error), value.length);
+      Item* test= eq(0)->create(idI, val);
+      sel->expr_list.head()->push_back(test);
+      test->top_level_item();
+      sel->add_joined_table(jt);
+    } else if (s->is_variable()) {
+      s->bind_field(ai->table.str, ret, NULL, true, thd, jt);
+    }
+  }
+  return ret;
+}
+
+
+/* <BindingGraphContext> */
+BindingGraphContext::BindingGraphContext (GraphContext *parent_param, sparqlFrob *sparql_frob_param) : 
+  GraphContext (parent_param, sparql_frob_param) {
+  bindings= new BindingContext(this, parent ? parent->get_binding_context() : NULL, 
+			       sparql_frob->lex);
+  current_select= NULL;
+}
+
+void BindingGraphContext::select_var (Item_variable *var, bool exists) {
+  cout << (void*)this << " SELECTs " << (exists ? "" : "NULL AS ") << var->name << endl;
+  current_select->add_item_to_list(thd, exists ? var->get_item() :  
+						 var->get_null_item());
+}
+/* </BindingGraphContext> */
+
+
+/* <RootGraphContext> */
+RootGraphContext::RootGraphContext (GraphContext *parent, 
+				    sparqlFrob *sparql_frob) : 
+  BindingGraphContext(parent, sparql_frob) {
+  bindings->start_constraints();
+  current_select= sparql_frob->lex->current_select;
+}
+/* </RootGraphContext> */
+
+
+/* <Union1GraphContext> */
+Union1GraphContext::Union1GraphContext (GraphContext *parent, 
+					sparqlFrob *sparql_frob) : 
+  BindingGraphContext(parent, sparql_frob) {
+  LEX *lex= thd->lex;
+  lex->current_select->init_nested_join(thd);
+  lex->current_select->end_nested_join(thd);
+  lex->derived_tables|= DERIVED_SUBQUERY;
+  mysql_new_select(lex, 1);
+  current_select= sparql_frob->lex->current_select;
+  bindings->start_constraints();
+  lex->current_select->linkage= DERIVED_TABLE_TYPE;
+}
+void Union1GraphContext::close () {
+  thd->lex->current_select->init_nested_join(thd);
+  //    thd->lex->current_select->init_nested_join(thd);
+  thd->lex->current_select->end_nested_join(thd);
+  bindings->end_and_check_constraints();
+}
+/* </Union1GraphContext> */
+
+
+/* <Union1GraphContext> */
+Union2GraphContext::Union2GraphContext (GraphContext *parent, 
+					sparqlFrob *sparql_frob) : 
+  BindingGraphContext(parent, sparql_frob) {
+  left= (BindingGraphContext*)sparql_frob->last_context();
+  LEX *lex= thd->lex;
+
+  lex->current_select = left->current_select; // next function called with left select
+  if (mysql_new_select(lex, 0)) // sets the new lex->current_select
+    assert(0);
+  current_select= sparql_frob->lex->current_select;
+  bindings->start_constraints();
+  lex->current_select->linkage=UNION_TYPE;
+  if (sparql_frob->get_distinct()) /* UNION DISTINCT - remember position */
+    lex->current_select->master_unit()->union_distinct=
+      lex->current_select;
+}
+void Union2GraphContext::close () {
+  LEX *lex= thd->lex;
+
+  lex->pop_context();
+  SELECT_LEX *sel= lex->current_select;
+  SELECT_LEX_UNIT *unit= sel->master_unit();
+  lex->current_select= sel= unit->outer_select();
+  TABLE_LIST *t;
+  if (!(t = sel->
+	add_table_to_list(thd, new Table_ident(unit),
+			  sparql_frob->next_union_alias(), 0,
+			  TL_READ,(List<String> *)0,
+			  (List<String> *)0)))
+
+    assert(0);
+  sel->add_joined_table(t);
+  lex->pop_context();
+
+  Item *as= ((Union1GraphContext*)left)->map_variables_to_outer_context();
+  cout << "SPARQL: close Union2 {" << endl << buf->str() << "}" << endl;
+  bindings->end_and_check_constraints();
+}
+/* </Union1GraphContext> */
+
+
+Item_URI *XSD_integer= NULL;
+Item_URI *XSD_float= NULL;
+Item_URI *XSD_decimal= NULL;
+String Global_string;
+
+/* <Buf> */
+Buf::Buf(char *str) {
+  len = strlen(str);
+  data = new char[len+1];
+  strncpy(data, str, len);
+  data[len] = 0;
+}
+/* Build a space-separated concatonation of bufs. */
+Buf::Buf(int count, ...) {
+  va_list bufs;
+  const Buf *src;
+
+  // This is inefficient for a single buf as the created buf could
+  // just steal the other buf's data pointer and delete it.
+
+  // Walk args to find the total len.
+  len = -1;
+  va_start(bufs, count);
+  for (int i = 0; i < count; i++) {
+    src = va_arg(bufs, Buf*);
+    len += src->len+1;
+  }
+  va_end(bufs);
+
+  data = new char[len+1];
+
+  // Walk args to fill the data buffer.
+  len = -1;
+  va_start(bufs, count);
+  for (int i = 0; i < count; i++) {
+    src = va_arg(bufs, Buf*);
+    strncpy(data + len+1, src->data, src->len);
+    len += src->len+1;
+    data[len] = ' ';
+    delete src;
+    src = 0;
+  }
+  va_end(bufs);
+  data[len] = 0;
+}
+/* </Buf> */
+
+// $Log: mysql+sparql-server-5.0.41.patch,v $
+// Revision 1.1  2007-09-05 19:20:45  eric
+// ~ backing docs in http://www.w3.org/2005/05/22-SPARQL-MySQL/
+//
+// Revision 1.1  2006/12/16 15:35:23  eric
+// ~ test build
+//
+// Revision 1.3  2006/12/16 14:08:23  eric
+// ~ beacoup aesthetic changes
+// ~ s/Item_POS_/Item_literal_/g
+//
+// Revision 1.2  2006/12/16 02:22:40  eric
+// + primary keys return the URI identifying their tuple (as they are written in queries)
+//
+// Revision 1.1  2006/12/15 14:45:17  eric
+// import from cvs://cvs.w3.org/WWW/2005/05/22-SPARQL-MySQL/
+//
+// Revision 1.35  2006/05/26 18:49:51  eric
+// progress on UNIONs
+//
+// Revision 1.34  2006/05/23 09:05:24  eric
+// UNION fleshed out, needs debugging
+//
+// Revision 1.33  2006/05/11 19:15:47  eric
+// first pass at BindingContext architecture
+//
+// Revision 1.32  2006/05/01 06:39:56  eric
+// + tollerance for foreign key ambiguity
+// ~ valgrind: free[], initialize Item_variable::jt
+//
+// Revision 1.31  2006/04/29 22:06:17  eric
+// + INTEGER
+// + DECIMAL
+// + DOUBLE (well, Item_float)
+//
+// Revision 1.30  2006/04/29 21:08:26  eric
+// - pruning
+// ~ fixed strncmp (erroneous match on substring) error and marked another
+// - YYTHD macros
+//
+// Revision 1.29  2006/04/29 16:53:27  eric
+// ~ simplified get_primary_key (complicated by previous extension tables commit)
+//
+// Revision 1.28  2006/04/29 16:45:03  eric
+// + extension tables (tables with the same primary key as another -- both are likely to be ?s)
+//
+// Revision 1.27  2006/04/23 01:34:25  eric
+// ~ OPTIONAL using nested JOINs
+//
+// Revision 1.26  2006/04/17 09:53:57  eric
+// + postpone putting variables in a context until we have the context
+//
+// Revision 1.25  2006/04/17 01:13:22  eric
+// + OPTIONAL
+//
+// Revision 1.24  2006/04/16 23:29:00  eric
+// + start on OPTIONALS
+//
+// Revision 1.23  2006/04/16 11:23:16  eric
+// + DISTINCT
+// + ORDER BY
+// + LIMIT
+// + OFFSET
+//
+// Revision 1.22  2006/04/16 08:44:03  eric
+// + labeled blank nodes
+//
+// Revision 1.21  2006/04/15 20:27:59  eric
+// + active POS casting to make exprs work
+//
+// Revision 1.20  2006/04/15 16:18:12  eric
+// - cleaned slightly
+//
+// Revision 1.19  2006/04/15 15:32:20  eric
+// + late-binding primary keys
+//
+// Revision 1.18  2006/04/13 23:52:11  eric
+// + framed out Item_primary_key_field
+// + expr on down compiling -- need to re-derive POS_string from a constant Item_ class
+//
+// Revision 1.17  2006/04/12 16:24:35  eric
+// + using sel->expr_list to collect outermost WHERE conjunction
+//
+// Revision 1.16  2006/04/12 14:48:03  eric
+// - reduced casting
+//
+// Revision 1.15  2006/04/11 13:20:02  eric
+// + parser errors => YYABORT
+//
+// Revision 1.14  2006/04/11 11:46:45  eric
+// added CVS tags
+//
+//
--- mysql-dfsg-5.0-5.0.41/sparql/sparqlScanner.ll	1970-01-01 01:00:00.000000000 +0100
+++ mysql-dfsg-5.0-5.0.41-spasql/sparql/sparqlScanner.ll	2006-12-14 14:33:42.000000000 +0100
@@ -0,0 +1,235 @@
+%{ 
+#ifndef FLEXFIX
+#define FLEXFIX YY_sparqlParser_STYPE *val
+#define FLEXFIX2 val
+#endif
+#include "sparqlParser.h"
+
+#define YY_INPUT(buf,result,max_size) \
+	if ( (result = LexerReadStatic( (char *) buf, max_size )) < 0 ) \
+		YY_FATAL_ERROR( "input in flex scanner failed" );
+%}
+
+IT_BASE		"BASE"
+IT_PREFIX		"PREFIX"
+IT_SELECT		"SELECT"
+IT_DISTINCT		"DISTINCT"
+GT_TIMES		"*"
+IT_CONSTRUCT		"CONSTRUCT"
+IT_DESCRIBE		"DESCRIBE"
+IT_ASK		"ASK"
+IT_FROM		"FROM"
+IT_NAMED		"NAMED"
+IT_WHERE		"WHERE"
+IT_ORDER		"ORDER"
+IT_BY		"BY"
+IT_ASC		"ASC"
+IT_DESC		"DESC"
+IT_LIMIT		"LIMIT"
+IT_OFFSET		"OFFSET"
+GT_LCURLEY		"{"
+GT_RCURLEY		"}"
+GT_DOT		"."
+IT_OPTIONAL		"OPTIONAL"
+IT_GRAPH		"GRAPH"
+IT_UNION		"UNION"
+IT_FILTER		"FILTER"
+GT_COMMA		","
+GT_LPAREN		"("
+GT_RPAREN		")"
+GT_SEMI		";"
+IT_a		"a"
+GT_LBRACKET		"\["
+GT_RBRACKET		"\]"
+GT_MINUS		"-"
+GT_PLUS		"+"
+GT_OR		"||"
+GT_AND		"&&"
+GT_EQUAL		"="
+GT_NEQUAL		"!="
+GT_LT		"<"
+GT_GT		">"
+GT_LE		"<="
+GT_GE		">="
+GT_DIVIDE		"/"
+GT_NOT		"!"
+IT_STR		"STR"
+IT_LANG		"LANG"
+IT_LANGMATCHES		"LANGMATCHES"
+IT_DATATYPE		"DATATYPE"
+IT_BOUND		"BOUND"
+IT_isIRI		"isIRI"
+IT_isURI		"isURI"
+IT_isBLANK		"isBLANK"
+IT_isLITERAL		"isLITERAL"
+IT_REGEX		"REGEX"
+GT_DTYPE		"^^"
+IT_true		"true"
+IT_false		"false"
+Q_IRI_REF		"<"(([!-&(-;=?-\]_a-z~-\x7F]|([\xC2-\xDF][\x80-\xBF])|(\xE0([\xA0-\xBF][\x80-\xBF]))|([\xE1-\xEC][\x80-\xBF][\x80-\xBF])|([\xE1-\xEC][\x80-\xBF][\x80-\xBF])|(\xED([\x80-\x9F][\x80-\xBF]))|([\xEE-\xEF][\x80-\xBF][\x80-\xBF])|(\xF0([\x90-\xBF][\x80-\xBF][\x80-\xBF]))|([\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF])|(\xF4([\x80-\x8E][\x80-\xBF][\x80-\xBF])|(\x8F([\x80-\xBE][\x80-\xBF])|(\xBF[\x80-\xBE])))]))*">"
+LANGTAG		"@"([A-Za-z])+(("-"([0-9A-Za-z])+))*
+INTEGER		([0-9])+
+DECIMAL		(([0-9])+"."([0-9])*)|("."([0-9])+)
+EXPONENT		[Ee]([+-])?([0-9])+
+DOUBLE		(([0-9])+"."([0-9])*({EXPONENT}))|(("."(([0-9]))+({EXPONENT}))|((([0-9]))+({EXPONENT})))
+ECHAR		"\\"[\"'\\bfnrt]
+HEX		([0-9])|(([A-F])|([a-f]))
+UCHAR		"\\"(("u"({HEX})({HEX})({HEX})({HEX}))|("U"({HEX})({HEX})({HEX})({HEX})({HEX})({HEX})({HEX})({HEX})))
+STRING_LITERAL1		"'"(((([\x00-\t\x0B-\x0C\x0E-&(-\[\]-\x7F]|([\xC2-\xDF][\x80-\xBF])|(\xE0([\xA0-\xBF][\x80-\xBF]))|([\xE1-\xEC][\x80-\xBF][\x80-\xBF])|([\xE1-\xEC][\x80-\xBF][\x80-\xBF])|(\xED([\x80-\x9F][\x80-\xBF]))|([\xEE-\xEF][\x80-\xBF][\x80-\xBF])|(\xF0([\x90-\xBF][\x80-\xBF][\x80-\xBF]))|([\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF])|(\xF4([\x80-\x8E][\x80-\xBF][\x80-\xBF])|(\x8F([\x80-\xBE][\x80-\xBF])|(\xBF[\x80-\xBE])))]))|((({ECHAR}))|(({UCHAR})))))*"'"
+STRING_LITERAL2		"\""(((([\x00-\t\x0B-\x0C\x0E-!#-\[\]-\x7F]|([\xC2-\xDF][\x80-\xBF])|(\xE0([\xA0-\xBF][\x80-\xBF]))|([\xE1-\xEC][\x80-\xBF][\x80-\xBF])|([\xE1-\xEC][\x80-\xBF][\x80-\xBF])|(\xED([\x80-\x9F][\x80-\xBF]))|([\xEE-\xEF][\x80-\xBF][\x80-\xBF])|(\xF0([\x90-\xBF][\x80-\xBF][\x80-\xBF]))|([\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF])|(\xF4([\x80-\x8E][\x80-\xBF][\x80-\xBF])|(\x8F([\x80-\xBE][\x80-\xBF])|(\xBF[\x80-\xBE])))]))|((({ECHAR}))|(({UCHAR})))))*"\""
+STRING_LITERAL_LONG1		"'''"((((("'")|("''")))?(([\x00-&(-\[\]-\x7F]|([\xC2-\xDF][\x80-\xBF])|(\xE0([\xA0-\xBF][\x80-\xBF]))|([\xE1-\xEC][\x80-\xBF][\x80-\xBF])|([\xE1-\xEC][\x80-\xBF][\x80-\xBF])|(\xED([\x80-\x9F][\x80-\xBF]))|([\xEE-\xEF][\x80-\xBF][\x80-\xBF])|(\xF0([\x90-\xBF][\x80-\xBF][\x80-\xBF]))|([\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF])|(\xF4([\x80-\x8E][\x80-\xBF][\x80-\xBF])|(\x8F([\x80-\xBE][\x80-\xBF])|(\xBF[\x80-\xBE])))])|((({ECHAR}))|(({UCHAR}))))))*"'''"
+STRING_LITERAL_LONG2		"\"\"\""((((("\"")|("\"\"")))?(([\x00-!#-\[\]-\x7F]|([\xC2-\xDF][\x80-\xBF])|(\xE0([\xA0-\xBF][\x80-\xBF]))|([\xE1-\xEC][\x80-\xBF][\x80-\xBF])|([\xE1-\xEC][\x80-\xBF][\x80-\xBF])|(\xED([\x80-\x9F][\x80-\xBF]))|([\xEE-\xEF][\x80-\xBF][\x80-\xBF])|(\xF0([\x90-\xBF][\x80-\xBF][\x80-\xBF]))|([\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF])|(\xF4([\x80-\x8E][\x80-\xBF][\x80-\xBF])|(\x8F([\x80-\xBE][\x80-\xBF])|(\xBF[\x80-\xBE])))])|((({ECHAR}))|(({UCHAR}))))))*"\"\"\""
+WS		(" ")|(("\t")|(("\r")|("\n")))
+NIL		"("(({WS}))*")"
+ANON		"\["(({WS}))*"\]"
+NCCHAR1p		([A-Z])|(([a-z])|(((\xC3[\x80-\x96]))|(((\xC3[\x98-\xB6]))|(((\xC3[\xB8-\xBF])|([\xC4-\xCB][\x80-\xBF]))|(((\xCD[\xB0-\xBD]))|(((\xCD\xBF)|([\xCE-\xDF][\x80-\xBF])|(\xE0([\xA0-\xBF][\x80-\xBF]))|(\xE1([\x80-\xBF][\x80-\xBF])))|(((\xE2(\x80[\x8C-\x8D])))|(((\xE2(\x81[\xB0-\xBF])|([\x82-\x85][\x80-\xBF])|(\x86[\x80-\x8F])))|(((\xE2([\xB0-\xBE][\x80-\xBF])|(\xBF[\x80-\xAF])))|(((\xE3(\x80[\x81-\xBF])|([\x81-\xBF][\x80-\xBF]))|([\xE4-\xEC][\x80-\xBF][\x80-\xBF])|([\xE1-\xEC][\x80-\xBF][\x80-\xBF])|(\xED([\x80-\x9F][\x80-\xBF])))|(((\xEF([\xA4-\xB6][\x80-\xBF])|(\xB7[\x80-\x8F])))|(((\xEF(\xB7[\xB0-\xBF])|([\xB8-\xBE][\x80-\xBF])|(\xBF[\x80-\xBD])))|(((\xF0([\x90-\xBF][\x80-\xBF][\x80-\xBF]))|([\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF]))|(({UCHAR})))))))))))))))
+NCCHAR1		(({NCCHAR1p}))|("_")
+VARNAME		((({NCCHAR1}))|([0-9]))(((({NCCHAR1}))|(([0-9])|((\xC2\xB7)|(((\xCD[\x80-\xAF]))|((\xE2(\x80\xBF)|(\x81\x80))))))))*
+VAR2		"$"({VARNAME})
+VAR1		"?"({VARNAME})
+NCCHAR		(({NCCHAR1}))|(("-")|(([0-9])|((\xC2\xB7)|(((\xCD[\x80-\xAF]))|((\xE2(\x80\xBF)|(\x81\x80)))))))
+NCNAME_PREFIX		({NCCHAR1p})(((((({NCCHAR}))|(".")))*({NCCHAR})))?
+QNAME_NS		(({NCNAME_PREFIX}))?":"
+NCNAME		({NCCHAR1})(((((({NCCHAR}))|(".")))*({NCCHAR})))?
+BLANK_NODE_LABEL		"_:"({NCNAME})
+QNAME		(({NCNAME_PREFIX}))?":"(({NCNAME}))?
+PASSED_TOKENS		([\t\n\r ])+
+%%
+{PASSED_TOKENS}
+{IT_BASE}		{return sparqlParser::IT_BASE;}
+{IT_PREFIX}		{val->buf = new Buf(yytext); return sparqlParser::IT_PREFIX;}
+{IT_SELECT}		{return sparqlParser::IT_SELECT;}
+{IT_DISTINCT}		{val->buf = new Buf(yytext); return sparqlParser::IT_DISTINCT;}
+{GT_TIMES}		{val->buf = new Buf(yytext); return sparqlParser::GT_TIMES;}
+{IT_CONSTRUCT}		{val->buf = new Buf(yytext); return sparqlParser::IT_CONSTRUCT;}
+{IT_DESCRIBE}		{val->buf = new Buf(yytext); return sparqlParser::IT_DESCRIBE;}
+{IT_ASK}		{val->buf = new Buf(yytext); return sparqlParser::IT_ASK;}
+{IT_FROM}		{val->buf = new Buf(yytext); return sparqlParser::IT_FROM;}
+{IT_NAMED}		{val->buf = new Buf(yytext); return sparqlParser::IT_NAMED;}
+{IT_WHERE}		{val->buf = new Buf(yytext); return sparqlParser::IT_WHERE;}
+{IT_ORDER}		{val->buf = new Buf(yytext); return sparqlParser::IT_ORDER;}
+{IT_BY}		{val->buf = new Buf(yytext); return sparqlParser::IT_BY;}
+{IT_ASC}		{val->buf = new Buf(yytext); return sparqlParser::IT_ASC;}
+{IT_DESC}		{val->buf = new Buf(yytext); return sparqlParser::IT_DESC;}
+{IT_LIMIT}		{val->buf = new Buf(yytext); return sparqlParser::IT_LIMIT;}
+{IT_OFFSET}		{val->buf = new Buf(yytext); return sparqlParser::IT_OFFSET;}
+{GT_LCURLEY}		{val->buf = new Buf(yytext); return sparqlParser::GT_LCURLEY;}
+{GT_RCURLEY}		{val->buf = new Buf(yytext); return sparqlParser::GT_RCURLEY;}
+{GT_DOT}		{val->buf = new Buf(yytext); return sparqlParser::GT_DOT;}
+{IT_OPTIONAL}		{val->buf = new Buf(yytext); return sparqlParser::IT_OPTIONAL;}
+{IT_GRAPH}		{val->buf = new Buf(yytext); return sparqlParser::IT_GRAPH;}
+{IT_UNION}		{val->buf = new Buf(yytext); return sparqlParser::IT_UNION;}
+{IT_FILTER}		{val->buf = new Buf(yytext); return sparqlParser::IT_FILTER;}
+{GT_COMMA}		{val->buf = new Buf(yytext); return sparqlParser::GT_COMMA;}
+{GT_LPAREN}		{val->buf = new Buf(yytext); return sparqlParser::GT_LPAREN;}
+{GT_RPAREN}		{val->buf = new Buf(yytext); return sparqlParser::GT_RPAREN;}
+{GT_SEMI}		{val->buf = new Buf(yytext); return sparqlParser::GT_SEMI;}
+{IT_a}		{val->buf = new Buf(yytext); return sparqlParser::IT_a;}
+{GT_LBRACKET}		{val->buf = new Buf(yytext); return sparqlParser::GT_LBRACKET;}
+{GT_RBRACKET}		{val->buf = new Buf(yytext); return sparqlParser::GT_RBRACKET;}
+{GT_MINUS}		{val->buf = new Buf(yytext); return sparqlParser::GT_MINUS;}
+{GT_PLUS}		{val->buf = new Buf(yytext); return sparqlParser::GT_PLUS;}
+{GT_OR}		{val->buf = new Buf(yytext); return sparqlParser::GT_OR;}
+{GT_AND}		{val->buf = new Buf(yytext); return sparqlParser::GT_AND;}
+{GT_EQUAL}		{val->buf = new Buf(yytext); return sparqlParser::GT_EQUAL;}
+{GT_NEQUAL}		{val->buf = new Buf(yytext); return sparqlParser::GT_NEQUAL;}
+{GT_LT}		{val->buf = new Buf(yytext); return sparqlParser::GT_LT;}
+{GT_GT}		{val->buf = new Buf(yytext); return sparqlParser::GT_GT;}
+{GT_LE}		{val->buf = new Buf(yytext); return sparqlParser::GT_LE;}
+{GT_GE}		{val->buf = new Buf(yytext); return sparqlParser::GT_GE;}
+{GT_DIVIDE}		{val->buf = new Buf(yytext); return sparqlParser::GT_DIVIDE;}
+{GT_NOT}		{val->buf = new Buf(yytext); return sparqlParser::GT_NOT;}
+{IT_STR}		{val->buf = new Buf(yytext); return sparqlParser::IT_STR;}
+{IT_LANG}		{val->buf = new Buf(yytext); return sparqlParser::IT_LANG;}
+{IT_LANGMATCHES}		{val->buf = new Buf(yytext); return sparqlParser::IT_LANGMATCHES;}
+{IT_DATATYPE}		{val->buf = new Buf(yytext); return sparqlParser::IT_DATATYPE;}
+{IT_BOUND}		{val->buf = new Buf(yytext); return sparqlParser::IT_BOUND;}
+{IT_isIRI}		{val->buf = new Buf(yytext); return sparqlParser::IT_isIRI;}
+{IT_isURI}		{val->buf = new Buf(yytext); return sparqlParser::IT_isURI;}
+{IT_isBLANK}		{val->buf = new Buf(yytext); return sparqlParser::IT_isBLANK;}
+{IT_isLITERAL}		{val->buf = new Buf(yytext); return sparqlParser::IT_isLITERAL;}
+{IT_REGEX}		{val->buf = new Buf(yytext); return sparqlParser::IT_REGEX;}
+{GT_DTYPE}		{val->buf = new Buf(yytext); return sparqlParser::GT_DTYPE;}
+{IT_true}		{val->buf = new Buf(yytext); return sparqlParser::IT_true;}
+{IT_false}		{val->buf = new Buf(yytext); return sparqlParser::IT_false;}
+{Q_IRI_REF}		{val->lex_str = get_token(1, 1); return sparqlParser::Q_IRI_REF;}
+{QNAME_NS}		{val->lex_str = get_token(1, 0); return sparqlParser::QNAME_NS;}
+{QNAME}		{val->lex_str = get_token(0, 0); return sparqlParser::QNAME;}
+{BLANK_NODE_LABEL}		{val->lex_str = get_token(2, 0); return sparqlParser::BLANK_NODE_LABEL;}
+{VAR1}		{val->lex_str = get_token(1, 0); return sparqlParser::VAR1;}
+{VAR2}		{val->lex_str = get_token(1, 0); return sparqlParser::VAR2;}
+{LANGTAG}		{val->lex_str = get_token(0, 0); return sparqlParser::LANGTAG;}
+{INTEGER}		{val->lex_str = get_token(0, 0); return sparqlParser::INTEGER;}
+{DECIMAL}		{val->lex_str = get_token(0, 0); return sparqlParser::DECIMAL;}
+{DOUBLE}		{val->lex_str = get_token(0, 0); return sparqlParser::DOUBLE;}
+{STRING_LITERAL1}		{val->lex_str = get_token(1, 1); return sparqlParser::STRING_LITERAL1;}
+{STRING_LITERAL2}		{val->lex_str = get_token(1, 1); return sparqlParser::STRING_LITERAL2;}
+{STRING_LITERAL_LONG1}		{val->lex_str = get_token(1, 1); return sparqlParser::STRING_LITERAL_LONG1;}
+{STRING_LITERAL_LONG2}		{val->lex_str = get_token(1, 1); return sparqlParser::STRING_LITERAL_LONG2;}
+{NIL}		{val->buf = new Buf(yytext); return sparqlParser::NIL;}
+{ANON}		{val->buf = new Buf(yytext); return sparqlParser::ANON;}
+<<EOF>>			{ yyterminate();}
+%%
+int yywrap()
+{
+        return(1);
+}
+
+int sparqlFlexLexer::LexerReadStatic( char* buf, int max_size )
+{
+    char** cur = yyptr;
+    char* start = *cur;
+#if 0
+    for (; **cur && max_size > 0; (*cur)++, buf++) {
+      *buf = **cur;
+      max_size--;
+    }
+#else
+    if (**cur && max_size > 0) {
+      *buf = **cur;
+      (*cur)++, buf++;
+    }
+#endif
+    return *cur - start;
+}
+
+sparqlFlexLexer::sparqlFlexLexer( THD *thd, char** ptr)
+	{
+	this->thd = thd;
+	yyptr = ptr;
+
+	yyin = NULL;
+	yyout = NULL;
+	yy_c_buf_p = 0;
+	yy_init = 1;
+	yy_start = 0;
+	yy_flex_debug = 0;
+	yylineno = 1;	// this will only get updated if %option yylineno
+
+	yy_did_buffer_switch_on_eof = 0;
+
+	yy_looking_for_trail_begin = 0;
+	yy_more_flag = 0;
+	yy_more_len = 0;
+	yy_more_offset = yy_prev_more_offset = 0;
+
+	yy_start_stack_ptr = yy_start_stack_depth = 0;
+	yy_start_stack = 0;
+
+	yy_current_buffer = 0;
+
+#ifdef YY_USES_REJECT
+	yy_state_buf = new yy_state_type[YY_BUF_SIZE + 2];
+#else
+	yy_state_buf = 0;
+#endif
+	}
+
+LEX_STRING sparqlFlexLexer::get_token(size_t skip, size_t trail)
+{
+  LEX_STRING tmp;
+  tmp.length = yyleng - skip - trail;
+  tmp.str = (char*) thd->strmake((char*) yytext + skip, tmp.length);
+  return tmp;
+}
+
diff -Naur -x bnf -x compilationResults -x '*.Po' -x '*.patch' -x '*.out' -x '*~' -x '*.o' -x main -x sparql -x '*.a' -x '*.libs' -x main.cc -x Makefile -x Makefile.in -x '*.yy' -x '*.ll' mysql-dfsg-5.0-5.0.41/sparql/CVS/Entries mysql-dfsg-5.0-5.0.41-spasql/sparql/CVS/Entries
--- mysql-dfsg-5.0-5.0.41/sparql/CVS/Entries	1970-01-01 01:00:00.000000000 +0100
+++ mysql-dfsg-5.0-5.0.41-spasql/sparql/CVS/Entries	2006-12-16 16:08:22.000000000 +0100
@@ -0,0 +1,7 @@
+/.cvsignore/1.1/Fri Dec 15 15:42:29 2006//
+/FlexLexer.h/1.1/Fri Dec 15 14:45:17 2006//
+/sparqlScanner.ll/1.1/Thu Dec 14 13:33:42 2006//
+/Makefile.am/1.2/Fri Dec 15 16:04:12 2006//
+/sparqlFrob.h/1.2/Sat Dec 16 12:12:51 2006//
+/sparqlParser.yy/1.3/Sat Dec 16 14:08:23 2006//
+D
diff -Naur -x bnf -x compilationResults -x '*.Po' -x '*.patch' -x '*.out' -x '*~' -x '*.o' -x main -x sparql -x '*.a' -x '*.libs' -x main.cc -x Makefile -x Makefile.in -x '*.yy' -x '*.ll' mysql-dfsg-5.0-5.0.41/sparql/CVS/Repository mysql-dfsg-5.0-5.0.41-spasql/sparql/CVS/Repository
--- mysql-dfsg-5.0-5.0.41/sparql/CVS/Repository	1970-01-01 01:00:00.000000000 +0100
+++ mysql-dfsg-5.0-5.0.41-spasql/sparql/CVS/Repository	2006-12-15 16:27:20.000000000 +0100
@@ -0,0 +1 @@
+2006/spasql/mysql5/sparql
diff -Naur -x bnf -x compilationResults -x '*.Po' -x '*.patch' -x '*.out' -x '*~' -x '*.o' -x main -x sparql -x '*.a' -x '*.libs' -x main.cc -x Makefile -x Makefile.in -x '*.yy' -x '*.ll' mysql-dfsg-5.0-5.0.41/sparql/CVS/Root mysql-dfsg-5.0-5.0.41-spasql/sparql/CVS/Root
--- mysql-dfsg-5.0-5.0.41/sparql/CVS/Root	1970-01-01 01:00:00.000000000 +0100
+++ mysql-dfsg-5.0-5.0.41-spasql/sparql/CVS/Root	2006-12-15 16:27:20.000000000 +0100
@@ -0,0 +1 @@
+eric@homer.w3.org:/sources/public
diff -Naur -x bnf -x compilationResults -x '*.Po' -x '*.patch' -x '*.out' -x '*~' -x '*.o' -x main -x sparql -x '*.a' -x '*.libs' -x main.cc -x Makefile -x Makefile.in -x '*.yy' -x '*.ll' mysql-dfsg-5.0-5.0.41/sparql/.cvsignore mysql-dfsg-5.0-5.0.41-spasql/sparql/.cvsignore
--- mysql-dfsg-5.0-5.0.41/sparql/.cvsignore	1970-01-01 01:00:00.000000000 +0100
+++ mysql-dfsg-5.0-5.0.41-spasql/sparql/.cvsignore	2006-12-15 16:42:29.000000000 +0100
@@ -0,0 +1,11 @@
+.deps
+*~
+libsparql.a
+Makefile
+Makefile.in
+sparqlParser.cc
+sparqlParser.h
+sparqlParser.o
+sparqlParser.out
+sparqlScanner.cc
+sparqlScanner.o
diff -Naur -x bnf -x compilationResults -x '*.Po' -x '*.patch' -x '*.out' -x '*~' -x '*.o' -x main -x sparql -x '*.a' -x '*.libs' -x main.cc -x Makefile -x Makefile.in -x '*.yy' -x '*.ll' mysql-dfsg-5.0-5.0.41/sparql/FlexLexer.h mysql-dfsg-5.0-5.0.41-spasql/sparql/FlexLexer.h
--- mysql-dfsg-5.0-5.0.41/sparql/FlexLexer.h	1970-01-01 01:00:00.000000000 +0100
+++ mysql-dfsg-5.0-5.0.41-spasql/sparql/FlexLexer.h	2006-12-15 15:45:17.000000000 +0100
@@ -0,0 +1,202 @@
+// $Header: /sources/public/2006/spasql/mysql5/mysql+sparql-server-5.0.41.patch,v 1.1 2007-09-05 19:20:45 eric Exp $
+
+// FlexLexer.h -- define interfaces for lexical analyzer classes generated
+//		  by flex
+
+// Copyright (c) 1993 The Regents of the University of California.
+// All rights reserved.
+//
+// This code is derived from software contributed to Berkeley by
+// Kent Williams and Tom Epperly.
+//
+// Redistribution and use in source and binary forms with or without
+// modification are permitted provided that: (1) source distributions retain
+// this entire copyright notice and comment, and (2) distributions including
+// binaries display the following acknowledgement:  ``This product includes
+// software developed by the University of California, Berkeley and its
+// contributors'' in the documentation or other materials provided with the
+// distribution and in all advertising materials mentioning features or use
+// of this software.  Neither the name of the University nor the names of
+// its contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+
+// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
+// WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+
+// This file defines FlexLexer, an abstract class which specifies the
+// external interface provided to flex C++ lexer objects, and yyFlexLexer,
+// which defines a particular lexer class.
+//
+// If you want to create multiple lexer classes, you use the -P flag
+// to rename each yyFlexLexer to some other xxFlexLexer.  You then
+// include <FlexLexer.h> in your other sources once per lexer class:
+//
+//	#undef yyFlexLexer
+//	#define yyFlexLexer xxFlexLexer
+//	#include <FlexLexer.h>
+//
+//	#undef yyFlexLexer
+//	#define yyFlexLexer zzFlexLexer
+//	#include <FlexLexer.h>
+//	...
+
+#ifndef __FLEX_LEXER_H
+// Never included before - need to define base class.
+#define __FLEX_LEXER_H
+#include <iostream>
+#include "sparqlParser.h"
+//#include "sparqlParserPackage.h"
+
+// Change YY_DECL macro so flex doesn't use yylex
+#undef YY_DECL
+#define YY_DECL int sparqlFlexLexer::sparqllex(yy_sparqlParser_stype *val)
+
+extern "C++" {
+
+struct yy_buffer_state;
+typedef int yy_state_type;
+
+class FlexLexer {
+public:
+	virtual ~FlexLexer()	{ }
+
+	const char* YYText()	{ return yytext; }
+	int YYLeng()		{ return yyleng; }
+
+	virtual void
+		yy_switch_to_buffer( struct yy_buffer_state* new_buffer ) = 0;
+	virtual struct yy_buffer_state*
+		yy_create_buffer( istream* s, int size ) = 0;
+	virtual void yy_delete_buffer( struct yy_buffer_state* b ) = 0;
+	virtual void yyrestart( istream* s ) = 0;
+
+	virtual int yylex(FLEXFIX) = 0;
+
+	// Call yylex with new input/output sources.
+	int yylex(FLEXFIX, istream* new_in, ostream* new_out = 0 )
+		{
+		switch_streams( new_in, new_out );
+		return yylex(FLEXFIX2);
+		}
+
+	// Switch to new input/output streams.  A nil stream pointer
+	// indicates "keep the current one".
+	virtual void switch_streams( istream* new_in = 0,
+					ostream* new_out = 0 ) = 0;
+
+	int lineno() const		{ return yylineno; }
+
+	int debug() const		{ return yy_flex_debug; }
+	void set_debug( int flag )	{ yy_flex_debug = flag; }
+
+protected:
+	char* yytext;
+	int yyleng;
+	int yylineno;		// only maintained if you use %option yylineno
+	int yy_flex_debug;	// only has effect with -d or "%option debug"
+};
+
+}
+#endif
+
+#if defined(yyFlexLexer) || ! defined(yyFlexLexerOnce)
+// Either this is the first time through (yyFlexLexerOnce not defined),
+// or this is a repeated include to define a different flavor of
+// yyFlexLexer, as discussed in the flex man page.
+#define yyFlexLexerOnce
+
+class sparqlFlexLexer : public FlexLexer {
+public:
+	// arg_yyin and arg_yyout default to the cin and cout, but we
+	// only make that assignment when initializing in yylex().
+	sparqlFlexLexer( istream* arg_yyin = 0, ostream* arg_yyout = 0 );
+
+	virtual ~sparqlFlexLexer();
+
+	void yy_switch_to_buffer( struct yy_buffer_state* new_buffer );
+	struct yy_buffer_state* yy_create_buffer( istream* s, int size );
+	void yy_delete_buffer( struct yy_buffer_state* b );
+	void yyrestart( istream* s );
+
+	virtual int sparqllex(FLEXFIX);
+	virtual void switch_streams( istream* new_in, ostream* new_out );
+
+	// SPASQL-specific stuff
+	sparqlFlexLexer( THD *thd, char** ptr);
+	char *get_last_word () { return *yyptr; }
+
+protected:
+	virtual int LexerInput( char* buf, int max_size );
+	virtual int LexerReadStatic( char* buf, int max_size );
+	LEX_STRING get_token(size_t skip, size_t trail);
+	virtual void LexerOutput( const char* buf, int size );
+	virtual void LexerError( const char* msg );
+
+	void yyunput( int c, char* buf_ptr );
+	int yyinput();
+
+	void yy_load_buffer_state();
+	void yy_init_buffer( struct yy_buffer_state* b, istream* s );
+	void yy_flush_buffer( struct yy_buffer_state* b );
+
+	int yy_start_stack_ptr;
+	int yy_start_stack_depth;
+	int* yy_start_stack;
+
+	void yy_push_state( int new_state );
+	void yy_pop_state();
+	int yy_top_state();
+
+	yy_state_type yy_get_previous_state();
+	yy_state_type yy_try_NUL_trans( yy_state_type current_state );
+	int yy_get_next_buffer();
+
+	istream* yyin;	// input source for default LexerInput
+	ostream* yyout;	// output sink for default LexerOutput
+
+	struct yy_buffer_state* yy_current_buffer;
+
+	// yy_hold_char holds the character lost when yytext is formed.
+	char yy_hold_char;
+
+	// Number of characters read into yy_ch_buf.
+	int yy_n_chars;
+
+	// Points to current character in buffer.
+	char* yy_c_buf_p;
+
+	int yy_init;		// whether we need to initialize
+	int yy_start;		// start state number
+
+	// Flag which is used to allow yywrap()'s to do buffer switches
+	// instead of setting up a fresh yyin.  A bit of a hack ...
+	int yy_did_buffer_switch_on_eof;
+
+	// The following are not always needed, but may be depending
+	// on use of certain flex features (like REJECT or yymore()).
+
+	yy_state_type yy_last_accepting_state;
+	char* yy_last_accepting_cpos;
+
+	yy_state_type* yy_state_buf;
+	yy_state_type* yy_state_ptr;
+
+	char* yy_full_match;
+	int* yy_full_state;
+	int yy_full_lp;
+
+	int yy_lp;
+	int yy_looking_for_trail_begin;
+
+	int yy_more_flag;
+	int yy_more_len;
+	int yy_more_offset;
+	int yy_prev_more_offset;
+
+	// SPASQL-specific stuff
+	char **yyptr;
+	THD *thd;
+};
+
+#endif
diff -Naur -x bnf -x compilationResults -x '*.Po' -x '*.patch' -x '*.out' -x '*~' -x '*.o' -x main -x sparql -x '*.a' -x '*.libs' -x main.cc -x Makefile -x Makefile.in -x '*.yy' -x '*.ll' mysql-dfsg-5.0-5.0.41/sparql/Makefile.am mysql-dfsg-5.0-5.0.41-spasql/sparql/Makefile.am
--- mysql-dfsg-5.0-5.0.41/sparql/Makefile.am	1970-01-01 01:00:00.000000000 +0100
+++ mysql-dfsg-5.0-5.0.41-spasql/sparql/Makefile.am	2006-12-15 17:04:12.000000000 +0100
@@ -0,0 +1,46 @@
+# Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
+# 
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+DEFS =			-DMYSQL_SERVER \
+			@DEFS@
+INCLUDES =		-I$(top_builddir)/include -I$(top_srcdir)/include -I$(top_srcdir)/sql -I$(top_srcdir)/regex
+
+LDADD =			libsparql.a ../mysys/libmysys.a ../dbug/libdbug.a \
+			../strings/libmystrings.a
+pkglib_LIBRARIES =	libsparql.a
+noinst_HEADERS =	sparqlParser.h FlexLexer.h sparqlFrob.h
+libsparql_a_SOURCES =	sparqlScanner.ll sparqlParser.yy
+BUILT_SOURCES =		sparqlParser.cc sparqlParser.h sparqlScanner.cc
+
+sparqlParser.cc:	sparqlParser.yy
+	$(YACCCC) -o $*.cc -h $*.h $*.yy
+	sed "s/YY_sparqlParser_CLASS(YY_sparqlParser_CONSTRUCTOR_PARAM);/\\0\\x0a virtual ~YY_sparqlParser_CLASS() {;}/1" < $*.cc > $*.tmp
+	mv $*.tmp $*.cc
+	sed "s/YY_sparqlParser_CLASS(YY_sparqlParser_CONSTRUCTOR_PARAM);/\\0\\x0a virtual ~YY_sparqlParser_CLASS() {;}/1" < $*.h > $*.tmp
+	mv $*.tmp $*.h
+sparqlParser.h:	sparqlParser.yy
+
+sparqlParser.o:	sparqlParser.cc sparqlParser.h $(HEADERS)
+		$(CXXCOMPILE) $(LM_CFLAGS) -c $<
+
+sparqlScanner.cc:	sparqlScanner.ll
+	$(LEX) -o$*.cc $*.ll
+
+sparqlScanner.o:	sparqlScanner.cc $(HEADERS)
+		$(CXXCOMPILE) $(LM_CFLAGS) -c $<
+
+%::SCCS/s.%
+
diff -Naur -x bnf -x compilationResults -x '*.Po' -x '*.patch' -x '*.out' -x '*~' -x '*.o' -x main -x sparql -x '*.a' -x '*.libs' -x main.cc -x Makefile -x Makefile.in -x '*.yy' -x '*.ll' mysql-dfsg-5.0-5.0.41/sparql/sparqlFrob.h mysql-dfsg-5.0-5.0.41-spasql/sparql/sparqlFrob.h
--- mysql-dfsg-5.0-5.0.41/sparql/sparqlFrob.h	1970-01-01 01:00:00.000000000 +0100
+++ mysql-dfsg-5.0-5.0.41-spasql/sparql/sparqlFrob.h	2006-12-16 13:12:51.000000000 +0100
@@ -0,0 +1,82 @@
+class Item_POS;
+class Item_URI;
+class Item_variable;
+class Item_blank_node;
+class Item_literal_string;
+class Item_literal_int;
+class Item_literal_decimal;
+class Item_literal_float;
+class Alias_info;
+class GraphContext;
+class BindingGraphContext;
+class RootGraphContext;
+
+class sparqlFrob {
+private:
+  void* parser;
+  List<Item_URI> uris;
+  List<Item_variable> variables;
+  List<Item_blank_node> blank_nodes;
+  List<Item_literal_string> strings;
+  List<Item_literal_int> ints;
+  List<Item_literal_decimal> decimals;
+  List<Item_literal_float> floats;
+  List<Item_POS> subjects;
+  List<Item_POS> predicates;
+  List<GraphContext> contexts;
+  List<Item> root_constraints;
+  List<List<BindingGraphContext> > need_selects;
+  bool distinct;
+  GraphContext *last_graph_context;
+  GraphContext *next_graph_context;
+  byte next_union_alias_index;
+
+public:
+  sparqlFrob(THD *thd, char** ptr);
+  ~sparqlFrob();
+  int parse();
+
+  Item_variable* ensure_variable (const char *var);
+  Item_URI* ensure_URI (LEX_STRING uristr);
+  Item_blank_node* make_blank_node ();
+  Item_blank_node* ensure_blank_node (const char *label);
+  Item_literal_string* ensure_string (LEX_STRING str, Item_POS *lang_or_datatype);
+  Item_literal_int* ensure_int (LEX_STRING str, Item_POS *lang_or_datatype);
+  Item_literal_decimal* ensure_decimal (LEX_STRING str, Item_POS *lang_or_datatype);
+  Item_literal_float* ensure_float (LEX_STRING str, Item_POS *lang_or_datatype);
+  void push_subject (Item_POS *subject);
+  Item_POS* pop_subject ();
+  void push_predicate (Item_POS *predicate);
+  void pop_predicate ();
+  bool object (Item_POS *object);
+  bool type_list ();
+  bool add_listElement (Item_POS  *item);
+  const char* get_primary_key(const char *table_name);
+  void push_context(GraphContext *gc) {contexts.push_front(gc);}
+  GraphContext* head_context() {return contexts.head();}
+  GraphContext* pop_context() {return last_graph_context = contexts.pop();}
+  void add_root_constraints (Item *constraint) {
+    if (constraint)
+      root_constraints.push_front(constraint);
+  }
+  Item* get_root_constraints () {
+    return root_constraints.elements == 0 ? 
+      NULL : 
+      root_constraints.elements == 1 ? 
+      root_constraints.pop() : 
+      new Item_cond_and(root_constraints);
+  }
+  void needs_select (List<BindingGraphContext> *contexts) {
+    need_selects.push_back(contexts); // Must iterate backwards through list.
+  }
+  void select_variables();
+  void set_distinct (bool distinct_parm) {distinct= distinct_parm;}
+  bool get_distinct () {return distinct;}
+  GraphContext *last_context () {return last_graph_context;}
+  void set_next_GC (GraphContext *gc) {next_graph_context= gc;}
+  GraphContext *was_next_GC () {GraphContext *ret= next_graph_context; next_graph_context= NULL; return ret;}
+  LEX_STRING* next_union_alias ();
+
+  THD *thd;
+  LEX *lex;
+};
diff -Naur -x bnf -x compilationResults -x '*.Po' -x '*.patch' -x '*.out' -x '*~' -x '*.o' -x main -x sparql -x '*.a' -x '*.libs' -x main.cc -x Makefile -x Makefile.in -x '*.yy' -x '*.ll' mysql-dfsg-5.0-5.0.41/sparql/sparqlParser.cc mysql-dfsg-5.0-5.0.41-spasql/sparql/sparqlParser.cc
--- mysql-dfsg-5.0-5.0.41/sparql/sparqlParser.cc	1970-01-01 01:00:00.000000000 +0100
+++ mysql-dfsg-5.0-5.0.41-spasql/sparql/sparqlParser.cc	2006-12-16 16:03:05.000000000 +0100
@@ -0,0 +1,4715 @@
+#define YY_sparqlParser_h_included
+#define YY_USE_CLASS
+
+/*  A Bison++ parser, made from sparqlParser.yy  */
+
+ /* with Bison++ version bison++ Version 1.21.9-1, adapted from GNU bison by coetmeur@icdc.fr
+Maintained by Magnus Ekdahl <magnus@debian.org>
+  */
+
+#define yyparse sparqlparse
+#define yylex sparqllex
+#define yyerror sparqlerror
+#define yylval sparqllval
+#define yychar sparqlchar
+#define yydebug sparqldebug
+#define YY_USE_CLASS
+
+#line 1 "/usr/share/bison++/bison.cc"
+/* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
+/* Skeleton output parser for bison,
+   Copyright (C) 1984, 1989, 1990 Bob Corbett and Richard Stallman
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 1, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  
+
+   As a special exception, when this file is copied by Bison++ into a
+   Bison++ output file, you may use that output file without restriction.
+   This special exception was added by the Free Software Foundation
+   in version 1.24 of Bison, and has been in Bison++ since 1.21.9.  
+
+*/
+
+/* HEADER SECTION */
+#if defined( _MSDOS ) || defined(MSDOS) || defined(__MSDOS__) 
+ #define __MSDOS_AND_ALIKE
+#endif
+
+#if defined(_WINDOWS) && defined(_MSC_VER)
+ #define __HAVE_NO_ALLOCA
+ #define __MSDOS_AND_ALIKE
+#endif
+
+#ifndef alloca
+ #if defined( __GNUC__)
+  #define alloca __builtin_alloca
+
+ #elif (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc)  || defined (__sgi)
+  #include <alloca.h>
+
+ #elif defined (__MSDOS_AND_ALIKE)
+  #include <malloc.h>
+  #ifndef __TURBOC__
+   /* MS C runtime lib */
+   #define alloca _alloca
+  #endif
+
+ #elif defined(_AIX)
+  /* pragma must be put before any C/C++ instruction !! */
+  #pragma alloca
+  #include <malloc.h>
+
+ #elif defined(__hpux)
+  #ifdef __cplusplus
+   extern "C" {
+     void *alloca (unsigned int);
+   };
+  #else /* not __cplusplus */
+   void *alloca ();
+  #endif /* not __cplusplus */
+
+ #endif /* not _AIX  not MSDOS, or __TURBOC__ or _AIX, not sparc.  */
+#endif /* alloca not defined.  */
+
+#ifdef c_plusplus
+ #ifndef __cplusplus
+  #define __cplusplus
+ #endif
+#endif
+
+#ifdef __cplusplus
+ #ifndef YY_USE_CLASS
+/*#warning "For C++ its recomended to use bison++, otherwise classes won't be generated"*/
+ #endif
+#else
+ #ifndef __STDC__
+  #define const
+ #endif
+ #ifdef YY_USE_CLASS
+  #error "This is a C++ header generated by bison++, please use a C++ compiler!"
+ #endif
+#endif
+
+#include <stdio.h>
+#define YYBISON 1  
+
+ #line 88 "/usr/share/bison++/bison.cc"
+#line 1 "sparqlParser.yy"
+
+#define YY_sparqlParser_STYPE yy_sparqlParser_stype
+/* 
+$Id: mysql+sparql-server-5.0.41.patch,v 1.1 2007-09-05 19:20:45 eric Exp $
+
+TODO:
+research pre-existing var.jt in conjunction with trump
+
+OUTLINE:
+
+Some SPARQL graph pattern opperations correspond to SQL subselects. These create
+a new BindingContext, which keeps track of looks for table alias re-use
+opportunities. These occur in a given binding context where more than one
+subject/predicate pair is in the same table.  For instance, both (?s, T1.p1) and
+(?s, T1.p2) both map to the alias T1_0. (Ohterwise, you get needless joins like
+  FROM T1 AS T1_0 JOIN T1 AS T1_1 ON T1_0.id=T1_1.id
+ WHERE T1_0.p1=o1 AND T1_1.p1=o2
+
+sparqlFrob::object(subject, predicate, object)
+
+*/
+#define YY_sparqlParser_LSP_NEEDED 
+#define YY_sparqlParser_ERROR_BODY  =0
+#define YY_sparqlParser_LEX_BODY  =0
+#line 27 "sparqlParser.yy"
+
+#include <iostream>
+#include <string>
+using namespace std;
+#undef yyFlexLexer
+#define yyFlexLexer sparqlFlexLexer
+
+#ifndef FLEXFIX
+#define FLEXFIX YY_sparqlParser_STYPE *val
+#define FLEXFIX2 val
+#endif
+
+#define MYSQL_YACC
+#define YYINITDEPTH 100
+#define YYMAXDEPTH 3200				/* Because of 64K stack */
+#include "mysql_priv.h"
+#include "slave.h"
+#include "lex_symbol.h"
+#include "item_create.h"
+#include "sp_head.h"
+#include "sp_pcontext.h"
+#include "sp_rcontext.h"
+#include "sp.h"
+#include <myisam.h>
+#include <myisammrg.h>
+
+#include "sparqlFrob.h"
+#define YY_sparqlParser_PARSE_PARAM sparqlFrob *yySparqlFrob
+
+#define PLS_REPORT "Please report this bug, along with the query that triggered it."
+
+extern String Global_string; // call test->print(&Global_string); p Global_string.c_ptr(); call Global_string.free()
+
+/* DEBUGGING/DEVELOPMENT
+ *   aggregates a string representing the compiled string.
+ */
+class Buf {
+protected:
+  char* data;
+  int len;
+public:
+  Buf() {
+    len = 0;
+    data = 0;
+  }
+  Buf(char *str);
+  Buf(int count, ...);
+  ~Buf() {
+    if (data) delete[] data;
+  }
+  char *str() {return data;}
+};
+
+
+/* forward class declarations */
+class BindingContext;
+
+
+/* static function declarations */
+static const char* scan_string(THD *thd, LEX_STRING *lex_string, 
+			       const char *start, const char *end, 
+			       const char look_for);
+
+
+/* Item_POS: overload the mysql Item object for all the SPARQL parts
+ * of speach (URIs, bNodes, variables, and various forms of literal).
+ *
+ * Item overloads: bind_field
+ */
+class Item_POS
+{
+protected:
+  Item *item;
+public:
+  Item_POS (Item* item_arg) {item = item_arg;}
+  virtual ~Item_POS () {}
+  virtual void bind_field(const char *table_name, const char *alias, 
+			  const char *field_name_arg, bool trump, 
+			  THD *thd, TABLE_LIST *jt) = 0;
+  virtual bool is_URI () {return false;}
+  virtual bool is_variable () {return false;}
+  virtual bool is_blank_node () {return false;}
+  virtual bool is_string () {return false;}
+  Item* get_item () {return item;} // OK 'cause ALL Item_POS's are Items.
+};
+
+
+class Item_URI : public Item_field, public Item_POS
+{
+protected:
+  LEX_STRING table;
+  LEX_STRING field;
+  LEX_STRING value;
+
+public:
+  Item_URI(Name_resolution_context *context_arg, LEX_STRING uri, THD *thd);
+  virtual void bind_field(const char *table_name, const char *alias, 
+			  const char *field_name_arg, bool trump, 
+			  THD *thd, TABLE_LIST *jt);
+  virtual bool is_URI () {return true;}
+  LEX_STRING get_table () {return table;}
+  LEX_STRING get_field () {return field;}
+  LEX_STRING get_value () {return value;}
+  void print(String *str);
+};
+extern Item_URI *XSD_integer;
+extern Item_URI *XSD_float;
+extern Item_URI *XSD_decimal;
+
+
+/* Item_variable: represent SPARQL variable.
+ *
+ * includes the status of a variable's use in the current JOIN. A variable in
+ * a nested JOIN is different from a variable in an outer context (the
+ * UnionGraphContext::close handles the correlation (U0.foo=oldTable.oldField).
+ *
+ * Item_variable has the same virtual functions as an Item, but is never
+ * added to the SQL compile tree (for instance, in the form of a table
+ * constraint or a select item).
+ */
+class Item_variable : public Item_field, public Item_POS
+{
+private:
+  Name_resolution_context *nr_context;
+  GraphContext *gc;
+  bool bound;
+  bool primary_key;
+  TABLE_LIST *jt;
+  Item_variable *outer;
+  sparqlFrob *frob;
+  const char *real_table_name;
+  int ref_count;
+
+public:
+  Item_variable(Name_resolution_context *context_arg, 
+		const char *variable_name, Item_variable *outer_arg, 
+		sparqlFrob *frob_arg, int ref_count_arg);
+  virtual void bind_field(const char *table_name, const char *alias, 
+			  const char *field_name_arg, 
+			  bool trump, THD *thd, TABLE_LIST *jt);
+  Item* make_Item_field(Name_resolution_context *context_arg,
+			const char *db_arg, const char *table_name_arg,
+			const char *field_name_arg, 
+			const char* real_table_name);
+  const char* get_primary_key () {return frob->get_primary_key(real_table_name);}
+  virtual bool is_variable () {return true;}
+  bool same_variable (const char* variable_name) {
+    return !strcmp(orig_field_name, variable_name);
+  }
+  virtual bool fix_fields(THD *, Item **);
+  void add_ref_count (int ref_count_arg) {ref_count+= ref_count_arg;}
+  bool outer_has_no_refs () {return outer ? outer->ref_count == 0 : true;}
+  static Item_variable* 
+  match_var_in_list (List<Item_variable> *p_item_variables, const char *var);
+  Item* get_null_item();
+  virtual bool send(Protocol *protocol, String *buffer);
+  void print(String *str);
+};
+
+
+/* Item_blank_node: represent SPARQL bNode.
+ */
+class Item_blank_node : public Item_variable
+{
+public:
+  Item_blank_node (Name_resolution_context *context_arg, 
+		   const char *node_name, sparqlFrob *frob_arg) : 
+    Item_variable(context_arg, node_name, NULL, frob_arg, 0) {}
+  virtual bool is_blank_node () {return true;}
+  void print(String *str);
+};
+
+
+/* Item_literal_string: represent SPARQL xsd:string typed literal.
+ */
+class Item_literal_string : public Item_string, public Item_POS
+{
+private:
+  Item_POS *lang_or_datatype;
+public:
+  Item_literal_string (LEX_STRING string, 
+		       Item_POS *lang_or_datatype, CHARSET_INFO *charset) : 
+    Item_string(string.str, string.length, charset), Item_POS(this) {
+    this->lang_or_datatype = lang_or_datatype;
+  }
+  virtual void bind_field(const char *table_name, const char *alias, 
+			  const char *field_name_arg, bool trump, 
+			  THD *thd, TABLE_LIST *jt);
+  virtual bool is_string () {return true;}
+  Item_POS* get_language_or_datatype () {
+    return lang_or_datatype;
+  }
+  Item_URI* get_datatype () {
+    return lang_or_datatype && lang_or_datatype->is_URI() ? 
+      (Item_URI*)lang_or_datatype : NULL;
+  }
+  Item_literal_string* get_language () {
+    return lang_or_datatype && lang_or_datatype->is_string() ? 
+      (Item_literal_string*)lang_or_datatype : NULL;
+  }
+  void print(String *str);
+};
+
+
+/* Item_literal_int: represent SPARQL xsd:integer typed literal.
+ */
+class Item_literal_int : public Item_int, public Item_POS
+{
+public:
+  Item_literal_int (LEX_STRING string, 
+		   Item_POS *lang_or_datatype, CHARSET_INFO *charset) : 
+    Item_int(string.str), Item_POS(this) {}
+  virtual void bind_field(const char *table_name, const char *alias, 
+			  const char *field_name_arg, bool trump, 
+			  THD *thd, TABLE_LIST *jt);
+  virtual bool is_string () {return false;}
+  Item_URI* get_datatype () {return XSD_integer;}
+  Item_literal_string* get_language () {return NULL;}
+  void print(String *str);
+};
+
+
+/* Item_literal_decimal: represent SPARQL xsd:decimal typed literal.
+ */
+class Item_literal_decimal : public Item_decimal, public Item_POS
+{
+public:
+  Item_literal_decimal (LEX_STRING string, Item_POS *lang_or_datatype, CHARSET_INFO *charset) : 
+    Item_decimal(string.str, string.length, charset), Item_POS(this) {}
+  virtual void bind_field(const char *table_name, const char *alias, 
+			  const char *field_name_arg, bool trump, 
+			  THD *thd, TABLE_LIST *jt);
+  virtual bool is_string () {return false;}
+  Item_URI* get_datatype () {return XSD_decimal;}
+  Item_literal_string* get_language () {return NULL;}
+  void print(String *str);
+};
+
+
+/* Item_literal_float: represent SPARQL xsd:float typed literal.
+ */
+class Item_literal_float : public Item_float, public Item_POS
+{
+public:
+  Item_literal_float (LEX_STRING string, Item_POS *lang_or_datatype, CHARSET_INFO *charset) : 
+    Item_float(string.str, string.length), Item_POS(this) {}
+  virtual void bind_field(const char *table_name, const char *alias, 
+			  const char *field_name_arg, bool trump, 
+			  THD *thd, TABLE_LIST *jt);
+  virtual bool is_string () {return false;}
+  Item_URI* get_datatype () {return XSD_float;}
+  Item_literal_string* get_language() {return NULL;}
+  void print(String *str);
+};
+
+
+/* Item_primary_key_field: reference to an Item_field that is a primary key.
+ * Used to create foreign key/primary key constraints on joins.
+ */
+class Item_primary_key_field : public Item_field
+{
+protected:
+  sparqlFrob *frob;
+  const char* real_table_name;
+public:
+  Item_primary_key_field(Name_resolution_context *context_arg,
+			 const char *db_arg, const char *table_name_arg, 
+			 sparqlFrob *frob_arg, 
+			 const char* real_table_name_arg);
+  virtual bool fix_fields(THD *, Item **);
+};
+
+
+#if 0
+/* Item_func_call: not implemented
+ */
+class Item_func_call : public Item_POS
+{
+protected:
+  Item_POS* name;
+  List<Item>* args;
+public:
+  Item_func_call (Name_resolution_context *context_arg, 
+		  Item_POS* name, List<Item>* args) :
+    Item_POS(context_arg, "<Item_func_call>") {
+    this->name = name;
+    this->args = args;
+  }
+  ~Item_func_call() {}
+  void bind_field (const char *table_name, const char *alias, 
+		   const char *field_name_arg, bool trump, 
+		  T HD *thd, TABLE_LIST *jt) {}
+  bool fix_fields(THD *, Item **);
+};
+#endif
+
+
+
+
+
+/* Alias_info: aliases for a table, indexed by subject.
+ * If it's not in subjects, you need a new alias.
+ */
+class Alias_info {
+  friend class GraphContext;
+private:
+  LEX_STRING table;
+  List<Item_POS> subjects;
+public:
+  Alias_info(LEX_STRING table) {
+    this->table = table;
+  }
+  bool same_table(LEX_STRING table) {
+    return !strcmp(this->table.str, table.str);
+  }
+};
+
+
+/* BindingContext: SQL table aliases and constraints for a given
+ * SPARQL group graph pattern.
+ */
+class BindingContext {
+protected:
+  List<Item_variable> item_variables;
+  // All known table aliases for in the context.
+  List<Alias_info> aliases;
+  Name_resolution_context *name_res_context;
+  BindingContext *parent;
+  LEX *lex;
+  List<Item> *constraints;
+
+public:
+  BindingContext(GraphContext *gc_param, 
+		 BindingContext *parent_param, LEX *lex_param) {
+    parent= parent_param;
+    lex= lex_param;
+    //name_res_context= lex->current_context();
+  }
+  Item_variable* ensure_bound_item_variable(const char *name, 
+				    sparqlFrob *sparql_frob, int ref_count);
+  void select_star(THD *thd);
+  List<Item_variable>* get_item_variables () { return &item_variables; }
+  Alias_info* get_table_alias(THD *thd, Item_POS *s, Item_URI *p, Item_POS *o);
+  Item* get_bound_variable_constraints(Item *conjunction_constraints, 
+				       GraphContext *gc);
+  void start_constraints();
+  void end_and_check_constraints() {
+    assert(constraints == lex->select_lex.expr_list.pop());
+  }
+  Item* make_item_constraints() {
+    return constraints->elements ? new Item_cond_and(*constraints) : NULL;
+  }
+};
+
+
+/* GraphContext: corresponds to a SPARQL graph context.
+ */
+class GraphContext {
+protected:
+  GraphContext *parent;
+  THD *thd;
+  Buf *buf; // temporary
+
+public:
+  sparqlFrob *sparql_frob; // !!! should be protected
+  GraphContext (GraphContext *parent_param, sparqlFrob *sparql_frob_param) {
+    sparql_frob= sparql_frob_param;
+    parent= parent_param;
+    thd= sparql_frob->thd;
+    buf= NULL;
+  }
+  virtual ~GraphContext () {}
+  virtual void close () {
+    cout << "SPARQL: close {" << endl << buf->str() << "}" << endl;
+  }
+  virtual void no_right_union () {
+    cout << "SPARQL: non-UNION {" << endl << buf->str() << "}" << endl;
+  }
+  void set_Buf (Buf *buf_param) { buf= buf_param; }
+  Buf* get_Buf () { return buf; }
+  virtual bool is_optional () { return false; }
+  virtual BindingContext* get_binding_context () {
+    return parent->get_binding_context();
+  }
+  const char* get_alias_string(Alias_info *ai, Item_POS *s, THD *thd);
+};
+
+
+/* BindingGraphContext: the graph contexts that require a new BindingContext.
+ * Raison d'etre: factored common code from Union and Graph contexts.
+ */
+class BindingGraphContext : public GraphContext {
+  friend class Union2GraphContext; // why doesn't BindingGraphContext work here?
+protected:
+  BindingContext *bindings;
+  SELECT_LEX *current_select;
+  BindingGraphContext(GraphContext *parent_param, sparqlFrob *sparql_frob_param);
+public:
+  void select_var(Item_variable *var, bool exists);
+  virtual BindingContext* get_binding_context() { return bindings; }
+};
+
+
+/* RootGraphContext: the graph context just inside the WHERE.
+ */
+class RootGraphContext : public BindingGraphContext {
+public:
+  RootGraphContext(GraphContext *parent, sparqlFrob *sparql_frob);
+  virtual void close () {
+    bindings->end_and_check_constraints();
+  }
+};
+
+
+/* OptionalGraphContext: OPTIONAL {   }.
+ *                                 ^^^
+ */
+class OptionalGraphContext : public GraphContext {
+public:
+  OptionalGraphContext (GraphContext *parent, sparqlFrob *sparql_frob) : 
+    GraphContext(parent, sparql_frob) {
+    /* if (!(on_context= make_join_on_context(thd, $1, $3)))
+       assert(0);
+       thd->lex->push_context(on_context);
+    */
+  }
+  virtual void close () {
+    /* thd->lex->pop_context();
+     */
+  }
+  virtual bool is_optional () { return true; }
+};
+
+
+/* Union1GraphContext: {   } UNION {   }.
+ *                      ^^^
+ */
+class Union1GraphContext : public BindingGraphContext {
+public:
+  Union1GraphContext(GraphContext *parent, sparqlFrob *sparql_frob);
+  virtual void no_right_union () {
+    /* Just a spurious {} so copy the context up to the parent.
+       @@@ TODO
+    */
+    my_printf_error(1, "SPARQL: implementation limitation: not ready to deal with non-UNION %s. "PLS_REPORT, MYF(0), buf->str());
+  }
+  virtual void close();
+  Item* map_variables_to_outer_context () { // !!! does nothing
+    return NULL;
+  }
+};
+
+
+/* Union1GraphContext: {   } UNION {   }.
+ *                                  ^^^
+ */
+class Union2GraphContext : public BindingGraphContext {
+private:
+  BindingGraphContext *left; // left side of the UNION
+
+public:
+  Union2GraphContext(GraphContext *parent, sparqlFrob *sparql_frob);
+  virtual void close();
+};
+
+
+/* GraphGraphContext: GRAPH {   }.
+ *                           ^^^
+ */
+class GraphGraphContext : public BindingGraphContext {
+public:
+  GraphGraphContext (GraphContext *parent, sparqlFrob *sparql_frob) : 
+    BindingGraphContext(parent, sparql_frob) {}
+};
+
+
+
+#line 505 "sparqlParser.yy"
+typedef union {
+  int  num;
+  LEX_STRING lex_str;
+  Item *item;
+  List<Item> *item_list;
+  List<BindingGraphContext> *BindingGraphContext_list;
+  Item_POS *item_pos;
+  GraphContext *graph_context;
+  BindingGraphContext *binding_graph_context;
+  Buf *buf;
+} yy_sparqlParser_stype;
+#define YY_sparqlParser_STYPE yy_sparqlParser_stype
+
+#line 88 "/usr/share/bison++/bison.cc"
+/* %{ and %header{ and %union, during decl */
+#define YY_sparqlParser_BISON 1
+
+#ifndef YY_sparqlParser_COMPATIBILITY
+ #ifndef YY_USE_CLASS
+  #define  YY_sparqlParser_COMPATIBILITY 1
+ #else
+  #define  YY_sparqlParser_COMPATIBILITY 0
+ #endif
+#endif
+
+#if YY_sparqlParser_COMPATIBILITY != 0
+ /* backward compatibility */
+ #ifdef YYLTYPE
+  #ifndef YY_sparqlParser_LTYPE
+   #define YY_sparqlParser_LTYPE YYLTYPE
+  #endif
+ #endif
+/* Testing alternative bison solution
+   /#ifdef YYSTYPE*/
+#ifndef YY_sparqlParser_STYPE 
+   #define YY_sparqlParser_STYPE YYSTYPE
+#endif
+/*#endif*/
+ #ifdef YYDEBUG
+  #ifndef YY_sparqlParser_DEBUG
+   #define  YY_sparqlParser_DEBUG YYDEBUG
+  #endif
+ #endif
+ 
+ /* use goto to be compatible */
+ #ifndef YY_sparqlParser_USE_GOTO
+  #define YY_sparqlParser_USE_GOTO 1
+ #endif
+#endif
+
+/* use no goto to be clean in C++ */
+#ifndef YY_sparqlParser_USE_GOTO
+ #define YY_sparqlParser_USE_GOTO 0
+#endif
+
+#ifndef YY_sparqlParser_PURE
+
+ #line 130 "/usr/share/bison++/bison.cc"
+
+#line 130 "/usr/share/bison++/bison.cc"
+/*  YY_sparqlParser_PURE */
+#endif
+
+/* section apres lecture def, avant lecture grammaire S2 */
+
+ #line 134 "/usr/share/bison++/bison.cc"
+#define YY_sparqlParser_PARSE sparqlparse
+#define YY_sparqlParser_LEX sparqllex
+#define YY_sparqlParser_ERROR sparqlerror
+#define YY_sparqlParser_LVAL sparqllval
+#define YY_sparqlParser_CHAR sparqlchar
+#define YY_sparqlParser_DEBUG sparqldebug
+
+#line 134 "/usr/share/bison++/bison.cc"
+/* prefix */
+#ifndef YY_sparqlParser_DEBUG
+
+ #line 136 "/usr/share/bison++/bison.cc"
+
+#line 136 "/usr/share/bison++/bison.cc"
+/* YY_sparqlParser_DEBUG */
+#endif
+
+
+#ifndef YY_sparqlParser_LSP_NEEDED
+
+ #line 141 "/usr/share/bison++/bison.cc"
+
+#line 141 "/usr/share/bison++/bison.cc"
+ /* YY_sparqlParser_LSP_NEEDED*/
+#endif
+
+
+
+/* DEFAULT LTYPE*/
+#ifdef YY_sparqlParser_LSP_NEEDED
+#ifndef YY_sparqlParser_LTYPE
+#ifndef BISON_YYLTYPE_ISDECLARED
+#define BISON_YYLTYPE_ISDECLARED
+typedef
+  struct yyltype
+    {
+      int timestamp;
+      int first_line;
+      int first_column;
+      int last_line;
+      int last_column;
+      char *text;
+   }
+  yyltype;
+
+#endif
+#define YY_sparqlParser_LTYPE yyltype
+#endif
+#endif
+/* DEFAULT STYPE*/
+      /* We used to use `unsigned long' as YY_sparqlParser_STYPE on MSDOS,
+	 but it seems better to be consistent.
+	 Most programs should declare their own type anyway.  */
+
+#ifndef YY_sparqlParser_STYPE
+#define YY_sparqlParser_STYPE int
+#endif
+/* DEFAULT MISCELANEOUS */
+#ifndef YY_sparqlParser_PARSE
+#define YY_sparqlParser_PARSE yyparse
+#endif
+#ifndef YY_sparqlParser_LEX
+#define YY_sparqlParser_LEX yylex
+#endif
+#ifndef YY_sparqlParser_LVAL
+#define YY_sparqlParser_LVAL yylval
+#endif
+#ifndef YY_sparqlParser_LLOC
+#define YY_sparqlParser_LLOC yylloc
+#endif
+#ifndef YY_sparqlParser_CHAR
+#define YY_sparqlParser_CHAR yychar
+#endif
+#ifndef YY_sparqlParser_NERRS
+#define YY_sparqlParser_NERRS yynerrs
+#endif
+#ifndef YY_sparqlParser_DEBUG_FLAG
+#define YY_sparqlParser_DEBUG_FLAG yydebug
+#endif
+#ifndef YY_sparqlParser_ERROR
+#define YY_sparqlParser_ERROR yyerror
+#endif
+
+#ifndef YY_sparqlParser_PARSE_PARAM
+ #ifndef YY_USE_CLASS
+  #ifdef YYPARSE_PARAM
+   #define YY_sparqlParser_PARSE_PARAM void* YYPARSE_PARAM 
+  #else
+   #ifndef __STDC__
+    #ifndef __cplusplus
+     #define YY_sparqlParser_PARSE_PARAM
+    #endif
+   #endif
+  #endif
+ #endif
+ #ifndef YY_sparqlParser_PARSE_PARAM
+  #define YY_sparqlParser_PARSE_PARAM void
+ #endif
+#endif
+
+#if YY_sparqlParser_COMPATIBILITY != 0
+/* backward compatibility */
+#ifdef YY_sparqlParser_LTYPE
+#ifndef YYLTYPE
+#define YYLTYPE YY_sparqlParser_LTYPE
+#else
+/* WARNING obsolete !!! user defined YYLTYPE not reported into generated header */
+#endif
+#endif
+
+/* Removed due to bison compabilityproblems
+/#ifndef YYSTYPE
+/#define YYSTYPE YY_sparqlParser_STYPE
+/#else*/
+/* WARNING obsolete !!! user defined YYSTYPE not reported into generated header */
+/*#endif*/
+
+#ifdef YY_sparqlParser_PURE
+#  ifndef YYPURE
+#    define YYPURE YY_sparqlParser_PURE
+#  endif
+#endif
+
+#ifdef YY_sparqlParser_DEBUG
+#  ifndef YYDEBUG
+#    define YYDEBUG YY_sparqlParser_DEBUG 
+#  endif
+#endif
+
+#ifndef YY_sparqlParser_ERROR_VERBOSE
+ #ifdef YYERROR_VERBOSE
+  #define YY_sparqlParser_ERROR_VERBOSE YYERROR_VERBOSE
+ #endif
+#endif
+
+#ifndef YY_sparqlParser_LSP_NEEDED
+#  ifdef YYLSP_NEEDED
+#    define YY_sparqlParser_LSP_NEEDED YYLSP_NEEDED
+#  endif
+#endif
+
+#endif
+
+#ifndef YY_USE_CLASS
+/* TOKEN C */
+
+ #line 263 "/usr/share/bison++/bison.cc"
+#define	IT_BASE	258
+#define	IT_PREFIX	259
+#define	IT_SELECT	260
+#define	IT_DISTINCT	261
+#define	GT_TIMES	262
+#define	IT_CONSTRUCT	263
+#define	IT_DESCRIBE	264
+#define	IT_ASK	265
+#define	IT_FROM	266
+#define	IT_NAMED	267
+#define	IT_WHERE	268
+#define	IT_ORDER	269
+#define	IT_BY	270
+#define	IT_ASC	271
+#define	IT_DESC	272
+#define	IT_LIMIT	273
+#define	IT_OFFSET	274
+#define	GT_LCURLEY	275
+#define	GT_RCURLEY	276
+#define	GT_DOT	277
+#define	IT_OPTIONAL	278
+#define	IT_GRAPH	279
+#define	IT_UNION	280
+#define	IT_FILTER	281
+#define	GT_COMMA	282
+#define	GT_LPAREN	283
+#define	GT_RPAREN	284
+#define	GT_SEMI	285
+#define	IT_a	286
+#define	GT_LBRACKET	287
+#define	GT_RBRACKET	288
+#define	GT_MINUS	289
+#define	GT_PLUS	290
+#define	GT_OR	291
+#define	GT_AND	292
+#define	GT_EQUAL	293
+#define	GT_NEQUAL	294
+#define	GT_LT	295
+#define	GT_GT	296
+#define	GT_LE	297
+#define	GT_GE	298
+#define	GT_DIVIDE	299
+#define	GT_NOT	300
+#define	IT_STR	301
+#define	IT_LANG	302
+#define	IT_LANGMATCHES	303
+#define	IT_DATATYPE	304
+#define	IT_BOUND	305
+#define	IT_isIRI	306
+#define	IT_isURI	307
+#define	IT_isBLANK	308
+#define	IT_isLITERAL	309
+#define	IT_REGEX	310
+#define	GT_DTYPE	311
+#define	IT_true	312
+#define	IT_false	313
+#define	Q_IRI_REF	314
+#define	QNAME_NS	315
+#define	QNAME	316
+#define	BLANK_NODE_LABEL	317
+#define	VAR1	318
+#define	VAR2	319
+#define	LANGTAG	320
+#define	INTEGER	321
+#define	DECIMAL	322
+#define	DOUBLE	323
+#define	STRING_LITERAL1	324
+#define	STRING_LITERAL2	325
+#define	STRING_LITERAL_LONG1	326
+#define	STRING_LITERAL_LONG2	327
+#define	NIL	328
+#define	ANON	329
+
+
+#line 263 "/usr/share/bison++/bison.cc"
+ /* #defines tokens */
+#else
+/* CLASS */
+#ifndef YY_sparqlParser_CLASS
+#define YY_sparqlParser_CLASS sparqlParser
+#endif
+#ifndef YY_sparqlParser_INHERIT
+#define YY_sparqlParser_INHERIT
+#endif
+#ifndef YY_sparqlParser_MEMBERS
+#define YY_sparqlParser_MEMBERS 
+#endif
+#ifndef YY_sparqlParser_LEX_BODY
+#define YY_sparqlParser_LEX_BODY  
+#endif
+#ifndef YY_sparqlParser_ERROR_BODY
+#define YY_sparqlParser_ERROR_BODY  
+#endif
+#ifndef YY_sparqlParser_CONSTRUCTOR_PARAM
+#define YY_sparqlParser_CONSTRUCTOR_PARAM
+#endif
+#ifndef YY_sparqlParser_CONSTRUCTOR_CODE
+#define YY_sparqlParser_CONSTRUCTOR_CODE
+#endif
+#ifndef YY_sparqlParser_CONSTRUCTOR_INIT
+#define YY_sparqlParser_CONSTRUCTOR_INIT
+#endif
+/* choose between enum and const */
+#ifndef YY_sparqlParser_USE_CONST_TOKEN
+#define YY_sparqlParser_USE_CONST_TOKEN 0
+/* yes enum is more compatible with flex,  */
+/* so by default we use it */ 
+#endif
+#if YY_sparqlParser_USE_CONST_TOKEN != 0
+#ifndef YY_sparqlParser_ENUM_TOKEN
+#define YY_sparqlParser_ENUM_TOKEN yy_sparqlParser_enum_token
+#endif
+#endif
+
+class YY_sparqlParser_CLASS YY_sparqlParser_INHERIT
+{
+public: 
+#if YY_sparqlParser_USE_CONST_TOKEN != 0
+/* static const int token ... */
+
+ #line 307 "/usr/share/bison++/bison.cc"
+static const int IT_BASE;
+static const int IT_PREFIX;
+static const int IT_SELECT;
+static const int IT_DISTINCT;
+static const int GT_TIMES;
+static const int IT_CONSTRUCT;
+static const int IT_DESCRIBE;
+static const int IT_ASK;
+static const int IT_FROM;
+static const int IT_NAMED;
+static const int IT_WHERE;
+static const int IT_ORDER;
+static const int IT_BY;
+static const int IT_ASC;
+static const int IT_DESC;
+static const int IT_LIMIT;
+static const int IT_OFFSET;
+static const int GT_LCURLEY;
+static const int GT_RCURLEY;
+static const int GT_DOT;
+static const int IT_OPTIONAL;
+static const int IT_GRAPH;
+static const int IT_UNION;
+static const int IT_FILTER;
+static const int GT_COMMA;
+static const int GT_LPAREN;
+static const int GT_RPAREN;
+static const int GT_SEMI;
+static const int IT_a;
+static const int GT_LBRACKET;
+static const int GT_RBRACKET;
+static const int GT_MINUS;
+static const int GT_PLUS;
+static const int GT_OR;
+static const int GT_AND;
+static const int GT_EQUAL;
+static const int GT_NEQUAL;
+static const int GT_LT;
+static const int GT_GT;
+static const int GT_LE;
+static const int GT_GE;
+static const int GT_DIVIDE;
+static const int GT_NOT;
+static const int IT_STR;
+static const int IT_LANG;
+static const int IT_LANGMATCHES;
+static const int IT_DATATYPE;
+static const int IT_BOUND;
+static const int IT_isIRI;
+static const int IT_isURI;
+static const int IT_isBLANK;
+static const int IT_isLITERAL;
+static const int IT_REGEX;
+static const int GT_DTYPE;
+static const int IT_true;
+static const int IT_false;
+static const int Q_IRI_REF;
+static const int QNAME_NS;
+static const int QNAME;
+static const int BLANK_NODE_LABEL;
+static const int VAR1;
+static const int VAR2;
+static const int LANGTAG;
+static const int INTEGER;
+static const int DECIMAL;
+static const int DOUBLE;
+static const int STRING_LITERAL1;
+static const int STRING_LITERAL2;
+static const int STRING_LITERAL_LONG1;
+static const int STRING_LITERAL_LONG2;
+static const int NIL;
+static const int ANON;
+
+
+#line 307 "/usr/share/bison++/bison.cc"
+ /* decl const */
+#else
+enum YY_sparqlParser_ENUM_TOKEN { YY_sparqlParser_NULL_TOKEN=0
+
+ #line 310 "/usr/share/bison++/bison.cc"
+	,IT_BASE=258
+	,IT_PREFIX=259
+	,IT_SELECT=260
+	,IT_DISTINCT=261
+	,GT_TIMES=262
+	,IT_CONSTRUCT=263
+	,IT_DESCRIBE=264
+	,IT_ASK=265
+	,IT_FROM=266
+	,IT_NAMED=267
+	,IT_WHERE=268
+	,IT_ORDER=269
+	,IT_BY=270
+	,IT_ASC=271
+	,IT_DESC=272
+	,IT_LIMIT=273
+	,IT_OFFSET=274
+	,GT_LCURLEY=275
+	,GT_RCURLEY=276
+	,GT_DOT=277
+	,IT_OPTIONAL=278
+	,IT_GRAPH=279
+	,IT_UNION=280
+	,IT_FILTER=281
+	,GT_COMMA=282
+	,GT_LPAREN=283
+	,GT_RPAREN=284
+	,GT_SEMI=285
+	,IT_a=286
+	,GT_LBRACKET=287
+	,GT_RBRACKET=288
+	,GT_MINUS=289
+	,GT_PLUS=290
+	,GT_OR=291
+	,GT_AND=292
+	,GT_EQUAL=293
+	,GT_NEQUAL=294
+	,GT_LT=295
+	,GT_GT=296
+	,GT_LE=297
+	,GT_GE=298
+	,GT_DIVIDE=299
+	,GT_NOT=300
+	,IT_STR=301
+	,IT_LANG=302
+	,IT_LANGMATCHES=303
+	,IT_DATATYPE=304
+	,IT_BOUND=305
+	,IT_isIRI=306
+	,IT_isURI=307
+	,IT_isBLANK=308
+	,IT_isLITERAL=309
+	,IT_REGEX=310
+	,GT_DTYPE=311
+	,IT_true=312
+	,IT_false=313
+	,Q_IRI_REF=314
+	,QNAME_NS=315
+	,QNAME=316
+	,BLANK_NODE_LABEL=317
+	,VAR1=318
+	,VAR2=319
+	,LANGTAG=320
+	,INTEGER=321
+	,DECIMAL=322
+	,DOUBLE=323
+	,STRING_LITERAL1=324
+	,STRING_LITERAL2=325
+	,STRING_LITERAL_LONG1=326
+	,STRING_LITERAL_LONG2=327
+	,NIL=328
+	,ANON=329
+
+
+#line 310 "/usr/share/bison++/bison.cc"
+ /* enum token */
+     }; /* end of enum declaration */
+#endif
+public:
+ int YY_sparqlParser_PARSE (YY_sparqlParser_PARSE_PARAM);
+ virtual void YY_sparqlParser_ERROR(char *msg) YY_sparqlParser_ERROR_BODY;
+#ifdef YY_sparqlParser_PURE
+#ifdef YY_sparqlParser_LSP_NEEDED
+ virtual int  YY_sparqlParser_LEX (YY_sparqlParser_STYPE *YY_sparqlParser_LVAL,YY_sparqlParser_LTYPE *YY_sparqlParser_LLOC) YY_sparqlParser_LEX_BODY;
+#else
+ virtual int  YY_sparqlParser_LEX (YY_sparqlParser_STYPE *YY_sparqlParser_LVAL) YY_sparqlParser_LEX_BODY;
+#endif
+#else
+ virtual int YY_sparqlParser_LEX() YY_sparqlParser_LEX_BODY;
+ YY_sparqlParser_STYPE YY_sparqlParser_LVAL;
+#ifdef YY_sparqlParser_LSP_NEEDED
+ YY_sparqlParser_LTYPE YY_sparqlParser_LLOC;
+#endif
+ int   YY_sparqlParser_NERRS;
+ int    YY_sparqlParser_CHAR;
+#endif
+#if YY_sparqlParser_DEBUG != 0
+ int YY_sparqlParser_DEBUG_FLAG;   /*  nonzero means print parse trace     */
+#endif
+public:
+ YY_sparqlParser_CLASS(YY_sparqlParser_CONSTRUCTOR_PARAM);
+ virtual ~YY_sparqlParser_CLASS() {;}
+public:
+ YY_sparqlParser_MEMBERS 
+};
+/* other declare folow */
+#if YY_sparqlParser_USE_CONST_TOKEN != 0
+
+ #line 341 "/usr/share/bison++/bison.cc"
+const int YY_sparqlParser_CLASS::IT_BASE=258;
+const int YY_sparqlParser_CLASS::IT_PREFIX=259;
+const int YY_sparqlParser_CLASS::IT_SELECT=260;
+const int YY_sparqlParser_CLASS::IT_DISTINCT=261;
+const int YY_sparqlParser_CLASS::GT_TIMES=262;
+const int YY_sparqlParser_CLASS::IT_CONSTRUCT=263;
+const int YY_sparqlParser_CLASS::IT_DESCRIBE=264;
+const int YY_sparqlParser_CLASS::IT_ASK=265;
+const int YY_sparqlParser_CLASS::IT_FROM=266;
+const int YY_sparqlParser_CLASS::IT_NAMED=267;
+const int YY_sparqlParser_CLASS::IT_WHERE=268;
+const int YY_sparqlParser_CLASS::IT_ORDER=269;
+const int YY_sparqlParser_CLASS::IT_BY=270;
+const int YY_sparqlParser_CLASS::IT_ASC=271;
+const int YY_sparqlParser_CLASS::IT_DESC=272;
+const int YY_sparqlParser_CLASS::IT_LIMIT=273;
+const int YY_sparqlParser_CLASS::IT_OFFSET=274;
+const int YY_sparqlParser_CLASS::GT_LCURLEY=275;
+const int YY_sparqlParser_CLASS::GT_RCURLEY=276;
+const int YY_sparqlParser_CLASS::GT_DOT=277;
+const int YY_sparqlParser_CLASS::IT_OPTIONAL=278;
+const int YY_sparqlParser_CLASS::IT_GRAPH=279;
+const int YY_sparqlParser_CLASS::IT_UNION=280;
+const int YY_sparqlParser_CLASS::IT_FILTER=281;
+const int YY_sparqlParser_CLASS::GT_COMMA=282;
+const int YY_sparqlParser_CLASS::GT_LPAREN=283;
+const int YY_sparqlParser_CLASS::GT_RPAREN=284;
+const int YY_sparqlParser_CLASS::GT_SEMI=285;
+const int YY_sparqlParser_CLASS::IT_a=286;
+const int YY_sparqlParser_CLASS::GT_LBRACKET=287;
+const int YY_sparqlParser_CLASS::GT_RBRACKET=288;
+const int YY_sparqlParser_CLASS::GT_MINUS=289;
+const int YY_sparqlParser_CLASS::GT_PLUS=290;
+const int YY_sparqlParser_CLASS::GT_OR=291;
+const int YY_sparqlParser_CLASS::GT_AND=292;
+const int YY_sparqlParser_CLASS::GT_EQUAL=293;
+const int YY_sparqlParser_CLASS::GT_NEQUAL=294;
+const int YY_sparqlParser_CLASS::GT_LT=295;
+const int YY_sparqlParser_CLASS::GT_GT=296;
+const int YY_sparqlParser_CLASS::GT_LE=297;
+const int YY_sparqlParser_CLASS::GT_GE=298;
+const int YY_sparqlParser_CLASS::GT_DIVIDE=299;
+const int YY_sparqlParser_CLASS::GT_NOT=300;
+const int YY_sparqlParser_CLASS::IT_STR=301;
+const int YY_sparqlParser_CLASS::IT_LANG=302;
+const int YY_sparqlParser_CLASS::IT_LANGMATCHES=303;
+const int YY_sparqlParser_CLASS::IT_DATATYPE=304;
+const int YY_sparqlParser_CLASS::IT_BOUND=305;
+const int YY_sparqlParser_CLASS::IT_isIRI=306;
+const int YY_sparqlParser_CLASS::IT_isURI=307;
+const int YY_sparqlParser_CLASS::IT_isBLANK=308;
+const int YY_sparqlParser_CLASS::IT_isLITERAL=309;
+const int YY_sparqlParser_CLASS::IT_REGEX=310;
+const int YY_sparqlParser_CLASS::GT_DTYPE=311;
+const int YY_sparqlParser_CLASS::IT_true=312;
+const int YY_sparqlParser_CLASS::IT_false=313;
+const int YY_sparqlParser_CLASS::Q_IRI_REF=314;
+const int YY_sparqlParser_CLASS::QNAME_NS=315;
+const int YY_sparqlParser_CLASS::QNAME=316;
+const int YY_sparqlParser_CLASS::BLANK_NODE_LABEL=317;
+const int YY_sparqlParser_CLASS::VAR1=318;
+const int YY_sparqlParser_CLASS::VAR2=319;
+const int YY_sparqlParser_CLASS::LANGTAG=320;
+const int YY_sparqlParser_CLASS::INTEGER=321;
+const int YY_sparqlParser_CLASS::DECIMAL=322;
+const int YY_sparqlParser_CLASS::DOUBLE=323;
+const int YY_sparqlParser_CLASS::STRING_LITERAL1=324;
+const int YY_sparqlParser_CLASS::STRING_LITERAL2=325;
+const int YY_sparqlParser_CLASS::STRING_LITERAL_LONG1=326;
+const int YY_sparqlParser_CLASS::STRING_LITERAL_LONG2=327;
+const int YY_sparqlParser_CLASS::NIL=328;
+const int YY_sparqlParser_CLASS::ANON=329;
+
+
+#line 341 "/usr/share/bison++/bison.cc"
+ /* const YY_sparqlParser_CLASS::token */
+#endif
+/*apres const  */
+YY_sparqlParser_CLASS::YY_sparqlParser_CLASS(YY_sparqlParser_CONSTRUCTOR_PARAM) YY_sparqlParser_CONSTRUCTOR_INIT
+{
+#if YY_sparqlParser_DEBUG != 0
+YY_sparqlParser_DEBUG_FLAG=0;
+#endif
+YY_sparqlParser_CONSTRUCTOR_CODE;
+};
+#endif
+
+ #line 352 "/usr/share/bison++/bison.cc"
+
+
+#define	YYFINAL		348
+#define	YYFLAG		-32768
+#define	YYNTBASE	75
+
+#define YYTRANSLATE(x) ((unsigned)(x) <= 329 ? yytranslate[x] : 223)
+
+static const char yytranslate[] = {     0,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     1,     2,     3,     4,     5,
+     6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
+    16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
+    26,    27,    28,    29,    30,    31,    32,    33,    34,    35,
+    36,    37,    38,    39,    40,    41,    42,    43,    44,    45,
+    46,    47,    48,    49,    50,    51,    52,    53,    54,    55,
+    56,    57,    58,    59,    60,    61,    62,    63,    64,    65,
+    66,    67,    68,    69,    70,    71,    72,    73,    74
+};
+
+#if YY_sparqlParser_DEBUG != 0
+static const short yyprhs[] = {     0,
+     0,     1,     5,     7,     9,    11,    13,    16,    17,    19,
+    20,    23,    26,    30,    31,    32,    41,    42,    44,    46,
+    49,    51,    53,    54,    57,    63,    69,    71,    74,    76,
+    78,    79,    81,    85,    88,    90,    92,    94,    97,    99,
+   100,   104,   105,   107,   111,   112,   114,   115,   117,   118,
+   120,   124,   126,   129,   131,   133,   135,   137,   140,   142,
+   144,   146,   149,   152,   153,   158,   161,   162,   164,   168,
+   169,   171,   174,   175,   177,   181,   182,   184,   187,   188,
+   190,   193,   194,   197,   199,   201,   203,   204,   208,   209,
+   214,   215,   219,   220,   224,   225,   228,   231,   233,   235,
+   237,   240,   242,   245,   246,   249,   251,   252,   258,   262,
+   264,   267,   268,   270,   273,   274,   276,   277,   281,   282,
+   286,   288,   289,   291,   292,   297,   300,   301,   303,   304,
+   308,   311,   312,   314,   316,   318,   320,   322,   323,   328,
+   329,   334,   336,   339,   341,   343,   345,   347,   349,   351,
+   353,   355,   357,   359,   361,   363,   365,   368,   370,   372,
+   374,   376,   378,   379,   381,   383,   384,   388,   391,   392,
+   395,   396,   400,   403,   404,   407,   409,   410,   414,   417,
+   420,   423,   426,   429,   432,   433,   435,   437,   438,   442,
+   445,   448,   449,   452,   453,   457,   460,   463,   464,   467,
+   470,   473,   476,   478,   480,   482,   484,   486,   488,   490,
+   492,   494,   498,   503,   508,   515,   520,   525,   530,   535,
+   540,   545,   547,   555,   556,   558,   561,   562,   564,   567,
+   570,   572,   574,   575,   577,   579,   581,   583,   585,   587,
+   589,   591,   593,   595,   597,   599,   601,   603,   605
+};
+
+static const short yyrhs[] = {    -1,
+    76,    78,    77,     0,    83,     0,    90,     0,    91,     0,
+    95,     0,    79,    80,     0,     0,    81,     0,     0,    80,
+    82,     0,     3,    59,     0,     4,    60,    59,     0,     0,
+     0,     5,    84,    86,    88,    85,    89,   101,   104,     0,
+     0,     6,     0,   178,     0,    87,   178,     0,    87,     0,
+     7,     0,     0,    89,    96,     0,     8,   148,    89,   101,
+   104,     0,     9,    93,    89,    94,   104,     0,   176,     0,
+    92,   176,     0,    92,     0,     7,     0,     0,   101,     0,
+    10,    89,   101,     0,    11,    97,     0,    98,     0,    99,
+     0,   100,     0,    12,   100,     0,   220,     0,     0,   103,
+   102,   116,     0,     0,    13,     0,   105,   106,   107,     0,
+     0,   108,     0,     0,   114,     0,     0,   115,     0,    14,
+    15,   109,     0,   110,     0,   109,   110,     0,   112,     0,
+   113,     0,    16,     0,    17,     0,   111,   207,     0,   142,
+     0,   178,     0,   207,     0,    18,    66,     0,    19,    66,
+     0,     0,    20,   117,   118,    21,     0,   122,   121,     0,
+     0,    22,     0,   130,   119,   118,     0,     0,   120,     0,
+   123,   125,     0,     0,   126,     0,   140,   119,   122,     0,
+     0,   124,     0,   154,   129,     0,     0,   154,     0,    22,
+   127,     0,     0,   129,   128,     0,   131,     0,   135,     0,
+   133,     0,     0,    23,   132,   116,     0,     0,    24,   177,
+   134,   116,     0,     0,   116,   136,   139,     0,     0,    25,
+   138,   116,     0,     0,   139,   137,     0,    26,   141,     0,
+   207,     0,   208,     0,   142,     0,   220,   143,     0,   146,
+     0,    27,   182,     0,     0,   145,   144,     0,    73,     0,
+     0,    28,   147,   182,   145,    29,     0,    20,   149,    21,
+     0,   153,     0,    22,   149,     0,     0,   150,     0,   154,
+   151,     0,     0,   152,     0,     0,   175,   155,   159,     0,
+     0,   168,   156,   157,     0,   158,     0,     0,   159,     0,
+     0,   167,   160,   163,   162,     0,    30,   157,     0,     0,
+   161,     0,     0,   174,   164,   166,     0,    27,   163,     0,
+     0,   165,     0,   176,     0,    31,     0,   171,     0,   169,
+     0,     0,    32,   170,   159,    33,     0,     0,    28,   172,
+   173,    29,     0,   174,     0,   173,   174,     0,   175,     0,
+   168,     0,   178,     0,   179,     0,   178,     0,   220,     0,
+   178,     0,   222,     0,   220,     0,    63,     0,    64,     0,
+   220,     0,   213,     0,   181,   217,     0,   218,     0,   222,
+     0,    73,     0,    34,     0,    35,     0,     0,   180,     0,
+   183,     0,     0,   187,   184,   186,     0,    36,   187,     0,
+     0,   186,   185,     0,     0,   191,   188,   190,     0,    37,
+   191,     0,     0,   190,   189,     0,   192,     0,     0,   196,
+   193,   195,     0,    38,   196,     0,    39,   196,     0,    40,
+   196,     0,    41,   196,     0,    42,   196,     0,    43,   196,
+     0,     0,   194,     0,   197,     0,     0,   201,   198,   200,
+     0,    35,   201,     0,    34,   201,     0,     0,   200,   199,
+     0,     0,   205,   202,   204,     0,     7,   205,     0,    44,
+   205,     0,     0,   204,   203,     0,    45,   206,     0,    35,
+   206,     0,    34,   206,     0,   206,     0,   207,     0,   208,
+     0,   211,     0,   213,     0,   217,     0,   218,     0,   222,
+     0,   178,     0,    28,   182,    29,     0,    46,    28,   182,
+    29,     0,    47,    28,   182,    29,     0,    48,    28,   182,
+    27,   182,    29,     0,    49,    28,   182,    29,     0,    50,
+    28,   178,    29,     0,    51,    28,   182,    29,     0,    52,
+    28,   182,    29,     0,    53,    28,   182,    29,     0,    54,
+    28,   182,    29,     0,   209,     0,    55,    28,   182,    27,
+   182,   210,    29,     0,     0,   144,     0,   220,   212,     0,
+     0,   143,     0,   219,   216,     0,    56,   220,     0,    65,
+     0,   214,     0,     0,   215,     0,    66,     0,    67,     0,
+    68,     0,    57,     0,    58,     0,    69,     0,    70,     0,
+    71,     0,    72,     0,    59,     0,   221,     0,    61,     0,
+    60,     0,    62,     0,    74,     0
+};
+
+#endif
+
+#if (YY_sparqlParser_DEBUG != 0) || defined(YY_sparqlParser_ERROR_VERBOSE) 
+static const short yyrline[] = { 0,
+   718,   729,   736,   738,   739,   740,   742,   745,   747,   749,
+   751,   753,   756,   759,   768,   777,   790,   792,   798,   812,
+   821,   823,   827,   829,   831,   834,   837,   839,   841,   843,
+   845,   847,   849,   852,   855,   857,   859,   862,   865,   868,
+   879,   899,   901,   903,   906,   908,   910,   912,   914,   916,
+   918,   921,   923,   925,   927,   929,   931,   933,   943,   945,
+   946,   948,   957,   966,   973,   982,   985,   987,   989,   992,
+   994,   996,   999,  1001,  1003,  1006,  1008,  1010,  1013,  1015,
+  1017,  1020,  1022,  1024,  1026,  1027,  1029,  1038,  1055,  1063,
+  1067,  1073,  1095,  1104,  1109,  1113,  1120,  1131,  1133,  1134,
+  1136,  1140,  1143,  1146,  1148,  1153,  1155,  1159,  1165,  1168,
+  1171,  1174,  1176,  1178,  1181,  1183,  1185,  1191,  1195,  1200,
+  1205,  1208,  1210,  1212,  1217,  1223,  1226,  1228,  1230,  1236,
+  1238,  1241,  1243,  1245,  1247,  1249,  1251,  1253,  1258,  1264,
+  1271,  1277,  1283,  1290,  1292,  1294,  1296,  1298,  1300,  1302,
+  1304,  1305,  1307,  1312,  1317,  1319,  1320,  1321,  1322,  1323,
+  1325,  1327,  1329,  1331,  1333,  1336,  1342,  1354,  1360,  1362,
+  1364,  1370,  1382,  1388,  1390,  1392,  1395,  1402,  1417,  1423,
+  1428,  1433,  1438,  1443,  1449,  1451,  1453,  1456,  1463,  1482,
+  1489,  1496,  1498,  1500,  1507,  1526,  1533,  1540,  1542,  1544,
+  1549,  1550,  1554,  1556,  1558,  1559,  1560,  1561,  1562,  1563,
+  1564,  1566,  1569,  1571,  1572,  1573,  1574,  1575,  1576,  1577,
+  1578,  1579,  1581,  1584,  1586,  1588,  1592,  1594,  1596,  1599,
+  1602,  1604,  1606,  1608,  1610,  1612,  1613,  1615,  1617,  1619,
+  1621,  1622,  1623,  1625,  1627,  1629,  1631,  1633,  1635
+};
+
+static const char * const yytname[] = {   "$","error","$illegal.","IT_BASE",
+"IT_PREFIX","IT_SELECT","IT_DISTINCT","GT_TIMES","IT_CONSTRUCT","IT_DESCRIBE",
+"IT_ASK","IT_FROM","IT_NAMED","IT_WHERE","IT_ORDER","IT_BY","IT_ASC","IT_DESC",
+"IT_LIMIT","IT_OFFSET","GT_LCURLEY","GT_RCURLEY","GT_DOT","IT_OPTIONAL","IT_GRAPH",
+"IT_UNION","IT_FILTER","GT_COMMA","GT_LPAREN","GT_RPAREN","GT_SEMI","IT_a","GT_LBRACKET",
+"GT_RBRACKET","GT_MINUS","GT_PLUS","GT_OR","GT_AND","GT_EQUAL","GT_NEQUAL","GT_LT",
+"GT_GT","GT_LE","GT_GE","GT_DIVIDE","GT_NOT","IT_STR","IT_LANG","IT_LANGMATCHES",
+"IT_DATATYPE","IT_BOUND","IT_isIRI","IT_isURI","IT_isBLANK","IT_isLITERAL","IT_REGEX",
+"GT_DTYPE","IT_true","IT_false","Q_IRI_REF","QNAME_NS","QNAME","BLANK_NODE_LABEL",
+"VAR1","VAR2","LANGTAG","INTEGER","DECIMAL","DOUBLE","STRING_LITERAL1","STRING_LITERAL2",
+"STRING_LITERAL_LONG1","STRING_LITERAL_LONG2","NIL","ANON","Query","@1","_O_QSelectQuery_E__Or__QConstructQuery_E__Or__QDescribeQuery_E__Or__QAskQuery_E__C",
+"Prolog","_QBaseDecl_E_Opt","_QPrefixDecl_E_Star","BaseDecl","PrefixDecl","SelectQuery",
+"@2","@3","_QDISTINCT_E_Opt","_QVar_E_Plus","_O_QVar_E_Plus_Or__QTIMES_E__C",
+"_QDatasetClause_E_Star","ConstructQuery","DescribeQuery","_QVarOrIRIref_E_Plus",
+"_O_QVarOrIRIref_E_Plus_Or__QTIMES_E__C","_QWhereClause_E_Opt","AskQuery","DatasetClause",
+"_O_QDefaultGraphClause_E__Or__QNamedGraphClause_E__C","DefaultGraphClause",
+"NamedGraphClause","SourceSelector","WhereClause","@4","_QWHERE_E_Opt","SolutionModifier",
+"_QOrderClause_E_Opt","_QLimitClause_E_Opt","_QOffsetClause_E_Opt","OrderClause",
+"_QOrderCondition_E_Plus","OrderCondition","_O_QASC_E__Or__QDESC_E__C","_O_QASC_E__Or__QDESC_E____QBrackettedExpression_E__C",
+"_O_QFunctionCall_E__Or__QVar_E__Or__QBrackettedExpression_E__C","LimitClause",
+"OffsetClause","GroupGraphPattern","@5","GraphPattern","_QDOT_E_Opt","_O_QGraphPatternNotTriples_E____QDOT_E_Opt___QGraphPattern_E__C",
+"_Q_O_QGraphPatternNotTriples_E____QDOT_E_Opt___QGraphPattern_E__C_E_Opt","FilteredBasicGraphPattern",
+"_QBlockOfTriples_E_Opt","_O_QConstraint_E____QDOT_E_Opt___QFilteredBasicGraphPattern_E__C",
+"_Q_O_QConstraint_E____QDOT_E_Opt___QFilteredBasicGraphPattern_E__C_E_Opt","BlockOfTriples",
+"_QTriplesSameSubject_E_Opt","_O_QDOT_E____QTriplesSameSubject_E_Opt_C","_Q_O_QDOT_E____QTriplesSameSubject_E_Opt_C_E_Star",
+"GraphPatternNotTriples","OptionalGraphPattern","@6","GraphGraphPattern","@7",
+"GroupOrUnionGraphPattern","@8","_O_QUNION_E____QGroupGraphPattern_E__C","@9",
+"_Q_O_QUNION_E____QGroupGraphPattern_E__C_E_Star","Constraint","_O_QBrackettedExpression_E__Or__QBuiltInCall_E__Or__QFunctionCall_E__C",
+"FunctionCall","ArgList","_O_QCOMMA_E____QExpression_E__C","_Q_O_QCOMMA_E____QExpression_E__C_E_Star",
+"_O_QNIL_E__Or__QLPAREN_E____QExpression_E____QCOMMA_E____QExpression_E_Star___QRPAREN_E__C",
+"@10","ConstructTemplate","ConstructTriples","_O_QDOT_E____QConstructTriples_E__C",
+"_Q_O_QDOT_E____QConstructTriples_E__C_E_Opt","_O_QTriplesSameSubject_E____QDOT_E____QConstructTriples_E_Opt_C",
+"_Q_O_QTriplesSameSubject_E____QDOT_E____QConstructTriples_E_Opt_C_E_Opt","TriplesSameSubject",
+"@11","@12","PropertyList","_QPropertyListNotEmpty_E_Opt","PropertyListNotEmpty",
+"@13","_O_QSEMI_E____QPropertyList_E__C","_Q_O_QSEMI_E____QPropertyList_E__C_E_Opt",
+"ObjectList","@14","_O_QCOMMA_E____QObjectList_E__C","_Q_O_QCOMMA_E____QObjectList_E__C_E_Opt",
+"Verb","TriplesNode","BlankNodePropertyList","@15","Collection","@16","_QGraphNode_E_Plus",
+"GraphNode","VarOrTerm","VarOrIRIref","VarOrBlankNodeOrIRIref","Var","GraphTerm",
+"_O_QMINUS_E__Or__QPLUS_E__C","_Q_O_QMINUS_E__Or__QPLUS_E__C_E_Opt","Expression",
+"ConditionalOrExpression","@17","_O_QOR_E____QConditionalAndExpression_E__C",
+"_Q_O_QOR_E____QConditionalAndExpression_E__C_E_Star","ConditionalAndExpression",
+"@18","_O_QAND_E____QValueLogical_E__C","_Q_O_QAND_E____QValueLogical_E__C_E_Star",
+"ValueLogical","RelationalExpression","@19","_O_QEQUAL_E____QNumericExpression_E__Or__QNEQUAL_E____QNumericExpression_E__Or__QLT_E____QNumericExpression_E__Or__QGT_E____QNumericExpression_E__Or__QLE_E____QNumericExpression_E__Or__QGE_E____QNumericExpression_E__C",
+"_Q_O_QEQUAL_E____QNumericExpression_E__Or__QNEQUAL_E____QNumericExpression_E__Or__QLT_E____QNumericExpression_E__Or__QGT_E____QNumericExpression_E__Or__QLE_E____QNumericExpression_E__Or__QGE_E____QNumericExpression_E__C_E_Opt",
+"NumericExpression","AdditiveExpression","@20","_O_QPLUS_E____QMultiplicativeExpression_E__Or__QMINUS_E____QMultiplicativeExpression_E__C",
+"_Q_O_QPLUS_E____QMultiplicativeExpression_E__Or__QMINUS_E____QMultiplicativeExpression_E__C_E_Star",
+"MultiplicativeExpression","@21","_O_QTIMES_E____QUnaryExpression_E__Or__QDIVIDE_E____QUnaryExpression_E__C",
+"_Q_O_QTIMES_E____QUnaryExpression_E__Or__QDIVIDE_E____QUnaryExpression_E__C_E_Star",
+"UnaryExpression","PrimaryExpression","BrackettedExpression","BuiltInCall","RegexExpression",
+"_Q_O_QCOMMA_E____QExpression_E__C_E_Opt","IRIrefOrFunction","_QArgList_E_Opt",
+"RDFLiteral","_O_QDTYPE_E____QIRIref_E__C","_O_QLANGTAG_E__Or__QDTYPE_E____QIRIref_E__C",
+"_Q_O_QLANGTAG_E__Or__QDTYPE_E____QIRIref_E__C_E_Opt","NumericLiteral","BooleanLiteral",
+"String","IRIref","QName","BlankNode",""
+};
+#endif
+
+static const short yyr1[] = {     0,
+    76,    75,    77,    77,    77,    77,    78,    79,    79,    80,
+    80,    81,    82,    84,    85,    83,    86,    86,    87,    87,
+    88,    88,    89,    89,    90,    91,    92,    92,    93,    93,
+    94,    94,    95,    96,    97,    97,    98,    99,   100,   102,
+   101,   103,   103,   104,   105,   105,   106,   106,   107,   107,
+   108,   109,   109,   110,   110,   111,   111,   112,   113,   113,
+   113,   114,   115,   117,   116,   118,   119,   119,   120,   121,
+   121,   122,   123,   123,   124,   125,   125,   126,   127,   127,
+   128,   129,   129,   130,   130,   130,   132,   131,   134,   133,
+   136,   135,   138,   137,   139,   139,   140,   141,   141,   141,
+   142,   143,   144,   145,   145,   146,   147,   146,   148,   149,
+   150,   151,   151,   152,   153,   153,   155,   154,   156,   154,
+   157,   158,   158,   160,   159,   161,   162,   162,   164,   163,
+   165,   166,   166,   167,   167,   168,   168,   170,   169,   172,
+   171,   173,   173,   174,   174,   175,   175,   176,   176,   177,
+   177,   177,   178,   178,   179,   179,   179,   179,   179,   179,
+   180,   180,   181,   181,   182,   184,   183,   185,   186,   186,
+   188,   187,   189,   190,   190,   191,   193,   192,   194,   194,
+   194,   194,   194,   194,   195,   195,   196,   198,   197,   199,
+   199,   200,   200,   202,   201,   203,   203,   204,   204,   205,
+   205,   205,   205,   206,   206,   206,   206,   206,   206,   206,
+   206,   207,   208,   208,   208,   208,   208,   208,   208,   208,
+   208,   208,   209,   210,   210,   211,   212,   212,   213,   214,
+   215,   215,   216,   216,   217,   217,   217,   218,   218,   219,
+   219,   219,   219,   220,   220,   221,   221,   222,   222
+};
+
+static const short yyr2[] = {     0,
+     0,     3,     1,     1,     1,     1,     2,     0,     1,     0,
+     2,     2,     3,     0,     0,     8,     0,     1,     1,     2,
+     1,     1,     0,     2,     5,     5,     1,     2,     1,     1,
+     0,     1,     3,     2,     1,     1,     1,     2,     1,     0,
+     3,     0,     1,     3,     0,     1,     0,     1,     0,     1,
+     3,     1,     2,     1,     1,     1,     1,     2,     1,     1,
+     1,     2,     2,     0,     4,     2,     0,     1,     3,     0,
+     1,     2,     0,     1,     3,     0,     1,     2,     0,     1,
+     2,     0,     2,     1,     1,     1,     0,     3,     0,     4,
+     0,     3,     0,     3,     0,     2,     2,     1,     1,     1,
+     2,     1,     2,     0,     2,     1,     0,     5,     3,     1,
+     2,     0,     1,     2,     0,     1,     0,     3,     0,     3,
+     1,     0,     1,     0,     4,     2,     0,     1,     0,     3,
+     2,     0,     1,     1,     1,     1,     1,     0,     4,     0,
+     4,     1,     2,     1,     1,     1,     1,     1,     1,     1,
+     1,     1,     1,     1,     1,     1,     2,     1,     1,     1,
+     1,     1,     0,     1,     1,     0,     3,     2,     0,     2,
+     0,     3,     2,     0,     2,     1,     0,     3,     2,     2,
+     2,     2,     2,     2,     0,     1,     1,     0,     3,     2,
+     2,     0,     2,     0,     3,     2,     2,     0,     2,     2,
+     2,     2,     1,     1,     1,     1,     1,     1,     1,     1,
+     1,     3,     4,     4,     6,     4,     4,     4,     4,     4,
+     4,     1,     7,     0,     1,     2,     0,     1,     2,     2,
+     1,     1,     0,     1,     1,     1,     1,     1,     1,     1,
+     1,     1,     1,     1,     1,     1,     1,     1,     1
+};
+
+static const short yydefact[] = {     1,
+     8,     0,     0,    10,     9,    12,    14,     0,     0,    23,
+     2,     3,     4,     5,     6,     7,    17,   163,    23,    30,
+   244,   247,   246,   153,   154,    29,    23,    27,   148,   149,
+   245,    42,     0,    11,    18,     0,   140,   138,   161,   162,
+   238,   239,   248,   240,   241,   242,   243,   160,   249,     0,
+   116,   110,   112,   119,   137,   136,   117,   146,   147,   164,
+     0,   156,   158,   233,   155,   159,    42,    28,    31,     0,
+    43,    24,    33,    40,     0,    22,    21,    15,    19,   163,
+     0,   109,   163,   113,   114,   122,     0,   235,   236,   237,
+   157,     0,   231,   232,   234,   229,    45,    45,    32,     0,
+    34,    35,    36,    37,    39,     0,    13,    20,    23,   145,
+   163,   142,   144,   135,     0,   124,   134,   111,   120,   121,
+   123,   118,   230,     0,    25,    47,    46,    26,    38,    64,
+    41,    42,   141,   143,   139,   163,     0,     0,    49,    48,
+    73,    45,   127,   129,    56,    57,     0,    51,    52,     0,
+    54,    55,    59,    60,    61,     0,    62,     0,    44,    50,
+     0,    70,    76,    74,    82,    16,   122,   128,   125,   132,
+     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+     0,     0,     0,   211,     0,   165,   166,   171,   176,   177,
+   187,   188,   194,   203,   204,   205,   222,   206,   207,   208,
+   209,   227,   210,    53,    58,   107,   106,   101,   102,    63,
+    65,    87,     0,    91,    71,    66,    67,    84,    86,    85,
+     0,    77,    72,    67,    78,   126,   163,   133,   130,   202,
+   201,   200,     0,     0,     0,     0,     0,     0,     0,     0,
+     0,     0,   212,   169,   174,   185,   192,   198,   228,   226,
+     0,     0,    89,   150,   152,   151,    95,    68,    73,    97,
+   100,    98,    99,    73,    79,    83,   131,     0,     0,     0,
+     0,     0,     0,     0,     0,     0,     0,   167,   172,     0,
+     0,     0,     0,     0,     0,   186,   178,   189,   195,   104,
+    88,     0,    92,    69,    75,    81,    80,   213,   214,     0,
+   216,   217,   218,   219,   220,   221,     0,     0,   170,     0,
+   175,   179,   180,   181,   182,   183,   184,     0,     0,   193,
+     0,     0,   199,     0,    90,    93,    96,     0,   224,   168,
+   173,   191,   190,   196,   197,     0,   108,   105,     0,   215,
+   225,     0,   103,    94,   223,     0,     0,     0
+};
+
+static const short yydefgoto[] = {   346,
+     1,    11,     3,     4,    16,     5,    34,    12,    17,   109,
+    36,    77,    78,    32,    13,    14,    26,    27,    98,    15,
+    72,   101,   102,   103,   104,    73,   106,    74,   125,   126,
+   139,   159,   127,   148,   149,   150,   151,   152,   140,   160,
+   131,   141,   161,   259,   215,   216,   162,   163,   222,   223,
+   164,   296,   266,   225,   217,   218,   252,   219,   292,   220,
+   257,   327,   339,   293,   224,   260,   153,   208,   338,   324,
+   209,   251,    19,    50,    84,    85,    51,    52,   165,    87,
+    86,   119,   120,   121,   136,   168,   169,   143,   170,   228,
+   229,   116,    54,    55,    81,    56,    80,   111,   144,    57,
+   117,   253,   184,    59,    60,    61,   185,   186,   244,   309,
+   278,   187,   245,   311,   279,   188,   189,   246,   286,   287,
+   190,   191,   247,   320,   288,   192,   248,   323,   289,   193,
+   194,   195,   196,   197,   342,   198,   250,   199,    94,    95,
+    96,   200,   201,    64,   202,    31,   203
+};
+
+static const short yypact[] = {-32768,
+    41,    -8,   200,-32768,-32768,-32768,-32768,    37,    74,-32768,
+-32768,-32768,-32768,-32768,-32768,    61,    64,   166,-32768,-32768,
+-32768,-32768,-32768,-32768,-32768,   116,-32768,-32768,-32768,-32768,
+-32768,    36,    13,-32768,-32768,    16,-32768,-32768,-32768,-32768,
+-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,    54,
+-32768,-32768,    60,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
+    48,-32768,-32768,   -30,-32768,-32768,    36,-32768,    35,    -7,
+-32768,-32768,-32768,-32768,    27,-32768,   -42,-32768,-32768,   388,
+   109,-32768,   166,-32768,-32768,   109,   109,-32768,-32768,-32768,
+-32768,    86,-32768,-32768,-32768,-32768,    75,    75,-32768,    86,
+-32768,-32768,-32768,-32768,-32768,    72,-32768,-32768,-32768,-32768,
+   341,-32768,-32768,-32768,    66,-32768,-32768,-32768,-32768,-32768,
+-32768,-32768,-32768,    93,-32768,    99,-32768,-32768,-32768,-32768,
+-32768,    36,-32768,-32768,-32768,   388,   125,    53,   102,-32768,
+   323,    75,    96,-32768,-32768,-32768,   241,   125,-32768,   121,
+-32768,-32768,-32768,-32768,-32768,   -10,-32768,    94,-32768,-32768,
+   160,   172,   104,-32768,-32768,-32768,   109,-32768,-32768,   155,
+   278,   278,   278,   162,   163,   165,   171,   174,   175,   178,
+   188,   189,   191,-32768,   192,-32768,-32768,-32768,-32768,-32768,
+-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
+-32768,   -10,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
+-32768,-32768,   -32,-32768,-32768,-32768,   209,-32768,-32768,-32768,
+   378,-32768,-32768,   209,   210,-32768,   388,-32768,-32768,-32768,
+-32768,-32768,   241,   241,   241,   241,   -42,   241,   241,   241,
+   241,   241,-32768,-32768,-32768,   124,-32768,-32768,-32768,-32768,
+   241,    72,-32768,-32768,-32768,-32768,-32768,-32768,   323,-32768,
+-32768,-32768,-32768,   323,   323,-32768,-32768,   193,   204,   214,
+   213,   217,   223,   224,   225,   234,   237,   229,   230,   241,
+   241,   241,   241,   241,   241,-32768,-32768,     5,     1,-32768,
+-32768,    72,   243,-32768,-32768,-32768,-32768,-32768,-32768,   241,
+-32768,-32768,-32768,-32768,-32768,-32768,   241,   241,-32768,   241,
+-32768,-32768,-32768,-32768,-32768,-32768,-32768,   241,   241,-32768,
+   241,   241,-32768,    31,-32768,-32768,-32768,   244,   247,-32768,
+-32768,-32768,-32768,-32768,-32768,   241,-32768,-32768,    72,-32768,
+-32768,   249,-32768,-32768,-32768,   270,   280,-32768
+};
+
+static const short yypgoto[] = {-32768,
+-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
+-32768,-32768,-32768,   -12,-32768,-32768,-32768,-32768,-32768,-32768,
+-32768,-32768,-32768,-32768,   181,   -56,-32768,-32768,   -74,-32768,
+-32768,-32768,-32768,-32768,   149,-32768,-32768,-32768,-32768,-32768,
+  -156,-32768,    55,    92,-32768,-32768,    56,-32768,-32768,-32768,
+-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
+-32768,-32768,-32768,-32768,-32768,-32768,    97,   115,    -6,-32768,
+-32768,-32768,-32768,   236,-32768,-32768,-32768,-32768,   -14,-32768,
+-32768,   154,-32768,   -25,-32768,-32768,-32768,    95,-32768,-32768,
+-32768,-32768,   -77,-32768,-32768,-32768,-32768,-32768,   -61,   -70,
+    11,-32768,     7,-32768,-32768,-32768,  -129,-32768,-32768,-32768,
+-32768,    26,-32768,-32768,-32768,    33,-32768,-32768,-32768,-32768,
+   -23,-32768,-32768,-32768,-32768,  -195,-32768,-32768,-32768,  -170,
+    42,  -136,   132,-32768,-32768,-32768,-32768,    18,-32768,-32768,
+-32768,   293,    20,-32768,    -9,-32768,   -16
+};
+
+
+#define	YYLAST		462
+
+
+static const short yytable[] = {    30,
+   155,    66,   110,    53,   100,   214,    67,   321,    65,   113,
+    97,   155,    99,   205,    69,    29,    30,   206,   112,    28,
+    24,    25,    76,   128,    58,    92,    21,    22,    23,    43,
+    24,    25,    29,   110,    93,    62,    68,    63,   318,   319,
+   113,    49,    79,     2,   322,    70,    70,    71,    71,   134,
+     6,    21,    22,    23,   -42,   115,    18,   336,   110,   337,
+   105,   122,   207,    66,    33,   113,    66,   166,    53,    35,
+    65,    30,    75,    65,    82,   142,    30,    30,    24,    25,
+    20,    83,   123,   108,   262,   107,    58,    29,   124,    58,
+   105,   130,    29,    29,    66,   291,   132,    62,   135,    63,
+    62,    65,    63,   268,   269,   270,   271,   137,   273,   274,
+   275,   276,   277,    88,    89,    90,   138,    58,   157,    66,
+   158,   290,   332,   333,    66,   167,    65,   156,    62,   221,
+    63,    65,    21,    22,    23,   325,    24,    25,   156,   114,
+   145,   146,    58,   154,    21,    22,    23,    58,   147,   110,
+   334,   335,   147,    62,   154,    63,   113,    30,    62,   210,
+    63,   280,   281,   282,   283,   284,   285,    21,    22,    23,
+   328,    24,    25,    29,    21,    22,    23,   329,    24,    25,
+   211,   227,   344,    21,    22,    23,  -115,    24,    25,   233,
+   234,   130,   235,    37,   212,   213,   256,    38,   236,    39,
+    40,   237,   238,   255,     7,   239,   343,     8,     9,    10,
+    66,   156,   230,   231,   232,   240,   241,    65,   242,   254,
+   243,   298,    41,    42,    21,    22,    23,    43,    24,    25,
+   258,   265,   299,    58,    44,    45,    46,    47,    48,    49,
+   300,   301,    66,   272,    62,   302,    63,    66,    66,    65,
+   297,   303,   304,   305,    65,    65,   312,   313,   314,   315,
+   316,   317,   306,   307,   308,    58,   310,   326,   147,   347,
+    58,    58,   340,   336,   171,   172,    62,   345,    63,   348,
+   129,    62,    62,    63,    63,   173,   174,   175,   176,   177,
+   178,   179,   180,   181,   182,   183,   204,    41,    42,    21,
+    22,    23,    43,    24,    25,   147,    88,    89,    90,    44,
+    45,    46,    47,   294,    49,   264,   249,   261,   118,   295,
+   226,   267,   341,   174,   175,   176,   177,   178,   179,   180,
+   181,   182,   183,   330,    41,    42,    21,    22,    23,    43,
+    24,    25,   331,    88,    89,    90,    44,    45,    46,    47,
+    37,    49,   263,    91,    38,     0,    39,    40,     0,     0,
+     0,     0,     0,     0,     0,     0,     0,     0,    37,   133,
+     0,     0,    38,     0,    39,    40,     0,     0,     0,    41,
+    42,    21,    22,    23,    43,    24,    25,     0,  -163,  -163,
+  -163,    44,    45,    46,    47,    48,    49,    41,    42,    21,
+    22,    23,    43,    24,    25,   147,     0,     0,     0,    44,
+    45,    46,    47,    48,    49,    37,     0,     0,     0,    38,
+     0,    39,    40,   174,   175,   176,   177,   178,   179,   180,
+   181,   182,   183,     0,     0,     0,    21,    22,    23,     0,
+     0,     0,     0,     0,    41,    42,    21,    22,    23,    43,
+    24,    25,     0,     0,     0,     0,    44,    45,    46,    47,
+    48,    49
+};
+
+static const short yycheck[] = {     9,
+   137,    18,    80,    18,    12,   162,    19,     7,    18,    80,
+    67,   148,    69,   150,    27,     9,    26,    28,    80,     9,
+    63,    64,     7,    98,    18,    56,    59,    60,    61,    62,
+    63,    64,    26,   111,    65,    18,    26,    18,    34,    35,
+   111,    74,    36,     3,    44,    11,    11,    13,    13,   111,
+    59,    59,    60,    61,    20,    81,    20,    27,   136,    29,
+    70,    87,    73,    80,     4,   136,    83,   142,    83,     6,
+    80,    81,    60,    83,    21,   132,    86,    87,    63,    64,
+     7,    22,    92,    77,   221,    59,    80,    81,    14,    83,
+   100,    20,    86,    87,   111,   252,   109,    80,    33,    80,
+    83,   111,    83,   233,   234,   235,   236,    15,   238,   239,
+   240,   241,   242,    66,    67,    68,    18,   111,    66,   136,
+    19,   251,   318,   319,   141,    30,   136,   137,   111,    26,
+   111,   141,    59,    60,    61,   292,    63,    64,   148,    31,
+    16,    17,   136,   137,    59,    60,    61,   141,    28,   227,
+   321,   322,    28,   136,   148,   136,   227,   167,   141,    66,
+   141,    38,    39,    40,    41,    42,    43,    59,    60,    61,
+   300,    63,    64,   167,    59,    60,    61,   307,    63,    64,
+    21,    27,   339,    59,    60,    61,    21,    63,    64,    28,
+    28,    20,    28,    28,    23,    24,   213,    32,    28,    34,
+    35,    28,    28,   213,     5,    28,   336,     8,     9,    10,
+   227,   221,   171,   172,   173,    28,    28,   227,    28,   213,
+    29,    29,    57,    58,    59,    60,    61,    62,    63,    64,
+    22,    22,    29,   227,    69,    70,    71,    72,    73,    74,
+    27,    29,   259,   237,   227,    29,   227,   264,   265,   259,
+   265,    29,    29,    29,   264,   265,   280,   281,   282,   283,
+   284,   285,    29,    27,    36,   259,    37,    25,    28,     0,
+   264,   265,    29,    27,    34,    35,   259,    29,   259,     0,
+   100,   264,   265,   264,   265,    45,    46,    47,    48,    49,
+    50,    51,    52,    53,    54,    55,   148,    57,    58,    59,
+    60,    61,    62,    63,    64,    28,    66,    67,    68,    69,
+    70,    71,    72,   259,    74,   224,   202,   221,    83,   264,
+   167,   227,   329,    46,    47,    48,    49,    50,    51,    52,
+    53,    54,    55,   308,    57,    58,    59,    60,    61,    62,
+    63,    64,   310,    66,    67,    68,    69,    70,    71,    72,
+    28,    74,   221,    61,    32,    -1,    34,    35,    -1,    -1,
+    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    28,    29,
+    -1,    -1,    32,    -1,    34,    35,    -1,    -1,    -1,    57,
+    58,    59,    60,    61,    62,    63,    64,    -1,    66,    67,
+    68,    69,    70,    71,    72,    73,    74,    57,    58,    59,
+    60,    61,    62,    63,    64,    28,    -1,    -1,    -1,    69,
+    70,    71,    72,    73,    74,    28,    -1,    -1,    -1,    32,
+    -1,    34,    35,    46,    47,    48,    49,    50,    51,    52,
+    53,    54,    55,    -1,    -1,    -1,    59,    60,    61,    -1,
+    -1,    -1,    -1,    -1,    57,    58,    59,    60,    61,    62,
+    63,    64,    -1,    -1,    -1,    -1,    69,    70,    71,    72,
+    73,    74
+};
+
+#line 352 "/usr/share/bison++/bison.cc"
+ /* fattrs + tables */
+
+/* parser code folow  */
+
+
+/* This is the parser code that is written into each bison parser
+  when the %semantic_parser declaration is not specified in the grammar.
+  It was written by Richard Stallman by simplifying the hairy parser
+  used when %semantic_parser is specified.  */
+
+/* Note: dollar marks section change
+   the next  is replaced by the list of actions, each action
+   as one case of the switch.  */ 
+
+#if YY_sparqlParser_USE_GOTO != 0
+/* 
+ SUPRESSION OF GOTO : on some C++ compiler (sun c++)
+  the goto is strictly forbidden if any constructor/destructor
+  is used in the whole function (very stupid isn't it ?)
+ so goto are to be replaced with a 'while/switch/case construct'
+ here are the macro to keep some apparent compatibility
+*/
+#define YYGOTO(lb) {yy_gotostate=lb;continue;}
+#define YYBEGINGOTO  enum yy_labels yy_gotostate=yygotostart; \
+                     for(;;) switch(yy_gotostate) { case yygotostart: {
+#define YYLABEL(lb) } case lb: {
+#define YYENDGOTO } } 
+#define YYBEGINDECLARELABEL enum yy_labels {yygotostart
+#define YYDECLARELABEL(lb) ,lb
+#define YYENDDECLARELABEL  };
+#else
+/* macro to keep goto */
+#define YYGOTO(lb) goto lb
+#define YYBEGINGOTO 
+#define YYLABEL(lb) lb:
+#define YYENDGOTO
+#define YYBEGINDECLARELABEL 
+#define YYDECLARELABEL(lb)
+#define YYENDDECLARELABEL 
+#endif
+/* LABEL DECLARATION */
+YYBEGINDECLARELABEL
+  YYDECLARELABEL(yynewstate)
+  YYDECLARELABEL(yybackup)
+/* YYDECLARELABEL(yyresume) */
+  YYDECLARELABEL(yydefault)
+  YYDECLARELABEL(yyreduce)
+  YYDECLARELABEL(yyerrlab)   /* here on detecting error */
+  YYDECLARELABEL(yyerrlab1)   /* here on error raised explicitly by an action */
+  YYDECLARELABEL(yyerrdefault)  /* current state does not do anything special for the error token. */
+  YYDECLARELABEL(yyerrpop)   /* pop the current state because it cannot handle the error token */
+  YYDECLARELABEL(yyerrhandle)  
+YYENDDECLARELABEL
+/* ALLOCA SIMULATION */
+/* __HAVE_NO_ALLOCA */
+#ifdef __HAVE_NO_ALLOCA
+int __alloca_free_ptr(char *ptr,char *ref)
+{if(ptr!=ref) free(ptr);
+ return 0;}
+
+#define __ALLOCA_alloca(size) malloc(size)
+#define __ALLOCA_free(ptr,ref) __alloca_free_ptr((char *)ptr,(char *)ref)
+
+#ifdef YY_sparqlParser_LSP_NEEDED
+#define __ALLOCA_return(num) \
+            do { return( __ALLOCA_free(yyss,yyssa)+\
+		    __ALLOCA_free(yyvs,yyvsa)+\
+		    __ALLOCA_free(yyls,yylsa)+\
+		   (num)); } while(0)
+#else
+#define __ALLOCA_return(num) \
+            do { return( __ALLOCA_free(yyss,yyssa)+\
+		    __ALLOCA_free(yyvs,yyvsa)+\
+		   (num)); } while(0)
+#endif
+#else
+#define __ALLOCA_return(num) do { return(num); } while(0)
+#define __ALLOCA_alloca(size) alloca(size)
+#define __ALLOCA_free(ptr,ref) 
+#endif
+
+/* ENDALLOCA SIMULATION */
+
+#define yyerrok         (yyerrstatus = 0)
+#define yyclearin       (YY_sparqlParser_CHAR = YYEMPTY)
+#define YYEMPTY         -2
+#define YYEOF           0
+#define YYACCEPT        __ALLOCA_return(0)
+#define YYABORT         __ALLOCA_return(1)
+#define YYERROR         YYGOTO(yyerrlab1)
+/* Like YYERROR except do call yyerror.
+   This remains here temporarily to ease the
+   transition to the new meaning of YYERROR, for GCC.
+   Once GCC version 2 has supplanted version 1, this can go.  */
+#define YYFAIL          YYGOTO(yyerrlab)
+#define YYRECOVERING()  (!!yyerrstatus)
+#define YYBACKUP(token, value) \
+do                                                              \
+  if (YY_sparqlParser_CHAR == YYEMPTY && yylen == 1)                               \
+    { YY_sparqlParser_CHAR = (token), YY_sparqlParser_LVAL = (value);                 \
+      yychar1 = YYTRANSLATE (YY_sparqlParser_CHAR);                                \
+      YYPOPSTACK;                                               \
+      YYGOTO(yybackup);                                            \
+    }                                                           \
+  else                                                          \
+    { YY_sparqlParser_ERROR ("syntax error: cannot back up"); YYERROR; }   \
+while (0)
+
+#define YYTERROR        1
+#define YYERRCODE       256
+
+#ifndef YY_sparqlParser_PURE
+/* UNPURE */
+#define YYLEX           YY_sparqlParser_LEX()
+#ifndef YY_USE_CLASS
+/* If nonreentrant, and not class , generate the variables here */
+int     YY_sparqlParser_CHAR;                      /*  the lookahead symbol        */
+YY_sparqlParser_STYPE      YY_sparqlParser_LVAL;              /*  the semantic value of the */
+				/*  lookahead symbol    */
+int YY_sparqlParser_NERRS;                 /*  number of parse errors so far */
+#ifdef YY_sparqlParser_LSP_NEEDED
+YY_sparqlParser_LTYPE YY_sparqlParser_LLOC;   /*  location data for the lookahead     */
+			/*  symbol                              */
+#endif
+#endif
+
+
+#else
+/* PURE */
+#ifdef YY_sparqlParser_LSP_NEEDED
+#define YYLEX           YY_sparqlParser_LEX(&YY_sparqlParser_LVAL, &YY_sparqlParser_LLOC)
+#else
+#define YYLEX           YY_sparqlParser_LEX(&YY_sparqlParser_LVAL)
+#endif
+#endif
+#ifndef YY_USE_CLASS
+#if YY_sparqlParser_DEBUG != 0
+int YY_sparqlParser_DEBUG_FLAG;                    /*  nonzero means print parse trace     */
+/* Since this is uninitialized, it does not stop multiple parsers
+   from coexisting.  */
+#endif
+#endif
+
+
+
+/*  YYINITDEPTH indicates the initial size of the parser's stacks       */
+
+#ifndef YYINITDEPTH
+#define YYINITDEPTH 200
+#endif
+
+/*  YYMAXDEPTH is the maximum size the stacks can grow to
+    (effective only if the built-in stack extension method is used).  */
+
+#if YYMAXDEPTH == 0
+#undef YYMAXDEPTH
+#endif
+
+#ifndef YYMAXDEPTH
+#define YYMAXDEPTH 10000
+#endif
+
+
+#if __GNUC__ > 1                /* GNU C and GNU C++ define this.  */
+#define __yy_bcopy(FROM,TO,COUNT)       __builtin_memcpy(TO,FROM,COUNT)
+#else                           /* not GNU C or C++ */
+
+/* This is the most reliable way to avoid incompatibilities
+   in available built-in functions on various systems.  */
+
+#ifdef __cplusplus
+static void __yy_bcopy (char *from, char *to, int count)
+#else
+#ifdef __STDC__
+static void __yy_bcopy (char *from, char *to, int count)
+#else
+static void __yy_bcopy (from, to, count)
+     char *from;
+     char *to;
+     int count;
+#endif
+#endif
+{
+  register char *f = from;
+  register char *t = to;
+  register int i = count;
+
+  while (i-- > 0)
+    *t++ = *f++;
+}
+#endif
+
+
+int
+#ifdef YY_USE_CLASS
+ YY_sparqlParser_CLASS::
+#endif
+     YY_sparqlParser_PARSE(YY_sparqlParser_PARSE_PARAM)
+#ifndef __STDC__
+#ifndef __cplusplus
+#ifndef YY_USE_CLASS
+/* parameter definition without protypes */
+YY_sparqlParser_PARSE_PARAM_DEF
+#endif
+#endif
+#endif
+{
+  register int yystate;
+  register int yyn;
+  register short *yyssp;
+  register YY_sparqlParser_STYPE *yyvsp;
+  int yyerrstatus;      /*  number of tokens to shift before error messages enabled */
+  int yychar1=0;          /*  lookahead token as an internal (translated) token number */
+
+  short yyssa[YYINITDEPTH];     /*  the state stack                     */
+  YY_sparqlParser_STYPE yyvsa[YYINITDEPTH];        /*  the semantic value stack            */
+
+  short *yyss = yyssa;          /*  refer to the stacks thru separate pointers */
+  YY_sparqlParser_STYPE *yyvs = yyvsa;     /*  to allow yyoverflow to reallocate them elsewhere */
+
+#ifdef YY_sparqlParser_LSP_NEEDED
+  YY_sparqlParser_LTYPE yylsa[YYINITDEPTH];        /*  the location stack                  */
+  YY_sparqlParser_LTYPE *yyls = yylsa;
+  YY_sparqlParser_LTYPE *yylsp;
+
+#define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
+#else
+#define YYPOPSTACK   (yyvsp--, yyssp--)
+#endif
+
+  int yystacksize = YYINITDEPTH;
+
+#ifdef YY_sparqlParser_PURE
+  int YY_sparqlParser_CHAR;
+  YY_sparqlParser_STYPE YY_sparqlParser_LVAL;
+  int YY_sparqlParser_NERRS;
+#ifdef YY_sparqlParser_LSP_NEEDED
+  YY_sparqlParser_LTYPE YY_sparqlParser_LLOC;
+#endif
+#endif
+
+  YY_sparqlParser_STYPE yyval;             /*  the variable used to return         */
+				/*  semantic values from the action     */
+				/*  routines                            */
+
+  int yylen;
+/* start loop, in which YYGOTO may be used. */
+YYBEGINGOTO
+
+#if YY_sparqlParser_DEBUG != 0
+  if (YY_sparqlParser_DEBUG_FLAG)
+    fprintf(stderr, "Starting parse\n");
+#endif
+  yystate = 0;
+  yyerrstatus = 0;
+  YY_sparqlParser_NERRS = 0;
+  YY_sparqlParser_CHAR = YYEMPTY;          /* Cause a token to be read.  */
+
+  /* Initialize stack pointers.
+     Waste one element of value and location stack
+     so that they stay on the same level as the state stack.
+     The wasted elements are never initialized.  */
+
+  yyssp = yyss - 1;
+  yyvsp = yyvs;
+#ifdef YY_sparqlParser_LSP_NEEDED
+  yylsp = yyls;
+#endif
+
+/* Push a new state, which is found in  yystate  .  */
+/* In all cases, when you get here, the value and location stacks
+   have just been pushed. so pushing a state here evens the stacks.  */
+YYLABEL(yynewstate)
+
+  *++yyssp = yystate;
+
+  if (yyssp >= yyss + yystacksize - 1)
+    {
+      /* Give user a chance to reallocate the stack */
+      /* Use copies of these so that the &'s don't force the real ones into memory. */
+      YY_sparqlParser_STYPE *yyvs1 = yyvs;
+      short *yyss1 = yyss;
+#ifdef YY_sparqlParser_LSP_NEEDED
+      YY_sparqlParser_LTYPE *yyls1 = yyls;
+#endif
+
+      /* Get the current used size of the three stacks, in elements.  */
+      int size = yyssp - yyss + 1;
+
+#ifdef yyoverflow
+      /* Each stack pointer address is followed by the size of
+	 the data in use in that stack, in bytes.  */
+#ifdef YY_sparqlParser_LSP_NEEDED
+      /* This used to be a conditional around just the two extra args,
+	 but that might be undefined if yyoverflow is a macro.  */
+      yyoverflow("parser stack overflow",
+		 &yyss1, size * sizeof (*yyssp),
+		 &yyvs1, size * sizeof (*yyvsp),
+		 &yyls1, size * sizeof (*yylsp),
+		 &yystacksize);
+#else
+      yyoverflow("parser stack overflow",
+		 &yyss1, size * sizeof (*yyssp),
+		 &yyvs1, size * sizeof (*yyvsp),
+		 &yystacksize);
+#endif
+
+      yyss = yyss1; yyvs = yyvs1;
+#ifdef YY_sparqlParser_LSP_NEEDED
+      yyls = yyls1;
+#endif
+#else /* no yyoverflow */
+      /* Extend the stack our own way.  */
+      if (yystacksize >= YYMAXDEPTH)
+	{
+	  YY_sparqlParser_ERROR("parser stack overflow");
+	  __ALLOCA_return(2);
+	}
+      yystacksize *= 2;
+      if (yystacksize > YYMAXDEPTH)
+	yystacksize = YYMAXDEPTH;
+      yyss = (short *) __ALLOCA_alloca (yystacksize * sizeof (*yyssp));
+      __yy_bcopy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));
+      __ALLOCA_free(yyss1,yyssa);
+      yyvs = (YY_sparqlParser_STYPE *) __ALLOCA_alloca (yystacksize * sizeof (*yyvsp));
+      __yy_bcopy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));
+      __ALLOCA_free(yyvs1,yyvsa);
+#ifdef YY_sparqlParser_LSP_NEEDED
+      yyls = (YY_sparqlParser_LTYPE *) __ALLOCA_alloca (yystacksize * sizeof (*yylsp));
+      __yy_bcopy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp));
+      __ALLOCA_free(yyls1,yylsa);
+#endif
+#endif /* no yyoverflow */
+
+      yyssp = yyss + size - 1;
+      yyvsp = yyvs + size - 1;
+#ifdef YY_sparqlParser_LSP_NEEDED
+      yylsp = yyls + size - 1;
+#endif
+
+#if YY_sparqlParser_DEBUG != 0
+      if (YY_sparqlParser_DEBUG_FLAG)
+	fprintf(stderr, "Stack size increased to %d\n", yystacksize);
+#endif
+
+      if (yyssp >= yyss + yystacksize - 1)
+	YYABORT;
+    }
+
+#if YY_sparqlParser_DEBUG != 0
+  if (YY_sparqlParser_DEBUG_FLAG)
+    fprintf(stderr, "Entering state %d\n", yystate);
+#endif
+
+  YYGOTO(yybackup);
+YYLABEL(yybackup)
+
+/* Do appropriate processing given the current state.  */
+/* Read a lookahead token if we need one and don't already have one.  */
+/* YYLABEL(yyresume) */
+
+  /* First try to decide what to do without reference to lookahead token.  */
+
+  yyn = yypact[yystate];
+  if (yyn == YYFLAG)
+    YYGOTO(yydefault);
+
+  /* Not known => get a lookahead token if don't already have one.  */
+
+  /* yychar is either YYEMPTY or YYEOF
+     or a valid token in external form.  */
+
+  if (YY_sparqlParser_CHAR == YYEMPTY)
+    {
+#if YY_sparqlParser_DEBUG != 0
+      if (YY_sparqlParser_DEBUG_FLAG)
+	fprintf(stderr, "Reading a token: ");
+#endif
+      YY_sparqlParser_CHAR = YYLEX;
+    }
+
+  /* Convert token to internal form (in yychar1) for indexing tables with */
+
+  if (YY_sparqlParser_CHAR <= 0)           /* This means end of input. */
+    {
+      yychar1 = 0;
+      YY_sparqlParser_CHAR = YYEOF;                /* Don't call YYLEX any more */
+
+#if YY_sparqlParser_DEBUG != 0
+      if (YY_sparqlParser_DEBUG_FLAG)
+	fprintf(stderr, "Now at end of input.\n");
+#endif
+    }
+  else
+    {
+      yychar1 = YYTRANSLATE(YY_sparqlParser_CHAR);
+
+#if YY_sparqlParser_DEBUG != 0
+      if (YY_sparqlParser_DEBUG_FLAG)
+	{
+	  fprintf (stderr, "Next token is %d (%s", YY_sparqlParser_CHAR, yytname[yychar1]);
+	  /* Give the individual parser a way to print the precise meaning
+	     of a token, for further debugging info.  */
+#ifdef YYPRINT
+	  YYPRINT (stderr, YY_sparqlParser_CHAR, YY_sparqlParser_LVAL);
+#endif
+	  fprintf (stderr, ")\n");
+	}
+#endif
+    }
+
+  yyn += yychar1;
+  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
+    YYGOTO(yydefault);
+
+  yyn = yytable[yyn];
+
+  /* yyn is what to do for this token type in this state.
+     Negative => reduce, -yyn is rule number.
+     Positive => shift, yyn is new state.
+       New state is final state => don't bother to shift,
+       just return success.
+     0, or most negative number => error.  */
+
+  if (yyn < 0)
+    {
+      if (yyn == YYFLAG)
+	YYGOTO(yyerrlab);
+      yyn = -yyn;
+      YYGOTO(yyreduce);
+    }
+  else if (yyn == 0)
+    YYGOTO(yyerrlab);
+
+  if (yyn == YYFINAL)
+    YYACCEPT;
+
+  /* Shift the lookahead token.  */
+
+#if YY_sparqlParser_DEBUG != 0
+  if (YY_sparqlParser_DEBUG_FLAG)
+    fprintf(stderr, "Shifting token %d (%s), ", YY_sparqlParser_CHAR, yytname[yychar1]);
+#endif
+
+  /* Discard the token being shifted unless it is eof.  */
+  if (YY_sparqlParser_CHAR != YYEOF)
+    YY_sparqlParser_CHAR = YYEMPTY;
+
+  *++yyvsp = YY_sparqlParser_LVAL;
+#ifdef YY_sparqlParser_LSP_NEEDED
+  *++yylsp = YY_sparqlParser_LLOC;
+#endif
+
+  /* count tokens shifted since error; after three, turn off error status.  */
+  if (yyerrstatus) yyerrstatus--;
+
+  yystate = yyn;
+  YYGOTO(yynewstate);
+
+/* Do the default action for the current state.  */
+YYLABEL(yydefault)
+
+  yyn = yydefact[yystate];
+  if (yyn == 0)
+    YYGOTO(yyerrlab);
+
+/* Do a reduction.  yyn is the number of a rule to reduce with.  */
+YYLABEL(yyreduce)
+  yylen = yyr2[yyn];
+  if (yylen > 0)
+    yyval = yyvsp[1-yylen]; /* implement default value of the action */
+
+#if YY_sparqlParser_DEBUG != 0
+  if (YY_sparqlParser_DEBUG_FLAG)
+    {
+      int i;
+
+      fprintf (stderr, "Reducing via rule %d (line %d), ",
+	       yyn, yyrline[yyn]);
+
+      /* Print the symbols being reduced, and their result.  */
+      for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
+	fprintf (stderr, "%s ", yytname[yyrhs[i]]);
+      fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
+    }
+#endif
+
+
+ #line 839 "/usr/share/bison++/bison.cc"
+
+  switch (yyn) {
+
+case 1:
+#line 719 "sparqlParser.yy"
+{
+	  LEX *lex= yySparqlFrob->thd->lex;
+	  SELECT_LEX *sel= lex->current_select;
+	  lex->current_select->parsing_place = NO_MATTER;
+	  sel->offset_limit= NULL;
+	  sel->select_limit= NULL;
+	  // create root context right away so SELECTs have a context
+	  yySparqlFrob->push_context(
+	     new RootGraphContext(yySparqlFrob->head_context(), yySparqlFrob));
+	;
+    break;}
+case 2:
+#line 730 "sparqlParser.yy"
+{
+	  Buf *b = new Buf(2, yyvsp[-1].buf, yyvsp[0].buf);
+	  cout << "Query end -- " << b->str() << endl;
+	  delete b;
+	;
+    break;}
+case 3:
+#line 737 "sparqlParser.yy"
+{yyval.buf = yyvsp[0].buf;
+    break;}
+case 4:
+#line 738 "sparqlParser.yy"
+{yyval.buf = yyvsp[0].buf; YYABORT;;
+    break;}
+case 5:
+#line 739 "sparqlParser.yy"
+{yyval.buf = yyvsp[0].buf; YYABORT;;
+    break;}
+case 6:
+#line 740 "sparqlParser.yy"
+{yyval.buf = yyvsp[0].buf; YYABORT;;
+    break;}
+case 7:
+#line 743 "sparqlParser.yy"
+{yyval.buf = new Buf(2, yyvsp[-1].buf, yyvsp[0].buf);
+    break;}
+case 8:
+#line 746 "sparqlParser.yy"
+{yyval.buf = new Buf();
+    break;}
+case 9:
+#line 747 "sparqlParser.yy"
+{yyval.buf = yyvsp[0].buf;
+    break;}
+case 10:
+#line 750 "sparqlParser.yy"
+{yyval.buf = new Buf();
+    break;}
+case 11:
+#line 751 "sparqlParser.yy"
+{yyval.buf = new Buf(2, yyvsp[-1].buf, yyvsp[0].buf);
+    break;}
+case 12:
+#line 754 "sparqlParser.yy"
+{yyval.buf = new Buf(2, new Buf("BASE"), new Buf(yyvsp[0].lex_str.str));
+    break;}
+case 13:
+#line 757 "sparqlParser.yy"
+{yyval.buf = new Buf(3, yyvsp[-2].buf, new Buf(yyvsp[-1].lex_str.str), new Buf(yyvsp[0].lex_str.str));
+    break;}
+case 14:
+#line 761 "sparqlParser.yy"
+{
+	  LEX *lex= yySparqlFrob->lex;
+	  SELECT_LEX *sel= lex->current_select;
+
+	  sel->parsing_place = SELECT_LIST;
+	  lex->sql_command= SQLCOM_SELECT; // SQLCOM_EMPTY_QUERY;
+	;
+    break;}
+case 15:
+#line 769 "sparqlParser.yy"
+{
+	  //SELECT_LEX *sel= yySparqlFrob->lex->current_select;
+
+	  //	  commented out 'cause the didn't seem to be needed - EGP 20060326
+	  //	  lex->create_view_select_start = $1->get_item()->name;
+	  //sel->parsing_place = NO_MATTER;
+	  //sel->set_braces(0);
+	;
+    break;}
+case 16:
+#line 778 "sparqlParser.yy"
+{
+	  LEX *lex= yySparqlFrob->lex;
+	  SELECT_LEX *sel= lex->current_select;
+
+	  // Now that we have all the variables, fix up the SELECTs.
+	  yySparqlFrob->select_variables();
+
+	  sel->parsing_place = NO_MATTER;
+	  yyval.buf = new Buf(6, new Buf("SELECT"), yyvsp[-5].buf, yyvsp[-4].buf, yyvsp[-2].buf, yyvsp[-1].buf, yyvsp[0].buf);
+	;
+    break;}
+case 17:
+#line 791 "sparqlParser.yy"
+{yyval.buf = new Buf();
+    break;}
+case 18:
+#line 793 "sparqlParser.yy"
+{
+	  yySparqlFrob->set_distinct(true);
+	  yyval.buf = yyvsp[0].buf;
+	;
+    break;}
+case 19:
+#line 800 "sparqlParser.yy"
+{
+	  THD *thd= yySparqlFrob->thd;
+	  LEX *lex= thd->lex;
+	  SELECT_LEX *sel= lex->current_select;
+	  sel->use_index_ptr=sel->ignore_index_ptr=0;
+	  sel->table_join_options= 0;
+	  if (add_item_to_list(thd, yyvsp[0].item_pos->get_item())) {
+	    YYABORT;
+	  }
+
+	  yyval.buf = new Buf(yyvsp[0].item_pos->get_item()->name);
+	;
+    break;}
+case 20:
+#line 813 "sparqlParser.yy"
+{
+	  THD *thd= yySparqlFrob->thd;
+	  if (add_item_to_list(thd, yyvsp[0].item_pos->get_item())) {
+	    YYABORT;
+	  }
+	  yyval.buf = new Buf(2, yyvsp[-1].buf, new Buf(yyvsp[0].item_pos->get_item()->name));
+	;
+    break;}
+case 21:
+#line 822 "sparqlParser.yy"
+{yyval.buf = yyvsp[0].buf;
+    break;}
+case 22:
+#line 824 "sparqlParser.yy"
+{ yyval.buf = yyvsp[0].buf; ;
+    break;}
+case 23:
+#line 828 "sparqlParser.yy"
+{yyval.buf = new Buf();
+    break;}
+case 24:
+#line 829 "sparqlParser.yy"
+{yyval.buf = new Buf(2, yyvsp[-1].buf, yyvsp[0].buf);
+    break;}
+case 25:
+#line 832 "sparqlParser.yy"
+{yyval.buf = new Buf(5, yyvsp[-4].buf, yyvsp[-3].buf, yyvsp[-2].buf, yyvsp[-1].buf, yyvsp[0].buf);
+    break;}
+case 26:
+#line 835 "sparqlParser.yy"
+{yyval.buf = new Buf(5, yyvsp[-4].buf, yyvsp[-3].buf, yyvsp[-2].buf, yyvsp[-1].buf, yyvsp[0].buf);
+    break;}
+case 27:
+#line 838 "sparqlParser.yy"
+{yyval.buf = new Buf(yyvsp[0].item_pos->get_item()->name);
+    break;}
+case 28:
+#line 839 "sparqlParser.yy"
+{yyval.buf = new Buf(2, yyvsp[-1].buf, new Buf(yyvsp[0].item_pos->get_item()->name));
+    break;}
+case 29:
+#line 842 "sparqlParser.yy"
+{yyval.buf = yyvsp[0].buf;
+    break;}
+case 30:
+#line 843 "sparqlParser.yy"
+{yyval.buf = yyvsp[0].buf;
+    break;}
+case 31:
+#line 846 "sparqlParser.yy"
+{yyval.buf = new Buf();
+    break;}
+case 32:
+#line 847 "sparqlParser.yy"
+{yyval.buf = yyvsp[0].buf;
+    break;}
+case 33:
+#line 850 "sparqlParser.yy"
+{yyval.buf = new Buf(3, yyvsp[-2].buf, yyvsp[-1].buf, yyvsp[0].buf);
+    break;}
+case 34:
+#line 853 "sparqlParser.yy"
+{yyval.buf = new Buf(2, yyvsp[-1].buf, yyvsp[0].buf);
+    break;}
+case 35:
+#line 856 "sparqlParser.yy"
+{yyval.buf = yyvsp[0].buf;
+    break;}
+case 36:
+#line 857 "sparqlParser.yy"
+{yyval.buf = yyvsp[0].buf;
+    break;}
+case 37:
+#line 860 "sparqlParser.yy"
+{yyval.buf = yyvsp[0].buf;
+    break;}
+case 38:
+#line 863 "sparqlParser.yy"
+{yyval.buf = new Buf(2, yyvsp[-1].buf, yyvsp[0].buf);
+    break;}
+case 39:
+#line 866 "sparqlParser.yy"
+{yyval.buf = new Buf(yyvsp[0].item_pos->get_item()->name);
+    break;}
+case 40:
+#line 870 "sparqlParser.yy"
+{
+	  SELECT_LEX* sel = &yySparqlFrob->lex->select_lex;
+	  sel->parsing_place = IN_WHERE;
+
+	  /* we've been using a context (for SELECTs) but need
+	     to pop it so it can be pushed back on at the LCURLEY */
+	  yySparqlFrob->set_next_GC(yySparqlFrob->pop_context());
+	;
+    break;}
+case 41:
+#line 879 "sparqlParser.yy"
+{
+	  GraphContext *gc= yyvsp[0].graph_context;
+	  SELECT_LEX* sel = &yySparqlFrob->lex->select_lex;
+	  BindingContext *bc= gc->get_binding_context();
+	  Item *constraints= bc->make_item_constraints();
+	  yySparqlFrob->add_root_constraints(bc->
+				   get_bound_variable_constraints(constraints, gc));
+	  Item *where = yySparqlFrob->get_root_constraints();
+	  if (where) {
+	    where->top_level_item();
+	    sel->where = where;
+	    String string;
+	    where->print(&string);
+	    yyval.buf = new Buf(4, yyvsp[-2].buf, yyvsp[0].graph_context->get_Buf(), new Buf("WHERE"), new Buf(string.c_ptr()));
+	  } else {
+	    yyval.buf = new Buf(2, yyvsp[-2].buf, yyvsp[0].graph_context->get_Buf());
+	  }
+	  sel->parsing_place= NO_MATTER;
+	;
+    break;}
+case 42:
+#line 900 "sparqlParser.yy"
+{yyval.buf = new Buf();
+    break;}
+case 43:
+#line 901 "sparqlParser.yy"
+{yyval.buf = yyvsp[0].buf;
+    break;}
+case 44:
+#line 904 "sparqlParser.yy"
+{yyval.buf = new Buf(3, yyvsp[-2].buf, yyvsp[-1].buf, yyvsp[0].buf);
+    break;}
+case 45:
+#line 907 "sparqlParser.yy"
+{yyval.buf = new Buf();
+    break;}
+case 46:
+#line 908 "sparqlParser.yy"
+{yyval.buf = yyvsp[0].buf;
+    break;}
+case 47:
+#line 911 "sparqlParser.yy"
+{yyval.buf = new Buf();;
+    break;}
+case 48:
+#line 912 "sparqlParser.yy"
+{yyval.buf = yyvsp[0].buf;
+    break;}
+case 49:
+#line 915 "sparqlParser.yy"
+{yyval.buf = new Buf();
+    break;}
+case 50:
+#line 916 "sparqlParser.yy"
+{yyval.buf = yyvsp[0].buf;
+    break;}
+case 51:
+#line 919 "sparqlParser.yy"
+{yyval.buf = new Buf(3, yyvsp[-2].buf, yyvsp[-1].buf, yyvsp[0].buf);
+    break;}
+case 52:
+#line 922 "sparqlParser.yy"
+{yyval.buf = yyvsp[0].buf;
+    break;}
+case 53:
+#line 923 "sparqlParser.yy"
+{yyval.buf = new Buf(2, yyvsp[-1].buf, yyvsp[0].buf);
+    break;}
+case 54:
+#line 926 "sparqlParser.yy"
+{yyval.buf = yyvsp[0].buf;
+    break;}
+case 55:
+#line 927 "sparqlParser.yy"
+{yyval.buf = new Buf("!!!");
+    break;}
+case 56:
+#line 930 "sparqlParser.yy"
+{yyval.num =1;
+    break;}
+case 57:
+#line 931 "sparqlParser.yy"
+{yyval.num =0;
+    break;}
+case 58:
+#line 935 "sparqlParser.yy"
+{
+	  if (add_order_to_list(yySparqlFrob->thd, yyvsp[0].item, (bool) yyvsp[-1].num))
+	    YYABORT; 
+	  String string;
+	  yyvsp[0].item->print(&string);
+	  yyval.buf = new Buf(2, new Buf((char*)(yyvsp[-1].num ? "ASK" : "DESC")), new Buf(string.c_ptr()));
+	;
+    break;}
+case 59:
+#line 944 "sparqlParser.yy"
+{yyval.item = yyvsp[0].item;
+    break;}
+case 60:
+#line 945 "sparqlParser.yy"
+{yyval.item = yyvsp[0].item_pos->get_item();
+    break;}
+case 61:
+#line 946 "sparqlParser.yy"
+{yyval.item = yyvsp[0].item;
+    break;}
+case 62:
+#line 950 "sparqlParser.yy"
+{
+	  SELECT_LEX *sel = &yySparqlFrob->lex->select_lex;
+	  sel->select_limit = new Item_uint(yyvsp[0].lex_str.str, yyvsp[0].lex_str.length);
+	  sel->explicit_limit= 1;
+	  yyval.buf = new Buf(2, yyvsp[-1].buf, new Buf(yyvsp[0].lex_str.str));
+	;
+    break;}
+case 63:
+#line 959 "sparqlParser.yy"
+{
+	  SELECT_LEX *sel = &yySparqlFrob->lex->select_lex;
+	  sel->offset_limit = new Item_uint(yyvsp[0].lex_str.str, yyvsp[0].lex_str.length);
+	  sel->explicit_limit= 1;
+	  yyval.buf = new Buf(2, yyvsp[-1].buf, new Buf(yyvsp[0].lex_str.str));
+	;
+    break;}
+case 64:
+#line 968 "sparqlParser.yy"
+{
+	  GraphContext *gc = yySparqlFrob->was_next_GC();
+	  yySparqlFrob->push_context(gc ? gc : 
+			  new Union1GraphContext(yySparqlFrob->head_context(), yySparqlFrob));
+	;
+    break;}
+case 65:
+#line 974 "sparqlParser.yy"
+{
+	  if (yySparqlFrob->get_distinct())
+	    yySparqlFrob->lex->current_select->options|= SELECT_DISTINCT;
+	  yyval.graph_context= yySparqlFrob->pop_context();
+	  yyval.graph_context->set_Buf(new Buf(3, yyvsp[-3].buf, yyvsp[-1].buf, yyvsp[0].buf));
+	  yyval.graph_context->close();
+	;
+    break;}
+case 66:
+#line 983 "sparqlParser.yy"
+{yyval.buf = new Buf(2, yyvsp[-1].buf, yyvsp[0].buf);
+    break;}
+case 67:
+#line 986 "sparqlParser.yy"
+{yyval.buf = new Buf();
+    break;}
+case 68:
+#line 987 "sparqlParser.yy"
+{yyval.buf = yyvsp[0].buf;
+    break;}
+case 69:
+#line 990 "sparqlParser.yy"
+{yyval.buf = new Buf(3, yyvsp[-2].buf, yyvsp[-1].buf, yyvsp[0].buf);
+    break;}
+case 70:
+#line 993 "sparqlParser.yy"
+{yyval.buf = new Buf();
+    break;}
+case 71:
+#line 994 "sparqlParser.yy"
+{yyval.buf = yyvsp[0].buf;
+    break;}
+case 72:
+#line 997 "sparqlParser.yy"
+{yyval.buf = new Buf(2, yyvsp[-1].buf, yyvsp[0].buf);
+    break;}
+case 73:
+#line 1000 "sparqlParser.yy"
+{yyval.buf = new Buf();
+    break;}
+case 74:
+#line 1001 "sparqlParser.yy"
+{yyval.buf = yyvsp[0].buf;
+    break;}
+case 75:
+#line 1004 "sparqlParser.yy"
+{yyval.buf = new Buf(3, yyvsp[-2].buf, yyvsp[-1].buf, yyvsp[0].buf);
+    break;}
+case 76:
+#line 1007 "sparqlParser.yy"
+{yyval.buf = new Buf();
+    break;}
+case 77:
+#line 1008 "sparqlParser.yy"
+{yyval.buf = yyvsp[0].buf;
+    break;}
+case 78:
+#line 1011 "sparqlParser.yy"
+{yyval.buf = new Buf(2, yyvsp[-1].buf, yyvsp[0].buf);
+    break;}
+case 79:
+#line 1014 "sparqlParser.yy"
+{yyval.buf = new Buf();
+    break;}
+case 80:
+#line 1015 "sparqlParser.yy"
+{yyval.buf = yyvsp[0].buf;
+    break;}
+case 81:
+#line 1018 "sparqlParser.yy"
+{yyval.buf = new Buf(2, yyvsp[-1].buf, yyvsp[0].buf);
+    break;}
+case 82:
+#line 1021 "sparqlParser.yy"
+{yyval.buf = new Buf();
+    break;}
+case 83:
+#line 1022 "sparqlParser.yy"
+{yyval.buf = new Buf(2, yyvsp[-1].buf, yyvsp[0].buf);
+    break;}
+case 84:
+#line 1025 "sparqlParser.yy"
+{yyval.buf = yyvsp[0].buf;
+    break;}
+case 85:
+#line 1026 "sparqlParser.yy"
+{yyval.buf = yyvsp[0].buf;
+    break;}
+case 86:
+#line 1027 "sparqlParser.yy"
+{yyval.buf = yyvsp[0].buf;
+    break;}
+case 87:
+#line 1031 "sparqlParser.yy"
+{
+	  yySparqlFrob->lex->select_lex.init_nested_join(yySparqlFrob->thd);
+	  yySparqlFrob->set_next_GC(
+			new OptionalGraphContext(yySparqlFrob->head_context(), 
+						 yySparqlFrob));
+	;
+    break;}
+case 88:
+#line 1038 "sparqlParser.yy"
+{
+	  GraphContext *gc= yyvsp[0].graph_context;
+	  SELECT_LEX* sel= &yySparqlFrob->lex->select_lex;
+	  BindingContext *bc= gc->get_binding_context();
+	  Item *constraints= bc->make_item_constraints();
+	  Item *constraint= bc->get_bound_variable_constraints(constraints, gc);
+	  yySparqlFrob->add_root_constraints(constraint);
+
+	  String string;
+	  if (constraint)
+	    constraint->print(&string);
+
+	  yySparqlFrob->lex->select_lex.end_nested_join(yySparqlFrob->thd);
+
+	  yyval.buf = new Buf(3, yyvsp[-2].buf, yyvsp[0].graph_context->get_Buf(), new Buf(string.c_ptr()));
+	;
+    break;}
+case 89:
+#line 1057 "sparqlParser.yy"
+{
+	  yySparqlFrob->set_next_GC(
+			   new GraphGraphContext(yySparqlFrob->head_context(), 
+						 yySparqlFrob));
+	;
+    break;}
+case 90:
+#line 1063 "sparqlParser.yy"
+{
+	  yyval.buf = new Buf(3, yyvsp[-3].buf, yyvsp[-2].buf, yyvsp[0].graph_context->get_Buf());
+	;
+    break;}
+case 91:
+#line 1069 "sparqlParser.yy"
+{
+	  cout << "look for UNIONs in     \"" << yySparqlFrob->lex->ptr << "\"?" << endl;
+	;
+    break;}
+case 92:
+#line 1073 "sparqlParser.yy"
+{
+	  yyval.buf= yyvsp[-2].graph_context->get_Buf();
+	  if (yyvsp[0].BindingGraphContext_list) {
+	    yyvsp[0].BindingGraphContext_list->push_front((BindingGraphContext*)yyvsp[-2].graph_context);
+	    cout << "there were " << yyvsp[0].BindingGraphContext_list->elements << " UNION elements" << endl;
+
+	    yySparqlFrob->needs_select(yyvsp[0].BindingGraphContext_list);
+
+	    // Maintain the Buf for debugging.
+	    cout << "0: " << (void*)yyvsp[-2].graph_context << ": " << yyval.buf->str() << endl;
+	    unsigned i= 1;
+	    List_iterator<BindingGraphContext> item_list_it(*yyvsp[0].BindingGraphContext_list);
+	    GraphContext* gc= item_list_it++;
+	    while ((gc= item_list_it++)) {
+	      cout << i++ << ": " << (void*)gc << ": " << gc->get_Buf()->str() << endl;
+	      yyval.buf= new Buf(3, yyval.buf, new Buf("UNION"), gc->get_Buf());
+	    }
+	  } else {
+	    yyvsp[-2].graph_context->no_right_union();
+	  }
+	;
+    break;}
+case 93:
+#line 1097 "sparqlParser.yy"
+{
+	  yySparqlFrob->set_next_GC(
+			  new Union2GraphContext(yySparqlFrob->head_context(), 
+						 yySparqlFrob));
+	  //cout << " found UNION start    \"" << yySparqlFrob->lex->ptr << "\"?" << endl;
+	;
+    break;}
+case 94:
+#line 1104 "sparqlParser.yy"
+{
+	  yyval.binding_graph_context = (BindingGraphContext*)yyvsp[0].graph_context;
+	  //cout << " UNION end at         \"" << yySparqlFrob->lex->ptr << "\"?" << endl;
+	;
+    break;}
+case 95:
+#line 1110 "sparqlParser.yy"
+{
+	  yyval.BindingGraphContext_list= NULL;
+	;
+    break;}
+case 96:
+#line 1114 "sparqlParser.yy"
+{
+	  //cout << " UNION found before   \"" << yySparqlFrob->lex->ptr << "\"?" << endl;
+	  yyval.BindingGraphContext_list= yyvsp[-1].BindingGraphContext_list ? yyvsp[-1].BindingGraphContext_list : new List<BindingGraphContext>;
+	  yyval.BindingGraphContext_list->push_back(yyvsp[0].binding_graph_context);
+	;
+    break;}
+case 97:
+#line 1122 "sparqlParser.yy"
+{
+	  LEX *lex = yySparqlFrob->lex;
+	  SELECT_LEX* sel = &lex->select_lex;
+	  sel->expr_list.head()->push_back(yyvsp[0].item);
+	  String string;
+	  yyvsp[0].item->print(&string);
+	  yyval.buf = new Buf(string.c_ptr());
+	;
+    break;}
+case 98:
+#line 1132 "sparqlParser.yy"
+{yyval.item = yyvsp[0].item;
+    break;}
+case 99:
+#line 1133 "sparqlParser.yy"
+{yyval.item = yyvsp[0].item;
+    break;}
+case 100:
+#line 1134 "sparqlParser.yy"
+{yyval.item = yyvsp[0].item;
+    break;}
+case 101:
+#line 1137 "sparqlParser.yy"
+{yyval.item = NULL; // new Item_func_call(yySparqlFrob->lex->current_context(), $1, $2); 
+YYABORT /* !!! NI */;
+    break;}
+case 102:
+#line 1141 "sparqlParser.yy"
+{yyval.item_list = yyvsp[0].item_list;
+    break;}
+case 103:
+#line 1144 "sparqlParser.yy"
+{yyval.item = yyvsp[0].item;
+    break;}
+case 104:
+#line 1147 "sparqlParser.yy"
+{;
+    break;}
+case 105:
+#line 1149 "sparqlParser.yy"
+{
+	  yySparqlFrob->lex->select_lex.expr_list.push_front(new List<Item>);
+	;
+    break;}
+case 106:
+#line 1154 "sparqlParser.yy"
+{yyval.item_list = NULL;
+    break;}
+case 107:
+#line 1156 "sparqlParser.yy"
+{
+	  yySparqlFrob->lex->select_lex.expr_list.push_front(new List<Item>);
+	;
+    break;}
+case 108:
+#line 1160 "sparqlParser.yy"
+{
+	  yyval.item_list = yySparqlFrob->lex->select_lex.expr_list.pop();
+	  yyval.item_list->push_front(yyvsp[-2].item);
+	;
+    break;}
+case 109:
+#line 1166 "sparqlParser.yy"
+{yyval.buf = new Buf(3, yyvsp[-2].buf, yyvsp[-1].buf, yyvsp[0].buf);
+    break;}
+case 110:
+#line 1169 "sparqlParser.yy"
+{yyval.buf = yyvsp[0].buf;
+    break;}
+case 111:
+#line 1172 "sparqlParser.yy"
+{yyval.buf = new Buf(2, yyvsp[-1].buf, yyvsp[0].buf);
+    break;}
+case 112:
+#line 1175 "sparqlParser.yy"
+{yyval.buf = new Buf();
+    break;}
+case 113:
+#line 1176 "sparqlParser.yy"
+{yyval.buf = yyvsp[0].buf;
+    break;}
+case 114:
+#line 1179 "sparqlParser.yy"
+{yyval.buf = new Buf(2, yyvsp[-1].buf, yyvsp[0].buf);
+    break;}
+case 115:
+#line 1182 "sparqlParser.yy"
+{yyval.buf = new Buf();
+    break;}
+case 116:
+#line 1183 "sparqlParser.yy"
+{yyval.buf = yyvsp[0].buf;
+    break;}
+case 117:
+#line 1187 "sparqlParser.yy"
+{
+	  yySparqlFrob->push_subject(yyvsp[0].item_pos);
+	;
+    break;}
+case 118:
+#line 1191 "sparqlParser.yy"
+{
+	  yySparqlFrob->pop_subject();
+	  yyval.buf = new Buf(2, new Buf(yyvsp[-2].item_pos->get_item()->name), yyvsp[0].buf);
+	;
+    break;}
+case 119:
+#line 1196 "sparqlParser.yy"
+{
+	  yySparqlFrob->push_subject(yyvsp[0].item_pos);
+	;
+    break;}
+case 120:
+#line 1200 "sparqlParser.yy"
+{
+	  yySparqlFrob->pop_subject();
+	  yyval.buf = new Buf(2, new Buf(yyvsp[-2].item_pos->get_item()->name), yyvsp[0].buf);
+	;
+    break;}
+case 121:
+#line 1206 "sparqlParser.yy"
+{yyval.buf = yyvsp[0].buf;
+    break;}
+case 122:
+#line 1209 "sparqlParser.yy"
+{yyval.buf = new Buf();
+    break;}
+case 123:
+#line 1210 "sparqlParser.yy"
+{yyval.buf = yyvsp[0].buf;
+    break;}
+case 124:
+#line 1214 "sparqlParser.yy"
+{
+	  yySparqlFrob->push_predicate(yyvsp[0].item_pos);
+	;
+    break;}
+case 125:
+#line 1218 "sparqlParser.yy"
+{
+	  yySparqlFrob->pop_predicate();
+	  yyval.buf = new Buf(3, new Buf(yyvsp[-3].item_pos->get_item()->name), yyvsp[-1].buf, yyvsp[0].buf);
+	;
+    break;}
+case 126:
+#line 1224 "sparqlParser.yy"
+{yyval.buf = new Buf(2, yyvsp[-1].buf, yyvsp[0].buf);
+    break;}
+case 127:
+#line 1227 "sparqlParser.yy"
+{yyval.buf = new Buf();
+    break;}
+case 128:
+#line 1228 "sparqlParser.yy"
+{yyval.buf = yyvsp[0].buf;
+    break;}
+case 129:
+#line 1232 "sparqlParser.yy"
+{
+	  if (yySparqlFrob->object(yyvsp[0].item_pos))
+	    YYABORT;
+	;
+    break;}
+case 130:
+#line 1236 "sparqlParser.yy"
+{yyval.buf = new Buf(2, new Buf(yyvsp[-2].item_pos->get_item()->name), yyvsp[0].buf);
+    break;}
+case 131:
+#line 1239 "sparqlParser.yy"
+{yyval.buf = new Buf(2, yyvsp[-1].buf, yyvsp[0].buf);
+    break;}
+case 132:
+#line 1242 "sparqlParser.yy"
+{yyval.buf = new Buf();
+    break;}
+case 133:
+#line 1243 "sparqlParser.yy"
+{yyval.buf = yyvsp[0].buf;
+    break;}
+case 134:
+#line 1246 "sparqlParser.yy"
+{yyval.item_pos = yyvsp[0].item_pos;
+    break;}
+case 135:
+#line 1247 "sparqlParser.yy"
+{yyval.item_pos = yyvsp[0].item_pos;
+    break;}
+case 136:
+#line 1250 "sparqlParser.yy"
+{yyval.item_pos = yyvsp[0].item_pos;
+    break;}
+case 137:
+#line 1251 "sparqlParser.yy"
+{yyval.item_pos = yyvsp[0].item_pos;
+    break;}
+case 138:
+#line 1255 "sparqlParser.yy"
+{
+	  yySparqlFrob->push_subject(yySparqlFrob->make_blank_node());
+	;
+    break;}
+case 139:
+#line 1259 "sparqlParser.yy"
+{
+	  //Buf* t = new Buf(3, $1, $3, $4);
+	  yyval.item_pos = yySparqlFrob->pop_subject();
+	;
+    break;}
+case 140:
+#line 1266 "sparqlParser.yy"
+{
+	  yySparqlFrob->push_subject(yySparqlFrob->make_blank_node());
+	  if (yySparqlFrob->type_list())
+	    YYABORT
+	;
+    break;}
+case 141:
+#line 1272 "sparqlParser.yy"
+{
+	  //Buf *t = new Buf(3, $1, $3, $4);
+	  yyval.item_pos = yySparqlFrob->pop_subject();
+	;
+    break;}
+case 142:
+#line 1279 "sparqlParser.yy"
+{
+	  if (yySparqlFrob->add_listElement(yyvsp[0].item_pos))
+	    YYABORT;
+	;
+    break;}
+case 143:
+#line 1284 "sparqlParser.yy"
+{
+	  if (yySparqlFrob->add_listElement(yyvsp[0].item_pos))
+	    YYABORT;
+	  yyval.buf = new Buf(2, yyvsp[-1].buf, new Buf(yyvsp[0].item_pos->get_item()->name));
+	;
+    break;}
+case 144:
+#line 1291 "sparqlParser.yy"
+{yyval.item_pos = yyvsp[0].item_pos;
+    break;}
+case 145:
+#line 1292 "sparqlParser.yy"
+{yyval.item_pos = yyvsp[0].item_pos;
+    break;}
+case 146:
+#line 1295 "sparqlParser.yy"
+{yyval.item_pos = yyvsp[0].item_pos;
+    break;}
+case 147:
+#line 1296 "sparqlParser.yy"
+{yyval.item_pos = yyvsp[0].item_pos;
+    break;}
+case 148:
+#line 1299 "sparqlParser.yy"
+{yyval.item_pos = yyvsp[0].item_pos;
+    break;}
+case 149:
+#line 1300 "sparqlParser.yy"
+{yyval.item_pos = yyvsp[0].item_pos;
+    break;}
+case 150:
+#line 1303 "sparqlParser.yy"
+{yyval.buf = new Buf(yyvsp[0].item_pos->get_item()->name);
+    break;}
+case 151:
+#line 1304 "sparqlParser.yy"
+{yyval.buf = new Buf(yyvsp[0].item_pos->get_item()->name);
+    break;}
+case 152:
+#line 1305 "sparqlParser.yy"
+{yyval.buf = new Buf(yyvsp[0].item_pos->get_item()->name);
+    break;}
+case 153:
+#line 1309 "sparqlParser.yy"
+{
+	  yyval.item_pos = yySparqlFrob->ensure_variable(yyvsp[0].lex_str.str);
+	;
+    break;}
+case 154:
+#line 1313 "sparqlParser.yy"
+{
+	  yyval.item_pos = yySparqlFrob->ensure_variable(yyvsp[0].lex_str.str);
+	;
+    break;}
+case 155:
+#line 1318 "sparqlParser.yy"
+{yyval.item_pos = yyvsp[0].item_pos;
+    break;}
+case 156:
+#line 1319 "sparqlParser.yy"
+{yyval.item_pos = yyvsp[0].item_pos;
+    break;}
+case 157:
+#line 1320 "sparqlParser.yy"
+{yyval.item_pos = yyvsp[0].item_pos /* !!! */;
+    break;}
+case 158:
+#line 1321 "sparqlParser.yy"
+{yyval.item_pos = yyvsp[0].item_pos;
+    break;}
+case 159:
+#line 1322 "sparqlParser.yy"
+{yyval.item_pos = yyvsp[0].item_pos;
+    break;}
+case 160:
+#line 1323 "sparqlParser.yy"
+{yyval.item_pos = yyvsp[0].item_pos;
+    break;}
+case 161:
+#line 1326 "sparqlParser.yy"
+{yyval.buf = yyvsp[0].buf;
+    break;}
+case 162:
+#line 1327 "sparqlParser.yy"
+{yyval.buf = yyvsp[0].buf;
+    break;}
+case 163:
+#line 1330 "sparqlParser.yy"
+{yyval.buf = new Buf();
+    break;}
+case 164:
+#line 1331 "sparqlParser.yy"
+{yyval.buf = yyvsp[0].buf;
+    break;}
+case 165:
+#line 1334 "sparqlParser.yy"
+{yyval.item = yyvsp[0].item;
+    break;}
+case 166:
+#line 1338 "sparqlParser.yy"
+{
+	  yySparqlFrob->lex->select_lex.expr_list.push_front(new List<Item>);
+	;
+    break;}
+case 167:
+#line 1342 "sparqlParser.yy"
+{
+	  List<Item> *list= yySparqlFrob->lex->select_lex.expr_list.pop();
+	  if (list->elements)
+            {
+              list->push_front(yyvsp[-2].item);
+              yyval.item= new Item_cond_or(*list);
+            }
+	  else
+	    yyval.item= yyvsp[-2].item;
+	  delete list;
+	;
+    break;}
+case 168:
+#line 1356 "sparqlParser.yy"
+{
+	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back(yyvsp[0].item);
+	;
+    break;}
+case 169:
+#line 1361 "sparqlParser.yy"
+{;
+    break;}
+case 170:
+#line 1362 "sparqlParser.yy"
+{;
+    break;}
+case 171:
+#line 1366 "sparqlParser.yy"
+{
+	  yySparqlFrob->lex->select_lex.expr_list.push_front(new List<Item>);
+	;
+    break;}
+case 172:
+#line 1370 "sparqlParser.yy"
+{
+	  List<Item> *list= yySparqlFrob->lex->select_lex.expr_list.pop();
+	  if (list->elements)
+            {
+              list->push_front(yyvsp[-2].item);
+              yyval.item= new Item_cond_and(*list);
+            }
+	  else
+	    yyval.item= yyvsp[-2].item;
+	  delete list;
+	;
+    break;}
+case 173:
+#line 1384 "sparqlParser.yy"
+{
+	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back(yyvsp[0].item);
+	;
+    break;}
+case 174:
+#line 1389 "sparqlParser.yy"
+{;
+    break;}
+case 175:
+#line 1390 "sparqlParser.yy"
+{;
+    break;}
+case 176:
+#line 1393 "sparqlParser.yy"
+{yyval.item = yyvsp[0].item;
+    break;}
+case 177:
+#line 1397 "sparqlParser.yy"
+{
+	  // Stick " = 3 " into two list elements in the expr_list.
+	  yySparqlFrob->lex->select_lex.expr_list.push_front(new List<Item>);
+	;
+    break;}
+case 178:
+#line 1402 "sparqlParser.yy"
+{
+	  List<Item> *list= yySparqlFrob->lex->select_lex.expr_list.pop();
+	  if (list->elements)
+            {
+	      chooser_compare_func_creator op = (chooser_compare_func_creator)list->pop();
+	      Item* value = list->pop();
+	      //  chooser_compare_func_creator eq = &comp_eq_creator;
+	      //  Item* test = eq(0)->create($1, value);
+	      yyval.item= op(0)->create(yyvsp[-2].item, value);
+            }
+	  else
+	    yyval.item= yyvsp[-2].item;
+	  delete list;
+	;
+    break;}
+case 179:
+#line 1419 "sparqlParser.yy"
+{
+	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back((Item*)comp_eq_creator);
+	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back(yyvsp[0].item);
+	;
+    break;}
+case 180:
+#line 1424 "sparqlParser.yy"
+{
+	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back((Item*)comp_ne_creator);
+	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back(yyvsp[0].item);
+	;
+    break;}
+case 181:
+#line 1429 "sparqlParser.yy"
+{
+	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back((Item*)comp_lt_creator);
+	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back(yyvsp[0].item);
+	;
+    break;}
+case 182:
+#line 1434 "sparqlParser.yy"
+{
+	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back((Item*)comp_gt_creator);
+	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back(yyvsp[0].item);
+	;
+    break;}
+case 183:
+#line 1439 "sparqlParser.yy"
+{
+	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back((Item*)comp_le_creator);
+	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back(yyvsp[0].item);
+	;
+    break;}
+case 184:
+#line 1444 "sparqlParser.yy"
+{
+	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back((Item*)comp_ge_creator);
+	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back(yyvsp[0].item);
+	;
+    break;}
+case 185:
+#line 1450 "sparqlParser.yy"
+{;
+    break;}
+case 186:
+#line 1451 "sparqlParser.yy"
+{;
+    break;}
+case 187:
+#line 1454 "sparqlParser.yy"
+{yyval.item = yyvsp[0].item;
+    break;}
+case 188:
+#line 1458 "sparqlParser.yy"
+{
+	  // Stick " + 3 " into two list elements in the expr_list.
+	  yySparqlFrob->lex->select_lex.expr_list.push_front(new List<Item>);
+	;
+    break;}
+case 189:
+#line 1463 "sparqlParser.yy"
+{
+	  List<Item> *list= yySparqlFrob->lex->select_lex.expr_list.pop();
+	  if (list->elements)
+            {
+	      //	      chooser_compare_func_creator *op = (chooser_compare_func_creator*)list->pop();
+	      char *op = (char*)list->pop();
+	      Item* value = list->pop();
+	      if (op[0] == '+') {
+		yyval.item= new Item_func_plus(yyvsp[-2].item, value);
+	      } else {
+		yyval.item= new Item_func_minus(yyvsp[-2].item, value);
+	      }
+	      //	      $$= (*op)(0)->create($1, value);
+            }
+	  else
+	    yyval.item= yyvsp[-2].item;
+	  delete list;
+	;
+    break;}
+case 190:
+#line 1484 "sparqlParser.yy"
+{
+	  //	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back((Item*)&comp_plus_creator);
+	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back((Item*)"+");
+	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back(yyvsp[0].item);
+	;
+    break;}
+case 191:
+#line 1490 "sparqlParser.yy"
+{
+	  //	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back((Item*)&comp_minus_creator);
+	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back((Item*)"-");
+	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back(yyvsp[0].item);
+	;
+    break;}
+case 192:
+#line 1497 "sparqlParser.yy"
+{;
+    break;}
+case 193:
+#line 1498 "sparqlParser.yy"
+{;
+    break;}
+case 194:
+#line 1502 "sparqlParser.yy"
+{
+	  // Stick " * 3 " into two list elements in the expr_list.
+	  yySparqlFrob->lex->select_lex.expr_list.push_front(new List<Item>);
+	;
+    break;}
+case 195:
+#line 1507 "sparqlParser.yy"
+{
+	  List<Item> *list= yySparqlFrob->lex->select_lex.expr_list.pop();
+	  if (list->elements)
+            {
+	      //	      chooser_compare_func_creator *op = (chooser_compare_func_creator*)list->pop();
+	      char *op = (char*)list->pop();
+	      Item* value = list->pop();
+	      if (op[0] == '*') {
+		yyval.item= new Item_func_mul(yyvsp[-2].item, value);
+	      } else {
+		yyval.item= new Item_func_div(yyvsp[-2].item, value);
+	      }
+	      //	      $$= (*op)(0)->create($1, value);
+            }
+	  else
+	    yyval.item= yyvsp[-2].item;
+	  delete list;
+	;
+    break;}
+case 196:
+#line 1528 "sparqlParser.yy"
+{
+	  //	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back((Item*)&comp_times_creator);
+	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back((Item*)"*");
+	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back(yyvsp[0].item);
+	;
+    break;}
+case 197:
+#line 1534 "sparqlParser.yy"
+{
+	  //	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back((Item*)&comp_divide_creator);
+	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back((Item*)"/");
+	  yySparqlFrob->lex->select_lex.expr_list.head()->push_back(yyvsp[0].item);
+	;
+    break;}
+case 198:
+#line 1541 "sparqlParser.yy"
+{;
+    break;}
+case 199:
+#line 1542 "sparqlParser.yy"
+{;
+    break;}
+case 200:
+#line 1546 "sparqlParser.yy"
+{
+	  new Item_func_not(yyvsp[0].item);
+	;
+    break;}
+case 201:
+#line 1549 "sparqlParser.yy"
+{yyval.item = yyvsp[0].item;
+    break;}
+case 202:
+#line 1551 "sparqlParser.yy"
+{
+	  new Item_func_neg(yyvsp[0].item);
+	;
+    break;}
+case 203:
+#line 1554 "sparqlParser.yy"
+{yyval.item = yyvsp[0].item;
+    break;}
+case 204:
+#line 1557 "sparqlParser.yy"
+{yyval.item = yyvsp[0].item;
+    break;}
+case 205:
+#line 1558 "sparqlParser.yy"
+{yyval.item = yyvsp[0].item;
+    break;}
+case 206:
+#line 1559 "sparqlParser.yy"
+{yyval.item = yyvsp[0].item;
+    break;}
+case 207:
+#line 1560 "sparqlParser.yy"
+{yyval.item = yyvsp[0].item_pos->get_item();
+    break;}
+case 208:
+#line 1561 "sparqlParser.yy"
+{yyval.item = yyvsp[0].item_pos->get_item();
+    break;}
+case 209:
+#line 1562 "sparqlParser.yy"
+{yyval.item = yyvsp[0].item_pos->get_item();
+    break;}
+case 210:
+#line 1563 "sparqlParser.yy"
+{yyval.item = yyvsp[0].item_pos->get_item();
+    break;}
+case 211:
+#line 1564 "sparqlParser.yy"
+{yyval.item = yyvsp[0].item_pos->get_item();
+    break;}
+case 212:
+#line 1567 "sparqlParser.yy"
+{yyval.item = yyvsp[-1].item;
+    break;}
+case 213:
+#line 1570 "sparqlParser.yy"
+{yyval.item = yyvsp[-1].item; YYABORT /* !!! NI */;
+    break;}
+case 214:
+#line 1571 "sparqlParser.yy"
+{yyval.item = yyvsp[-1].item; YYABORT /* !!! NI */;
+    break;}
+case 215:
+#line 1572 "sparqlParser.yy"
+{yyval.item = yyvsp[-3].item; YYABORT /* !!! NI */;
+    break;}
+case 216:
+#line 1573 "sparqlParser.yy"
+{yyval.item = yyvsp[-1].item; YYABORT /* !!! NI */;
+    break;}
+case 217:
+#line 1574 "sparqlParser.yy"
+{yyval.item = new Item_func_isnotnull(yyvsp[-1].item_pos->get_item());;
+    break;}
+case 218:
+#line 1575 "sparqlParser.yy"
+{yyval.item = yyvsp[-1].item; YYABORT /* !!! NI */;
+    break;}
+case 219:
+#line 1576 "sparqlParser.yy"
+{yyval.item = yyvsp[-1].item; YYABORT /* !!! NI */;
+    break;}
+case 220:
+#line 1577 "sparqlParser.yy"
+{yyval.item = yyvsp[-1].item; YYABORT /* !!! NI */;
+    break;}
+case 221:
+#line 1578 "sparqlParser.yy"
+{yyval.item = yyvsp[-1].item; YYABORT /* !!! NI */;
+    break;}
+case 222:
+#line 1579 "sparqlParser.yy"
+{yyval.item = yyvsp[0].item;
+    break;}
+case 223:
+#line 1582 "sparqlParser.yy"
+{yyval.item = yyvsp[-4].item; YYABORT /* !!! NI */;
+    break;}
+case 224:
+#line 1585 "sparqlParser.yy"
+{yyval.item = NULL;
+    break;}
+case 225:
+#line 1586 "sparqlParser.yy"
+{yyval.item = yyvsp[0].item;
+    break;}
+case 226:
+#line 1589 "sparqlParser.yy"
+{yyval.item = NULL; // new Item_func_call(yySparqlFrob->lex->current_context(), $1, $2); 
+YYABORT /* !!! NI */;
+    break;}
+case 227:
+#line 1593 "sparqlParser.yy"
+{yyval.item_list = NULL;
+    break;}
+case 228:
+#line 1594 "sparqlParser.yy"
+{yyval.item_list = yyvsp[0].item_list;
+    break;}
+case 229:
+#line 1597 "sparqlParser.yy"
+{yyval.item_pos = yySparqlFrob->ensure_string(yyvsp[-1].lex_str, yyvsp[0].item_pos) /* !!! */;
+    break;}
+case 230:
+#line 1600 "sparqlParser.yy"
+{yyval.item_pos = yyvsp[0].item_pos;
+    break;}
+case 231:
+#line 1603 "sparqlParser.yy"
+{yyval.item_pos = yyvsp[0].item_pos;
+    break;}
+case 232:
+#line 1604 "sparqlParser.yy"
+{yyval.item_pos = yyvsp[0].item_pos;
+    break;}
+case 233:
+#line 1607 "sparqlParser.yy"
+{yyval.item_pos = NULL;
+    break;}
+case 234:
+#line 1608 "sparqlParser.yy"
+{yyval.item_pos = yyvsp[0].item_pos;
+    break;}
+case 235:
+#line 1611 "sparqlParser.yy"
+{yyval.item_pos = yySparqlFrob->ensure_int(yyvsp[0].lex_str, NULL) /* !!! */;
+    break;}
+case 236:
+#line 1612 "sparqlParser.yy"
+{yyval.item_pos = yySparqlFrob->ensure_decimal(yyvsp[0].lex_str, NULL) /* !!! */;
+    break;}
+case 237:
+#line 1613 "sparqlParser.yy"
+{yyval.item_pos = yySparqlFrob->ensure_float(yyvsp[0].lex_str, NULL) /* !!! */;
+    break;}
+case 238:
+#line 1616 "sparqlParser.yy"
+{yyval.item_pos = yyvsp[0].item_pos;
+    break;}
+case 239:
+#line 1617 "sparqlParser.yy"
+{yyval.item_pos = yyvsp[0].item_pos;
+    break;}
+case 240:
+#line 1620 "sparqlParser.yy"
+{yyval.lex_str = yyvsp[0].lex_str;
+    break;}
+case 241:
+#line 1621 "sparqlParser.yy"
+{yyval.lex_str = yyvsp[0].lex_str;
+    break;}
+case 242:
+#line 1622 "sparqlParser.yy"
+{yyval.lex_str = yyvsp[0].lex_str;
+    break;}
+case 243:
+#line 1623 "sparqlParser.yy"
+{yyval.lex_str = yyvsp[0].lex_str;
+    break;}
+case 244:
+#line 1626 "sparqlParser.yy"
+{yyval.item_pos = yySparqlFrob->ensure_URI(yyvsp[0].lex_str);
+    break;}
+case 245:
+#line 1627 "sparqlParser.yy"
+{yyval.item_pos = yyvsp[0].item_pos;
+    break;}
+case 246:
+#line 1630 "sparqlParser.yy"
+{yyval.item_pos = yySparqlFrob->ensure_URI(yyvsp[0].lex_str);
+    break;}
+case 247:
+#line 1631 "sparqlParser.yy"
+{yyval.item_pos = yySparqlFrob->ensure_URI(yyvsp[0].lex_str);
+    break;}
+case 248:
+#line 1634 "sparqlParser.yy"
+{yyval.item_pos = yySparqlFrob->ensure_blank_node(yyvsp[0].lex_str.str);
+    break;}
+case 249:
+#line 1635 "sparqlParser.yy"
+{yyval.item_pos = yySparqlFrob->make_blank_node();
+    break;}
+}
+
+#line 839 "/usr/share/bison++/bison.cc"
+   /* the action file gets copied in in place of this dollarsign  */
+  yyvsp -= yylen;
+  yyssp -= yylen;
+#ifdef YY_sparqlParser_LSP_NEEDED
+  yylsp -= yylen;
+#endif
+
+#if YY_sparqlParser_DEBUG != 0
+  if (YY_sparqlParser_DEBUG_FLAG)
+    {
+      short *ssp1 = yyss - 1;
+      fprintf (stderr, "state stack now");
+      while (ssp1 != yyssp)
+	fprintf (stderr, " %d", *++ssp1);
+      fprintf (stderr, "\n");
+    }
+#endif
+
+  *++yyvsp = yyval;
+
+#ifdef YY_sparqlParser_LSP_NEEDED
+  yylsp++;
+  if (yylen == 0)
+    {
+      yylsp->first_line = YY_sparqlParser_LLOC.first_line;
+      yylsp->first_column = YY_sparqlParser_LLOC.first_column;
+      yylsp->last_line = (yylsp-1)->last_line;
+      yylsp->last_column = (yylsp-1)->last_column;
+      yylsp->text = 0;
+    }
+  else
+    {
+      yylsp->last_line = (yylsp+yylen-1)->last_line;
+      yylsp->last_column = (yylsp+yylen-1)->last_column;
+    }
+#endif
+
+  /* Now "shift" the result of the reduction.
+     Determine what state that goes to,
+     based on the state we popped back to
+     and the rule number reduced by.  */
+
+  yyn = yyr1[yyn];
+
+  yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
+  if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
+    yystate = yytable[yystate];
+  else
+    yystate = yydefgoto[yyn - YYNTBASE];
+
+  YYGOTO(yynewstate);
+
+YYLABEL(yyerrlab)   /* here on detecting error */
+
+  if (! yyerrstatus)
+    /* If not already recovering from an error, report this error.  */
+    {
+      ++YY_sparqlParser_NERRS;
+
+#ifdef YY_sparqlParser_ERROR_VERBOSE
+      yyn = yypact[yystate];
+
+      if (yyn > YYFLAG && yyn < YYLAST)
+	{
+	  int size = 0;
+	  char *msg;
+	  int x, count;
+
+	  count = 0;
+	  /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */
+	  for (x = (yyn < 0 ? -yyn : 0);
+	       x < (sizeof(yytname) / sizeof(char *)); x++)
+	    if (yycheck[x + yyn] == x)
+	      size += strlen(yytname[x]) + 15, count++;
+	  msg = (char *) malloc(size + 15);
+	  if (msg != 0)
+	    {
+	      strcpy(msg, "parse error");
+
+	      if (count < 5)
+		{
+		  count = 0;
+		  for (x = (yyn < 0 ? -yyn : 0);
+		       x < (sizeof(yytname) / sizeof(char *)); x++)
+		    if (yycheck[x + yyn] == x)
+		      {
+			strcat(msg, count == 0 ? ", expecting `" : " or `");
+			strcat(msg, yytname[x]);
+			strcat(msg, "'");
+			count++;
+		      }
+		}
+	      YY_sparqlParser_ERROR(msg);
+	      free(msg);
+	    }
+	  else
+	    YY_sparqlParser_ERROR ("parse error; also virtual memory exceeded");
+	}
+      else
+#endif /* YY_sparqlParser_ERROR_VERBOSE */
+	YY_sparqlParser_ERROR("parse error");
+    }
+
+  YYGOTO(yyerrlab1);
+YYLABEL(yyerrlab1)   /* here on error raised explicitly by an action */
+
+  if (yyerrstatus == 3)
+    {
+      /* if just tried and failed to reuse lookahead token after an error, discard it.  */
+
+      /* return failure if at end of input */
+      if (YY_sparqlParser_CHAR == YYEOF)
+	YYABORT;
+
+#if YY_sparqlParser_DEBUG != 0
+      if (YY_sparqlParser_DEBUG_FLAG)
+	fprintf(stderr, "Discarding token %d (%s).\n", YY_sparqlParser_CHAR, yytname[yychar1]);
+#endif
+
+      YY_sparqlParser_CHAR = YYEMPTY;
+    }
+
+  /* Else will try to reuse lookahead token
+     after shifting the error token.  */
+
+  yyerrstatus = 3;              /* Each real token shifted decrements this */
+
+  YYGOTO(yyerrhandle);
+
+YYLABEL(yyerrdefault)  /* current state does not do anything special for the error token. */
+
+#if 0
+  /* This is wrong; only states that explicitly want error tokens
+     should shift them.  */
+  yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
+  if (yyn) YYGOTO(yydefault);
+#endif
+
+YYLABEL(yyerrpop)   /* pop the current state because it cannot handle the error token */
+
+  if (yyssp == yyss) YYABORT;
+  yyvsp--;
+  yystate = *--yyssp;
+#ifdef YY_sparqlParser_LSP_NEEDED
+  yylsp--;
+#endif
+
+#if YY_sparqlParser_DEBUG != 0
+  if (YY_sparqlParser_DEBUG_FLAG)
+    {
+      short *ssp1 = yyss - 1;
+      fprintf (stderr, "Error: state stack now");
+      while (ssp1 != yyssp)
+	fprintf (stderr, " %d", *++ssp1);
+      fprintf (stderr, "\n");
+    }
+#endif
+
+YYLABEL(yyerrhandle)
+
+  yyn = yypact[yystate];
+  if (yyn == YYFLAG)
+    YYGOTO(yyerrdefault);
+
+  yyn += YYTERROR;
+  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
+    YYGOTO(yyerrdefault);
+
+  yyn = yytable[yyn];
+  if (yyn < 0)
+    {
+      if (yyn == YYFLAG)
+	YYGOTO(yyerrpop);
+      yyn = -yyn;
+      YYGOTO(yyreduce);
+    }
+  else if (yyn == 0)
+    YYGOTO(yyerrpop);
+
+  if (yyn == YYFINAL)
+    YYACCEPT;
+
+#if YY_sparqlParser_DEBUG != 0
+  if (YY_sparqlParser_DEBUG_FLAG)
+    fprintf(stderr, "Shifting error token, ");
+#endif
+
+  *++yyvsp = YY_sparqlParser_LVAL;
+#ifdef YY_sparqlParser_LSP_NEEDED
+  *++yylsp = YY_sparqlParser_LLOC;
+#endif
+
+  yystate = yyn;
+  YYGOTO(yynewstate);
+/* end loop, in which YYGOTO may be used. */
+  YYENDGOTO
+}
+
+/* END */
+
+ #line 1038 "/usr/share/bison++/bison.cc"
+#line 1693 "sparqlParser.yy"
+
+
+#define YY_DECL int yyFlexLexer::yylex(YY_sparqlParser_STYPE *val, void *yythd)
+    //int yylex(void *yylval, void *yythd);
+const LEX_STRING null_lex_str={0,0};
+
+
+// -------------------------------------- START
+#include "FlexLexer.h"
+// -------------------------------------- END
+
+class sparqlParserPackage : public sparqlParser
+{
+ private:
+  yyFlexLexer theScanner;
+  THD *thd;
+ public:
+  virtual int yylex();
+  virtual void yyerror(char *m);
+  sparqlParserPackage(THD *thd, char** ptr) : theScanner(thd, ptr) {
+    this->thd = thd;
+  };
+};
+
+int sparqlParserPackage::sparqllex()
+{
+ return theScanner.yylex(&yylval);
+}
+
+void sparqlParserPackage::yyerror(char *s)
+{
+  char *yytext= theScanner.get_last_word();
+  my_printf_error(ER_PARSE_ERROR,  ER(ER_PARSE_ERROR), MYF(0), s,
+                  (yytext ? (char*) yytext : ""),
+                  thd->lex->yylineno);
+}
+
+// Move this class definition into sparqlFrob.h and uncomment the #include
+// below. See http://www.w3.org/1999/02/26-modules/User/Yacker#encap for more
+// details.
+
+sparqlFrob::sparqlFrob(THD *thd, char** ptr)
+{
+  // stringstream* ss = new stringstream(buf, stringstream::in);
+  this->thd= thd;
+  lex= thd ? thd->lex : NULL;
+  distinct= false;
+  sparqlParserPackage* aCompiler= new sparqlParserPackage(thd, ptr);
+  parser= aCompiler;
+  next_union_alias_index= 0;
+}
+sparqlFrob::~sparqlFrob()
+{
+}
+
+int sparqlFrob::parse()
+{
+  sparqlParserPackage* aCompiler = (sparqlParserPackage*) parser;
+  return aCompiler->yyparse(this);
+}
+
+const char* sparqlFrob::get_primary_key(const char *table_name) {
+  TABLE_LIST *entry = thd->main_lex.select_lex.context.table_list;
+  while (entry) {
+    if (!strcmp(table_name, entry->table_name)) {
+      KEY *key= entry->table->key_info;
+
+      /* Search table structure for PRIMARY KEY.
+	 Taken from sql_show.cc::2905 get_schema_stat_record */
+      for (unsigned i= 0; i < entry->table->s->keys; i++) {
+	if (!strcmp(key[i].name, "PRIMARY")) {
+	  const char *ret = key[i].key_part->field->field_name;
+	  if (key[i].key_parts != 1)
+	    cout << "SPARQL: table \"" << table_name << "\" primary key has " <<
+	      key[i].key_parts << " parts -- using only 1st field, \"" << ret <<
+	      "\"" << endl;
+	  return ret;
+	}
+      }
+
+      // Couldn't find PRIMARY KEY
+      const char *ret = entry->table->s->fieldnames.type_names[0];
+      cout << "SPARQL: could not find " << table_name << ".<pk> -- trying " << ret << endl;
+      return ret;
+    }
+    entry= entry->next_global;
+  }
+  my_printf_error(1, "SPARQL: could not find table entry for %s. "PLS_REPORT, MYF(0), table_name);
+  return NULL;
+}
+LEX_STRING* sparqlFrob::next_union_alias () {
+  char space[3];
+  space[0]= 'U';
+  space[1]= '0'+next_union_alias_index++;
+  space[2]= 0;
+
+  LEX_STRING *alias = new LEX_STRING;
+  alias->str= thd->strmake(space, 3);
+  alias->length = 2;
+  return alias;
+}
+
+
+Item_variable* sparqlFrob::ensure_variable (const char *var) {
+  return head_context()->get_binding_context()->
+    ensure_bound_item_variable(var, this, 1);
+}
+
+Item_URI* sparqlFrob::ensure_URI (LEX_STRING uristr) {
+  Item_URI* ret;
+  List_iterator<Item_URI> item_list_it(uris);
+  while ((ret = item_list_it++))
+  {
+    if (!strcmp(ret->name, uristr.str)) { /* !!! */
+      return ret;
+    }
+      //    if (curr_item->eq(this, 1))
+      //      DBUG_RETURN(FALSE); /* Already in the set. */
+  }
+
+  ret = new Item_URI(lex->current_context(), uristr, thd);
+  uris.push_back(ret);
+  return ret;
+}
+
+Item_blank_node* sparqlFrob::make_blank_node () {
+  return new Item_blank_node(lex->current_context(), "", this);
+}
+
+Item_blank_node* sparqlFrob::ensure_blank_node (const char *label) {
+  Item_blank_node* ret;
+  List_iterator<Item_blank_node> item_list_it(blank_nodes);
+  while ((ret = item_list_it++))
+  {
+    if (!strcmp(ret->name, label)) {
+      return ret;
+    }
+      //    if (curr_item->eq(this, 1))
+      //      DBUG_RETURN(FALSE); /* Already in the set. */
+  }
+
+  ret = new Item_blank_node(lex->current_context(), label, this);
+  blank_nodes.push_back(ret);
+  return ret;
+}
+
+Item_primary_key_field::Item_primary_key_field (
+			 Name_resolution_context *context_arg,
+			 const char *db_arg, const char *table_name_arg, 
+			 sparqlFrob *frob_arg, 
+			 const char* real_table_name_arg) :
+  Item_field(context_arg, db_arg, table_name_arg, "<pk>") {
+  frob = frob_arg;
+  real_table_name= real_table_name_arg;
+}
+bool Item_primary_key_field::fix_fields(THD *thd, Item **reference) {
+  field_name = frob->get_primary_key(real_table_name);
+  return Item_field::fix_fields(thd, reference);
+}
+
+Item_literal_string* sparqlFrob::ensure_string (LEX_STRING str, Item_POS *lang_or_datatype) {
+  Item_literal_string* ret;
+  List_iterator<Item_literal_string> item_list_it(strings);
+  while ((ret = item_list_it++))
+    if (!strncmp(ret->name, str.str, str.length) && ret->get_language_or_datatype() == lang_or_datatype) // !!! check len or "foo1"="foo"
+      return ret;
+  ret = new Item_literal_string(str, lang_or_datatype, thd->charset());
+  strings.push_back(ret);
+  return ret;
+}
+Item_literal_int* sparqlFrob::ensure_int (LEX_STRING str, Item_POS *lang_or_datatype) {
+  Item_literal_int* ret;
+  List_iterator<Item_literal_int> item_list_it(ints);
+  while ((ret = item_list_it++))
+    if (!strncmp(ret->name, str.str, str.length)) // !!! check len or "foo1"="foo"
+      return ret;
+  ret = new Item_literal_int(str, lang_or_datatype, thd->charset());
+  ints.push_back(ret);
+  return ret;
+}
+Item_literal_decimal* sparqlFrob::ensure_decimal (LEX_STRING str, Item_POS *lang_or_datatype) {
+  Item_literal_decimal* ret;
+  List_iterator<Item_literal_decimal> item_list_it(decimals);
+  while ((ret = item_list_it++))
+    if (!strncmp(ret->name, str.str, str.length)) // !!! check len or "foo1"="foo"
+      return ret;
+  ret = new Item_literal_decimal(str, lang_or_datatype, thd->charset());
+  decimals.push_back(ret);
+  return ret;
+}
+Item_literal_float* sparqlFrob::ensure_float (LEX_STRING str, Item_POS *lang_or_datatype) {
+  Item_literal_float* ret;
+  List_iterator<Item_literal_float> item_list_it(floats);
+  while ((ret = item_list_it++))
+    if (!strncmp(ret->name, str.str, str.length)) // !!! check len or "foo1"="foo"
+      return ret;
+  ret = new Item_literal_float(str, lang_or_datatype, thd->charset());
+  floats.push_back(ret);
+  return ret;
+}
+
+void sparqlFrob::select_variables () {
+  SELECT_LEX *sel= lex->current_select;  
+  sel->parsing_place= SELECT_LIST;
+  BindingContext *bc = last_context()->get_binding_context();
+
+  // If nothing was selected, we know there was a "SELECT *".
+  bool select_star= !lex->current_select->item_list.elements;
+
+  /**************************
+   * Handle the subselects. *
+   **************************/
+
+  // Walk the list of GraphContext sets
+  List_iterator<List<BindingGraphContext> > list_it(need_selects);
+  List<BindingGraphContext> *list;
+  while ((list= list_it++)) {
+
+    // Assemble a list of selected variables.
+    List<Item_variable> selected_vars;
+
+    // List of BindingGraphContexts that need newly added vars (starts with ()).
+    List<BindingGraphContext> passed_gcs;
+
+    // For each BindingGraphContext...
+    List_iterator<BindingGraphContext> gc_it(*list);
+    BindingGraphContext *gc;
+    while ((gc= gc_it++)) {
+
+      // Walk variables bound in this context.
+      List<Item_variable> *known_vars= gc->get_binding_context()->get_item_variables();
+      List_iterator<Item_variable> known_vars_it(*known_vars);
+      Item_variable *known_var;
+      while ((known_var= known_vars_it++)) {
+
+	// If the variable has no in parents refs, skip it.
+	if (!select_star && known_var->outer_has_no_refs())
+	  continue;
+
+	// If the variable was already selected, skip it.
+	bool stupid_continue_flag= false; // C doesn't have a labeled continue.
+	List_iterator<Item_variable> selected_vars_it(selected_vars);
+	Item_variable *selected_var;
+	while ((selected_var= selected_vars_it++))
+	  if (selected_var->same_variable(known_var->name)) {
+	    stupid_continue_flag= true;
+	    break;
+	  }
+	if (stupid_continue_flag)
+	  continue;
+
+	// known_var is referenced in a parent context and not yet selected in
+	// this UNION.
+
+	// Select in this gc...
+	gc->select_var(known_var, true);
+	//                  ...and all passed...
+	List_iterator<BindingGraphContext> passed_gcs_it(passed_gcs);
+	BindingGraphContext *passed_gc;
+	while ((passed_gc= passed_gcs_it++))
+	  passed_gc->select_var(known_var, false);// also sets binding in parent.
+	//                                   ...and future gcs.
+	List_iterator<BindingGraphContext> future_gcs_it= gc_it; // @@@ ca marche?
+	BindingGraphContext *future_gc;
+	while ((future_gc= future_gcs_it++)) {
+	  bool exists= Item_variable::match_var_in_list(future_gc->get_binding_context()->get_item_variables(), known_var->name) != NULL;
+	  future_gc->select_var(known_var, exists);
+	}
+
+	selected_vars.push_front(known_var); // It's selected now.
+      }
+      
+      passed_gcs.push_front(gc);
+    }
+  }    
+
+  if (select_star)
+    // Select known vars and update reference counts.
+    bc->select_star(thd);
+
+  sel->parsing_place= NO_MATTER;
+}
+
+void sparqlFrob::push_subject (Item_POS *subject) {
+  subjects.push_front(subject);
+}
+
+Item_POS* sparqlFrob::pop_subject () {
+  return subjects.pop();
+}
+
+void sparqlFrob::push_predicate (Item_POS *predicate) {
+  predicates.push_front(predicate);
+}
+
+void sparqlFrob::pop_predicate () {
+  predicates.pop();
+}
+
+int Simple_error (const char *format) {
+  my_printf_error(1, format, MYF(0));
+  return 1;
+}
+
+int Item_error (const char *format, Item *item) {
+  String pString;
+  item->print(&pString);
+  my_printf_error(1, format, MYF(0), pString.c_ptr());
+  return 1;
+}
+
+const char* scan_string (THD *thd, LEX_STRING *lex_string, const char *start, 
+			 const char *end, const char look_for) {
+  const char *ptr = end;
+  lex_string->length = 0;
+  for (; ; ) {
+    if (ptr == start) {
+      if (look_for) {
+	// we didn't find it
+	ptr = NULL;
+	lex_string->length = 0;
+	return NULL;
+      } else {
+	lex_string->str = thd->strmake(ptr, lex_string->length);
+	return ptr;
+      }
+    }
+    if (*ptr == look_for) {
+      --lex_string->length;
+      lex_string->str = thd->strmake(ptr+1, lex_string->length);
+      return ptr;
+    }
+    --ptr;
+    ++lex_string->length;
+  }
+}
+
+bool sparqlFrob::object (Item_POS *object) {
+  Item_POS* subject = subjects.head();
+  if (!predicates.head()->is_URI())
+    return Item_error("predicate must be a URI, not \"%s\"", predicates.head()->get_item());
+  Item_URI* predicate = (Item_URI*)predicates.head();
+  BindingContext *bc= head_context()->get_binding_context();
+  Alias_info *ai= bc->get_table_alias(thd, subject, predicate, object);
+  const char *ptr = head_context()->get_alias_string(ai, subject, thd);
+  if (!ptr)
+    return true;
+
+  object->bind_field(predicate->get_table().str, ptr, predicate->get_field().str, false, thd, NULL);
+  return false;
+}
+
+bool sparqlFrob::type_list () {
+  return Simple_error("Lists not supported");
+}
+
+bool sparqlFrob::add_listElement (Item_POS *item) {
+  return Item_error("Lists not supported -- can't add \"%s\"", item->get_item());
+}
+
+
+/* <BindingContext> */
+void BindingContext::select_star (THD *thd) {
+  List_iterator<Item_variable> list_it(item_variables);
+  Item_variable *ptr;
+  while ((ptr= list_it++))
+    add_item_to_list(thd, ptr);
+}
+Alias_info* BindingContext::get_table_alias (THD *thd, Item_POS *s, Item_URI *p, Item_POS *o) {
+  LEX_STRING table = p->get_table();
+  Alias_info *ai = NULL;
+  List_iterator<Alias_info> item_list_it(aliases);
+  Alias_info *t;
+  while ((t = item_list_it++)) {
+    if (t->same_table(table)) {
+      ai = t;
+      break;
+    }
+  }
+  if (!ai) {
+    ai = new Alias_info(table);
+    aliases.push_front(ai);
+  }
+  return ai;
+}
+
+/* ref_count -- 
+		0: child context looking for the variable in a parent context.
+		1: normal use
+ */
+Item_variable* BindingContext::ensure_bound_item_variable (const char *var, sparqlFrob *sparql_frob, int ref_count) {
+  List_iterator<Item_variable> item_list_it(item_variables);
+  Item_variable* ret;
+  while ((ret= item_list_it++))
+    if (ret->same_variable(var)) {
+      ret->add_ref_count(ref_count);
+      return ret;
+    }
+
+  Item_variable *outer= parent ? parent->ensure_bound_item_variable(var, 
+						        sparql_frob, 0) : NULL;
+  ret= new Item_variable(name_res_context, var, outer, sparql_frob, ref_count);
+  item_variables.push_back(ret);
+
+  return ret;
+}
+
+Item* BindingContext::get_bound_variable_constraints (Item *conjunction_constraints, GraphContext *gc) {
+  // Will need to write down our created constraints
+  List<Item> nulls;
+  List<Item> notNulls;
+  //  return NULL;
+  // Walk the list of our introduced variables.
+  List_iterator<Item_variable> item_list_it(item_variables);
+  Item_variable *t;
+  while ((t = item_list_it++)) {
+    if (gc->is_optional()) {
+      nulls.push_front(new Item_func_isnull(t));
+    }
+    notNulls.push_front(new Item_func_isnotnull(t));
+  }
+  if (conjunction_constraints)
+    notNulls.push_front(conjunction_constraints);
+  Item *nulls_cond = nulls.elements ? new Item_cond_and(nulls) : NULL;
+  Item *notNulls_cond = notNulls.elements ? new Item_cond_and(notNulls) : NULL;
+  if (nulls_cond && notNulls_cond) {
+    List<Item> *or_cond = new List<Item>;
+    or_cond->push_front(nulls_cond);
+    or_cond->push_front(notNulls_cond);
+    return new Item_cond_or(*or_cond);
+  }
+  // It is impossible that we have nulls and no notNulls to return notNulls.
+  return notNulls_cond;
+}
+void BindingContext::start_constraints () {
+  mysql_init_select(lex);
+  name_res_context= lex->current_context();
+  constraints= new List<Item>;
+  lex->select_lex.expr_list.push_front(constraints); // current_select->
+}
+/* </BindingContext> */
+
+
+Item_URI::Item_URI(Name_resolution_context *context_arg, LEX_STRING uri, THD *thd) : 
+  Item_field(context_arg, NullS, NullS, uri.str), Item_POS(this) {
+  const char* ptr = scan_string(thd, &value, name, name + uri.length, '=');
+  if ((ptr = scan_string(thd, &field, name, ptr ? ptr : name + uri.length, '.'))) {
+    scan_string(thd, &table, name, ptr ? ptr : name + uri.length, 0);
+  }
+}
+void Item_URI::bind_field(const char *table_name, const char *alias, 
+			  const char *field_name_arg, bool trump, 
+			  THD *thd, TABLE_LIST *jt) {
+  LEX *lex= thd->lex;
+  SELECT_LEX *sel= lex->current_select;
+  chooser_compare_func_creator eq = &comp_eq_creator;
+  LEX_STRING value = get_value();
+  cout << "WHERE " << alias << "." << get_field().str << "=" << value.str << endl;
+  Item* idI = new Item_field(lex->current_context(), NullS, alias, get_field().str);
+  int error;
+  Item* val = new Item_int(value.str, (longlong) my_strtoll10(value.str, NULL, &error), value.length);
+  Item* test = eq(0)->create(idI, val);
+  sel->expr_list.head()->push_back(test);
+  test->top_level_item();
+  if (jt) {
+    SELECT_LEX *sel= lex->current_select;
+    sel->add_joined_table(jt);
+  }
+}
+void Item_URI::print(String *str)
+{
+  str->append('<');
+  str->append(name);
+  str->append('>');
+}
+
+
+/* <Item_variable> */
+Item_variable::Item_variable(Name_resolution_context *context_arg, 
+			     const char *variable_name, Item_variable *outer_arg, 
+			     sparqlFrob *frob_arg, int ref_count_arg) : 
+  Item_field(context_arg, NullS, NullS, variable_name), Item_POS(this) {
+  set_name(variable_name, strlen(variable_name), system_charset_info);
+  is_autogenerated_name= FALSE;
+  nr_context= context_arg;
+  bound= false;
+  outer= outer_arg;
+  frob= frob_arg;
+  primary_key= false;
+  gc= frob->head_context();
+  jt= NULL;
+  ref_count= ref_count_arg;
+}
+Item* Item_variable::make_Item_field(Name_resolution_context *context_arg,
+				     const char *db_arg,
+				     const char *table_name_arg,
+				     const char *field_name_arg, 
+				     const char* real_table_name) {
+  return field_name_arg ? new Item_field(context_arg, db_arg, 
+					 table_name_arg, field_name_arg) :
+    new Item_primary_key_field(context_arg, db_arg, 
+			       table_name_arg, frob, real_table_name);
+}
+void Item_variable::bind_field(const char *table_name_arg, const char *alias, 
+			       const char *field_name_arg, bool trump, 
+			       THD *thd, TABLE_LIST *jt_param) {
+  LEX *lex= thd->lex;
+  if (jt_param && (!jt || trump)) {
+    //    assert(!jt);
+    jt = jt_param;
+    SELECT_LEX *sel= lex->current_select;
+    sel->add_joined_table(jt);
+  }
+  if (jt && bound) {
+    cout << " ON " << table_name << "." << (primary_key ? "<pk>" : field_name) << " = " << alias << "." << (field_name_arg ? field_name_arg : "<pk>") << endl; // !!!
+    Item* l = make_Item_field(lex->current_context(), NullS, table_name, primary_key ? NULL : field_name, real_table_name);
+    Item* r = make_Item_field(lex->current_context(), NullS, alias, field_name_arg, table_name_arg);
+    chooser_compare_func_creator eq = &comp_eq_creator;
+    Item* on = eq(0)->create(l, r);
+    add_join_on(jt, on);
+  }
+  if (!bound || trump) {
+    cout << "  " << alias << "." << (field_name_arg ? field_name_arg : "<pk>") << " AS \"" << name << "\"" << endl;
+    table_name = (char*) alias;
+    if (field_name_arg) {
+      field_name = (char*) field_name_arg;
+      primary_key = false;
+    } else {
+      primary_key = true;
+      real_table_name = table_name_arg;
+    }
+    bound = true;
+    // name = (char*) field_name;
+  }
+}
+bool Item_variable::fix_fields(THD *thd, Item **reference) {
+  if (primary_key)
+    if (!(field_name = get_primary_key()))
+      return true; // signal an error
+  return Item_field::fix_fields(thd, reference);
+}
+Item_variable* Item_variable::match_var_in_list (List<Item_variable> *p_item_variables, const char *var) {
+  List_iterator<Item_variable> item_list_it(*p_item_variables);
+  Item_variable* ret;
+  while ((ret= item_list_it++))
+    if (ret->same_variable(var)) {
+      return ret;
+    }
+  return NULL;
+}
+Item* Item_variable::get_null_item() {
+  Item *ret= new Item_null();
+  ret->set_name(name, strlen(name), system_charset_info);
+  ret->is_autogenerated_name= FALSE;
+  return ret;
+}
+/* virtual overload of Item::send, which is called when serializing the results.
+ */
+bool Item_variable::send(Protocol *protocol, String *buffer)
+{
+  bool result;
+  String *res;
+  if (primary_key) {
+    if ((res=val_str(buffer))) {
+      // Return something in the form of "<Orders.id=2186>".
+      size_t len = 1+strlen(real_table_name)+1+strlen(field_name)+1+res->length()+1;
+      // Assume res->charset() is compatible with ASCII.
+      // Otherwise, we'd need to convert names et all to res->charset().
+      char space[len+1];
+      space[0] = '<';
+      strcpy(space+1, real_table_name);
+      strcat(space, ".");
+      strcat(space, field_name);
+      strcat(space, "=");
+      strncat(space, res->ptr(), res->length());
+      space[len-1] = '>';
+      space[len] = 0;
+      return protocol->store(space,len,res->charset());
+    } else
+      return protocol->store_null();
+  } else
+    return protocol->store(result_field);
+
+  //    return protocol->store(result_field);
+}
+void Item_variable::print(String *str)
+{
+  Item::print(str);
+  str->append("{?");
+  str->append(name);
+  str->append('}');
+}
+/* </Item_variable> */
+
+
+void Item_blank_node::print(String *str)
+{
+  Item::print(str);
+  str->append("[_:");
+  str->append(name);
+  str->append(']');
+}
+void Item_literal_string::bind_field(const char *table_name, const char *alias, 
+				     const char *field_name_arg, bool trump, 
+				     THD *thd, TABLE_LIST *jt) {
+  cout << "WHERE " << alias << "." << field_name_arg << "=\"" << name << "\"" << endl;
+  LEX *lex= thd->lex;
+  Item* idI = new Item_field(lex->current_context(), NullS, alias, field_name_arg);
+  chooser_compare_func_creator eq = &comp_eq_creator;
+  Item* test = eq(0)->create(idI, get_item());
+  SELECT_LEX *sel= lex->current_select;
+  sel->expr_list.head()->push_back(test);
+  test->top_level_item();
+  if (jt) {
+    sel->add_joined_table(jt);
+  }
+}
+void Item_literal_string::print(String *str)
+{
+  str->append('\'');
+  str->append(name);
+  str->append('\'');
+}
+void Item_literal_int::bind_field(const char *table_name, const char *alias, 
+				  const char *field_name_arg, bool trump, 
+				  THD *thd, TABLE_LIST *jt) {
+  cout << "WHERE " << alias << "." << field_name_arg << "=\"" << name << "\"" << endl;
+  LEX *lex= thd->lex;
+  Item* idI = new Item_field(lex->current_context(), NullS, alias, field_name_arg);
+  chooser_compare_func_creator eq = &comp_eq_creator;
+  Item* test = eq(0)->create(idI, get_item());
+  SELECT_LEX *sel= lex->current_select;
+  sel->expr_list.head()->push_back(test);
+  test->top_level_item();
+  if (jt) {
+    sel->add_joined_table(jt);
+  }
+}
+void Item_literal_int::print(String *str)
+{
+  str->append(name);
+}
+void Item_literal_decimal::bind_field(const char *table_name, const char *alias, 
+				      const char *field_name_arg, bool trump, 
+				      THD *thd, TABLE_LIST *jt) {
+  cout << "WHERE " << alias << "." << field_name_arg << "=\"" << name << "\"" << endl;
+  LEX *lex= thd->lex;
+  Item* idI = new Item_field(lex->current_context(), NullS, alias, field_name_arg);
+  chooser_compare_func_creator eq = &comp_eq_creator;
+  Item* test = eq(0)->create(idI, get_item());
+  SELECT_LEX *sel= lex->current_select;
+  sel->expr_list.head()->push_back(test);
+  test->top_level_item();
+  if (jt) {
+    sel->add_joined_table(jt);
+  }
+}
+void Item_literal_decimal::print(String *str)
+{
+  str->append(name);
+}
+void Item_literal_float::bind_field(const char *table_name, const char *alias, 
+				    const char *field_name_arg, bool trump, 
+				    THD *thd, TABLE_LIST *jt) {
+  cout << "WHERE " << alias << "." << field_name_arg << "=\"" << name << "\"" << endl;
+  LEX *lex= thd->lex;
+  Item* idI = new Item_field(lex->current_context(), NullS, alias, field_name_arg);
+  chooser_compare_func_creator eq = &comp_eq_creator;
+  Item* test = eq(0)->create(idI, get_item());
+  SELECT_LEX *sel= lex->current_select;
+  sel->expr_list.head()->push_back(test);
+  test->top_level_item();
+  if (jt) {
+    sel->add_joined_table(jt);
+  }
+}
+void Item_literal_float::print(String *str)
+{
+  str->append(name);
+}
+const char* GraphContext::get_alias_string (Alias_info *ai, Item_POS *s, THD *thd) {
+  List_iterator<Item_POS> item_list_it(ai->subjects);
+  Item_POS *t;
+  size_t i= 0;
+  bool found= false;
+  while ((t= item_list_it++)) {
+    if (t == s) {
+      found= true;
+      break;
+    }
+    ++i;
+  }
+  char space[ai->table.length+1+1+1];
+  strncpy(space, ai->table.str, ai->table.length);
+  space[ai->table.length]= '_';
+  space[ai->table.length+1]= '0'+i;
+  space[ai->table.length+2]= 0;
+  const char *ret= thd->strmake(space, ai->table.length+1+1+1);
+  if (!found) {
+    ai->subjects.push_front(s);
+    Table_ident* table_i= new Table_ident(ai->table);
+    LEX *lex= thd->lex;
+    SELECT_LEX* sel= lex->current_select; // &lex->select_lex;
+    LEX_STRING *alias= new LEX_STRING;
+    alias->str= (char*)ret;
+    alias->length= ai->table.length+2;
+    cout << "FROM " << ai->table.str << " AS " << alias->str << endl;
+    TABLE_LIST *jt= sel->add_table_to_list(lex->thd, table_i, alias,
+					   sel->get_table_join_options(),
+					   lex->lock_option,
+					   sel->get_use_index(),
+					   sel->get_ignore_index());
+    if (!jt)
+      return NULL;
+    if (is_optional())
+      jt->outer_join|=JOIN_TYPE_LEFT;
+    if (s->is_URI()) {
+      Item_URI *sURI= (Item_URI*)s;
+      chooser_compare_func_creator eq= &comp_eq_creator;
+      LEX_STRING value= sURI->get_value();
+      cout << "WHERE " << alias->str << "." << sURI->get_field().str << "=" << value.str << endl;
+      Item* idI= new Item_field(lex->current_context(), NullS, alias->str, sURI->get_field().str);
+      int error;
+      Item* val= new Item_int(value.str, (longlong) my_strtoll10(value.str, NULL, &error), value.length);
+      Item* test= eq(0)->create(idI, val);
+      sel->expr_list.head()->push_back(test);
+      test->top_level_item();
+      sel->add_joined_table(jt);
+    } else if (s->is_variable()) {
+      s->bind_field(ai->table.str, ret, NULL, true, thd, jt);
+    }
+  }
+  return ret;
+}
+
+
+/* <BindingGraphContext> */
+BindingGraphContext::BindingGraphContext (GraphContext *parent_param, sparqlFrob *sparql_frob_param) : 
+  GraphContext (parent_param, sparql_frob_param) {
+  bindings= new BindingContext(this, parent ? parent->get_binding_context() : NULL, 
+			       sparql_frob->lex);
+  current_select= NULL;
+}
+
+void BindingGraphContext::select_var (Item_variable *var, bool exists) {
+  cout << (void*)this << " SELECTs " << (exists ? "" : "NULL AS ") << var->name << endl;
+  current_select->add_item_to_list(thd, exists ? var->get_item() :  
+						 var->get_null_item());
+}
+/* </BindingGraphContext> */
+
+
+/* <RootGraphContext> */
+RootGraphContext::RootGraphContext (GraphContext *parent, 
+				    sparqlFrob *sparql_frob) : 
+  BindingGraphContext(parent, sparql_frob) {
+  bindings->start_constraints();
+  current_select= sparql_frob->lex->current_select;
+}
+/* </RootGraphContext> */
+
+
+/* <Union1GraphContext> */
+Union1GraphContext::Union1GraphContext (GraphContext *parent, 
+					sparqlFrob *sparql_frob) : 
+  BindingGraphContext(parent, sparql_frob) {
+  LEX *lex= thd->lex;
+  lex->current_select->init_nested_join(thd);
+  lex->current_select->end_nested_join(thd);
+  lex->derived_tables|= DERIVED_SUBQUERY;
+  mysql_new_select(lex, 1);
+  current_select= sparql_frob->lex->current_select;
+  bindings->start_constraints();
+  lex->current_select->linkage= DERIVED_TABLE_TYPE;
+}
+void Union1GraphContext::close () {
+  thd->lex->current_select->init_nested_join(thd);
+  //    thd->lex->current_select->init_nested_join(thd);
+  thd->lex->current_select->end_nested_join(thd);
+  bindings->end_and_check_constraints();
+}
+/* </Union1GraphContext> */
+
+
+/* <Union1GraphContext> */
+Union2GraphContext::Union2GraphContext (GraphContext *parent, 
+					sparqlFrob *sparql_frob) : 
+  BindingGraphContext(parent, sparql_frob) {
+  left= (BindingGraphContext*)sparql_frob->last_context();
+  LEX *lex= thd->lex;
+
+  lex->current_select = left->current_select; // next function called with left select
+  if (mysql_new_select(lex, 0)) // sets the new lex->current_select
+    assert(0);
+  current_select= sparql_frob->lex->current_select;
+  bindings->start_constraints();
+  lex->current_select->linkage=UNION_TYPE;
+  if (sparql_frob->get_distinct()) /* UNION DISTINCT - remember position */
+    lex->current_select->master_unit()->union_distinct=
+      lex->current_select;
+}
+void Union2GraphContext::close () {
+  LEX *lex= thd->lex;
+
+  lex->pop_context();
+  SELECT_LEX *sel= lex->current_select;
+  SELECT_LEX_UNIT *unit= sel->master_unit();
+  lex->current_select= sel= unit->outer_select();
+  TABLE_LIST *t;
+  if (!(t = sel->
+	add_table_to_list(thd, new Table_ident(unit),
+			  sparql_frob->next_union_alias(), 0,
+			  TL_READ,(List<String> *)0,
+			  (List<String> *)0)))
+
+    assert(0);
+  sel->add_joined_table(t);
+  lex->pop_context();
+
+  Item *as= ((Union1GraphContext*)left)->map_variables_to_outer_context();
+  cout << "SPARQL: close Union2 {" << endl << buf->str() << "}" << endl;
+  bindings->end_and_check_constraints();
+}
+/* </Union1GraphContext> */
+
+
+Item_URI *XSD_integer= NULL;
+Item_URI *XSD_float= NULL;
+Item_URI *XSD_decimal= NULL;
+String Global_string;
+
+/* <Buf> */
+Buf::Buf(char *str) {
+  len = strlen(str);
+  data = new char[len+1];
+  strncpy(data, str, len);
+  data[len] = 0;
+}
+/* Build a space-separated concatonation of bufs. */
+Buf::Buf(int count, ...) {
+  va_list bufs;
+  const Buf *src;
+
+  // This is inefficient for a single buf as the created buf could
+  // just steal the other buf's data pointer and delete it.
+
+  // Walk args to find the total len.
+  len = -1;
+  va_start(bufs, count);
+  for (int i = 0; i < count; i++) {
+    src = va_arg(bufs, Buf*);
+    len += src->len+1;
+  }
+  va_end(bufs);
+
+  data = new char[len+1];
+
+  // Walk args to fill the data buffer.
+  len = -1;
+  va_start(bufs, count);
+  for (int i = 0; i < count; i++) {
+    src = va_arg(bufs, Buf*);
+    strncpy(data + len+1, src->data, src->len);
+    len += src->len+1;
+    data[len] = ' ';
+    delete src;
+    src = 0;
+  }
+  va_end(bufs);
+  data[len] = 0;
+}
+/* </Buf> */
+
+// $Log: mysql+sparql-server-5.0.41.patch,v $
+// Revision 1.1  2007-09-05 19:20:45  eric
+// ~ backing docs in http://www.w3.org/2005/05/22-SPARQL-MySQL/
+//
+// Revision 1.1  2006/12/16 15:35:23  eric
+// ~ test build
+//
+// Revision 1.2  2006/12/16 02:22:40  eric
+// + primary keys return the URI identifying their tuple (as they are written in queries)
+//
+// Revision 1.1  2006/12/15 14:45:17  eric
+// import from cvs://cvs.w3.org/WWW/2005/05/22-SPARQL-MySQL/
+//
+// Revision 1.35  2006/05/26 18:49:51  eric
+// progress on UNIONs
+//
+// Revision 1.34  2006/05/23 09:05:24  eric
+// UNION fleshed out, needs debugging
+//
+// Revision 1.33  2006/05/11 19:15:47  eric
+// first pass at BindingContext architecture
+//
+// Revision 1.32  2006/05/01 06:39:56  eric
+// + tollerance for foreign key ambiguity
+// ~ valgrind: free[], initialize Item_variable::jt
+//
+// Revision 1.31  2006/04/29 22:06:17  eric
+// + INTEGER
+// + DECIMAL
+// + DOUBLE (well, Item_float)
+//
+// Revision 1.30  2006/04/29 21:08:26  eric
+// - pruning
+// ~ fixed strncmp (erroneous match on substring) error and marked another
+// - YYTHD macros
+//
+// Revision 1.29  2006/04/29 16:53:27  eric
+// ~ simplified get_primary_key (complicated by previous extension tables commit)
+//
+// Revision 1.28  2006/04/29 16:45:03  eric
+// + extension tables (tables with the same primary key as another -- both are likely to be ?s)
+//
+// Revision 1.27  2006/04/23 01:34:25  eric
+// ~ OPTIONAL using nested JOINs
+//
+// Revision 1.26  2006/04/17 09:53:57  eric
+// + postpone putting variables in a context until we have the context
+//
+// Revision 1.25  2006/04/17 01:13:22  eric
+// + OPTIONAL
+//
+// Revision 1.24  2006/04/16 23:29:00  eric
+// + start on OPTIONALS
+//
+// Revision 1.23  2006/04/16 11:23:16  eric
+// + DISTINCT
+// + ORDER BY
+// + LIMIT
+// + OFFSET
+//
+// Revision 1.22  2006/04/16 08:44:03  eric
+// + labeled blank nodes
+//
+// Revision 1.21  2006/04/15 20:27:59  eric
+// + active POS casting to make exprs work
+//
+// Revision 1.20  2006/04/15 16:18:12  eric
+// - cleaned slightly
+//
+// Revision 1.19  2006/04/15 15:32:20  eric
+// + late-binding primary keys
+//
+// Revision 1.18  2006/04/13 23:52:11  eric
+// + framed out Item_primary_key_field
+// + expr on down compiling -- need to re-derive POS_string from a constant Item_ class
+//
+// Revision 1.17  2006/04/12 16:24:35  eric
+// + using sel->expr_list to collect outermost WHERE conjunction
+//
+// Revision 1.16  2006/04/12 14:48:03  eric
+// - reduced casting
+//
+// Revision 1.15  2006/04/11 13:20:02  eric
+// + parser errors => YYABORT
+//
+// Revision 1.14  2006/04/11 11:46:45  eric
+// added CVS tags
+//
+//
diff -Naur -x bnf -x compilationResults -x '*.Po' -x '*.patch' -x '*.out' -x '*~' -x '*.o' -x main -x sparql -x '*.a' -x '*.libs' -x main.cc -x Makefile -x Makefile.in -x '*.yy' -x '*.ll' mysql-dfsg-5.0-5.0.41/sparql/sparqlParser.h mysql-dfsg-5.0-5.0.41-spasql/sparql/sparqlParser.h
--- mysql-dfsg-5.0-5.0.41/sparql/sparqlParser.h	1970-01-01 01:00:00.000000000 +0100
+++ mysql-dfsg-5.0-5.0.41-spasql/sparql/sparqlParser.h	2006-12-16 16:03:05.000000000 +0100
@@ -0,0 +1,1013 @@
+#ifndef YY_sparqlParser_h_included
+#define YY_sparqlParser_h_included
+#define YY_USE_CLASS
+
+#line 1 "/usr/share/bison++/bison.h"
+/* before anything */
+#ifdef c_plusplus
+ #ifndef __cplusplus
+  #define __cplusplus
+ #endif
+#endif
+
+
+ #line 8 "/usr/share/bison++/bison.h"
+#define YY_sparqlParser_LSP_NEEDED 
+#define YY_sparqlParser_ERROR_BODY  =0
+#define YY_sparqlParser_LEX_BODY  =0
+#line 27 "sparqlParser.yy"
+
+#include <iostream>
+#include <string>
+using namespace std;
+#undef yyFlexLexer
+#define yyFlexLexer sparqlFlexLexer
+
+#ifndef FLEXFIX
+#define FLEXFIX YY_sparqlParser_STYPE *val
+#define FLEXFIX2 val
+#endif
+
+#define MYSQL_YACC
+#define YYINITDEPTH 100
+#define YYMAXDEPTH 3200				/* Because of 64K stack */
+#include "mysql_priv.h"
+#include "slave.h"
+#include "lex_symbol.h"
+#include "item_create.h"
+#include "sp_head.h"
+#include "sp_pcontext.h"
+#include "sp_rcontext.h"
+#include "sp.h"
+#include <myisam.h>
+#include <myisammrg.h>
+
+#include "sparqlFrob.h"
+#define YY_sparqlParser_PARSE_PARAM sparqlFrob *yySparqlFrob
+
+#define PLS_REPORT "Please report this bug, along with the query that triggered it."
+
+extern String Global_string; // call test->print(&Global_string); p Global_string.c_ptr(); call Global_string.free()
+
+/* DEBUGGING/DEVELOPMENT
+ *   aggregates a string representing the compiled string.
+ */
+class Buf {
+protected:
+  char* data;
+  int len;
+public:
+  Buf() {
+    len = 0;
+    data = 0;
+  }
+  Buf(char *str);
+  Buf(int count, ...);
+  ~Buf() {
+    if (data) delete[] data;
+  }
+  char *str() {return data;}
+};
+
+
+/* forward class declarations */
+class BindingContext;
+
+
+/* static function declarations */
+static const char* scan_string(THD *thd, LEX_STRING *lex_string, 
+			       const char *start, const char *end, 
+			       const char look_for);
+
+
+/* Item_POS: overload the mysql Item object for all the SPARQL parts
+ * of speach (URIs, bNodes, variables, and various forms of literal).
+ *
+ * Item overloads: bind_field
+ */
+class Item_POS
+{
+protected:
+  Item *item;
+public:
+  Item_POS (Item* item_arg) {item = item_arg;}
+  virtual ~Item_POS () {}
+  virtual void bind_field(const char *table_name, const char *alias, 
+			  const char *field_name_arg, bool trump, 
+			  THD *thd, TABLE_LIST *jt) = 0;
+  virtual bool is_URI () {return false;}
+  virtual bool is_variable () {return false;}
+  virtual bool is_blank_node () {return false;}
+  virtual bool is_string () {return false;}
+  Item* get_item () {return item;} // OK 'cause ALL Item_POS's are Items.
+};
+
+
+class Item_URI : public Item_field, public Item_POS
+{
+protected:
+  LEX_STRING table;
+  LEX_STRING field;
+  LEX_STRING value;
+
+public:
+  Item_URI(Name_resolution_context *context_arg, LEX_STRING uri, THD *thd);
+  virtual void bind_field(const char *table_name, const char *alias, 
+			  const char *field_name_arg, bool trump, 
+			  THD *thd, TABLE_LIST *jt);
+  virtual bool is_URI () {return true;}
+  LEX_STRING get_table () {return table;}
+  LEX_STRING get_field () {return field;}
+  LEX_STRING get_value () {return value;}
+  void print(String *str);
+};
+extern Item_URI *XSD_integer;
+extern Item_URI *XSD_float;
+extern Item_URI *XSD_decimal;
+
+
+/* Item_variable: represent SPARQL variable.
+ *
+ * includes the status of a variable's use in the current JOIN. A variable in
+ * a nested JOIN is different from a variable in an outer context (the
+ * UnionGraphContext::close handles the correlation (U0.foo=oldTable.oldField).
+ *
+ * Item_variable has the same virtual functions as an Item, but is never
+ * added to the SQL compile tree (for instance, in the form of a table
+ * constraint or a select item).
+ */
+class Item_variable : public Item_field, public Item_POS
+{
+private:
+  Name_resolution_context *nr_context;
+  GraphContext *gc;
+  bool bound;
+  bool primary_key;
+  TABLE_LIST *jt;
+  Item_variable *outer;
+  sparqlFrob *frob;
+  const char *real_table_name;
+  int ref_count;
+
+public:
+  Item_variable(Name_resolution_context *context_arg, 
+		const char *variable_name, Item_variable *outer_arg, 
+		sparqlFrob *frob_arg, int ref_count_arg);
+  virtual void bind_field(const char *table_name, const char *alias, 
+			  const char *field_name_arg, 
+			  bool trump, THD *thd, TABLE_LIST *jt);
+  Item* make_Item_field(Name_resolution_context *context_arg,
+			const char *db_arg, const char *table_name_arg,
+			const char *field_name_arg, 
+			const char* real_table_name);
+  const char* get_primary_key () {return frob->get_primary_key(real_table_name);}
+  virtual bool is_variable () {return true;}
+  bool same_variable (const char* variable_name) {
+    return !strcmp(orig_field_name, variable_name);
+  }
+  virtual bool fix_fields(THD *, Item **);
+  void add_ref_count (int ref_count_arg) {ref_count+= ref_count_arg;}
+  bool outer_has_no_refs () {return outer ? outer->ref_count == 0 : true;}
+  static Item_variable* 
+  match_var_in_list (List<Item_variable> *p_item_variables, const char *var);
+  Item* get_null_item();
+  virtual bool send(Protocol *protocol, String *buffer);
+  void print(String *str);
+};
+
+
+/* Item_blank_node: represent SPARQL bNode.
+ */
+class Item_blank_node : public Item_variable
+{
+public:
+  Item_blank_node (Name_resolution_context *context_arg, 
+		   const char *node_name, sparqlFrob *frob_arg) : 
+    Item_variable(context_arg, node_name, NULL, frob_arg, 0) {}
+  virtual bool is_blank_node () {return true;}
+  void print(String *str);
+};
+
+
+/* Item_literal_string: represent SPARQL xsd:string typed literal.
+ */
+class Item_literal_string : public Item_string, public Item_POS
+{
+private:
+  Item_POS *lang_or_datatype;
+public:
+  Item_literal_string (LEX_STRING string, 
+		       Item_POS *lang_or_datatype, CHARSET_INFO *charset) : 
+    Item_string(string.str, string.length, charset), Item_POS(this) {
+    this->lang_or_datatype = lang_or_datatype;
+  }
+  virtual void bind_field(const char *table_name, const char *alias, 
+			  const char *field_name_arg, bool trump, 
+			  THD *thd, TABLE_LIST *jt);
+  virtual bool is_string () {return true;}
+  Item_POS* get_language_or_datatype () {
+    return lang_or_datatype;
+  }
+  Item_URI* get_datatype () {
+    return lang_or_datatype && lang_or_datatype->is_URI() ? 
+      (Item_URI*)lang_or_datatype : NULL;
+  }
+  Item_literal_string* get_language () {
+    return lang_or_datatype && lang_or_datatype->is_string() ? 
+      (Item_literal_string*)lang_or_datatype : NULL;
+  }
+  void print(String *str);
+};
+
+
+/* Item_literal_int: represent SPARQL xsd:integer typed literal.
+ */
+class Item_literal_int : public Item_int, public Item_POS
+{
+public:
+  Item_literal_int (LEX_STRING string, 
+		   Item_POS *lang_or_datatype, CHARSET_INFO *charset) : 
+    Item_int(string.str), Item_POS(this) {}
+  virtual void bind_field(const char *table_name, const char *alias, 
+			  const char *field_name_arg, bool trump, 
+			  THD *thd, TABLE_LIST *jt);
+  virtual bool is_string () {return false;}
+  Item_URI* get_datatype () {return XSD_integer;}
+  Item_literal_string* get_language () {return NULL;}
+  void print(String *str);
+};
+
+
+/* Item_literal_decimal: represent SPARQL xsd:decimal typed literal.
+ */
+class Item_literal_decimal : public Item_decimal, public Item_POS
+{
+public:
+  Item_literal_decimal (LEX_STRING string, Item_POS *lang_or_datatype, CHARSET_INFO *charset) : 
+    Item_decimal(string.str, string.length, charset), Item_POS(this) {}
+  virtual void bind_field(const char *table_name, const char *alias, 
+			  const char *field_name_arg, bool trump, 
+			  THD *thd, TABLE_LIST *jt);
+  virtual bool is_string () {return false;}
+  Item_URI* get_datatype () {return XSD_decimal;}
+  Item_literal_string* get_language () {return NULL;}
+  void print(String *str);
+};
+
+
+/* Item_literal_float: represent SPARQL xsd:float typed literal.
+ */
+class Item_literal_float : public Item_float, public Item_POS
+{
+public:
+  Item_literal_float (LEX_STRING string, Item_POS *lang_or_datatype, CHARSET_INFO *charset) : 
+    Item_float(string.str, string.length), Item_POS(this) {}
+  virtual void bind_field(const char *table_name, const char *alias, 
+			  const char *field_name_arg, bool trump, 
+			  THD *thd, TABLE_LIST *jt);
+  virtual bool is_string () {return false;}
+  Item_URI* get_datatype () {return XSD_float;}
+  Item_literal_string* get_language() {return NULL;}
+  void print(String *str);
+};
+
+
+/* Item_primary_key_field: reference to an Item_field that is a primary key.
+ * Used to create foreign key/primary key constraints on joins.
+ */
+class Item_primary_key_field : public Item_field
+{
+protected:
+  sparqlFrob *frob;
+  const char* real_table_name;
+public:
+  Item_primary_key_field(Name_resolution_context *context_arg,
+			 const char *db_arg, const char *table_name_arg, 
+			 sparqlFrob *frob_arg, 
+			 const char* real_table_name_arg);
+  virtual bool fix_fields(THD *, Item **);
+};
+
+
+#if 0
+/* Item_func_call: not implemented
+ */
+class Item_func_call : public Item_POS
+{
+protected:
+  Item_POS* name;
+  List<Item>* args;
+public:
+  Item_func_call (Name_resolution_context *context_arg, 
+		  Item_POS* name, List<Item>* args) :
+    Item_POS(context_arg, "<Item_func_call>") {
+    this->name = name;
+    this->args = args;
+  }
+  ~Item_func_call() {}
+  void bind_field (const char *table_name, const char *alias, 
+		   const char *field_name_arg, bool trump, 
+		  T HD *thd, TABLE_LIST *jt) {}
+  bool fix_fields(THD *, Item **);
+};
+#endif
+
+
+
+
+
+/* Alias_info: aliases for a table, indexed by subject.
+ * If it's not in subjects, you need a new alias.
+ */
+class Alias_info {
+  friend class GraphContext;
+private:
+  LEX_STRING table;
+  List<Item_POS> subjects;
+public:
+  Alias_info(LEX_STRING table) {
+    this->table = table;
+  }
+  bool same_table(LEX_STRING table) {
+    return !strcmp(this->table.str, table.str);
+  }
+};
+
+
+/* BindingContext: SQL table aliases and constraints for a given
+ * SPARQL group graph pattern.
+ */
+class BindingContext {
+protected:
+  List<Item_variable> item_variables;
+  // All known table aliases for in the context.
+  List<Alias_info> aliases;
+  Name_resolution_context *name_res_context;
+  BindingContext *parent;
+  LEX *lex;
+  List<Item> *constraints;
+
+public:
+  BindingContext(GraphContext *gc_param, 
+		 BindingContext *parent_param, LEX *lex_param) {
+    parent= parent_param;
+    lex= lex_param;
+    //name_res_context= lex->current_context();
+  }
+  Item_variable* ensure_bound_item_variable(const char *name, 
+				    sparqlFrob *sparql_frob, int ref_count);
+  void select_star(THD *thd);
+  List<Item_variable>* get_item_variables () { return &item_variables; }
+  Alias_info* get_table_alias(THD *thd, Item_POS *s, Item_URI *p, Item_POS *o);
+  Item* get_bound_variable_constraints(Item *conjunction_constraints, 
+				       GraphContext *gc);
+  void start_constraints();
+  void end_and_check_constraints() {
+    assert(constraints == lex->select_lex.expr_list.pop());
+  }
+  Item* make_item_constraints() {
+    return constraints->elements ? new Item_cond_and(*constraints) : NULL;
+  }
+};
+
+
+/* GraphContext: corresponds to a SPARQL graph context.
+ */
+class GraphContext {
+protected:
+  GraphContext *parent;
+  THD *thd;
+  Buf *buf; // temporary
+
+public:
+  sparqlFrob *sparql_frob; // !!! should be protected
+  GraphContext (GraphContext *parent_param, sparqlFrob *sparql_frob_param) {
+    sparql_frob= sparql_frob_param;
+    parent= parent_param;
+    thd= sparql_frob->thd;
+    buf= NULL;
+  }
+  virtual ~GraphContext () {}
+  virtual void close () {
+    cout << "SPARQL: close {" << endl << buf->str() << "}" << endl;
+  }
+  virtual void no_right_union () {
+    cout << "SPARQL: non-UNION {" << endl << buf->str() << "}" << endl;
+  }
+  void set_Buf (Buf *buf_param) { buf= buf_param; }
+  Buf* get_Buf () { return buf; }
+  virtual bool is_optional () { return false; }
+  virtual BindingContext* get_binding_context () {
+    return parent->get_binding_context();
+  }
+  const char* get_alias_string(Alias_info *ai, Item_POS *s, THD *thd);
+};
+
+
+/* BindingGraphContext: the graph contexts that require a new BindingContext.
+ * Raison d'etre: factored common code from Union and Graph contexts.
+ */
+class BindingGraphContext : public GraphContext {
+  friend class Union2GraphContext; // why doesn't BindingGraphContext work here?
+protected:
+  BindingContext *bindings;
+  SELECT_LEX *current_select;
+  BindingGraphContext(GraphContext *parent_param, sparqlFrob *sparql_frob_param);
+public:
+  void select_var(Item_variable *var, bool exists);
+  virtual BindingContext* get_binding_context() { return bindings; }
+};
+
+
+/* RootGraphContext: the graph context just inside the WHERE.
+ */
+class RootGraphContext : public BindingGraphContext {
+public:
+  RootGraphContext(GraphContext *parent, sparqlFrob *sparql_frob);
+  virtual void close () {
+    bindings->end_and_check_constraints();
+  }
+};
+
+
+/* OptionalGraphContext: OPTIONAL {   }.
+ *                                 ^^^
+ */
+class OptionalGraphContext : public GraphContext {
+public:
+  OptionalGraphContext (GraphContext *parent, sparqlFrob *sparql_frob) : 
+    GraphContext(parent, sparql_frob) {
+    /* if (!(on_context= make_join_on_context(thd, $1, $3)))
+       assert(0);
+       thd->lex->push_context(on_context);
+    */
+  }
+  virtual void close () {
+    /* thd->lex->pop_context();
+     */
+  }
+  virtual bool is_optional () { return true; }
+};
+
+
+/* Union1GraphContext: {   } UNION {   }.
+ *                      ^^^
+ */
+class Union1GraphContext : public BindingGraphContext {
+public:
+  Union1GraphContext(GraphContext *parent, sparqlFrob *sparql_frob);
+  virtual void no_right_union () {
+    /* Just a spurious {} so copy the context up to the parent.
+       @@@ TODO
+    */
+    my_printf_error(1, "SPARQL: implementation limitation: not ready to deal with non-UNION %s. "PLS_REPORT, MYF(0), buf->str());
+  }
+  virtual void close();
+  Item* map_variables_to_outer_context () { // !!! does nothing
+    return NULL;
+  }
+};
+
+
+/* Union1GraphContext: {   } UNION {   }.
+ *                                  ^^^
+ */
+class Union2GraphContext : public BindingGraphContext {
+private:
+  BindingGraphContext *left; // left side of the UNION
+
+public:
+  Union2GraphContext(GraphContext *parent, sparqlFrob *sparql_frob);
+  virtual void close();
+};
+
+
+/* GraphGraphContext: GRAPH {   }.
+ *                           ^^^
+ */
+class GraphGraphContext : public BindingGraphContext {
+public:
+  GraphGraphContext (GraphContext *parent, sparqlFrob *sparql_frob) : 
+    BindingGraphContext(parent, sparql_frob) {}
+};
+
+
+
+#line 505 "sparqlParser.yy"
+typedef union {
+  int  num;
+  LEX_STRING lex_str;
+  Item *item;
+  List<Item> *item_list;
+  List<BindingGraphContext> *BindingGraphContext_list;
+  Item_POS *item_pos;
+  GraphContext *graph_context;
+  BindingGraphContext *binding_graph_context;
+  Buf *buf;
+} yy_sparqlParser_stype;
+#define YY_sparqlParser_STYPE yy_sparqlParser_stype
+
+#line 21 "/usr/share/bison++/bison.h"
+ /* %{ and %header{ and %union, during decl */
+#ifndef YY_sparqlParser_COMPATIBILITY
+ #ifndef YY_USE_CLASS
+  #define  YY_sparqlParser_COMPATIBILITY 1
+ #else
+  #define  YY_sparqlParser_COMPATIBILITY 0
+ #endif
+#endif
+
+#if YY_sparqlParser_COMPATIBILITY != 0
+/* backward compatibility */
+ #ifdef YYLTYPE
+  #ifndef YY_sparqlParser_LTYPE
+   #define YY_sparqlParser_LTYPE YYLTYPE
+/* WARNING obsolete !!! user defined YYLTYPE not reported into generated header */
+/* use %define LTYPE */
+  #endif
+ #endif
+/*#ifdef YYSTYPE*/
+  #ifndef YY_sparqlParser_STYPE
+   #define YY_sparqlParser_STYPE YYSTYPE
+  /* WARNING obsolete !!! user defined YYSTYPE not reported into generated header */
+   /* use %define STYPE */
+  #endif
+/*#endif*/
+ #ifdef YYDEBUG
+  #ifndef YY_sparqlParser_DEBUG
+   #define  YY_sparqlParser_DEBUG YYDEBUG
+   /* WARNING obsolete !!! user defined YYDEBUG not reported into generated header */
+   /* use %define DEBUG */
+  #endif
+ #endif 
+ /* use goto to be compatible */
+ #ifndef YY_sparqlParser_USE_GOTO
+  #define YY_sparqlParser_USE_GOTO 1
+ #endif
+#endif
+
+/* use no goto to be clean in C++ */
+#ifndef YY_sparqlParser_USE_GOTO
+ #define YY_sparqlParser_USE_GOTO 0
+#endif
+
+#ifndef YY_sparqlParser_PURE
+
+ #line 65 "/usr/share/bison++/bison.h"
+
+#line 65 "/usr/share/bison++/bison.h"
+/* YY_sparqlParser_PURE */
+#endif
+
+
+ #line 68 "/usr/share/bison++/bison.h"
+#define YY_sparqlParser_PARSE sparqlparse
+#define YY_sparqlParser_LEX sparqllex
+#define YY_sparqlParser_ERROR sparqlerror
+#define YY_sparqlParser_LVAL sparqllval
+#define YY_sparqlParser_CHAR sparqlchar
+#define YY_sparqlParser_DEBUG sparqldebug
+
+#line 68 "/usr/share/bison++/bison.h"
+/* prefix */
+
+#ifndef YY_sparqlParser_DEBUG
+
+ #line 71 "/usr/share/bison++/bison.h"
+
+#line 71 "/usr/share/bison++/bison.h"
+/* YY_sparqlParser_DEBUG */
+#endif
+
+#ifndef YY_sparqlParser_LSP_NEEDED
+
+ #line 75 "/usr/share/bison++/bison.h"
+
+#line 75 "/usr/share/bison++/bison.h"
+ /* YY_sparqlParser_LSP_NEEDED*/
+#endif
+
+/* DEFAULT LTYPE*/
+#ifdef YY_sparqlParser_LSP_NEEDED
+ #ifndef YY_sparqlParser_LTYPE
+  #ifndef BISON_YYLTYPE_ISDECLARED
+   #define BISON_YYLTYPE_ISDECLARED
+typedef
+  struct yyltype
+    {
+      int timestamp;
+      int first_line;
+      int first_column;
+      int last_line;
+      int last_column;
+      char *text;
+   }
+  yyltype;
+  #endif
+
+  #define YY_sparqlParser_LTYPE yyltype
+ #endif
+#endif
+
+/* DEFAULT STYPE*/
+#ifndef YY_sparqlParser_STYPE
+ #define YY_sparqlParser_STYPE int
+#endif
+
+/* DEFAULT MISCELANEOUS */
+#ifndef YY_sparqlParser_PARSE
+ #define YY_sparqlParser_PARSE yyparse
+#endif
+
+#ifndef YY_sparqlParser_LEX
+ #define YY_sparqlParser_LEX yylex
+#endif
+
+#ifndef YY_sparqlParser_LVAL
+ #define YY_sparqlParser_LVAL yylval
+#endif
+
+#ifndef YY_sparqlParser_LLOC
+ #define YY_sparqlParser_LLOC yylloc
+#endif
+
+#ifndef YY_sparqlParser_CHAR
+ #define YY_sparqlParser_CHAR yychar
+#endif
+
+#ifndef YY_sparqlParser_NERRS
+ #define YY_sparqlParser_NERRS yynerrs
+#endif
+
+#ifndef YY_sparqlParser_DEBUG_FLAG
+ #define YY_sparqlParser_DEBUG_FLAG yydebug
+#endif
+
+#ifndef YY_sparqlParser_ERROR
+ #define YY_sparqlParser_ERROR yyerror
+#endif
+
+#ifndef YY_sparqlParser_PARSE_PARAM
+ #ifndef __STDC__
+  #ifndef __cplusplus
+   #ifndef YY_USE_CLASS
+    #define YY_sparqlParser_PARSE_PARAM
+    #ifndef YY_sparqlParser_PARSE_PARAM_DEF
+     #define YY_sparqlParser_PARSE_PARAM_DEF
+    #endif
+   #endif
+  #endif
+ #endif
+ #ifndef YY_sparqlParser_PARSE_PARAM
+  #define YY_sparqlParser_PARSE_PARAM void
+ #endif
+#endif
+
+/* TOKEN C */
+#ifndef YY_USE_CLASS
+
+ #ifndef YY_sparqlParser_PURE
+  #ifndef yylval
+   extern YY_sparqlParser_STYPE YY_sparqlParser_LVAL;
+  #else
+   #if yylval != YY_sparqlParser_LVAL
+    extern YY_sparqlParser_STYPE YY_sparqlParser_LVAL;
+   #else
+    #warning "Namespace conflict, disabling some functionality (bison++ only)"
+   #endif
+  #endif
+ #endif
+
+
+ #line 169 "/usr/share/bison++/bison.h"
+#define	IT_BASE	258
+#define	IT_PREFIX	259
+#define	IT_SELECT	260
+#define	IT_DISTINCT	261
+#define	GT_TIMES	262
+#define	IT_CONSTRUCT	263
+#define	IT_DESCRIBE	264
+#define	IT_ASK	265
+#define	IT_FROM	266
+#define	IT_NAMED	267
+#define	IT_WHERE	268
+#define	IT_ORDER	269
+#define	IT_BY	270
+#define	IT_ASC	271
+#define	IT_DESC	272
+#define	IT_LIMIT	273
+#define	IT_OFFSET	274
+#define	GT_LCURLEY	275
+#define	GT_RCURLEY	276
+#define	GT_DOT	277
+#define	IT_OPTIONAL	278
+#define	IT_GRAPH	279
+#define	IT_UNION	280
+#define	IT_FILTER	281
+#define	GT_COMMA	282
+#define	GT_LPAREN	283
+#define	GT_RPAREN	284
+#define	GT_SEMI	285
+#define	IT_a	286
+#define	GT_LBRACKET	287
+#define	GT_RBRACKET	288
+#define	GT_MINUS	289
+#define	GT_PLUS	290
+#define	GT_OR	291
+#define	GT_AND	292
+#define	GT_EQUAL	293
+#define	GT_NEQUAL	294
+#define	GT_LT	295
+#define	GT_GT	296
+#define	GT_LE	297
+#define	GT_GE	298
+#define	GT_DIVIDE	299
+#define	GT_NOT	300
+#define	IT_STR	301
+#define	IT_LANG	302
+#define	IT_LANGMATCHES	303
+#define	IT_DATATYPE	304
+#define	IT_BOUND	305
+#define	IT_isIRI	306
+#define	IT_isURI	307
+#define	IT_isBLANK	308
+#define	IT_isLITERAL	309
+#define	IT_REGEX	310
+#define	GT_DTYPE	311
+#define	IT_true	312
+#define	IT_false	313
+#define	Q_IRI_REF	314
+#define	QNAME_NS	315
+#define	QNAME	316
+#define	BLANK_NODE_LABEL	317
+#define	VAR1	318
+#define	VAR2	319
+#define	LANGTAG	320
+#define	INTEGER	321
+#define	DECIMAL	322
+#define	DOUBLE	323
+#define	STRING_LITERAL1	324
+#define	STRING_LITERAL2	325
+#define	STRING_LITERAL_LONG1	326
+#define	STRING_LITERAL_LONG2	327
+#define	NIL	328
+#define	ANON	329
+
+
+#line 169 "/usr/share/bison++/bison.h"
+ /* #defines token */
+/* after #define tokens, before const tokens S5*/
+#else
+ #ifndef YY_sparqlParser_CLASS
+  #define YY_sparqlParser_CLASS sparqlParser
+ #endif
+
+ #ifndef YY_sparqlParser_INHERIT
+  #define YY_sparqlParser_INHERIT
+ #endif
+
+ #ifndef YY_sparqlParser_MEMBERS
+  #define YY_sparqlParser_MEMBERS 
+ #endif
+
+ #ifndef YY_sparqlParser_LEX_BODY
+  #define YY_sparqlParser_LEX_BODY  
+ #endif
+
+ #ifndef YY_sparqlParser_ERROR_BODY
+  #define YY_sparqlParser_ERROR_BODY  
+ #endif
+
+ #ifndef YY_sparqlParser_CONSTRUCTOR_PARAM
+  #define YY_sparqlParser_CONSTRUCTOR_PARAM
+ #endif
+ /* choose between enum and const */
+ #ifndef YY_sparqlParser_USE_CONST_TOKEN
+  #define YY_sparqlParser_USE_CONST_TOKEN 0
+  /* yes enum is more compatible with flex,  */
+  /* so by default we use it */ 
+ #endif
+ #if YY_sparqlParser_USE_CONST_TOKEN != 0
+  #ifndef YY_sparqlParser_ENUM_TOKEN
+   #define YY_sparqlParser_ENUM_TOKEN yy_sparqlParser_enum_token
+  #endif
+ #endif
+
+class YY_sparqlParser_CLASS YY_sparqlParser_INHERIT
+{
+public: 
+ #if YY_sparqlParser_USE_CONST_TOKEN != 0
+  /* static const int token ... */
+  
+ #line 212 "/usr/share/bison++/bison.h"
+static const int IT_BASE;
+static const int IT_PREFIX;
+static const int IT_SELECT;
+static const int IT_DISTINCT;
+static const int GT_TIMES;
+static const int IT_CONSTRUCT;
+static const int IT_DESCRIBE;
+static const int IT_ASK;
+static const int IT_FROM;
+static const int IT_NAMED;
+static const int IT_WHERE;
+static const int IT_ORDER;
+static const int IT_BY;
+static const int IT_ASC;
+static const int IT_DESC;
+static const int IT_LIMIT;
+static const int IT_OFFSET;
+static const int GT_LCURLEY;
+static const int GT_RCURLEY;
+static const int GT_DOT;
+static const int IT_OPTIONAL;
+static const int IT_GRAPH;
+static const int IT_UNION;
+static const int IT_FILTER;
+static const int GT_COMMA;
+static const int GT_LPAREN;
+static const int GT_RPAREN;
+static const int GT_SEMI;
+static const int IT_a;
+static const int GT_LBRACKET;
+static const int GT_RBRACKET;
+static const int GT_MINUS;
+static const int GT_PLUS;
+static const int GT_OR;
+static const int GT_AND;
+static const int GT_EQUAL;
+static const int GT_NEQUAL;
+static const int GT_LT;
+static const int GT_GT;
+static const int GT_LE;
+static const int GT_GE;
+static const int GT_DIVIDE;
+static const int GT_NOT;
+static const int IT_STR;
+static const int IT_LANG;
+static const int IT_LANGMATCHES;
+static const int IT_DATATYPE;
+static const int IT_BOUND;
+static const int IT_isIRI;
+static const int IT_isURI;
+static const int IT_isBLANK;
+static const int IT_isLITERAL;
+static const int IT_REGEX;
+static const int GT_DTYPE;
+static const int IT_true;
+static const int IT_false;
+static const int Q_IRI_REF;
+static const int QNAME_NS;
+static const int QNAME;
+static const int BLANK_NODE_LABEL;
+static const int VAR1;
+static const int VAR2;
+static const int LANGTAG;
+static const int INTEGER;
+static const int DECIMAL;
+static const int DOUBLE;
+static const int STRING_LITERAL1;
+static const int STRING_LITERAL2;
+static const int STRING_LITERAL_LONG1;
+static const int STRING_LITERAL_LONG2;
+static const int NIL;
+static const int ANON;
+
+
+#line 212 "/usr/share/bison++/bison.h"
+ /* decl const */
+ #else
+  enum YY_sparqlParser_ENUM_TOKEN { YY_sparqlParser_NULL_TOKEN=0
+  
+ #line 215 "/usr/share/bison++/bison.h"
+	,IT_BASE=258
+	,IT_PREFIX=259
+	,IT_SELECT=260
+	,IT_DISTINCT=261
+	,GT_TIMES=262
+	,IT_CONSTRUCT=263
+	,IT_DESCRIBE=264
+	,IT_ASK=265
+	,IT_FROM=266
+	,IT_NAMED=267
+	,IT_WHERE=268
+	,IT_ORDER=269
+	,IT_BY=270
+	,IT_ASC=271
+	,IT_DESC=272
+	,IT_LIMIT=273
+	,IT_OFFSET=274
+	,GT_LCURLEY=275
+	,GT_RCURLEY=276
+	,GT_DOT=277
+	,IT_OPTIONAL=278
+	,IT_GRAPH=279
+	,IT_UNION=280
+	,IT_FILTER=281
+	,GT_COMMA=282
+	,GT_LPAREN=283
+	,GT_RPAREN=284
+	,GT_SEMI=285
+	,IT_a=286
+	,GT_LBRACKET=287
+	,GT_RBRACKET=288
+	,GT_MINUS=289
+	,GT_PLUS=290
+	,GT_OR=291
+	,GT_AND=292
+	,GT_EQUAL=293
+	,GT_NEQUAL=294
+	,GT_LT=295
+	,GT_GT=296
+	,GT_LE=297
+	,GT_GE=298
+	,GT_DIVIDE=299
+	,GT_NOT=300
+	,IT_STR=301
+	,IT_LANG=302
+	,IT_LANGMATCHES=303
+	,IT_DATATYPE=304
+	,IT_BOUND=305
+	,IT_isIRI=306
+	,IT_isURI=307
+	,IT_isBLANK=308
+	,IT_isLITERAL=309
+	,IT_REGEX=310
+	,GT_DTYPE=311
+	,IT_true=312
+	,IT_false=313
+	,Q_IRI_REF=314
+	,QNAME_NS=315
+	,QNAME=316
+	,BLANK_NODE_LABEL=317
+	,VAR1=318
+	,VAR2=319
+	,LANGTAG=320
+	,INTEGER=321
+	,DECIMAL=322
+	,DOUBLE=323
+	,STRING_LITERAL1=324
+	,STRING_LITERAL2=325
+	,STRING_LITERAL_LONG1=326
+	,STRING_LITERAL_LONG2=327
+	,NIL=328
+	,ANON=329
+
+
+#line 215 "/usr/share/bison++/bison.h"
+ /* enum token */
+     }; /* end of enum declaration */
+ #endif
+public:
+ int YY_sparqlParser_PARSE(YY_sparqlParser_PARSE_PARAM);
+ virtual void YY_sparqlParser_ERROR(char *msg) YY_sparqlParser_ERROR_BODY;
+ #ifdef YY_sparqlParser_PURE
+  #ifdef YY_sparqlParser_LSP_NEEDED
+   virtual int  YY_sparqlParser_LEX(YY_sparqlParser_STYPE *YY_sparqlParser_LVAL,YY_sparqlParser_LTYPE *YY_sparqlParser_LLOC) YY_sparqlParser_LEX_BODY;
+  #else
+   virtual int  YY_sparqlParser_LEX(YY_sparqlParser_STYPE *YY_sparqlParser_LVAL) YY_sparqlParser_LEX_BODY;
+  #endif
+ #else
+  virtual int YY_sparqlParser_LEX() YY_sparqlParser_LEX_BODY;
+  YY_sparqlParser_STYPE YY_sparqlParser_LVAL;
+  #ifdef YY_sparqlParser_LSP_NEEDED
+   YY_sparqlParser_LTYPE YY_sparqlParser_LLOC;
+  #endif
+  int YY_sparqlParser_NERRS;
+  int YY_sparqlParser_CHAR;
+ #endif
+ #if YY_sparqlParser_DEBUG != 0
+  public:
+   int YY_sparqlParser_DEBUG_FLAG;	/*  nonzero means print parse trace	*/
+ #endif
+public:
+ YY_sparqlParser_CLASS(YY_sparqlParser_CONSTRUCTOR_PARAM);
+ virtual ~YY_sparqlParser_CLASS() {;}
+public:
+ YY_sparqlParser_MEMBERS 
+};
+/* other declare folow */
+#endif
+
+
+#if YY_sparqlParser_COMPATIBILITY != 0
+ /* backward compatibility */
+ /* Removed due to bison problems
+ /#ifndef YYSTYPE
+ / #define YYSTYPE YY_sparqlParser_STYPE
+ /#endif*/
+
+ #ifndef YYLTYPE
+  #define YYLTYPE YY_sparqlParser_LTYPE
+ #endif
+ #ifndef YYDEBUG
+  #ifdef YY_sparqlParser_DEBUG 
+   #define YYDEBUG YY_sparqlParser_DEBUG
+  #endif
+ #endif
+
+#endif
+/* END */
+
+ #line 267 "/usr/share/bison++/bison.h"
+#endif
diff -Naur -x bnf -x compilationResults -x '*.Po' -x '*.patch' -x '*.out' -x '*~' -x '*.o' -x main -x sparql -x '*.a' -x '*.libs' -x main.cc -x Makefile -x Makefile.in -x '*.yy' -x '*.ll' mysql-dfsg-5.0-5.0.41/sparql/sparqlScanner.cc mysql-dfsg-5.0-5.0.41-spasql/sparql/sparqlScanner.cc
--- mysql-dfsg-5.0-5.0.41/sparql/sparqlScanner.cc	1970-01-01 01:00:00.000000000 +0100
+++ mysql-dfsg-5.0-5.0.41-spasql/sparql/sparqlScanner.cc	2006-12-14 14:54:27.000000000 +0100
@@ -0,0 +1,4096 @@
+#line 2 "sparqlScanner.cc"
+/* A lexical scanner generated by flex */
+
+/* Scanner skeleton version:
+ * $Header: /sources/public/2006/spasql/mysql5/mysql+sparql-server-5.0.41.patch,v 1.1 2007-09-05 19:20:45 eric Exp $
+ */
+
+#define FLEX_SCANNER
+#define YY_FLEX_MAJOR_VERSION 2
+#define YY_FLEX_MINOR_VERSION 5
+
+
+/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
+#ifdef c_plusplus
+#ifndef __cplusplus
+#define __cplusplus
+#endif
+#endif
+
+
+#ifdef __cplusplus
+
+#include <stdlib.h>
+#include <fstream>
+using std::istream;
+using std::ostream;
+#ifndef _WIN32
+#include <unistd.h>
+#endif
+
+/* Use prototypes in function declarations. */
+#define YY_USE_PROTOS
+
+/* The "const" storage-class-modifier is valid. */
+#define YY_USE_CONST
+
+#else	/* ! __cplusplus */
+
+#if __STDC__
+
+#define YY_USE_PROTOS
+#define YY_USE_CONST
+
+#endif	/* __STDC__ */
+#endif	/* ! __cplusplus */
+
+#ifdef __TURBOC__
+ #pragma warn -rch
+ #pragma warn -use
+#include <io.h>
+#include <stdlib.h>
+#define YY_USE_CONST
+#define YY_USE_PROTOS
+#endif
+
+#ifdef YY_USE_CONST
+#define yyconst const
+#else
+#define yyconst
+#endif
+
+
+#ifdef YY_USE_PROTOS
+#define YY_PROTO(proto) proto
+#else
+#define YY_PROTO(proto) ()
+#endif
+
+
+/* Returned upon end-of-file. */
+#define YY_NULL 0
+
+/* Promotes a possibly negative, possibly signed char to an unsigned
+ * integer for use as an array index.  If the signed char is negative,
+ * we want to instead treat it as an 8-bit unsigned char, hence the
+ * double cast.
+ */
+#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
+
+/* Enter a start condition.  This macro really ought to take a parameter,
+ * but we do it the disgusting crufty way forced on us by the ()-less
+ * definition of BEGIN.
+ */
+#define BEGIN yy_start = 1 + 2 *
+
+/* Translate the current start state into a value that can be later handed
+ * to BEGIN to return to the state.  The YYSTATE alias is for lex
+ * compatibility.
+ */
+#define YY_START ((yy_start - 1) / 2)
+#define YYSTATE YY_START
+
+/* Action number for EOF rule of a given start state. */
+#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
+
+/* Special action meaning "start processing a new file". */
+#define YY_NEW_FILE yyrestart( yyin )
+
+#define YY_END_OF_BUFFER_CHAR 0
+
+/* Size of default input buffer. */
+#define YY_BUF_SIZE 16384
+
+typedef struct yy_buffer_state *YY_BUFFER_STATE;
+
+extern int yyleng;
+
+#define EOB_ACT_CONTINUE_SCAN 0
+#define EOB_ACT_END_OF_FILE 1
+#define EOB_ACT_LAST_MATCH 2
+
+/* The funky do-while in the following #define is used to turn the definition
+ * int a single C statement (which needs a semi-colon terminator).  This
+ * avoids problems with code like:
+ *
+ * 	if ( condition_holds )
+ *		yyless( 5 );
+ *	else
+ *		do_something_else();
+ *
+ * Prior to using the do-while the compiler would get upset at the
+ * "else" because it interpreted the "if" statement as being all
+ * done when it reached the ';' after the yyless() call.
+ */
+
+/* Return all but the first 'n' matched characters back to the input stream. */
+
+#define yyless(n) \
+	do \
+		{ \
+		/* Undo effects of setting up yytext. */ \
+		*yy_cp = yy_hold_char; \
+		YY_RESTORE_YY_MORE_OFFSET \
+		yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
+		YY_DO_BEFORE_ACTION; /* set up yytext again */ \
+		} \
+	while ( 0 )
+
+#define unput(c) yyunput( c, yytext_ptr )
+
+/* The following is because we cannot portably get our hands on size_t
+ * (without autoconf's help, which isn't available because we want
+ * flex-generated scanners to compile on their own).
+ */
+typedef unsigned int yy_size_t;
+
+
+struct yy_buffer_state
+	{
+	istream* yy_input_file;
+
+	char *yy_ch_buf;		/* input buffer */
+	char *yy_buf_pos;		/* current position in input buffer */
+
+	/* Size of input buffer in bytes, not including room for EOB
+	 * characters.
+	 */
+	yy_size_t yy_buf_size;
+
+	/* Number of characters read into yy_ch_buf, not including EOB
+	 * characters.
+	 */
+	int yy_n_chars;
+
+	/* Whether we "own" the buffer - i.e., we know we created it,
+	 * and can realloc() it to grow it, and should free() it to
+	 * delete it.
+	 */
+	int yy_is_our_buffer;
+
+	/* Whether this is an "interactive" input source; if so, and
+	 * if we're using stdio for input, then we want to use getc()
+	 * instead of fread(), to make sure we stop fetching input after
+	 * each newline.
+	 */
+	int yy_is_interactive;
+
+	/* Whether we're considered to be at the beginning of a line.
+	 * If so, '^' rules will be active on the next match, otherwise
+	 * not.
+	 */
+	int yy_at_bol;
+
+	/* Whether to try to fill the input buffer when we reach the
+	 * end of it.
+	 */
+	int yy_fill_buffer;
+
+	int yy_buffer_status;
+#define YY_BUFFER_NEW 0
+#define YY_BUFFER_NORMAL 1
+	/* When an EOF's been seen but there's still some text to process
+	 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
+	 * shouldn't try reading from the input source any more.  We might
+	 * still have a bunch of tokens to match, though, because of
+	 * possible backing-up.
+	 *
+	 * When we actually see the EOF, we change the status to "new"
+	 * (via yyrestart()), so that the user can continue scanning by
+	 * just pointing yyin at a new input file.
+	 */
+#define YY_BUFFER_EOF_PENDING 2
+	};
+
+
+/* We provide macros for accessing buffer states in case in the
+ * future we want to put the buffer states in a more general
+ * "scanner state".
+ */
+#define YY_CURRENT_BUFFER yy_current_buffer
+
+
+
+static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
+static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
+static void yy_flex_free YY_PROTO(( void * ));
+
+#define yy_new_buffer yy_create_buffer
+
+#define yy_set_interactive(is_interactive) \
+	{ \
+	if ( ! yy_current_buffer ) \
+		yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
+	yy_current_buffer->yy_is_interactive = is_interactive; \
+	}
+
+#define yy_set_bol(at_bol) \
+	{ \
+	if ( ! yy_current_buffer ) \
+		yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
+	yy_current_buffer->yy_at_bol = at_bol; \
+	}
+
+#define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
+
+typedef unsigned char YY_CHAR;
+#define yytext_ptr yytext
+#define YY_INTERACTIVE
+
+#include <FlexLexer.h>
+
+
+/* Done after the current pattern has been matched and before the
+ * corresponding action - sets up yytext.
+ */
+#define YY_DO_BEFORE_ACTION \
+	yytext_ptr = yy_bp; \
+	yyleng = (int) (yy_cp - yy_bp); \
+	yy_hold_char = *yy_cp; \
+	*yy_cp = '\0'; \
+	yy_c_buf_p = yy_cp;
+
+#define YY_NUM_RULES 74
+#define YY_END_OF_BUFFER 75
+static yyconst short int yy_accept[1055] =
+    {   0,
+        0,    0,   75,   74,    1,   44,   74,   74,   74,   74,
+       27,   28,    6,   34,   26,   33,   21,   43,   65,   59,
+       29,   39,   37,   40,   74,   74,   74,   74,   74,   74,
+       74,   74,   74,   74,   74,   74,   74,   74,   74,   74,
+       74,   31,   74,   32,   74,   74,   30,   74,   74,   74,
+       19,   74,   20,   74,   74,   74,   74,   74,   74,   74,
+       74,   74,   74,   74,   74,   74,   74,   74,   74,   74,
+       74,   74,    1,   38,    0,   69,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,   63,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+
+        0,    0,    0,    0,    0,    0,    0,    0,   36,    0,
+       68,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,   72,   66,   66,   65,    0,   60,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+       41,   58,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,   42,   62,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,   64,    0,    0,   59,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,   14,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,   73,    0,    0,   55,    0,
+        0,    0,    0,   35,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,   69,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,   63,   63,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+
+        0,    0,    0,    0,   63,   63,   63,   63,   63,   63,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,   68,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,   66,    0,
+        0,   67,   60,    0,   60,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,   60,
+       60,   60,   60,   60,   60,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,   62,   62,    0,
+
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,   62,   62,   62,   62,   62,   62,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,   15,    9,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,   45,    0,    0,    0,    0,
+       61,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,   63,   63,   63,   63,   63,
+       63,   63,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,   63,   63,   63,
+       63,   63,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,   67,    0,   67,    0,    0,   60,
+
+       60,   60,   60,   60,   60,   60,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,   60,   60,   60,   60,   60,    0,    0,    0,    0,
+        0,    0,    0,    0,   62,   62,   62,   62,   62,   62,
+       62,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,   62,   62,   62,   62,
+       62,    0,    0,   64,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    2,    0,    0,    0,   16,    0,    0,
+       10,    0,   46,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,   61,    0,   61,    0,    0,
+
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,   61,   61,   61,   61,   61,   61,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,   56,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,   63,   63,   63,   63,   63,
+        0,    0,    0,    0,   63,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,   60,   60,   60,   60,   60,    0,    0,    0,
+
+        0,   60,    0,    0,   62,   62,   62,   62,   62,    0,
+        0,    0,    0,   62,    0,    0,    0,   49,    0,    0,
+        0,    0,    0,   23,    0,   17,   11,    0,    0,   13,
+        0,   54,    0,   24,   12,    0,    0,    0,    0,   61,
+       61,   61,   61,   61,   61,   61,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,   61,   61,   61,   61,   61,    0,    0,   57,    0,
+       50,    0,   51,   71,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,   63,    0,    0,   70,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,   60,    0,
+
+        0,    0,    0,   62,    0,    0,    0,    0,    0,    0,
+        0,    0,   25,    0,   18,    0,    3,    4,    0,    0,
+        0,    0,   61,   61,   61,   61,   61,    0,    0,    0,
+        0,   61,    0,    0,    0,    0,    0,    0,    0,    0,
+       63,    0,    0,    0,    0,    0,    0,   60,    0,    0,
+        0,   62,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,   61,    0,    0,   52,    0,    0,    0,
+        0,    0,   63,    0,    0,    0,    0,    0,   60,    0,
+        0,   62,    0,    0,    0,   48,    8,    5,    0,   22,
+        0,    0,    0,    0,   61,    0,    0,    0,    0,    0,
+
+        0,    0,    0,    0,    0,    0,    0,    7,    0,    0,
+        0,   61,    0,   53,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,   63,    0,    0,    0,   60,    0,   62,    0,
+       47,    0,    0,    0,   63,    0,   60,   62,    0,   61,
+        0,    0,   61,    0
+    } ;
+
+static yyconst int yy_ec[256] =
+    {   0,
+        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
+        1,    1,    4,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    5,    6,    7,    8,    9,    8,   10,   11,   12,
+       13,   14,   15,   16,   17,   18,   19,   20,   20,   20,
+       20,   20,   20,   20,   20,   20,   20,   21,   22,   23,
+       24,   25,   26,   27,   28,   29,   30,   31,   32,   33,
+       34,   35,   36,   37,   38,   39,   40,   41,   42,   43,
+       37,   44,   45,   46,   47,   37,   48,   49,   50,   37,
+       51,   52,   53,   54,   55,    1,   56,   57,   58,   58,
+
+       59,   60,   61,   61,   62,   61,   61,   63,   61,   64,
+       61,   61,   61,   65,   66,   67,   68,   61,   61,   61,
+       61,   61,   69,   70,   71,    8,    8,   72,   73,   74,
+       74,   74,   74,   75,   76,   76,   76,   76,   76,   77,
+       77,   76,   78,   79,   79,   79,   79,   79,   79,   79,
+       80,   81,   81,   81,   81,   81,   81,   81,   81,   82,
+       82,   82,   82,   83,   83,   83,   83,   83,   83,   83,
+       83,   83,   83,   83,   83,   84,   84,   84,   84,   84,
+       84,   84,   85,   86,   86,   86,   86,   86,   86,   87,
+       88,   89,   89,   90,   91,   92,   92,   92,   92,   92,
+
+       92,   92,   92,   93,   94,   95,   95,   95,   95,   95,
+       95,   95,   95,   95,   95,   95,   95,   95,   95,   95,
+       95,   95,   95,   96,   97,   98,   99,  100,  100,  100,
+      100,  100,  100,  100,  100,  100,  101,  102,  103,  104,
+      105,  105,  105,  106,   89,   89,   89,   89,   89,   89,
+       89,   89,   89,   89,   89
+    } ;
+
+static yyconst int yy_meta[107] =
+    {   0,
+        1,    1,    2,    2,    1,    3,    3,    3,    3,    3,
+        1,    3,    3,    3,    3,    3,    4,    3,    3,    5,
+        3,    3,    1,    3,    3,    3,    3,    6,    6,    6,
+        6,    6,    6,    6,    6,    6,    6,    6,    6,    6,
+        6,    6,    6,    6,    6,    6,    6,    6,    6,    6,
+        3,    3,    3,    1,    3,    6,    6,    6,    6,    6,
+        6,    6,    6,    6,    6,    6,    6,    6,    1,    1,
+        1,    7,    7,    7,    7,    7,    7,    8,    7,    7,
+        7,    7,    7,    7,    7,    7,    9,   10,   11,    3,
+        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
+
+        3,    3,    3,    3,    3,    3
+    } ;
+
+static yyconst short int yy_base[1345] =
+    {   0,
+        0,    0, 2102, 8482,  105, 2064,  104,  191, 2069,  286,
+      110, 8482, 8482, 8482, 8482, 8482, 2058, 8482,   98,  365,
+     8482,  447, 8482, 2053,  534,    0,  623,   89,   77,   92,
+     2026,   91,   81,   93,  104,  100,   96,  110,  114,  106,
+      113,  159,  103, 8482, 2016, 2048, 2018,  109,  107,  121,
+     8482, 1987, 8482,    0,    0,  102,  226,    0,  103,  233,
+        0,   84,    0,  240,    0,  257, 1971,    0,  273,  100,
+      394,    0,  211, 8482,  722, 2035,  447,    0,    0,    0,
+      249,    0,  411,    0,  651,    0,  283,  809,  195,    0,
+        0,  293,  444,    0,  442,  668,    0,  412,    0,  473,
+
+        0,  685, 1968,    0,  687,  177,  696,    0, 8482,  904,
+     2018,  910,    0,    0,    0,  703,    0,  850,    0,  853,
+        0,  573,  790, 8482,  473,  776,  926,  486,  994,  271,
+        0,    0,  875,  943,    0,  746, 1028,    0,  713,    0,
+     1035,    0, 1052, 1956,    0, 1054,  278, 1061,    0, 1125,
+     1207, 8482,    0,    0,    0, 1069,    0, 1086,    0, 1089,
+        0,  914, 8482, 1294,  369,    0,    0, 1106, 1113,    0,
+     1108, 1161,    0,  721,    0, 1122,    0, 1178, 1955,    0,
+     1180,  351, 1187,    0, 1996, 1383, 1988, 1461,    0,  472,
+      466, 1920,    0, 1204,    0, 1214,    0, 1113, 1906, 1495,
+
+        0,  875,    0, 1233,    0, 1512, 1918,    0, 1514,  520,
+     1521,    0, 1944, 1927,    0, 1932, 1925, 1902, 1901, 1883,
+     1878, 1891, 1869, 1869, 1868, 1869, 1850, 1863, 1850, 1834,
+     1783, 1776, 1783, 1782, 1608, 8482, 1594, 1600, 8482, 1634,
+     1750,  937, 1744, 8482,    0,    0,    0,    0,    0,    0,
+        0,    0,    0, 1707, 1321,    0,    0, 1705,    0,    0,
+        0, 1531,    0,    0, 8482, 1733, 1833, 1716, 1722,    0,
+     1718,    0,    0,    0,    0,    0,    0,    0, 1920,    0,
+      538, 1698,    0, 1562,    0, 1569,    0, 1672, 1684, 1714,
+        0,  895,    0, 1679,    0, 1731, 1696,    0, 1769,  609,
+
+     1772,    0, 1841, 1847,    0,    0,    0,    0,    0,    0,
+        0,    0, 1666, 1721,    0,    0, 1669,    0,    0,    0,
+     1778,    0,    0, 8482, 2015, 2111, 2002, 2016,    0, 1674,
+        0,    0,    0,    0,    0,    0,    0,  516, 1182, 1866,
+     1704, 1703, 2201,    0,    0,  627, 1634,    0, 1815,    0,
+     1840,    0, 1857, 1620, 2008,    0, 1953,    0, 1968,    0,
+     2051, 1632,    0, 2053,  795, 2060,    0, 2136, 2283,    0,
+        0,    0,    0,    0,    0,    0,    0, 1626, 2013,    0,
+        0, 1616,    0,    0,    0, 2065,    0,    0,    0, 1634,
+        0,    0,    0,    0,    0,    0,    0, 2324,    0,  813,
+
+     1613,    0, 2098,    0, 2105,    0, 2073, 1570, 2245,    0,
+     1980,    0, 2140,    0, 2262, 1577,    0, 2358,  835, 2361,
+        0, 2430, 2436,    0,    0,    0,    0,    0,    0,    0,
+        0, 1571, 2100,    0,    0, 1549,    0,    0,    0, 2367,
+        0,    0,    0, 2480,    0, 2562, 2568,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,  866, 2386,    0,    0,
+     1508,    0,    0,    0, 2391,    0,    0, 1543, 1522, 1509,
+     1523, 1520, 1487, 1486, 1491, 1487, 1481, 1478, 1480, 1440,
+     1440, 1440, 1422, 1422, 1421,    0, 1410, 1393, 2582, 2603,
+     2647,  925,    0,    0, 2531, 2571,    0, 2396, 2681,    0,
+
+     2418,    0, 2568,    0, 2585, 1364,    0, 2698,  980, 2701,
+        0, 1368, 1371, 1358, 1360, 1343, 1324,    0,    0,    0,
+        0,    0,    0,    0, 2783, 2883, 2784,    0,    0,    0,
+     2714,    0, 2731,    0, 2734,    0, 2751, 2835, 2880, 2983,
+        0,    0,    0, 2886, 2900, 3070,    0,    0,    0,    0,
+        0,    0,    0,    0, 1206, 2772,    0,    0, 1294,    0,
+        0,    0, 2817,    0,    0, 2935, 2980,    0,    0,    0,
+        0,    0,    0,    0, 3165, 3261, 2995,    0,    0,    0,
+     2839,    0, 2942,    0, 2945,    0, 2875, 3036, 3152, 3357,
+        0,    0,    0, 1328, 1327, 1325, 1276, 3166, 3172, 3447,
+
+        0,    0,    0,    0,    0,    0,    0,    0, 1706, 3103,
+        0,    0, 1221,    0,    0,    0, 3149,    0,    0, 3218,
+     3259,    0,    0,    0,    0,    0,    0,    0, 3528,    0,
+        0,    0, 3265, 3313, 3615,    0,    0,    0,    0,    0,
+        0,    0,    0, 1722, 3196,    0,    0, 1212,    0,    0,
+        0, 3215,    0,    0, 3354, 3360,    0,    0,    0,    0,
+        0,    0,    0, 1229, 3374, 3529, 3704,    0,    0,    0,
+        0,    0,    0,    0, 1181, 1165, 1067, 1064, 1060, 1055,
+        0, 1048, 1008, 1001,  982,  939,  927,  924,  928,  906,
+      915,  875,  879, 3535, 3551, 3793,    0,    0,  998,  830,
+
+        0, 3232,    0, 3254,    0, 3250,  813, 3827,    0, 2754,
+        0, 3313,    0, 3134,  791,    0, 3524, 1280, 3837,    0,
+     3906, 3912,    0,    0,    0,    0,    0,    0,    0,    0,
+      785, 3291,    0,    0,  764,    0,    0,    0, 3337,    0,
+        0, 3956,  745,  689,  234,  906,  752,  743, 4055, 4155,
+     4038, 4044,    0,  700,    0,    0,    0,    0,    0,    0,
+        0, 4058, 4107, 4152, 4158, 4242,    0,    0,    0,    0,
+        0,    0, 4172, 4207,    0, 4337, 4433, 4324, 4338,    0,
+      663,    0,    0,    0,    0,    0,    0,    0, 4344, 4389,
+     4430, 4436, 4523,    0,    0,    0,    0,    0,    0, 4450,
+
+     4605,    0, 4611, 4625, 4666,    0,    0,    0,    0,    0,
+        0, 4748, 4754,    0, 4768, 4789, 4833,    0,  668,  627,
+      640,  601,  592,    0,  599,    0,    0,  578,  582,    0,
+      539,    0,  541,    0,    0, 4915, 4921, 4935, 4956, 5000,
+        0,    0,    0,    0,    0,    0,    0,    0, 1807, 3352,
+        0,    0,  452,    0,    0,    0, 3384,    0,    0, 5082,
+     5088,    0,    0,    0,    0,    0,    0,    0,    0,  482,
+        0,  477,    0, 8482, 5102, 5123, 5177,    0,    0,    0,
+     5137, 5143, 5157, 5178, 5264, 5192, 5346, 8482, 5352, 5366,
+     5416,    0,    0,    0, 5387, 5401, 5420, 5442, 5506, 5588,
+
+     5594, 5608, 5629, 5670, 5752, 5758, 5772, 5793,  461,  452,
+      438,  425,    0,  373,    0,  390,    0,    0, 5807,    0,
+     5813, 5827,    0,    0,    0,    0,    0,    0,    0, 5848,
+     5862,    0,  337,  329, 5868, 5882, 5903, 5917, 5923, 5937,
+        0, 5958, 5972, 5978, 5992, 6013, 6027,    0, 6033, 6047,
+     6068,    0, 6082,    0,  342,  308,  281,  238,  251,  206,
+     6088, 6102, 6123,    0, 6137, 6143,    0,  216, 6157, 6178,
+     6192, 6198,    0, 6212, 6233, 6247, 6253, 6267,    0, 6288,
+     6302,    0, 6308, 6322,  172,    0,    0,    0,  182,    0,
+     6343, 6357, 6363, 6377,    0,  154, 6398, 6412, 6418, 6432,
+
+     6453, 6467, 6473, 6487, 6508, 6522, 6528,    0,  149, 6542,
+     6563,    0, 6577,    0, 6583, 6597, 6618, 6632, 6638, 6652,
+     6673, 6687, 6693, 6707, 6728,  122,    0, 6742, 6748, 6762,
+     6816, 6783,    0, 6797, 6912, 6804,    0, 6818,    0,    0,
+        0, 6868, 6909, 6915,    0, 6929,    0,    0, 6963,    0,
+     7017, 7113,    0, 8482, 7219, 7229, 7237,  147, 7241, 7245,
+     7249, 7253, 7257, 7261, 7265, 7269, 7273, 7277, 7287, 7291,
+     7294, 7297, 7301, 7305, 7309, 7313, 7317, 7321, 7325, 7329,
+     7333, 7337, 7341, 7345, 7349, 7359, 7363, 7366, 7369, 7373,
+     7377, 7381, 7385, 7389, 7393, 7397, 7401, 7405, 7409, 7413,
+
+     7417, 7421, 7429, 7433, 7436, 7439, 7443, 7447, 7451, 7455,
+     7459, 7463, 7467, 7471, 7475, 7479, 7483, 7487, 7491, 7498,
+     7498, 7502, 7506, 7510, 7514, 7518, 7522, 7526, 7530, 7534,
+     7538, 7542, 7546, 7550, 7554, 7558, 7562, 7566, 7570, 7580,
+     7590, 7594, 7598, 7602, 7606, 7610, 7614, 7618, 7622, 7626,
+     7630, 7634, 7638, 7642, 7646, 7650, 7654, 7658, 7662, 7666,
+     7670, 7674, 7678, 7682, 7686, 7690, 7700, 7710, 7714, 7718,
+     7722, 7726, 7730, 7734, 7738, 7742, 7746, 7750, 7754, 7758,
+     7762, 7766, 7770, 7774, 7778, 7782, 7786, 7790, 7794, 7798,
+     7802, 7806, 7810, 7814, 7818, 7822, 7826, 7830, 7834, 7838,
+
+     7842, 7846, 7850, 7854, 7858, 7862, 7866, 7870, 7874, 7878,
+     7882, 7886, 7890, 7894, 7898, 7902, 7906, 7910, 7916, 7916,
+     7920, 7924, 7928, 7932, 7936, 7940, 7944, 7948, 7952, 7956,
+     7960, 7964, 7968, 7972, 7976, 7980, 7984, 7988, 7998, 8002,
+     8005, 8008, 8012, 8016, 8020, 8030, 8034, 8038, 8042, 8046,
+     8050, 8054, 8058, 8062, 8066, 8070, 8074, 8084, 8088, 8091,
+     8094, 8098, 8102, 8106, 8116, 8120, 8124, 8128, 8132, 8136,
+     8140, 8144, 8148, 8152, 8156, 8160, 8168, 8172, 8176, 8180,
+     8184, 8188, 8192, 8196, 8200, 8204, 8208, 8212, 8219, 8219,
+     8223, 8227, 8231, 8235, 8239, 8243, 8247, 8251, 8255, 8259,
+
+     8263, 8267, 8271, 8275, 8279, 8283, 8287, 8291, 8295, 8305,
+     8309, 8313, 8317, 8321, 8325, 8329, 8333, 8343, 8347, 8351,
+     8355, 8359, 8363, 8367, 8371, 8375, 8379, 8383, 8387, 8391,
+     8395, 8399, 8403, 8407, 8411, 8421, 8425, 8429, 8439, 8443,
+     8447, 8451, 8461, 8471
+    } ;
+
+static yyconst short int yy_def[1345] =
+    {   0,
+     1054,    1, 1054, 1054, 1054, 1054, 1055, 1054, 1054, 1056,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1057, 1054, 1054, 1054, 1058, 1054,   27,   27,   27,
+       27,   27,   27,   27,   27,   27,   27,   27,   27,   27,
+       27, 1054, 1054, 1054, 1054, 1054,   27,   27,   27,   27,
+     1054, 1054, 1054, 1059, 1060, 1059, 1059, 1061, 1062, 1054,
+     1063, 1054, 1064, 1054, 1065, 1066, 1066, 1067, 1054, 1054,
+     1054, 1068, 1054, 1054, 1069, 1054, 1054, 1070, 1071, 1072,
+     1054, 1073, 1054, 1074, 1054, 1075, 1054, 1054, 1054, 1076,
+     1077, 1076, 1076, 1078, 1079, 1054, 1080, 1054, 1081, 1054,
+
+     1082, 1083, 1083, 1084, 1054, 1054, 1054, 1085, 1054, 1086,
+     1054, 1054, 1087, 1088, 1089, 1054, 1090, 1054, 1091, 1054,
+     1092, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1093, 1094, 1093, 1093, 1095, 1096, 1054, 1097, 1054, 1098,
+     1054, 1099, 1100, 1100, 1101, 1054, 1054, 1054, 1102, 1103,
+     1103, 1054, 1104, 1105, 1106, 1054, 1107, 1054, 1108, 1054,
+     1109, 1054, 1054, 1054, 1054, 1110, 1111, 1110, 1110, 1112,
+     1113, 1054, 1114, 1054, 1115, 1054, 1116, 1117, 1117, 1118,
+     1054, 1054, 1054, 1119, 1120, 1054,  186, 1054,  186,  186,
+     1054, 1121, 1122, 1121, 1121, 1121, 1123, 1124, 1054, 1054,
+
+     1125, 1126, 1127, 1054, 1128, 1129, 1129, 1130, 1054, 1054,
+     1054, 1131,  186,  186,  186,  186,  186,  186,  186,  186,
+      186,  186,  186,  186,  186,  186,  186,  186,  186,  186,
+      186,  186,  186,  186, 1054, 1054, 1054, 1054, 1054, 1054,
+      186,  186,  186, 1054,  186,  186,  186,  186,  186,  186,
+      186, 1132, 1133, 1134, 1134, 1134, 1135, 1136, 1136, 1134,
+     1137, 1054, 1138, 1139, 1054, 1140, 1141, 1054, 1054, 1142,
+     1054, 1143, 1144, 1143, 1143, 1145, 1146, 1147, 1054,  279,
+     1054, 1148, 1149, 1148, 1148, 1148, 1150, 1151, 1054, 1054,
+     1152, 1153, 1154, 1054, 1155, 1156, 1156, 1157, 1054, 1054,
+
+     1054, 1158, 1054, 1054,  279,  279,  279,  279,  279,  279,
+     1159, 1160, 1161, 1161, 1161, 1162, 1163, 1163, 1161, 1164,
+     1054, 1165, 1166, 1054, 1167, 1168, 1054, 1054, 1169, 1054,
+     1170, 1171, 1170, 1170, 1172, 1173, 1174, 1054, 1054, 1054,
+     1054, 1054, 1054,  343,  343, 1054, 1175, 1176, 1175, 1175,
+     1175, 1177, 1178, 1054, 1054, 1179, 1180, 1181, 1054, 1182,
+     1183, 1183, 1184, 1054, 1054, 1054, 1185, 1054, 1054,  343,
+      343,  343,  343,  343,  343, 1186, 1187, 1188, 1188, 1188,
+     1189, 1190, 1190, 1188, 1191, 1054, 1192, 1193, 1194, 1054,
+     1195, 1196, 1195, 1195, 1197, 1198, 1199, 1054,  398, 1054,
+
+     1200, 1201, 1200, 1200, 1200, 1202, 1203, 1054, 1054, 1204,
+     1205, 1206, 1054, 1207, 1208, 1208, 1209, 1054, 1054, 1054,
+     1210, 1054, 1054,  398,  398,  398,  398,  398,  398, 1211,
+     1212, 1213, 1213, 1213, 1214, 1215, 1215, 1213, 1216, 1054,
+     1217, 1218, 1219, 1054,  444, 1054, 1054,  444,  444,  444,
+      444,  444,  444,  444, 1220, 1221, 1222, 1222, 1222, 1223,
+     1224, 1224, 1222, 1225, 1054, 1226, 1227,  444,  444,  444,
+      444,  444,  444,  444,  444,  444,  444,  444,  444,  444,
+      444,  444,  444,  444,  444,  444,  444,  444, 1054, 1054,
+     1054, 1054, 1228, 1229, 1228, 1228, 1230, 1231, 1054, 1232,
+
+     1054, 1233, 1054, 1234, 1235, 1235, 1236, 1054, 1054, 1054,
+     1237,  444,  444,  444,  444,  444,  444,  444,  444,  444,
+      444,  444, 1238, 1238, 1239, 1239, 1054, 1240, 1241, 1242,
+     1054, 1243, 1054, 1244, 1054, 1245, 1054, 1054, 1054, 1246,
+     1247, 1247, 1248, 1054, 1054, 1054,  546,  546,  546,  546,
+      546,  546, 1249, 1250, 1251, 1251, 1251, 1252, 1253, 1253,
+     1251, 1254, 1054, 1255, 1256, 1054, 1054,  546,  546,  546,
+      546,  546, 1257, 1257, 1258, 1258, 1054, 1259, 1260, 1261,
+     1054, 1262, 1054, 1263, 1054, 1264, 1054, 1054, 1054, 1265,
+     1266, 1266, 1267, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+
+      600,  600,  600,  600,  600,  600, 1268, 1269, 1270, 1270,
+     1270, 1271, 1272, 1272, 1270, 1273, 1054, 1274, 1275, 1054,
+     1054,  600,  600,  600,  600,  600, 1276, 1276, 1277, 1278,
+     1278, 1279, 1054, 1054, 1054,  635,  635,  635,  635,  635,
+      635, 1280, 1281, 1282, 1282, 1282, 1283, 1284, 1284, 1282,
+     1285, 1054, 1286, 1287, 1054, 1054,  635,  635,  635,  635,
+      635, 1288, 1288, 1289, 1054, 1054, 1054,  667,  667,  667,
+      667, 1290, 1290,  667,  667,  667,  667,  667,  667,  667,
+      667,  667,  667,  667,  667,  667,  667,  667,  667,  667,
+      667,  667,  667, 1054, 1054, 1054,  696,  696, 1054, 1291,
+
+     1292, 1291, 1291, 1291, 1293, 1294, 1054, 1054, 1295, 1296,
+     1297, 1054, 1298, 1299, 1299, 1300, 1054, 1054, 1054, 1301,
+     1054, 1054,  696,  696,  696,  696,  696,  696, 1302, 1303,
+     1304, 1304, 1304, 1305, 1306, 1306, 1304, 1307, 1054, 1308,
+     1309, 1054,  742,  742,  742,  742,  742,  742, 1310, 1310,
+     1054, 1054, 1311, 1054, 1312, 1313, 1312, 1312, 1314, 1315,
+     1316, 1054, 1054, 1054, 1054, 1054,  766,  766,  766,  766,
+     1317, 1317, 1054, 1054,  766, 1318, 1318, 1054, 1054, 1319,
+     1054, 1320, 1321, 1320, 1320, 1322, 1323, 1324, 1054, 1054,
+     1054, 1054, 1054,  793,  793,  793,  793, 1325, 1325, 1054,
+
+     1054,  793, 1054, 1054, 1054,  805,  805,  805,  805, 1326,
+     1326, 1054, 1054,  805, 1054, 1054, 1054,  817,  817,  817,
+      817,  817,  817,  817,  817,  817,  817,  817,  817,  817,
+      817,  817,  817,  817,  817, 1054, 1054, 1054, 1054, 1054,
+      840,  840,  840,  840,  840,  840, 1327, 1328, 1329, 1329,
+     1329, 1330, 1331, 1331, 1329, 1332, 1054, 1333, 1334, 1054,
+     1054,  840,  840,  840,  840,  840, 1335, 1335,  817,  817,
+      817,  817,  817, 1054, 1054, 1054, 1336, 1337, 1337, 1338,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1339, 1340, 1340, 1341, 1054, 1054, 1054, 1054, 1054, 1054,
+
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,  817,  817,
+      817,  817,  817,  817,  817,  817,  817,  817, 1054,  817,
+     1054, 1054,  840,  840,  840,  840,  840, 1342, 1342, 1054,
+     1054,  840,  817,  817, 1054, 1054, 1054, 1054, 1054, 1054,
+      885, 1054, 1054, 1054, 1054, 1054, 1054,  899, 1054, 1054,
+     1054,  904, 1054,  817,  817,  817,  817,  817,  817,  817,
+     1054, 1054, 1054,  840, 1054, 1054,  817,  817, 1054, 1054,
+     1054, 1054,  885, 1054, 1054, 1054, 1054, 1054,  899, 1054,
+     1054,  904, 1054, 1054,  817,  817,  817,  817,  817,  817,
+     1054, 1054, 1054, 1054,  840,  817, 1054, 1054, 1054, 1054,
+
+     1054, 1054, 1054, 1054, 1054, 1054, 1054,  817,  817, 1054,
+     1054,  840, 1054,  817, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054,  817,  817, 1054, 1054, 1054,
+     1343, 1054,  885, 1054, 1344, 1054,  899, 1054,  904,  817,
+      817, 1054, 1054, 1054,  885, 1054,  899,  904, 1054,  840,
+     1336, 1339,  840,    0, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054
+    } ;
+
+static yyconst short int yy_nxt[8589] =
+    {   0,
+        4,    5,    5,    5,    5,    6,    7,    4,    8,    9,
+       10,   11,   12,   13,   14,   15,   16,   17,   18,   19,
+       20,   21,   22,   23,   24,   25,   26,   27,   28,   29,
+       30,   31,   32,   33,   31,   31,   31,   31,   34,   31,
+       35,   36,   37,   38,   39,   31,   40,   41,   31,   31,
+       42,   43,   44,   45,   46,   47,   31,   31,   31,   48,
+       31,   49,   31,   31,   31,   31,   50,   31,   51,   52,
+       53,    4,   54,   55,   56,   54,   54,   54,   54,   54,
+       54,   54,   54,   54,   57,   58,   58,   59,    4,    4,
+       60,   61,    4,   62,   63,   64,   65,   66,   67,   68,
+
+       69,    4,   70,   71,   72,    4,   73,   73,   73,   73,
+       76,  123,  123,  123,  123,  126,  213,  127,  216,  217,
+      223,  189,  124,  218,  222,  189,  220,  219,  224,  128,
+      214,  225,  226,  189,  221,  189,  189,  189,  215,  229,
+      189,  230,  227,  228,  189,  231,  233,  234,  189,  237,
+      189,  189,  185,  189,  189,   77,  128,  189,  189,  232,
+      235,  235,  235,  235,  241,  189, 1041,  251,  251,  251,
+      238,  251,  242,  246,  246,  246,  246,  246,  246,  246,
+     1026,   78,  261,  261,  262,  243,  248,  248,  248,  245,
+      245,   79, 1014,   80,   80,   80,   80,   80,   80,   81,
+
+       82,   82,   82,   82,   83,   84,   84,   85,   86,   87,
+       88,  236,   73,   73,   73,   73, 1009, 1008,   88,   88,
+       88,   88,   88,   88,   88,   88,   88,   88,   88,   88,
+       88,   88,   88,   88,   88,   88,   88,   88,   88,   88,
+       88,  303,   89,  996,  990,   88,   88,   88,   88,   88,
+       88,   88,   88,   88,   88,   88,   88,   88,   88,  320,
+      320,  321,  304,   90,   91,   92,   90,   90,   90,   90,
+       90,   90,   90,   90,   90,   93,   94,   94,   95,  872,
+      989,   96,   97,  988,   98,   99,  100,  101,  102,  103,
+      104,  105,  189,  106,  107,  108,  111,  247,  247,  247,
+
+      247,  247,  247,  247,  250,  250,  250,  250,  250,  250,
+      250,  250,  987,  250,  250,  250,  250,  368,  250,  250,
+      250,  252,  252,  252,  252,  252,  252,  252,  254,  255,
+      272,  272,  272,  272,  272,  272,  272,  112,  369,  986,
+      257,  257,  257,  257,  260,  260,  260,  260,  260,  260,
+      260,  260,  260,  260,  278,  278,  278,  278,  278,  278,
+      385,  385,  386,  113,  306,  306,  306,  306,  306,  306,
+      306,  985,  968,  114,  967,  115,  115,  115,  115,  115,
+      115,  116,  117,  117,  117,  117,  118,  119,  119,  120,
+      121,  122,  129,  129,  129,  129,  129,  129,  129,  129,
+
+      129,  129,  129,  129,  129,  129,  129,  129,  129,  129,
+      129,  129,  129,  129,  129,  422,  130,  960,  959,  129,
+      129,  129,  129,  129,  129,  129,  129,  129,  129,  129,
+      129,  129,  129,  439,  439,  440,  423,  131,  132,  133,
+      131,  131,  131,  131,  131,  131,  131,  131,  131,  134,
+      135,  135,  136,  267,  958,  137,  138,  267,  139,  140,
+      141,  142,  143,  144,  145,  146,  957,  147,  148,  149,
+      151,  152,  263,  263,  263,  263,  263,  263,  263,  263,
+      263,  263,  274,  274,  274,  274,  274,  274,  274,  274,
+      274,  274,  125,  268,  956,  310,  310,  310,  267,  310,
+
+      341,  444,  341,  267,  338,  342,  267,  955,  934,  445,
+      267,  267,  446,  267,  269,  307,  307,  307,  307,  307,
+      307,  307,  933,  841,  153,  308,  308,  308,  305,  305,
+      594,  338,  594,  447,  154,  595,  155,  155,  155,  155,
+      155,  155,  156,  157,  157,  157,  157,  158,  159,  159,
+      160,  161,  162,  164,  311,  311,  311,  311,  311,  311,
+      311,  164,  164,  164,  164,  164,  164,  164,  164,  164,
+      164,  164,  164,  164,  164,  164,  164,  164,  164,  164,
+      164,  164,  164,  164,  544,  165,  918,  917,  164,  164,
+      164,  164,  164,  164,  164,  164,  164,  164,  164,  164,
+
+      164,  164,  464,  464,  465,  545,  166,  167,  168,  166,
+      166,  166,  166,  166,  166,  166,  166,  166,  169,  170,
+      170,  171,  916,  915,  172,  173,  914,  174,  175,  176,
+      177,  178,  179,  180,  181,  913,  182,  183,  184,  186,
+      187,  912,  186,  188,  337,  337,  337,  337,  337,  337,
+      189,  189,  189,  189,  189,  189,  189,  189,  189,  189,
+      189,  189,  189,  189,  189,  189,  189,  190,  189,  189,
+      189,  189,  189,  598,  191,  911,  910,  189,  189,  189,
+      189,  189,  189,  189,  189,  189,  189,  189,  189,  189,
+      189,  562,  562,  563,  599,  192,  193,  194,  195,  195,
+
+      195,  195,  195,  195,  195,  195,  195,  196,  197,  197,
+      198,  909,  199,  200,  201,  575,  202,  203,  204,  205,
+      206,  207,  208,  209,  871,  210,  211,  212,  265,  276,
+      276,  276,  276,  276,  276,  276,  276,  276,  276,   88,
+       88,   88,   88,   88,   88,   88,   88,  189,   88,   88,
+       88,   88,  525,   88,   88,   88,  313,  314,  319,  319,
+      319,  319,  319,  319,  319,  319,  319,  319,  316,  316,
+      316,  316,  870,   77,  322,  322,  322,  322,  322,  322,
+      322,  322,  322,  322,  331,  331,  331,  331,  331,  331,
+      331,  123,  123,  123,  123,  339,  375,  375,  375,   78,
+
+      375,  189,  124,  189,  429,  429,  429,  340,  429,   79,
+      189,   80,   80,   80,   80,   80,   80,   81,   82,   82,
+       82,   82,   83,   84,   84,   85,   86,   87,  279,  373,
+      373,  373,  370,  370,  340,  723,  280,  280,  280,  280,
+      280,  280,  280,  280,  280,  280,  280,  280,  280,  280,
+      280,  280,  280,  280,  280,  280,  280,  280,  280,  633,
+      281,  724,  853,  280,  280,  280,  280,  280,  280,  280,
+      280,  280,  280,  280,  280,  280,  280,  616,  616,  617,
+      634,  282,  283,  284,  285,  285,  285,  285,  285,  285,
+      285,  285,  285,  286,  287,  287,  288,  696,  289,  290,
+
+      291,  840,  292,  293,  294,  295,  296,  297,  298,  299,
+      835,  300,  301,  302,  324,  834,  326,  651,  651,  652,
+      326,  333,  333,  333,  333,  333,  333,  333,  333,  333,
+      333,  335,  335,  335,  335,  335,  335,  335,  335,  335,
+      335,  873,  450,  126,  833,  127,  371,  371,  371,  371,
+      371,  371,  371,  448,  832,  112,  327,  128,  454,  454,
+      454,  326,  454,  831,  189,  513,  326,  830,  829,  326,
+      828,  721,  514,  326,  326,  515,  326,  328,  552,  552,
+      552,  113,  552,  516,  128,  397,  397,  397,  397,  397,
+      397,  114,  722,  115,  115,  115,  115,  115,  115,  116,
+
+      117,  117,  117,  117,  118,  119,  119,  120,  121,  122,
+      343,  344,  827,  343,  372,  372,  372,  372,  372,  372,
+      372,  345,  345,  345,  345,  345,  345,  345,  345,  345,
+      345,  345,  345,  345,  345,  345,  345,  345,  345,  345,
+      345,  345,  345,  345,  838,  346,  826,  825,  345,  345,
+      345,  345,  345,  345,  345,  345,  345,  345,  345,  345,
+      345,  345,  738,  738,  739,  839,  347,  348,  349,  350,
+      350,  350,  350,  350,  350,  350,  350,  350,  351,  352,
+      352,  353,  824,  354,  355,  356,  823,  357,  358,  359,
+      360,  361,  362,  363,  364,  822,  365,  366,  367,  129,
+
+      129,  129,  129,  129,  129,  129,  129,  821,  129,  129,
+      129,  129,  820,  129,  129,  129,  376,  376,  376,  376,
+      376,  376,  376,  378,  379,  384,  384,  384,  384,  384,
+      384,  384,  384,  384,  384,  381,  381,  381,  381,  387,
+      387,  387,  387,  387,  387,  387,  387,  387,  387,  152,
+      391,  391,  391,  391,  391,  391,  391,  393,  393,  393,
+      393,  393,  393,  393,  393,  393,  393,  395,  395,  395,
+      395,  395,  395,  395,  395,  395,  395,  425,  425,  425,
+      425,  425,  425,  425,  426,  426,  426,  426,  426,  426,
+      426,  427,  427,  427,  424,  424,  452,  452,  452,  449,
+
+      449,  339,  153,  430,  430,  430,  430,  430,  430,  430,
+      819,  818,  154,  340,  155,  155,  155,  155,  155,  155,
+      156,  157,  157,  157,  157,  158,  159,  159,  160,  161,
+      162,  152,  164,  164,  164,  164,  164,  164,  164,  164,
+      340,  164,  164,  164,  164,  443,  164,  164,  164,  432,
+      433,  438,  438,  438,  438,  438,  438,  438,  438,  438,
+      438,  435,  435,  435,  435,  441,  441,  441,  441,  441,
+      441,  441,  441,  441,  441,  450,  450,  450,  450,  450,
+      450,  450,  548,  636,  153,  451,  451,  451,  451,  451,
+      451,  451,  601,  546,  154,  597,  155,  155,  155,  155,
+
+      155,  155,  156,  157,  157,  157,  157,  158,  159,  159,
+      160,  161,  162,  398,  455,  455,  455,  455,  455,  455,
+      455,  399,  399,  399,  399,  399,  399,  399,  399,  399,
+      399,  399,  399,  399,  399,  399,  399,  399,  399,  399,
+      399,  399,  399,  399,  597,  400,  595,  595,  399,  399,
+      399,  399,  399,  399,  399,  399,  399,  399,  399,  399,
+      399,  399,  856,  856,  857,  547,  401,  402,  403,  404,
+      404,  404,  404,  404,  404,  404,  404,  404,  405,  406,
+      406,  407,  747,  408,  409,  410,  746,  411,  412,  413,
+      414,  415,  416,  417,  418,  745,  419,  420,  421,  186,
+
+      187,  744,  186,  188,  246,  246,  246,  246,  246,  743,
+      189,  189,  189,  189,  189,  189,  189,  189,  189,  189,
+      189,  189,  189,  189,  189,  189,  189,  189,  189,  189,
+      189,  189,  189,  742,  191,  735,  693,  189,  189,  189,
+      189,  189,  189,  189,  189,  189,  189,  189,  189,  189,
+      189,  692,  691,  690,  689,  192,  193,  194,  195,  195,
+      195,  195,  195,  195,  195,  195,  195,  196,  197,  197,
+      198,  688,  199,  200,  201,  687,  202,  203,  204,  205,
+      206,  207,  208,  209,  686,  210,  211,  212,  129,  129,
+      129,  129,  129,  129,  129,  129,  129,  129,  129,  129,
+
+      129,  129,  129,  129,  129,  129,  129,  129,  129,  129,
+      129,  685,  130,  684,  683,  129,  129,  129,  129,  129,
+      129,  129,  129,  129,  129,  129,  129,  129,  129,  682,
+      681,  680,  679,  131,  132,  133,  131,  131,  131,  131,
+      131,  131,  131,  131,  131,  134,  135,  135,  136,  678,
+      677,  137,  138,  676,  139,  140,  141,  142,  143,  144,
+      145,  146,  675,  147,  148,  149,  189,  189,  189,  189,
+      189,  189,  189,  189,  674,  189,  189,  189,  189,  449,
+      189,  189,  189,  457,  458,  463,  463,  463,  463,  463,
+      463,  463,  463,  463,  463,  460,  460,  460,  460,  466,
+
+      466,  466,  466,  466,  466,  466,  466,  466,  466,  235,
+      235,  235,  235,  489,  522,  522,  522,  522,  522,  490,
+      424,  489,  489,  489,  489,  489,  489,  490,  490,  490,
+      490,  490,  490,  548,  548,  548,  548,  548,  548,  548,
+      549,  549,  549,  549,  549,  549,  549,  425,  648,  489,
+      489,  489,  489,  489,  398,  490,  490,  490,  490,  490,
+      236,  491,  491,  491,  491,  491,  491,  491,  491,  491,
+      491,  491,  491,  491,  491,  491,  491,  491,  491,  491,
+      491,  491,  491,  491,  635,  492,  150,  370,  491,  491,
+      491,  491,  491,  491,  491,  491,  491,  491,  491,  491,
+
+      491,  491,  371,  613,  343,  600,  493,  494,  495,  493,
+      493,  493,  493,  493,  493,  493,  493,  493,  496,  497,
+      497,  498,  342,  342,  499,  500,  110,  501,  502,  503,
+      504,  505,  506,  507,  508,  538,  509,  510,  511,  526,
+      305,  539,  306,  538,  538,  538,  538,  538,  538,  539,
+      539,  539,  539,  539,  539,  550,  550,  550,  547,  547,
+      553,  553,  553,  553,  553,  553,  553,  559,  279,  546,
+       75,  538,  538,  538,  538,  538,  245,  539,  539,  539,
+      539,  539,  602,  246,  527,  280,  280,  280,  280,  280,
+      280,  280,  280,  600,  280,  280,  280,  280,  637,  280,
+
+      280,  280,  555,  556,  306,  306,  306,  306,  306,  635,
+      528,  517,  512,  488,  558,  558,  558,  558,  487,  486,
+      529,  485,  530,  530,  530,  530,  530,  530,  531,  532,
+      532,  532,  532,  533,  534,  534,  535,  536,  537,  265,
+      561,  561,  561,  561,  561,  561,  561,  561,  561,  561,
+      564,  564,  564,  564,  564,  564,  564,  564,  564,  564,
+      566,  572,  572,  572,  572,  572,  567,  484,  566,  566,
+      566,  566,  566,  566,  567,  567,  567,  567,  567,  567,
+      596,  483,  596,  842,   77,  597,  602,  602,  602,  602,
+      602,  602,  602,  482,  840,  481,  566,  566,  566,  566,
+
+      566,  480,  567,  567,  567,  567,  567,  479,  478,  477,
+       78,  603,  603,  603,  603,  603,  603,  603,  476,  475,
+       79,  474,   80,   80,   80,   80,   80,   80,   81,   82,
+       82,   82,   82,   83,   84,   84,   85,   86,   87,  279,
+      604,  604,  604,  601,  601,  473,  472,  280,  280,  280,
+      280,  280,  280,  280,  280,  280,  280,  280,  280,  280,
+      280,  280,  280,  280,  280,  280,  280,  280,  280,  280,
+      471,  281,  470,  469,  280,  280,  280,  280,  280,  280,
+      280,  280,  280,  280,  280,  280,  280,  280,  468,  461,
+      186,  448,  282,  283,  284,  285,  285,  285,  285,  285,
+
+      285,  285,  285,  285,  286,  287,  287,  288, 1054,  289,
+      290,  291,  443,  292,  293,  294,  295,  296,  297,  298,
+      299,  588,  300,  301,  302,  576,  436,  382,  325,  588,
+      588,  588,  588,  588,  588,  589,  606,  606,  606,  317,
+      606,  266,  258,  589,  589,  589,  589,  589,  589,  607,
+      607,  607,  607,  607,  607,  607,  244,  588,  588,  588,
+      588,  588,  189,  641,  641,  641,  577,  641,  240,  239,
+      189,  589,  589,  589,  589,  589,  163,  125,  109,  345,
+      345,  345,  345,  345,  345,  345,  345,   74,  345,  345,
+      345,  345,  578,  345,  345,  345,  371,  371,  371,  371,
+
+      371, 1054,  579, 1054,  580,  580,  580,  580,  580,  580,
+      581,  582,  582,  582,  582,  583,  584,  584,  585,  586,
+      587,  324,  609,  610,  615,  615,  615,  615,  615,  615,
+      615,  615,  615,  615,  612,  612,  612,  612,  618,  618,
+      618,  618,  618,  618,  618,  618,  618,  618,  626,  626,
+      626,  626,  626, 1054, 1054,  620,  639,  639,  639,  636,
+      636, 1054,  112,  620,  620,  620,  620,  620,  620,  637,
+      637,  637,  637,  637,  637,  637,  638,  638,  638,  638,
+      638,  638,  638,  425,  425,  425,  425,  425,  113, 1054,
+     1054,  620,  620,  620,  620,  620, 1054, 1054,  114, 1054,
+
+      115,  115,  115,  115,  115,  115,  116,  117,  117,  117,
+      117,  118,  119,  119,  120,  121,  122,  343,  344, 1054,
+      343,  642,  642,  642,  642,  642,  642,  642,  345,  345,
+      345,  345,  345,  345,  345,  345,  345,  345,  345,  345,
+      345,  345,  345,  345,  345,  345,  345,  345,  345,  345,
+      345, 1054,  346, 1054, 1054,  345,  345,  345,  345,  345,
+      345,  345,  345,  345,  345,  345,  345,  345,  345, 1054,
+     1054, 1054, 1054,  347,  348,  349,  350,  350,  350,  350,
+      350,  350,  350,  350,  350,  351,  352,  352,  353, 1054,
+      354,  355,  356, 1054,  357,  358,  359,  360,  361,  362,
+
+      363,  364,  621,  365,  366,  367, 1054, 1054, 1054, 1054,
+      621,  621,  621,  621,  621,  621,  399,  399,  399,  399,
+      399,  399,  399,  399, 1054,  399,  399,  399,  399, 1054,
+      399,  399,  399,  644,  645, 1054, 1054, 1054,  621,  621,
+      621,  621,  621,  398, 1054,  647,  647,  647,  647, 1054,
+     1054,  399,  399,  399,  399,  399,  399,  399,  399,  399,
+      399,  399,  399,  399,  399,  399,  399,  399,  399,  399,
+      399,  399,  399,  399, 1054,  400, 1054, 1054,  399,  399,
+      399,  399,  399,  399,  399,  399,  399,  399,  399,  399,
+      399,  399, 1054, 1054, 1054, 1054,  401,  402,  403,  404,
+
+      404,  404,  404,  404,  404,  404,  404,  404,  405,  406,
+      406,  407, 1054,  408,  409,  410, 1054,  411,  412,  413,
+      414,  415,  416,  417,  418, 1054,  419,  420,  421,  650,
+      650,  650,  650,  650,  650,  650,  650,  650,  650,  653,
+      653,  653,  653,  653,  653,  653,  653,  653,  653,  655,
+      661,  661,  661,  661,  661,  656, 1054,  655,  655,  655,
+      655,  655,  655,  656,  656,  656,  656,  656,  656,  450,
+      450,  450,  450,  450,  671,  671,  671,  671,  671,  726,
+      726,  726,  723,  723, 1054,  655,  655,  655,  655,  655,
+     1054,  656,  656,  656,  656,  656,  186,  187, 1054,  186,
+
+      188,  728,  728,  728, 1054,  728, 1054,  189,  189,  189,
+      189,  189,  189,  189,  189,  189,  189,  189,  189,  189,
+      189,  189,  189,  189,  189,  189,  189,  189,  189,  189,
+     1054,  191, 1054, 1054,  189,  189,  189,  189,  189,  189,
+      189,  189,  189,  189,  189,  189,  189,  189, 1054, 1054,
+     1054, 1054,  192,  193,  194,  195,  195,  195,  195,  195,
+      195,  195,  195,  195,  196,  197,  197,  198, 1054,  199,
+      200,  201, 1054,  202,  203,  204,  205,  206,  207,  208,
+      209,  665,  210,  211,  212, 1054, 1054,  666, 1054,  665,
+      665,  665,  665,  665,  665,  666,  666,  666,  666,  666,
+
+      666,  694,  724,  724,  724,  724,  724,  724,  724,  694,
+      694,  694,  694,  694,  694, 1054, 1054,  665,  665,  665,
+      665,  665,  695,  666,  666,  666,  666,  666, 1054, 1054,
+      695,  695,  695,  695,  695,  695, 1054,  694,  694,  694,
+      694,  694,  725,  725,  725,  725,  725,  725,  725,  729,
+      729,  729,  729,  729,  729,  729,  731,  732,  695,  695,
+      695,  695,  695,  696,  697, 1054,  696, 1054,  734,  734,
+      734,  734, 1054, 1054,  698,  698,  698,  698,  698,  698,
+      698,  698,  698,  698,  698,  698,  698,  698,  698,  698,
+      698,  698,  698,  698,  698,  698,  698, 1054,  699, 1054,
+
+     1054,  698,  698,  698,  698,  698,  698,  698,  698,  698,
+      698,  698,  698,  698,  698, 1054, 1054, 1054, 1054,  700,
+      701,  702,  703,  703,  703,  703,  703,  703,  703,  703,
+      703,  704,  705,  705,  706, 1054,  707,  708,  709, 1054,
+      710,  711,  712,  713,  714,  715,  716,  717, 1054,  718,
+      719,  720,  491,  491,  491,  491,  491,  491,  491,  491,
+     1054,  491,  491,  491,  491, 1054,  491,  491,  491,  737,
+      737,  737,  737,  737,  737,  737,  737,  737,  737,  740,
+      740,  740,  740,  740,  740,  740,  740,  740,  740,  526,
+      750, 1054, 1054, 1054,  750,  755,  755,  755,  755,  755,
+
+      755,  755,  757,  757,  757,  757,  757,  757,  757,  757,
+      757,  757,  759,  759,  759,  759,  759,  759,  759,  759,
+      759,  759,  761,  761,  761,  761,  761,  761, 1054, 1054,
+      751, 1054, 1054, 1054,  527,  750, 1054,  846,  846,  846,
+      750,  846, 1054,  750, 1054, 1054, 1054,  750,  750, 1054,
+      750,  752, 1054, 1054,  762,  548,  548,  548,  548,  548,
+      528, 1054,  762,  762,  762,  762,  762,  762, 1054, 1054,
+      529, 1054,  530,  530,  530,  530,  530,  530,  531,  532,
+      532,  532,  532,  533,  534,  534,  535,  536,  537,  749,
+      762,  762,  762,  762,  762, 1054, 1054, 1054, 1054,  763,
+
+      770,  770,  770,  770,  770,  764, 1054,  763,  763,  763,
+      763,  763,  763,  764,  764,  764,  764,  764,  764,  765,
+      782,  782,  782,  782,  782,  782,  782,  765,  765,  765,
+      765,  765,  765, 1054,  527,  763,  763,  763,  763,  763,
+     1054,  764,  764,  764,  764,  764,  788,  788,  788,  788,
+      788,  788, 1054, 1054,  773,  765,  765,  765,  765,  765,
+      528, 1054,  773,  773,  773,  773,  773,  773, 1054, 1054,
+      529, 1054,  530,  530,  530,  530,  530,  530,  531,  532,
+      532,  532,  532,  533,  534,  534,  535,  536,  537,  265,
+      773,  773,  773,  773,  773, 1054, 1054, 1054, 1054,  774,
+
+     1054,  777, 1054, 1054, 1054,  777, 1054,  774,  774,  774,
+      774,  774,  774,  784,  784,  784,  784,  784,  784,  784,
+      784,  784,  784,  786,  786,  786,  786,  786,  786,  786,
+      786,  786,  786, 1054,   77,  774,  774,  774,  774,  774,
+     1054,  778, 1054, 1054, 1054, 1054,  777, 1054, 1054, 1054,
+     1054,  777, 1054, 1054,  777,  789, 1054, 1054,  777,  777,
+       78,  777,  779,  789,  789,  789,  789,  789,  789, 1054,
+       79, 1054,   80,   80,   80,   80,   80,   80,   81,   82,
+       82,   82,   82,   83,   84,   84,   85,   86,   87,  279,
+     1054,  789,  789,  789,  789,  789, 1054,  280,  280,  280,
+
+      280,  280,  280,  280,  280,  280,  280,  280,  280,  280,
+      280,  280,  280,  280,  280,  280,  280,  280,  280,  280,
+     1054,  281, 1054, 1054,  280,  280,  280,  280,  280,  280,
+      280,  280,  280,  280,  280,  280,  280,  280, 1054, 1054,
+     1054, 1054,  282,  283,  284,  285,  285,  285,  285,  285,
+      285,  285,  285,  285,  286,  287,  287,  288, 1054,  289,
+      290,  291, 1054,  292,  293,  294,  295,  296,  297,  298,
+      299,  790,  300,  301,  302,  576, 1054, 1054, 1054,  790,
+      790,  790,  790,  790,  790,  791,  602,  602,  602,  602,
+      602,  792, 1054,  791,  791,  791,  791,  791,  791,  792,
+
+      792,  792,  792,  792,  792,  849,  850,  790,  790,  790,
+      790,  790, 1054, 1054, 1054, 1054,  577,  852,  852,  852,
+      852,  791,  791,  791,  791,  791, 1054,  792,  792,  792,
+      792,  792,  797,  797,  797,  797,  797,  800, 1054, 1054,
+     1054, 1054,  578, 1054, 1054,  800,  800,  800,  800,  800,
+      800, 1054,  579, 1054,  580,  580,  580,  580,  580,  580,
+      581,  582,  582,  582,  582,  583,  584,  584,  585,  586,
+      587,  776, 1054,  800,  800,  800,  800,  800,  801,  637,
+      637,  637,  637,  637,  803, 1054,  801,  801,  801,  801,
+      801,  801,  803,  803,  803,  803,  803,  803,  809,  809,
+
+      809,  809,  809,  842,  842,  842,  842,  842,  842,  842,
+     1054, 1054,  577, 1054,  801,  801,  801,  801,  801, 1054,
+      803,  803,  803,  803,  803,  843,  843,  843,  843,  843,
+      843,  843,  804,  844,  844,  844,  841,  841,  578, 1054,
+      804,  804,  804,  804,  804,  804, 1054, 1054,  579, 1054,
+      580,  580,  580,  580,  580,  580,  581,  582,  582,  582,
+      582,  583,  584,  584,  585,  586,  587,  324,  804,  804,
+      804,  804,  804,  812,  724,  724,  724,  724,  724,  813,
+     1054,  812,  812,  812,  812,  812,  812,  813,  813,  813,
+      813,  813,  813,  815,  847,  847,  847,  847,  847,  847,
+
+      847,  815,  815,  815,  815,  815,  815, 1054,  112,  812,
+      812,  812,  812,  812, 1054,  813,  813,  813,  813,  813,
+      866,  866,  866,  866,  866, 1054, 1054, 1054, 1054,  815,
+      815,  815,  815,  815,  113,  842,  842,  842,  842,  842,
+     1054, 1054, 1054, 1054,  114, 1054,  115,  115,  115,  115,
+      115,  115,  116,  117,  117,  117,  117,  118,  119,  119,
+      120,  121,  122,  343,  344, 1054,  343,  927,  927,  927,
+      927,  927, 1054, 1054,  345,  345,  345,  345,  345,  345,
+      345,  345,  345,  345,  345,  345,  345,  345,  345,  345,
+      345,  345,  345,  345,  345,  345,  345, 1054,  346, 1054,
+
+     1054,  345,  345,  345,  345,  345,  345,  345,  345,  345,
+      345,  345,  345,  345,  345, 1054, 1054, 1054, 1054,  347,
+      348,  349,  350,  350,  350,  350,  350,  350,  350,  350,
+      350,  351,  352,  352,  353, 1054,  354,  355,  356, 1054,
+      357,  358,  359,  360,  361,  362,  363,  364,  816,  365,
+      366,  367,  152, 1054,  836, 1054,  816,  816,  816,  816,
+      816,  816,  836,  836,  836,  836,  836,  836, 1054, 1054,
+      837, 1054, 1054, 1054, 1054, 1054, 1054, 1054,  837,  837,
+      837,  837,  837,  837,  816,  816,  816,  816,  816, 1054,
+      836,  836,  836,  836,  836,  855,  855,  855,  855,  855,
+
+      855,  855,  855,  855,  855,  153,  837,  837,  837,  837,
+      837, 1054, 1054, 1054, 1054,  154, 1054,  155,  155,  155,
+      155,  155,  155,  156,  157,  157,  157,  157,  158,  159,
+      159,  160,  161,  162,  398, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054,  399,  399,  399,  399,  399,  399,  399,  399,
+      399,  399,  399,  399,  399,  399,  399,  399,  399,  399,
+      399,  399,  399,  399,  399, 1054,  400, 1054, 1054,  399,
+      399,  399,  399,  399,  399,  399,  399,  399,  399,  399,
+      399,  399,  399, 1054, 1054, 1054, 1054,  401,  402,  403,
+      404,  404,  404,  404,  404,  404,  404,  404,  404,  405,
+
+      406,  406,  407, 1054,  408,  409,  410, 1054,  411,  412,
+      413,  414,  415,  416,  417,  418, 1054,  419,  420,  421,
+      186,  187, 1054,  186,  188, 1054, 1054, 1054, 1054, 1054,
+     1054,  189,  189,  189,  189,  189,  189,  189,  189,  189,
+      189,  189,  189,  189,  189,  189,  189,  189,  189,  189,
+      189,  189,  189,  189, 1054,  191, 1054, 1054,  189,  189,
+      189,  189,  189,  189,  189,  189,  189,  189,  189,  189,
+      189,  189, 1054, 1054, 1054, 1054,  192,  193,  194,  195,
+      195,  195,  195,  195,  195,  195,  195,  195,  196,  197,
+      197,  198, 1054,  199,  200,  201, 1054,  202,  203,  204,
+
+      205,  206,  207,  208,  209, 1054,  210,  211,  212,  696,
+      697, 1054,  696, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+      698,  698,  698,  698,  698,  698,  698,  698,  698,  698,
+      698,  698,  698,  698,  698,  698,  698,  698,  698,  698,
+      698,  698,  698, 1054,  699, 1054, 1054,  698,  698,  698,
+      698,  698,  698,  698,  698,  698,  698,  698,  698,  698,
+      698, 1054, 1054, 1054, 1054,  700,  701,  702,  703,  703,
+      703,  703,  703,  703,  703,  703,  703,  704,  705,  705,
+      706, 1054,  707,  708,  709, 1054,  710,  711,  712,  713,
+      714,  715,  716,  717, 1054,  718,  719,  720,  698,  698,
+
+      698,  698,  698,  698,  698,  698, 1054,  698,  698,  698,
+      698, 1054,  698,  698,  698,  858,  858,  858,  858,  858,
+      858,  858,  858,  858,  858,  860, 1054, 1054, 1054, 1054,
+     1054,  861, 1054,  860,  860,  860,  860,  860,  860,  861,
+      861,  861,  861,  861,  861, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054,  860,  860,  860,  860,  860, 1054,  861,  861,  861,
+      861,  861,  186,  187, 1054,  186,  188, 1054, 1054, 1054,
+     1054, 1054, 1054,  189,  189,  189,  189,  189,  189,  189,
+      189,  189,  189,  189,  189,  189,  189,  189,  189,  189,
+
+      189,  189,  189,  189,  189,  189, 1054,  191, 1054, 1054,
+      189,  189,  189,  189,  869,  189,  189,  189,  189,  189,
+      189,  189,  189,  189, 1054, 1054, 1054, 1054,  192,  193,
+      194,  195,  195,  195,  195,  195,  195,  195,  195,  195,
+      196,  197,  197,  198, 1054,  199,  200,  201, 1054,  202,
+      203,  204,  205,  206,  207,  208,  209,  875,  210,  211,
+      212,  874, 1054,  876, 1054,  875,  875,  875,  875,  875,
+      875,  876,  876,  876,  876,  876,  876,  881, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054,  881,  881,  881,  881,  881,
+      881, 1054, 1054,  875,  875,  875,  875,  875, 1054,  876,
+
+      876,  876,  876,  876, 1054, 1054,  527, 1054, 1054, 1054,
+     1054, 1054, 1054,  881,  881,  881,  881,  881, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054,  882, 1054, 1054, 1054,
+     1054, 1054,  528, 1054,  882,  882,  882,  882,  882,  882,
+     1054, 1054,  529, 1054,  530,  530,  530,  530,  530,  530,
+      531,  532,  532,  532,  532,  533,  534,  534,  535,  536,
+      537,  526,  882,  882,  882,  882,  882, 1054, 1054, 1054,
+     1054,  883, 1054, 1054, 1054, 1054, 1054,  884, 1054,  883,
+      883,  883,  883,  883,  883,  884,  884,  884,  884,  884,
+      884,  886, 1054, 1054, 1054, 1054, 1054, 1054, 1054,  886,
+
+      886,  886,  886,  886,  886, 1054,  527,  883,  883,  883,
+      883,  883, 1054,  884,  884,  884,  884,  884, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054,  887,  886,  886,  886,
+      886,  886,  528, 1054,  887,  887,  887,  887,  887,  887,
+     1054, 1054,  529, 1054,  530,  530,  530,  530,  530,  530,
+      531,  532,  532,  532,  532,  533,  534,  534,  535,  536,
+      537,  279,  887,  887,  887,  887,  887, 1054, 1054,  280,
+      280,  280,  280,  280,  280,  280,  280,  280,  280,  280,
+      280,  280,  280,  280,  280,  280,  280,  280,  280,  280,
+      280,  280, 1054,  281, 1054, 1054,  280,  280,  280,  280,
+
+      280,  280,  280,  280,  280,  280,  280,  280,  280,  280,
+     1054, 1054, 1054, 1054,  282,  283,  284,  285,  285,  285,
+      285,  285,  285,  285,  285,  285,  286,  287,  287,  288,
+     1054,  289,  290,  291, 1054,  292,  293,  294,  295,  296,
+      297,  298,  299,  889,  300,  301,  302,  888, 1054, 1054,
+     1054,  889,  889,  889,  889,  889,  889,  890, 1054, 1054,
+     1054, 1054, 1054,  895, 1054,  890,  890,  890,  890,  890,
+      890,  895,  895,  895,  895,  895,  895, 1054, 1054,  889,
+      889,  889,  889,  889, 1054, 1054, 1054, 1054,  577, 1054,
+     1054, 1054, 1054,  890,  890,  890,  890,  890, 1054,  895,
+
+      895,  895,  895,  895, 1054, 1054, 1054, 1054,  896, 1054,
+     1054, 1054, 1054, 1054,  578, 1054,  896,  896,  896,  896,
+      896,  896, 1054, 1054,  579, 1054,  580,  580,  580,  580,
+      580,  580,  581,  582,  582,  582,  582,  583,  584,  584,
+      585,  586,  587,  576,  896,  896,  896,  896,  896,  897,
+     1054, 1054, 1054, 1054, 1054,  898, 1054,  897,  897,  897,
+      897,  897,  897,  898,  898,  898,  898,  898,  898,  900,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054,  900,  900,  900,
+      900,  900,  900, 1054,  577,  897,  897,  897,  897,  897,
+     1054,  898,  898,  898,  898,  898, 1054, 1054, 1054, 1054,
+
+     1054, 1054, 1054, 1054, 1054,  900,  900,  900,  900,  900,
+      578, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+      579, 1054,  580,  580,  580,  580,  580,  580,  581,  582,
+      582,  582,  582,  583,  584,  584,  585,  586,  587,  343,
+      344, 1054,  343, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+      345,  345,  345,  345,  345,  345,  345,  345,  345,  345,
+      345,  345,  345,  345,  345,  345,  345,  345,  345,  345,
+      345,  345,  345, 1054,  346, 1054, 1054,  345,  345,  345,
+      345,  345,  345,  345,  345,  345,  345,  345,  345,  345,
+      345, 1054, 1054, 1054, 1054,  347,  348,  349,  350,  350,
+
+      350,  350,  350,  350,  350,  350,  350,  351,  352,  352,
+      353, 1054,  354,  355,  356, 1054,  357,  358,  359,  360,
+      361,  362,  363,  364,  901,  365,  366,  367, 1054, 1054,
+      902, 1054,  901,  901,  901,  901,  901,  901,  902,  902,
+      902,  902,  902,  902,  903, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054,  903,  903,  903,  903,  903,  903, 1054, 1054,
+      901,  901,  901,  901,  901, 1054,  902,  902,  902,  902,
+      902, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+      903,  903,  903,  903,  903,  398, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054,  399,  399,  399,  399,  399,  399,  399,
+
+      399,  399,  399,  399,  399,  399,  399,  399,  399,  399,
+      399,  399,  399,  399,  399,  399, 1054,  400, 1054, 1054,
+      399,  399,  399,  399,  399,  399,  399,  399,  399,  399,
+      399,  399,  399,  399, 1054, 1054, 1054, 1054,  401,  402,
+      403,  404,  404,  404,  404,  404,  404,  404,  404,  404,
+      405,  406,  406,  407, 1054,  408,  409,  410, 1054,  411,
+      412,  413,  414,  415,  416,  417,  418,  905,  419,  420,
+      421, 1054, 1054,  906, 1054,  905,  905,  905,  905,  905,
+      905,  906,  906,  906,  906,  906,  906,  907, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054,  907,  907,  907,  907,  907,
+
+      907, 1054, 1054,  905,  905,  905,  905,  905,  908,  906,
+      906,  906,  906,  906, 1054, 1054,  908,  908,  908,  908,
+      908,  908, 1054,  907,  907,  907,  907,  907, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054,  908,  908,  908,  908,  908,  186,
+      187, 1054,  186,  188, 1054, 1054, 1054, 1054, 1054, 1054,
+      189,  189,  189,  189,  189,  189,  189,  189,  189,  189,
+      189,  189,  189,  189,  189,  189,  189,  189,  189,  189,
+      189,  189,  189, 1054,  191, 1054, 1054,  189,  189,  189,
+      189,  189,  189,  189,  189,  189,  189,  189,  189,  189,
+
+      189, 1054, 1054, 1054, 1054,  192,  193,  194,  195,  195,
+      195,  195,  195,  195,  195,  195,  195,  196,  197,  197,
+      198, 1054,  199,  200,  201, 1054,  202,  203,  204,  205,
+      206,  207,  208,  209,  919,  210,  211,  212, 1054, 1054,
+      920, 1054,  919,  919,  919,  919,  919,  919,  920,  920,
+      920,  920,  920,  920,  921, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054,  921,  921,  921,  921,  921,  921, 1054, 1054,
+      919,  919,  919,  919,  919,  922,  920,  920,  920,  920,
+      920, 1054, 1054,  922,  922,  922,  922,  922,  922, 1054,
+      921,  921,  921,  921,  921, 1054, 1054, 1054, 1054, 1054,
+
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054,  922,  922,  922,  922,  922,  696,  697, 1054,  696,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054,  698,  698,  698,
+      698,  698,  698,  698,  698,  698,  698,  698,  698,  698,
+      698,  698,  698,  698,  698,  698,  698,  698,  698,  698,
+     1054,  699, 1054, 1054,  698,  698,  698,  698,  698,  698,
+      698,  698,  698,  698,  698,  698,  698,  698, 1054, 1054,
+     1054, 1054,  700,  701,  702,  703,  703,  703,  703,  703,
+      703,  703,  703,  703,  704,  705,  705,  706, 1054,  707,
+      708,  709, 1054,  710,  711,  712,  713,  714,  715,  716,
+
+      717,  930,  718,  719,  720, 1054, 1054,  931, 1054,  930,
+      930,  930,  930,  930,  930,  931,  931,  931,  931,  931,
+      931,  935, 1054, 1054, 1054, 1054, 1054, 1054, 1054,  935,
+      935,  935,  935,  935,  935, 1054, 1054,  930,  930,  930,
+      930,  930,  936,  931,  931,  931,  931,  931, 1054, 1054,
+      936,  936,  936,  936,  936,  936,  937,  935,  935,  935,
+      935,  935,  267, 1054,  937,  937,  937,  937,  937,  937,
+      267,  267,  267,  267,  267,  267,  938, 1054,  936,  936,
+      936,  936,  936,  526,  938,  938,  938,  938,  938,  938,
+     1054, 1054,  937,  937,  937,  937,  937,  939,  267,  267,
+
+      267,  267,  267, 1054, 1054,  939,  939,  939,  939,  939,
+      939,  940,  938,  938,  938,  938,  938, 1054, 1054,  940,
+      940,  940,  940,  940,  940, 1054, 1054, 1054,  527, 1054,
+     1054, 1054, 1054,  939,  939,  939,  939,  939, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054,  940,  940,  940,
+      940,  940, 1054, 1054,  528, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054,  529, 1054,  530,  530,  530,  530,
+      530,  530,  531,  532,  532,  532,  532,  533,  534,  534,
+      535,  536,  537,  279, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054,  280,  280,  280,  280,  280,  280,  280,  280,  280,
+
+      280,  280,  280,  280,  280,  280,  280,  280,  280,  280,
+      280,  280,  280,  280, 1054,  281, 1054, 1054,  280,  280,
+      280,  280,  280,  280,  280,  280,  280,  280,  280,  280,
+      280,  280, 1054, 1054, 1054, 1054,  282,  283,  284,  285,
+      285,  285,  285,  285,  285,  285,  285,  285,  286,  287,
+      287,  288, 1054,  289,  290,  291, 1054,  292,  293,  294,
+      295,  296,  297,  298,  299,  941,  300,  301,  302, 1054,
+     1054,  942, 1054,  941,  941,  941,  941,  941,  941,  942,
+      942,  942,  942,  942,  942,  943, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054,  943,  943,  943,  943,  943,  943, 1054,
+
+     1054,  941,  941,  941,  941,  941,  944,  942,  942,  942,
+      942,  942, 1054, 1054,  944,  944,  944,  944,  944,  944,
+      326,  943,  943,  943,  943,  943,  576, 1054,  326,  326,
+      326,  326,  326,  326, 1054, 1054, 1054, 1054, 1054,  945,
+     1054, 1054,  944,  944,  944,  944,  944,  945,  945,  945,
+      945,  945,  945, 1054, 1054, 1054,  326,  326,  326,  326,
+      326,  946, 1054, 1054, 1054, 1054, 1054,  577, 1054,  946,
+      946,  946,  946,  946,  946,  945,  945,  945,  945,  945,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054,  578, 1054, 1054, 1054,  946,  946,  946,
+
+      946,  946, 1054,  579, 1054,  580,  580,  580,  580,  580,
+      580,  581,  582,  582,  582,  582,  583,  584,  584,  585,
+      586,  587,  343,  344, 1054,  343, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054,  345,  345,  345,  345,  345,  345,  345,
+      345,  345,  345,  345,  345,  345,  345,  345,  345,  345,
+      345,  345,  345,  345,  345,  345, 1054,  346, 1054, 1054,
+      345,  345,  345,  345,  345,  345,  345,  345,  345,  345,
+      345,  345,  345,  345, 1054, 1054, 1054, 1054,  347,  348,
+      349,  350,  350,  350,  350,  350,  350,  350,  350,  350,
+      351,  352,  352,  353, 1054,  354,  355,  356, 1054,  357,
+
+      358,  359,  360,  361,  362,  363,  364,  947,  365,  366,
+      367, 1054, 1054,  948, 1054,  947,  947,  947,  947,  947,
+      947,  948,  948,  948,  948,  948,  948,  949, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054,  949,  949,  949,  949,  949,
+      949, 1054, 1054,  947,  947,  947,  947,  947,  950,  948,
+      948,  948,  948,  948, 1054, 1054,  950,  950,  950,  950,
+      950,  950, 1054,  949,  949,  949,  949,  949, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054,  950,  950,  950,  950,  950,  398,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054,  399,  399,  399,
+
+      399,  399,  399,  399,  399,  399,  399,  399,  399,  399,
+      399,  399,  399,  399,  399,  399,  399,  399,  399,  399,
+     1054,  400, 1054, 1054,  399,  399,  399,  399,  399,  399,
+      399,  399,  399,  399,  399,  399,  399,  399, 1054, 1054,
+     1054, 1054,  401,  402,  403,  404,  404,  404,  404,  404,
+      404,  404,  404,  404,  405,  406,  406,  407, 1054,  408,
+      409,  410, 1054,  411,  412,  413,  414,  415,  416,  417,
+      418,  951,  419,  420,  421, 1054, 1054,  952, 1054,  951,
+      951,  951,  951,  951,  951,  952,  952,  952,  952,  952,
+      952,  953, 1054, 1054, 1054, 1054, 1054, 1054, 1054,  953,
+
+      953,  953,  953,  953,  953, 1054, 1054,  951,  951,  951,
+      951,  951,  954,  952,  952,  952,  952,  952, 1054, 1054,
+      954,  954,  954,  954,  954,  954,  961,  953,  953,  953,
+      953,  953,  962, 1054,  961,  961,  961,  961,  961,  961,
+      962,  962,  962,  962,  962,  962,  963, 1054,  954,  954,
+      954,  954,  954, 1054,  963,  963,  963,  963,  963,  963,
+     1054, 1054,  961,  961,  961,  961,  961,  965,  962,  962,
+      962,  962,  962, 1054, 1054,  965,  965,  965,  965,  965,
+      965,  966,  963,  963,  963,  963,  963,  969, 1054,  966,
+      966,  966,  966,  966,  966,  969,  969,  969,  969,  969,
+
+      969,  970, 1054,  965,  965,  965,  965,  965, 1054,  970,
+      970,  970,  970,  970,  970, 1054, 1054,  966,  966,  966,
+      966,  966,  971,  969,  969,  969,  969,  969, 1054, 1054,
+      971,  971,  971,  971,  971,  971,  972,  970,  970,  970,
+      970,  970,  973, 1054,  972,  972,  972,  972,  972,  972,
+      973,  973,  973,  973,  973,  973,  974, 1054,  971,  971,
+      971,  971,  971, 1054,  974,  974,  974,  974,  974,  974,
+     1054, 1054,  972,  972,  972,  972,  972,  975,  973,  973,
+      973,  973,  973, 1054, 1054,  975,  975,  975,  975,  975,
+      975,  976,  974,  974,  974,  974,  974,  977, 1054,  976,
+
+      976,  976,  976,  976,  976,  977,  977,  977,  977,  977,
+      977,  978, 1054,  975,  975,  975,  975,  975, 1054,  978,
+      978,  978,  978,  978,  978, 1054, 1054,  976,  976,  976,
+      976,  976,  979,  977,  977,  977,  977,  977, 1054, 1054,
+      979,  979,  979,  979,  979,  979,  980,  978,  978,  978,
+      978,  978,  981, 1054,  980,  980,  980,  980,  980,  980,
+      981,  981,  981,  981,  981,  981,  982, 1054,  979,  979,
+      979,  979,  979, 1054,  982,  982,  982,  982,  982,  982,
+     1054, 1054,  980,  980,  980,  980,  980,  983,  981,  981,
+      981,  981,  981, 1054, 1054,  983,  983,  983,  983,  983,
+
+      983,  984,  982,  982,  982,  982,  982,  991, 1054,  984,
+      984,  984,  984,  984,  984,  991,  991,  991,  991,  991,
+      991,  992, 1054,  983,  983,  983,  983,  983, 1054,  992,
+      992,  992,  992,  992,  992, 1054, 1054,  984,  984,  984,
+      984,  984,  993,  991,  991,  991,  991,  991, 1054, 1054,
+      993,  993,  993,  993,  993,  993,  994,  992,  992,  992,
+      992,  992,  995, 1054,  994,  994,  994,  994,  994,  994,
+      995,  995,  995,  995,  995,  995,  997, 1054,  993,  993,
+      993,  993,  993, 1054,  997,  997,  997,  997,  997,  997,
+     1054, 1054,  994,  994,  994,  994,  994,  750,  995,  995,
+
+      995,  995,  995, 1054, 1054,  750,  750,  750,  750,  750,
+      750,  998,  997,  997,  997,  997,  997,  999, 1054,  998,
+      998,  998,  998,  998,  998,  999,  999,  999,  999,  999,
+      999, 1000, 1054,  750,  750,  750,  750,  750, 1054, 1000,
+     1000, 1000, 1000, 1000, 1000, 1054, 1054,  998,  998,  998,
+      998,  998, 1001,  999,  999,  999,  999,  999, 1054, 1054,
+     1001, 1001, 1001, 1001, 1001, 1001,  777, 1000, 1000, 1000,
+     1000, 1000, 1002, 1054,  777,  777,  777,  777,  777,  777,
+     1002, 1002, 1002, 1002, 1002, 1002, 1003, 1054, 1001, 1001,
+     1001, 1001, 1001, 1054, 1003, 1003, 1003, 1003, 1003, 1003,
+
+     1054, 1054,  777,  777,  777,  777,  777, 1004, 1002, 1002,
+     1002, 1002, 1002, 1054, 1054, 1004, 1004, 1004, 1004, 1004,
+     1004, 1005, 1003, 1003, 1003, 1003, 1003, 1006, 1054, 1005,
+     1005, 1005, 1005, 1005, 1005, 1006, 1006, 1006, 1006, 1006,
+     1006, 1007, 1054, 1004, 1004, 1004, 1004, 1004, 1054, 1007,
+     1007, 1007, 1007, 1007, 1007, 1054, 1054, 1005, 1005, 1005,
+     1005, 1005, 1010, 1006, 1006, 1006, 1006, 1006, 1054, 1054,
+     1010, 1010, 1010, 1010, 1010, 1010, 1011, 1007, 1007, 1007,
+     1007, 1007, 1012, 1054, 1011, 1011, 1011, 1011, 1011, 1011,
+     1012, 1012, 1012, 1012, 1012, 1012, 1013, 1054, 1010, 1010,
+
+     1010, 1010, 1010, 1054, 1013, 1013, 1013, 1013, 1013, 1013,
+     1054, 1054, 1011, 1011, 1011, 1011, 1011, 1015, 1012, 1012,
+     1012, 1012, 1012, 1054, 1054, 1015, 1015, 1015, 1015, 1015,
+     1015, 1016, 1013, 1013, 1013, 1013, 1013, 1017, 1054, 1016,
+     1016, 1016, 1016, 1016, 1016, 1017, 1017, 1017, 1017, 1017,
+     1017, 1018, 1054, 1015, 1015, 1015, 1015, 1015, 1054, 1018,
+     1018, 1018, 1018, 1018, 1018, 1054, 1054, 1016, 1016, 1016,
+     1016, 1016, 1019, 1017, 1017, 1017, 1017, 1017, 1054, 1054,
+     1019, 1019, 1019, 1019, 1019, 1019, 1020, 1018, 1018, 1018,
+     1018, 1018, 1021, 1054, 1020, 1020, 1020, 1020, 1020, 1020,
+
+     1021, 1021, 1021, 1021, 1021, 1021, 1022, 1054, 1019, 1019,
+     1019, 1019, 1019, 1054, 1022, 1022, 1022, 1022, 1022, 1022,
+     1054, 1054, 1020, 1020, 1020, 1020, 1020, 1023, 1021, 1021,
+     1021, 1021, 1021, 1054, 1054, 1023, 1023, 1023, 1023, 1023,
+     1023, 1024, 1022, 1022, 1022, 1022, 1022, 1025, 1054, 1024,
+     1024, 1024, 1024, 1024, 1024, 1025, 1025, 1025, 1025, 1025,
+     1025, 1027, 1054, 1023, 1023, 1023, 1023, 1023, 1054, 1027,
+     1027, 1027, 1027, 1027, 1027, 1054, 1054, 1024, 1024, 1024,
+     1024, 1024, 1028, 1025, 1025, 1025, 1025, 1025, 1054, 1054,
+     1028, 1028, 1028, 1028, 1028, 1028, 1029, 1027, 1027, 1027,
+
+     1027, 1027, 1030, 1054, 1029, 1029, 1029, 1029, 1029, 1029,
+     1030, 1030, 1030, 1030, 1030, 1030, 1031, 1054, 1028, 1028,
+     1028, 1028, 1028, 1054, 1031, 1031, 1031, 1031, 1031, 1031,
+     1054, 1054, 1029, 1029, 1029, 1029, 1029, 1032, 1030, 1030,
+     1030, 1030, 1030, 1054, 1054, 1032, 1032, 1032, 1032, 1032,
+     1032, 1033, 1031, 1031, 1031, 1031, 1031, 1034, 1054, 1033,
+     1033, 1033, 1033, 1033, 1033, 1034, 1034, 1034, 1034, 1034,
+     1034, 1035, 1054, 1032, 1032, 1032, 1032, 1032, 1054, 1035,
+     1035, 1035, 1035, 1035, 1035, 1054, 1054, 1033, 1033, 1033,
+     1033, 1033, 1036, 1034, 1034, 1034, 1034, 1034, 1054, 1054,
+
+     1036, 1036, 1036, 1036, 1036, 1036, 1037, 1035, 1035, 1035,
+     1035, 1035, 1038, 1054, 1037, 1037, 1037, 1037, 1037, 1037,
+     1038, 1038, 1038, 1038, 1038, 1038, 1039, 1054, 1036, 1036,
+     1036, 1036, 1036, 1054, 1039, 1039, 1039, 1039, 1039, 1039,
+     1054, 1054, 1037, 1037, 1037, 1037, 1037, 1040, 1038, 1038,
+     1038, 1038, 1038, 1054, 1054, 1040, 1040, 1040, 1040, 1040,
+     1040, 1042, 1039, 1039, 1039, 1039, 1039, 1043, 1054, 1042,
+     1042, 1042, 1042, 1042, 1042, 1043, 1043, 1043, 1043, 1043,
+     1043, 1044, 1054, 1040, 1040, 1040, 1040, 1040, 1054, 1044,
+     1044, 1044, 1044, 1044, 1044, 1054, 1054, 1042, 1042, 1042,
+
+     1042, 1042, 1045, 1043, 1043, 1043, 1043, 1043, 1054, 1054,
+     1045, 1045, 1045, 1045, 1045, 1045, 1046, 1044, 1044, 1044,
+     1044, 1044,  265, 1047, 1046, 1046, 1046, 1046, 1046, 1046,
+     1054, 1047, 1047, 1047, 1047, 1047, 1047, 1048, 1045, 1045,
+     1045, 1045, 1045, 1054, 1054, 1048, 1048, 1048, 1048, 1048,
+     1048, 1054, 1046, 1046, 1046, 1046, 1046, 1054, 1054, 1047,
+     1047, 1047, 1047, 1047, 1054, 1054, 1054,   77, 1054, 1054,
+     1054, 1054, 1054, 1048, 1048, 1048, 1048, 1048, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1049, 1054, 1054,
+     1054, 1054, 1054,   78, 1054, 1049, 1049, 1049, 1049, 1049,
+
+     1049, 1054, 1054,   79, 1054,   80,   80,   80,   80,   80,
+       80,   81,   82,   82,   82,   82,   83,   84,   84,   85,
+       86,   87,  324, 1049, 1049, 1049, 1049, 1049, 1050, 1054,
+     1054, 1054, 1054, 1054, 1051, 1054, 1050, 1050, 1050, 1050,
+     1050, 1050, 1051, 1051, 1051, 1051, 1051, 1051, 1052, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1052, 1052, 1052, 1052,
+     1052, 1052, 1054,  112, 1050, 1050, 1050, 1050, 1050, 1054,
+     1051, 1051, 1051, 1051, 1051, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1053, 1054, 1052, 1052, 1052, 1052, 1052,  113,
+     1053, 1053, 1053, 1053, 1053, 1053, 1054, 1054, 1054,  114,
+
+     1054,  115,  115,  115,  115,  115,  115,  116,  117,  117,
+      117,  117,  118,  119,  119,  120,  121,  122, 1053, 1053,
+     1053, 1053, 1053,  526, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,  527, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054,  528, 1054, 1054, 1054, 1054, 1054,
+
+     1054, 1054, 1054, 1054,  529, 1054,  530,  530,  530,  530,
+      530,  530,  531,  532,  532,  532,  532,  533,  534,  534,
+      535,  536,  537,  576, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054,  577, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+      578, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+
+      579, 1054,  580,  580,  580,  580,  580,  580,  581,  582,
+      582,  582,  582,  583,  584,  584,  585,  586,  587,   75,
+     1054,   75,   75,   75,   75, 1054,   75, 1054,   75,  110,
+     1054,  110,  110,  110,  110, 1054,  110, 1054,  110,  150,
+      150,  150,  150, 1054,  150, 1054,  150,  245,  245,  245,
+      245,  246,  246,  246,  246,  248,  248,  248,  248,  249,
+      249,  249,  249,  250,  250,  250,  250,  251,  251,  251,
+      251,  253,  253,  253,  253,  256,  256,  256,  256,  259,
+      259,  259,  259,  264,  264,  264,  264,   75, 1054,   75,
+       75,   75,   75, 1054,   75, 1054,   75,  270,  270,  270,
+
+      271,  271,  271,   75,   75,   75,   75,  273,  273,  273,
+      273,  275,  275,  275,  275,  277,  277,  277,  277,  305,
+      305,  305,  305,  306,  306,  306,  306,  308,  308,  308,
+      308,  309,  309,  309,  309,   88,   88,   88,   88,  310,
+      310,  310,  310,  312,  312,  312,  312,  315,  315,  315,
+      315,  318,  318,  318,  318,  323,  323,  323,  323,  110,
+     1054,  110,  110,  110,  110, 1054,  110, 1054,  110,  329,
+      329,  329,  330,  330,  330,  110,  110,  110,  110,  332,
+      332,  332,  332,  334,  334,  334,  334,  336,  336,  336,
+      336,  370,  370,  370,  370,  371,  371,  371,  371,  373,
+
+      373,  373,  373,  374,  374,  374,  374,  129,  129,  129,
+      129,  375,  375,  375,  375,  377,  377,  377,  377,  380,
+      380,  380,  380,  383,  383,  383,  383,  388,  388,  388,
+      388,  150,  150,  150,  150, 1054,  150, 1054,  150,  389,
+      389,  389,  390,  390,  390,  150,  150,  150,  150,  392,
+      392,  392,  392,  394,  394,  394,  394,  396,  396,  396,
+      396,  424,  424,  424,  424,  425,  425,  425,  425,  427,
+      427,  427,  427,  428,  428,  428,  428,  164,  164,  164,
+      164,  429,  429,  429,  429,  431,  431,  431,  431,  434,
+      434,  434,  434,  437,  437,  437,  437,  442,  442,  442,
+
+      442,  185, 1054,  185,  449,  449,  449,  449,  450,  450,
+      450,  450,  452,  452,  452,  452,  453,  453,  453,  453,
+      189,  189,  189,  189,  186,  186, 1054,  186,  454,  454,
+      454,  454,  456,  456,  456,  456,  459,  459,  459,  459,
+      462,  462,  462,  462,  467,  467,  467,  467,  251,  251,
+      251,  251,  518,  518,  518,  518,  245,  245,  245,  245,
+      519,  519,  519,  519,  520,  520,  520,  520,  521,  521,
+      521,  521,  523,  523,  523,  523,  524,  524,  524,  524,
+      525,  525,  525,  525,  525,  525, 1054,  525, 1054,  525,
+       75, 1054,   75,   75,   75,   75, 1054,   75, 1054,   75,
+
+      271,  271,  271,  271,   75,   75,   75,   75,  540,  540,
+      540,  540,  541,  541,  541,  541,  542,  542,  542,  542,
+      543,  543,  543,  543,  547,  547,  547,  547,  548,  548,
+      548,  548,  550,  550,  550,  550,  551,  551,  551,  551,
+      280,  280,  280,  280,  279,  279, 1054,  279,  552,  552,
+      552,  552,  554,  554,  554,  554,  557,  557,  557,  557,
+      560,  560,  560,  560,  565,  565,  565,  565,  310,  310,
+      310,  310,  568,  568,  568,  568,  305,  305,  305,  305,
+      569,  569,  569,  569,  570,  570,  570,  570,  571,  571,
+      571,  571,  573,  573,  573,  573,  574,  574,  574,  574,
+
+      575,  575,  575,  575,  575,  575, 1054,  575, 1054,  575,
+      110, 1054,  110,  110,  110,  110, 1054,  110, 1054,  110,
+      330,  330,  330,  330,  110,  110,  110,  110,  590,  590,
+      590,  590,  591,  591,  591,  591,  592,  592,  592,  592,
+      593,  593,  593,  593,  601,  601,  601,  601,  602,  602,
+      602,  602,  604,  604,  604,  604,  605,  605,  605,  605,
+      345,  345,  345,  345,  343,  343, 1054,  343,  606,  606,
+      606,  606,  608,  608,  608,  608,  611,  611,  611,  611,
+      614,  614,  614,  614,  619,  619,  619,  619,  375,  375,
+      375,  375,  622,  622,  622,  622,  370,  370,  370,  370,
+
+      623,  623,  623,  623,  624,  624,  624,  624,  625,  625,
+      625,  625,  627,  627,  627,  627,  628,  628,  628,  628,
+      390,  390,  390,  390,  150,  150,  150,  150,  629,  629,
+      629,  629,  630,  630,  630,  630,  631,  631,  631,  631,
+      632,  632,  632,  632,  636,  636,  636,  636,  637,  637,
+      637,  637,  639,  639,  639,  639,  640,  640,  640,  640,
+      399,  399,  399,  399,  398,  398, 1054,  398,  641,  641,
+      641,  641,  643,  643,  643,  643,  646,  646,  646,  646,
+      649,  649,  649,  649,  654,  654,  654,  654,  429,  429,
+      429,  429,  657,  657,  657,  657,  424,  424,  424,  424,
+
+      658,  658,  658,  658,  659,  659,  659,  659,  660,  660,
+      660,  660,  662,  662,  662,  662,  663,  663,  663,  663,
+      664,  664,  454,  454,  454,  454,  667,  667,  667,  667,
+      449,  449,  449,  449,  668,  668,  668,  668,  669,  669,
+      669,  669,  670,  670,  670,  670,  672,  672,  672,  672,
+      673,  673,  673,  673,  723,  723,  723,  723,  724,  724,
+      724,  724,  726,  726,  726,  726,  727,  727,  727,  727,
+      491,  491,  491,  491,  728,  728,  728,  728,  730,  730,
+      730,  730,  733,  733,  733,  733,  736,  736,  736,  736,
+      741,  741,  741,  741,  748,  748,  748,  748,  525,  525,
+
+      525,  525,  525,  525, 1054,  525, 1054,  525,  753,  753,
+      753,  754,  754,  754,  525,  525,  525,  525,  756,  756,
+      756,  756,  758,  758,  758,  758,  760,  760,  760,  760,
+       75, 1054,   75,   75,   75,   75, 1054,   75, 1054,   75,
+       75,   75,   75,   75,  271,  271,  271,  271,  552,  552,
+      552,  552,  766,  766,  766,  766,  547,  547,  547,  547,
+      767,  767,  767,  767,  768,  768,  768,  768,  769,  769,
+      769,  769,  771,  771,  771,  771,  772,  772,  772,  772,
+      775,  775,  775,  775,  575,  575,  575,  575,  575,  575,
+     1054,  575, 1054,  575,  780,  780,  780,  781,  781,  781,
+
+      575,  575,  575,  575,  783,  783,  783,  783,  785,  785,
+      785,  785,  787,  787,  787,  787,  110, 1054,  110,  110,
+      110,  110, 1054,  110, 1054,  110,  110,  110,  110,  110,
+      330,  330,  330,  330,  606,  606,  606,  606,  793,  793,
+      793,  793,  601,  601,  601,  601,  794,  794,  794,  794,
+      795,  795,  795,  795,  796,  796,  796,  796,  798,  798,
+      798,  798,  799,  799,  799,  799,  802,  802,  802,  802,
+      150,  150,  150,  150, 1054,  150, 1054,  150,  150,  150,
+      150,  150,  390,  390,  390,  390,  641,  641,  641,  641,
+      805,  805,  805,  805,  636,  636,  636,  636,  806,  806,
+
+      806,  806,  807,  807,  807,  807,  808,  808,  808,  808,
+      810,  810,  810,  810,  811,  811,  811,  811,  814,  814,
+      814,  814,  664,  664,  664,  817,  817,  817,  817,  841,
+      841,  841,  841,  842,  842,  842,  842,  844,  844,  844,
+      844,  845,  845,  845,  845,  698,  698,  698,  698,  696,
+      696, 1054,  696,  846,  846,  846,  846,  848,  848,  848,
+      848,  851,  851,  851,  851,  854,  854,  854,  854,  859,
+      859,  859,  859,  728,  728,  728,  728,  862,  862,  862,
+      862,  723,  723,  723,  723,  863,  863,  863,  863,  864,
+      864,  864,  864,  865,  865,  865,  865,  867,  867,  867,
+
+      867,  868,  868,  868,  868,  525,  525,  525,  525,  525,
+      525, 1054,  525, 1054,  525,  754,  754,  754,  754,  525,
+      525,  525,  525,  877,  877,  877,  877,  878,  878,  878,
+      878,  879,  879,  879,  879,  880,  880,  880,  880,  885,
+      885,  885,  885,  575,  575,  575,  575,  575,  575, 1054,
+      575, 1054,  575,  781,  781,  781,  781,  575,  575,  575,
+      575,  891,  891,  891,  891,  892,  892,  892,  892,  893,
+      893,  893,  893,  894,  894,  894,  894,  899,  899,  899,
+      899,  904,  904,  904,  904,  846,  846,  846,  846,  923,
+      923,  923,  923,  841,  841,  841,  841,  924,  924,  924,
+
+      924,  925,  925,  925,  925,  926,  926,  926,  926,  928,
+      928,  928,  928,  929,  929,  929,  929,  932,  932,  932,
+      932,  525,  525,  525,  525,  525,  525, 1054,  525, 1054,
+      525,  525,  525,  525,  525,  754,  754,  754,  754,  575,
+      575,  575,  575,  575,  575, 1054,  575, 1054,  575,  575,
+      575,  575,  575,  781,  781,  781,  781,  964,  964,  964,
+      964,   75, 1054,   75,   75,   75,   75, 1054,   75, 1054,
+       75,  110, 1054,  110,  110,  110,  110, 1054,  110, 1054,
+      110,    3, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054
+    } ;
+
+static yyconst short int yy_chk[8589] =
+    {   0,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+
+        1,    1,    1,    1,    1,    1,    5,    5,    5,    5,
+        7,   11,   11,   11,   11,   19,   28,   19,   29,   30,
+       34,   29,   11,   30,   33,   33,   32,   30,   34,   19,
+       28,   35,   36,   28,   32,   32,   30,   34,   28,   37,
+       37,   38,   36,   36,   36,   39,   40,   41,   35,   43,
+       40,   49, 1058,   48,   38,    7,   19,   41,   39,   39,
+       42,   42,   42,   42,   48,   50, 1026,   62,   62,   62,
+       43,   62,   49,   56,   56,   56,   56,   56,   56,   56,
+     1009,    7,   70,   70,   70,   50,   59,   59,   59,   59,
+       59,    7,  996,    7,    7,    7,    7,    7,    7,    7,
+
+        7,    7,    7,    7,    7,    7,    7,    7,    7,    7,
+        8,   42,   73,   73,   73,   73,  989,  985,    8,    8,
+        8,    8,    8,    8,    8,    8,    8,    8,    8,    8,
+        8,    8,    8,    8,    8,    8,    8,    8,    8,    8,
+        8,   89,    8,  968,  960,    8,    8,    8,    8,    8,
+        8,    8,    8,    8,    8,    8,    8,    8,    8,  106,
+      106,  106,   89,    8,    8,    8,    8,    8,    8,    8,
+        8,    8,    8,    8,    8,    8,    8,    8,    8,  745,
+      959,    8,    8,  958,    8,    8,    8,    8,    8,    8,
+        8,    8,  745,    8,    8,    8,   10,   57,   57,   57,
+
+       57,   57,   57,   57,   60,   60,   60,   60,   60,   60,
+       60,   60,  957,   60,   60,   60,   60,  130,   60,   60,
+       60,   64,   64,   64,   64,   64,   64,   64,   66,   66,
+       81,   81,   81,   81,   81,   81,   81,   10,  130,  956,
+       66,   66,   66,   66,   69,   69,   69,   69,   69,   69,
+       69,   69,   69,   69,   87,   87,   87,   87,   87,   87,
+      147,  147,  147,   10,   92,   92,   92,   92,   92,   92,
+       92,  955,  934,   10,  933,   10,   10,   10,   10,   10,
+       10,   10,   10,   10,   10,   10,   10,   10,   10,   10,
+       10,   10,   20,   20,   20,   20,   20,   20,   20,   20,
+
+       20,   20,   20,   20,   20,   20,   20,   20,   20,   20,
+       20,   20,   20,   20,   20,  165,   20,  916,  914,   20,
+       20,   20,   20,   20,   20,   20,   20,   20,   20,   20,
+       20,   20,   20,  182,  182,  182,  165,   20,   20,   20,
+       20,   20,   20,   20,   20,   20,   20,   20,   20,   20,
+       20,   20,   20,   77,  912,   20,   20,   77,   20,   20,
+       20,   20,   20,   20,   20,   20,  911,   20,   20,   20,
+       22,   22,   71,   71,   71,   71,   71,   71,   71,   71,
+       71,   71,   83,   83,   83,   83,   83,   83,   83,   83,
+       83,   83,  125,   77,  910,   98,   98,   98,   77,   98,
+
+      128,  190,  128,   77,  125,  128,   77,  909,  872,  190,
+       77,   77,  191,   77,   77,   93,   93,   93,   93,   93,
+       93,   93,  870,  853,   22,   95,   95,   95,   95,   95,
+      338,  125,  338,  191,   22,  338,   22,   22,   22,   22,
+       22,   22,   22,   22,   22,   22,   22,   22,   22,   22,
+       22,   22,   22,   25,  100,  100,  100,  100,  100,  100,
+      100,   25,   25,   25,   25,   25,   25,   25,   25,   25,
+       25,   25,   25,   25,   25,   25,   25,   25,   25,   25,
+       25,   25,   25,   25,  281,   25,  833,  831,   25,   25,
+       25,   25,   25,   25,   25,   25,   25,   25,   25,   25,
+
+       25,   25,  210,  210,  210,  281,   25,   25,   25,   25,
+       25,   25,   25,   25,   25,   25,   25,   25,   25,   25,
+       25,   25,  829,  828,   25,   25,  825,   25,   25,   25,
+       25,   25,   25,   25,   25,  823,   25,   25,   25,   27,
+       27,  822,   27,   27,  122,  122,  122,  122,  122,  122,
+       27,   27,   27,   27,   27,   27,   27,   27,   27,   27,
+       27,   27,   27,   27,   27,   27,   27,   27,   27,   27,
+       27,   27,   27,  346,   27,  821,  820,   27,   27,   27,
+       27,   27,   27,   27,   27,   27,   27,   27,   27,   27,
+       27,  300,  300,  300,  346,   27,   27,   27,   27,   27,
+
+       27,   27,   27,   27,   27,   27,   27,   27,   27,   27,
+       27,  819,   27,   27,   27,  781,   27,   27,   27,   27,
+       27,   27,   27,   27,  744,   27,   27,   27,   75,   85,
+       85,   85,   85,   85,   85,   85,   85,   85,   85,   96,
+       96,   96,   96,   96,   96,   96,   96,  744,   96,   96,
+       96,   96,  754,   96,   96,   96,  102,  102,  105,  105,
+      105,  105,  105,  105,  105,  105,  105,  105,  102,  102,
+      102,  102,  743,   75,  107,  107,  107,  107,  107,  107,
+      107,  107,  107,  107,  116,  116,  116,  116,  116,  116,
+      116,  123,  123,  123,  123,  126,  139,  139,  139,   75,
+
+      139,  748,  123,  743,  174,  174,  174,  126,  174,   75,
+      747,   75,   75,   75,   75,   75,   75,   75,   75,   75,
+       75,   75,   75,   75,   75,   75,   75,   75,   88,  136,
+      136,  136,  136,  136,  126,  735,   88,   88,   88,   88,
+       88,   88,   88,   88,   88,   88,   88,   88,   88,   88,
+       88,   88,   88,   88,   88,   88,   88,   88,   88,  400,
+       88,  731,  715,   88,   88,   88,   88,   88,   88,   88,
+       88,   88,   88,   88,   88,   88,   88,  365,  365,  365,
+      400,   88,   88,   88,   88,   88,   88,   88,   88,   88,
+       88,   88,   88,   88,   88,   88,   88,  707,   88,   88,
+
+       88,  700,   88,   88,   88,   88,   88,   88,   88,   88,
+      693,   88,   88,   88,  110,  692,  112,  419,  419,  419,
+      112,  118,  118,  118,  118,  118,  118,  118,  118,  118,
+      118,  120,  120,  120,  120,  120,  120,  120,  120,  120,
+      120,  746,  457,  127,  691,  127,  133,  133,  133,  133,
+      133,  133,  133,  457,  690,  110,  112,  127,  202,  202,
+      202,  112,  202,  689,  746,  242,  112,  688,  687,  112,
+      686,  492,  242,  112,  112,  242,  112,  112,  292,  292,
+      292,  110,  292,  242,  127,  162,  162,  162,  162,  162,
+      162,  110,  492,  110,  110,  110,  110,  110,  110,  110,
+
+      110,  110,  110,  110,  110,  110,  110,  110,  110,  110,
+      129,  129,  685,  129,  134,  134,  134,  134,  134,  134,
+      134,  129,  129,  129,  129,  129,  129,  129,  129,  129,
+      129,  129,  129,  129,  129,  129,  129,  129,  129,  129,
+      129,  129,  129,  129,  699,  129,  684,  683,  129,  129,
+      129,  129,  129,  129,  129,  129,  129,  129,  129,  129,
+      129,  129,  509,  509,  509,  699,  129,  129,  129,  129,
+      129,  129,  129,  129,  129,  129,  129,  129,  129,  129,
+      129,  129,  682,  129,  129,  129,  680,  129,  129,  129,
+      129,  129,  129,  129,  129,  679,  129,  129,  129,  137,
+
+      137,  137,  137,  137,  137,  137,  137,  678,  137,  137,
+      137,  137,  677,  137,  137,  137,  141,  141,  141,  141,
+      141,  141,  141,  143,  143,  146,  146,  146,  146,  146,
+      146,  146,  146,  146,  146,  143,  143,  143,  143,  148,
+      148,  148,  148,  148,  148,  148,  148,  148,  148,  150,
+      156,  156,  156,  156,  156,  156,  156,  158,  158,  158,
+      158,  158,  158,  158,  158,  158,  158,  160,  160,  160,
+      160,  160,  160,  160,  160,  160,  160,  168,  168,  168,
+      168,  168,  168,  168,  169,  169,  169,  169,  169,  169,
+      169,  171,  171,  171,  171,  171,  198,  198,  198,  198,
+
+      198,  339,  150,  176,  176,  176,  176,  176,  176,  176,
+      676,  675,  150,  339,  150,  150,  150,  150,  150,  150,
+      150,  150,  150,  150,  150,  150,  150,  150,  150,  150,
+      150,  151,  172,  172,  172,  172,  172,  172,  172,  172,
+      339,  172,  172,  172,  172,  664,  172,  172,  172,  178,
+      178,  181,  181,  181,  181,  181,  181,  181,  181,  181,
+      181,  178,  178,  178,  178,  183,  183,  183,  183,  183,
+      183,  183,  183,  183,  183,  194,  194,  194,  194,  194,
+      194,  194,  555,  648,  151,  196,  196,  196,  196,  196,
+      196,  196,  613,  555,  151,  597,  151,  151,  151,  151,
+
+      151,  151,  151,  151,  151,  151,  151,  151,  151,  151,
+      151,  151,  151,  164,  204,  204,  204,  204,  204,  204,
+      204,  164,  164,  164,  164,  164,  164,  164,  164,  164,
+      164,  164,  164,  164,  164,  164,  164,  164,  164,  164,
+      164,  164,  164,  164,  596,  164,  595,  594,  164,  164,
+      164,  164,  164,  164,  164,  164,  164,  164,  164,  164,
+      164,  164,  718,  718,  718,  559,  164,  164,  164,  164,
+      164,  164,  164,  164,  164,  164,  164,  164,  164,  164,
+      164,  164,  517,  164,  164,  164,  516,  164,  164,  164,
+      164,  164,  164,  164,  164,  515,  164,  164,  164,  186,
+
+      186,  514,  186,  186,  255,  255,  255,  255,  255,  513,
+      186,  186,  186,  186,  186,  186,  186,  186,  186,  186,
+      186,  186,  186,  186,  186,  186,  186,  186,  186,  186,
+      186,  186,  186,  512,  186,  506,  488,  186,  186,  186,
+      186,  186,  186,  186,  186,  186,  186,  186,  186,  186,
+      186,  487,  485,  484,  483,  186,  186,  186,  186,  186,
+      186,  186,  186,  186,  186,  186,  186,  186,  186,  186,
+      186,  482,  186,  186,  186,  481,  186,  186,  186,  186,
+      186,  186,  186,  186,  480,  186,  186,  186,  188,  188,
+      188,  188,  188,  188,  188,  188,  188,  188,  188,  188,
+
+      188,  188,  188,  188,  188,  188,  188,  188,  188,  188,
+      188,  479,  188,  478,  477,  188,  188,  188,  188,  188,
+      188,  188,  188,  188,  188,  188,  188,  188,  188,  476,
+      475,  474,  473,  188,  188,  188,  188,  188,  188,  188,
+      188,  188,  188,  188,  188,  188,  188,  188,  188,  472,
+      471,  188,  188,  470,  188,  188,  188,  188,  188,  188,
+      188,  188,  469,  188,  188,  188,  200,  200,  200,  200,
+      200,  200,  200,  200,  468,  200,  200,  200,  200,  461,
+      200,  200,  200,  206,  206,  209,  209,  209,  209,  209,
+      209,  209,  209,  209,  209,  206,  206,  206,  206,  211,
+
+      211,  211,  211,  211,  211,  211,  211,  211,  211,  235,
+      235,  235,  235,  237,  262,  262,  262,  262,  262,  238,
+      436,  237,  237,  237,  237,  237,  237,  238,  238,  238,
+      238,  238,  238,  284,  284,  284,  284,  284,  284,  284,
+      286,  286,  286,  286,  286,  286,  286,  432,  416,  237,
+      237,  237,  237,  237,  408,  238,  238,  238,  238,  238,
+      235,  240,  240,  240,  240,  240,  240,  240,  240,  240,
+      240,  240,  240,  240,  240,  240,  240,  240,  240,  240,
+      240,  240,  240,  240,  401,  240,  390,  382,  240,  240,
+      240,  240,  240,  240,  240,  240,  240,  240,  240,  240,
+
+      240,  240,  378,  362,  354,  347,  240,  240,  240,  240,
+      240,  240,  240,  240,  240,  240,  240,  240,  240,  240,
+      240,  240,  342,  341,  240,  240,  330,  240,  240,  240,
+      240,  240,  240,  240,  240,  268,  240,  240,  240,  266,
+      317,  269,  313,  268,  268,  268,  268,  268,  268,  269,
+      269,  269,  269,  269,  269,  288,  288,  288,  288,  288,
+      294,  294,  294,  294,  294,  294,  294,  297,  289,  282,
+      271,  268,  268,  268,  268,  268,  258,  269,  269,  269,
+      269,  269,  609,  254,  266,  290,  290,  290,  290,  290,
+      290,  290,  290,  609,  290,  290,  290,  290,  644,  290,
+
+      290,  290,  296,  296,  314,  314,  314,  314,  314,  644,
+      266,  243,  241,  234,  296,  296,  296,  296,  233,  232,
+      266,  231,  266,  266,  266,  266,  266,  266,  266,  266,
+      266,  266,  266,  266,  266,  266,  266,  266,  266,  267,
+      299,  299,  299,  299,  299,  299,  299,  299,  299,  299,
+      301,  301,  301,  301,  301,  301,  301,  301,  301,  301,
+      303,  321,  321,  321,  321,  321,  304,  230,  303,  303,
+      303,  303,  303,  303,  304,  304,  304,  304,  304,  304,
+      340,  229,  340,  849,  267,  340,  349,  349,  349,  349,
+      349,  349,  349,  228,  849,  227,  303,  303,  303,  303,
+
+      303,  226,  304,  304,  304,  304,  304,  225,  224,  223,
+      267,  351,  351,  351,  351,  351,  351,  351,  222,  221,
+      267,  220,  267,  267,  267,  267,  267,  267,  267,  267,
+      267,  267,  267,  267,  267,  267,  267,  267,  267,  279,
+      353,  353,  353,  353,  353,  219,  218,  279,  279,  279,
+      279,  279,  279,  279,  279,  279,  279,  279,  279,  279,
+      279,  279,  279,  279,  279,  279,  279,  279,  279,  279,
+      217,  279,  216,  214,  279,  279,  279,  279,  279,  279,
+      279,  279,  279,  279,  279,  279,  279,  279,  213,  207,
+      199,  192,  279,  279,  279,  279,  279,  279,  279,  279,
+
+      279,  279,  279,  279,  279,  279,  279,  279,  187,  279,
+      279,  279,  185,  279,  279,  279,  279,  279,  279,  279,
+      279,  327,  279,  279,  279,  325,  179,  144,  111,  327,
+      327,  327,  327,  327,  327,  328,  357,  357,  357,  103,
+      357,   76,   67,  328,  328,  328,  328,  328,  328,  359,
+      359,  359,  359,  359,  359,  359,   52,  327,  327,  327,
+      327,  327,   47,  411,  411,  411,  325,  411,   46,   45,
+       31,  328,  328,  328,  328,  328,   24,   17,    9,  355,
+      355,  355,  355,  355,  355,  355,  355,    6,  355,  355,
+      355,  355,  325,  355,  355,  355,  379,  379,  379,  379,
+
+      379,    3,  325,    0,  325,  325,  325,  325,  325,  325,
+      325,  325,  325,  325,  325,  325,  325,  325,  325,  325,
+      325,  326,  361,  361,  364,  364,  364,  364,  364,  364,
+      364,  364,  364,  364,  361,  361,  361,  361,  366,  366,
+      366,  366,  366,  366,  366,  366,  366,  366,  386,  386,
+      386,  386,  386,    0,    0,  368,  407,  407,  407,  407,
+      407,    0,  326,  368,  368,  368,  368,  368,  368,  403,
+      403,  403,  403,  403,  403,  403,  405,  405,  405,  405,
+      405,  405,  405,  433,  433,  433,  433,  433,  326,    0,
+        0,  368,  368,  368,  368,  368,    0,    0,  326,    0,
+
+      326,  326,  326,  326,  326,  326,  326,  326,  326,  326,
+      326,  326,  326,  326,  326,  326,  326,  343,  343,    0,
+      343,  413,  413,  413,  413,  413,  413,  413,  343,  343,
+      343,  343,  343,  343,  343,  343,  343,  343,  343,  343,
+      343,  343,  343,  343,  343,  343,  343,  343,  343,  343,
+      343,    0,  343,    0,    0,  343,  343,  343,  343,  343,
+      343,  343,  343,  343,  343,  343,  343,  343,  343,    0,
+        0,    0,    0,  343,  343,  343,  343,  343,  343,  343,
+      343,  343,  343,  343,  343,  343,  343,  343,  343,    0,
+      343,  343,  343,    0,  343,  343,  343,  343,  343,  343,
+
+      343,  343,  369,  343,  343,  343,    0,    0,    0,    0,
+      369,  369,  369,  369,  369,  369,  409,  409,  409,  409,
+      409,  409,  409,  409,    0,  409,  409,  409,  409,    0,
+      409,  409,  409,  415,  415,    0,    0,    0,  369,  369,
+      369,  369,  369,  398,    0,  415,  415,  415,  415,    0,
+        0,  398,  398,  398,  398,  398,  398,  398,  398,  398,
+      398,  398,  398,  398,  398,  398,  398,  398,  398,  398,
+      398,  398,  398,  398,    0,  398,    0,    0,  398,  398,
+      398,  398,  398,  398,  398,  398,  398,  398,  398,  398,
+      398,  398,    0,    0,    0,    0,  398,  398,  398,  398,
+
+      398,  398,  398,  398,  398,  398,  398,  398,  398,  398,
+      398,  398,    0,  398,  398,  398,    0,  398,  398,  398,
+      398,  398,  398,  398,  398,    0,  398,  398,  398,  418,
+      418,  418,  418,  418,  418,  418,  418,  418,  418,  420,
+      420,  420,  420,  420,  420,  420,  420,  420,  420,  422,
+      440,  440,  440,  440,  440,  423,    0,  422,  422,  422,
+      422,  422,  422,  423,  423,  423,  423,  423,  423,  458,
+      458,  458,  458,  458,  465,  465,  465,  465,  465,  498,
+      498,  498,  498,  498,    0,  422,  422,  422,  422,  422,
+        0,  423,  423,  423,  423,  423,  444,  444,    0,  444,
+
+      444,  501,  501,  501,    0,  501,    0,  444,  444,  444,
+      444,  444,  444,  444,  444,  444,  444,  444,  444,  444,
+      444,  444,  444,  444,  444,  444,  444,  444,  444,  444,
+        0,  444,    0,    0,  444,  444,  444,  444,  444,  444,
+      444,  444,  444,  444,  444,  444,  444,  444,    0,    0,
+        0,    0,  444,  444,  444,  444,  444,  444,  444,  444,
+      444,  444,  444,  444,  444,  444,  444,  444,    0,  444,
+      444,  444,    0,  444,  444,  444,  444,  444,  444,  444,
+      444,  446,  444,  444,  444,    0,    0,  447,    0,  446,
+      446,  446,  446,  446,  446,  447,  447,  447,  447,  447,
+
+      447,  489,  495,  495,  495,  495,  495,  495,  495,  489,
+      489,  489,  489,  489,  489,    0,    0,  446,  446,  446,
+      446,  446,  490,  447,  447,  447,  447,  447,    0,    0,
+      490,  490,  490,  490,  490,  490,    0,  489,  489,  489,
+      489,  489,  496,  496,  496,  496,  496,  496,  496,  503,
+      503,  503,  503,  503,  503,  503,  505,  505,  490,  490,
+      490,  490,  490,  491,  491,    0,  491,    0,  505,  505,
+      505,  505,    0,    0,  491,  491,  491,  491,  491,  491,
+      491,  491,  491,  491,  491,  491,  491,  491,  491,  491,
+      491,  491,  491,  491,  491,  491,  491,    0,  491,    0,
+
+        0,  491,  491,  491,  491,  491,  491,  491,  491,  491,
+      491,  491,  491,  491,  491,    0,    0,    0,    0,  491,
+      491,  491,  491,  491,  491,  491,  491,  491,  491,  491,
+      491,  491,  491,  491,  491,    0,  491,  491,  491,    0,
+      491,  491,  491,  491,  491,  491,  491,  491,    0,  491,
+      491,  491,  499,  499,  499,  499,  499,  499,  499,  499,
+        0,  499,  499,  499,  499,    0,  499,  499,  499,  508,
+      508,  508,  508,  508,  508,  508,  508,  508,  508,  510,
+      510,  510,  510,  510,  510,  510,  510,  510,  510,  525,
+      527,    0,    0,    0,  527,  531,  531,  531,  531,  531,
+
+      531,  531,  533,  533,  533,  533,  533,  533,  533,  533,
+      533,  533,  535,  535,  535,  535,  535,  535,  535,  535,
+      535,  535,  537,  537,  537,  537,  537,  537,    0,    0,
+      527,    0,    0,    0,  525,  527,    0,  710,  710,  710,
+      527,  710,    0,  527,    0,    0,    0,  527,  527,    0,
+      527,  527,    0,    0,  538,  556,  556,  556,  556,  556,
+      525,    0,  538,  538,  538,  538,  538,  538,    0,    0,
+      525,    0,  525,  525,  525,  525,  525,  525,  525,  525,
+      525,  525,  525,  525,  525,  525,  525,  525,  525,  526,
+      538,  538,  538,  538,  538,    0,    0,    0,    0,  539,
+
+      563,  563,  563,  563,  563,  544,    0,  539,  539,  539,
+      539,  539,  539,  544,  544,  544,  544,  544,  544,  545,
+      581,  581,  581,  581,  581,  581,  581,  545,  545,  545,
+      545,  545,  545,    0,  526,  539,  539,  539,  539,  539,
+        0,  544,  544,  544,  544,  544,  587,  587,  587,  587,
+      587,  587,    0,    0,  566,  545,  545,  545,  545,  545,
+      526,    0,  566,  566,  566,  566,  566,  566,    0,    0,
+      526,    0,  526,  526,  526,  526,  526,  526,  526,  526,
+      526,  526,  526,  526,  526,  526,  526,  526,  526,  540,
+      566,  566,  566,  566,  566,    0,    0,    0,    0,  567,
+
+        0,  577,    0,    0,    0,  577,    0,  567,  567,  567,
+      567,  567,  567,  583,  583,  583,  583,  583,  583,  583,
+      583,  583,  583,  585,  585,  585,  585,  585,  585,  585,
+      585,  585,  585,    0,  540,  567,  567,  567,  567,  567,
+        0,  577,    0,    0,    0,    0,  577,    0,    0,    0,
+        0,  577,    0,    0,  577,  588,    0,    0,  577,  577,
+      540,  577,  577,  588,  588,  588,  588,  588,  588,    0,
+      540,    0,  540,  540,  540,  540,  540,  540,  540,  540,
+      540,  540,  540,  540,  540,  540,  540,  540,  540,  546,
+        0,  588,  588,  588,  588,  588,    0,  546,  546,  546,
+
+      546,  546,  546,  546,  546,  546,  546,  546,  546,  546,
+      546,  546,  546,  546,  546,  546,  546,  546,  546,  546,
+        0,  546,    0,    0,  546,  546,  546,  546,  546,  546,
+      546,  546,  546,  546,  546,  546,  546,  546,    0,    0,
+        0,    0,  546,  546,  546,  546,  546,  546,  546,  546,
+      546,  546,  546,  546,  546,  546,  546,  546,    0,  546,
+      546,  546,    0,  546,  546,  546,  546,  546,  546,  546,
+      546,  589,  546,  546,  546,  575,    0,    0,    0,  589,
+      589,  589,  589,  589,  589,  598,  610,  610,  610,  610,
+      610,  599,    0,  598,  598,  598,  598,  598,  598,  599,
+
+      599,  599,  599,  599,  599,  714,  714,  589,  589,  589,
+      589,  589,    0,    0,    0,    0,  575,  714,  714,  714,
+      714,  598,  598,  598,  598,  598,    0,  599,  599,  599,
+      599,  599,  617,  617,  617,  617,  617,  620,    0,    0,
+        0,    0,  575,    0,    0,  620,  620,  620,  620,  620,
+      620,    0,  575,    0,  575,  575,  575,  575,  575,  575,
+      575,  575,  575,  575,  575,  575,  575,  575,  575,  575,
+      575,  576,    0,  620,  620,  620,  620,  620,  621,  645,
+      645,  645,  645,  645,  633,    0,  621,  621,  621,  621,
+      621,  621,  633,  633,  633,  633,  633,  633,  652,  652,
+
+      652,  652,  652,  702,  702,  702,  702,  702,  702,  702,
+        0,    0,  576,    0,  621,  621,  621,  621,  621,    0,
+      633,  633,  633,  633,  633,  704,  704,  704,  704,  704,
+      704,  704,  634,  706,  706,  706,  706,  706,  576,    0,
+      634,  634,  634,  634,  634,  634,    0,    0,  576,    0,
+      576,  576,  576,  576,  576,  576,  576,  576,  576,  576,
+      576,  576,  576,  576,  576,  576,  576,  590,  634,  634,
+      634,  634,  634,  655,  732,  732,  732,  732,  732,  656,
+        0,  655,  655,  655,  655,  655,  655,  656,  656,  656,
+      656,  656,  656,  665,  712,  712,  712,  712,  712,  712,
+
+      712,  665,  665,  665,  665,  665,  665,    0,  590,  655,
+      655,  655,  655,  655,    0,  656,  656,  656,  656,  656,
+      739,  739,  739,  739,  739,    0,    0,    0,    0,  665,
+      665,  665,  665,  665,  590,  850,  850,  850,  850,  850,
+        0,    0,    0,    0,  590,    0,  590,  590,  590,  590,
+      590,  590,  590,  590,  590,  590,  590,  590,  590,  590,
+      590,  590,  590,  600,  600,    0,  600,  857,  857,  857,
+      857,  857,    0,    0,  600,  600,  600,  600,  600,  600,
+      600,  600,  600,  600,  600,  600,  600,  600,  600,  600,
+      600,  600,  600,  600,  600,  600,  600,    0,  600,    0,
+
+        0,  600,  600,  600,  600,  600,  600,  600,  600,  600,
+      600,  600,  600,  600,  600,    0,    0,    0,    0,  600,
+      600,  600,  600,  600,  600,  600,  600,  600,  600,  600,
+      600,  600,  600,  600,  600,    0,  600,  600,  600,    0,
+      600,  600,  600,  600,  600,  600,  600,  600,  666,  600,
+      600,  600,  629,    0,  694,    0,  666,  666,  666,  666,
+      666,  666,  694,  694,  694,  694,  694,  694,    0,    0,
+      695,    0,    0,    0,    0,    0,    0,    0,  695,  695,
+      695,  695,  695,  695,  666,  666,  666,  666,  666,    0,
+      694,  694,  694,  694,  694,  717,  717,  717,  717,  717,
+
+      717,  717,  717,  717,  717,  629,  695,  695,  695,  695,
+      695,    0,    0,    0,    0,  629,    0,  629,  629,  629,
+      629,  629,  629,  629,  629,  629,  629,  629,  629,  629,
+      629,  629,  629,  629,  635,    0,    0,    0,    0,    0,
+        0,    0,  635,  635,  635,  635,  635,  635,  635,  635,
+      635,  635,  635,  635,  635,  635,  635,  635,  635,  635,
+      635,  635,  635,  635,  635,    0,  635,    0,    0,  635,
+      635,  635,  635,  635,  635,  635,  635,  635,  635,  635,
+      635,  635,  635,    0,    0,    0,    0,  635,  635,  635,
+      635,  635,  635,  635,  635,  635,  635,  635,  635,  635,
+
+      635,  635,  635,    0,  635,  635,  635,    0,  635,  635,
+      635,  635,  635,  635,  635,  635,    0,  635,  635,  635,
+      667,  667,    0,  667,  667,    0,    0,    0,    0,    0,
+        0,  667,  667,  667,  667,  667,  667,  667,  667,  667,
+      667,  667,  667,  667,  667,  667,  667,  667,  667,  667,
+      667,  667,  667,  667,    0,  667,    0,    0,  667,  667,
+      667,  667,  667,  667,  667,  667,  667,  667,  667,  667,
+      667,  667,    0,    0,    0,    0,  667,  667,  667,  667,
+      667,  667,  667,  667,  667,  667,  667,  667,  667,  667,
+      667,  667,    0,  667,  667,  667,    0,  667,  667,  667,
+
+      667,  667,  667,  667,  667,    0,  667,  667,  667,  696,
+      696,    0,  696,    0,    0,    0,    0,    0,    0,    0,
+      696,  696,  696,  696,  696,  696,  696,  696,  696,  696,
+      696,  696,  696,  696,  696,  696,  696,  696,  696,  696,
+      696,  696,  696,    0,  696,    0,    0,  696,  696,  696,
+      696,  696,  696,  696,  696,  696,  696,  696,  696,  696,
+      696,    0,    0,    0,    0,  696,  696,  696,  696,  696,
+      696,  696,  696,  696,  696,  696,  696,  696,  696,  696,
+      696,    0,  696,  696,  696,    0,  696,  696,  696,  696,
+      696,  696,  696,  696,    0,  696,  696,  696,  708,  708,
+
+      708,  708,  708,  708,  708,  708,    0,  708,  708,  708,
+      708,    0,  708,  708,  708,  719,  719,  719,  719,  719,
+      719,  719,  719,  719,  719,  721,    0,    0,    0,    0,
+        0,  722,    0,  721,  721,  721,  721,  721,  721,  722,
+      722,  722,  722,  722,  722,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,  721,  721,  721,  721,  721,    0,  722,  722,  722,
+      722,  722,  742,  742,    0,  742,  742,    0,    0,    0,
+        0,    0,    0,  742,  742,  742,  742,  742,  742,  742,
+      742,  742,  742,  742,  742,  742,  742,  742,  742,  742,
+
+      742,  742,  742,  742,  742,  742,    0,  742,    0,    0,
+      742,  742,  742,  742,  742,  742,  742,  742,  742,  742,
+      742,  742,  742,  742,    0,    0,    0,    0,  742,  742,
+      742,  742,  742,  742,  742,  742,  742,  742,  742,  742,
+      742,  742,  742,  742,    0,  742,  742,  742,    0,  742,
+      742,  742,  742,  742,  742,  742,  742,  751,  742,  742,
+      742,  749,    0,  752,    0,  751,  751,  751,  751,  751,
+      751,  752,  752,  752,  752,  752,  752,  762,    0,    0,
+        0,    0,    0,    0,    0,  762,  762,  762,  762,  762,
+      762,    0,    0,  751,  751,  751,  751,  751,    0,  752,
+
+      752,  752,  752,  752,    0,    0,  749,    0,    0,    0,
+        0,    0,    0,  762,  762,  762,  762,  762,    0,    0,
+        0,    0,    0,    0,    0,    0,  763,    0,    0,    0,
+        0,    0,  749,    0,  763,  763,  763,  763,  763,  763,
+        0,    0,  749,    0,  749,  749,  749,  749,  749,  749,
+      749,  749,  749,  749,  749,  749,  749,  749,  749,  749,
+      749,  750,  763,  763,  763,  763,  763,    0,    0,    0,
+        0,  764,    0,    0,    0,    0,    0,  765,    0,  764,
+      764,  764,  764,  764,  764,  765,  765,  765,  765,  765,
+      765,  773,    0,    0,    0,    0,    0,    0,    0,  773,
+
+      773,  773,  773,  773,  773,    0,  750,  764,  764,  764,
+      764,  764,    0,  765,  765,  765,  765,  765,    0,    0,
+        0,    0,    0,    0,    0,    0,  774,  773,  773,  773,
+      773,  773,  750,    0,  774,  774,  774,  774,  774,  774,
+        0,    0,  750,    0,  750,  750,  750,  750,  750,  750,
+      750,  750,  750,  750,  750,  750,  750,  750,  750,  750,
+      750,  766,  774,  774,  774,  774,  774,    0,    0,  766,
+      766,  766,  766,  766,  766,  766,  766,  766,  766,  766,
+      766,  766,  766,  766,  766,  766,  766,  766,  766,  766,
+      766,  766,    0,  766,    0,    0,  766,  766,  766,  766,
+
+      766,  766,  766,  766,  766,  766,  766,  766,  766,  766,
+        0,    0,    0,    0,  766,  766,  766,  766,  766,  766,
+      766,  766,  766,  766,  766,  766,  766,  766,  766,  766,
+        0,  766,  766,  766,    0,  766,  766,  766,  766,  766,
+      766,  766,  766,  778,  766,  766,  766,  776,    0,    0,
+        0,  778,  778,  778,  778,  778,  778,  779,    0,    0,
+        0,    0,    0,  789,    0,  779,  779,  779,  779,  779,
+      779,  789,  789,  789,  789,  789,  789,    0,    0,  778,
+      778,  778,  778,  778,    0,    0,    0,    0,  776,    0,
+        0,    0,    0,  779,  779,  779,  779,  779,    0,  789,
+
+      789,  789,  789,  789,    0,    0,    0,    0,  790,    0,
+        0,    0,    0,    0,  776,    0,  790,  790,  790,  790,
+      790,  790,    0,    0,  776,    0,  776,  776,  776,  776,
+      776,  776,  776,  776,  776,  776,  776,  776,  776,  776,
+      776,  776,  776,  777,  790,  790,  790,  790,  790,  791,
+        0,    0,    0,    0,    0,  792,    0,  791,  791,  791,
+      791,  791,  791,  792,  792,  792,  792,  792,  792,  800,
+        0,    0,    0,    0,    0,    0,    0,  800,  800,  800,
+      800,  800,  800,    0,  777,  791,  791,  791,  791,  791,
+        0,  792,  792,  792,  792,  792,    0,    0,    0,    0,
+
+        0,    0,    0,    0,    0,  800,  800,  800,  800,  800,
+      777,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+      777,    0,  777,  777,  777,  777,  777,  777,  777,  777,
+      777,  777,  777,  777,  777,  777,  777,  777,  777,  793,
+      793,    0,  793,    0,    0,    0,    0,    0,    0,    0,
+      793,  793,  793,  793,  793,  793,  793,  793,  793,  793,
+      793,  793,  793,  793,  793,  793,  793,  793,  793,  793,
+      793,  793,  793,    0,  793,    0,    0,  793,  793,  793,
+      793,  793,  793,  793,  793,  793,  793,  793,  793,  793,
+      793,    0,    0,    0,    0,  793,  793,  793,  793,  793,
+
+      793,  793,  793,  793,  793,  793,  793,  793,  793,  793,
+      793,    0,  793,  793,  793,    0,  793,  793,  793,  793,
+      793,  793,  793,  793,  801,  793,  793,  793,    0,    0,
+      803,    0,  801,  801,  801,  801,  801,  801,  803,  803,
+      803,  803,  803,  803,  804,    0,    0,    0,    0,    0,
+        0,    0,  804,  804,  804,  804,  804,  804,    0,    0,
+      801,  801,  801,  801,  801,    0,  803,  803,  803,  803,
+      803,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+      804,  804,  804,  804,  804,  805,    0,    0,    0,    0,
+        0,    0,    0,  805,  805,  805,  805,  805,  805,  805,
+
+      805,  805,  805,  805,  805,  805,  805,  805,  805,  805,
+      805,  805,  805,  805,  805,  805,    0,  805,    0,    0,
+      805,  805,  805,  805,  805,  805,  805,  805,  805,  805,
+      805,  805,  805,  805,    0,    0,    0,    0,  805,  805,
+      805,  805,  805,  805,  805,  805,  805,  805,  805,  805,
+      805,  805,  805,  805,    0,  805,  805,  805,    0,  805,
+      805,  805,  805,  805,  805,  805,  805,  812,  805,  805,
+      805,    0,    0,  813,    0,  812,  812,  812,  812,  812,
+      812,  813,  813,  813,  813,  813,  813,  815,    0,    0,
+        0,    0,    0,    0,    0,  815,  815,  815,  815,  815,
+
+      815,    0,    0,  812,  812,  812,  812,  812,  816,  813,
+      813,  813,  813,  813,    0,    0,  816,  816,  816,  816,
+      816,  816,    0,  815,  815,  815,  815,  815,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,  816,  816,  816,  816,  816,  817,
+      817,    0,  817,  817,    0,    0,    0,    0,    0,    0,
+      817,  817,  817,  817,  817,  817,  817,  817,  817,  817,
+      817,  817,  817,  817,  817,  817,  817,  817,  817,  817,
+      817,  817,  817,    0,  817,    0,    0,  817,  817,  817,
+      817,  817,  817,  817,  817,  817,  817,  817,  817,  817,
+
+      817,    0,    0,    0,    0,  817,  817,  817,  817,  817,
+      817,  817,  817,  817,  817,  817,  817,  817,  817,  817,
+      817,    0,  817,  817,  817,    0,  817,  817,  817,  817,
+      817,  817,  817,  817,  836,  817,  817,  817,    0,    0,
+      837,    0,  836,  836,  836,  836,  836,  836,  837,  837,
+      837,  837,  837,  837,  838,    0,    0,    0,    0,    0,
+        0,    0,  838,  838,  838,  838,  838,  838,    0,    0,
+      836,  836,  836,  836,  836,  839,  837,  837,  837,  837,
+      837,    0,    0,  839,  839,  839,  839,  839,  839,    0,
+      838,  838,  838,  838,  838,    0,    0,    0,    0,    0,
+
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,  839,  839,  839,  839,  839,  840,  840,    0,  840,
+        0,    0,    0,    0,    0,    0,    0,  840,  840,  840,
+      840,  840,  840,  840,  840,  840,  840,  840,  840,  840,
+      840,  840,  840,  840,  840,  840,  840,  840,  840,  840,
+        0,  840,    0,    0,  840,  840,  840,  840,  840,  840,
+      840,  840,  840,  840,  840,  840,  840,  840,    0,    0,
+        0,    0,  840,  840,  840,  840,  840,  840,  840,  840,
+      840,  840,  840,  840,  840,  840,  840,  840,    0,  840,
+      840,  840,    0,  840,  840,  840,  840,  840,  840,  840,
+
+      840,  860,  840,  840,  840,    0,    0,  861,    0,  860,
+      860,  860,  860,  860,  860,  861,  861,  861,  861,  861,
+      861,  875,    0,    0,    0,    0,    0,    0,    0,  875,
+      875,  875,  875,  875,  875,    0,    0,  860,  860,  860,
+      860,  860,  876,  861,  861,  861,  861,  861,    0,    0,
+      876,  876,  876,  876,  876,  876,  881,  875,  875,  875,
+      875,  875,  882,    0,  881,  881,  881,  881,  881,  881,
+      882,  882,  882,  882,  882,  882,  883,    0,  876,  876,
+      876,  876,  876,  877,  883,  883,  883,  883,  883,  883,
+        0,    0,  881,  881,  881,  881,  881,  884,  882,  882,
+
+      882,  882,  882,    0,    0,  884,  884,  884,  884,  884,
+      884,  886,  883,  883,  883,  883,  883,    0,    0,  886,
+      886,  886,  886,  886,  886,    0,    0,    0,  877,    0,
+        0,    0,    0,  884,  884,  884,  884,  884,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,  886,  886,  886,
+      886,  886,    0,    0,  877,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,  877,    0,  877,  877,  877,  877,
+      877,  877,  877,  877,  877,  877,  877,  877,  877,  877,
+      877,  877,  877,  885,    0,    0,    0,    0,    0,    0,
+        0,  885,  885,  885,  885,  885,  885,  885,  885,  885,
+
+      885,  885,  885,  885,  885,  885,  885,  885,  885,  885,
+      885,  885,  885,  885,    0,  885,    0,    0,  885,  885,
+      885,  885,  885,  885,  885,  885,  885,  885,  885,  885,
+      885,  885,    0,    0,    0,    0,  885,  885,  885,  885,
+      885,  885,  885,  885,  885,  885,  885,  885,  885,  885,
+      885,  885,    0,  885,  885,  885,    0,  885,  885,  885,
+      885,  885,  885,  885,  885,  887,  885,  885,  885,    0,
+        0,  889,    0,  887,  887,  887,  887,  887,  887,  889,
+      889,  889,  889,  889,  889,  890,    0,    0,    0,    0,
+        0,    0,    0,  890,  890,  890,  890,  890,  890,    0,
+
+        0,  887,  887,  887,  887,  887,  895,  889,  889,  889,
+      889,  889,    0,    0,  895,  895,  895,  895,  895,  895,
+      896,  890,  890,  890,  890,  890,  891,    0,  896,  896,
+      896,  896,  896,  896,    0,    0,    0,    0,    0,  897,
+        0,    0,  895,  895,  895,  895,  895,  897,  897,  897,
+      897,  897,  897,    0,    0,    0,  896,  896,  896,  896,
+      896,  898,    0,    0,    0,    0,    0,  891,    0,  898,
+      898,  898,  898,  898,  898,  897,  897,  897,  897,  897,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,  891,    0,    0,    0,  898,  898,  898,
+
+      898,  898,    0,  891,    0,  891,  891,  891,  891,  891,
+      891,  891,  891,  891,  891,  891,  891,  891,  891,  891,
+      891,  891,  899,  899,    0,  899,    0,    0,    0,    0,
+        0,    0,    0,  899,  899,  899,  899,  899,  899,  899,
+      899,  899,  899,  899,  899,  899,  899,  899,  899,  899,
+      899,  899,  899,  899,  899,  899,    0,  899,    0,    0,
+      899,  899,  899,  899,  899,  899,  899,  899,  899,  899,
+      899,  899,  899,  899,    0,    0,    0,    0,  899,  899,
+      899,  899,  899,  899,  899,  899,  899,  899,  899,  899,
+      899,  899,  899,  899,    0,  899,  899,  899,    0,  899,
+
+      899,  899,  899,  899,  899,  899,  899,  900,  899,  899,
+      899,    0,    0,  901,    0,  900,  900,  900,  900,  900,
+      900,  901,  901,  901,  901,  901,  901,  902,    0,    0,
+        0,    0,    0,    0,    0,  902,  902,  902,  902,  902,
+      902,    0,    0,  900,  900,  900,  900,  900,  903,  901,
+      901,  901,  901,  901,    0,    0,  903,  903,  903,  903,
+      903,  903,    0,  902,  902,  902,  902,  902,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,  903,  903,  903,  903,  903,  904,
+        0,    0,    0,    0,    0,    0,    0,  904,  904,  904,
+
+      904,  904,  904,  904,  904,  904,  904,  904,  904,  904,
+      904,  904,  904,  904,  904,  904,  904,  904,  904,  904,
+        0,  904,    0,    0,  904,  904,  904,  904,  904,  904,
+      904,  904,  904,  904,  904,  904,  904,  904,    0,    0,
+        0,    0,  904,  904,  904,  904,  904,  904,  904,  904,
+      904,  904,  904,  904,  904,  904,  904,  904,    0,  904,
+      904,  904,    0,  904,  904,  904,  904,  904,  904,  904,
+      904,  905,  904,  904,  904,    0,    0,  906,    0,  905,
+      905,  905,  905,  905,  905,  906,  906,  906,  906,  906,
+      906,  907,    0,    0,    0,    0,    0,    0,    0,  907,
+
+      907,  907,  907,  907,  907,    0,    0,  905,  905,  905,
+      905,  905,  908,  906,  906,  906,  906,  906,    0,    0,
+      908,  908,  908,  908,  908,  908,  919,  907,  907,  907,
+      907,  907,  921,    0,  919,  919,  919,  919,  919,  919,
+      921,  921,  921,  921,  921,  921,  922,    0,  908,  908,
+      908,  908,  908,    0,  922,  922,  922,  922,  922,  922,
+        0,    0,  919,  919,  919,  919,  919,  930,  921,  921,
+      921,  921,  921,    0,    0,  930,  930,  930,  930,  930,
+      930,  931,  922,  922,  922,  922,  922,  935,    0,  931,
+      931,  931,  931,  931,  931,  935,  935,  935,  935,  935,
+
+      935,  936,    0,  930,  930,  930,  930,  930,    0,  936,
+      936,  936,  936,  936,  936,    0,    0,  931,  931,  931,
+      931,  931,  937,  935,  935,  935,  935,  935,    0,    0,
+      937,  937,  937,  937,  937,  937,  938,  936,  936,  936,
+      936,  936,  939,    0,  938,  938,  938,  938,  938,  938,
+      939,  939,  939,  939,  939,  939,  940,    0,  937,  937,
+      937,  937,  937,    0,  940,  940,  940,  940,  940,  940,
+        0,    0,  938,  938,  938,  938,  938,  942,  939,  939,
+      939,  939,  939,    0,    0,  942,  942,  942,  942,  942,
+      942,  943,  940,  940,  940,  940,  940,  944,    0,  943,
+
+      943,  943,  943,  943,  943,  944,  944,  944,  944,  944,
+      944,  945,    0,  942,  942,  942,  942,  942,    0,  945,
+      945,  945,  945,  945,  945,    0,    0,  943,  943,  943,
+      943,  943,  946,  944,  944,  944,  944,  944,    0,    0,
+      946,  946,  946,  946,  946,  946,  947,  945,  945,  945,
+      945,  945,  949,    0,  947,  947,  947,  947,  947,  947,
+      949,  949,  949,  949,  949,  949,  950,    0,  946,  946,
+      946,  946,  946,    0,  950,  950,  950,  950,  950,  950,
+        0,    0,  947,  947,  947,  947,  947,  951,  949,  949,
+      949,  949,  949,    0,    0,  951,  951,  951,  951,  951,
+
+      951,  953,  950,  950,  950,  950,  950,  961,    0,  953,
+      953,  953,  953,  953,  953,  961,  961,  961,  961,  961,
+      961,  962,    0,  951,  951,  951,  951,  951,    0,  962,
+      962,  962,  962,  962,  962,    0,    0,  953,  953,  953,
+      953,  953,  963,  961,  961,  961,  961,  961,    0,    0,
+      963,  963,  963,  963,  963,  963,  965,  962,  962,  962,
+      962,  962,  966,    0,  965,  965,  965,  965,  965,  965,
+      966,  966,  966,  966,  966,  966,  969,    0,  963,  963,
+      963,  963,  963,    0,  969,  969,  969,  969,  969,  969,
+        0,    0,  965,  965,  965,  965,  965,  970,  966,  966,
+
+      966,  966,  966,    0,    0,  970,  970,  970,  970,  970,
+      970,  971,  969,  969,  969,  969,  969,  972,    0,  971,
+      971,  971,  971,  971,  971,  972,  972,  972,  972,  972,
+      972,  974,    0,  970,  970,  970,  970,  970,    0,  974,
+      974,  974,  974,  974,  974,    0,    0,  971,  971,  971,
+      971,  971,  975,  972,  972,  972,  972,  972,    0,    0,
+      975,  975,  975,  975,  975,  975,  976,  974,  974,  974,
+      974,  974,  977,    0,  976,  976,  976,  976,  976,  976,
+      977,  977,  977,  977,  977,  977,  978,    0,  975,  975,
+      975,  975,  975,    0,  978,  978,  978,  978,  978,  978,
+
+        0,    0,  976,  976,  976,  976,  976,  980,  977,  977,
+      977,  977,  977,    0,    0,  980,  980,  980,  980,  980,
+      980,  981,  978,  978,  978,  978,  978,  983,    0,  981,
+      981,  981,  981,  981,  981,  983,  983,  983,  983,  983,
+      983,  984,    0,  980,  980,  980,  980,  980,    0,  984,
+      984,  984,  984,  984,  984,    0,    0,  981,  981,  981,
+      981,  981,  991,  983,  983,  983,  983,  983,    0,    0,
+      991,  991,  991,  991,  991,  991,  992,  984,  984,  984,
+      984,  984,  993,    0,  992,  992,  992,  992,  992,  992,
+      993,  993,  993,  993,  993,  993,  994,    0,  991,  991,
+
+      991,  991,  991,    0,  994,  994,  994,  994,  994,  994,
+        0,    0,  992,  992,  992,  992,  992,  997,  993,  993,
+      993,  993,  993,    0,    0,  997,  997,  997,  997,  997,
+      997,  998,  994,  994,  994,  994,  994,  999,    0,  998,
+      998,  998,  998,  998,  998,  999,  999,  999,  999,  999,
+      999, 1000,    0,  997,  997,  997,  997,  997,    0, 1000,
+     1000, 1000, 1000, 1000, 1000,    0,    0,  998,  998,  998,
+      998,  998, 1001,  999,  999,  999,  999,  999,    0,    0,
+     1001, 1001, 1001, 1001, 1001, 1001, 1002, 1000, 1000, 1000,
+     1000, 1000, 1003,    0, 1002, 1002, 1002, 1002, 1002, 1002,
+
+     1003, 1003, 1003, 1003, 1003, 1003, 1004,    0, 1001, 1001,
+     1001, 1001, 1001,    0, 1004, 1004, 1004, 1004, 1004, 1004,
+        0,    0, 1002, 1002, 1002, 1002, 1002, 1005, 1003, 1003,
+     1003, 1003, 1003,    0,    0, 1005, 1005, 1005, 1005, 1005,
+     1005, 1006, 1004, 1004, 1004, 1004, 1004, 1007,    0, 1006,
+     1006, 1006, 1006, 1006, 1006, 1007, 1007, 1007, 1007, 1007,
+     1007, 1010,    0, 1005, 1005, 1005, 1005, 1005,    0, 1010,
+     1010, 1010, 1010, 1010, 1010,    0,    0, 1006, 1006, 1006,
+     1006, 1006, 1011, 1007, 1007, 1007, 1007, 1007,    0,    0,
+     1011, 1011, 1011, 1011, 1011, 1011, 1013, 1010, 1010, 1010,
+
+     1010, 1010, 1015,    0, 1013, 1013, 1013, 1013, 1013, 1013,
+     1015, 1015, 1015, 1015, 1015, 1015, 1016,    0, 1011, 1011,
+     1011, 1011, 1011,    0, 1016, 1016, 1016, 1016, 1016, 1016,
+        0,    0, 1013, 1013, 1013, 1013, 1013, 1017, 1015, 1015,
+     1015, 1015, 1015,    0,    0, 1017, 1017, 1017, 1017, 1017,
+     1017, 1018, 1016, 1016, 1016, 1016, 1016, 1019,    0, 1018,
+     1018, 1018, 1018, 1018, 1018, 1019, 1019, 1019, 1019, 1019,
+     1019, 1020,    0, 1017, 1017, 1017, 1017, 1017,    0, 1020,
+     1020, 1020, 1020, 1020, 1020,    0,    0, 1018, 1018, 1018,
+     1018, 1018, 1021, 1019, 1019, 1019, 1019, 1019,    0,    0,
+
+     1021, 1021, 1021, 1021, 1021, 1021, 1022, 1020, 1020, 1020,
+     1020, 1020, 1023,    0, 1022, 1022, 1022, 1022, 1022, 1022,
+     1023, 1023, 1023, 1023, 1023, 1023, 1024,    0, 1021, 1021,
+     1021, 1021, 1021,    0, 1024, 1024, 1024, 1024, 1024, 1024,
+        0,    0, 1022, 1022, 1022, 1022, 1022, 1025, 1023, 1023,
+     1023, 1023, 1023,    0,    0, 1025, 1025, 1025, 1025, 1025,
+     1025, 1028, 1024, 1024, 1024, 1024, 1024, 1029,    0, 1028,
+     1028, 1028, 1028, 1028, 1028, 1029, 1029, 1029, 1029, 1029,
+     1029, 1030,    0, 1025, 1025, 1025, 1025, 1025,    0, 1030,
+     1030, 1030, 1030, 1030, 1030,    0,    0, 1028, 1028, 1028,
+
+     1028, 1028, 1032, 1029, 1029, 1029, 1029, 1029,    0,    0,
+     1032, 1032, 1032, 1032, 1032, 1032, 1034, 1030, 1030, 1030,
+     1030, 1030, 1031, 1036, 1034, 1034, 1034, 1034, 1034, 1034,
+        0, 1036, 1036, 1036, 1036, 1036, 1036, 1038, 1032, 1032,
+     1032, 1032, 1032,    0,    0, 1038, 1038, 1038, 1038, 1038,
+     1038,    0, 1034, 1034, 1034, 1034, 1034,    0,    0, 1036,
+     1036, 1036, 1036, 1036,    0,    0,    0, 1031,    0,    0,
+        0,    0,    0, 1038, 1038, 1038, 1038, 1038,    0,    0,
+        0,    0,    0,    0,    0,    0,    0, 1042,    0,    0,
+        0,    0,    0, 1031,    0, 1042, 1042, 1042, 1042, 1042,
+
+     1042,    0,    0, 1031,    0, 1031, 1031, 1031, 1031, 1031,
+     1031, 1031, 1031, 1031, 1031, 1031, 1031, 1031, 1031, 1031,
+     1031, 1031, 1035, 1042, 1042, 1042, 1042, 1042, 1043,    0,
+        0,    0,    0,    0, 1044,    0, 1043, 1043, 1043, 1043,
+     1043, 1043, 1044, 1044, 1044, 1044, 1044, 1044, 1046,    0,
+        0,    0,    0,    0,    0,    0, 1046, 1046, 1046, 1046,
+     1046, 1046,    0, 1035, 1043, 1043, 1043, 1043, 1043,    0,
+     1044, 1044, 1044, 1044, 1044,    0,    0,    0,    0,    0,
+        0,    0, 1049,    0, 1046, 1046, 1046, 1046, 1046, 1035,
+     1049, 1049, 1049, 1049, 1049, 1049,    0,    0,    0, 1035,
+
+        0, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035,
+     1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1049, 1049,
+     1049, 1049, 1049, 1051,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0, 1051,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0, 1051,    0,    0,    0,    0,    0,
+
+        0,    0,    0,    0, 1051,    0, 1051, 1051, 1051, 1051,
+     1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051,
+     1051, 1051, 1051, 1052,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0, 1052,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+     1052,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+
+     1052,    0, 1052, 1052, 1052, 1052, 1052, 1052, 1052, 1052,
+     1052, 1052, 1052, 1052, 1052, 1052, 1052, 1052, 1052, 1055,
+        0, 1055, 1055, 1055, 1055,    0, 1055,    0, 1055, 1056,
+        0, 1056, 1056, 1056, 1056,    0, 1056,    0, 1056, 1057,
+     1057, 1057, 1057,    0, 1057,    0, 1057, 1059, 1059, 1059,
+     1059, 1060, 1060, 1060, 1060, 1061, 1061, 1061, 1061, 1062,
+     1062, 1062, 1062, 1063, 1063, 1063, 1063, 1064, 1064, 1064,
+     1064, 1065, 1065, 1065, 1065, 1066, 1066, 1066, 1066, 1067,
+     1067, 1067, 1067, 1068, 1068, 1068, 1068, 1069,    0, 1069,
+     1069, 1069, 1069,    0, 1069,    0, 1069, 1070, 1070, 1070,
+
+     1071, 1071, 1071, 1072, 1072, 1072, 1072, 1073, 1073, 1073,
+     1073, 1074, 1074, 1074, 1074, 1075, 1075, 1075, 1075, 1076,
+     1076, 1076, 1076, 1077, 1077, 1077, 1077, 1078, 1078, 1078,
+     1078, 1079, 1079, 1079, 1079, 1080, 1080, 1080, 1080, 1081,
+     1081, 1081, 1081, 1082, 1082, 1082, 1082, 1083, 1083, 1083,
+     1083, 1084, 1084, 1084, 1084, 1085, 1085, 1085, 1085, 1086,
+        0, 1086, 1086, 1086, 1086,    0, 1086,    0, 1086, 1087,
+     1087, 1087, 1088, 1088, 1088, 1089, 1089, 1089, 1089, 1090,
+     1090, 1090, 1090, 1091, 1091, 1091, 1091, 1092, 1092, 1092,
+     1092, 1093, 1093, 1093, 1093, 1094, 1094, 1094, 1094, 1095,
+
+     1095, 1095, 1095, 1096, 1096, 1096, 1096, 1097, 1097, 1097,
+     1097, 1098, 1098, 1098, 1098, 1099, 1099, 1099, 1099, 1100,
+     1100, 1100, 1100, 1101, 1101, 1101, 1101, 1102, 1102, 1102,
+     1102, 1103, 1103, 1103, 1103,    0, 1103,    0, 1103, 1104,
+     1104, 1104, 1105, 1105, 1105, 1106, 1106, 1106, 1106, 1107,
+     1107, 1107, 1107, 1108, 1108, 1108, 1108, 1109, 1109, 1109,
+     1109, 1110, 1110, 1110, 1110, 1111, 1111, 1111, 1111, 1112,
+     1112, 1112, 1112, 1113, 1113, 1113, 1113, 1114, 1114, 1114,
+     1114, 1115, 1115, 1115, 1115, 1116, 1116, 1116, 1116, 1117,
+     1117, 1117, 1117, 1118, 1118, 1118, 1118, 1119, 1119, 1119,
+
+     1119, 1120,    0, 1120, 1121, 1121, 1121, 1121, 1122, 1122,
+     1122, 1122, 1123, 1123, 1123, 1123, 1124, 1124, 1124, 1124,
+     1125, 1125, 1125, 1125, 1126, 1126,    0, 1126, 1127, 1127,
+     1127, 1127, 1128, 1128, 1128, 1128, 1129, 1129, 1129, 1129,
+     1130, 1130, 1130, 1130, 1131, 1131, 1131, 1131, 1132, 1132,
+     1132, 1132, 1133, 1133, 1133, 1133, 1134, 1134, 1134, 1134,
+     1135, 1135, 1135, 1135, 1136, 1136, 1136, 1136, 1137, 1137,
+     1137, 1137, 1138, 1138, 1138, 1138, 1139, 1139, 1139, 1139,
+     1140, 1140, 1140, 1140, 1140, 1140,    0, 1140,    0, 1140,
+     1141,    0, 1141, 1141, 1141, 1141,    0, 1141,    0, 1141,
+
+     1142, 1142, 1142, 1142, 1143, 1143, 1143, 1143, 1144, 1144,
+     1144, 1144, 1145, 1145, 1145, 1145, 1146, 1146, 1146, 1146,
+     1147, 1147, 1147, 1147, 1148, 1148, 1148, 1148, 1149, 1149,
+     1149, 1149, 1150, 1150, 1150, 1150, 1151, 1151, 1151, 1151,
+     1152, 1152, 1152, 1152, 1153, 1153,    0, 1153, 1154, 1154,
+     1154, 1154, 1155, 1155, 1155, 1155, 1156, 1156, 1156, 1156,
+     1157, 1157, 1157, 1157, 1158, 1158, 1158, 1158, 1159, 1159,
+     1159, 1159, 1160, 1160, 1160, 1160, 1161, 1161, 1161, 1161,
+     1162, 1162, 1162, 1162, 1163, 1163, 1163, 1163, 1164, 1164,
+     1164, 1164, 1165, 1165, 1165, 1165, 1166, 1166, 1166, 1166,
+
+     1167, 1167, 1167, 1167, 1167, 1167,    0, 1167,    0, 1167,
+     1168,    0, 1168, 1168, 1168, 1168,    0, 1168,    0, 1168,
+     1169, 1169, 1169, 1169, 1170, 1170, 1170, 1170, 1171, 1171,
+     1171, 1171, 1172, 1172, 1172, 1172, 1173, 1173, 1173, 1173,
+     1174, 1174, 1174, 1174, 1175, 1175, 1175, 1175, 1176, 1176,
+     1176, 1176, 1177, 1177, 1177, 1177, 1178, 1178, 1178, 1178,
+     1179, 1179, 1179, 1179, 1180, 1180,    0, 1180, 1181, 1181,
+     1181, 1181, 1182, 1182, 1182, 1182, 1183, 1183, 1183, 1183,
+     1184, 1184, 1184, 1184, 1185, 1185, 1185, 1185, 1186, 1186,
+     1186, 1186, 1187, 1187, 1187, 1187, 1188, 1188, 1188, 1188,
+
+     1189, 1189, 1189, 1189, 1190, 1190, 1190, 1190, 1191, 1191,
+     1191, 1191, 1192, 1192, 1192, 1192, 1193, 1193, 1193, 1193,
+     1194, 1194, 1194, 1194, 1195, 1195, 1195, 1195, 1196, 1196,
+     1196, 1196, 1197, 1197, 1197, 1197, 1198, 1198, 1198, 1198,
+     1199, 1199, 1199, 1199, 1200, 1200, 1200, 1200, 1201, 1201,
+     1201, 1201, 1202, 1202, 1202, 1202, 1203, 1203, 1203, 1203,
+     1204, 1204, 1204, 1204, 1205, 1205,    0, 1205, 1206, 1206,
+     1206, 1206, 1207, 1207, 1207, 1207, 1208, 1208, 1208, 1208,
+     1209, 1209, 1209, 1209, 1210, 1210, 1210, 1210, 1211, 1211,
+     1211, 1211, 1212, 1212, 1212, 1212, 1213, 1213, 1213, 1213,
+
+     1214, 1214, 1214, 1214, 1215, 1215, 1215, 1215, 1216, 1216,
+     1216, 1216, 1217, 1217, 1217, 1217, 1218, 1218, 1218, 1218,
+     1219, 1219, 1220, 1220, 1220, 1220, 1221, 1221, 1221, 1221,
+     1222, 1222, 1222, 1222, 1223, 1223, 1223, 1223, 1224, 1224,
+     1224, 1224, 1225, 1225, 1225, 1225, 1226, 1226, 1226, 1226,
+     1227, 1227, 1227, 1227, 1228, 1228, 1228, 1228, 1229, 1229,
+     1229, 1229, 1230, 1230, 1230, 1230, 1231, 1231, 1231, 1231,
+     1232, 1232, 1232, 1232, 1233, 1233, 1233, 1233, 1234, 1234,
+     1234, 1234, 1235, 1235, 1235, 1235, 1236, 1236, 1236, 1236,
+     1237, 1237, 1237, 1237, 1238, 1238, 1238, 1238, 1239, 1239,
+
+     1239, 1239, 1239, 1239,    0, 1239,    0, 1239, 1240, 1240,
+     1240, 1241, 1241, 1241, 1242, 1242, 1242, 1242, 1243, 1243,
+     1243, 1243, 1244, 1244, 1244, 1244, 1245, 1245, 1245, 1245,
+     1246,    0, 1246, 1246, 1246, 1246,    0, 1246,    0, 1246,
+     1247, 1247, 1247, 1247, 1248, 1248, 1248, 1248, 1249, 1249,
+     1249, 1249, 1250, 1250, 1250, 1250, 1251, 1251, 1251, 1251,
+     1252, 1252, 1252, 1252, 1253, 1253, 1253, 1253, 1254, 1254,
+     1254, 1254, 1255, 1255, 1255, 1255, 1256, 1256, 1256, 1256,
+     1257, 1257, 1257, 1257, 1258, 1258, 1258, 1258, 1258, 1258,
+        0, 1258,    0, 1258, 1259, 1259, 1259, 1260, 1260, 1260,
+
+     1261, 1261, 1261, 1261, 1262, 1262, 1262, 1262, 1263, 1263,
+     1263, 1263, 1264, 1264, 1264, 1264, 1265,    0, 1265, 1265,
+     1265, 1265,    0, 1265,    0, 1265, 1266, 1266, 1266, 1266,
+     1267, 1267, 1267, 1267, 1268, 1268, 1268, 1268, 1269, 1269,
+     1269, 1269, 1270, 1270, 1270, 1270, 1271, 1271, 1271, 1271,
+     1272, 1272, 1272, 1272, 1273, 1273, 1273, 1273, 1274, 1274,
+     1274, 1274, 1275, 1275, 1275, 1275, 1276, 1276, 1276, 1276,
+     1277, 1277, 1277, 1277,    0, 1277,    0, 1277, 1278, 1278,
+     1278, 1278, 1279, 1279, 1279, 1279, 1280, 1280, 1280, 1280,
+     1281, 1281, 1281, 1281, 1282, 1282, 1282, 1282, 1283, 1283,
+
+     1283, 1283, 1284, 1284, 1284, 1284, 1285, 1285, 1285, 1285,
+     1286, 1286, 1286, 1286, 1287, 1287, 1287, 1287, 1288, 1288,
+     1288, 1288, 1289, 1289, 1289, 1290, 1290, 1290, 1290, 1291,
+     1291, 1291, 1291, 1292, 1292, 1292, 1292, 1293, 1293, 1293,
+     1293, 1294, 1294, 1294, 1294, 1295, 1295, 1295, 1295, 1296,
+     1296,    0, 1296, 1297, 1297, 1297, 1297, 1298, 1298, 1298,
+     1298, 1299, 1299, 1299, 1299, 1300, 1300, 1300, 1300, 1301,
+     1301, 1301, 1301, 1302, 1302, 1302, 1302, 1303, 1303, 1303,
+     1303, 1304, 1304, 1304, 1304, 1305, 1305, 1305, 1305, 1306,
+     1306, 1306, 1306, 1307, 1307, 1307, 1307, 1308, 1308, 1308,
+
+     1308, 1309, 1309, 1309, 1309, 1310, 1310, 1310, 1310, 1310,
+     1310,    0, 1310,    0, 1310, 1311, 1311, 1311, 1311, 1312,
+     1312, 1312, 1312, 1313, 1313, 1313, 1313, 1314, 1314, 1314,
+     1314, 1315, 1315, 1315, 1315, 1316, 1316, 1316, 1316, 1317,
+     1317, 1317, 1317, 1318, 1318, 1318, 1318, 1318, 1318,    0,
+     1318,    0, 1318, 1319, 1319, 1319, 1319, 1320, 1320, 1320,
+     1320, 1321, 1321, 1321, 1321, 1322, 1322, 1322, 1322, 1323,
+     1323, 1323, 1323, 1324, 1324, 1324, 1324, 1325, 1325, 1325,
+     1325, 1326, 1326, 1326, 1326, 1327, 1327, 1327, 1327, 1328,
+     1328, 1328, 1328, 1329, 1329, 1329, 1329, 1330, 1330, 1330,
+
+     1330, 1331, 1331, 1331, 1331, 1332, 1332, 1332, 1332, 1333,
+     1333, 1333, 1333, 1334, 1334, 1334, 1334, 1335, 1335, 1335,
+     1335, 1336, 1336, 1336, 1336, 1336, 1336,    0, 1336,    0,
+     1336, 1337, 1337, 1337, 1337, 1338, 1338, 1338, 1338, 1339,
+     1339, 1339, 1339, 1339, 1339,    0, 1339,    0, 1339, 1340,
+     1340, 1340, 1340, 1341, 1341, 1341, 1341, 1342, 1342, 1342,
+     1342, 1343,    0, 1343, 1343, 1343, 1343,    0, 1343,    0,
+     1343, 1344,    0, 1344, 1344, 1344, 1344,    0, 1344,    0,
+     1344, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054,
+     1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054
+    } ;
+
+/* The intent behind this definition is that it'll catch
+ * any uses of REJECT which flex missed.
+ */
+#define REJECT reject_used_but_not_detected
+#define yymore() yymore_used_but_not_detected
+#define YY_MORE_ADJ 0
+#define YY_RESTORE_YY_MORE_OFFSET
+#line 1 "sparqlScanner.ll"
+#define INITIAL 0
+#line 2 "sparqlScanner.ll"
+#ifndef FLEXFIX
+#define FLEXFIX YY_sparqlParser_STYPE *val
+#define FLEXFIX2 val
+#endif
+#include "sparqlParser.h"
+
+#define YY_INPUT(buf,result,max_size) \
+	if ( (result = LexerReadStatic( (char *) buf, max_size )) < 0 ) \
+		YY_FATAL_ERROR( "input in flex scanner failed" );
+#line 2643 "sparqlScanner.cc"
+
+/* Macros after this point can all be overridden by user definitions in
+ * section 1.
+ */
+
+#ifndef YY_SKIP_YYWRAP
+#ifdef __cplusplus
+extern "C" int yywrap YY_PROTO(( void ));
+#else
+extern int yywrap YY_PROTO(( void ));
+#endif
+#endif
+
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen YY_PROTO(( yyconst char * ));
+#endif
+
+#ifndef YY_NO_INPUT
+#endif
+
+#if YY_STACK_USED
+static int yy_start_stack_ptr = 0;
+static int yy_start_stack_depth = 0;
+static int *yy_start_stack = 0;
+#ifndef YY_NO_PUSH_STATE
+static void yy_push_state YY_PROTO(( int new_state ));
+#endif
+#ifndef YY_NO_POP_STATE
+static void yy_pop_state YY_PROTO(( void ));
+#endif
+#ifndef YY_NO_TOP_STATE
+static int yy_top_state YY_PROTO(( void ));
+#endif
+
+#else
+#define YY_NO_PUSH_STATE 1
+#define YY_NO_POP_STATE 1
+#define YY_NO_TOP_STATE 1
+#endif
+
+#ifdef YY_MALLOC_DECL
+YY_MALLOC_DECL
+#else
+#if __STDC__
+#ifndef __cplusplus
+#include <stdlib.h>
+#endif
+#else
+/* Just try to get by without declaring the routines.  This will fail
+ * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
+ * or sizeof(void*) != sizeof(int).
+ */
+#endif
+#endif
+
+/* Amount of stuff to slurp up with each read. */
+#ifndef YY_READ_BUF_SIZE
+#define YY_READ_BUF_SIZE 8192
+#endif
+
+/* Copy whatever the last rule matched to the standard output. */
+
+#ifndef ECHO
+#define ECHO LexerOutput( yytext, yyleng )
+#endif
+
+/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
+ * is returned in "result".
+ */
+#ifndef YY_INPUT
+#define YY_INPUT(buf,result,max_size) \
+	if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \
+		YY_FATAL_ERROR( "input in flex scanner failed" );
+#endif
+
+/* No semi-colon after return; correct usage is to write "yyterminate();" -
+ * we don't want an extra ';' after the "return" because that will cause
+ * some compilers to complain about unreachable statements.
+ */
+#ifndef yyterminate
+#define yyterminate() return YY_NULL
+#endif
+
+/* Number of entries by which start-condition stack grows. */
+#ifndef YY_START_STACK_INCR
+#define YY_START_STACK_INCR 25
+#endif
+
+/* Report a fatal error. */
+#ifndef YY_FATAL_ERROR
+#define YY_FATAL_ERROR(msg) LexerError( msg )
+#endif
+
+/* Default declaration of generated scanner - a define so the user can
+ * easily add parameters.
+ */
+#ifndef YY_DECL
+#define YY_DECL int yyFlexLexer::yylex()
+#endif
+
+/* Code executed at the beginning of each rule, after yytext and yyleng
+ * have been set up.
+ */
+#ifndef YY_USER_ACTION
+#define YY_USER_ACTION
+#endif
+
+/* Code executed at the end of each rule. */
+#ifndef YY_BREAK
+#define YY_BREAK break;
+#endif
+
+#define YY_RULE_SETUP \
+	YY_USER_ACTION
+
+YY_DECL
+	{
+	register yy_state_type yy_current_state;
+	register char *yy_cp, *yy_bp;
+	register int yy_act;
+
+#line 97 "sparqlScanner.ll"
+
+#line 2772 "sparqlScanner.cc"
+
+	if ( yy_init )
+		{
+		yy_init = 0;
+
+#ifdef YY_USER_INIT
+		YY_USER_INIT;
+#endif
+
+		if ( ! yy_start )
+			yy_start = 1;	/* first start state */
+
+		if ( ! yyin )
+			yyin = &cin;
+
+		if ( ! yyout )
+			yyout = &cout;
+
+		if ( ! yy_current_buffer )
+			yy_current_buffer =
+				yy_create_buffer( yyin, YY_BUF_SIZE );
+
+		yy_load_buffer_state();
+		}
+
+	while ( 1 )		/* loops until end-of-file is reached */
+		{
+		yy_cp = yy_c_buf_p;
+
+		/* Support of yytext. */
+		*yy_cp = yy_hold_char;
+
+		/* yy_bp points to the position in yy_ch_buf of the start of
+		 * the current run.
+		 */
+		yy_bp = yy_cp;
+
+		yy_current_state = yy_start;
+yy_match:
+		do
+			{
+			register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
+			if ( yy_accept[yy_current_state] )
+				{
+				yy_last_accepting_state = yy_current_state;
+				yy_last_accepting_cpos = yy_cp;
+				}
+			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+				{
+				yy_current_state = (int) yy_def[yy_current_state];
+				if ( yy_current_state >= 1055 )
+					yy_c = yy_meta[(unsigned int) yy_c];
+				}
+			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+			++yy_cp;
+			}
+		while ( yy_base[yy_current_state] != 8482 );
+
+yy_find_action:
+		yy_act = yy_accept[yy_current_state];
+		if ( yy_act == 0 )
+			{ /* have to back up */
+			yy_cp = yy_last_accepting_cpos;
+			yy_current_state = yy_last_accepting_state;
+			yy_act = yy_accept[yy_current_state];
+			}
+
+		YY_DO_BEFORE_ACTION;
+
+
+do_action:	/* This label is used only to access EOF actions. */
+
+
+		switch ( yy_act )
+	{ /* beginning of action switch */
+			case 0: /* must back up */
+			/* undo the effects of YY_DO_BEFORE_ACTION */
+			*yy_cp = yy_hold_char;
+			yy_cp = yy_last_accepting_cpos;
+			yy_current_state = yy_last_accepting_state;
+			goto yy_find_action;
+
+case 1:
+YY_RULE_SETUP
+#line 98 "sparqlScanner.ll"
+
+	YY_BREAK
+case 2:
+YY_RULE_SETUP
+#line 99 "sparqlScanner.ll"
+{return sparqlParser::IT_BASE;}
+	YY_BREAK
+case 3:
+YY_RULE_SETUP
+#line 100 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::IT_PREFIX;}
+	YY_BREAK
+case 4:
+YY_RULE_SETUP
+#line 101 "sparqlScanner.ll"
+{return sparqlParser::IT_SELECT;}
+	YY_BREAK
+case 5:
+YY_RULE_SETUP
+#line 102 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::IT_DISTINCT;}
+	YY_BREAK
+case 6:
+YY_RULE_SETUP
+#line 103 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::GT_TIMES;}
+	YY_BREAK
+case 7:
+YY_RULE_SETUP
+#line 104 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::IT_CONSTRUCT;}
+	YY_BREAK
+case 8:
+YY_RULE_SETUP
+#line 105 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::IT_DESCRIBE;}
+	YY_BREAK
+case 9:
+YY_RULE_SETUP
+#line 106 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::IT_ASK;}
+	YY_BREAK
+case 10:
+YY_RULE_SETUP
+#line 107 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::IT_FROM;}
+	YY_BREAK
+case 11:
+YY_RULE_SETUP
+#line 108 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::IT_NAMED;}
+	YY_BREAK
+case 12:
+YY_RULE_SETUP
+#line 109 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::IT_WHERE;}
+	YY_BREAK
+case 13:
+YY_RULE_SETUP
+#line 110 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::IT_ORDER;}
+	YY_BREAK
+case 14:
+YY_RULE_SETUP
+#line 111 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::IT_BY;}
+	YY_BREAK
+case 15:
+YY_RULE_SETUP
+#line 112 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::IT_ASC;}
+	YY_BREAK
+case 16:
+YY_RULE_SETUP
+#line 113 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::IT_DESC;}
+	YY_BREAK
+case 17:
+YY_RULE_SETUP
+#line 114 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::IT_LIMIT;}
+	YY_BREAK
+case 18:
+YY_RULE_SETUP
+#line 115 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::IT_OFFSET;}
+	YY_BREAK
+case 19:
+YY_RULE_SETUP
+#line 116 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::GT_LCURLEY;}
+	YY_BREAK
+case 20:
+YY_RULE_SETUP
+#line 117 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::GT_RCURLEY;}
+	YY_BREAK
+case 21:
+YY_RULE_SETUP
+#line 118 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::GT_DOT;}
+	YY_BREAK
+case 22:
+YY_RULE_SETUP
+#line 119 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::IT_OPTIONAL;}
+	YY_BREAK
+case 23:
+YY_RULE_SETUP
+#line 120 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::IT_GRAPH;}
+	YY_BREAK
+case 24:
+YY_RULE_SETUP
+#line 121 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::IT_UNION;}
+	YY_BREAK
+case 25:
+YY_RULE_SETUP
+#line 122 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::IT_FILTER;}
+	YY_BREAK
+case 26:
+YY_RULE_SETUP
+#line 123 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::GT_COMMA;}
+	YY_BREAK
+case 27:
+YY_RULE_SETUP
+#line 124 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::GT_LPAREN;}
+	YY_BREAK
+case 28:
+YY_RULE_SETUP
+#line 125 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::GT_RPAREN;}
+	YY_BREAK
+case 29:
+YY_RULE_SETUP
+#line 126 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::GT_SEMI;}
+	YY_BREAK
+case 30:
+YY_RULE_SETUP
+#line 127 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::IT_a;}
+	YY_BREAK
+case 31:
+YY_RULE_SETUP
+#line 128 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::GT_LBRACKET;}
+	YY_BREAK
+case 32:
+YY_RULE_SETUP
+#line 129 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::GT_RBRACKET;}
+	YY_BREAK
+case 33:
+YY_RULE_SETUP
+#line 130 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::GT_MINUS;}
+	YY_BREAK
+case 34:
+YY_RULE_SETUP
+#line 131 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::GT_PLUS;}
+	YY_BREAK
+case 35:
+YY_RULE_SETUP
+#line 132 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::GT_OR;}
+	YY_BREAK
+case 36:
+YY_RULE_SETUP
+#line 133 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::GT_AND;}
+	YY_BREAK
+case 37:
+YY_RULE_SETUP
+#line 134 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::GT_EQUAL;}
+	YY_BREAK
+case 38:
+YY_RULE_SETUP
+#line 135 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::GT_NEQUAL;}
+	YY_BREAK
+case 39:
+YY_RULE_SETUP
+#line 136 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::GT_LT;}
+	YY_BREAK
+case 40:
+YY_RULE_SETUP
+#line 137 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::GT_GT;}
+	YY_BREAK
+case 41:
+YY_RULE_SETUP
+#line 138 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::GT_LE;}
+	YY_BREAK
+case 42:
+YY_RULE_SETUP
+#line 139 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::GT_GE;}
+	YY_BREAK
+case 43:
+YY_RULE_SETUP
+#line 140 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::GT_DIVIDE;}
+	YY_BREAK
+case 44:
+YY_RULE_SETUP
+#line 141 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::GT_NOT;}
+	YY_BREAK
+case 45:
+YY_RULE_SETUP
+#line 142 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::IT_STR;}
+	YY_BREAK
+case 46:
+YY_RULE_SETUP
+#line 143 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::IT_LANG;}
+	YY_BREAK
+case 47:
+YY_RULE_SETUP
+#line 144 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::IT_LANGMATCHES;}
+	YY_BREAK
+case 48:
+YY_RULE_SETUP
+#line 145 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::IT_DATATYPE;}
+	YY_BREAK
+case 49:
+YY_RULE_SETUP
+#line 146 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::IT_BOUND;}
+	YY_BREAK
+case 50:
+YY_RULE_SETUP
+#line 147 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::IT_isIRI;}
+	YY_BREAK
+case 51:
+YY_RULE_SETUP
+#line 148 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::IT_isURI;}
+	YY_BREAK
+case 52:
+YY_RULE_SETUP
+#line 149 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::IT_isBLANK;}
+	YY_BREAK
+case 53:
+YY_RULE_SETUP
+#line 150 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::IT_isLITERAL;}
+	YY_BREAK
+case 54:
+YY_RULE_SETUP
+#line 151 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::IT_REGEX;}
+	YY_BREAK
+case 55:
+YY_RULE_SETUP
+#line 152 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::GT_DTYPE;}
+	YY_BREAK
+case 56:
+YY_RULE_SETUP
+#line 153 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::IT_true;}
+	YY_BREAK
+case 57:
+YY_RULE_SETUP
+#line 154 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::IT_false;}
+	YY_BREAK
+case 58:
+YY_RULE_SETUP
+#line 155 "sparqlScanner.ll"
+{val->lex_str = get_token(1, 1); return sparqlParser::Q_IRI_REF;}
+	YY_BREAK
+case 59:
+YY_RULE_SETUP
+#line 156 "sparqlScanner.ll"
+{val->lex_str = get_token(1, 0); return sparqlParser::QNAME_NS;}
+	YY_BREAK
+case 60:
+YY_RULE_SETUP
+#line 157 "sparqlScanner.ll"
+{val->lex_str = get_token(0, 0); return sparqlParser::QNAME;}
+	YY_BREAK
+case 61:
+YY_RULE_SETUP
+#line 158 "sparqlScanner.ll"
+{val->lex_str = get_token(2, 0); return sparqlParser::BLANK_NODE_LABEL;}
+	YY_BREAK
+case 62:
+YY_RULE_SETUP
+#line 159 "sparqlScanner.ll"
+{val->lex_str = get_token(1, 0); return sparqlParser::VAR1;}
+	YY_BREAK
+case 63:
+YY_RULE_SETUP
+#line 160 "sparqlScanner.ll"
+{val->lex_str = get_token(1, 0); return sparqlParser::VAR2;}
+	YY_BREAK
+case 64:
+YY_RULE_SETUP
+#line 161 "sparqlScanner.ll"
+{val->lex_str = get_token(0, 0); return sparqlParser::LANGTAG;}
+	YY_BREAK
+case 65:
+YY_RULE_SETUP
+#line 162 "sparqlScanner.ll"
+{val->lex_str = get_token(0, 0); return sparqlParser::INTEGER;}
+	YY_BREAK
+case 66:
+YY_RULE_SETUP
+#line 163 "sparqlScanner.ll"
+{val->lex_str = get_token(0, 0); return sparqlParser::DECIMAL;}
+	YY_BREAK
+case 67:
+YY_RULE_SETUP
+#line 164 "sparqlScanner.ll"
+{val->lex_str = get_token(0, 0); return sparqlParser::DOUBLE;}
+	YY_BREAK
+case 68:
+YY_RULE_SETUP
+#line 165 "sparqlScanner.ll"
+{val->lex_str = get_token(1, 1); return sparqlParser::STRING_LITERAL1;}
+	YY_BREAK
+case 69:
+YY_RULE_SETUP
+#line 166 "sparqlScanner.ll"
+{val->lex_str = get_token(1, 1); return sparqlParser::STRING_LITERAL2;}
+	YY_BREAK
+case 70:
+YY_RULE_SETUP
+#line 167 "sparqlScanner.ll"
+{val->lex_str = get_token(1, 1); return sparqlParser::STRING_LITERAL_LONG1;}
+	YY_BREAK
+case 71:
+YY_RULE_SETUP
+#line 168 "sparqlScanner.ll"
+{val->lex_str = get_token(1, 1); return sparqlParser::STRING_LITERAL_LONG2;}
+	YY_BREAK
+case 72:
+YY_RULE_SETUP
+#line 169 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::NIL;}
+	YY_BREAK
+case 73:
+YY_RULE_SETUP
+#line 170 "sparqlScanner.ll"
+{val->buf = new Buf(yytext); return sparqlParser::ANON;}
+	YY_BREAK
+case YY_STATE_EOF(INITIAL):
+#line 171 "sparqlScanner.ll"
+{ yyterminate();}
+	YY_BREAK
+case 74:
+YY_RULE_SETUP
+#line 172 "sparqlScanner.ll"
+ECHO;
+	YY_BREAK
+#line 3229 "sparqlScanner.cc"
+
+	case YY_END_OF_BUFFER:
+		{
+		/* Amount of text matched not including the EOB char. */
+		int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
+
+		/* Undo the effects of YY_DO_BEFORE_ACTION. */
+		*yy_cp = yy_hold_char;
+		YY_RESTORE_YY_MORE_OFFSET
+
+		if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
+			{
+			/* We're scanning a new file or input source.  It's
+			 * possible that this happened because the user
+			 * just pointed yyin at a new source and called
+			 * yylex().  If so, then we have to assure
+			 * consistency between yy_current_buffer and our
+			 * globals.  Here is the right place to do so, because
+			 * this is the first action (other than possibly a
+			 * back-up) that will match for the new input source.
+			 */
+			yy_n_chars = yy_current_buffer->yy_n_chars;
+			yy_current_buffer->yy_input_file = yyin;
+			yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
+			}
+
+		/* Note that here we test for yy_c_buf_p "<=" to the position
+		 * of the first EOB in the buffer, since yy_c_buf_p will
+		 * already have been incremented past the NUL character
+		 * (since all states make transitions on EOB to the
+		 * end-of-buffer state).  Contrast this with the test
+		 * in input().
+		 */
+		if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
+			{ /* This was really a NUL. */
+			yy_state_type yy_next_state;
+
+			yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
+
+			yy_current_state = yy_get_previous_state();
+
+			/* Okay, we're now positioned to make the NUL
+			 * transition.  We couldn't have
+			 * yy_get_previous_state() go ahead and do it
+			 * for us because it doesn't know how to deal
+			 * with the possibility of jamming (and we don't
+			 * want to build jamming into it because then it
+			 * will run more slowly).
+			 */
+
+			yy_next_state = yy_try_NUL_trans( yy_current_state );
+
+			yy_bp = yytext_ptr + YY_MORE_ADJ;
+
+			if ( yy_next_state )
+				{
+				/* Consume the NUL. */
+				yy_cp = ++yy_c_buf_p;
+				yy_current_state = yy_next_state;
+				goto yy_match;
+				}
+
+			else
+				{
+				yy_cp = yy_c_buf_p;
+				goto yy_find_action;
+				}
+			}
+
+		else switch ( yy_get_next_buffer() )
+			{
+			case EOB_ACT_END_OF_FILE:
+				{
+				yy_did_buffer_switch_on_eof = 0;
+
+				if ( yywrap() )
+					{
+					/* Note: because we've taken care in
+					 * yy_get_next_buffer() to have set up
+					 * yytext, we can now set up
+					 * yy_c_buf_p so that if some total
+					 * hoser (like flex itself) wants to
+					 * call the scanner after we return the
+					 * YY_NULL, it'll still work - another
+					 * YY_NULL will get returned.
+					 */
+					yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
+
+					yy_act = YY_STATE_EOF(YY_START);
+					goto do_action;
+					}
+
+				else
+					{
+					if ( ! yy_did_buffer_switch_on_eof )
+						YY_NEW_FILE;
+					}
+				break;
+				}
+
+			case EOB_ACT_CONTINUE_SCAN:
+				yy_c_buf_p =
+					yytext_ptr + yy_amount_of_matched_text;
+
+				yy_current_state = yy_get_previous_state();
+
+				yy_cp = yy_c_buf_p;
+				yy_bp = yytext_ptr + YY_MORE_ADJ;
+				goto yy_match;
+
+			case EOB_ACT_LAST_MATCH:
+				yy_c_buf_p =
+				&yy_current_buffer->yy_ch_buf[yy_n_chars];
+
+				yy_current_state = yy_get_previous_state();
+
+				yy_cp = yy_c_buf_p;
+				yy_bp = yytext_ptr + YY_MORE_ADJ;
+				goto yy_find_action;
+			}
+		break;
+		}
+
+	default:
+		YY_FATAL_ERROR(
+			"fatal flex scanner internal error--no action found" );
+	} /* end of action switch */
+		} /* end of scanning one token */
+	} /* end of yylex */
+
+yyFlexLexer::yyFlexLexer( istream* arg_yyin, ostream* arg_yyout )
+	{
+	yyin = arg_yyin;
+	yyout = arg_yyout;
+	yy_c_buf_p = 0;
+	yy_init = 1;
+	yy_start = 0;
+	yy_flex_debug = 0;
+	yylineno = 1;	// this will only get updated if %option yylineno
+
+	yy_did_buffer_switch_on_eof = 0;
+
+	yy_looking_for_trail_begin = 0;
+	yy_more_flag = 0;
+	yy_more_len = 0;
+	yy_more_offset = yy_prev_more_offset = 0;
+
+	yy_start_stack_ptr = yy_start_stack_depth = 0;
+	yy_start_stack = 0;
+
+	yy_current_buffer = 0;
+
+#ifdef YY_USES_REJECT
+	yy_state_buf = new yy_state_type[YY_BUF_SIZE + 2];
+#else
+	yy_state_buf = 0;
+#endif
+	}
+
+yyFlexLexer::~yyFlexLexer()
+	{
+	delete yy_state_buf;
+	yy_delete_buffer( yy_current_buffer );
+	}
+
+void yyFlexLexer::switch_streams( istream* new_in, ostream* new_out )
+	{
+	if ( new_in )
+		{
+		yy_delete_buffer( yy_current_buffer );
+		yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE ) );
+		}
+
+	if ( new_out )
+		yyout = new_out;
+	}
+
+#ifdef YY_INTERACTIVE
+int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
+#else
+int yyFlexLexer::LexerInput( char* buf, int max_size )
+#endif
+	{
+	if ( yyin->eof() || yyin->fail() )
+		return 0;
+
+#ifdef YY_INTERACTIVE
+	yyin->get( buf[0] );
+
+	if ( yyin->eof() )
+		return 0;
+
+	if ( yyin->bad() )
+		return -1;
+
+	return 1;
+
+#else
+	(void) yyin->read( buf, max_size );
+
+	if ( yyin->bad() )
+		return -1;
+	else
+		return yyin->gcount();
+#endif
+	}
+
+void yyFlexLexer::LexerOutput( const char* buf, int size )
+	{
+	(void) yyout->write( buf, size );
+	}
+
+/* yy_get_next_buffer - try to read in a new buffer
+ *
+ * Returns a code representing an action:
+ *	EOB_ACT_LAST_MATCH -
+ *	EOB_ACT_CONTINUE_SCAN - continue scanning from current position
+ *	EOB_ACT_END_OF_FILE - end of file
+ */
+
+int yyFlexLexer::yy_get_next_buffer()
+	{
+	register char *dest = yy_current_buffer->yy_ch_buf;
+	register char *source = yytext_ptr;
+	register int number_to_move, i;
+	int ret_val;
+
+	if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
+		YY_FATAL_ERROR(
+		"fatal flex scanner internal error--end of buffer missed" );
+
+	if ( yy_current_buffer->yy_fill_buffer == 0 )
+		{ /* Don't try to fill the buffer, so this is an EOF. */
+		if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
+			{
+			/* We matched a single character, the EOB, so
+			 * treat this as a final EOF.
+			 */
+			return EOB_ACT_END_OF_FILE;
+			}
+
+		else
+			{
+			/* We matched some text prior to the EOB, first
+			 * process it.
+			 */
+			return EOB_ACT_LAST_MATCH;
+			}
+		}
+
+	/* Try to read more data. */
+
+	/* First move last chars to start of buffer. */
+	number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
+
+	for ( i = 0; i < number_to_move; ++i )
+		*(dest++) = *(source++);
+
+	if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
+		/* don't do the read, it's not guaranteed to return an EOF,
+		 * just force an EOF
+		 */
+		yy_current_buffer->yy_n_chars = yy_n_chars = 0;
+
+	else
+		{
+		int num_to_read =
+			yy_current_buffer->yy_buf_size - number_to_move - 1;
+
+		while ( num_to_read <= 0 )
+			{ /* Not enough room in the buffer - grow it. */
+#ifdef YY_USES_REJECT
+			YY_FATAL_ERROR(
+"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
+#else
+
+			/* just a shorter name for the current buffer */
+			YY_BUFFER_STATE b = yy_current_buffer;
+
+			int yy_c_buf_p_offset =
+				(int) (yy_c_buf_p - b->yy_ch_buf);
+
+			if ( b->yy_is_our_buffer )
+				{
+				int new_size = b->yy_buf_size * 2;
+
+				if ( new_size <= 0 )
+					b->yy_buf_size += b->yy_buf_size / 8;
+				else
+					b->yy_buf_size *= 2;
+
+				b->yy_ch_buf = (char *)
+					/* Include room in for 2 EOB chars. */
+					yy_flex_realloc( (void *) b->yy_ch_buf,
+							 b->yy_buf_size + 2 );
+				}
+			else
+				/* Can't grow it, we don't own it. */
+				b->yy_ch_buf = 0;
+
+			if ( ! b->yy_ch_buf )
+				YY_FATAL_ERROR(
+				"fatal error - scanner input buffer overflow" );
+
+			yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
+
+			num_to_read = yy_current_buffer->yy_buf_size -
+						number_to_move - 1;
+#endif
+			}
+
+		if ( num_to_read > YY_READ_BUF_SIZE )
+			num_to_read = YY_READ_BUF_SIZE;
+
+		/* Read in more data. */
+		YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
+			yy_n_chars, num_to_read );
+
+		yy_current_buffer->yy_n_chars = yy_n_chars;
+		}
+
+	if ( yy_n_chars == 0 )
+		{
+		if ( number_to_move == YY_MORE_ADJ )
+			{
+			ret_val = EOB_ACT_END_OF_FILE;
+			yyrestart( yyin );
+			}
+
+		else
+			{
+			ret_val = EOB_ACT_LAST_MATCH;
+			yy_current_buffer->yy_buffer_status =
+				YY_BUFFER_EOF_PENDING;
+			}
+		}
+
+	else
+		ret_val = EOB_ACT_CONTINUE_SCAN;
+
+	yy_n_chars += number_to_move;
+	yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
+	yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
+
+	yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
+
+	return ret_val;
+	}
+
+
+/* yy_get_previous_state - get the state just before the EOB char was reached */
+
+yy_state_type yyFlexLexer::yy_get_previous_state()
+	{
+	register yy_state_type yy_current_state;
+	register char *yy_cp;
+
+	yy_current_state = yy_start;
+
+	for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
+		{
+		register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
+		if ( yy_accept[yy_current_state] )
+			{
+			yy_last_accepting_state = yy_current_state;
+			yy_last_accepting_cpos = yy_cp;
+			}
+		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+			{
+			yy_current_state = (int) yy_def[yy_current_state];
+			if ( yy_current_state >= 1055 )
+				yy_c = yy_meta[(unsigned int) yy_c];
+			}
+		yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+		}
+
+	return yy_current_state;
+	}
+
+
+/* yy_try_NUL_trans - try to make a transition on the NUL character
+ *
+ * synopsis
+ *	next_state = yy_try_NUL_trans( current_state );
+ */
+
+yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
+	{
+	register int yy_is_jam;
+	register char *yy_cp = yy_c_buf_p;
+
+	register YY_CHAR yy_c = 1;
+	if ( yy_accept[yy_current_state] )
+		{
+		yy_last_accepting_state = yy_current_state;
+		yy_last_accepting_cpos = yy_cp;
+		}
+	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+		{
+		yy_current_state = (int) yy_def[yy_current_state];
+		if ( yy_current_state >= 1055 )
+			yy_c = yy_meta[(unsigned int) yy_c];
+		}
+	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+	yy_is_jam = (yy_current_state == 1054);
+
+	return yy_is_jam ? 0 : yy_current_state;
+	}
+
+
+void yyFlexLexer::yyunput( int c, register char* yy_bp )
+	{
+	register char *yy_cp = yy_c_buf_p;
+
+	/* undo effects of setting up yytext */
+	*yy_cp = yy_hold_char;
+
+	if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
+		{ /* need to shift things up to make room */
+		/* +2 for EOB chars. */
+		register int number_to_move = yy_n_chars + 2;
+		register char *dest = &yy_current_buffer->yy_ch_buf[
+					yy_current_buffer->yy_buf_size + 2];
+		register char *source =
+				&yy_current_buffer->yy_ch_buf[number_to_move];
+
+		while ( source > yy_current_buffer->yy_ch_buf )
+			*--dest = *--source;
+
+		yy_cp += (int) (dest - source);
+		yy_bp += (int) (dest - source);
+		yy_current_buffer->yy_n_chars =
+			yy_n_chars = yy_current_buffer->yy_buf_size;
+
+		if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
+			YY_FATAL_ERROR( "flex scanner push-back overflow" );
+		}
+
+	*--yy_cp = (char) c;
+
+
+	yytext_ptr = yy_bp;
+	yy_hold_char = *yy_cp;
+	yy_c_buf_p = yy_cp;
+	}
+
+
+int yyFlexLexer::yyinput()
+	{
+	int c;
+
+	*yy_c_buf_p = yy_hold_char;
+
+	if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
+		{
+		/* yy_c_buf_p now points to the character we want to return.
+		 * If this occurs *before* the EOB characters, then it's a
+		 * valid NUL; if not, then we've hit the end of the buffer.
+		 */
+		if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
+			/* This was really a NUL. */
+			*yy_c_buf_p = '\0';
+
+		else
+			{ /* need more input */
+			int offset = yy_c_buf_p - yytext_ptr;
+			++yy_c_buf_p;
+
+			switch ( yy_get_next_buffer() )
+				{
+				case EOB_ACT_LAST_MATCH:
+					/* This happens because yy_g_n_b()
+					 * sees that we've accumulated a
+					 * token and flags that we need to
+					 * try matching the token before
+					 * proceeding.  But for input(),
+					 * there's no matching to consider.
+					 * So convert the EOB_ACT_LAST_MATCH
+					 * to EOB_ACT_END_OF_FILE.
+					 */
+
+					/* Reset buffer status. */
+					yyrestart( yyin );
+
+					/* fall through */
+
+				case EOB_ACT_END_OF_FILE:
+					{
+					if ( yywrap() )
+						return EOF;
+
+					if ( ! yy_did_buffer_switch_on_eof )
+						YY_NEW_FILE;
+#ifdef __cplusplus
+					return yyinput();
+#else
+					return input();
+#endif
+					}
+
+				case EOB_ACT_CONTINUE_SCAN:
+					yy_c_buf_p = yytext_ptr + offset;
+					break;
+				}
+			}
+		}
+
+	c = *(unsigned char *) yy_c_buf_p;	/* cast for 8-bit char's */
+	*yy_c_buf_p = '\0';	/* preserve yytext */
+	yy_hold_char = *++yy_c_buf_p;
+
+
+	return c;
+	}
+
+
+void yyFlexLexer::yyrestart( istream* input_file )
+	{
+	if ( ! yy_current_buffer )
+		yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
+
+	yy_init_buffer( yy_current_buffer, input_file );
+	yy_load_buffer_state();
+	}
+
+
+void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
+	{
+	if ( yy_current_buffer == new_buffer )
+		return;
+
+	if ( yy_current_buffer )
+		{
+		/* Flush out information for old buffer. */
+		*yy_c_buf_p = yy_hold_char;
+		yy_current_buffer->yy_buf_pos = yy_c_buf_p;
+		yy_current_buffer->yy_n_chars = yy_n_chars;
+		}
+
+	yy_current_buffer = new_buffer;
+	yy_load_buffer_state();
+
+	/* We don't actually know whether we did this switch during
+	 * EOF (yywrap()) processing, but the only time this flag
+	 * is looked at is after yywrap() is called, so it's safe
+	 * to go ahead and always set it.
+	 */
+	yy_did_buffer_switch_on_eof = 1;
+	}
+
+
+void yyFlexLexer::yy_load_buffer_state()
+	{
+	yy_n_chars = yy_current_buffer->yy_n_chars;
+	yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
+	yyin = yy_current_buffer->yy_input_file;
+	yy_hold_char = *yy_c_buf_p;
+	}
+
+
+YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( istream* file, int size )
+	{
+	YY_BUFFER_STATE b;
+
+	b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
+	if ( ! b )
+		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+	b->yy_buf_size = size;
+
+	/* yy_ch_buf has to be 2 characters longer than the size given because
+	 * we need to put in 2 end-of-buffer characters.
+	 */
+	b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
+	if ( ! b->yy_ch_buf )
+		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+	b->yy_is_our_buffer = 1;
+
+	yy_init_buffer( b, file );
+
+	return b;
+	}
+
+
+void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
+	{
+	if ( ! b )
+		return;
+
+	if ( b == yy_current_buffer )
+		yy_current_buffer = (YY_BUFFER_STATE) 0;
+
+	if ( b->yy_is_our_buffer )
+		yy_flex_free( (void *) b->yy_ch_buf );
+
+	yy_flex_free( (void *) b );
+	}
+
+
+void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, istream* file )
+
+	{
+	yy_flush_buffer( b );
+
+	b->yy_input_file = file;
+	b->yy_fill_buffer = 1;
+
+	b->yy_is_interactive = 0;
+	}
+
+
+void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
+	{
+	if ( ! b )
+		return;
+
+	b->yy_n_chars = 0;
+
+	/* We always need two end-of-buffer characters.  The first causes
+	 * a transition to the end-of-buffer state.  The second causes
+	 * a jam in that state.
+	 */
+	b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
+	b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
+
+	b->yy_buf_pos = &b->yy_ch_buf[0];
+
+	b->yy_at_bol = 1;
+	b->yy_buffer_status = YY_BUFFER_NEW;
+
+	if ( b == yy_current_buffer )
+		yy_load_buffer_state();
+	}
+
+
+#ifndef YY_NO_SCAN_BUFFER
+#endif
+
+
+#ifndef YY_NO_SCAN_STRING
+#endif
+
+
+#ifndef YY_NO_SCAN_BYTES
+#endif
+
+
+#ifndef YY_NO_PUSH_STATE
+void yyFlexLexer::yy_push_state( int new_state )
+	{
+	if ( yy_start_stack_ptr >= yy_start_stack_depth )
+		{
+		yy_size_t new_size;
+
+		yy_start_stack_depth += YY_START_STACK_INCR;
+		new_size = yy_start_stack_depth * sizeof( int );
+
+		if ( ! yy_start_stack )
+			yy_start_stack = (int *) yy_flex_alloc( new_size );
+
+		else
+			yy_start_stack = (int *) yy_flex_realloc(
+					(void *) yy_start_stack, new_size );
+
+		if ( ! yy_start_stack )
+			YY_FATAL_ERROR(
+			"out of memory expanding start-condition stack" );
+		}
+
+	yy_start_stack[yy_start_stack_ptr++] = YY_START;
+
+	BEGIN(new_state);
+	}
+#endif
+
+
+#ifndef YY_NO_POP_STATE
+void yyFlexLexer::yy_pop_state()
+	{
+	if ( --yy_start_stack_ptr < 0 )
+		YY_FATAL_ERROR( "start-condition stack underflow" );
+
+	BEGIN(yy_start_stack[yy_start_stack_ptr]);
+	}
+#endif
+
+
+#ifndef YY_NO_TOP_STATE
+int yyFlexLexer::yy_top_state()
+	{
+	return yy_start_stack[yy_start_stack_ptr - 1];
+	}
+#endif
+
+#ifndef YY_EXIT_FAILURE
+#define YY_EXIT_FAILURE 2
+#endif
+
+
+void yyFlexLexer::LexerError( yyconst char msg[] )
+	{
+	cerr << msg << '\n';
+	exit( YY_EXIT_FAILURE );
+	}
+
+
+/* Redefine yyless() so it works in section 3 code. */
+
+#undef yyless
+#define yyless(n) \
+	do \
+		{ \
+		/* Undo effects of setting up yytext. */ \
+		yytext[yyleng] = yy_hold_char; \
+		yy_c_buf_p = yytext + n; \
+		yy_hold_char = *yy_c_buf_p; \
+		*yy_c_buf_p = '\0'; \
+		yyleng = n; \
+		} \
+	while ( 0 )
+
+
+/* Internal utility routines. */
+
+#ifndef yytext_ptr
+#ifdef YY_USE_PROTOS
+static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
+#else
+static void yy_flex_strncpy( s1, s2, n )
+char *s1;
+yyconst char *s2;
+int n;
+#endif
+	{
+	register int i;
+	for ( i = 0; i < n; ++i )
+		s1[i] = s2[i];
+	}
+#endif
+
+#ifdef YY_NEED_STRLEN
+#ifdef YY_USE_PROTOS
+static int yy_flex_strlen( yyconst char *s )
+#else
+static int yy_flex_strlen( s )
+yyconst char *s;
+#endif
+	{
+	register int n;
+	for ( n = 0; s[n]; ++n )
+		;
+
+	return n;
+	}
+#endif
+
+
+#ifdef YY_USE_PROTOS
+static void *yy_flex_alloc( yy_size_t size )
+#else
+static void *yy_flex_alloc( size )
+yy_size_t size;
+#endif
+	{
+	return (void *) malloc( size );
+	}
+
+#ifdef YY_USE_PROTOS
+static void *yy_flex_realloc( void *ptr, yy_size_t size )
+#else
+static void *yy_flex_realloc( ptr, size )
+void *ptr;
+yy_size_t size;
+#endif
+	{
+	/* The cast to (char *) in the following accommodates both
+	 * implementations that use char* generic pointers, and those
+	 * that use void* generic pointers.  It works with the latter
+	 * because both ANSI C and C++ allow castless assignment from
+	 * any pointer type to void*, and deal with argument conversions
+	 * as though doing an assignment.
+	 */
+	return (void *) realloc( (char *) ptr, size );
+	}
+
+#ifdef YY_USE_PROTOS
+static void yy_flex_free( void *ptr )
+#else
+static void yy_flex_free( ptr )
+void *ptr;
+#endif
+	{
+	free( ptr );
+	}
+
+#if YY_MAIN
+int main()
+	{
+	yylex();
+	return 0;
+	}
+#endif
+#line 172 "sparqlScanner.ll"
+
+int yywrap()
+{
+        return(1);
+}
+
+int sparqlFlexLexer::LexerReadStatic( char* buf, int max_size )
+{
+    char** cur = yyptr;
+    char* start = *cur;
+#if 0
+    for (; **cur && max_size > 0; (*cur)++, buf++) {
+      *buf = **cur;
+      max_size--;
+    }
+#else
+    if (**cur && max_size > 0) {
+      *buf = **cur;
+      (*cur)++, buf++;
+    }
+#endif
+    return *cur - start;
+}
+
+sparqlFlexLexer::sparqlFlexLexer( THD *thd, char** ptr)
+	{
+	this->thd = thd;
+	yyptr = ptr;
+
+	yyin = NULL;
+	yyout = NULL;
+	yy_c_buf_p = 0;
+	yy_init = 1;
+	yy_start = 0;
+	yy_flex_debug = 0;
+	yylineno = 1;	// this will only get updated if %option yylineno
+
+	yy_did_buffer_switch_on_eof = 0;
+
+	yy_looking_for_trail_begin = 0;
+	yy_more_flag = 0;
+	yy_more_len = 0;
+	yy_more_offset = yy_prev_more_offset = 0;
+
+	yy_start_stack_ptr = yy_start_stack_depth = 0;
+	yy_start_stack = 0;
+
+	yy_current_buffer = 0;
+
+#ifdef YY_USES_REJECT
+	yy_state_buf = new yy_state_type[YY_BUF_SIZE + 2];
+#else
+	yy_state_buf = 0;
+#endif
+	}
+
+LEX_STRING sparqlFlexLexer::get_token(size_t skip, size_t trail)
+{
+  LEX_STRING tmp;
+  tmp.length = yyleng - skip - trail;
+  tmp.str = (char*) thd->strmake((char*) yytext + skip, tmp.length);
+  return tmp;
+}
+
diff -Naur -x .deps -x mysqld -x '*~' -x '*.o' -x '*.a' -x '*.libs' -x mysql_tzinfo_to_sql -x '*.la' -x '*.lo' -x Makefile -x Makefile.in mysql-dfsg-5.0-5.0.41/sql/Makefile.am mysql-dfsg-5.0-5.0.41-spasql/sql/Makefile.am
--- mysql-dfsg-5.0-5.0.41/sql/Makefile.am	2006-11-23 21:13:25.000000000 +0100
+++ mysql-dfsg-5.0-5.0.41-spasql/sql/Makefile.am	2006-12-14 13:08:09.000000000 +0100
@@ -33,6 +34,7 @@
 			$(top_builddir)/myisammrg/libmyisammrg.a \
 			$(top_builddir)/heap/libheap.a \
 			$(top_builddir)/vio/libvio.a \
+			$(top_builddir)/sparql/libsparql.a \
 			$(top_builddir)/mysys/libmysys.a \
 			$(top_builddir)/dbug/libdbug.a \
 			$(top_builddir)/regex/libregex.a \
diff -Naur -x .deps -x mysqld -x '*~' -x '*.o' -x '*.a' -x '*.libs' -x mysql_tzinfo_to_sql -x '*.la' -x '*.lo' -x Makefile -x Makefile.in mysql-dfsg-5.0-5.0.41/sql/sql_parse.cc mysql-dfsg-5.0-5.0.41-spasql/sql/sql_parse.cc
--- mysql-dfsg-5.0-5.0.41/sql/sql_parse.cc	2006-12-13 21:31:10.000000000 +0100
+++ mysql-dfsg-5.0-5.0.41-spasql/sql/sql_parse.cc	2006-12-14 17:39:01.000000000 +0100
@@ -33,6 +33,9 @@
 #include "sp.h"
 #include "sp_cache.h"
 #include "sql_trigger.h"
+//#include <sstream>
+#include "../sparql/sparqlFrob.h"
+//#include <algorithm>
 
 #ifdef HAVE_OPENSSL
 /*
@@ -5943,7 +5765,16 @@
     sp_cache_flush_obsolete(&thd->sp_proc_cache);
     sp_cache_flush_obsolete(&thd->sp_func_cache);
     
-    if (!MYSQLparse((void *)thd) && ! thd->is_fatal_error)
+    int parse_res;
+    if (!strncmp(inBuf, "SPARQL:", 7)) {
+      lex->ptr = (uchar*)inBuf+7;
+      sparqlFrob frob(thd, (char**)&lex->ptr);
+      parse_res = frob.parse();
+    } else {
+      parse_res = MYSQLparse((void *)thd);
+    }
+
+    if (!parse_res && ! thd->is_fatal_error)
     {
 #ifndef NO_EMBEDDED_ACCESS_CHECKS
       if (mqh_used && thd->user_connect &&
--- mysql-dfsg-5.0-5.0.41/libmysqld/examples/Makefile.am	2006-11-23 21:13:34.000000000 +0100
+++ mysql-dfsg-5.0-5.0.41-spasql/libmysqld/examples/Makefile.am	2006-12-14 16:54:07.000000000 +0100
@@ -35,7 +36,7 @@
 		-I$(top_srcdir) -I$(top_srcdir)/client -I$(top_srcdir)/regex \
 		$(openssl_includes)
 LIBS =		@LIBS@ @WRAPLIBS@ @CLIENT_LIBS@ $(yassl_libs)
-LDADD =		@CLIENT_EXTRA_LDFLAGS@ ../libmysqld.a @innodb_system_libs@ @LIBDL@ $(CXXLDFLAGS)
+LDADD =		@CLIENT_EXTRA_LDFLAGS@ ../libmysqld.a ../../sparql/libsparql.a @innodb_system_libs@ @LIBDL@ $(CXXLDFLAGS)
 
 mysqltest_embedded_LINK = $(CXXLINK)
 mysqltest_embedded_SOURCES =	mysqltest.c
--- mysql-dfsg-5.0-5.0.41/Makefile.am	2006-11-23 21:13:06.000000000 +0100
+++ mysql-dfsg-5.0-5.0.41-spasql/Makefile.am	2006-12-14 13:45:33.000000000 +0100
@@ -27,12 +28,14 @@
 			netware @libmysqld_dirs@ \
 			@bench_dirs@ support-files @tools_dirs@
 
+
 DIST_SUBDIRS =		. include @docs_dirs@ zlib \
 			@readline_topdir@ sql-common \
 			@thread_dirs@ pstack \
 			@sql_union_dirs@ scripts @man_dirs@ tests SSL\
 			BUILD netware os2 @libmysqld_dirs@ \
-			@bench_dirs@ support-files @tools_dirs@ win
+			@bench_dirs@ support-files @tools_dirs@ win \
+			sparql
 
 # Run these targets before any others, also make part of clean target,
 # to make sure we create new links after a clean.
--- mysql-dfsg-5.0-5.0.41/configure.in	2006-11-23 21:13:07.000000000 +0100
+++ mysql-dfsg-5.0-5.0.41-spasql/configure.in	2006-12-14 13:57:51.000000000 +0100
@@ -252,6 +245,8 @@
 
 # Not critical since the generated file is distributed
 AC_CHECK_PROGS(YACC, ['bison -y -p MYSQL'])
+AC_CHECK_PROGS(YACCCC, ['bison++ -p sparql -d -v'])
+AC_CHECK_PROGS(LEX, ['flex++'])
 AC_CHECK_PROG(PDFMANUAL, pdftex, manual.pdf)
 AC_CHECK_PROG(DVIS,      tex,    manual.dvi)
 
@@ -2736,7 +2639,7 @@
   #
   # END of configuration for optional table handlers
   #
-  sql_server_dirs="$sql_server_dirs myisam myisammrg heap vio sql"
+  sql_server_dirs="$sql_server_dirs sparql myisam myisammrg heap vio sql"
 fi
 
 # IMPORTANT - do not modify LIBS past this line - this hack is the only way
@@ -2920,7 +2819,7 @@
 # Output results
 AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile dnl
  strings/Makefile regex/Makefile heap/Makefile dnl
- myisam/Makefile myisammrg/Makefile dnl
+ sparql/Makefile myisam/Makefile myisammrg/Makefile dnl
  os2/Makefile os2/include/Makefile os2/include/sys/Makefile dnl
  man/Makefile BUILD/Makefile vio/Makefile dnl
  libmysql/Makefile client/Makefile dnl

