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


Reply via email to