本文整理汇总了Java中org.eclipse.rdf4j.query.Dataset类的典型用法代码示例。如果您正苦于以下问题:Java Dataset类的具体用法?Java Dataset怎么用?Java Dataset使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Dataset类属于org.eclipse.rdf4j.query包,在下文中一共展示了Dataset类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:Merck,项目名称:Halyard,代码行数:20,代码来源:TimeAwareHBaseSail.java
示例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);
}
开发者ID:semagrow,项目名称:semagrow,代码行数:31,代码来源:SemagrowSailConnection.java
示例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);
}
开发者ID:semagrow,项目名称:semagrow,代码行数:22,代码来源:SemagrowSailConnection.java
示例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;
}
开发者ID:semagrow,项目名称:semagrow,代码行数:18,代码来源:CachedSourceSelector.java
示例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;
}
开发者ID:semagrow,项目名称:semagrow,代码行数:17,代码来源:SourceSelectorWithQueryTransform.java
示例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);
}
开发者ID:semagrow,项目名称:semagrow,代码行数:24,代码来源:SimpleQueryCompiler.java
示例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());
}
开发者ID:dice-group,项目名称:CostFed,代码行数:13,代码来源:NativeStoreConnectionExt.java
示例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);
}
};
}
开发者ID:Merck,项目名称:Halyard,代码行数:12,代码来源:MemoryStoreWithHalyardStrategy.java
示例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;
}
开发者ID:semagrow,项目名称:semagrow,代码行数:9,代码来源:AskSourceSelector.java
示例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();
}
}
开发者ID:semagrow,项目名称:semagrow,代码行数:38,代码来源:SemagrowSailConnection.java
示例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);
}
开发者ID:semagrow,项目名称:semagrow,代码行数:9,代码来源:SemagrowSailConnection.java
示例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);
}
}
开发者ID:semagrow,项目名称:semagrow,代码行数:14,代码来源:SemagrowSailConnection.java
示例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;
}
开发者ID:semagrow,项目名称:semagrow,代码行数:16,代码来源:SemagrowSailConnection.java
示例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);
}
}
开发者ID:semagrow,项目名称:semagrow,代码行数:31,代码来源:SemagrowSailBooleanQuery.java
示例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());
}
开发者ID:semagrow,项目名称:semagrow,代码行数:14,代码来源:SemagrowSailQuery.java
示例16: getSources
import org.eclipse.rdf4j.query.Dataset; //导入依赖的package包/类
@Loggable
public Collection<SourceMetadata> getSources(StatementPattern pattern, Dataset dataset, BindingSet bindings) {
if (!pattern.getSubjectVar().hasValue() &&
!pattern.getPredicateVar().hasValue() &&
!pattern.getObjectVar().hasValue())
return new LinkedList<SourceMetadata>(uritoSourceMetadata(pattern, getEndpoints()));
else
return new LinkedList<SourceMetadata>(datasetsToSourceMetadata(pattern, getDatasets(pattern)));
}
开发者ID:semagrow,项目名称:semagrow,代码行数:11,代码来源:VOIDSourceSelector.java
示例17: getSources
import org.eclipse.rdf4j.query.Dataset; //导入依赖的package包/类
public Collection<SourceMetadata> getSources(TupleExpr expr, Dataset dataset, BindingSet bindingSet) {
if (expr instanceof StatementPattern)
return getSources((StatementPattern)expr, dataset, bindingSet);
else {
Collection<StatementPattern> patterns = StatementPatternCollector.process(expr);
return patterns.stream().distinct()
.flatMap(p -> getSources(p, dataset, bindingSet).stream())
.collect(Collectors.toList());
}
}
开发者ID:semagrow,项目名称:semagrow,代码行数:11,代码来源:PatternWiseSourceSelector.java
示例18: getSources
import org.eclipse.rdf4j.query.Dataset; //导入依赖的package包/类
@Override
public Collection<SourceMetadata> getSources(StatementPattern pattern, Dataset dataset, BindingSet bindings) {
if (map.containsKey(pattern))
return map.get(pattern);
else
return Collections.emptyList();
}
开发者ID:semagrow,项目名称:semagrow,代码行数:8,代码来源:StaticSourceSelector.java
示例19: decompose
import org.eclipse.rdf4j.query.Dataset; //导入依赖的package包/类
@Override
public void decompose(TupleExpr expr, Dataset dataset, BindingSet bindings) {
/* creates the context of operation of the decomposer.
* Specifically, collects FILTER statements */
QueryGraphDecomposerContext ctx = new QueryGraphDecomposerContext( expr );
SourceSelector staticSelector = new StaticSourceSelector(sourceSelector.getSources(expr, dataset, bindings));
PlanFactory planFactory = new SimplePlanFactory(costEstimator, cardinalityEstimator);
/* uses the SourceSelector provided in order to identify the
* sub-expressions that can be executed at each data source,
* and annotates with cardinality and selectivity metadata */
PlanGenerator planGenerator = new QueryGraphPlanGenerator(ctx, staticSelector, planFactory);
/* optimizes the plans generated by the PlanGenerator */
DPPlanOptimizer planOptimizer = new DPPlanOptimizer(planGenerator);
/* selects the optimal plan */
Optional<Plan> maybePlan = planOptimizer.getBestPlan(ctx.getQueryGraph().getVertices(), bindings, dataset);
if (maybePlan.isPresent()) {
/* grafts the optimal plan into expr */
if (expr instanceof QueryRoot) {
((QueryRoot)expr).getArg().replaceWith(maybePlan.get());
}
}
}
开发者ID:semagrow,项目名称:semagrow,代码行数:30,代码来源:QueryGraphDecomposer.java
示例20: compile
import org.eclipse.rdf4j.query.Dataset; //导入依赖的package包/类
@Override
public Plan compile(QueryRoot query, Dataset dataset, BindingSet bindings) {
// transformations on logical query.
rewrite(query.getArg(), dataset, bindings);
// split query to queryblocks.
QueryBlock blockRoot = blockify(query, dataset, bindings);
// infer interesting properties for each query block.
blockRoot.visit(new InterestingPropertiesVisitor()); // infer interesting properties for each block
// traverse Blocks and compile them bottom-up.
Collection<Plan> plans = blockRoot.getPlans(getContext());
// enforce Site = Local
RequestedPlanProperties props = new RequestedPlanProperties();
props.setSite(LocalSite.getInstance());
plans = getContext().enforceProps(plans, props);
getContext().prune(plans);
if (plans.isEmpty())
return null;
else
return plans.iterator().next();
}
开发者ID:semagrow,项目名称:semagrow,代码行数:28,代码来源:SimpleQueryCompiler.java
注:本文中的org.eclipse.rdf4j.query.Dataset类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论