@Override public boolean hasNext() { return iteration.hasNext(); }
public boolean hasNext() throws RepositoryException { return wrappedIter.hasNext(); }
@Override public boolean hasNext() throws RepositoryException { return wrappedIter.hasNext(); }
@Override public boolean hasNext() { boolean hasMore = iteration.hasNext(); if (!hasMore) { Iterators.closeSilently(this); } return hasMore; }
@Override public boolean hasNext() { boolean hasMore = iteration.hasNext(); if (!hasMore) { Iterators.closeSilently(this); } return hasMore; }
@Override public boolean hasNext() { boolean hasMore = iteration.hasNext(); if (!hasMore) { Iterators.closeSilently(this); } return hasMore; }
private void visitInsert(Resource insert) throws RDF4JException { Iteration<? extends Resource, QueryEvaluationException> groupIter = TripleSources.listResources( insert, store); while (groupIter.hasNext()) { Resource r = groupIter.next(); Value type = TripleSources.singleValue(r, RDF.TYPE, store); visitPattern(r, (type != null) ? Collections.singleton((IRI)type) : Collections.<IRI> emptySet(), null); } }
/** * Checks whether the source type iteration contains more elements. * * @return <tt>true</tt> if the source type iteration contains more elements, <tt>false</tt> otherwise. * @throws X */ @Override public boolean hasNext() throws X { if (isClosed()) { return false; } boolean result = iter.hasNext(); if (!result) { close(); } return result; }
/** * Checks whether the source type iteration contains more elements. * * @return <tt>true</tt> if the source type iteration contains more elements, <tt>false</tt> otherwise. * @throws X */ @Override public boolean hasNext() throws X { if (isClosed()) { return false; } boolean result = iter.hasNext(); if (!result) { close(); } return result; }
private void visitDelete(Resource delete) throws RDF4JException { Iteration<? extends Resource, QueryEvaluationException> groupIter = TripleSources.listResources( delete, store); while (groupIter.hasNext()) { Resource r = groupIter.next(); Value type = TripleSources.singleValue(r, RDF.TYPE, store); visitPattern(r, (type != null) ? Collections.singleton((IRI)type) : Collections.<IRI> emptySet(), null); } }
/** * Checks whether the source type iteration contains more elements. * * @return <tt>true</tt> if the source type iteration contains more elements, <tt>false</tt> otherwise. * @throws X */ @Override public boolean hasNext() throws X { if (isClosed()) { return false; } boolean result = iter.hasNext(); if (!result) { close(); } return result; }
/** * Checks whether the wrapped Iteration contains more elements, closing this Iteration when this is not * the case. * * @return <tt>true</tt> if the wrapped Iteration contains more elements, <tt>false</tt> otherwise. */ public boolean hasNext() throws X { if (isClosed()) { return false; } else if (Thread.currentThread().isInterrupted()) { close(); return false; } boolean result = wrappedIter.hasNext(); if (!result) { close(); } return result; }
/** * Calls the <tt>hasNext</tt> method of the underlying iteration. */ @Override public boolean hasNext() throws X { if (isClosed()) { return false; } Iteration<? extends E, ? extends X> resultIter = iter; if (resultIter == null) { // Underlying iterator has not yet been initialized synchronized (this) { resultIter = iter; if (resultIter == null) { resultIter = iter = createIteration(); } } } return resultIter.hasNext(); }
public <E extends Exception> void remove( Iteration<? extends Statement, E> statements, Resource... contexts) throws RepositoryException, E { OpenRDFUtil.verifyContextNotNull(contexts); JSONArray rows = new JSONArray(); while (statements.hasNext()) { append(rows, encodeJSON(statements.next(), null, contexts)); } prepareHttpRepoClient().deleteJSON(rows); }
private Order visitOrderBy(Resource orderby) throws RDF4JException { Order order = new Order(); Iteration<? extends Resource, QueryEvaluationException> iter = TripleSources.listResources(orderby, store); while (iter.hasNext()) { Resource r = iter.next(); OrderElem orderElem = visitOrderByCondition(r); order.addElement(orderElem); } return order; }
public <E extends Exception> void add( Iteration<? extends Statement, E> statementIter, Resource... contexts) throws RepositoryException, E { OpenRDFUtil.verifyContextNotNull(contexts); JSONArray rows = new JSONArray(); while (statementIter.hasNext()) { append(rows, encodeJSON(statementIter.next(), null, contexts)); } try { prepareHttpRepoClient().uploadJSON(rows); } catch (AGHttpException e) { throw new RepositoryException(e); } }
public <E extends Exception> void add( Iteration<? extends Statement, E> statementIter, JSONObject attributes, Resource... contexts) throws RepositoryException, E { OpenRDFUtil.verifyContextNotNull(contexts); JSONArray rows = new JSONArray(); while (statementIter.hasNext()) { append(rows, encodeJSON(statementIter.next(), attributes, contexts)); } try { prepareHttpRepoClient().uploadJSON(rows); } catch (AGHttpException e) { throw new RepositoryException(e); } }
private Projection visitResultVariables(Resource resultVars, Map<String, ProjectionElem> previousProjElems) throws RDF4JException { ProjectionElemList projElemList = new ProjectionElemList(); Iteration<? extends Resource, QueryEvaluationException> iter = TripleSources.listResources( resultVars, store); while (iter.hasNext()) { Resource r = iter.next(); ProjectionElem projElem = visitResultVariable(r, previousProjElems); projElemList.addElement(projElem); } Projection proj = new Projection(); proj.setProjectionElemList(projElemList); tupleRoot = proj; return proj; }
private Projection visitResultNodes(Resource resultNodes) throws RDF4JException { ProjectionElemList projElemList = new ProjectionElemList(); Iteration<? extends Resource, QueryEvaluationException> iter = TripleSources.listResources( resultNodes, store); while (iter.hasNext()) { Resource r = iter.next(); ProjectionElem projElem = visitResultNode(r); projElemList.addElement(projElem); } Projection proj = new Projection(); proj.setProjectionElemList(projElemList); tupleRoot = new DescribeOperator(proj); return proj; }
private TupleExpr visitHaving(Resource having) throws RDF4JException { UnaryTupleOperator op = (UnaryTupleOperator)group.getParentNode(); op.setArg(new Extension(group)); Iteration<? extends Resource, QueryEvaluationException> iter = TripleSources.listResources(having, store); while (iter.hasNext()) { Resource r = iter.next(); ValueExpr havingExpr = visitExpression(r); Filter filter = new Filter(op.getArg(), havingExpr); op.setArg(filter); op = filter; } return op; }