On 11/12/13 05:38, Charles Li wrote:
Hi, Jena and SPARQL experts:

I have the following SPARQL query:
--------------------------------------------------------------------------------
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX my: <http://www.mycompany.com/me1.0#>
select ?type where { <my#xyz> rdf:type ?type }
--------------------------------------------------------------------------------

When I run it inside the Fuseki web console, the result is: "my.MyType".

It's probably my:MyType

However, when I use the following code to run in Jena 2.10.1:
--------------------------------------------------------------------------------
                 Query query = QueryFactory.create(queryString); //the above
query string in entirety
QueryExecution qexec = QueryExecutionFactory.create(query, model);
ResultSet results = qexec.execSelect();
  QuerySolution soln = null;
String rdfClassName = null;
  if(results.hasNext()) {
soln = results.nextSolution();
rdfClassName = soln.get("?type").toString();
}

--------------------------------------------------------------------------------

rdfClassName contains string "http://www.mycompany.com/me1.0#MyType";.

My question is: how do I write the Jena code to have refClassName also
contains "my.MyType"?

model.shortForm( rdfClassName )

Dave

Reply via email to