Got it - it’s gotta be a real URI, with http and everything:

       http://ao.com/aaa

 The simple names, like:

       aaa

don’t work …

S.


On 4/10/17, 4:22 PM, "Dimov, Stefan" <[email protected]> wrote:

    I (almost) got it.
    
    Apparently, the data was loaded correctly. Now I can query the names of all 
the graphs:
    
    SELECT DISTINCT $g
    {
       GRAPH ?g { ?s ?p ?o }
    }
    
    returns:
    
    {
      "head": {
        "vars": [ "g" ]
      } ,
      "results": {
        "bindings": [
          {
            "g": { "type": "uri" , "value": "aaa" }
          } ,
          {
            "g": { "type": "uri" , "value": "bbb" }
          } ,
          {
            "g": { "type": "uri" , "value": "ccc" }
          } ,
          {
            "g": { "type": "uri" , "value": "ddd" }
          } ,
          …
    
    or the data:
    
    SELECT count(*)
    {
       GRAPH ?g { ?s ?p ?o }
    }
    
    returns:
    
    {
      "head": {
        "vars": [ ".1" ]
      } ,
      "results": {
        "bindings": [
          {
            ".1": { "type": "literal" , "datatype": 
"http://www.w3.org/2001/XMLSchema#integer"; , "value": "395721" }
          }
        ]
      }
    }
    
    but I still can’t figure out how to query specific named graph. This:
    
    SELECT count(*)
    {
       GRAPH <aaa> { ?s ?p ?o }
    }
    
    should work. But actually it returns zero results:
    
    {
      "head": {
        "vars": [ ".1" ]
      } ,
      "results": {
        "bindings": [
          {
            ".1": { "type": "literal" , "datatype": 
"http://www.w3.org/2001/XMLSchema#integer"; , "value": "0" }
          }
        ]
      }
    }
    
    Any idea?
    
    S.
    
    
    On 4/10/17, 2:06 PM, "Dimov, Stefan" <[email protected]> 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);
            ds.begin(ReadWrite.WRITE);
            FileManager.get().readModel(model, fileName);
            ds.commit();
            ds.end();
            return true;
        }
        
        
        
        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