/** * An extension of the Graph.find interface which allows the caller to * encode complex expressions in RDF and then refer to those expressions * within the query triple. For example, one might encode a class expression * and then ask if there are any instances of this class expression in the * InfGraph. * @param subject the subject Node of the query triple, may be a Node in * the graph or a node in the parameter micro-graph or null * @param property the property to be retrieved or null * @param object the object Node of the query triple, may be a Node in * the graph or a node in the parameter micro-graph. * @param param a small graph encoding an expression which the subject and/or * object nodes refer. */ @Override public ExtendedIterator<Triple> find(Node subject, Node property, Node object, Graph param) { return cloneWithPremises(param).find(subject, property, object); }
/** 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 matchesthe <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 */ @Override public StmtIterator listStatements( Resource subject, Property predicate, RDFNode object, Model posit ) { Iterator<Triple> iter = getInfGraph().find(asNode(subject), asNode(predicate), asNode(object), posit.getGraph()); return IteratorFactory.asStmtIterator(iter,this); }
/** 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; } }