You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Wang Dongsheng <ds...@gmail.com> on 2013/09/02 03:37:33 UTC

How to add a new triple into a named graph in TDB?

Hi, all
   It confused me a lot that when I maintain a named graph.

   I stored many named graph in TDB, I can get the named graph by
dataset.getNamedModel("model name"); or delete the named model by
dataset.removeNamedModel("").

   But when I want to add a new triple, into the named model, it does
not work. For example, Model model = dataset.getNamedModel("model
name"); model.add("a statement");

   The statement is not found in the named model or even in the default model.~

Re: How to add a new triple into a named graph in TDB?

Posted by Dave Reynolds <da...@gmail.com>.
On 02/09/13 02:37, Wang Dongsheng wrote:
> Hi, all
>     It confused me a lot that when I maintain a named graph.
>
>     I stored many named graph in TDB, I can get the named graph by
> dataset.getNamedModel("model name"); or delete the named model by
> dataset.removeNamedModel("").
>
>     But when I want to add a new triple, into the named model, it does
> not work. For example, Model model = dataset.getNamedModel("model
> name"); model.add("a statement");
>
>     The statement is not found in the named model or even in the default model.~

I do this all the time and it works fine. The added statement will show 
up in the named model. It will only show up in the default model if you 
have symUnionDefaultGraph set.

If you can't get this to work then you would need to show us a complete, 
minimal example of your code.

Dave