/** * Get a constraint element by index. * * @param index The constraint element to retrieve, from 0 to 3. * @return The constraint element referred to by index. */ public ConstraintElement getElement(int index) { return constraint.getElement(index); }
public ConstraintElement getModel() { return unanchoredConstraint.getModel(); }
/** * Get all constraints which are variables. For back-compatibility, this * method currently ignores the fourth element of the triple. * * @return A set containing all variable constraints. */ public Set<Variable> getVariables() { return constraint.getVariables(); }
public static Constraint replace(Map<Variable,ValueElement> bindings, Constraint constraint) throws QueryException { return ConstraintFactory.newConstraint(replace(bindings, constraint.getElement(0)), replace(bindings, constraint.getElement(1)), replace(bindings, constraint.getElement(2)), replace(bindings, constraint.getModel())); }
store = newStore; subject = toGraphTuplesIndex(constraint.getElement(0)); predicate = toGraphTuplesIndex(constraint.getElement(1)); object = toGraphTuplesIndex(constraint.getElement(2)); metanode = toGraphTuplesIndex(constraint.getModel()); if (constraint.getElement(index) instanceof Variable) { Variable var = (Variable) constraint.getElement(index); if (!var.equals(Variable.FROM)) {
/** * Get a constraint element by index. * * @param index The constraint element to retrieve, from 0 to 3. * @return The constraint element referred to by index. */ public ConstraintElement getElement(int index) { return transConstraint.getElement(index); }
if (!(predConstraint.getAnchoredConstraint().getElement(1) instanceof ValueElement)) { throw new QueryException("Predicate in walk function, " + predConstraint.getAnchoredConstraint().getElement(1) + ", currently must be bound to a value."); if (((predConstraint.getAnchoredConstraint().getElement(0) instanceof Variable) && !(predConstraint.getAnchoredConstraint().getElement(2) instanceof ValueElement)) || ((predConstraint.getAnchoredConstraint().getElement(0) instanceof ValueElement) && !(predConstraint.getAnchoredConstraint().getElement(2) instanceof Variable))) { throw new QueryException( "The subject: " + predConstraint.getAnchoredConstraint().getElement(0) + " and the object: " + predConstraint.getAnchoredConstraint().getElement(2) + " are invalid, one must be a variable and the other a fixed value" + " around a predicate."); if (!(predConstraint.getUnanchoredConstraint().getElement(1) instanceof ValueElement)) { throw new QueryException("Predicate in transitive function, " + predConstraint.getElement(1) + ", currently must be bound to a value."); if (!((predConstraint.getUnanchoredConstraint().getElement(0) instanceof Variable) && (predConstraint.getUnanchoredConstraint().getElement(2) instanceof Variable))) { throw new QueryException( "The subject: " + predConstraint.getUnanchoredConstraint().getElement(0) + " and the object: " + predConstraint.getUnanchoredConstraint().getElement(2) + " are invalid, both must be variables."); if (anchoredConstraint.getElement(0) instanceof Variable) { ConstraintElement element = anchoredConstraint.getElement(2);
public ConstraintElement getModel() { return constraint.getModel(); }
/** * Get all constraints which are variables. For back-compatibility, this * method currently ignores the fourth element of the triple. * * @return A set containing all variable constraints. */ public Set<Variable> getVariables() { return transConstraint.getVariables(); }
/** * Get a constraint element by index. * * @param index The constraint element to retrieve, from 0 to 3. * @return The constraint element referred to by index. */ public ConstraintElement getElement(int index) { return unanchoredConstraint.getElement(index); }
if (predConstraint.getElement(0) instanceof Variable) { value = new Long(session.lookup((Value)predConstraint.getElement(2))); variable = (Variable) predConstraint.getElement(0); predConstraint.getElement(1), tmpVariable, predConstraint.getModel()); } else { value = new Long(session.lookup((Value)predConstraint.getElement(0))); variable = (Variable)predConstraint.getElement(2); predConstraint.getElement(1), variable, predConstraint.getElement(3));
public ConstraintElement getModel() { return transConstraint.getModel(); }
/** * Get all constraints which are variables. For back-compatibility, this * method currently ignores the fourth element of the triple. * * @return A set containing all variable constraints. */ public Set<Variable> getVariables() { Set<Variable> vars = new HashSet<Variable>(); vars.addAll(unanchoredConstraint.getVariables()); vars.addAll(anchoredConstraint.getVariables()); return vars; }
/** * Get a constraint element by index. * * @param index The constraint element to retrieve, from 0 to 3. * @return The constraint element referred to by index. */ public ConstraintElement getElement(int index) { return unanchoredConstraint.getElement(index); }
public ConstraintElement getModel() { return unanchoredConstraint.getModel(); }
/** * Get all constraints which are variables. For back-compatibility, this * method currently ignores the fourth element of the triple. * * @return A set containing all variable constraints. */ public Set<Variable> getVariables() { Set<Variable> vars = new HashSet<Variable>(); vars.addAll(unanchoredConstraint.getVariables()); vars.addAll(anchoredConstraint.getVariables()); return vars; }
public void renameVariables(Constraint constraint) { variables[0] = (Variable)constraint.getElement(0); }
public Resolution resolve(Constraint constraint) throws QueryException { // Validate "constraint" parameter if (constraint == null) { throw new IllegalArgumentException("Null \"constraint\" parameter"); } if (!(constraint.getModel() instanceof LocalNode)) { throw new QueryException( "Unable to resolve constraint with unbound model: " + constraint ); } assert constraint.getModel() instanceof LocalNode; LocalNode modelLocalNode = (LocalNode)constraint.getModel(); // Obtain the resolver against the cached version Resolver temporaryResolver; try { temporaryResolver = getTemporaryResolver(modelLocalNode); } catch (Exception e) { throw new QueryException("Unable to cache model " + modelLocalNode, e); } assert temporaryResolver != null; return temporaryResolver.resolve(constraint); }
public Constraint rewrite(ConstraintElement newModel, Constraint constraint) throws Exception { return new ConstraintImpl(constraint.getElement(0), constraint.getElement(1), constraint.getElement(2), newModel); } }),
throw new IllegalArgumentException("constraint null"); else if (!(constraint.getModel() instanceof LocalNode)) { throw new QueryException("Constraint model can't be variable"); long modelNode; try { modelNode = ((LocalNode) constraint.getModel()).getValue(); Value node = resolverSession.globalize(modelNode);