title: Writing SPARQL queries with Jena to query for IRIs like: http://pt.dbpedia.org/
body: <p>I'm using Jena to write a <code>SPARQL</code> query to get the <code>rdfs:label</code> property from a URI received as a method parameter. That method only receives URIs like: <code>http://pt.dbpedia.org/..</code> It should return me the <code>rdfs:label</code>, but it doesn't return me anything. I checked and it doesn't enter the <code>while block</code> supposed to iterate the results. I even made a test with the URI:  <code>&lt;http://pt.dbpedia.org/resource/Brasil&gt;</code> , but it didn't work.</p>
  
  <p>What may be the problem?</p>
  
  <pre><code> public String getLabel(String uri, String label) {
                Model model = ModelFactory.createDefaultModel().read( uri );
                RDFNode node;
  
   String queryString = "PREFIX rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt; " +
                "PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt; " +
                    "PREFIX owl: &lt;http://www.w3.org/2002/07/owl#&gt;" +
                "SELECT distinct ?label WHERE { " +
               "?resource owl:sameAs &lt;" + uri + "&gt; ;" +
                    "rdfs:label ?label ." +
                    "filter( langMatches(lang(?label),'pt'))  }";
  
               Query query = QueryFactory.create(queryString);
  
                  QueryExecution qe = QueryExecutionFactory.create(query, model);
                  ResultSet r =  qe.execSelect();
  
                  while( r.hasNext() ) {
                         QuerySolution querySolution = r.next();
                         node = querySolution.get("label");
                         label = node.toString();
                      }
                  return label;
        }
  </code></pre>
  
  <p>The <code>SPARQL</code> query is like that:</p>
  
  <pre><code>SELECT distinct ?label WHERE { 
    ?brasil owl:sameAs &lt;http://pt.dbpedia.org/resource/Brasil&gt; ;
            rdfs:label ?label .
    filter( langMatches(lang(?label),"pt") )
  }
  </code></pre>
  
  <p>Thank you!</p>