Re: write (assert) to an rdf file
Fxp <[email protected]> Thu, 14 May 2009 10:53:19 -0700 (PDT)
| Newsgroups | gmane.comp.mozilla.devel.rdf |
|---|---|
| Organization | http://groups.google.com |
| Message-ID | <[email protected]> |
Thank you again Neil, it works fine.
I just leave here the complete code of the function, because for the
modifications to be writen to the file, you have to use the
"nsIRDFRemoteDataSource" interface, and its "flush" method.
function addDesc(){
var datasource =3D RDF.GetDataSource("file:///F:/xampp/htdocs/
extensionFirefoxDezip/fxdatatree/chrome/content/template-guide-
photos5.rdf");
//var datasource =3D RDF.GetDataSource("chrome://fxdatatree/content/
template-guide-photos5.rdf");
var remote =3D datasource.QueryInterface
(Components.interfaces.nsIRDFRemoteDataSource);
var source =3D RDF.GetResource("http://www.xulplanet.com/ndeakin/images/
t/obelisk.jpg");
var predicate =3D RDF.GetResource("http://purl.org/dc/elements/1.1/
description");
var target =3D RDF.GetLiteral("One of the twenty or so Egyptian
obelisks");
datasource.Assert(source, predicate, target, true);
remote.Flush();
alert("done");
}
Hope this helps
Fran=E7ois