And the presenting issue fixed as well:
https://issues.apache.org/jira/browse/JENA-860
which will be in the next snapshot build.
Whether this is the same as, related to, or completely different to the
other SO question is hard to tell. The details matter a lot here and the
OntModel changes things as well.
Andy
On 22/01/15 17:11, Nandana Mihindukulasooriya wrote:
Hi Andy,
Reading directly into the dataset worked like a charm, thanks a lot !!
Best Regards,
Nandana
On Thu, Jan 22, 2015 at 5:57 PM, Andy Seaborne <[email protected]> wrote:
On 22/01/15 16:17, Nandana Mihindukulasooriya wrote:
Hi,
I am using Jena TDB (1.1.1) to store a set of named graphs. Everything
works fine but whenever I retrieve a named graph from the dataset, all the
namespace prefix information is lost. Is there a way to preserve the
namespace prefixes in the original RDF graph when I add them to dataset.
I've attached a minimal code snippet here that illustrate the issue in the
following link.
http://stackoverflow.com/questions/28091817/how-to-
preserve-namespace-prefixes-in-a-jena-tdb-dataset
Best Regards,
Nandana
Hi Nandana,
Thanks for the example - I'll try and get it running when I can (wrong
size of computer just at the moment) but a partial answer now ...
I can't remember exactly but I think that addNamedModel is a quad copy
(does not copy prefixes). If so, it is probably an oversight nowadays.
What happens if you read directly into the dataset?
dataset.begin(ReadWrite.WRITE) ;
try {
StringReader sw = new StringReader(modelText) ;
Model m = dataset.getNamedModel("http://example.org/ro") ;
RDFDataMgr.read(m, sw, null, Lang.TTL) ;
dataset.commit() ;
} finally {
dataset.end() ;
}
//Unchecked
Hmm - quick grep - looks like DatasetGraphCaching.addGraph could do the
prefix thing.
Sorry for the rushed answer,
Andy