/** * Returns the position in the group. If the node is not present in * the group, the last position in the group is returned. * * We calculate the position in order to make sure that we append * new nodes at the same position of the property path node that * will be replaced later on. This is important in order to keep * semantics of the query, e.g. in the context of OPTIONAL or * MINUS queries we cannot blindly append at the end. See BLZG-1498 * and BLZG-1627 and the respective test cases in TestTickets for * examples that illustrate why this is indeed necessary. */ protected int getPositionOfNodeInGroup( final PropertyPathNode node, final GraphPatternGroup<? extends IGroupMemberNode> group) { final List<? extends IGroupMemberNode> children = group.getChildren(); for (int i=0; i<children.size(); i++) { if (children.get(i).equals(node)) return i; } // if we don't find the property path node, we're in a nested scope // (e.g. for union subgroups). In that case, we append at the end. return children.size(); }
/** * Returns the position in the group. If the node is not present in * the group, the last position in the group is returned. * * We calculate the position in order to make sure that we append * new nodes at the same position of the property path node that * will be replaced later on. This is important in order to keep * semantics of the query, e.g. in the context of OPTIONAL or * MINUS queries we cannot blindly append at the end. See BLZG-1498 * and BLZG-1627 and the respective test cases in TestTickets for * examples that illustrate why this is indeed necessary. */ protected int getPositionOfNodeInGroup( final PropertyPathNode node, final GraphPatternGroup<? extends IGroupMemberNode> group) { final List<? extends IGroupMemberNode> children = group.getChildren(); for (int i=0; i<children.size(); i++) { if (children.get(i).equals(node)) return i; } // if we don't find the property path node, we're in a nested scope // (e.g. for union subgroups). In that case, we append at the end. return children.size(); }
public RDRHistoryServiceCall(final AbstractTripleStore database, final IServiceOptions options, final GraphPatternGroup<IGroupMemberNode> subgroup) { this.database = database; this.options = options; this.subgroup = subgroup; final List<StatementPatternNode> spNodes = subgroup.getChildren(StatementPatternNode.class); if (spNodes.size() != 2) { throw new IllegalArgumentException(); } if (spNodes.get(0).sid() != null) { sidNode = spNodes.get(0); historyNode = spNodes.get(1); } else { sidNode = spNodes.get(1); historyNode = spNodes.get(0); } }
public RDRHistoryServiceCall(final AbstractTripleStore database, final IServiceOptions options, final GraphPatternGroup<IGroupMemberNode> subgroup) { this.database = database; this.options = options; this.subgroup = subgroup; final List<StatementPatternNode> spNodes = subgroup.getChildren(StatementPatternNode.class); if (spNodes.size() != 2) { throw new IllegalArgumentException(); } if (spNodes.get(0).sid() != null) { sidNode = spNodes.get(0); historyNode = spNodes.get(1); } else { sidNode = spNodes.get(1); historyNode = spNodes.get(0); } }
final Iterator<IGroupMemberNode> itr = graphPattern.getChildren() .iterator();
final Iterator<IGroupMemberNode> itr = graphPattern.getChildren() .iterator();
final Iterator<IGroupMemberNode> itr = graphPattern.getChildren() .iterator();
final Iterator<IGroupMemberNode> itr = graphPattern.getChildren() .iterator();
@SuppressWarnings("unchecked") private void testQuery(final BigdataSailRepositoryConnection conn, final String query, final int expectedIVs) throws MalformedQueryException, RepositoryException, QueryEvaluationException { TupleQuery tq = conn.prepareTupleQuery(QueryLanguage.SPARQL, query); TupleQueryResult tqr = tq.evaluate(); try { int cnt = 0; while (tqr.hasNext()) { tqr.next(); cnt++; } // assertEquals("Expected 1 row in resultset", 1, cnt); QueryRoot queryRoot = ((BigdataSailTupleQuery)tq).getASTContainer().getOriginalAST(); cnt = 0; for (Object filterNode: queryRoot.getWhereClause().getChildren(FilterNode.class)) { cnt += checkNode((BOp)filterNode); } assertEquals("Expected inlined IV for date literal", expectedIVs, cnt); } finally { tqr.close(); } }
@SuppressWarnings("unchecked") private void testQuery(final BigdataSailRepositoryConnection conn, final String query, final int expectedIVs) throws MalformedQueryException, RepositoryException, QueryEvaluationException { TupleQuery tq = conn.prepareTupleQuery(QueryLanguage.SPARQL, query); TupleQueryResult tqr = tq.evaluate(); try { int cnt = 0; while (tqr.hasNext()) { tqr.next(); cnt++; } // assertEquals("Expected 1 row in resultset", 1, cnt); QueryRoot queryRoot = ((BigdataSailTupleQuery)tq).getASTContainer().getOriginalAST(); cnt = 0; for (Object filterNode: queryRoot.getWhereClause().getChildren(FilterNode.class)) { cnt += checkNode((BOp)filterNode); } assertEquals("Expected inlined IV for date literal", expectedIVs, cnt); } finally { tqr.close(); } }
List<FilterNode> filterNodes = whereClause.getChildren(FilterNode.class); for (FilterNode filterNode: filterNodes) { checkNode(filterNode);
List<FilterNode> filterNodes = whereClause.getChildren(FilterNode.class); for (FilterNode filterNode: filterNodes) { checkNode(filterNode);