title: How to extract dataproperty value from sparql results?
body: <p>I am using jena to fire query on ontology. I am getting results as follows when I run the query to get the value of data property assigned to object <code>Student1</code></p>
  
  <pre><code>"Ashutosh"^^http://www.w3.org/2001/XMLSchema#string is not a URI node
  </code></pre>
  
  <p>What should I do if I want result as follows</p>
  
  <pre><code>"Ashutosh" or `Ashutosh`
  </code></pre>
  
  <p>This is my java code. What should I do if I want answer as given above?</p>
  
  <pre><code>import com.hp.hpl.jena.query.Query;
  import com.hp.hpl.jena.query.QueryFactory;
  import com.hp.hpl.jena.query.QueryExecution;
  import com.hp.hpl.jena.query.QueryExecutionFactory;
  import com.hp.hpl.jena.query.QuerySolution;
  import com.hp.hpl.jena.query.ResultSet;
  import com.hp.hpl.jena.rdf.model.Model;
  import com.hp.hpl.jena.rdf.model.RDFNode;
  import com.hp.hpl.jena.util.FileManager;
  
  
  public class abc {
  static String avg;
  static String sq="Charlie";
  static String tq="'";
  static String data;
  
  
  public static void main(String[] args) {
  
      // TODO Auto-generated method stub
  
  sparqltest();}
  
  
  static void sparqltest()
  {
  
      FileManager.get().addLocatorClassLoader(abc.class.getClassLoader());
      Model model= FileManager.get().loadModel("C:/Users/avg/workspacejena32/Jena/bin/ashu.rdf");
      //System.out.println("Connected...");
      String queryString="prefix avg:&lt;http://www.semanticweb.org/avg/ontologies/2016/3/untitled-ontology-14#&gt;" +
                         "prefix rdf:&lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt;" +
                         "SELECT * WHERE {" +
                         "avg:Student1 avg:Name ?x . filter isLiteral(?x)" +
                         "}";
      //System.out.println("Connected...");
  
  
      Query query= QueryFactory.create(queryString);
      QueryExecution qexec=QueryExecutionFactory.create(query, model);
  
   try {
      ResultSet rs = qexec.execSelect();
      for ( ; rs.hasNext() ; )
      {
      QuerySolution soln = rs.nextSolution() ;
      RDFNode a = soln.get("x") ;
      data = a.asNode().getLocalName();
  
  
  } }
  
  
      catch(Exception e)
  {
      System.out.println(e.getMessage());
  }   
   } 
   } 
  </code></pre>