X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=src%2Forg%2Fz3950%2Fzing%2Fcql%2FCQLGenerator.java;h=d16c9522cd76c9e8f07d47d1865cb18b300b3b95;hb=8e35f984081a29de9b53af7c1b2fbf981c474d88;hp=747bf520baea4171b1bf4a71b517e81ec45fa31a;hpb=f744abfa23a7e569a156e4686e0e8e3cec242652;p=cql-java-moved-to-github.git diff --git a/src/org/z3950/zing/cql/CQLGenerator.java b/src/org/z3950/zing/cql/CQLGenerator.java index 747bf52..d16c952 100644 --- a/src/org/z3950/zing/cql/CQLGenerator.java +++ b/src/org/z3950/zing/cql/CQLGenerator.java @@ -1,4 +1,4 @@ -// $Id: CQLGenerator.java,v 1.5 2002-11-20 01:15:14 mike Exp $ +// $Id: CQLGenerator.java,v 1.8 2007-06-29 10:24:24 mike Exp $ package org.z3950.zing.cql; import java.util.Properties; @@ -18,11 +18,11 @@ import java.io.FileNotFoundException; * the parser of your choice, and check that the XCQL it comes up with * is the same what you got from your initial rendering. *

- * This code is based on the grammar in the Grammar file of + * This code is based on the same grammar as the CQLParser class in * this distribution - there is a generate_x() method * for each grammar element X. * - * @version $Id: CQLGenerator.java,v 1.5 2002-11-20 01:15:14 mike Exp $ + * @version $Id: CQLGenerator.java,v 1.8 2007-06-29 10:24:24 mike Exp $ * @see http://zing.z3950.org/cql/index.html */ @@ -64,7 +64,7 @@ public class CQLGenerator { * [mandatory] A floating-point number between 0.0 and 1.0, * indicating the probability for each search-clause * node that it will be expanded into a full sub-query rather - * than a [ qualifier relation ] term triplet. + * than an [ index relation ] term triplet. *

* *

proxOp
@@ -141,9 +141,9 @@ public class CQLGenerator { // ### generate proximity nodes } else { switch (rnd.nextInt(3)) { - case 0: return new CQLAndNode(node1, node2); - case 1: return new CQLOrNode(node1, node2); - case 2: return new CQLNotNode(node1, node2); + case 0: return new CQLAndNode(node1, node2, null); + case 1: return new CQLOrNode(node1, node2, null); + case 2: return new CQLNotNode(node1, node2, null); } } @@ -155,33 +155,33 @@ public class CQLGenerator { return generate_cql_query(); } - // ### Should sometimes generate qualifier/relation-free terms - String qualifier = generate_qualifier(); + // ### Should sometimes generate index/relation-free terms + String index = generate_index(); CQLRelation relation = generate_relation(); String term = generate_term(); - return new CQLTermNode(qualifier, relation, term); + return new CQLTermNode(index, relation, term); } // ### Should probably be more configurable - private String generate_qualifier() { - String qualifier = ""; // shut up compiler warning + private String generate_index() { + String index = ""; // shut up compiler warning if (rnd.nextInt(2) == 0) { switch (rnd.nextInt(3)) { - case 0: qualifier = "dc.author"; break; - case 1: qualifier = "dc.title"; break; - case 2: qualifier = "dc.subject"; break; + case 0: index = "dc.author"; break; + case 1: index = "dc.title"; break; + case 2: index = "dc.subject"; break; } } else { switch (rnd.nextInt(4)) { - case 0: qualifier = "bath.author"; break; - case 1: qualifier = "bath.title"; break; - case 2: qualifier = "bath.subject"; break; - case 3: qualifier = "foo>bar"; break; + case 0: index = "bath.author"; break; + case 1: index = "bath.title"; break; + case 2: index = "bath.subject"; break; + case 3: index = "foo>bar"; break; } } - return qualifier; + return index; } private CQLRelation generate_relation() throws MissingParameterException {