private String generateSubjectMapRDF(
      SubjectMap subjMap, Set<String> existingTopRowTriples, Map<String, String> columnValues)
      throws ValueNotFoundKarmaException, NoValueFoundInNodeException {
    // Generate URI for subject
    String uri = "";
    if (subjMap.isBlankNode()) {
      uri =
          getBlankNodeUri(subjMap.getId(), columnValues)
              .replaceAll(" ", "")
              .replaceAll("[,`']", "_");
    } else
      uri =
          getTemplateTermSetPopulatedWithValues(columnValues, subjMap.getTemplate())
              .replaceAll(" ", "")
              .replaceAll("[,`']", "_");

    // Generate triples for specifying the types
    for (TemplateTermSet typeTerm : subjMap.getRdfsType()) {
      String typeUri = getTemplateTermSetPopulatedWithValues(columnValues, typeTerm);
      String triple = constructTripleWithURIObject(uri, Uris.RDF_TYPE_URI, typeUri);
      if (!existingTopRowTriples.contains(triple)) {
        existingTopRowTriples.add(triple);
        outWriter.println(triple);
      }
    }
    return uri;
  }