org.eclipse.rdf4j.query.algebra.Union.<init>()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(8.5k)|赞(0)|评价(0)|浏览(152)

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

Union.<init>介绍

[英]Creates a new union operator that operates on the two specified arguments.
[中]创建对两个指定参数进行操作的新联合运算符。

代码示例

代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client

@Override
public Object visit(ASTPathExprUnion node, Object data)
  throws VisitorException
{
  Iterator<ASTPathExpr> args = node.getPathExprList().iterator();
  // Create new sub-graph pattern for optional path expressions
  TupleExpr unionExpr = parseGraphPattern(args.next()).buildTupleExpr();
  while (args.hasNext()) {
    TupleExpr argExpr = parseGraphPattern(args.next()).buildTupleExpr();
    unionExpr = new Union(unionExpr, argExpr);
  }
  graphPattern.addRequiredTE(unionExpr);
  return null;
}

代码示例来源:origin: org.eclipse.rdf4j/rdf4j-queryparser-serql

@Override
public Object visit(ASTPathExprUnion node, Object data)
  throws VisitorException
{
  Iterator<ASTPathExpr> args = node.getPathExprList().iterator();
  // Create new sub-graph pattern for optional path expressions
  TupleExpr unionExpr = parseGraphPattern(args.next()).buildTupleExpr();
  while (args.hasNext()) {
    TupleExpr argExpr = parseGraphPattern(args.next()).buildTupleExpr();
    unionExpr = new Union(unionExpr, argExpr);
  }
  graphPattern.addRequiredTE(unionExpr);
  return null;
}

代码示例来源:origin: eclipse/rdf4j

@Override
public Object visit(ASTPathExprUnion node, Object data)
  throws VisitorException
{
  Iterator<ASTPathExpr> args = node.getPathExprList().iterator();
  // Create new sub-graph pattern for optional path expressions
  TupleExpr unionExpr = parseGraphPattern(args.next()).buildTupleExpr();
  while (args.hasNext()) {
    TupleExpr argExpr = parseGraphPattern(args.next()).buildTupleExpr();
    unionExpr = new Union(unionExpr, argExpr);
  }
  graphPattern.addRequiredTE(unionExpr);
  return null;
}

代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client

/**
 * @inheritDoc
 */
public TupleExpr expr() {
  if (mLeft != null && mRight != null) {
    return new Union(mLeft.expr(), mRight.expr());
  }
  else if (mLeft != null && mRight == null) {
    return mLeft.expr();
  }
  else if (mRight != null && mLeft == null) {
    return mRight.expr();
  }
  else {
    return null;
  }
}

代码示例来源:origin: org.eclipse.rdf4j/rdf4j-queryrender

/**
 * @inheritDoc
 */
public TupleExpr expr() {
  if (mLeft != null && mRight != null) {
    return new Union(mLeft.expr(), mRight.expr());
  }
  else if (mLeft != null && mRight == null) {
    return mLeft.expr();
  }
  else if (mRight != null && mLeft == null) {
    return mRight.expr();
  }
  else {
    return null;
  }
}

代码示例来源:origin: eclipse/rdf4j

/**
 * @inheritDoc
 */
@Override
public TupleExpr expr() {
  if (mLeft != null && mRight != null) {
    return new Union(mLeft.expr(), mRight.expr());
  }
  else if (mLeft != null && mRight == null) {
    return mLeft.expr();
  }
  else if (mRight != null && mLeft == null) {
    return mRight.expr();
  }
  else {
    return null;
  }
}

代码示例来源:origin: eclipse/rdf4j

@Override
public TupleExpr visit(ASTTupleUnion node, Object data)
  throws VisitorException
{
  TupleExpr leftArg = (TupleExpr)node.getLeftArg().jjtAccept(this, null);
  TupleExpr rightArg = (TupleExpr)node.getRightArg().jjtAccept(this, null);
  TupleExpr result = new Union(leftArg, rightArg);
  if (node.isDistinct()) {
    result = new Distinct(result);
  }
  return result;
}

代码示例来源:origin: org.eclipse.rdf4j/rdf4j-queryparser-serql

@Override
public TupleExpr visit(ASTGraphUnion node, Object data)
  throws VisitorException
{
  TupleExpr leftArg = (TupleExpr)node.getLeftArg().jjtAccept(this, null);
  TupleExpr rightArg = (TupleExpr)node.getRightArg().jjtAccept(this, null);
  TupleExpr result = new Union(leftArg, rightArg);
  if (node.isDistinct()) {
    result = new Distinct(result);
  }
  return result;
}

代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client

@Override
public TupleExpr visit(ASTTupleUnion node, Object data)
  throws VisitorException
{
  TupleExpr leftArg = (TupleExpr)node.getLeftArg().jjtAccept(this, null);
  TupleExpr rightArg = (TupleExpr)node.getRightArg().jjtAccept(this, null);
  TupleExpr result = new Union(leftArg, rightArg);
  if (node.isDistinct()) {
    result = new Distinct(result);
  }
  return result;
}

代码示例来源:origin: org.eclipse.rdf4j/rdf4j-queryparser-serql

@Override
public TupleExpr visit(ASTTupleUnion node, Object data)
  throws VisitorException
{
  TupleExpr leftArg = (TupleExpr)node.getLeftArg().jjtAccept(this, null);
  TupleExpr rightArg = (TupleExpr)node.getRightArg().jjtAccept(this, null);
  TupleExpr result = new Union(leftArg, rightArg);
  if (node.isDistinct()) {
    result = new Distinct(result);
  }
  return result;
}

代码示例来源:origin: eclipse/rdf4j

@Override
public TupleExpr visit(ASTGraphUnion node, Object data)
  throws VisitorException
{
  TupleExpr leftArg = (TupleExpr)node.getLeftArg().jjtAccept(this, null);
  TupleExpr rightArg = (TupleExpr)node.getRightArg().jjtAccept(this, null);
  TupleExpr result = new Union(leftArg, rightArg);
  if (node.isDistinct()) {
    result = new Distinct(result);
  }
  return result;
}

代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client

@Override
public TupleExpr visit(ASTGraphUnion node, Object data)
  throws VisitorException
{
  TupleExpr leftArg = (TupleExpr)node.getLeftArg().jjtAccept(this, null);
  TupleExpr rightArg = (TupleExpr)node.getRightArg().jjtAccept(this, null);
  TupleExpr result = new Union(leftArg, rightArg);
  if (node.isDistinct()) {
    result = new Distinct(result);
  }
  return result;
}

代码示例来源:origin: org.eclipse.rdf4j/rdf4j-queryparser-sparql

@Override
public Object visit(ASTUnionGraphPattern node, Object data)
  throws VisitorException
{
  GraphPattern parentGP = graphPattern;
  graphPattern = new GraphPattern(parentGP);
  node.jjtGetChild(0).jjtAccept(this, null);
  TupleExpr leftArg = graphPattern.buildTupleExpr();
  graphPattern = new GraphPattern(parentGP);
  node.jjtGetChild(1).jjtAccept(this, null);
  TupleExpr rightArg = graphPattern.buildTupleExpr();
  parentGP.addRequiredTE(new Union(leftArg, rightArg));
  graphPattern = parentGP;
  return null;
}

代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client

@Override
public Object visit(ASTUnionGraphPattern node, Object data)
  throws VisitorException
{
  GraphPattern parentGP = graphPattern;
  graphPattern = new GraphPattern(parentGP);
  node.jjtGetChild(0).jjtAccept(this, null);
  TupleExpr leftArg = graphPattern.buildTupleExpr();
  graphPattern = new GraphPattern(parentGP);
  node.jjtGetChild(1).jjtAccept(this, null);
  TupleExpr rightArg = graphPattern.buildTupleExpr();
  parentGP.addRequiredTE(new Union(leftArg, rightArg));
  graphPattern = parentGP;
  return null;
}

代码示例来源:origin: eclipse/rdf4j

@Override
public Object visit(ASTUnionGraphPattern node, Object data)
  throws VisitorException
{
  GraphPattern parentGP = graphPattern;
  graphPattern = new GraphPattern(parentGP);
  node.jjtGetChild(0).jjtAccept(this, null);
  TupleExpr leftArg = graphPattern.buildTupleExpr();
  graphPattern = new GraphPattern(parentGP);
  node.jjtGetChild(1).jjtAccept(this, null);
  TupleExpr rightArg = graphPattern.buildTupleExpr();
  parentGP.addRequiredTE(new Union(leftArg, rightArg));
  graphPattern = parentGP;
  return null;
}

代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client

Union union = new Union();
Union currentUnion = union;
for (int i = 0; i < altCount - 1; i++) {
    Union newUnion = new Union();
    currentUnion.setRightArg(newUnion);
    currentUnion = newUnion;

代码示例来源:origin: eclipse/rdf4j

Union union = new Union();
Union currentUnion = union;
for (int i = 0; i < altCount - 1; i++) {
    Union newUnion = new Union();
    currentUnion.setRightArg(newUnion);
    currentUnion = newUnion;

代码示例来源:origin: org.eclipse.rdf4j/rdf4j-queryparser-sparql

Union union = new Union();
Union currentUnion = union;
for (int i = 0; i < altCount - 1; i++) {
    Union newUnion = new Union();
    currentUnion.setRightArg(newUnion);
    currentUnion = newUnion;

代码示例来源:origin: org.eclipse.rdf4j/rdf4j-queryalgebra-evaluation

@Override
public void meet(Filter filter) {
  if (filter.getCondition() instanceof Or && containsSameTerm(filter.getCondition())) {
    Or orNode = (Or)filter.getCondition();
    TupleExpr filterArg = filter.getArg();
    ValueExpr leftConstraint = orNode.getLeftArg();
    ValueExpr rightConstraint = orNode.getRightArg();
    // remove filter
    filter.replaceWith(filterArg);
    // Push UNION down below other filters to avoid cloning them
    TupleExpr node = findNotFilter(filterArg);
    Filter leftFilter = new Filter(node.clone(), leftConstraint);
    Filter rightFilter = new Filter(node.clone(), rightConstraint);
    Union union = new Union(leftFilter, rightFilter);
    node.replaceWith(union);
    filter.getParentNode().visit(this);
  }
  else {
    super.meet(filter);
  }
}

代码示例来源:origin: de.tudarmstadt.ukp.inception.rdf4j/rdf4j-queryalgebra-evaluation

@Override
public void meet(Filter filter) {
  if (filter.getCondition() instanceof Or && containsSameTerm(filter.getCondition())) {
    Or orNode = (Or)filter.getCondition();
    TupleExpr filterArg = filter.getArg();
    ValueExpr leftConstraint = orNode.getLeftArg();
    ValueExpr rightConstraint = orNode.getRightArg();
    // remove filter
    filter.replaceWith(filterArg);
    // Push UNION down below other filters to avoid cloning them
    TupleExpr node = findNotFilter(filterArg);
    Filter leftFilter = new Filter(node.clone(), leftConstraint);
    Filter rightFilter = new Filter(node.clone(), rightConstraint);
    Union union = new Union(leftFilter, rightFilter);
    node.replaceWith(union);
    filter.getParentNode().visit(this);
  }
  else {
    super.meet(filter);
  }
}

相关文章