Hi Andy, Thank you very much for the explanation. But I still miss the point: as you said, the FROM keyword set / fills the default graph so assuming I previously loaded a triple under http://graph1.com
Running SELECT ?s FROM <http://graph1.com> { ?s ?p ?o } I should get the subject of that triple. Is that correct? Because the code above is running under this exact scenario and I'm getting no result. Kind Regards, Andrea On 13 May 2015 21:05, "Andy Seaborne" <[email protected]> wrote: > FROM describes the dataset to use. > > GRAPH accesses the data. > > FROM <http://example/data> set the default graph from the contents of > http://example/data by reading that URL. (This is for the general purpose > dataset - TDB is slightly different but the principle is the same) > > Andy > > On 13/05/15 18:57, Andrea Gazzarini wrote: > >> Hi Trevor, >> Thanks, yes that works...but I would like to understand what is wrong with >> my example >> >> Thanks again >> Andrea >> On 13 May 2015 19:54, "Trevor Donaldson" <[email protected]> wrote: >> >> Hi Andrea, >>> >>> Can I suggest trying this .. >>> >>> SELECT ?s >>> WHERE { >>> GRAPH <http://graph1.com> { >>> ?s ?p ?o >>> } >>> } >>> >>> On Wed, May 13, 2015 at 1:26 PM, Andrea Gazzarini <[email protected]> >>> wrote: >>> >>> Hi, >>>> A question about the FROM keyword. I have the following data >>>> >>>> <http://graph1.com> = { <http://a.b.c/s1> <http://a.b.c/p1> < >>>> http://a.b.c/o1> >>>> . } >>>> <http://graph2.com> = { <http://a.b.c/s2> <http://a.b.c/p2> < >>>> http://a.b.c/o2> >>>> . } >>>> >>>> For simplicity, I created a file for each triple (file1.nt and >>>> file2.nt). >>>> Then, I loaded those data using the following code: >>>> >>>> Dataset memoryDataset = DatasetFactory.createMem(); >>>> Model memoryModel = ModelFactory.createDefaultModel(); >>>> memoryModel.read(new FileReader("file1.nt"), "http://e.org", >>>> >>> "N-TRIPLE"); >>> >>>> memoryDataset.addNamedModel("http://graph1.com", memoryModel); >>>> >>>> memoryModel = ModelFactory.createDefaultModel(); >>>> memoryModel.read(new FileReader("file2.nt"), "http://e.org", >>>> >>> "N-TRIPLE"); >>> >>>> memoryDataset.addNamedModel("http://graph2.com", memoryModel); >>>> >>>> I'm not understanding the results coming from the following query: >>>> >>>> SELECT ?s FROM <http://graph1.com> { ?s ?p ?o } >>>> >>>> ?s = <nothing> >>>> >>>> I was expecting >>>> >>>> ?s=<http://a.b.c/s1> >>>> >>>> Am I missing something? I'm using Jena 2.12.1 >>>> >>>> Thanks in advance for your help >>>> Andrea >>>> >>>> >>> >> >
