本文整理汇总了Java中org.openrdf.query.Dataset类的典型用法代码示例。如果您正苦于以下问题:Java Dataset类的具体用法?Java Dataset怎么用?Java Dataset使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Dataset类属于org.openrdf.query包,在下文中一共展示了Dataset类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: optimize
import org.openrdf.query.Dataset; //导入依赖的package包/类
/**
* This method optimizes a specified query by matching subsets of it with
* PCJ queries.
*
* @param tupleExpr - the query to be optimized
* @param dataset - this value is ignored
* @param bindings - this value is ignored
*/
@Override
public void optimize(TupleExpr tupleExpr, final Dataset dataset, final BindingSet bindings) {
checkNotNull(tupleExpr);
// first standardize query by pulling all filters to top of query if
// they exist using TopOfQueryFilterRelocator
tupleExpr = TopOfQueryFilterRelocator.moveFiltersToTop(tupleExpr);
try {
if (provider.size() > 0) {
super.optimize(tupleExpr, null, null);
} else {
return;
}
} catch (final Exception e) {
throw new RuntimeException("Could not populate Index Cache.", e);
}
}
示例2: evaluate
import org.openrdf.query.Dataset; //导入依赖的package包/类
static CloseableIteration<BindingSet, QueryEvaluationException> evaluate(
final TripleTransaction transaction, final TupleExpr expr,
@Nullable final Dataset dataset, @Nullable final BindingSet bindings,
@Nullable final Long timeout) throws QueryEvaluationException {
Preconditions.checkNotNull(transaction);
final AtomicBoolean delegate = new AtomicBoolean(false);
expr.visit(new QueryModelVisitorBase<RuntimeException>() {
@Override
public void meet(final StatementPattern node) throws RuntimeException {
delegate.set(true);
}
});
final EvaluationStrategy strategy = delegate.get() ? new DelegatingEvaluationStrategy(
transaction, dataset, timeout, false) : new LocalEvaluationStrategy(transaction,
dataset, timeout);
return strategy
.evaluate(expr, bindings != null ? bindings : EmptyBindingSet.getInstance());
}
示例3: from
import org.openrdf.query.Dataset; //导入依赖的package包/类
/**
* Returns an <tt>SelectQuery</tt> for the algebraic expression and optional dataset
* specified.
*
* @param expression
* the algebraic expression for the query
* @param dataset
* the dataset optionally associated to the query
* @return the corresponding <tt>SelectQuery</tt> object
* @throws ParseException
* in case the supplied algebraic expression does not denote a valid SPARQL SELECT
* query
*/
public static SelectQuery from(final TupleExpr expression, @Nullable final Dataset dataset)
throws ParseException {
Preconditions.checkNotNull(expression);
try {
// Sesame rendering facilities are definitely broken, so we use our own
final String string = new SPARQLRenderer(null, true).render(expression, dataset);
SelectQuery query = CACHE.getIfPresent(string);
if (query == null) {
query = new SelectQuery(string, expression, dataset);
CACHE.put(string, query);
}
return query;
} catch (final Exception ex) {
throw new ParseException(expression.toString(),
"The supplied algebraic expression does not denote a valid SPARQL query", ex);
}
}
示例4: optimize
import org.openrdf.query.Dataset; //导入依赖的package包/类
@Override
public void optimize(TupleExpr query, Dataset dataset, BindingSet bindings) { // Sesame 2
// collect all basic graph patterns
for (TupleExpr bgp : BasicGraphPatternExtractor.process(query)) {
// // a single statement pattern needs no optimization
// // TODO: need sources first
// if (bgp instanceof StatementPattern)
// continue;
if (LOGGER.isTraceEnabled())
LOGGER.trace("BGP before optimization:\n" + AnnotatingTreePrinter.print(bgp));
bgp = optimizeBGP(bgp);
if (LOGGER.isTraceEnabled() && modelEvaluator != null)
LOGGER.trace("BGP after optimization:\n" + AnnotatingTreePrinter.print(bgp, modelEvaluator));
}
}
示例5: evaluateInternal
import org.openrdf.query.Dataset; //导入依赖的package包/类
@Override
protected CloseableIteration<BindingSet, QueryEvaluationException> evaluateInternal(
TupleExpr expr, Dataset dataset, BindingSet bindings, boolean includeInferred)
throws SailException {
triples.flush();
try {
TupleExpr tupleExpr;
EvaluationStrategy strategy;
strategy = factory.createRdbmsEvaluation(dataset);
tupleExpr = optimizer.optimize(expr, dataset, bindings, strategy);
// Mexri edw to GeneralDBSqlDiffDateTime ftanei kanonika
return strategy.evaluate(tupleExpr, EmptyBindingSet.getInstance());
} catch (QueryEvaluationException e) {
throw new SailException(e);
}
}
示例6: evaluate
import org.openrdf.query.Dataset; //导入依赖的package包/类
@Override
public CloseableIteration<? extends BindingSet, QueryEvaluationException> evaluate(
TupleExpr tupleExpr, Dataset dataset, BindingSet bindings,
boolean includeInferred) throws SailException {
try {
IdentifiersOrgTripleSource tripleSource = new IdentifiersOrgTripleSource(vf, dao);
EvaluationStrategy strategy = new EvaluationStrategyImpl(tripleSource);
tupleExpr = tupleExpr.clone();
new BindingAssigner().optimize(tupleExpr, dataset, bindings);
new FilterOptimizer().optimize(tupleExpr, dataset, bindings);
return strategy.evaluate(tupleExpr, EmptyBindingSet.getInstance());
} catch (QueryEvaluationException e) {
throw new SailException(e);
}
}
示例7: SQLSubQuery
import org.openrdf.query.Dataset; //导入依赖的package包/类
public SQLSubQuery(String alias, Projection query, BindingSet bindings, Dataset dataset, ValueConverter converter, KiWiDialect dialect, Set<String> parentProjectedVars) throws UnsatisfiableQueryException {
super(alias);
Set<String> projectedVars = new HashSet<>(parentProjectedVars);
// count projected variables
for(ProjectionElem elem : query.getProjectionElemList().getElements()) {
projectedVars.add(elem.getSourceName());
}
// we build a full subquery for each of the UNION's arguments
builder = new SQLBuilder(query.getArg(), bindings, dataset, converter, dialect, projectedVars);
for(SQLVariable svl : builder.getVariables().values()) {
if(projectedVars.contains(svl.getSparqlName())) {
variables.add(svl);
}
}
}
示例8: ParallelEvaluationStrategyImpl
import org.openrdf.query.Dataset; //导入依赖的package包/类
public ParallelEvaluationStrategyImpl(StoreTripleSource tripleSource, InferenceEngine inferenceEngine,
Dataset dataset, RdfCloudTripleStoreConfiguration conf) {
super(tripleSource, dataset);
Integer nthreads = conf.getNumThreads();
this.numOfThreads = (nthreads != null) ? nthreads : this.numOfThreads;
Boolean val = conf.isPerformant();
this.performant = (val != null) ? val : this.performant;
val = conf.isDisplayQueryPlan();
this.displayQueryPlan = (val != null) ? val : this.displayQueryPlan;
this.executorService = Executors.newFixedThreadPool(this.numOfThreads);
this.inferenceEngine = inferenceEngine;
}
示例9: optimize
import org.openrdf.query.Dataset; //导入依赖的package包/类
@Override
public void optimize(TupleExpr tupleExpr, Dataset dataset, BindingSet bindings) {
SparqlToPipelineTransformVisitor pipelineVisitor = new SparqlToPipelineTransformVisitor(conf);
try {
tupleExpr.visit(pipelineVisitor);
} catch (Exception e) {
logger.error("Error attempting to transform query using the aggregation pipeline", e);
}
}
示例10: optimize
import org.openrdf.query.Dataset; //导入依赖的package包/类
@Override
public void optimize(TupleExpr tupleExpr, final Dataset dataset, final BindingSet bindings) {
checkNotNull(tupleExpr);
checkNotNull(indexer);
// first standardize query by pulling all filters to top of query if
// they exist using TopOfQueryFilterRelocator
tupleExpr = TopOfQueryFilterRelocator.moveFiltersToTop(tupleExpr);
super.optimize(tupleExpr, null, null);
}
示例11: optimize
import org.openrdf.query.Dataset; //导入依赖的package包/类
@Override
public void optimize(final TupleExpr tupleExpr, final Dataset dataset, final BindingSet bindings) {
// find variables used in property and resource based searches:
final SearchVarVisitor searchVars = new SearchVarVisitor();
tupleExpr.visit(searchVars);
// rewrites for property searches:
processPropertySearches(tupleExpr, searchVars.searchProperties);
}
示例12: optimize
import org.openrdf.query.Dataset; //导入依赖的package包/类
@Override
public void optimize(TupleExpr tupleExpr, Dataset dataset, BindingSet bindings) {
if(!init) {
throw new IllegalStateException("Optimizer has not been properly initialized. Configuration must be set to initialize this class.");
}
super.optimize(tupleExpr, dataset, bindings);
}
示例13: optimize
import org.openrdf.query.Dataset; //导入依赖的package包/类
@Override
public void optimize(final TupleExpr tupleExpr, final Dataset dataset, final BindingSet bindings) {
// find variables used in property and resource based searches:
final SearchVarVisitor searchVars = new SearchVarVisitor();
tupleExpr.visit(searchVars);
// rewrites for property searches:
processPropertySearches(tupleExpr, searchVars.searchProperties);
}
示例14: DelegatingEvaluationStrategy
import org.openrdf.query.Dataset; //导入依赖的package包/类
public DelegatingEvaluationStrategy(final TripleTransaction transaction,
final Dataset dataset, @Nullable final Long timeout, final boolean skolemize) {
super(null, dataset, null);
this.transaction = transaction;
this.timeout = timeout;
this.skolemize = skolemize;
}
示例15: replaceDataset
import org.openrdf.query.Dataset; //导入依赖的package包/类
/**
* Replaces the dataset of this query with the one specified, returning the resulting
* <tt>SelectQuery</tt> object.
*
* @param dataset
* the new dataset; as usual, <tt>null</tt> denotes the default dataset (all the
* graphs)
* @return the resulting <tt>SelectQuery</tt> object (possibly <tt>this</tt> if no change is
* required)
*/
public SelectQuery replaceDataset(@Nullable final Dataset dataset) {
if (Objects.equal(this.dataset, dataset)) {
return this;
} else {
try {
return from(this.expression, dataset);
} catch (final ParseException ex) {
throw new Error("Unexpected error - replacing dataset made the query invalid (!)",
ex);
}
}
}