1) I use Fuseki2.

2) I have same test data
a) as triples in rdf file
b) as quads in nq file with graph name

from browser -- http://localhost:3030
-  I uploaded the data to persistent dataset
-  I see that my data successfully stored.
-  I performed simple queries

  #1)
       SELECT ?subj ?pred ?obj WHERE { ?subj ?pred ?obj }
  #2)
       SELECT ?subj ?pred ?obj WHERE {
           GRAPH ?g  { ?subj ?pred ?obj }
       }

  both queries succeeded and I saw valid results.


OK, now I try to perform same queries from java program.
Here is my code:

    Model model = ModelFactory.createDefaultModel();
    String url = "http://localhost:3030/ds";;
    model.read(url);

    String RQuery = ...;  //// <<< query #1 or query #2

    Query query = QueryFactory.create(RQuery);
    QueryExecution qe = QueryExecutionFactory.create(query, model);

    ResultSet rs = qe.execSelect();
    int count=0;

    while (rs.hasNext())
    {
      QuerySolution qsol = rs.nextSolution();
      ++count;
    }

And I have proper count for query #1 and count==0 for query #2.

Please, what is wrong with my code.

Thanks.







-- 
Vadim Shumilin

Reply via email to