Johannes-Gutenberg-Universität Mainz

Welcome to Black European Studies


Lost Password?

Register now!




Basic Datasources

As described in the previous section,

Mozilla provides three basic forms of datasource. These basic datasources are the in-memory-datasource, the xml-datasource

and the composite-datasource. These are described in more detail below. In addition, several datasources are provided which

are used for storing particular types of data. For example, Mozilla provides datasources for bookmarks, history, installed

search engines, mail folders and so on. Some of these datasources are actually wrappers around the three basic types. For

example, the bookmarks datasource is a wrapper around an in-memory-datasource. When a change is made to the bookmarks, it

actually ends up calling the inner in-memory-datasource to hold the data. This is done because this inner datasource has no

limitation on what kind of data it can hold. The bookmarks datasource however needs to enusre that the data entered is valid

within the context of bookmarks. Other datasources, such as the history datasource, are wrappers around other internal data

Memory Datasources

The in-memory-datasource holds all of the RDF data in memory. It is designed to be

efficient for querying and modification. This is the type of datasource that you would use for custom data that isn't loaded

from an RDF/XML file.

The memory datasource implements all of the methods of the nsIRDFDataSource interface as all

datasources do. It also implements the nsIRDFInMemoryDataSource interface which provides a

single method EnsureFastContainment. You wouldn't normally call this method yourself. It's used internally for optimizing

storage. Basically, it's used to ensure a particular resource in the datasource is stored in such a way that access to it is

faster. The tradeoff is that more memory is used. RDF containers set this automatically when they have a large number of

children, as access would be slower otherwise.
XML Datasources

The xml-datasource

is used for data loaded

from an RDF/XML file. These files may be local files or remote files stored on a web site. These datasources can be reloaded

and saved as well. Loading an RDF/XML file is as simple as calling the GetDataSource method of the RDF service. This will

load the file and parse it into a datasource. The xml-datasource is actually implemented as a wrapper around the

in-memory-datasource. This inner datasource holds the RDF data.

  • The RDF/XML file must have a HTTP content type

    of text/xml, application/xml or text/rdf.

  • Mozilla does not currently support RDF/XML sent as


  • RDF/XML sent as any other content type than the above will not load into a datasource. When

    loading datasources using the RDF service, you should always specify the absolute URL of the RDF/XML file, not a relative


RDF/XML datasources may be loaded from any type of URL. Currently, only those loaded from file URLs

(URLs that begin with 'file:') may be modified with the RDF modification APIs. One possible workaround for modifying remote

RDF sources is to load the RDF and then add the data into a separate in-memory-datasource.


© by Black European Studies 2005, provided by,
hosted by Johannes Gutenberg Universitšt Mainz, Volkswagenstiftung

Advanced Search