title: Reading all the RDF files in a directory
body: <p>I am trying to read all the RDF files in a directory, but it seems that I am only reading the first file. I first get the file names using File object and then try to iterate through them, reading each one. I dont know what to do if I have to do something like</p>
  
  <pre><code>model = ModelFactory.createDefaultModel();
  </code></pre>
  
  <p>after each iteration or close the input and output streams or something else. My code so far follows:</p>
  
  <pre><code>String inputFileName  = "";
  Model model = ModelFactory.createDefaultModel();
  StringWriter out;
  File folder = new File("D:/filepath");
  File[] listOfFiles = folder.listFiles();
  String result="";
  
  for (int i = 0; i &lt; listOfFiles.length; i++) {
      inputFileName= listOfFiles[i].getName();
      inputFileName = "D:/filepath/" +inputFileName;
      System.out.println(inputFileName);
      InputStream in = FileManager.get().open( inputFileName );
  
      if (in == null) {
          throw new IllegalArgumentException( "File: " + inputFileName + " not found");
      }
  
      model.read(in, "");
      String syntax = "RDF/XML-ABBREV"; 
      out = new StringWriter();
      model.write(out, syntax);
      result = out.toString();
      //  extractSomethingFrom(result);
      model = ModelFactory.createDefaultModel();
      in.close();
      out.close();
  }
  </code></pre>