code: public void performAdd(InputStream in, String baseURI, RDFFormat dataFormat, Transaction tx, Resource... contexts) throws RDFParseException, MarkLogicSesameException {
          try {
              graphManager.setDefaultMimetype(dataFormat.getDefaultMIMEType());
              if (dataFormat.equals(RDFFormat.NQUADS) || dataFormat.equals(RDFFormat.TRIG)) {
                  graphManager.mergeGraphs(new InputStreamHandle(in),tx);
              } else {
                  if (notNull(contexts) && contexts.length > 0) {
                      for (int i = 0; i < contexts.length; i++) {
                          if (notNull(contexts[i])) {
                              graphManager.mergeAs(contexts[i].toString(), new InputStreamHandle(in), getGraphPerms(), tx);
                          } else {
                              graphManager.mergeAs(DEFAULT_GRAPH_URI, new InputStreamHandle(in),getGraphPerms(), tx);
                          }
                      }
                  } else {
                      graphManager.mergeAs(DEFAULT_GRAPH_URI, new InputStreamHandle(in),getGraphPerms(), tx);
                  }
              }
              in.close();
          } catch (FailedRequestException e) {
              logger.error(e.getLocalizedMessage());
              throw new RDFParseException("Request to MarkLogic server failed, check input is valid.");
          } catch (IOException e) {
              logger.error(e.getLocalizedMessage());
              throw new MarkLogicSesameException("IO error");
          }
      }
docs: executes merge of triples from InputStream
  
  @param in
  @param baseURI
  @param dataFormat
  @param tx
  @param contexts
  @throws RDFParseException