Thanks!

S.

On 4/11/17, 2:19 AM, "Andy Seaborne" <[email protected]> wrote:

    
    
    On 10/04/17 22:06, Dimov, Stefan wrote:
    > Hi,
    >
    > I’m using in-mem base and loading multiple named graphs in one data set, 
iterating thru :
    >
    > private static boolean loadGraphT(Dataset ds) {
    >     …
    >     String filename = …
    >     String graphName = …
    >    …
    >     Model model = ds.getNamedModel(graphName);
    Put this inside the transaction
    
    >     ds.begin(ReadWrite.WRITE);
    >     FileManager.get().readModel(model, fileName);
    >     ds.commit();
    >     ds.end();
    >     return true;
     > }
    
          ds.begin(ReadWrite.WRITE);
          Model model = ds.getNamedModel(graphName);
          RDFDataMgr.read(model, fileName);
          ds.commit();
          ds.end();
    
    
    or even:
    
             Txn.executeWrite(ds, ()->{
                 Model model = ds.getNamedModel(graphName);
                 RDFDataMgr.read(model, fileName);
             });
    
    http://jena.apache.org/documentation/txn/
    
    
    > }
    >
    >
    >
    > At start, after everything is read and data set is committed, I’m 
printing out the graph names and their sizes, to check, if everything was 
loaded:
    >
    > 2017-04-10 13:50:50 INFO  Ontology:50 - Named graph aaa - 7855 triples
    > 2017-04-10 13:50:50 INFO  Ontology:50 - Named graph bbb - 26 triples
    > 2017-04-10 13:50:50 INFO  Ontology:50 - Named graph ccc - 4 triples
    > 2017-04-10 13:50:50 INFO  Ontology:50 - Named graph ddd - 20000 triples
    > …
    >
    > After that I’m trying to query some data from a named graph:
    >
    > SELECT count ($s)
    > FROM NAMED <aaa>
    > {
    >     { ?s ?p ?o }
    > }
    >
    > or trying to query it without specifying graph:
    >
    > SELECT count ($s)
    > {
    >     { ?s ?p ?o }
    > }
    >
    > The result is empty:
    >
    > {
    >   "head": {
    >     "vars": [ ".1" ]
    >   } ,
    >   "results": {
    >     "bindings": [
    >       {
    >         ".1": { "type": "literal" , "datatype": 
"http://www.w3.org/2001/XMLSchema#integer"; , "value": "0" }
    >       }
    >     ]
    >   }
    > }
    >
    > What am I doing wrong?
    >
    > S.
    >
    

Reply via email to