code: private  final String getFilenameFromRels(Context context, String pid, String dsid, String MIMETYPE) throws Exception {
          String filename = "";
  
          // read rels directly from RELS-INT - can't use Management.getRelationships as this requires auth
          DOReader reader = m_doManager.getReader(false, context, pid);
          Datastream relsInt = reader.GetDatastream("RELS-INT", null);
          if (relsInt == null) return "";
  //        try {
  //            relsInt = m_apiAService.getDatastreamDissemination(context, pid, "RELS-INT", null);
  //        } catch (DatastreamNotFoundException e) {
  //            return "";
  //        }
          Set<RelationshipTuple> relsIntTuples = RDFRelationshipReader.readRelationships(relsInt.getContentStream());
  
          if (relsIntTuples.size() == 0) return "";
          // find the tuple specifying the filename
          int matchingTuples = 0;
          String dsSubject = Constants.FEDORA.uri + pid + "/" + dsid;
          for ( RelationshipTuple tuple : relsIntTuples ) {
              if (tuple.subject.equals(dsSubject) && tuple.predicate.equals(FILENAME_REL)) {
                  // use the first found relationship by default (report warning later if there are more)
                  if (matchingTuples == 0) {
                      if (tuple.isLiteral) {
                          filename = tuple.object;
                      } else {
                          logger.warn("Object " + pid + " datastream " + dsid + " specifies a filename which is not a literal in RELS-INT");
                          filename = "";
                      }
                  }
                  matchingTuples++;
              }
          }
          if (matchingTuples > 1) {
              logger.warn("Object " + pid + " datastream " + dsid + " specifies more than one filename in RELS-INT.");
          }
          return filename;
  
      }
docs: Get datastream filename as defined in RELS-INT
  
  @param context
  @param pid
  @param dsid
  @param MIMETYPE
  @return
  @throws Exception