com.thinkaurelius.titan.graphdb.query.QueryUtil.isQueryNormalForm()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(10.9k)|赞(0)|评价(0)|浏览(87)

本文整理了Java中com.thinkaurelius.titan.graphdb.query.QueryUtil.isQueryNormalForm方法的一些代码示例,展示了QueryUtil.isQueryNormalForm的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。QueryUtil.isQueryNormalForm方法的具体详情如下:
包路径:com.thinkaurelius.titan.graphdb.query.QueryUtil
类名称:QueryUtil
方法名:isQueryNormalForm

QueryUtil.isQueryNormalForm介绍

[英]Query-normal-form (QNF) for Titan is a variant of CNF (conjunctive normal form) with negation inlined where possible
[中]Titan的查询范式(QNF)是CNF(合取范式)的一个变体,尽可能内联否定

代码示例

代码示例来源:origin: thinkaurelius/titan

public BaseVertexCentricQuery(Condition<TitanRelation> condition, Direction direction,
               List<BackendQueryHolder<SliceQuery>> queries, OrderList orders,
               int limit) {
  super(limit);
  Preconditions.checkArgument(condition != null && queries != null && direction != null);
  Preconditions.checkArgument(QueryUtil.isQueryNormalForm(condition) && limit>=0);
  this.condition = condition;
  this.queries = queries;
  this.orders = orders;
  this.direction=direction;
}

代码示例来源:origin: thinkaurelius/titan

public IndexQuery(String store, Condition condition, ImmutableList<OrderEntry> orders, int limit) {
  super(limit);
  Preconditions.checkNotNull(store);
  Preconditions.checkNotNull(condition);
  Preconditions.checkArgument(orders != null);
  Preconditions.checkArgument(QueryUtil.isQueryNormalForm(condition));
  this.condition = condition;
  this.orders = orders;
  this.store = store;
  this.hashcode = new HashCodeBuilder().append(condition).append(store).append(orders).append(limit).toHashCode();
}

代码示例来源:origin: thinkaurelius/titan

public GraphCentricQuery(ElementCategory resultType, Condition<TitanElement> condition, OrderList orders,
             BackendQueryHolder<JointIndexQuery> indexQuery, int limit) {
  super(limit);
  Preconditions.checkNotNull(condition);
  Preconditions.checkArgument(orders != null && orders.isImmutable());
  Preconditions.checkArgument(QueryUtil.isQueryNormalForm(condition));
  Preconditions.checkNotNull(resultType);
  Preconditions.checkNotNull(indexQuery);
  this.condition = condition;
  this.orders = orders;
  this.resultType = resultType;
  this.indexQuery = indexQuery;
}

代码示例来源:origin: thinkaurelius/titan

public static List<Object[]> indexCover(final CompositeIndexType index, Condition<TitanElement> condition, Set<Condition> covered) {
  assert QueryUtil.isQueryNormalForm(condition);
  assert condition instanceof And;
  if (index.getStatus()!= SchemaStatus.ENABLED) return null;
  IndexField[] fields = index.getFieldKeys();
  Object[] indexValues = new Object[fields.length];
  Set<Condition> coveredClauses = new HashSet<Condition>(fields.length);
  List<Object[]> indexCovers = new ArrayList<Object[]>(4);
  constructIndexCover(indexValues,0,fields,condition,indexCovers,coveredClauses);
  if (!indexCovers.isEmpty()) {
    covered.addAll(coveredClauses);
    return indexCovers;
  } else return null;
}

代码示例来源:origin: thinkaurelius/titan

public static final <E extends TitanElement> Condition<E> simplifyQNF(Condition<E> condition) {
  Preconditions.checkArgument(isQueryNormalForm(condition));
  if (condition.numChildren() == 1) {
    Condition<E> child = ((And) condition).get(0);
    if (child.getType() == Condition.Type.LITERAL) return child;
  }
  return condition;
}

代码示例来源:origin: thinkaurelius/titan

public static final Condition<TitanElement> indexCover(final MixedIndexType index, Condition<TitanElement> condition,
                            final IndexSerializer indexInfo, final Set<Condition> covered) {
  assert QueryUtil.isQueryNormalForm(condition);
  assert condition instanceof And;
  And<TitanElement> subcondition = new And<TitanElement>(condition.numChildren());
  for (Condition<TitanElement> subclause : condition.getChildren()) {
    if (coversAll(index,subclause,indexInfo)) {
      subcondition.add(subclause);
      covered.add(subclause);
    }
  }
  return subcondition.isEmpty()?null:subcondition;
}

代码示例来源:origin: thinkaurelius/titan

Preconditions.checkArgument(QueryUtil.isQueryNormalForm(query.getCondition()));
PredicateCondition<PropertyKey, TitanElement> standardIndexKey = getEqualityCondition(query.getCondition());
Iterator<TitanVertex> vertices;

代码示例来源:origin: com.thinkaurelius.titan/titan-core

public BaseVertexCentricQuery(Condition<TitanRelation> condition, Direction direction,
               List<BackendQueryHolder<SliceQuery>> queries, OrderList orders,
               int limit) {
  super(limit);
  Preconditions.checkArgument(condition != null && queries != null && direction != null);
  Preconditions.checkArgument(QueryUtil.isQueryNormalForm(condition) && limit>=0);
  this.condition = condition;
  this.queries = queries;
  this.orders = orders;
  this.direction=direction;
}

代码示例来源:origin: org.hawkular.titan/titan-core

public BaseVertexCentricQuery(Condition<TitanRelation> condition, Direction direction,
               List<BackendQueryHolder<SliceQuery>> queries, OrderList orders,
               int limit) {
  super(limit);
  Preconditions.checkArgument(condition != null && queries != null && direction != null);
  Preconditions.checkArgument(QueryUtil.isQueryNormalForm(condition) && limit>=0);
  this.condition = condition;
  this.queries = queries;
  this.orders = orders;
  this.direction=direction;
}

代码示例来源:origin: com.thinkaurelius.titan/titan-core

public IndexQuery(String store, Condition condition, ImmutableList<OrderEntry> orders, int limit) {
  super(limit);
  Preconditions.checkNotNull(store);
  Preconditions.checkNotNull(condition);
  Preconditions.checkArgument(orders != null);
  Preconditions.checkArgument(QueryUtil.isQueryNormalForm(condition));
  this.condition = condition;
  this.orders = orders;
  this.store = store;
  this.hashcode = new HashCodeBuilder().append(condition).append(store).append(orders).append(limit).toHashCode();
}

代码示例来源:origin: org.hawkular.titan/titan-core

public IndexQuery(String store, Condition condition, ImmutableList<OrderEntry> orders, int limit) {
  super(limit);
  Preconditions.checkNotNull(store);
  Preconditions.checkNotNull(condition);
  Preconditions.checkArgument(orders != null);
  Preconditions.checkArgument(QueryUtil.isQueryNormalForm(condition));
  this.condition = condition;
  this.orders = orders;
  this.store = store;
  this.hashcode = new HashCodeBuilder().append(condition).append(store).append(orders).append(limit).toHashCode();
}

代码示例来源:origin: com.thinkaurelius.titan/titan-core

public GraphCentricQuery(ElementCategory resultType, Condition<TitanElement> condition, OrderList orders,
             BackendQueryHolder<JointIndexQuery> indexQuery, int limit) {
  super(limit);
  Preconditions.checkNotNull(condition);
  Preconditions.checkArgument(orders != null && orders.isImmutable());
  Preconditions.checkArgument(QueryUtil.isQueryNormalForm(condition));
  Preconditions.checkNotNull(resultType);
  Preconditions.checkNotNull(indexQuery);
  this.condition = condition;
  this.orders = orders;
  this.resultType = resultType;
  this.indexQuery = indexQuery;
}

代码示例来源:origin: org.hawkular.titan/titan-core

public GraphCentricQuery(ElementCategory resultType, Condition<TitanElement> condition, OrderList orders,
             BackendQueryHolder<JointIndexQuery> indexQuery, int limit) {
  super(limit);
  Preconditions.checkNotNull(condition);
  Preconditions.checkArgument(orders != null && orders.isImmutable());
  Preconditions.checkArgument(QueryUtil.isQueryNormalForm(condition));
  Preconditions.checkNotNull(resultType);
  Preconditions.checkNotNull(indexQuery);
  this.condition = condition;
  this.orders = orders;
  this.resultType = resultType;
  this.indexQuery = indexQuery;
}

代码示例来源:origin: com.thinkaurelius.titan/titan-core

public static List<Object[]> indexCover(final CompositeIndexType index, Condition<TitanElement> condition, Set<Condition> covered) {
  assert QueryUtil.isQueryNormalForm(condition);
  assert condition instanceof And;
  if (index.getStatus()!= SchemaStatus.ENABLED) return null;
  IndexField[] fields = index.getFieldKeys();
  Object[] indexValues = new Object[fields.length];
  Set<Condition> coveredClauses = new HashSet<Condition>(fields.length);
  List<Object[]> indexCovers = new ArrayList<Object[]>(4);
  constructIndexCover(indexValues,0,fields,condition,indexCovers,coveredClauses);
  if (!indexCovers.isEmpty()) {
    covered.addAll(coveredClauses);
    return indexCovers;
  } else return null;
}

代码示例来源:origin: com.thinkaurelius.titan/titan-core

public static final <E extends TitanElement> Condition<E> simplifyQNF(Condition<E> condition) {
  Preconditions.checkArgument(isQueryNormalForm(condition));
  if (condition.numChildren() == 1) {
    Condition<E> child = ((And) condition).get(0);
    if (child.getType() == Condition.Type.LITERAL) return child;
  }
  return condition;
}

代码示例来源:origin: org.hawkular.titan/titan-core

public static final <E extends TitanElement> Condition<E> simplifyQNF(Condition<E> condition) {
  Preconditions.checkArgument(isQueryNormalForm(condition));
  if (condition.numChildren() == 1) {
    Condition<E> child = ((And) condition).get(0);
    if (child.getType() == Condition.Type.LITERAL) return child;
  }
  return condition;
}

代码示例来源:origin: org.apache.atlas/atlas-titan

public static final Condition<TitanElement> indexCover(final MixedIndexType index, Condition<TitanElement> condition,
  final IndexSerializer indexInfo, final Set<Condition> covered) {
  assert QueryUtil.isQueryNormalForm(condition);
  assert condition instanceof And;
  And<TitanElement> subcondition = new And<TitanElement>(condition.numChildren());
  for (Condition<TitanElement> subclause : condition.getChildren()) {
    if (coversAll(index,subclause,indexInfo)) {
      subcondition.add(subclause);
      covered.add(subclause);
    }
  }
  return subcondition.isEmpty()?null:subcondition;
}

代码示例来源:origin: apache/incubator-atlas

public static final Condition<TitanElement> indexCover(final MixedIndexType index, Condition<TitanElement> condition, 
  final IndexSerializer indexInfo, final Set<Condition> covered) {
  assert QueryUtil.isQueryNormalForm(condition);
  assert condition instanceof And;
  And<TitanElement> subcondition = new And<>(condition.numChildren());
  for (Condition<TitanElement> subclause : condition.getChildren()) {
    if (coversAll(index, subclause, indexInfo)) {
      subcondition.add(subclause);
      covered.add(subclause);
    }
  }
  return subcondition.isEmpty()?null:subcondition;
}

代码示例来源:origin: com.thinkaurelius.titan/titan-core

public static final Condition<TitanElement> indexCover(final MixedIndexType index, Condition<TitanElement> condition,
                            final IndexSerializer indexInfo, final Set<Condition> covered) {
  assert QueryUtil.isQueryNormalForm(condition);
  assert condition instanceof And;
  And<TitanElement> subcondition = new And<TitanElement>(condition.numChildren());
  for (Condition<TitanElement> subclause : condition.getChildren()) {
    if (coversAll(index,subclause,indexInfo)) {
      subcondition.add(subclause);
      covered.add(subclause);
    }
  }
  return subcondition.isEmpty()?null:subcondition;
}

代码示例来源:origin: org.hawkular.titan/titan-core

public static final Condition<TitanElement> indexCover(final MixedIndexType index, Condition<TitanElement> condition,
                            final IndexSerializer indexInfo, final Set<Condition> covered) {
  assert QueryUtil.isQueryNormalForm(condition);
  assert condition instanceof And;
  And<TitanElement> subcondition = new And<TitanElement>(condition.numChildren());
  for (Condition<TitanElement> subclause : condition.getChildren()) {
    if (coversAll(index,subclause,indexInfo)) {
      subcondition.add(subclause);
      covered.add(subclause);
    }
  }
  return subcondition.isEmpty()?null:subcondition;
}

相关文章