private Set<URI> getGraphs(StatementPattern sp) { if (dataset == null) return null; if (dataset.getDefaultGraphs().isEmpty() && dataset.getNamedGraphs().isEmpty()) return null; if (sp.getScope() == Scope.DEFAULT_CONTEXTS) return dataset.getDefaultGraphs(); return dataset.getNamedGraphs(); }
public void meet(StatementPattern node) { if (!Scope.DEFAULT_CONTEXTS.equals(node.getScope())) { basicPattern = false; } else if (node.getContextVar() != null) { basicPattern = false; } else { super.meet(node); } } }
if (sp.getScope() == Scope.DEFAULT_CONTEXTS) { graphs = dataset.getDefaultGraphs(); emptyGraph = graphs.isEmpty() && !dataset.getNamedGraphs().isEmpty();
@Override public boolean equals(Object other) { if (other instanceof StatementPattern) { StatementPattern o = (StatementPattern)other; return subjectVar.equals(o.getSubjectVar()) && predicateVar.equals(o.getPredicateVar()) && objectVar.equals(o.getObjectVar()) && nullEquals(contextVar, o.getContextVar()) && scope.equals(o.getScope()); } return false; }
@Override public void meet(StatementPattern node) throws RepositoryException { StringBuilder sb = new StringBuilder(); Scope scope = node.getScope(); Var subj = node.getSubjectVar(); Var pred = node.getPredicateVar();
Scope scope = node.getScope(); Var subj = node.getSubjectVar(); Var pred = node.getPredicateVar();
@Override public void meet(StatementPattern node) { handleType(SeRQO.STATEMENTPATTERN); handleLiteral(SeRQO.SCOPE, node.getScope().name()); handleChild(SeRQO.SUBJECTVAR, node.getSubjectVar()); handleChild(SeRQO.PREDICATEVAR, node.getPredicateVar()); handleChild(SeRQO.OBJECTVAR, node.getObjectVar()); handleChild(SeRQO.CONTEXTVAR, node.getContextVar()); super.meet(node); }
@Override public void meet(StatementPattern node) throws RDFHandlerException { ListContext ctxList = null; if (StatementPattern.Scope.NAMED_CONTEXTS == node.getScope()) { ctxList = getNamedGraph(node.getContextVar()); } listEntry(); predicate = SP.SUBJECT_PROPERTY; node.getSubjectVar().visit(this); predicate = SP.PREDICATE_PROPERTY; node.getPredicateVar().visit(this); predicate = SP.OBJECT_PROPERTY; node.getObjectVar().visit(this); predicate = null; if (ctxList != null) { restoreNamedGraph(ctxList); } }
@Override public CloseableIteration<BindingSet, QueryEvaluationException> evaluate( BindingSet bindings) throws QueryEvaluationException { if (this.bindings != null) { QueryBindingSet b = new QueryBindingSet(bindings); b.addAll(this.bindings); bindings = b; } CloseableIteration<? extends Statement, QueryEvaluationException> stIter = null; try { Resource[] contexts = contexts(sp, dataset, bindings); if (contexts == null) return new EmptyIteration<BindingSet, QueryEvaluationException>(); Iterator<Statement> iter = filter(model, bindings).iterator(); stIter = new CloseableIteratorIteration<Statement, QueryEvaluationException>(iter); if (contexts.length == 0 && sp.getScope() == Scope.NAMED_CONTEXTS) { stIter = new NamedContextCursor(stIter); } } catch (ClassCastException e) { // Invalid value type for subject, predicate and/or context return new EmptyIteration<BindingSet, QueryEvaluationException>(); } // The same variable might have been used multiple times in this // StatementPattern, verify value equality in those cases. stIter = new StatementPatternCursor(stIter, sp); // Return an iterator that converts the statements to var bindings return new StatementBindingSetCursor(stIter, sp, bindings); }
if (p.getSparqlPattern().getScope() == StatementPattern.Scope.DEFAULT_CONTEXTS) { graphs = dataset.getDefaultGraphs(); emptyGraph = graphs.isEmpty() && !dataset.getNamedGraphs().isEmpty();