-$Id: Changes,v 1.32 2003-07-29 22:53:02 mike Exp $
+$Id: Changes,v 1.33 2003-09-04 21:56:46 mike Exp $
Revision history for the CQL-Java package.
See the bottom of this file for a list of things still to do.
+0.7 Thu Sep 4 22:51:11 2003
+ - Support for profiled relations and relation modifiers:
+ recognise any non-key word as a relation or modifier,
+ rejecting those that are not of the form <prefix>.<name>
+ since these must be explicitly tied to a "context" (what
+ used to be called a qualifier-set or index-set).
+
0.6 Tue Jul 29 23:33:56 2003
- Include Ralph's fix for CQLTermNode::toType1BER() to prevent
it surrounding multi-word terms in quotes when encoded into
-// $Id: CQLParser.java,v 1.22 2002-11-20 01:15:15 mike Exp $
+// $Id: CQLParser.java,v 1.23 2003-09-04 21:56:46 mike Exp $
package org.z3950.zing.cql;
import java.io.IOException;
/**
* Compiles CQL strings into parse trees of CQLNode subtypes.
*
- * @version $Id: CQLParser.java,v 1.22 2002-11-20 01:15:15 mike Exp $
+ * @version $Id: CQLParser.java,v 1.23 2003-09-04 21:56:46 mike Exp $
* @see <A href="http://zing.z3950.org/cql/index.html"
* >http://zing.z3950.org/cql/index.html</A>
*/
break;
qualifier = word;
- relation = new CQLRelation(lexer.render(lexer.ttype, false));
+ relation = new CQLRelation(lexer.ttype == lexer.TT_WORD ?
+ lexer.sval :
+ lexer.render(lexer.ttype, false));
match(lexer.ttype);
while (lexer.ttype == '/') {
if (lexer.ttype != lexer.TT_RELEVANT &&
lexer.ttype != lexer.TT_FUZZY &&
lexer.ttype != lexer.TT_STEM &&
- lexer.ttype != lexer.TT_PHONETIC)
+ lexer.ttype != lexer.TT_PHONETIC &&
+ lexer.ttype != lexer.TT_WORD)
throw new CQLParseException("expected relation modifier, "
+ "got " + lexer.render());
+ if (lexer.ttype == lexer.TT_WORD &&
+ lexer.sval.indexOf('.') == -1)
+ throw new CQLParseException("unknown first-class " +
+ "relation modifier: " +
+ lexer.sval);
+
relation.addModifier(lexer.sval.toLowerCase());
match(lexer.ttype);
}
match(lexer.ttype);
}
- private boolean isBaseRelation() {
+ private boolean isBaseRelation()
+ throws CQLParseException {
debug("isBaseRelation: checking ttype=" + lexer.ttype +
" (" + lexer.render() + ")");
+
+ if (lexer.ttype == lexer.TT_WORD &&
+ lexer.sval.indexOf('.') == -1)
+ throw new CQLParseException("unknown first-class relation: " +
+ lexer.sval);
+
return (isProxRelation() ||
lexer.ttype == lexer.TT_ANY ||
lexer.ttype == lexer.TT_ALL ||
lexer.ttype == lexer.TT_EXACT ||
- lexer.ttype == lexer.TT_SCR);
+ lexer.ttype == lexer.TT_SCR ||
+ lexer.ttype == lexer.TT_WORD);
}
// Checks for a relation that may be used inside a prox operator
-// $Id: CQLRelation.java,v 1.10 2002-12-11 17:14:20 mike Exp $
+// $Id: CQLRelation.java,v 1.11 2003-09-04 21:56:46 mike Exp $
package org.z3950.zing.cql;
import java.util.Vector;
/**
* Represents a relation between a CQL qualifier and term.
*
- * @version $Id: CQLRelation.java,v 1.10 2002-12-11 17:14:20 mike Exp $
+ * @version $Id: CQLRelation.java,v 1.11 2003-09-04 21:56:46 mike Exp $
*/
public class CQLRelation extends CQLNode {
ModifierSet ms;
* Creates a new CQLRelation with the specified base relation.
* Typical base relations include the usual six ordering relations
* (<TT><=</TT>, <TT>></TT>, <I>etc.</I>), the text
- * relations <TT>any</TT>, <TT>all</TT> and <TT>exact</TT> and the
- * server-choice relation <TT>scr</TT>.
+ * relations <TT>any</TT>, <TT>all</TT> and <TT>exact</TT>, the
+ * server-choice relation <TT>scr</TT> and profiled relations of
+ * the form <TT><I>prefix</I>.<I>name</I></TT>.
*/
public CQLRelation(String base) {
ms = new ModifierSet(base);