org.openrdf.query.algebra.Extension类的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(8.4k)|赞(0)|评价(0)|浏览(206)

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

Extension介绍

[英]An extension operator that can be used to add bindings to solutions whose values are defined by ValueExpr.
[中]一个扩展运算符,可用于向ValueExpr定义其值的解决方案添加绑定。

代码示例

代码示例来源:origin: org.openrdf.sesame/sesame-spin

@Override
public void meet(Extension node)
  throws RDFHandlerException
{
  if (inlineBindings != null && inlineBindings.extension == node) {
    // this is the first Extension node and has already been handled
    // by meetExtension()
    // to produce inline bindings in SELECT so we can skip it here
    node.getArg().visit(this);
  }
  else {
    // any further Extension nodes produce BIND() clauses
    node.getArg().visit(this);
    for (ExtensionElem elem : node.getElements()) {
      elem.visit(this);
    }
  }
}

代码示例来源:origin: org.openrdf.sesame/sesame-spin

private void addSourceExpressions(UnaryTupleOperator op, Collection<ProjectionElem> elems) {
  Extension ext = null;
  for (ProjectionElem projElem : elems) {
    ExtensionElem extElem = projElem.getSourceExpression();
    if (extElem != null) {
      if (ext == null) {
        ext = new Extension(op.getArg());
        op.setArg(ext);
      }
      ext.addElement(extElem);
    }
  }
}

代码示例来源:origin: org.apache.rya/mongodb.rya

@Override
public void meet(Extension extensionNode) throws Exception {
  extensionNode.visitChildren(this);
  if (extensionNode.getArg() instanceof AggregationPipelineQueryNode && extensionNode.getParentNode() != null) {
    AggregationPipelineQueryNode pipelineNode = (AggregationPipelineQueryNode) extensionNode.getArg();
    if (pipelineNode.extend(extensionNode.getElements())) {
      extensionNode.replaceWith(pipelineNode);
    }
  }
}

代码示例来源:origin: org.openrdf.sesame/sesame-queryalgebra-model

@Override
  public Extension clone() {
    Extension clone = (Extension)super.clone();

    clone.elements = new ArrayList<ExtensionElem>(getElements().size());
    for (ExtensionElem elem : getElements()) {
      clone.addElement(elem.clone());
    }

    return clone;
  }
}

代码示例来源:origin: org.openrdf.sesame/sesame-queryparser-sparql

@Override
public TupleExpr visit(ASTDescribe node, Object data)
  throws VisitorException
{
  TupleExpr tupleExpr = (TupleExpr)data;
  if (tupleExpr == null) {
    tupleExpr = new SingletonSet();
  }
  Extension e = new Extension();
  ProjectionElemList projectionElements = new ProjectionElemList();
  for (int i = 0; i < node.jjtGetNumChildren(); i++) {
    ValueExpr resource = (ValueExpr)node.jjtGetChild(i).jjtAccept(this, null);
    if (resource instanceof Var) {
      projectionElements.addElement(new ProjectionElem(((Var)resource).getName()));
    }
    else {
      String alias = "_describe_" + UUID.randomUUID().toString().replaceAll("-", "_");
      ExtensionElem elem = new ExtensionElem(resource, alias);
      e.addElement(elem);
      projectionElements.addElement(new ProjectionElem(alias));
    }
  }
  if (!e.getElements().isEmpty()) {
    e.setArg(tupleExpr);
    tupleExpr = e;
  }
  Projection p = new Projection(tupleExpr, projectionElements);
  return new DescribeOperator(p);
}

代码示例来源:origin: eu.fbk.rdfpro/rdfpro-rules

for (final Extension extension : extractNodes(expr, Extension.class, null, null)) {
  TupleExpr arg = extension.getArg();
  while (arg instanceof Extension) {
    arg = ((Filter) arg).getArg();
    for (final ExtensionElem elem : new ArrayList<>(extension.getElements())) {
      final Set<String> elemVars = extractVariables(elem.getExpr());
      Extension newArg = null;
      if (join.getLeftArg().getAssuredBindingNames().containsAll(elemVars)) {
        newArg = join.getLeftArg() instanceof Extension ? (Extension) join
            .getLeftArg() : new Extension(join.getLeftArg());
            join.setLeftArg(newArg);
      } else if (join.getRightArg().getAssuredBindingNames().contains(elemVars)) {
        newArg = join.getRightArg() instanceof Extension ? (Extension) join
            .getRightArg() : new Extension(join.getRightArg());
            join.setRightArg(newArg);
        newArg.addElement(elem.clone());
        extension.getElements().remove(elem);
        dirty = true;
    if (extension.getElements().isEmpty()) {
      expr = (TupleExpr) replaceNode(expr, extension, extension.getArg());

代码示例来源:origin: org.openrdf.sesame/sesame-queryalgebra-model

@Override
public boolean equals(Object other) {
  if (other instanceof Extension && super.equals(other)) {
    Extension o = (Extension)other;
    return elements.equals(o.getElements());
  }
  return false;
}

代码示例来源:origin: org.openrdf.sesame/sesame-spin

private void visitBind(Resource r)
  throws OpenRDFException
{
  Value expr = Statements.singleValue(r, SP.EXPRESSION_PROPERTY, store);
  ValueExpr valueExpr = visitExpression(expr);
  Value varValue = Statements.singleValue(r, SP.VARIABLE_PROPERTY, store);
  if (!(varValue instanceof Resource)) {
    throw new MalformedSpinException(
        String.format("Value of %s is not a resource", SP.VARIABLE_PROPERTY));
  }
  String varName = getVarName((Resource)varValue);
  tupleNode = new Extension(tupleNode, new ExtensionElem(valueExpr, varName));
}

代码示例来源:origin: org.openrdf.sesame/sesame-queryparser-sparql

collector.meet(orderElem);
Extension extension = new Extension();
  extension.addElement(pe);
  group.addGroupElement(ge);
  extension.setArg(tupleExpr);
  tupleExpr = extension;

代码示例来源:origin: org.openrdf.sesame/sesame-sail-lucene-api

@Override
  public void updateQueryModelNodes(boolean hasResult) {
    QueryModelNode replacementNode = hasResult ? new SingletonSet() : new EmptySet();
    geoStatement.replaceWith(replacementNode);

    if(hasResult) {
      filter.replaceWith(filter.getArg());
    } else {
      filter.replaceWith(new EmptySet());
    }

    if(functionParent instanceof ExtensionElem) {
      Extension extension = (Extension) functionParent.getParentNode();
      List<ExtensionElem> elements = extension.getElements();
      if(elements.size() > 1) {
        elements.remove(functionParent);
      } else {
        extension.replaceWith(extension.getArg());
      }
    }
  }
}

代码示例来源:origin: eu.fbk.rdfpro/rdfpro-rules

final List<ExtensionElem> elems = ((Extension) e).getElements();
final Set<String> vars = new HashSet<>();
for (final ExtensionElem elem : elems) {
    result[i] = new Extension(result[i], elems);
    fixed = true;
    break;
  result[partition] = new Extension(result[partition], elems);
  fixed = true;

代码示例来源:origin: org.openrdf.sesame/sesame-spin

@Override
public void meet(Extension node)
  throws RDFHandlerException
{
  node.getArg().visit(this);
}

代码示例来源:origin: org.openrdf.sesame/sesame-queryrender

aExt = new Extension();
aExt.addElements(new ExtensionElem(new ValueConstant(aPattern.getSubjectVar().getValue()),
    aPattern.getSubjectVar().getName()));
  aExt = new Extension();
aExt.addElements(new ExtensionElem(new ValueConstant(aPattern.getPredicateVar().getValue()),
    aPattern.getPredicateVar().getName()));
  aExt = new Extension();
aExt.addElements(new ExtensionElem(new ValueConstant(aPattern.getObjectVar().getValue()),
    aPattern.getObjectVar().getName()));

代码示例来源:origin: org.openrdf.sesame/sesame-queryalgebra-model

public void addElements(ExtensionElem... elements) {
  for (ExtensionElem pe : elements) {
    addElement(pe);
  }
}

代码示例来源:origin: Quetzal-RDF/quetzal

Extension ex = new Extension();
for (Var var: s.getMap().keySet()) {
  String name = var.getName();
  ex.addElement(new ExtensionElem(expr, name));
if (!ex.getElements().isEmpty()) {
  ex.setArg(body);
  newExpression = ex;
} else {

代码示例来源:origin: org.openrdf.sesame/sesame-spin

@Override
public void meet(Extension node) {
  extension = node;
  List<ExtensionElem> elements = node.getElements();
  // NB: preserve ExtensionElem order
  extensionExprs = new LinkedHashMap<String, ValueExpr>(elements.size());
  for (ExtensionElem elem : elements) {
    extensionExprs.put(elem.getName(), elem.getExpr());
  }
}

代码示例来源:origin: eu.fbk.rdfpro/rdfpro-rules

RR.STAR_SELECT_GRAPH.stringValue(), filterGraphVars), new Var("_const-"
    + UUID.randomUUID(), RDF.NIL), CompareOp.NE));
body = new Extension(body, new ExtensionElem(new FunctionCall(
    RR.STAR_SELECT_GRAPH.stringValue(), bindGraphVars), prefix));

代码示例来源:origin: org.openrdf.sesame/sesame-queryparser-sparql

String alias = ((ASTVar)aliasNode).getName();
Extension extension = new Extension();
extension.addElement(new ExtensionElem(ve, alias));
  extension.setArg(((Filter)arg).getArg());
  ((Filter)arg).setArg(extension);
  extension.setArg(arg);
  result = extension;

代码示例来源:origin: org.openrdf.sesame/sesame-sail-lucene-api

@Override
  public void updateQueryModelNodes(boolean hasResult) {
    QueryModelNode replacementNode = hasResult ? new SingletonSet() : new EmptySet();
    geoStatement.replaceWith(replacementNode);

    if(hasResult) {
      filter.replaceWith(filter.getArg());
    } else {
      filter.replaceWith(new EmptySet());
    }

    if(functionParent instanceof ExtensionElem) {
      Extension extension = (Extension) functionParent.getParentNode();
      List<ExtensionElem> elements = extension.getElements();
      if(elements.size() > 1) {
        elements.remove(functionParent);
      } else {
        extension.replaceWith(extension.getArg());
      }
    }
  }
}

代码示例来源:origin: org.openrdf.sesame/sesame-queryalgebra-evaluation

@Override
public void meet(Extension node) {
  if (node.getArg().getBindingNames().containsAll(filterVars)) {
    node.getArg().visit(this);
  }
  else {
    relocate(filter, node);
  }
}

相关文章