- * Compiles a CQL query.
- * <P>
- * The resulting parse tree may be further processed by hand (see
- * the individual node-types' documentation for details on the
- * data structure) or, more often, simply rendered out in the
- * desired form using one of the back-ends. <TT>toCQL()</TT>
- * returns a decompiled CQL query equivalent to the one that was
- * compiled in the first place; <TT>toXCQL()</TT> returns an
- * XML snippet representing the query; and <TT>toPQF()</TT>
- * returns the query rendered in Index Data's Prefix Query
- * Format.
- *
- * @param cql The query
- * @return A CQLNode object which is the root of a parse
- * tree representing the query. */
- public CQLNode parse(String cql) throws CQLParseException, IOException {
- return parse(new StringReader(cql));
+ * Registers custom relation in this parser. Note that when a custom relation
+ * is registered the parser is no longer strictly compliant with the chosen spec.
+ * @param relation
+ * @return true if custom relation has not been registered already
+ */
+ public boolean registerCustomRelation(String relation) {
+ return customRelations.add(relation);
+ }
+
+ /**
+ * Unregisters previously registered custom relation in this instance of the parser.
+ * @param relation
+ * @return true is relation has been previously registered
+ */
+ public boolean unregisterCustomRelation(String relation) {
+ return customRelations.remove(relation);