public void addElements(Iterable<ProjectionElem> elements) { for (ProjectionElem pe : elements) { addElement(pe); } }
public void addElements(ProjectionElem... elements) { for (ProjectionElem pe : elements) { addElement(pe); } }
public void addElements(ProjectionElem... elements) { for (ProjectionElem pe : elements) { addElement(pe); } }
public void addElements(Iterable<ProjectionElem> elements) { for (ProjectionElem pe : elements) { addElement(pe); } }
private ProjectionElemList visitTemplate(Resource r) throws RDF4JException { ProjectionElemList projElems = new ProjectionElemList(); Value subj = TripleSources.singleValue(r, SP.SUBJECT_PROPERTY, store); projElems.addElement(createProjectionElem(subj, "subject", null)); Value pred = TripleSources.singleValue(r, SP.PREDICATE_PROPERTY, store); projElems.addElement(createProjectionElem(pred, "predicate", null)); Value obj = TripleSources.singleValue(r, SP.OBJECT_PROPERTY, store); projElems.addElement(createProjectionElem(obj, "object", null)); return projElems; }
@Override public ProjectionElemList clone() { ProjectionElemList clone = (ProjectionElemList)super.clone(); clone.elements = new ArrayList<>(getElements().size()); for (ProjectionElem pe : getElements()) { clone.addElement(pe.clone()); } return clone; } }
@Override public ProjectionElemList clone() { ProjectionElemList clone = (ProjectionElemList)super.clone(); clone.elements = new ArrayList<ProjectionElem>(getElements().size()); for (ProjectionElem pe : getElements()) { clone.addElement(pe.clone()); } return clone; } }
private UnaryTupleOperator projection() { if (!mProjectionPatterns.isEmpty()) { return multiProjection(); } else { Extension aExt = null; ProjectionElemList aList = new ProjectionElemList(); for (String aVar : mProjectionVars) { aList.addElement(new ProjectionElem(aVar)); } Projection aProjection = new Projection(); aProjection.setProjectionElemList(aList); if (aExt != null) { aProjection.setArg(aExt); } return aProjection; } }
private UnaryTupleOperator projection() { if (!mProjectionPatterns.isEmpty()) { return multiProjection(); } else { Extension aExt = null; ProjectionElemList aList = new ProjectionElemList(); for (String aVar : mProjectionVars) { aList.addElement(new ProjectionElem(aVar)); } Projection aProjection = new Projection(); aProjection.setProjectionElemList(aList); if (aExt != null) { aProjection.setArg(aExt); } return aProjection; } }
private UnaryTupleOperator projection() { if (!mProjectionPatterns.isEmpty()) { return multiProjection(); } else { Extension aExt = null; ProjectionElemList aList = new ProjectionElemList(); for (String aVar : mProjectionVars) { aList.addElement(new ProjectionElem(aVar)); } Projection aProjection = new Projection(); aProjection.setProjectionElemList(aList); if (aExt != null) { aProjection.setArg(aExt); } return aProjection; } }
@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); }
@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); }
@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); }
private Projection visitResultVariables(Resource resultVars, Map<String, ProjectionElem> previousProjElems) throws RDF4JException { ProjectionElemList projElemList = new ProjectionElemList(); Iteration<? extends Resource, QueryEvaluationException> iter = TripleSources.listResources( resultVars, store); while (iter.hasNext()) { Resource r = iter.next(); ProjectionElem projElem = visitResultVariable(r, previousProjElems); projElemList.addElement(projElem); } Projection proj = new Projection(); proj.setProjectionElemList(projElemList); tupleRoot = proj; return proj; }
private Projection visitResultNodes(Resource resultNodes) throws RDF4JException { ProjectionElemList projElemList = new ProjectionElemList(); Iteration<? extends Resource, QueryEvaluationException> iter = TripleSources.listResources( resultNodes, store); while (iter.hasNext()) { Resource r = iter.next(); ProjectionElem projElem = visitResultNode(r); projElemList.addElement(projElem); } Projection proj = new Projection(); proj.setProjectionElemList(projElemList); tupleRoot = new DescribeOperator(proj); return proj; }
projElemList.addElement(new ProjectionElem(alias)); projElemList.addElement(new ProjectionElem(projVar.getName()));
projElemList.addElement(new ProjectionElem(alias)); projElemList.addElement(new ProjectionElem(projVar.getName()));
ProjectionElemList aList = new ProjectionElemList(); aList.addElement(new ProjectionElem(aPattern.getSubjectVar().getName(), "subject")); aList.addElement(new ProjectionElem(aPattern.getPredicateVar().getName(), "predicate")); aList.addElement(new ProjectionElem(aPattern.getObjectVar().getName(), "object"));
ProjectionElemList aList = new ProjectionElemList(); aList.addElement(new ProjectionElem(aPattern.getSubjectVar().getName(), "subject")); aList.addElement(new ProjectionElem(aPattern.getPredicateVar().getName(), "predicate")); aList.addElement(new ProjectionElem(aPattern.getObjectVar().getName(), "object"));
ProjectionElemList aList = new ProjectionElemList(); aList.addElement(new ProjectionElem(aPattern.getSubjectVar().getName(), "subject")); aList.addElement(new ProjectionElem(aPattern.getPredicateVar().getName(), "predicate")); aList.addElement(new ProjectionElem(aPattern.getObjectVar().getName(), "object"));