X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=src%2Forg%2Fz3950%2Fzing%2Fcql%2FCQLPrefixNode.java;h=a08fa6487ee0ee45dc3ee63f3dfd3333326c57e6;hb=8e35f984081a29de9b53af7c1b2fbf981c474d88;hp=f5996ecc611c5658ef11c337cc8717ac27cf11ba;hpb=e4126f4c547f5f823fbfceb4169786bc7cf98401;p=cql-java-moved-to-github.git diff --git a/src/org/z3950/zing/cql/CQLPrefixNode.java b/src/org/z3950/zing/cql/CQLPrefixNode.java index f5996ec..a08fa64 100644 --- a/src/org/z3950/zing/cql/CQLPrefixNode.java +++ b/src/org/z3950/zing/cql/CQLPrefixNode.java @@ -1,4 +1,4 @@ -// $Id: CQLPrefixNode.java,v 1.6 2007-06-06 12:22:01 mike Exp $ +// $Id: CQLPrefixNode.java,v 1.8 2007-06-27 22:39:55 mike Exp $ package org.z3950.zing.cql; import java.lang.String; @@ -9,7 +9,7 @@ import java.util.Vector; /** * Represents a prefix node in a CQL parse-tree. * - * @version $Id: CQLPrefixNode.java,v 1.6 2007-06-06 12:22:01 mike Exp $ + * @version $Id: CQLPrefixNode.java,v 1.8 2007-06-27 22:39:55 mike Exp $ */ public class CQLPrefixNode extends CQLNode { /** @@ -25,7 +25,7 @@ public class CQLPrefixNode extends CQLNode { /** * Creates a new CQLPrefixNode inducing a mapping from the - * specified qualifier-set name to the specified identifier across + * specified index-set name to the specified identifier across * the specified subtree. */ public CQLPrefixNode(String name, String identifier, CQLNode subtree) { @@ -49,14 +49,19 @@ public class CQLPrefixNode extends CQLNode { } public String toCQL() { - // ### We don't always need parens around the operand - return ">" + prefix.name + "=\"" + prefix.identifier + "\" " + - "(" + subtree.toCQL() + ")"; + // ### We don't always need parens around the subtree + if (prefix.name == null) { + return ">\"" + prefix.identifier + "\" " + + "(" + subtree.toCQL() + ")"; + } else { + return ">" + prefix.name + "=\"" + prefix.identifier + "\" " + + "(" + subtree.toCQL() + ")"; + } } public String toPQF(Properties config) throws PQFTranslationException { // Prefixes and their identifiers don't actually play any role - // in PQF translation, since the meanings of the qualifiers, + // in PQF translation, since the meanings of the indexes, // including their prefixes if any, are instead wired into // `config'. return subtree.toPQF(config);