Re: Combine two RDF datasets

Mark <[email protected]> Mon, 02 Feb 2009 15:02:14 -0500
Newsgroups gmane.comp.mozilla.devel.rdf
Message-ID <[email protected]>
Guys thanks for your answers but the issue is, I cannot use a composite 
datasource, since I later need to save the contents of all datasets in 
one single file.  That cannot be done with a composite datasource AFAIK.

The idea is as following. At startup, my extension reads an RDF file. 
During execution, I need to add triples, and when TB shuts down, I 
simply need to dump the xml-datasource to the file (Flush method).

Surely, I can read the whole file at startup in an in-memory dataset and 
manage that as well, but that means that I have to manually save the 
whole file once in a while. The Flush method only does the saving if 
there was a change, and that also occurs automatically when the dataset 
is no longer referenced. Doing things manually can be more costly.

My question is, how can I add triples incrementally to the XML-file 
datasource, after parsing such triples from a string, or does that only 
work with an in-memory dataset?

I am targeting TB 1.5

Thanks in advance


Neil wrote:
> Axel Hecht wrote:
> 
>> You want to put your xml datasource into a composite datasource, and 
>> add your in-memory one to the composite one. The composite datasource 
>> well then have the triples of both, live, as it just wraps both.
> 
> Also note that whenever you use an RDF template you get a composite 
> datasource for free, so to speak.
>