/** Find all the statements matching a pattern. * <p>Return an iterator over all the statements in a model * that match a pattern. The statements selected are those * whose subject matches the <code>subject</code> argument, * whose predicate matches the <code>predicate</code> argument * and whose object matches the <code>object</code> argument. * If an argument is <code>null</code> it matches anything.</p> * <p> * The s/p/o terms may refer to resources which are temporarily defined in the "posit" model. * This allows one, for example, to query what resources are of type CE where CE is a * class expression rather than a named class - put CE in the posit arg.</p> * * @return an iterator over the subjects * @param subject The subject sought * @param predicate The predicate sought * @param object The value sought * @param posit Model containing additional assertions to be considered when matching statements */ @Override public StmtIterator listStatements( Resource subject, Property predicate, RDFNode object, Model posit ) { if (getGraph() instanceof InfGraph) { Graph gp = posit == null ? ModelFactory.createDefaultModel().getGraph() : posit.getGraph(); Iterator<Triple> iter = getInfGraph().find( asNode(subject), asNode(predicate), asNode(object), gp ); return IteratorFactory.asStmtIterator(iter,this); } else { return null; } }
/** Find all the statements matching a pattern. * <p>Return an iterator over all the statements in a model * that match a pattern. The statements selected are those * whose subject matches the <code>subject</code> argument, * whose predicate matches the <code>predicate</code> argument * and whose object matches the <code>object</code> argument. * If an argument is <code>null</code> it matches anything.</p> * <p> * The s/p/o terms may refer to resources which are temporarily defined in the "posit" model. * This allows one, for example, to query what resources are of type CE where CE is a * class expression rather than a named class - put CE in the posit arg.</p> * * @return an iterator over the subjects * @param subject The subject sought * @param predicate The predicate sought * @param object The value sought * @param posit Model containing additional assertions to be considered when matching statements */ @Override public StmtIterator listStatements( Resource subject, Property predicate, RDFNode object, Model posit ) { if (getGraph() instanceof InfGraph) { Graph gp = posit == null ? ModelFactory.createDefaultModel().getGraph() : posit.getGraph(); Iterator<Triple> iter = getInfGraph().find( asNode(subject), asNode(predicate), asNode(object), gp ); return IteratorFactory.asStmtIterator(iter,this); } else { return null; } }