/**
   * Ordinary constructor.
   *
   * @param graphSubjects
   * @param session
   * @param stream
   */
  public PersistingRdfStreamConsumer(
      final IdentifierTranslator graphSubjects, final Session session, final RdfStream stream) {
    this.idTranslator = graphSubjects;
    this.jcrRdfTools = JcrRdfTools.withContext(graphSubjects, session);
    this.isFedoraSubjectTriple =
        new Predicate<Triple>() {

          @Override
          public boolean apply(final Triple t) {

            final boolean result =
                graphSubjects.isFedoraGraphSubject(m.asStatement(t).getSubject());
            if (result) {
              LOGGER.debug("Discovered a Fedora-relevant subject in triple: {}.", t);
            } else {
              LOGGER.debug("Ignoring triple: {}.", t);
            }
            return result;
          }
        };
    // we knock out managed RDF and non-Fedora RDF
    this.stream =
        stream.withThisContext(
            stream.filter(and(not(isManagedTriple), isFedoraSubjectTriple)).iterator());
    this.session = session;
  }
 @Override
 public void consume() throws RepositoryException {
   while (stream.hasNext()) {
     final Statement t = m.asStatement(stream.next());
     LOGGER.debug("Operating on triple {}.", t);
     operateOnTriple(t);
   }
 }
 protected String getPropertyNameFromPredicate(final Node subjectNode, final Property predicate)
     throws RepositoryException {
   return jcrRdfTools().getPropertyNameFromPredicate(subjectNode, predicate, stream.namespaces());
 }