code: public void write(OutputStream os) throws Exception {
          try {
              JenaR2RMLMappingManager mm = JenaR2RMLMappingManager.getInstance();
              Collection<TriplesMap> tripleMaps = getTripleMaps();
  
              final JenaGraph jenaGraph = mm.exportMappings(tripleMaps);
              final Graph graph = new JenaRDF().asJenaGraph(jenaGraph);
  
              final PrefixMapping jenaPrefixMapping = graph.getPrefixMapping();
              prefixmng.getPrefixMap()
                      .forEach((s, s1) ->
                              jenaPrefixMapping.setNsPrefix(
                                      s.substring(0, s.length()-1) // remove the last ":" from the prefix
                                      , s1));
              jenaPrefixMapping.setNsPrefix("rr", "http://www.w3.org/ns/r2rml#");
  
              RDFWriter.create()
                      .lang(Lang.TTL)
                      .format(RDFFormat.TURTLE_PRETTY)
                      .source(graph)
                      .output(os);
  
              // use Jena to output pretty turtle syntax
              //RDFDataMgr.write(os, graph, org.apache.jena.riot.RDFFormat.TURTLE_PRETTY);
              os.close();
          } catch (Exception e) {
              e.printStackTrace();
              throw e;
          }
      }
docs: the method to write the R2RML mappings
  from an rdf Model to a file
  
  @param os the output target