Examples of ValueFilter


Examples of org.apache.hadoop.hbase.filter.ValueFilter

  @Test
  public void testValueFilter() throws Exception {
    // Match group one rows
    long expectedRows = numRows / 2;
    long expectedKeys = colsPerRow;
    Filter f = new ValueFilter(CompareOp.EQUAL,
        new BinaryComparator(Bytes.toBytes("testValueOne")));
    Scan s = new Scan();
    s.setFilter(f);
    verifyScanNoEarlyOut(s, expectedRows, expectedKeys);

    // Match group two rows
    expectedRows = numRows / 2;
    expectedKeys = colsPerRow;
    f = new ValueFilter(CompareOp.EQUAL,
        new BinaryComparator(Bytes.toBytes("testValueTwo")));
    s = new Scan();
    s.setFilter(f);
    verifyScanNoEarlyOut(s, expectedRows, expectedKeys);

    // Match all values using regex
    expectedRows = numRows;
    expectedKeys = colsPerRow;
    f = new ValueFilter(CompareOp.EQUAL,
        new RegexStringComparator("testValue((One)|(Two))"));
    s = new Scan();
    s.setFilter(f);
    verifyScanNoEarlyOut(s, expectedRows, expectedKeys);

    // Match values less than
    // Expect group one rows
    expectedRows = numRows / 2;
    expectedKeys = colsPerRow;
    f = new ValueFilter(CompareOp.LESS,
        new BinaryComparator(Bytes.toBytes("testValueTwo")));
    s = new Scan();
    s.setFilter(f);
    verifyScanNoEarlyOut(s, expectedRows, expectedKeys);
   
    // Match values less than or equal
    // Expect all rows
    expectedRows = numRows;
    expectedKeys = colsPerRow;
    f = new ValueFilter(CompareOp.LESS_OR_EQUAL,
        new BinaryComparator(Bytes.toBytes("testValueTwo")));
    s = new Scan();
    s.setFilter(f);
    verifyScanNoEarlyOut(s, expectedRows, expectedKeys);

    // Match values less than or equal
    // Expect group one rows
    expectedRows = numRows / 2;
    expectedKeys = colsPerRow;
    f = new ValueFilter(CompareOp.LESS_OR_EQUAL,
        new BinaryComparator(Bytes.toBytes("testValueOne")));
    s = new Scan();
    s.setFilter(f);
    verifyScanNoEarlyOut(s, expectedRows, expectedKeys);
   
    // Match values not equal
    // Expect half the rows
    expectedRows = numRows / 2;
    expectedKeys = colsPerRow;
    f = new ValueFilter(CompareOp.NOT_EQUAL,
        new BinaryComparator(Bytes.toBytes("testValueOne")));
    s = new Scan();
    s.setFilter(f);
    verifyScanNoEarlyOut(s, expectedRows, expectedKeys);
   
    // Match values greater or equal
    // Expect all rows
    expectedRows = numRows;
    expectedKeys = colsPerRow;
    f = new ValueFilter(CompareOp.GREATER_OR_EQUAL,
        new BinaryComparator(Bytes.toBytes("testValueOne")));
    s = new Scan();
    s.setFilter(f);
    verifyScanNoEarlyOut(s, expectedRows, expectedKeys);
   
    // Match values greater
    // Expect half rows
    expectedRows = numRows / 2;
    expectedKeys = colsPerRow;
    f = new ValueFilter(CompareOp.GREATER,
        new BinaryComparator(Bytes.toBytes("testValueOne")));
    s = new Scan();
    s.setFilter(f);
    verifyScanNoEarlyOut(s, expectedRows, expectedKeys);
   
    // Match values not equal to testValueOne
    // Look across rows and fully validate the keys and ordering
    // Should see all keys in all group two rows
    f = new ValueFilter(CompareOp.NOT_EQUAL,
        new BinaryComparator(Bytes.toBytes("testValueOne")));
    s = new Scan();
    s.setFilter(f);
   
    KeyValue [] kvs = {
View Full Code Here

Examples of org.apache.hadoop.hbase.filter.ValueFilter

    List<Filter> filters = new ArrayList<Filter>();
    filters.add(new RowFilter(CompareOp.EQUAL,
      new RegexStringComparator(".+-2")));
    filters.add(new QualifierFilter(CompareOp.EQUAL,
      new RegexStringComparator(".+-2")));
    filters.add(new ValueFilter(CompareOp.EQUAL,
      new SubstringComparator("One")));
    Filter f = new FilterList(Operator.MUST_PASS_ALL, filters);
    Scan s = new Scan();
    s.addFamily(FAMILIES[0]);
    s.setFilter(f);
    KeyValue [] kvs = {
        new KeyValue(ROWS_ONE[2], FAMILIES[0], QUALIFIERS_ONE[2], VALUES[0])
    };
    verifyScanFull(s, kvs);

    // Test getting everything with a MUST_PASS_ONE filter including row, qf,
    // val, regular expression and substring filters
    filters.clear();
    filters.add(new RowFilter(CompareOp.EQUAL,
      new RegexStringComparator(".+Two.+")));
    filters.add(new QualifierFilter(CompareOp.EQUAL,
      new RegexStringComparator(".+-2")));
    filters.add(new ValueFilter(CompareOp.EQUAL,
      new SubstringComparator("One")));
    f = new FilterList(Operator.MUST_PASS_ONE, filters);
    s = new Scan();
    s.setFilter(f);
    verifyScanNoEarlyOut(s, numRows, colsPerRow);
View Full Code Here

Examples of org.apache.hadoop.hbase.filter.ValueFilter

        break;
      case TimestampsFilter:
        filter = new TimestampsFilter(timestamps);
        break;
      case ValueFilter:
        filter = new ValueFilter(CompareOp.valueOf(op), comparator.build());
        break;
      case WhileMatchFilter:
        filter = new WhileMatchFilter(filters.get(0).build());
        break;
      default:
View Full Code Here

Examples of org.apache.hadoop.hbase.filter.ValueFilter

        break;
      case TimestampsFilter:
        filter = new TimestampsFilter(timestamps);
        break;
      case ValueFilter:
        filter = new ValueFilter(CompareOp.valueOf(op), comparator.build());
        break;
      case WhileMatchFilter:
        filter = new WhileMatchFilter(filters.get(0).build());
        break;
      default:
View Full Code Here

Examples of org.apache.hadoop.hbase.filter.ValueFilter

  @Test
  public void testValueFilter() throws Exception {
    // Match group one rows
    long expectedRows = numRows / 2;
    long expectedKeys = colsPerRow;
    Filter f = new ValueFilter(CompareOp.EQUAL,
        new BinaryComparator(Bytes.toBytes("testValueOne")));
    Scan s = new Scan();
    s.setFilter(f);
    verifyScanNoEarlyOut(s, expectedRows, expectedKeys);

    // Match group two rows
    expectedRows = numRows / 2;
    expectedKeys = colsPerRow;
    f = new ValueFilter(CompareOp.EQUAL,
        new BinaryComparator(Bytes.toBytes("testValueTwo")));
    s = new Scan();
    s.setFilter(f);
    verifyScanNoEarlyOut(s, expectedRows, expectedKeys);

    // Match all values using regex
    expectedRows = numRows;
    expectedKeys = colsPerRow;
    f = new ValueFilter(CompareOp.EQUAL,
        new RegexStringComparator("testValue((One)|(Two))"));
    s = new Scan();
    s.setFilter(f);
    verifyScanNoEarlyOut(s, expectedRows, expectedKeys);

    // Match values less than
    // Expect group one rows
    expectedRows = numRows / 2;
    expectedKeys = colsPerRow;
    f = new ValueFilter(CompareOp.LESS,
        new BinaryComparator(Bytes.toBytes("testValueTwo")));
    s = new Scan();
    s.setFilter(f);
    verifyScanNoEarlyOut(s, expectedRows, expectedKeys);
   
    // Match values less than or equal
    // Expect all rows
    expectedRows = numRows;
    expectedKeys = colsPerRow;
    f = new ValueFilter(CompareOp.LESS_OR_EQUAL,
        new BinaryComparator(Bytes.toBytes("testValueTwo")));
    s = new Scan();
    s.setFilter(f);
    verifyScanNoEarlyOut(s, expectedRows, expectedKeys);

    // Match values less than or equal
    // Expect group one rows
    expectedRows = numRows / 2;
    expectedKeys = colsPerRow;
    f = new ValueFilter(CompareOp.LESS_OR_EQUAL,
        new BinaryComparator(Bytes.toBytes("testValueOne")));
    s = new Scan();
    s.setFilter(f);
    verifyScanNoEarlyOut(s, expectedRows, expectedKeys);
   
    // Match values not equal
    // Expect half the rows
    expectedRows = numRows / 2;
    expectedKeys = colsPerRow;
    f = new ValueFilter(CompareOp.NOT_EQUAL,
        new BinaryComparator(Bytes.toBytes("testValueOne")));
    s = new Scan();
    s.setFilter(f);
    verifyScanNoEarlyOut(s, expectedRows, expectedKeys);
   
    // Match values greater or equal
    // Expect all rows
    expectedRows = numRows;
    expectedKeys = colsPerRow;
    f = new ValueFilter(CompareOp.GREATER_OR_EQUAL,
        new BinaryComparator(Bytes.toBytes("testValueOne")));
    s = new Scan();
    s.setFilter(f);
    verifyScanNoEarlyOut(s, expectedRows, expectedKeys);
   
    // Match values greater
    // Expect half rows
    expectedRows = numRows / 2;
    expectedKeys = colsPerRow;
    f = new ValueFilter(CompareOp.GREATER,
        new BinaryComparator(Bytes.toBytes("testValueOne")));
    s = new Scan();
    s.setFilter(f);
    verifyScanNoEarlyOut(s, expectedRows, expectedKeys);
   
    // Match values not equal to testValueOne
    // Look across rows and fully validate the keys and ordering
    // Should see all keys in all group two rows
    f = new ValueFilter(CompareOp.NOT_EQUAL,
        new BinaryComparator(Bytes.toBytes("testValueOne")));
    s = new Scan();
    s.setFilter(f);
   
    KeyValue [] kvs = {
View Full Code Here

Examples of org.corrib.s3b.mbb.beans.ValueFilter

       
    //we need it only when namespace defined
    RDFQuery rdfquery = (isInverse)?RDFQuery.RDFQ_INVERS_FILTER:RDFQuery.RDFQ_FILTER;
    String queryPart = rdfquery.toString("prop",//just prop
                             props);//we only need to filter values
    String query = new ValueFilter(sValues).process(queryPart, this.isIgnoreCase());
        query += " USING NAMESPACE mbb = <http://s3b.corrib.org/mbb#>";

    Repository.logger.info("URIPropertyFilterService: "+query);
   
    Value[] results;
View Full Code Here

Examples of org.corrib.s3b.mbb.beans.ValueFilter

   
    // --- =========== non inverse scenario ===================== ---
    RDFQuery rdfquery = (isInverse)?RDFQuery.RDFQ_INVERS_FILTER:RDFQuery.RDFQ_FILTER;
    String queryPart = rdfquery.toString(pparam,//we know the full URI of the property
                                restparam);//we only need to filter values
    String query = new ValueFilter(sValues).process(queryPart, this.isIgnoreCase());
    //no need for predefined properties

    Repository.logger.info(query);
   
    Value[] _uris;
View Full Code Here

Examples of org.corrib.s3b.mbb.beans.ValueFilter

      using = "";
     
      valueQueryPart = rdfquery.toString("%1$s");
    }

    ValueFilter values = new ValueFilter(sValues);
    String valueSelectQuery = values.process(valueQueryPart, this.isIgnoreCase());
         valueSelectQuery += using;
    //no need for predefined properties
    Repository.logger.info(valueSelectQuery);
    Value[] avUris = SesameWrapper.performVectorQuery(inGraph, QueryLanguage.SERQL, valueSelectQuery);
   
    Set<Value> ssubjectUris = new HashSet<Value>();
    RDFQuery subjectRdfQuery;
    if(isInverse)
      subjectRdfQuery = (!"*".equals(sFullProperty))?RDFQuery.RDFQ_BROWSE_FILTEROBJECTS_INVERSE:RDFQuery.RDFQ_BROWSE_FILTEROBJECTS_VALUES_INVERSE;
    else
      subjectRdfQuery = (!"*".equals(sFullProperty))?RDFQuery.RDFQ_BROWSE_FILTEROBJECTS:RDFQuery.RDFQ_BROWSE_FILTEROBJECTS_VALUES;
    String subjectQueryPart;
    Value[] avResults;
   
    for(Value value : avUris) {
      String value_filter;
      if(value instanceof BNode)
        value_filter = "<_:"+value+">";
      else if(value instanceof URI)
        value_filter = "<"+value+">";
      else
        value_filter = "\""+value+"\"";
     
      if(!"*".equals(sFullProperty))
        subjectQueryPart = subjectRdfQuery.toString(pparam, ("".equals(restparam))?"TRUE":restparam,  value_filter);
      else {
        String tmpQ = subjectRdfQuery.toString(value_filter, "%1$s");
        subjectQueryPart = values.process(tmpQ, this.isIgnoreCase());
      }
      subjectQueryPart += using;

      avResults = SesameWrapper.performVectorQuery(Repository.MAIN_REPOSITORY.getLocalRepository(),
                                 QueryLanguage.SERQL,
View Full Code Here

Examples of org.corrib.s3b.mbb.beans.ValueFilter

   * Test method for {@link org.corrib.s3b.mbb.beans.ValueFilter#process(java.lang.String, boolean)}.
   */
  @Test
  public void testProcess() {
    for(ValueTest value : this.tests) {
      ValueFilter vf = new ValueFilter(value.getCall());
      String output = vf.process(value.getValue(), value.isIgnoreCase());
     
      if(!output.equals(value.getResult()))
        failNotEquals("Results test failed ["+value.getId()+"]", value.getResult(), output);
     
      System.out.println("Test ["+value.getId()+"] passed");
View Full Code Here

Examples of org.corrib.s3b.mbb.beans.ValueFilter

       
    //we need it only when namespace defined
    RDFQuery rdfquery = (isInverse)?RDFQuery.RDFQ_INVERS_FILTER:RDFQuery.RDFQ_FILTER;
    String queryPart = rdfquery.toString("prop",//just prop
                             props);//we only need to filter values
    String query = new ValueFilter(sValues).process(queryPart, this.isIgnoreCase());
    if(!"*".equals(sPropertyNamespace))
       query += " USING NAMESPACE mbb = <http://s3b.corrib.org/mbb#>"+RDFQuery.RDFQ_ADD_NAMESPACE.toString(this.pnamespace.getURI(sPropertyNamespace));

    Repository.logger.info("CustomPropertyFilterService: "+query);
   
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.