01: /*
02: * Copyright Aduna (http://www.aduna-software.com/) (c) 1997-2006.
03: *
04: * Licensed under the Aduna BSD-style license.
05: */
06: package org.openrdf.query.algebra.evaluation;
07:
08: import info.aduna.iteration.CloseableIteration;
09:
10: import org.openrdf.model.Resource;
11: import org.openrdf.model.Statement;
12: import org.openrdf.model.URI;
13: import org.openrdf.model.Value;
14: import org.openrdf.model.ValueFactory;
15: import org.openrdf.query.QueryEvaluationException;
16:
17: /**
18: * A triple source that can be queried for (the existence of) certain triples in
19: * certain contexts. This interface defines the methods that are needed by the
20: * Sail Query Model to be able to evaluate itself.
21: */
22: public interface TripleSource {
23:
24: /**
25: * Gets all statements that have a specific subject, predicate and/or object.
26: * All three parameters may be null to indicate wildcards. Optionally a (set
27: * of) context(s) may be specified in which case the result will be
28: * restricted to statements matching one or more of the specified contexts.
29: *
30: * @param subj
31: * A Resource specifying the subject, or <tt>null</tt> for a
32: * wildcard.
33: * @param pred
34: * A URI specifying the predicate, or <tt>null</tt> for a wildcard.
35: * @param obj
36: * A Value specifying the object, or <tt>null</tt> for a wildcard.
37: * @param contexts
38: * The context(s) to get the statements from. Note that this parameter
39: * is a vararg and as such is optional. If no contexts are supplied
40: * the method operates on the entire repository.
41: * @return An iterator over the relevant statements.
42: * @throws QueryEvaluationException
43: * If the triple source failed to get the statements.
44: */
45: public CloseableIteration<? extends Statement, QueryEvaluationException> getStatements(
46: Resource subj, URI pred, Value obj, Resource... contexts)
47: throws QueryEvaluationException;
48:
49: /**
50: * Gets a ValueFactory object that can be used to create URI-, blank node-
51: * and literal objects.
52: *
53: * @return a ValueFactory object for this TripleSource.
54: */
55: public ValueFactory getValueFactory();
56: }
|