X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=src%2Forg%2Fz3950%2Fzing%2Fcql%2FCQLGenerator.java;h=7cde23e845caa0fbaba4640668a9adcd23557f56;hb=af923f9b50aecdbf896af612e733817f96c4388a;hp=c0f05ce75184e176498824838da446c58d12ae46;hpb=df372083094087da8590a526e0222c81c9ae7fc0;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 c0f05ce..7cde23e 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.4 2002-11-06 00:05:58 mike Exp $ +// $Id: CQLGenerator.java,v 1.7 2007-06-27 22:39:55 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.4 2002-11-06 00:05:58 mike Exp $ + * @version $Id: CQLGenerator.java,v 1.7 2007-06-27 22:39:55 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
@@ -136,6 +136,7 @@ public class CQLGenerator { CQLNode node1 = generate_cql_query(); CQLNode node2 = generate_search_clause(); + // ### should generate prefix-mapping nodes if (maybe("proxOp")) { // ### generate proximity nodes } else { @@ -154,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 {