@Override public boolean equals(Object other) { if (other instanceof ProjectionElemList) { ProjectionElemList o = (ProjectionElemList)other; return elements.equals(o.getElements()); } return false; }
@Override public boolean equals(Object other) { if (other instanceof ProjectionElemList) { ProjectionElemList o = (ProjectionElemList)other; return elements.equals(o.getElements()); } return false; }
/** * Return whether or not this projection looks like an spo binding for a construct query * * @param theList * the projection element list to inspect * @return true if it has the format of a spo construct projection element, false otherwise */ public static boolean isSPOElemList(ProjectionElemList theList) { return theList.getElements().size() == 3 && theList.getElements().get(0).getTargetName().equalsIgnoreCase("subject") && theList.getElements().get(1).getTargetName().equalsIgnoreCase("predicate") && theList.getElements().get(2).getTargetName().equalsIgnoreCase("object"); }
/** * Return whether or not this projection looks like an spo binding for a construct query * * @param theList * the projection element list to inspect * @return true if it has the format of a spo construct projection element, false otherwise */ public static boolean isSPOElemList(ProjectionElemList theList) { return theList.getElements().size() == 3 && theList.getElements().get(0).getTargetName().equalsIgnoreCase("subject") && theList.getElements().get(1).getTargetName().equalsIgnoreCase("predicate") && theList.getElements().get(2).getTargetName().equalsIgnoreCase("object"); }
/** * Return whether or not this projection looks like an spo binding for a construct query * * @param theList * the projection element list to inspect * @return true if it has the format of a spo construct projection element, false otherwise */ public static boolean isSPOElemList(ProjectionElemList theList) { return theList.getElements().size() == 3 && theList.getElements().get(0).getTargetName().equalsIgnoreCase("subject") && theList.getElements().get(1).getTargetName().equalsIgnoreCase("predicate") && theList.getElements().get(2).getTargetName().equalsIgnoreCase("object"); }
@Override public String getSignature() { return "(External Projection) " + Joiner.on(", ").join(tupleExpr.getProjectionElemList().getElements()).replaceAll("\\s+", " "); }
@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 void validateProjectionElemList(final ProjectionElemList list) { final List<ProjectionElem> elements = list.getElements(); checkArgument(elements.size() == 3); checkArgument(elements.get(0).getTargetName().equals("subject")); checkArgument(elements.get(1).getTargetName().equals("predicate")); checkArgument(elements.get(2).getTargetName().equals("object")); }
@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 String getSignature() { return "(Mongo PcjQueryNode) " + Joiner.on(", ").join(super.getTupleExpr().getProjectionElemList().getElements()).replaceAll("\\s+", " "); } }
/** * @inheritDoc */ @Override public void meet(final ProjectionElemList theProjectionElemList) throws Exception { if (!theProjectionElemList.getElements().isEmpty()) { mProjection.add(theProjectionElemList.clone()); } theProjectionElemList.visitChildren(this); }
@Override public String getSignature() { return "(SimpleExternalTupleSet) " + Joiner.on(", ") .join(this.getTupleExpr().getProjectionElemList() .getElements()).replaceAll("\\s+", " "); } }
/** * @inheritDoc */ @Override public void meet(final ProjectionElemList theProjectionElemList) throws Exception { if (!theProjectionElemList.getElements().isEmpty()) { mProjection.add(theProjectionElemList.clone()); } theProjectionElemList.visitChildren(this); }
/** * @inheritDoc */ @Override public void meet(final ProjectionElemList theProjectionElemList) throws Exception { if (!theProjectionElemList.getElements().isEmpty()) { mProjection.add(theProjectionElemList.clone()); } theProjectionElemList.visitChildren(this); }
@Override public void meet(ProjectionElemList node) { List<ProjectionElem> proj = node.getElements(); for (ProjectionElem s : proj) { if (varChanges.containsKey(s.getSourceName())) { String name = s.getSourceName(); s.setSourceName(varChanges.get(name)); s.setTargetName(varChanges.get(name)); } } }
private static VariableOrder getConstructGraphVarOrder(List<ProjectionElemList> projections) { final Set<String> varOrders = new HashSet<>(); for(final ProjectionElemList elems: projections) { for(final ProjectionElem elem: elems.getElements()) { final String name = elem.getSourceName(); if (!VarNameUtils.isConstant(name) && !VarNameUtils.isAnonymous(name)) { varOrders.add(name); } } } return new VariableOrder(varOrders); }
@Override public void meet(Var node) { if (projection != null) { boolean projected = false; for (ProjectionElem e : projection.getProjectionElemList().getElements()) { String source = e.getSourceName(); String target = e.getTargetName(); if (node.getName().equals(source) && node.getName().equals(target)) { projected = true; break; } } if (!projected) { variablesProjected = false; } } }
@Override public void meet(Var node) { if (projection != null) { boolean projected = false; for (ProjectionElem e : projection.getProjectionElemList().getElements()) { String source = e.getSourceName(); String target = e.getTargetName(); if (node.getName().equals(source) && node.getName().equals(target)) { projected = true; break; } } if (!projected) { variablesProjected = false; } } }
public static BindingSet project(ProjectionElemList projElemList, BindingSet sourceBindings, BindingSet parentBindings, boolean includeAllParentBindings) { final QueryBindingSet resultBindings = new QueryBindingSet(); if (includeAllParentBindings) { resultBindings.addAll(parentBindings); } for (ProjectionElem pe : projElemList.getElements()) { Value targetValue = sourceBindings.getValue(pe.getSourceName()); if (!includeAllParentBindings && targetValue == null) { targetValue = parentBindings.getValue(pe.getSourceName()); } if (targetValue != null) { resultBindings.setBinding(pe.getTargetName(), targetValue); } } return resultBindings; } }
public static BindingSet project(ProjectionElemList projElemList, BindingSet sourceBindings, BindingSet parentBindings, boolean includeAllParentBindings) { final QueryBindingSet resultBindings = new QueryBindingSet(); if (includeAllParentBindings) { resultBindings.addAll(parentBindings); } for (ProjectionElem pe : projElemList.getElements()) { Value targetValue = sourceBindings.getValue(pe.getSourceName()); if (!includeAllParentBindings && targetValue == null) { targetValue = parentBindings.getValue(pe.getSourceName()); } if (targetValue != null) { resultBindings.setBinding(pe.getTargetName(), targetValue); } } return resultBindings; } }