title: Java method not returning string
body: <pre><code>public static void searchLabel(String word) {
      String uri = null;
      String sparqlQueryString1 = sparqlQuerySetup + "SELECT * WHERE {?x uni:altLabel \"" + word + "\"^^xsd:string}";
      System.out.println(sparqlQueryString1);
      executeQuery(sparqlQueryString1);
      System.out.println(uri);
  
      getType(uri);
  }
  
  public static String executeQuery(String sparqlQuerystring1){
      String uri = null;
      Query query = QueryFactory.create(sparqlQuerystring1);
      QueryExecution qexec = QueryExecutionFactory.create(query, model);
      ResultSet results = qexec.execSelect();
      //ORGINEEL ResultSetFormatter.out(System.out, results, query);       
      //ALS RDF ResultSetFormatter.outputAsRDF("", results);    
     // ResultSetFormatter.outputAsJSON(results);
      if (results.hasNext()) {
           uri = results.next().get("x").toString();
        }
      qexec.close() ;
      System.out.println(uri);
      return uri;
  }
  </code></pre>
  
  <p>In the first method, I'm executing executeQuery. In the executeQuery I try to return "uri" and print it again in the searchLabel method, but it returns "null". It is being printed executeQuery method, just before returning uri.</p>
  
  <p>I'm guessing it has to do with the fact that I have uri defined as null inside the searchLabel method. But if I remove it I can't execute the script (uri can't be resolved to a variable)</p>