For your convenience, I pasted together the first lines of both API
mentioned:

// Make a TDB-backed dataset
String directory = "MyDatabases/Dataset1" ;
Dataset dataset = TDBFactory.createDataset(directory) ;
dataset.begin(ReadWrite.READ) ;
// Get model inside the transaction
Model model = dataset.getDefaultModel();
 //// paste from basic RDF API
Model model2 = ModelFactory.createDefaultModel();

 String inputFileName = "f";
// use the FileManager to find the input file
 InputStream in = FileManager.get().open( inputFileName  );
if (in == null) {
    throw new IllegalArgumentException(
             "File: " + inputFileName + " not found");
}

// read the RDF/XML file
model2.read(in, null);
* model.add(model2);*
////////
dataset.end();


2014-01-29 Jean-Marc Vanel <[email protected]>

> Cher Frédéric,
>
> You just have to use the basic RDF API :
> http://jena.apache.org/tutorials/rdf_api.html
>
> with the TDB API :
> http://jena.apache.org/documentation/tdb/java_api.html
>
> Note that "update nodes" is not the right wording for what happens.
> An RDF model is bascally a collection of triples.
> So adding
> <a> <p> <o2> .
>
> to a model that contains already:
> <a> <p> <o1> .
>
> will not "update" <a> ;
> there is just one more triples having <a> as subject.
>
>
>
> 2014-01-29 Frederic Toublanc <[email protected]>
>
> Hello there,
>>
>> Here is my question.
>>
>> I have an existing TDB containing triples.
>> I have a RDF file and i want to update the existing TDB with the data
>> contained in the RDF file.
>> If nodes already exist they should be updated and new data added.
>>
>> Is it possible to do it with the Jena API ?
>>
>
>
>
> --
> 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

Reply via email to