title: Parameterized SPARQL query with JENA
body: <p>I'm trying to build a small semantic web application using Jena framework, JSP and JAVA. I have a remote SPARQL endpoint and I've already written a simple query which works fine but now I need to use some parameters. Here is my code so far:</p>
  
  <pre><code>final static String serviceEndpoint = "http://fishdelish.cs.man.ac.uk/sparql/";
  
  String comNameQuery = 
          "PREFIX fd: &lt;http://fishdelish.cs.man.ac.uk/rdf/vocab/resource/&gt; " +
          "SELECT ?name ?language ?type" +
          "WHERE { ?nameID fd:comnames_ComName ?name ;" +
          "fd:comnames_Language ?language ;" +
          "fd:comnames_NameType ?type ." +
          "}";
  
  Query query = QueryFactory.create(comNameQuery);  
  QueryExecution qe = QueryExecutionFactory.sparqlService(serviceEndpoint,query);
  
  try {
      ResultSet rs = qe.execSelect();
      if ( rs.hasNext() ) {
          System.out.println(ResultSetFormatter.asText(rs));
      }
  } 
  catch(Exception e) { 
      System.out.println(e.getMessage());
  }
  finally {
      qe.close();
  }
  </code></pre>
  
  <p>What I want to do is to parameterized ?name. I'm new to Jena and I'm not really sure how to use parameters in a SPARQL query. I would appreciate it if someone could help me with this.</p>