title: How to convert a SPARQL query into an RDF file in Jena?
body: <p>I am trying to output an RDF/XML file directly from an SPARQL query from an Oracle database. 
  The query is working fine as I've verified the results in the ResultSet object.</p>
  
  <p>However, I'm not sure how to proceed from there. I think I want to create a Statement for each QuerySolution and then add it to the Model. However I can't figure out a way to do it, because I can't find a way to get the predicate value. </p>
  
  <p>Any help would be appreciated, as well as hints whether I am going down the right path.</p>
  
  <pre><code>QueryExecution qe = QueryExecutionFactory.create(query, oracleSemModel) ;       
  ResultSet results = qe.execSelect();
  
  Model model = ModelFactory.createDefaultModel();
  
  while (results.hasNext())
  {
      QuerySolution result = results.next();
      Resource  subject   =  result.getResource("s");   // get the subject
      Property  predicate =  result.getProperty("p");   // &lt;-- THIS FUNCTION DOESN'T EXIST
      RDFNode   object    =  result.get("o");           // get the object
  
      Statement stmt = ResourceFactory.createStatement(subject, predicate, object);
  
      model.add(stmt);
  }
  
  model.write(System.out, "RDF/XML-ABBREV");
  </code></pre>