Interface QueryableData
- All Known Subinterfaces:
CSVCopyable, DatalogDelegable, DataSource<NativeQueryType, NativeResultType>, FactBase, MaterializedData, MaterializedDataCollection<T>, MaterializedWritableDataCollection<Q,W>, QueryableDataCollection<T>, QueryableWritableDataCollection<Q, W>
- All Known Implementing Classes:
AbstractDataSource, DefaultInMemoryAtomSet, FactBaseDelAtomsWrapper, FederatedFactBase, LightInMemoryGraphStore, MongoDBDataSource, QueryableDataDelAtomsWrapper, QueryableRelationalFunctions, RDBMSStore, SimpleInMemoryGraphStore, SPARQLDataSource, SQLDataSource, TripleStoreStore, WebAPIDataSource
public interface QueryableData
This interface describes data sources that can be accessed with read rights.
- Author:
- Guillaume Pérution-Kihli
-
Method Summary
Modifier and TypeMethodDescriptionestimateBound(BasicQuery query) Estimate the number of answers to a query The estimation is the upper bound, meaning the actual number of answers will not exceed this number.estimateBound(Predicate predicate) Estimate the number of tuples in a predicate The estimation is the upper bound, meaning the actual number of answers will not exceed this number.evaluate(BasicQuery query) Try to evaluate a basic queryevaluate(BasicQuery query, List<Integer> sequenceOfAnswerVariables) Try to evaluate a basic querygetAtomicPattern(Predicate predicate) Get the basic pattern for a given predicateReturns a collection of all predicates in this Readable.default Collection<OperationsSupported> booleanAllows checking if this QueryableData provides the predicate p
-
Method Details
-
getPredicates
-
hasPredicate
Allows checking if this QueryableData provides the predicate p- Parameters:
p- the predicate to look up- Returns:
- boolean that is true iff the QueryableData provides this predicate
-
evaluate
Try to evaluate a basic query- Parameters:
query- the query to evaluate- Returns:
- Empty if the query is not evaluable, otherwise a stream containing substitutions that are the answers to the query
- Throws:
EvaluationException- if query evaluation fails
-
evaluate
default Stream<List<Term>> evaluate(BasicQuery query, List<Integer> sequenceOfAnswerVariables) throws EvaluationException Try to evaluate a basic query- Parameters:
query- the query to evaluatesequenceOfAnswerVariables- the sequence of answer variables that define the signature of the resulting tuple- Returns:
- Empty if the query is not evaluable, otherwise a stream containing lists of term ; each list corresponds to the substitution of the answer variables with the corresponding terms
- Throws:
EvaluationException- if query evaluation fails
-
estimateBound
Estimate the number of answers to a query The estimation is the upper bound, meaning the actual number of answers will not exceed this number. Implementations may return an empty Optional if they cannot provide an estimation.- Parameters:
query- the query for which we want to know the upper bound- Returns:
- an Optional containing the estimated upper bound of answers, or an empty Optional if estimation is not possible
-
estimateBound
Estimate the number of tuples in a predicate The estimation is the upper bound, meaning the actual number of answers will not exceed this number. Implementations may return an empty Optional if they cannot provide an estimation.- Parameters:
predicate- the query for which we want to know the upper bound- Returns:
- an Optional containing the estimated upper bound of answers, or an empty Optional if estimation is not possible
-
getAtomicPattern
Get the basic pattern for a given predicate- Parameters:
predicate- the predicate for which we want to know the basic pattern- Returns:
- a basic pattern for predicate
-
getSupportedOperations
- Returns:
- the set of operations and optimizations that are supported by the datasource
-