Package org.jzkit.search.util

Examples of org.jzkit.search.util.QueryModel


                             Map<String,AttrValue> transforms,
                             QueryModel qm,
                             String target_cql) throws org.jzkit.search.util.Profile.ProfileServiceException, org.jzkit.search.util.QueryModel.InvalidQueryException {

    org.jzkit.search.util.Profile.ProfileService ps = (org.jzkit.search.util.Profile.ProfileService) ctx.getBean("ProfileService");
    QueryModel new_qm = ps.makeConformant(qm,valid_attributes,transforms,null);
    String new_cql = transform(new_qm,ctx);
    log.debug(" testing "+qm.toString()+" -> "+new_cql+" (want "+target_cql+")");
    if ( new_cql.equals(target_cql) ) {
      log.debug(" PASS ");
    }
View Full Code Here


      // Do a search
      org.jzkit.search.impl.StatelessQueryService sqs = svc.getStatelessQueryService();

      String result_set_id = null;
      QueryModel model = new org.jzkit.search.util.QueryModel.PrefixString.PrefixString("@attrset bib-1 @attr 1=4 Science");
      LandscapeSpecification landscape = new org.jzkit.search.landscape.SimpleLandscapeSpecification(collection_ids);
      int first_hit = 1;
      int num_hits = 10;
      RecordFormatSpecification rfs = null;
      ExplicitRecordFormatSpecification display_spec = null;
View Full Code Here

    app_context = new ClassPathXmlApplicationContext( "TestApplicationContext.xml" );
  }

  public void testSimplePrefix() throws Exception {
    System.err.println("\n\ntestSimplePrefix\n\n");
    QueryModel qm = new org.jzkit.search.util.QueryModel.PrefixString.PrefixString("@attrset bib-1 @attr 1=4 science");
    System.err.println("Result of parse = "+qm.toString());
    InternalModelRootNode imrn = qm.toInternalQueryModel(app_context);
    System.err.println("Internal Model = "+imrn);
    System.err.println("Internal Model using RPN Visitor = "+org.jzkit.search.util.QueryModel.PrefixString.PrefixQueryVisitor.toPQF(imrn));
  }
View Full Code Here

    System.err.println("Internal Model using RPN Visitor = "+org.jzkit.search.util.QueryModel.PrefixString.PrefixQueryVisitor.toPQF(imrn));
  }

  public void testBooleanPrefix() throws Exception {
    System.err.println("\n\ntestBooleanPrefix\n\n");
    QueryModel qm = new org.jzkit.search.util.QueryModel.PrefixString.PrefixString("@attrset bib-1 @and @attr 1=4 science @attr 1=2 beer");
    System.err.println("Result of parse = "+qm.toString());
    InternalModelRootNode imrn = qm.toInternalQueryModel(app_context);
    System.err.println("Internal Model = "+imrn);
    System.err.println("Internal Model using RPN Visitor = "+org.jzkit.search.util.QueryModel.PrefixString.PrefixQueryVisitor.toPQF(imrn));
  }
View Full Code Here

    // Here we need to get an instance of CQLQuery.. So if thats not what we have been passed,
    // this is the place to create one.
    log.fine("Class of IRQuery: "+q.getQueryModel().getClass().getName());

    CQLString cql_string = null;
    QueryModel qm = q.getQueryModel();

    if ( qm instanceof CQLString )
      cql_string = (CQLString)qm;
    else
      cql_string = CQLBuilder.buildFrom(qm, ctx);
View Full Code Here

    System.err.println("Internal Model using RPN Visitor = "+org.jzkit.search.util.QueryModel.PrefixString.PrefixQueryVisitor.toPQF(imrn));
  }

  public void testSimpleInternal() throws Exception {
    System.err.println("\n\ntestSimpleInternal\n\n");
    QueryModel qm = InternalModelRootNode.createInstanceFromClasspathFile("/DefaultQueryModel.xml");
    System.err.println("Result of parse = "+qm.toString());
    InternalModelRootNode imrn = qm.toInternalQueryModel(app_context);
    System.err.println("Internal Model = "+imrn);
    System.err.println("Internal Model using RPN Visitor = "+org.jzkit.search.util.QueryModel.PrefixString.PrefixQueryVisitor.toPQF(imrn));
  }
View Full Code Here

    System.err.println("Internal Model using RPN Visitor = "+org.jzkit.search.util.QueryModel.PrefixString.PrefixQueryVisitor.toPQF(imrn));
  }

  public void testTemplateBasedQueryFactory() throws Exception {
    System.err.println("\n\ntestTemplateBasedQueryFactory\n\n");
    QueryModel qm = InternalModelRootNode.createInstanceFromClasspathFile("/DefaultQueryModel.xml");
    System.err.println("Result of parse = "+qm.toString()); System.err.println("Internal Model = "+qm.toInternalQueryModel(app_context).toString());
    Map values = new HashMap();
    values.put("query.SubjectCriteria.term","Sports");
    values.put("query.PlaceCriteria.term","Sheffield");
    InternalModelRootNode qm2 = TemplateBasedQueryFactory.visit((InternalModelRootNode)qm,values);
    System.err.println("New Internal Model = "+qm2.toString());
View Full Code Here

    System.err.println("Internal Model using RPN Visitor = "+org.jzkit.search.util.QueryModel.PrefixString.PrefixQueryVisitor.toPQF(qm2));
  }

  public void testAdvancedTemplateBasedQueryFactory() throws Exception {
    System.err.println("\n\nadvancedTestTemplateBasedQueryFactory\n\n");
    QueryModel qm = InternalModelRootNode.createInstanceFromClasspathFile("/DefaultQueryModel.xml");
    System.err.println("Result of parse = "+qm.toString());
    System.err.println("Internal Model = "+qm.toInternalQueryModel(app_context).toString());
    Map values = new HashMap();
    values.put("query.SubjectCriteria.term","Sports \"and a phrase\" Other Term \"And another phrase\"");
    values.put("query.SubjectCriteria.relation","Like");
    values.put("query.SubjectCriteria.truncation","RightAndLeft");
    values.put("query.PlaceCriteria.term","Sheffield");
View Full Code Here

    System.err.println("Internal Model using RPN Visitor = "+org.jzkit.search.util.QueryModel.PrefixString.PrefixQueryVisitor.toPQF(qm2));
  }

  public void testQuotedStrings() throws Exception {
    System.err.println("\n\ntestQuotedStrings\n\n");
    QueryModel qm = InternalModelRootNode.createInstanceFromClasspathFile("/DefaultQueryModel.xml");
    System.err.println("Result of parse = "+qm.toString());
    System.err.println("Internal Model = "+qm.toInternalQueryModel(app_context).toString());
    Map values = new HashMap();
    values.put("query.SubjectCriteria.term","Sports \\\"and a phrase\\\" Other Term \\\"And another phrase\\\"");
    InternalModelRootNode qm2 = TemplateBasedQueryFactory.visit((InternalModelRootNode)qm,values);
    System.err.println("New Internal Model = "+qm2.toString());
    String new_rpn = org.jzkit.search.util.QueryModel.PrefixString.PrefixQueryVisitor.toPQF(qm2);
View Full Code Here

    // }
  }

  public void testPassthrough() throws Exception {
    System.err.println("\n\ntestPassthrough\n\n");
    QueryModel qm = InternalModelRootNode.createInstanceFromClasspathFile("/DefaultQueryModel.xml");
    System.err.println("Result of parse = "+qm.toString());
    System.err.println("Internal Model = "+qm.toInternalQueryModel(app_context).toString());
    Map values = new HashMap();
    values.put("query.SubjectCriteria.multiTermOp","PASSTHRU");
    values.put("query.SubjectCriteria.term","Sports \"and a phrase\" Other Term \"And another phrase\"");
    InternalModelRootNode qm2 = TemplateBasedQueryFactory.visit((InternalModelRootNode)qm,values);
    System.err.println("New Internal Model = "+qm2.toString());
View Full Code Here

TOP

Related Classes of org.jzkit.search.util.QueryModel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.