On 05.02.2013 12:07, Andy Seaborne wrote:

If you want an updateable view of the model in the dataset use:

    Dataset ds = TDBFactory.createDataset("DB") ;

    ds.begin(ReadWrite.WRITE) ;
    try {
        Model m = ds.getNamedModel("http://example/g";) ;
        FileManager.get().readModel(m, "D.ttl") ;
        // Jena 2.10.0 ---> preferred style
        // RDFDataMgr.read(m, "D.ttl") ;
        ds.commit() ;
    } finally { ds.end() ; }


    Andy
I try this with non-transactional TDB however have not been able to
manage yet. Changes on m are not persisted on my side.

Thanks for the answer,

Anil.

If you provide a complete, minimal example, I'll take a look at it.

Using transaction is better, and is not necessarily slower; in fact it
can be faster.

     Andy


This works for me:

rm -rf DB/*

Run the following code:

        Dataset ds = TDBFactory.createDataset("DB") ;
        Model m = ds.getNamedModel("http://example/g";) ;
        FileManager.get().readModel(m, "D.ttl") ;
        TDB.sync(ds) ;
        System.exit(0) ;

then run

tdbquery --loc DB 'SELECT * { GRAPH ?g { ?s ?p ?o }}'

and I get the data from D.ttl in graph/model http://example/g

    Andy

Hi Andy,

Sorry, I did a mistake in another step, this works for me too.

Thanks a lot.

Anil.

Reply via email to