/** * @return SubjectPattern representation of this ConstructProjection * containing the {@link ConstructProjection#subjectSourceVar}, * {@link ConstructProjection#predicateSourceVar}, * {@link ConstructProjection#objectSourceVar} */ public StatementPattern getStatementPatternRepresentation() { return new StatementPattern(subjVar, predVar, objVar); }
private StatementPattern newPattern(Var theSubj, Var thePred, Var theObj) { return new StatementPattern(mScope, theSubj, thePred, theObj, mContext); }
public void addRequiredSP(Var subjVar, Var predVar, Var objVar) { addRequiredTE(new StatementPattern(spScope, subjVar, predVar, objVar, contextVar)); }
/** * Converts the String representation of a {@link StatementPattern} back * into the object version. * * @param patternString - The {@link StatementPattern} represented as a String. (not null) * @return A {@link StatementPatter} built from the string. */ public static StatementPattern toStatementPattern(final String patternString) { checkNotNull(patternString); final String[] parts = patternString.split(DELIM); final String subjectPart = parts[0]; final String predicatePart = parts[1]; final String objectPart = parts[2]; final Var subject = toVar(subjectPart); final Var predicate = toVar(predicatePart); final Var object = toVar(objectPart); return new StatementPattern(subject, predicate, object); }
@Override public void meet(Move node) throws RuntimeException { list.add(new StatementPattern(newVar(), newVar(), newVar(), newVar(node.getSourceGraph()))); list.add(new StatementPattern(newVar(), newVar(), newVar(), newVar(node.getDestinationGraph()))); }
/** * @inheritDoc */ public QueryBuilder<T> addProjectionStatement(IRI theSubj, IRI thePred, String theObj) { if (isConstruct()) { mProjectionPatterns.add(new StatementPattern(GroupBuilder.valueToVar(theSubj), GroupBuilder.valueToVar(thePred), new Var(theObj))); } return this; }
@Override public void meet(Copy node) throws RuntimeException { list.add(new StatementPattern(newVar(), newVar(), newVar(), newVar(node.getSourceGraph()))); list.add(new StatementPattern(newVar(), newVar(), newVar(), newVar(node.getDestinationGraph()))); }
/** * @inheritDoc */ public QueryBuilder<T> addProjectionStatement(String theSubj, IRI thePred, Value theObj) { if (isConstruct()) { mProjectionPatterns.add(new StatementPattern(new Var(theSubj), GroupBuilder.valueToVar(thePred), GroupBuilder.valueToVar(theObj))); } return this; }
/** * @inheritDoc */ public QueryBuilder<T> addProjectionStatement(final String theSubj, final Value thePred, final Value theObj) { if (isConstruct()) { mProjectionPatterns.add(new StatementPattern(new Var(theSubj), GroupBuilder.valueToVar(thePred), GroupBuilder.valueToVar(theObj))); } return this; }
@Override public void meet(Clear node) throws RuntimeException { if (node.getGraph() != null) { list.add(new StatementPattern(newVar(), newVar(), newVar(), newVar(node.getGraph()))); } else { list.add(new StatementPattern(newVar(), newVar(), newVar(), newVar())); } }
@Override public void meet(Create node) throws RuntimeException { list.add(new StatementPattern(newVar(), newVar(), newVar(), newVar(node.getGraph()))); }
@Override public void meet(Add node) throws RuntimeException { list.add(new StatementPattern(newVar(), newVar(), newVar(), newVar(node.getSourceGraph()))); }
/** * @inheritDoc */ public QueryBuilder<T> addProjectionStatement(final String theSubj, final String thePred, final Value theObj) { if (isConstruct()) { mProjectionPatterns.add(new StatementPattern(new Var(theSubj), new Var(thePred), GroupBuilder.valueToVar(theObj))); } return this; }
private static TupleExpr extractConstructExpression( final Map<String, ExtensionElem> extensions, final Iterable<? extends ProjectionElemList> multiProjections) { TupleExpr expression = null; for (final ProjectionElemList projections : multiProjections) { final Var subj = extractConstructVar(extensions, projections.getElements().get(0)); final Var pred = extractConstructVar(extensions, projections.getElements().get(1)); final Var obj = extractConstructVar(extensions, projections.getElements().get(2)); final Var ctx = projections.getElements().size() < 4 ? null : extractConstructVar( extensions, projections.getElements().get(3)); final StatementPattern pattern = new StatementPattern( ctx == null ? Scope.DEFAULT_CONTEXTS : Scope.NAMED_CONTEXTS, subj, pred, obj, ctx); expression = expression == null ? pattern : new Join(expression, pattern); } return expression; }
/** * @inheritDoc */ public QueryBuilder<T> addProjectionStatement(IRI theSubj, String thePred, String theObj) { if (isConstruct()) { mProjectionPatterns.add(new StatementPattern(GroupBuilder.valueToVar(theSubj), new Var(thePred), new Var(theObj))); } return this; }
/** * @inheritDoc */ public QueryBuilder<T> addProjectionStatement(String theSubj, IRI thePred, String theObj) { if (isConstruct()) { mProjectionPatterns.add(new StatementPattern(new Var(theSubj), GroupBuilder.valueToVar(thePred), new Var(theObj))); } return this; }
private static TupleExpr extractConstructExpression( final Map<String, ExtensionElem> extensions, final Iterable<? extends ProjectionElemList> multiProjections) { TupleExpr expression = null; for (final ProjectionElemList projections : multiProjections) { final Var subj = extractConstructVar(extensions, projections.getElements().get(0)); final Var pred = extractConstructVar(extensions, projections.getElements().get(1)); final Var obj = extractConstructVar(extensions, projections.getElements().get(2)); final Var ctx = projections.getElements().size() < 4 ? null : extractConstructVar( extensions, projections.getElements().get(3)); final StatementPattern pattern = new StatementPattern( ctx == null ? Scope.DEFAULT_CONTEXTS : Scope.NAMED_CONTEXTS, subj, pred, obj, ctx); expression = expression == null ? pattern : new Join(expression, pattern); } return expression; }
/** * @inheritDoc */ public QueryBuilder<T> addProjectionStatement(final String theSubj, final String thePred, final String theObj) { if (isConstruct()) { mProjectionPatterns.add(new StatementPattern(new Var(theSubj), new Var(thePred), new Var(theObj))); } return this; }
private CloseableIteration<BindingSet, QueryEvaluationException> createNextIteration(Value subject, Value object) throws QueryEvaluationException { if (subject == null && object == null) { return new EmptyIteration<BindingSet, QueryEvaluationException>(); } Var subjVar = new Var(VARNAME_SUBJECT, subject); Var predVar = new Var(VARNAME_PREDICATE); Var objVar = new Var(VARNAME_OBJECT, object); StatementPattern pattern = new StatementPattern(subjVar, predVar, objVar); return strategy.evaluate(pattern, parentBindings); }
private CloseableIteration<BindingSet, QueryEvaluationException> createIteration() throws QueryEvaluationException { Var startVar = createAnonVar(ANON_SUBJECT_VAR); Var predicate = createAnonVar(ANON_PREDICATE_VAR); Var endVar = createAnonVar(ANON_OBJECT_VAR); StatementPattern subjects = new StatementPattern(startVar, predicate, endVar); if (contextVar != null) { subjects.setScope(Scope.NAMED_CONTEXTS); subjects.setContextVar(contextVar); } CloseableIteration<BindingSet, QueryEvaluationException> iter = evaluationStrategy.evaluate( subjects, bindings); return iter; }