In Mozilla's content model, XUL documents and other interface resources are transformed into RDF when they are read. Each chunk of content is represented as a separate RDF datasource (see the next section, Section 10.2.1, for more information) and is then fed to the XUL Content Builder and rendered as the actual bits on the screen, as Figure 10-9 shows.
As you can see in Figure 10-9, the content model can be complex. The XUL documents in Figure 10-9 are files such as navigator.xul, which defines the main browser window's basic layout; the RDF documents include files like help-toc.rdf, which defines the Mozilla Help viewer's table of contents. The list of mail folders and accounts shown in Example 10-5 are part of the built-in data that Mozilla renders into browser content.
Whatever the source, the content model gets everything processed in-memory as RDF so that any data can be combined and formatted into XUL or other interface code. All sources of RDF data are called datasources.
Several datasources describe all the folders and messages in Mozilla's email. A root datasource called msgaccounts describes which mail servers and accounts are present. Separate datasources then represent each account separately. These datasources are composed to create the entire email storage system. The higher levels of this content structure look like Example 10-5.
Another example of a datasource, the in-memory-datasource, doesn't come from an actual RDF file. When an in-memory datasource is created, it doesn't contain data. However, data can be inserted into it and stored in memory until the datasource is destroyed. In-memory datasources frequently represent ephemeral data like search results. Other basic datasource types are described in Table 10-2.
Table 10-2. Types of datasources
Type |
Description |
---|---|
Local datasource |
A local datasource is an RDF graph contained in an RDF/XML file on a local disk. All RDF files in the chrome registry (e.g., all-packages.rdf in the chrome directory, which keeps track packages installed in Mozilla) are local datasources. |
Remote datasource |
RDF can be accessed locally or remotely. A remote datasource is an RDF/XML file stored on a server and accessed with a URL. |
In-memory datasource |
An in-memory datasource exists only in memory during a Mozilla session. In-memory datasources are built with assertions, statements that build an in-memory data model by adding resources, properties, and value to those. |
Built-in datasource |
These unique, prefabricated datasources represent something used often in Mozilla, such as a built-in filesystem datasource and a history datasource. |
Composite datasource |
A composite datasource may be a combination of any of the datasources previously listed. RDF allows you to merge different graphs. |