title: How I can query a model on Jena TDB given a name
body: <p>I have a question.</p>
  
  <p>I am trying to load my RDF files on Jena TDB.</p>
  
  <p>I have written this code:</p>
  
  <pre><code>public void store(){
      String directory = "C:\\tdb";
      String source = "C:\\file1.rdf";
      String source1 = "C:\\file2.rdf";
      Dataset dataset = openTDB(directory);
      Model tdb = loadModel(source, dataset);
      dataset.addNamedModel("File1", tdb);
  
      Model tdb1 = loadModel(source1, dataset);
      dataset.addNamedModel("File2", tdb1);
  
      queryTDB(tdb, dataset);
      queryTDB(tdb1, dataset);
  
      tdb.close();
      tdb1.close();
      dataset.close();
  }
  
  public Dataset openTDB(String directory) {
      // open TDB dataset
      Dataset dataset = TDBFactory.createDataset(directory);
      return dataset;
  }
  
  public Model loadModel(String source, Dataset dataset) {
  
      Model tdb = dataset.getDefaultModel();
      FileManager.get().readModel( tdb, source, "RDF/XML" );
      return tdb;
  }
  </code></pre>
  
  <p>In particular, I have two files and I want to load these files on Jena TDB. I have read on Internet that I can add a name to my models using "addNamedModel". In doing so, in the code above, I added the names "File1" and "File2".</p>
  
  <p>Now, I want to query this dataset and I'm trying to write this code:</p>
  
  <pre><code>public void queryTDB(Model tdb, Dataset dataset) {
  
      String queryStr = "SELECT * { ?s ?p ?o }";
  
      Query query = QueryFactory.create(queryStr);
      QueryExecution qexec = QueryExecutionFactory.create(query, tdb);
      /*Execute the Query*/
      ResultSet results = qexec.execSelect();
      ResultSetFormatter.out(results) ;
      qexec.close();
  }
  </code></pre>
  
  <p>This code works, but I would like to know how I can get the query results only for the model named "File1" (or "File2"). In fact, with the query written so, I get the results of both models.</p>
  
  <p>How I can realize it?</p>