code: private void validateSubject(final Resource subject) {
          final String subjectURI = subject.getURI();
          // blank nodes are okay
          if (!subject.isAnon()) {
              // hash URIs with the same base as the topic are okay
              final int hashIndex = subjectURI.lastIndexOf("#");
              if (!(hashIndex > 0 && topic.getURI().equals(subjectURI.substring(0, hashIndex)))) {
                  // the topic itself is okay
                  if (!topic.equals(subject.asNode())) {
                      // it's a bad subject, but it could still be in-domain
                      if (idTranslator.inDomain(subject)) {
                          LOGGER.error("{} is not in the topic of this RDF, which is {}.", subject, topic);
                          throw new IncorrectTripleSubjectException(subject +
                                  " is not in the topic of this RDF, which is " + topic);
                      }
                      // it's not even in the right domain!
                      LOGGER.error("subject ({}) is not in repository domain.", subject);
                      throw new OutOfDomainSubjectException(subject.asNode());
                  }
              }
          }
      }
docs: If it's not the right kind of node, throw an appropriate unchecked exception.
  
  @param subject to validate