rdf: how it works with nglayout
Last Updated: 29-November-1998
Overview
NGLayout can read and display RDF/XML by applying CSS2 style sheets to the RDF content after it has been converted into a tree. Furthermore, the content of the RDF/XML can refer to other RDF data sources. This document describes in detail how NGLayout handles RDF/XML content.
Identifying and Parsing RDF
Netlib is primarily responsible for identifying content as RDF. With HTTP data, a MIME type of text/rdf will trigger the RDF/XML parser. With FTP and local file system data, a .rdf file extension triggers the RDF/XML parser.
Content that is identified as text/rdf causes the document loader nsDocLoader to construct an RDF document object, nsRDFDocument. When the document is instructed to load via the StartDocumentLoad method, it creates an RDF-specific content sink object, nsRDFContentSink. The content sink is controlled by the vanilla XML parser, nsWellFormedDTD.
Constructing an In Memory Graph
As content streams in and is processed by the nsWellFormedDTD parser, the nsRDFContentSink is notified as open- and close-tags are encountered. The content sink inspects the tags and produces an in-memory representation of the RDF graph described by the XML using an nsMemoryDataSource object. The nsRDFDocument maintains an nsIRDFDataBase to which the nsMemoryDataSource is attached. This allows the RDF graph described in the RDF/XML document to be integrated with other RDF data sources.
Constructing a Content Model
The document's content model is constructed using nsRDFElement objects. Each nsRDFElement corresponds to a single node in the RDF graph. Initially, the nsRDFContentSink creates a single nsRDFElement for the first object it encounters in the serialized RDF/XML. It sets this element to be the document root. The remainder of the document model is constructed on-demand. When first asked for its children, an nsRDFElement will examine the arcs that lead out of the node to which it corresponds in the RDF graph. It will construct a new nsRDFElement object for each child.
Typically, the frame model recursively traverses the entire content model to build up its frame representation. We will need to ensure that an nsRDFElement only creates children if it is "open". This will prevent the frame model from traversing the entire RDF graph.
Child generation is currently somewhat ad hoc. Specifically, ...
An nsRDFElement's "tag" is generated by ...
Manipulating the Content Model with the DOM
Like all NGLayout content, the RDF content model can be manipulated using the DOM. Each nsRDFElement object implements the standard Level 1 Core DOM interfaces that allow the RDF graph to be explored and manipulate like a tree-structured document.
Furthermore, each nsRDFElement implements event handling interfaces ...
Notes and Open Issues
Using the content model with widgets. XSL...