On 29/05/13 05:57, Faisal Sarfraz wrote:
hi Stefan
Thanks for your message but i am stuck in here. My scenario is different as
i have to use some database values to be used as values in property.
i have a scenario in which under a same project URI, there will be repeated
values of 3 selected properties.
like a project ABC, for which i have different code files and these all
will have to be placed in rdf under URIhttp://somewhere/ABC

please suggest if you understand my wording

If you want to update the file after writing, then read it back in (if you don't have "model" around e.g. another program), make the changes to the model and write back out.

You can also use SPARQL Updare.

What you can't do is modify parts of the file in-p-lace with the Jena API. RDF/XML files are not like databases.

You must either

1/ Use a database (e.g. TDB) to store the RDF
or
2/ read-in, modify, write out.

        Andy



On Wed, May 29, 2013 at 9:13 AM, Stefan Scheffler <
[email protected]> wrote:

Hi,
You can read in the file as a new model, make your changes and write it
out like you do in the source code you posted(mke shure you closed the
filehandler before writing it out again). This will overwrite the existing
file with the changes.
By the way you also can update the existing model and write it out. This
will have the same effect.

Regards
Stefan

Am 29.05.2013 03:27, schrieb Faisal Sarfraz:

  Hi All
I am new to jena. I am trying to update RDF file which is placed
externally. Currently i am using this code to write it

String fileName = "details.rdf";
          FileWriter out = new FileWriter( fileName );
          try {
              model.write( out, "RDF/XML-ABBREV" );
          }
          finally {
             try {
                 out.close();
             }
             catch (IOException closeException) {
                 // ignore
             }
          }

this is writing it to external file now i want to update it after certain
changes. is there a way?
Please help





Reply via email to