• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java RegExFilter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.accumulo.core.iterators.user.RegExFilter的典型用法代码示例。如果您正苦于以下问题:Java RegExFilter类的具体用法?Java RegExFilter怎么用?Java RegExFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



RegExFilter类属于org.apache.accumulo.core.iterators.user包,在下文中一共展示了RegExFilter类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: removeElementFromIndex

import org.apache.accumulo.core.iterators.user.RegExFilter; //导入依赖的package包/类
/**
 * Remove the given element's properties from the index.
 * @param element
 */
public void removeElementFromIndex(Element element) {
  BatchDeleter deleter = null;

  try {
    deleter = getDeleter();
    deleter.setRanges(Collections.singleton(new Range()));

    IteratorSetting is = new IteratorSetting(10, "getEdgeFilter", RegExFilter.class);
    RegExFilter.setRegexs(is, null, null,
        "^"+Pattern.quote(element.getId().toString())+"$", null, false);
    deleter.addScanIterator(is);
    deleter.delete();
    deleter.close();
  } catch (Exception e) {
    throw new AccumuloGraphException(e);
  } finally {
    if (deleter != null) {
      deleter.close();
    }
  }
}
 
开发者ID:JHUAPL,项目名称:AccumuloGraph,代码行数:26,代码来源:BaseIndexValuesTableWrapper.java


示例2: singleWildCardSearch

import org.apache.accumulo.core.iterators.user.RegExFilter; //导入依赖的package包/类
/**
 * Scans over the index table for files or directories with a given name that can contain a single wildcard '*' anywhere in the term.
 *
 * @param exp
 *          the name a file or directory to search for with one optional wildcard '*'
 */
public Iterable<Entry<Key,Value>> singleWildCardSearch(String exp) throws Exception {
  int starIndex = exp.indexOf("*");
  if (exp.indexOf("*", starIndex + 1) >= 0)
    throw new Exception("only one wild card for search");

  if (starIndex < 0) {
    return exactTermSearch(exp);
  } else if (starIndex == 0 || starIndex == exp.length() - 1) {
    return singleRestrictedWildCardSearch(exp);
  }

  String firstPart = exp.substring(0, starIndex);
  String lastPart = exp.substring(starIndex + 1);
  String regexString = ".*/" + exp.replace("*", "[^/]*");

  Scanner scanner = conn.createScanner(tableName, auths);
  if (firstPart.length() >= lastPart.length()) {
    System.out.println("executing middle wildcard search for " + regexString + " from entries starting with " + firstPart);
    scanner.setRange(Range.prefix(getForwardIndex(firstPart)));
  } else {
    System.out.println("executing middle wildcard search for " + regexString + " from entries ending with " + lastPart);
    scanner.setRange(Range.prefix(getReverseIndex(lastPart)));
  }
  IteratorSetting regex = new IteratorSetting(50, "regex", RegExFilter.class);
  RegExFilter.setRegexs(regex, null, null, regexString, null, false);
  scanner.addScanIterator(regex);
  return scanner;
}
 
开发者ID:apache,项目名称:accumulo-examples,代码行数:35,代码来源:QueryUtil.java


示例3: run

import org.apache.accumulo.core.iterators.user.RegExFilter; //导入依赖的package包/类
@Override
public int run(String[] args) throws Exception {
  Opts opts = new Opts();
  opts.parseArgs(getClass().getName(), args);

  Job job = Job.getInstance(getConf());
  job.setJobName(getClass().getSimpleName());
  job.setJarByClass(getClass());

  job.setInputFormatClass(AccumuloInputFormat.class);
  opts.setAccumuloConfigs(job);

  IteratorSetting regex = new IteratorSetting(50, "regex", RegExFilter.class);
  RegExFilter.setRegexs(regex, opts.rowRegex, opts.columnFamilyRegex, opts.columnQualifierRegex, opts.valueRegex, false);
  AccumuloInputFormat.addIterator(job, regex);

  job.setMapperClass(RegexMapper.class);
  job.setMapOutputKeyClass(Key.class);
  job.setMapOutputValueClass(Value.class);

  job.setNumReduceTasks(0);

  job.setOutputFormatClass(TextOutputFormat.class);
  TextOutputFormat.setOutputPath(job, new Path(opts.destination));

  System.out.println("setRowRegex: " + opts.rowRegex);
  System.out.println("setColumnFamilyRegex: " + opts.columnFamilyRegex);
  System.out.println("setColumnQualifierRegex: " + opts.columnQualifierRegex);
  System.out.println("setValueRegex: " + opts.valueRegex);

  job.waitForCompletion(true);
  return job.isSuccessful() ? 0 : 1;
}
 
开发者ID:apache,项目名称:accumulo-examples,代码行数:34,代码来源:RegexExample.java


示例4: run

import org.apache.accumulo.core.iterators.user.RegExFilter; //导入依赖的package包/类
@Override
public int run(String[] strings) throws Exception {
    conf.set(MRUtils.JOB_NAME_PROP, "Upgrade to Rya 3.2.2");
    //faster
    init();

    Job job = new Job(conf);
    job.setJarByClass(Upgrade322Tool.class);

    setupAccumuloInput(job);
    AccumuloInputFormat.setInputTableName(job, MRUtils.getTablePrefix(conf) + TBL_OSP_SUFFIX);

    //we do not need to change any row that is a string, custom, or uri type
    IteratorSetting regex = new IteratorSetting(30, "regex",
                                                RegExFilter.class);
    RegExFilter.setRegexs(regex, "\\w*" + TYPE_DELIM + "[\u0003|\u0008|\u0002]", null, null, null, false);
    RegExFilter.setNegate(regex, true);

    // set input output of the particular job
    job.setMapOutputKeyClass(Text.class);
    job.setMapOutputValueClass(Mutation.class);

    setupAccumuloOutput(job, MRUtils.getTablePrefix(conf) +
                           TBL_SPO_SUFFIX);

    // set mapper and reducer classes
    job.setMapperClass(Upgrade322Mapper.class);
    job.setReducerClass(Reducer.class);

    // Submit the job
    return job.waitForCompletion(true) ? 0 : 1;
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:33,代码来源:Upgrade322Tool.java


示例5: getVersionRegExFilterSetting

import org.apache.accumulo.core.iterators.user.RegExFilter; //导入依赖的package包/类
/**
 * Creates a {@link RegExFilter} setting to ignore the version row in a table.
 * @return the {@link RegExFilter} {@link IteratorSetting}.
 */
public static IteratorSetting getVersionRegExFilterSetting() {
    final IteratorSetting regex = new IteratorSetting(30, "version_regex", RegExFilter.class);
    RegExFilter.setRegexs(regex, "(.*)urn:(.*)#version[\u0000|\u0001](.*)", null, null, null, false);
    Filter.setNegate(regex, true);
    return regex;
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:11,代码来源:AccumuloRyaUtils.java


示例6: getCopyToolRunTimeRegExFilterSetting

import org.apache.accumulo.core.iterators.user.RegExFilter; //导入依赖的package包/类
/**
 * Creates a {@link RegExFilter} setting to ignore the copy tool run time row in a table.
 * @return the {@link RegExFilter} {@link IteratorSetting}.
 */
public static IteratorSetting getCopyToolRunTimeRegExFilterSetting() {
    final IteratorSetting regex = new IteratorSetting(31, COPY_TOOL_RUN_TIME_LOCAL_NAME + "_regex", RegExFilter.class);
    RegExFilter.setRegexs(regex, "(.*)urn:(.*)#" + COPY_TOOL_RUN_TIME_LOCAL_NAME + "[\u0000|\u0001](.*)", null, null, null, false);
    Filter.setNegate(regex, true);
    return regex;
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:11,代码来源:AccumuloRyaUtils.java


示例7: getCopyToolSplitTimeRegExFilterSetting

import org.apache.accumulo.core.iterators.user.RegExFilter; //导入依赖的package包/类
/**
 * Creates a {@link RegExFilter} setting to ignore the copy tool split time row in a table.
 * @return the {@link RegExFilter} {@link IteratorSetting}.
 */
public static IteratorSetting getCopyToolSplitTimeRegExFilterSetting() {
    final IteratorSetting regex = new IteratorSetting(32, COPY_TOOL_SPLIT_TIME_LOCAL_NAME + "_regex", RegExFilter.class);
    RegExFilter.setRegexs(regex, "(.*)urn:(.*)#" + COPY_TOOL_SPLIT_TIME_LOCAL_NAME + "[\u0000|\u0001](.*)", null, null, null, false);
    Filter.setNegate(regex, true);
    return regex;
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:11,代码来源:AccumuloRyaUtils.java


示例8: getCopyToolTimeOffsetRegExFilterSetting

import org.apache.accumulo.core.iterators.user.RegExFilter; //导入依赖的package包/类
/**
 * Creates a {@link RegExFilter} setting to ignore the copy tool time setting row in a table.
 * @return the {@link RegExFilter} {@link IteratorSetting}.
 */
public static IteratorSetting getCopyToolTimeOffsetRegExFilterSetting() {
    final IteratorSetting regex = new IteratorSetting(33, COPY_TOOL_TIME_OFFSET_LOCAL_NAME + "_regex", RegExFilter.class);
    RegExFilter.setRegexs(regex, "(.*)urn:(.*)#" + COPY_TOOL_TIME_OFFSET_LOCAL_NAME + "[\u0000|\u0001](.*)", null, null, null, false);
    Filter.setNegate(regex, true);
    return regex;
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:11,代码来源:AccumuloRyaUtils.java


示例9: getEdges

import org.apache.accumulo.core.iterators.user.RegExFilter; //导入依赖的package包/类
public Iterable<Edge> getEdges(String key, Object value) {
  AccumuloGraphUtils.nullCheckProperty(key, value);
  if (key.equalsIgnoreCase("label")) {
    key = Constants.LABEL;
  }
  
  BatchScanner scan = getBatchScanner();
  scan.fetchColumnFamily(new Text(key));

  byte[] val = AccumuloByteSerializer.serialize(value);
  if (val[0] != AccumuloByteSerializer.SERIALIZABLE) {
    IteratorSetting is = new IteratorSetting(10, "filter", RegExFilter.class);
    RegExFilter.setRegexs(is, null, null, null, Pattern.quote(new String(val)), false);
    scan.addScanIterator(is);

    return new ScannerIterable<Edge>(scan) {

      @Override
      public Edge next(PeekingIterator<Entry<Key,Value>> iterator) {

        Key k = iterator.next().getKey();

        if (k.getColumnFamily().toString().equals(Constants.LABEL)) {
          String[] vals = k.getColumnQualifier().toString().split(Constants.ID_DELIM);
          return new AccumuloEdge(globals, k.getRow().toString(),
              new AccumuloVertex(globals, vals[0]),
              new AccumuloVertex(globals, vals[1]), null);
        }
        return new AccumuloEdge(globals, k.getRow().toString());
      }
    };
  } else {
    // TODO
    throw new UnsupportedOperationException("Filtering on binary data not currently supported.");
  }
}
 
开发者ID:JHUAPL,项目名称:AccumuloGraph,代码行数:37,代码来源:EdgeTableWrapper.java


示例10: applyEdgeLabelValueFilter

import org.apache.accumulo.core.iterators.user.RegExFilter; //导入依赖的package包/类
/**
 * Add custom iterator to the given scanner so that
 * it will only return keys with value corresponding to an edge.
 * @param scan
 * @param labels
 */
protected void applyEdgeLabelValueFilter(Scanner scan, String... labels) {
  StringBuilder regex = new StringBuilder();
  for (String lab : labels) {
    if (regex.length() != 0)
      regex.append("|");
    regex.append(".*"+Constants.ID_DELIM+"\\Q").append(lab).append("\\E$");
  }

  IteratorSetting is = new IteratorSetting(10, "edgeValueFilter", RegExFilter.class);
  RegExFilter.setRegexs(is, null, null, null, regex.toString(), false);
  scan.addScanIterator(is);
}
 
开发者ID:JHUAPL,项目名称:AccumuloGraph,代码行数:19,代码来源:ElementTableWrapper.java


示例11: metricScanner

import org.apache.accumulo.core.iterators.user.RegExFilter; //导入依赖的package包/类
protected ScannerBase metricScanner(AccumuloFeatureConfig xform, Date start, Date end, String group, String type, String name, TimeUnit timeUnit, Auths auths) {
    checkNotNull(xform);

    try {

        group = defaultString(group);
        timeUnit = (timeUnit == null ? TimeUnit.MINUTES : timeUnit);

        Scanner scanner = connector.createScanner(tableName + REVERSE_SUFFIX, auths.getAuths());
        scanner.setRange(buildRange(type, start, end, timeUnit));

        if (group != null && name != null) {
            scanner.fetchColumn(new Text(combine(timeUnit.toString(), xform.featureName())), new Text(combine(group, name)));
        } else {
            scanner.fetchColumnFamily(new Text(combine(timeUnit.toString(), xform.featureName())));

            String cqRegex = null;
            if (group != null) {
                cqRegex = combine(group, "(.*)");
            } else if (name != null)
                cqRegex = combine("(.*)", name);
            if (cqRegex != null) {
                IteratorSetting regexIterator = new IteratorSetting(Constants.DEFAULT_ITERATOR_PRIORITY - 1, "regex", RegExFilter.class);
                scanner.addScanIterator(regexIterator);
            }
        }

        return scanner;
    } catch (TableNotFoundException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:calrissian,项目名称:accumulo-recipes,代码行数:33,代码来源:AccumuloFeatureStore.java



注:本文中的org.apache.accumulo.core.iterators.user.RegExFilter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Range类代码示例发布时间:2022-05-23
下一篇:
Java VoidType类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap