Hello Martynas, it finally showed the result. But I did not understand the code. Why we assign the result to a Model? Why not resultset.
Model results = qexec.execConstruct() ; On Thu, Aug 24, 2017 at 11:44 PM, Martynas Jusevičius < marty...@atomgraph.com> wrote: > This means your query hasn't matched anything. > > Show us your data. > > On Thu, Aug 24, 2017 at 10:42 PM, javed khan <javedbtk...@gmail.com> > wrote: > > > In response to my question earlier, I replace this > > > > ResultSet results = (ResultSet) qexec.execConstruct() ; > > > > with > > > > Model results = qexec.execConstruct() ; > > results.write(System.out, "TURTLE"); > > > > But how can I get the require result i.e value of ?z and ?y > > > > I expect the following result: > > > > Bob hasUncle Lincoln > > > > But currently, it just display the prefixes. > > > > > > > > > > On Thu, Aug 24, 2017 at 9:20 PM, javed khan <javedbtk...@gmail.com> > wrote: > > > > > Hello > > > > > > What is the problem in this query: 'Male' is string literal here. (The > > > query works inside Protege) > > > > > > CONSTRUCT { ?x mo:hasUncle ?y } WHERE { ?x mo:hasParents ?z .?z > > > mo:Gender 'Male' . ?z mo:hasBrother ?y} > > > > > > Query query = QueryFactory.create(str); > > > QueryExecution qexec = QueryExecutionFactory.create(query, model) ; > > > ResultSet results = (ResultSet) qexec.execConstruct() ; > > > while (results.hasNext()) > > > { > > > QuerySolution binding = results.nextSolution(); > > > Literal lit = binding.get("z").asLiteral(); > > > > > > > > > > > >