Rob, I agree that it's not safe to use relative URI's, and I'll probably prefix my URI's with ldp: .
I had already tested your query, and it returns the original (relative) graph name . 2015-07-28 13:10 GMT+02:00 Rob Vesse <[email protected]>: > Using relative URIs is almost always ill-advised since URI resolution will > be system and environment dependent > > In this case the problem is that the URI gets resolved differently in > different parts of the system > > Try listing the graphs to see the actual graph names that end up in the > store: > > SELECT ?g WHERE { GRAPH ?g { } } > > Rob > > On 28/07/2015 11:18, "Jean-Marc Vanel" <[email protected]> wrote: > > >Hi > > > >I'm not sure if if having a named graph with its name being a relative URI > >is compliant with the W3C recommendations, > >But what is sure is that it does not work in TDB. > >The outcome of this code is that the named graph's content is not > >retrieved. > > > >The use case behind is that I'm developing a simplified LDP server backed > >by TDB with Scala and Banana-RDF: > > > https://github.com/jmvanel/semantic_forms/blob/master/scala/forms/src/main > >/scala/deductions/runtime/services/LDP.scala > > > >import com.hp.hpl.jena.query.*; > >import com.hp.hpl.jena.rdf.model.*; > >import com.hp.hpl.jena.tdb.*; > >import com.hp.hpl.jena.vocabulary.*; > > > >public class TestTDBNamedGraphRelativeURI { > >public static void main(String[] args) { > > String graphURI = "test1/test1.ttl"; > > > > Dataset dataset = TDBFactory.createDataset("TDB1"); > >Model model = ModelFactory.createDefaultModel(); > > > >String personURI = "http://somewhere/JohnSmith"; > >Resource johnSmith = model.createResource(personURI); > >String fullName = "John Smith"; > > johnSmith.addProperty(VCARD.FN, fullName); > >dataset.addNamedModel(graphURI, model); > > > >String q = "CONSTRUCT { ?s ?p ?o } " > >+ "WHERE { GRAPH <" + graphURI + "> {?s ?p ?o } }"; > > Query query = QueryFactory.create(q) ; > >QueryExecution qexec = QueryExecutionFactory.create(query, dataset) ; > >Model resultModel = qexec.execConstruct() ; > >qexec.close() ; > >System.out.println( resultModel ); > >} > >} > > > > > >-- > >Jean-Marc Vanel > >Déductions SARL - Consulting, services, training, > >Rule-based programming, Semantic Web > >http://deductions-software.com/ > >+33 (0)6 89 16 29 52 > >Twitter: @jmvanel , @jmvanel_fr ; chat: irc://irc.freenode.net#eulergui > > > > > -- Jean-Marc Vanel Déductions SARL - Consulting, services, training, Rule-based programming, Semantic Web http://deductions-software.com/ +33 (0)6 89 16 29 52 Twitter: @jmvanel , @jmvanel_fr ; chat: irc://irc.freenode.net#eulergui
