Returns a view of the statements with the specified subject, predicate, object and (optionally) context. The
subject,
predicate and
object parameters can be
null to indicate wildcards. The
contexts parameter is a wildcard and accepts zero or more values. If no contexts are specified, statements will match disregarding their context. If one or more contexts are specified, statements with a context matching one of these will match. Note: to match statements without an associated context, specify the value
null and explicitly cast it to type
Resource.
The returned model is backed by this Model, so changes to this Model are reflected in the returned model, and vice-versa. If this Model is modified while an iteration over the returned model is in progress (except through the iterator's own remove operation), the results of the iteration are undefined. The model supports element removal, which removes the corresponding statement from this Model, via the Iterator.remove, Set.remove, removeAll, retainAll, and clear operations. The statements passed to the add and addAll operations must match the parameter pattern.
Examples: model.filter(s1, null, null) matches all statements that have subject s1,
model.filter(null, null, null, c1) matches all statements that have context c1,
model.filter(null, null, null, (Resource)null) matches all statements that have no associated context,
model.filter(null, null, null, c1, c2, c3) matches all statements that have context c1, c2 or c3.
@param subj The subject of the statements to match, null to match statements with any subject.
@param pred The predicate of the statements to match, null to match statements with any predicate.
@param obj The object of the statements to match, null to match statements with any object.
@param contexts The contexts of the statements to match. If no contexts are specified, statements will match disregarding their context. If one or more contexts are specified, statements with a context matching one of these will match.
@return The statements that match the specified pattern.