1 // $Id: CQLRelation.java,v 1.11 2003-09-04 21:56:46 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.11 2003-09-04 21:56:46 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>, the
21 * server-choice relation <TT>scr</TT> and profiled relations of
22 * the form <TT><I>prefix</I>.<I>name</I></TT>.
24 public CQLRelation(String base) {
25 ms = new ModifierSet(base);
29 * Returns the base relation with which the CQLRelation was
32 public String getBase() {
37 * Adds a new relation modifier to the specified CQLRelation.
38 * Typical relation modifiers include <TT>relevant</TT>,
39 * <TT>fuzzy</TT>, <TT>stem</TT> and <TT>phonetic</TT>. On the
40 * whole, these modifiers have a meaningful interpretation only
41 * for the text relations.
43 public void addModifier(String modifier) {
44 ms.addModifier(null, modifier);
48 * Returns an array of the modifiers associated with a CQLRelation.
50 * An array of zero or more <TT>String</TT>s, each representing a
51 * modifier associated with the specified CQLRelation.
53 public String[] getModifiers() {
54 Vector[] v = ms.getModifiers();
56 String[] s = new String[n];
57 for (int i = 0; i < n; i++) {
58 s[i] = (String) v[i].get(1);
63 public String toXCQL(int level, Vector prefixes) {
64 return ms.toXCQL(level, "relation");
67 public String toCQL() {
71 public String toPQF(Properties config) throws PQFTranslationException {
72 throw new Error("CQLRelation.toPQF() can never be called");
75 public byte[] toType1BER(Properties config) {
76 throw new Error("CQLRelation.toType1BER() can never be called");