本文整理汇总了Java中info.aduna.iteration.EmptyIteration类的典型用法代码示例。如果您正苦于以下问题:Java EmptyIteration类的具体用法?Java EmptyIteration怎么用?Java EmptyIteration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EmptyIteration类属于info.aduna.iteration包,在下文中一共展示了EmptyIteration类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: evaluate
import info.aduna.iteration.EmptyIteration; //导入依赖的package包/类
/**
* This method pairs each {@link BindingSet} in the specified collection
* with the StatementPattern constraints and issues a query to Rya using the
* {@link RyaQueryEngine}.
*/
@Override
public CloseableIteration<BindingSet, QueryEvaluationException> evaluate(Collection<BindingSet> bindingset)
throws QueryEvaluationException {
if (bindingset.size() == 0) {
return new EmptyIteration<>();
}
queryEngine = RyaQueryEngineFactory.getQueryEngine(conf);
Set<Map.Entry<RyaStatement, BindingSet>> statements = new HashSet<>();
Iterator<BindingSet> iter = bindingset.iterator();
while (iter.hasNext()) {
BindingSet bs = iter.next();
statements.add(new RdfCloudTripleStoreUtils.CustomEntry<RyaStatement, BindingSet>(
getRyaStatementFromBindings(bs), bs));
}
final CloseableIteration<? extends Entry<RyaStatement, BindingSet>, RyaDAOException> iteration;
try {
iteration = queryEngine.queryWithBindingSet(statements, conf);
} catch (RyaDAOException e) {
throw new RuntimeException(e);
}
return new PropertyFilterAndBindingSetJoinIteration(iteration, properties, statement);
}
开发者ID:apache,项目名称:incubator-rya,代码行数:31,代码来源:StatementMetadataNode.java
示例2: listVersionsInternal
import info.aduna.iteration.EmptyIteration; //导入依赖的package包/类
/**
* List all versions in the database affecting the given resource as subject; operates directly on the result set,
* i.e. the iteration is carried out lazily and needs to be closed when iteration is completed.
*
* @return
* @throws SQLException
*/
private CloseableIteration<Version, SQLException> listVersionsInternal(KiWiResource r) throws SQLException {
if(r.getId() < 0) {
return new EmptyIteration<Version, SQLException>();
} else {
requireJDBCConnection();
PreparedStatement queryVersions = getPreparedStatement("load.versions_by_resource");
queryVersions.setLong(1,r.getId());
final ResultSet result = queryVersions.executeQuery();
return new ResultSetIteration<Version>(result, new ResultTransformerFunction<Version>() {
@Override
public Version apply(ResultSet row) throws SQLException {
return constructVersionFromDatabase(result);
}
});
}
}
开发者ID:apache,项目名称:marmotta,代码行数:27,代码来源:KiWiVersioningConnection.java
示例3: getStatements
import info.aduna.iteration.EmptyIteration; //导入依赖的package包/类
@Override
public CloseableIteration<StatementImpl, QueryEvaluationException> getStatements(
Resource subj, URI pred, Value obj, Resource... contexts)
throws QueryEvaluationException {
if (!pred.equals(OWL.SAMEAS))
return new EmptyIteration<StatementImpl, QueryEvaluationException>();
if (subj == null && obj == null)
return new EmptyIteration<StatementImpl, QueryEvaluationException>();
final Iterator<StatementImpl> iter = getIterViaJDBC(subj, obj, contexts);
return new CloseableIteration<StatementImpl, QueryEvaluationException>() {
@Override
public boolean hasNext() throws QueryEvaluationException {
return iter.hasNext();
}
@Override
public StatementImpl next() throws QueryEvaluationException {
return iter.next();
}
@Override
public void remove() throws QueryEvaluationException {
iter.remove();
}
@Override
public void close() throws QueryEvaluationException {
// TODO Auto-generated method stub
}
};
}
开发者ID:JervenBolleman,项目名称:sparql-identifiers,代码行数:34,代码来源:IdentifiersOrgTripleSource.java
示例4: getStatements
import info.aduna.iteration.EmptyIteration; //导入依赖的package包/类
@Override
public CloseableIteration<? extends Statement, QueryEvaluationException> getStatements(
Resource subj, IRI pred, Value obj, Resource... contexts)
throws QueryEvaluationException {
if (pred == null || possiblePredicates.contains(pred)) {
return new BEDFileFilterReader(file, subj, pred, obj, contexts,
getValueFactory());
} else
return new EmptyIteration<Statement, QueryEvaluationException>();
}
开发者ID:JervenBolleman,项目名称:sparql-bed,代码行数:11,代码来源:BEDTripleSource.java
示例5: sendSparqlQuery
import info.aduna.iteration.EmptyIteration; //导入依赖的package包/类
private CloseableIteration<BindingSet, QueryEvaluationException> sendSparqlQuery(TupleExpr expr, Set<Graph> sources, BindingSet bindings) {
// check if there are any sources to query
if (sources.size() == 0) {
LOGGER.warn("Cannot find any source for: " + OperatorTreePrinter.print(expr));
return new EmptyIteration<BindingSet, QueryEvaluationException>();
}
// if (expr instanceof StatementPattern)
// LOGGER.error("is statement pattern");
// TODO: need to know actual projection and join variables to reduce transmitted data
CloseableIteration<BindingSet, QueryEvaluationException> cursor;
List<CloseableIteration<BindingSet, QueryEvaluationException>> cursors = new ArrayList<CloseableIteration<BindingSet, QueryEvaluationException>>(sources.size());
final String query = "SELECT REDUCED * WHERE {" + SparqlPrinter.print(expr) + "}";
if (LOGGER.isDebugEnabled())
LOGGER.debug("Sending SPARQL query to '" + sources + " with bindings " + bindings + "\n" + query);
for (final Graph rep : sources) {
if (MULTI_THREADED)
cursors.add(getMultiThread(rep, query, bindings));
else
cursors.add(QueryExecutor.eval(rep.toString(), query, bindings));
}
// create union if multiple sources are involved
if (cursors.size() > 1) {
// cursor = new UnionCursor<BindingSet>(cursors);
cursor = new UnionIteration<BindingSet, QueryEvaluationException>(cursors);
} else {
cursor = cursors.get(0);
}
// Filter any duplicates
// cursor = new DistinctCursor<BindingSet>(cursor);
// TODO: check if this is bad for performance
cursor = new DistinctIteration<BindingSet, QueryEvaluationException>(cursor);
return cursor;
}
开发者ID:goerlitz,项目名称:rdffederator,代码行数:45,代码来源:FederationEvalStrategy.java
示例6: getNamespaces
import info.aduna.iteration.EmptyIteration; //导入依赖的package包/类
@Override
public RepositoryResult<Namespace> getNamespaces() throws RepositoryException
{
return new RepositoryResult<Namespace>(new EmptyIteration<Namespace, RepositoryException>());
}
开发者ID:obidea,项目名称:semantika-endpoint,代码行数:6,代码来源:SemantikaRepositoryConnection.java
示例7: listTriplesInternalSnapshot
import info.aduna.iteration.EmptyIteration; //导入依赖的package包/类
/**
* Internal implementation for actually carrying out the query. Returns a closable iteration that can be used
* in a repository result. The iteration is forward-only and does not allow removing result rows.
*
* @param subject the subject to query for, or null for a wildcard query
* @param predicate the predicate to query for, or null for a wildcard query
* @param object the object to query for, or null for a wildcard query
* @param context the context to query for, or null for a wildcard query
* @param inferred if true, the result will also contain triples inferred by the reasoner, if false not
* @return a ClosableIteration that wraps the database ResultSet; needs to be closed explicitly by the caller
* @throws SQLException
*/
private CloseableIteration<Statement, SQLException> listTriplesInternalSnapshot(KiWiResource subject, KiWiUriResource predicate, KiWiNode object, KiWiResource context, boolean inferred, Date snapshotDate) throws SQLException {
// if one of the database ids is null, there will not be any database results, so we can return an empty result
if(subject != null && subject.getId() < 0) {
return new EmptyIteration<Statement, SQLException>();
}
if(predicate != null && predicate.getId() < 0) {
return new EmptyIteration<Statement, SQLException>();
}
if(object != null && object.getId() < 0) {
return new EmptyIteration<Statement, SQLException>();
}
if(context != null && context.getId() < 0) {
return new EmptyIteration<Statement, SQLException>();
}
requireJDBCConnection();
// otherwise we need to create an appropriate SQL query and execute it, the repository result will be read-only
// and only allow forward iteration, so we can limit the query using the respective flags
PreparedStatement query = connection.prepareStatement(
constructTripleQuerySnapshot(subject, predicate, object, context, inferred, snapshotDate),
ResultSet.TYPE_FORWARD_ONLY,
ResultSet.CONCUR_READ_ONLY
);
query.clearParameters();
// set query parameters
query.setTimestamp(1, new Timestamp(snapshotDate.getTime()));
query.setTimestamp(2, new Timestamp(snapshotDate.getTime()));
int position = 3;
if(subject != null) {
query.setLong(position++, subject.getId());
}
if(predicate != null) {
query.setLong(position++, predicate.getId());
}
if(object != null) {
query.setLong(position++, object.getId());
}
if(context != null) {
query.setLong(position++, context.getId());
}
final ResultSet result = query.executeQuery();
return new ResultSetIteration<Statement>(result, true, new ResultTransformerFunction<Statement>() {
@Override
public Statement apply(ResultSet row) throws SQLException {
return constructTripleFromDatabase(result);
}
});
}
开发者ID:apache,项目名称:marmotta,代码行数:67,代码来源:KiWiVersioningConnection.java
示例8: getContextIDs
import info.aduna.iteration.EmptyIteration; //导入依赖的package包/类
@Override
public CloseableIteration<? extends Resource, SailException> getContextIDs()
throws SailException {
return new EmptyIteration<Resource, SailException>();
}
开发者ID:JervenBolleman,项目名称:sparql-bed,代码行数:6,代码来源:BEDConnection.java
注:本文中的info.aduna.iteration.EmptyIteration类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论