1 // $Id: CQLRelation.java,v 1.7 2002-11-20 01:15:15 mike Exp $
3 package org.z3950.zing.cql;
4 import java.util.Vector;
5 import java.util.Properties;
6 import java.lang.StringBuffer;
9 * Represents a relation between a CQL qualifier and term.
11 * @version $Id: CQLRelation.java,v 1.7 2002-11-20 01:15:15 mike Exp $
13 public class CQLRelation extends CQLNode {
17 * Creates a new CQLRelation with the specified base relation.
18 * Typical base relations include the usual six ordering relations
19 * (<TT><=</TT>, <TT>></TT>, <I>etc.</I>), the text
20 * relations <TT>any</TT>, <TT>all</TT> and <TT>exact</TT> and the
21 * server-choice relation <TT>scr</TT>.
23 public CQLRelation(String base) {
24 ms = new ModifierSet(base);
28 * Returns the base relation with which the CQLRelation was
31 public String getBase() {
36 * Adds a new relation modifier to the specified CQLRelation.
37 * Typical relation modifiers include <TT>relevant</TT>,
38 * <TT>fuzzy</TT>, <TT>stem</TT> and <TT>phonetic</TT>. On the
39 * whole, these modifiers have a meaningful interpretation only
40 * for the text relations.
42 public void addModifier(String modifier) {
43 ms.addModifier(null, modifier);
47 * Returns an array of the modifiers associated with a CQLRelation.
49 * An array of zero or more <TT>String</TT>s, each representing a
50 * modifier associated with the specified CQLRelation.
52 public String[] getModifiers() {
53 Vector[] v = ms.getModifiers();
55 String[] s = new String[n];
56 for (int i = 0; i < n; i++) {
57 s[i] = (String) v[i].get(1);
62 public String toXCQL(int level, Vector prefixes) {
63 return ms.toXCQL(level, "relation");
66 public String toCQL() {
70 public String toPQF(Properties config) throws PQFTranslationException {
71 throw new Error("CQLRelation.toPQF() can never be called");