本文整理汇总了Java中org.eclipse.rdf4j.query.Dataset类的典型用法代码示例。如果您正苦于以下问题:Java Dataset类的具体用法?Java Dataset怎么用?Java Dataset使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Dataset类属于org.eclipse.rdf4j.query包,在下文中一共展示了Dataset类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: evaluate
import org.eclipse.rdf4j.query.Dataset; //导入依赖的package包/类
@Override
public CloseableIteration<? extends BindingSet, QueryEvaluationException> evaluate(TupleExpr tupleExpr, Dataset dataset, BindingSet bindings, boolean includeInferred) throws SailException {
Binding b = bindings.getBinding(TIMESTAMP_CALLBACK_BINDING_NAME);
final TimestampCallbackBinding timestampBinding = (b instanceof TimestampCallbackBinding) ? (TimestampCallbackBinding) b : null;
CloseableIteration<? extends BindingSet, QueryEvaluationException> iter = super.evaluate(tupleExpr, dataset, bindings, includeInferred);
//push back the actual timestamp binding to the callback binding if requested
if (timestampBinding != null) {
iter = new FilterIteration<BindingSet, QueryEvaluationException>(iter) {
@Override
protected boolean accept(BindingSet bindings) throws QueryEvaluationException {
Binding b = bindings.getBinding(TIMESTAMP_BINDING_NAME);
//push back actual time if the timestamp binding is not provided
timestampBinding.v = b == null ? SimpleValueFactory.getInstance().createLiteral(System.currentTimeMillis()) : b.getValue();
return true;
}
};
}
return iter;
}
示例2: evaluateInternal
import org.eclipse.rdf4j.query.Dataset; //导入依赖的package包/类
/**
* Evaluates a query represented as TupleExpr
* @param tupleExpr the tuple expression to evaluate
* @param dataset
* @param bindings
* @param b include inferred
* @param p include provenance
* @return the resultset as a closable iteration
* @throws SailException
*/
protected CloseableIteration<? extends BindingSet, QueryEvaluationException>
evaluateInternal(TupleExpr tupleExpr,
Dataset dataset,
BindingSet bindings,
boolean b, boolean p,
Collection<IRI> includeOnlySources,
Collection<IRI> excludeSources)
throws SailException {
logger.debug("Starting decomposition of " + tupleExpr.toString());
TupleExpr decomposed = null;
decomposed = decompose(tupleExpr, dataset, bindings, includeOnlySources, excludeSources);
logger.debug("Query decomposed to " + decomposed.toString());
logger.info("Decomposed query: " + decomposed.toString());
throw new SailException("Closeableiteration is not implemented. Please use the queryhandler");
//return evaluateOnly(decomposed, dataset, bindings, b, p);
}
示例3: evaluateInternalReactive
import org.eclipse.rdf4j.query.Dataset; //导入依赖的package包/类
protected Publisher<? extends BindingSet>
evaluateInternalReactive(TupleExpr tupleExpr,
Dataset dataset,
BindingSet bindings,
boolean b, boolean p,
Collection<IRI> includeOnlySources,
Collection<IRI> excludeSources)
throws SailException
{
long start_time = System.currentTimeMillis();
logger.debug("Starting decomposition of " + tupleExpr.toString());
TupleExpr decomposed = null;
decomposed = decompose(tupleExpr, dataset, bindings, includeOnlySources, excludeSources);
long end_time = System.currentTimeMillis();
logger.debug("Decomposition duration = " + (end_time - start_time));
logger.debug("Query decomposed to " + decomposed.toString());
return evaluateOnlyReactive(decomposed, dataset, bindings, b, p);
}
示例4: getSources
import org.eclipse.rdf4j.query.Dataset; //导入依赖的package包/类
@Override
@Loggable
public Collection<SourceMetadata> getSources(StatementPattern pattern, Dataset dataset, BindingSet bindings)
{
Collection<SourceMetadata> retv;
if( cache.containsKey(pattern) ) {
retv = cache.get(pattern);
}
else {
Collection<SourceMetadata> list = super.getSources(pattern, dataset, bindings);
cache.put(pattern, list);
retv = list;
}
return retv;
}
示例5: getSources
import org.eclipse.rdf4j.query.Dataset; //导入依赖的package包/类
@Override
public Collection<SourceMetadata> getSources(StatementPattern pattern, Dataset dataset, BindingSet bindings) {
Collection<SourceMetadata> lst = super.getSources(pattern, dataset, bindings);
Collection<FuzzyEntry<StatementPattern>> transformed = transformPattern(pattern);
for (FuzzyEntry<StatementPattern> fep : transformed) {
Collection<SourceMetadata> lt = super.getSources(fep.getElem(), dataset, bindings);
for (SourceMetadata m : lt) {
lst.add(new FuzzySourceMetadata(pattern, m, fep));
}
}
return lst;
}
示例6: rewrite
import org.eclipse.rdf4j.query.Dataset; //导入依赖的package包/类
/**
* Rewrites the logical expression into a logically-equivalent simpler ``canonical'' expression.
* @param expr The expression subject to transformation. It will be substituted by the equivalent expression
* and therefore must have a parent.
* @param dataset
* @param bindings possible bindings for some of the variables in the expression.
*/
protected void rewrite(TupleExpr expr, Dataset dataset, BindingSet bindings) {
assert expr.getParentNode() != null;
QueryOptimizer queryOptimizer = new QueryOptimizerList(
new BindingAssigner(), // substitute variables with constants if in the given bindingset
new CompareOptimizer(), // substitute Compare with SameTerm if possible
new SameTermFilterOptimizer(), // rename variables or replace with constants if filtered with SameTerm
new ConjunctiveConstraintSplitter(), // splits Filters And to consecutive applications
new DisjunctiveConstraintOptimizer(), // split Filters Or to Union
new FilterOptimizer(), // push Filters as deep as possible
new QueryModelNormalizer() // remove emptysets, singletonsets, transform to DNF (union before joins)
);
queryOptimizer.optimize(expr, dataset, bindings);
}
示例7: evaluatePrecompiledInternal
import org.eclipse.rdf4j.query.Dataset; //导入依赖的package包/类
protected CloseableIteration<? extends BindingSet, QueryEvaluationException> evaluatePrecompiledInternal(
TupleExpr tupleExpr, Dataset dataset, BindingSet bindings, boolean includeInferred) {
/*
replaceValues(tupleExpr);
*/
TripleSource tripleSource = null;
//new RepositoryTripleSource(nativeStore, includeInferred, transactionActive());
StrictEvaluationStrategy strategy = new StrictEvaluationStrategy(tripleSource, dataset, null);
return strategy.evaluate(tupleExpr, EmptyBindingSet.getInstance());
}
示例8: getConnectionInternal
import org.eclipse.rdf4j.query.Dataset; //导入依赖的package包/类
@Override
protected NotifyingSailConnection getConnectionInternal() throws SailException {
return new MemoryStoreConnection(this) {
@Override
protected EvaluationStrategy getEvaluationStrategy(Dataset dataset, TripleSource tripleSource) {
return new HalyardEvaluationStrategy(tripleSource, dataset, null, -1);
}
};
}
示例9: getSources
import org.eclipse.rdf4j.query.Dataset; //导入依赖的package包/类
private Collection<SourceMetadata> getSources( Iterable<StatementPattern> patterns, Dataset dataset, BindingSet bindings )
{
Collection<SourceMetadata> list = new LinkedList<SourceMetadata>();
for( StatementPattern p : patterns ) {
list.addAll( this.getSources(p, dataset, bindings) );
}
return list;
}
示例10: evaluate
import org.eclipse.rdf4j.query.Dataset; //导入依赖的package包/类
public final CloseableIteration<? extends BindingSet, QueryEvaluationException> evaluate(
TupleExpr tupleExpr, Dataset dataset, BindingSet bindings,
boolean includeInferred, boolean includeProvenance,
Collection<IRI> includeOnlySources, Collection<IRI> excludeSources)
throws SailException
{
//FIXME: flushPendingUpdates();
connectionLock.readLock().lock();
try {
verifyIsOpen();
boolean registered = false;
CloseableIteration<? extends BindingSet, QueryEvaluationException> iteration =
evaluateInternal(tupleExpr, dataset, bindings,
includeInferred, includeProvenance,
includeOnlySources, excludeSources);
try {
CloseableIteration<? extends BindingSet, QueryEvaluationException> registeredIteration =
registerIteration(iteration);
registered = true;
return registeredIteration;
}
finally {
if (!registered) {
try {
iteration.close();
}
catch (QueryEvaluationException e) {
throw new SailException(e);
}
}
}
}
finally {
connectionLock.readLock().unlock();
}
}
示例11: evaluateReactive
import org.eclipse.rdf4j.query.Dataset; //导入依赖的package包/类
public Publisher<? extends BindingSet>
evaluateReactive(TupleExpr tupleExpr, Dataset dataset, BindingSet bindings, boolean b, boolean p,
Collection<IRI> includeOnlySources,
Collection<IRI> excludeSources)
throws SailException
{
return evaluateInternalReactive(tupleExpr, dataset, bindings, b, p, includeOnlySources, excludeSources);
}
示例12: evaluateOnlyReactive
import org.eclipse.rdf4j.query.Dataset; //导入依赖的package包/类
public Publisher<? extends BindingSet>
evaluateOnlyReactive(TupleExpr expr, Dataset dataset, BindingSet bindings, boolean b, boolean p)
throws SailException
{
try {
//QueryExecutorImpl executor = new QueryExecutorImpl();
FederatedEvaluationStrategyImpl strategy = new FederatedEvaluationStrategyImpl(SemagrowValueFactory.getInstance());
strategy.setBatchSize(semagrowSail.getBatchSize());
return strategy.evaluate(expr, bindings);
} catch(QueryEvaluationException e) {
throw new SailException(e);
}
}
示例13: decompose
import org.eclipse.rdf4j.query.Dataset; //导入依赖的package包/类
public Plan decompose(TupleExpr tupleExpr, Dataset dataset, BindingSet bindings,
Collection<IRI> includeOnlySources, Collection<IRI> excludeSources)
{
QueryOptimizer optimizer = semagrowSail.getOptimizer();
optimizer.optimize(tupleExpr, dataset, bindings);
QueryCompiler decomposer = semagrowSail.getCompiler(includeOnlySources, excludeSources);
// TupleExpr used here must have been instantiated by the
// SemagrowSailQuery constructor and be QueryRoot
assert tupleExpr instanceof QueryRoot;
Plan p = decomposer.compile((QueryRoot)tupleExpr, dataset, bindings);
return p;
}
示例14: evaluate
import org.eclipse.rdf4j.query.Dataset; //导入依赖的package包/类
public boolean evaluate() throws QueryEvaluationException {
ParsedBooleanQuery parsedBooleanQuery = getParsedQuery();
TupleExpr tupleExpr = parsedBooleanQuery.getTupleExpr();
Dataset dataset = getDataset();
if (dataset == null) {
// No external dataset specified, use query's own dataset (if any)
dataset = parsedBooleanQuery.getDataset();
}
try {
SemagrowSailConnection sailCon = (SemagrowSailConnection) getConnection().getSailConnection();
CloseableIteration<? extends BindingSet, QueryEvaluationException> bindingsIter;
bindingsIter = sailCon.evaluate(tupleExpr, dataset, getBindings(), getIncludeInferred(), false,
getIncludedSources(), getExcludedSources());
bindingsIter = enforceMaxQueryTime(bindingsIter);
try {
return bindingsIter.hasNext();
}
finally {
bindingsIter.close();
}
}
catch (SailException e) {
throw new QueryEvaluationException(e.getMessage(), e);
}
}
示例15: getDecomposedQuery
import org.eclipse.rdf4j.query.Dataset; //导入依赖的package包/类
public TupleExpr getDecomposedQuery() {
SemagrowSailConnection conn = (SemagrowSailConnection) getConnection().getSailConnection();
TupleExpr initialExpr = getParsedQuery().getTupleExpr();
TupleExpr expr = initialExpr.clone();
Dataset dataset = getDataset();
if (dataset == null) {
// No external dataset specified, use query's own dataset (if any)
dataset = getParsedQuery().getDataset();
}
return conn.decompose(expr, dataset, getBindings(), getIncludedSources(), getExcludedSources());
}