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

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

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

Extension.<init>介绍

暂无

代码示例

代码示例来源:origin: de.tudarmstadt.ukp.inception.rdf4j/rdf4j-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: de.tudarmstadt.ukp.inception.rdf4j/rdf4j-spin

private void visitBind(Resource r)
  throws RDF4JException
{
  Value expr = TripleSources.singleValue(r, SP.EXPRESSION_PROPERTY, store);
  ValueExpr valueExpr = visitExpression(expr);
  Value varValue = TripleSources.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.eclipse.rdf4j/rdf4j-queryalgebra-evaluation

if (varsBefore.contains(name)) {
  UnaryTupleOperator proj = (UnaryTupleOperator)projElems.getParentNode();
  Extension ext = new Extension(proj.getArg());
  proj.setArg(ext);
  Var lostVar = new Var(name);

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

if (varsBefore.contains(name)) {
  UnaryTupleOperator proj = (UnaryTupleOperator)projElems.getParentNode();
  Extension ext = new Extension(proj.getArg());
  proj.setArg(ext);
  Var lostVar = new Var(name);

代码示例来源:origin: org.eclipse.rdf4j/rdf4j-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: eclipse/rdf4j

@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: org.eclipse.rdf4j/rdf4j-client

@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: de.tudarmstadt.ukp.inception.rdf4j/rdf4j-spin

private TupleExpr visitHaving(Resource having)
  throws RDF4JException
{
  UnaryTupleOperator op = (UnaryTupleOperator)group.getParentNode();
  op.setArg(new Extension(group));
  Iteration<? extends Resource, QueryEvaluationException> iter = TripleSources.listResources(having,
      store);
  while (iter.hasNext()) {
    Resource r = iter.next();
    ValueExpr havingExpr = visitExpression(r);
    Filter filter = new Filter(op.getArg(), havingExpr);
    op.setArg(filter);
    op = filter;
  }
  return op;
}

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

private void renameVar(Var oldVar, Var newVar, Filter filter) {
  filter.getArg().visit(new VarRenamer(oldVar, newVar));
  // TODO: skip this step if old variable name is not used
  // Replace SameTerm-filter with an Extension, the old variable name
  // might still be relevant to nodes higher in the tree
  Extension extension = new Extension(filter.getArg());
  extension.addElement(new ExtensionElem(new Var(newVar.getName()), oldVar.getName()));
  filter.replaceWith(extension);
}

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

private void renameVar(Var oldVar, Var newVar, Filter filter) {
  filter.getArg().visit(new VarRenamer(oldVar, newVar));
  // TODO: skip this step if old variable name is not used
  // Replace SameTerm-filter with an Extension, the old variable name
  // might still be relevant to nodes higher in the tree
  Extension extension = new Extension(filter.getArg());
  extension.addElement(new ExtensionElem(new Var(newVar.getName()), oldVar.getName()));
  filter.replaceWith(extension);
}

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

Extension extension = new Extension();
ProjectionElemList projElemList = new ProjectionElemList();

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

collector.meet(orderElem);
Extension extension = new Extension();

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

collector.meet(orderElem);
Extension extension = new Extension();

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

collector.meet(orderElem);
Extension extension = new Extension();

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

aExt = new Extension();
aExt = new Extension();
aExt = new Extension();

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

aExt = new Extension();
aExt = new Extension();
aExt = new Extension();

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

aExt = new Extension();
aExt = new Extension();
aExt = new Extension();

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

Extension extension = new Extension();
for (AggregateOperator operator : collector.getOperators()) {
  Var var = createAnonVar();

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

@Test
public void testExtension() throws Exception {
  QueryRoot queryTree = new QueryRoot(new Extension(
      new StatementPattern(new Var("x"), constant(TAKES), new Var("c")),
      new ExtensionElem(new Var("x"), "renamed"),
      new ExtensionElem(new ValueConstant(TAKES), "constant")));
  SparqlToPipelineTransformVisitor visitor = new SparqlToPipelineTransformVisitor(collection);
  queryTree.visit(visitor);
  Assert.assertTrue(queryTree.getArg() instanceof AggregationPipelineQueryNode);
  AggregationPipelineQueryNode pipelineNode = (AggregationPipelineQueryNode) queryTree.getArg();
  Assert.assertEquals(Sets.newHashSet("x", "c", "renamed", "constant"), pipelineNode.getAssuredBindingNames());
}

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

@Test
  public void testUnsupportedExtension() throws Exception {
    StatementPattern sp = new StatementPattern(new Var("x"), constant(TAKES), new Var("c"));
    List<ExtensionElem> elements = Arrays.asList(new ExtensionElem(new Var("x"), "renamed"),
        new ExtensionElem(new Not(new ValueConstant(VF.createLiteral(true))), "notTrue"),
        new ExtensionElem(new ValueConstant(TAKES), "constant"));
    Extension extensionNode = new Extension(sp, elements);
    QueryRoot queryTree = new QueryRoot(extensionNode);
    SparqlToPipelineTransformVisitor visitor = new SparqlToPipelineTransformVisitor(collection);
    queryTree.visit(visitor);
    Assert.assertTrue(queryTree.getArg() instanceof Extension);
    Assert.assertEquals(elements, ((Extension) queryTree.getArg()).getElements());
    TupleExpr innerQuery = ((Extension) queryTree.getArg()).getArg();
    Assert.assertTrue(innerQuery instanceof AggregationPipelineQueryNode);
    AggregationPipelineQueryNode pipelineNode = (AggregationPipelineQueryNode) innerQuery;
    Assert.assertEquals(Sets.newHashSet("x", "c"), pipelineNode.getAssuredBindingNames());
  }
}

相关文章