Search completed in 1.20 seconds.
8 results for "nsirdfdatasource":
Aggregating the In-Memory Datasource
Mozilla › Tech › XPCOM › Aggregating the In-Memory Datasource
Introduction You can use XPCOM aggregation1 with the in-memory datasource. Why would you want to do this? Say you were writing a datasource2, and the way you chose to implement it was to "wrap" the in-memory datasource; i.e., MyClass : public nsIMyInterface, public nsIRDFDataSource { private: nsCOMPtr<nsIRDFDataSource> mInner; public: // nsIRDFDataSource methods NS_IMETHOD Init(const char* aURI) { return mInner->Init(aURI); } NS_IMETHOD GetURI(char* *aURI) { return mInner->GetURI(aURI); } // etc., for each method in nsIRDFDataSource! }; Very painful, prone to errors, and fragile as the interfaces are still in flux (a wee bit). Aggregation to the rescue! Here are the gory details on how. When It Won't Work Although this magic is terribly convenient to u...
...In short, the only case where this technique is useful is when you're implementing a datasource to get "read-only reflection". That is, you want to reflect the contents of something as an RDF graph (presumably so that it can be aggregated with other information or displayed as styled content). Technical Details As before, have an nsCOMPtr as your delegate, but this time around,don't derive from nsIRDFDataSource. Also, instead of keeping an nsCOMPtr<nsIRDFDataSource>, you'll just want an nsCOMPtr<nsISupports>: class MyClass : public nsIMyInterface { ... private: nsCOMPtr<nsISupports> mInner; }; Construct the datasource delegate when your object is constructed (or, at worst, when somebody QI's for it): rv = nsComponentManager::CreateInstance( kRDFInMemoryDataSourceCID, this, /*...
...efs(mInner)); Note passing this as the "outer" parameter. Now, if the in-memory datasource's implementation of QueryInterface() fails because it doesn't support the requested interface, it willforward the query interface to its "outer" (which is "us"). This preserves the symmetrical property of QueryInterface(). ...
...And 3 more matches
RDF in Mozilla FAQ - Archive of obsolete content
Archive › Web Standards › RDF in Mozilla FAQ
var remote = ds.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource); // Be sure that your web server will deliver this as text/xml (recommended) or text/rdf! remote.Init("http://www.mozilla.org/some-rdf-file.rdf"); // Make it load! Note that this will happen asynchronously. By setting...
...ink = ds.QueryInterface(Components.interfaces.nsIRDFXMLSink); // Attach the observer to the datasource-as-sink sink.addXMLSinkObserver(Observer); // Now Observer's methods will be called-back as // the load progresses. } Note that the observer will remain attached to the RDF/XML datasource unless removeXMLSinkObserver is called. How do I access the information in a datasource? The nsIRDFDataSource interface is the means by which you access and manipulate the assertions in a datasource. boolean HasAssertion(aSource, aProperty, aTarget, aTruthValue). This tests the datasource to see if it has the specified tuple. nsIRDFNode GetTarget(aSource, aProperty, aTruthValue). nsISimpleEnumerator GetTargets(aSource, aProperty, aTruthValue). nsIRDFResource GetSource(aProperty, aTarget, aTruthVa...
...ill attempt to write the contents of the datasource back to the URL from which they were loaded, using a protocol specific mechanism (e.g., a file: URL just writes the file; an http: URL might do an HTTP-POST). Flush() only writes the datasource if its contents have changed. How do I merge two or more datasources to view them as one? Use nsIRDFCompositeDataSource. This interface is derived from nsIRDFDataSource. An implementation of this interface will typically combine the statements from several datasources together as a collective. Because the nsIRDFCompositeDataSource interface is derived from nsIRDFDataSource, it can be queried and modified just like an individual data source. How do I access "built-in" datasources? A built-in datasource is a locally-installed component that implements nsIRDFData...
...And 2 more matches
RDF Datasource How-To - Archive of obsolete content
Archive › Mozilla › RDF Datasource How-To
of effort. There are several existing vocabularies of note, including: The RDF Schema Specification. This vocabulary is a "meta vocabulary" that is used to specify other vocabularies. The Dublin Core. This vocabulary is useful for describing electronic resources. It contains elements for authorship, subject, publication date, etc. Mapping your data to nodes and arcs [write me!] Implementing the nsIRDFDataSource interface Your first chore will be to implement the nsIRDFDataSource interface. There are basically two approaches that you can take in this endeavor: Delegate to an inner proxy. For example, you may choose to delegate to the in-memory datasource, which is a generic datasource that implements nsIRDFDataSource. Typically, you provide a parser for reading in some sort of static storage (e.g., a d...
... like this, look at the RDF/XML datasource or the bookmarks datasource. You may want to choose this implementation if your primary goal is to "wrap" a legacy data store. This implementation may cause problems if your data store can be modified "on the fly" by other agents. Aggregate the in-memory datasource. This is an extreme case of delegation, where you use XPCOM aggregation to implement the nsIRDFDataSource interface. See Aggregating the In-Memory Datasource for technical details. If you take this approach, you won't be able to selectively implement methods of the nsIRDFDataSource interface; instead, all of the methods will be "forwarded" to the in-memory datasource. This can be useful if your datasource is "read-only", and you aren't worried about modification using Assert(), etc. Implement the i...
...urce. This value, when prefixed with "rdf:", is a datasource identifier, and may be used with nsIRDFService::GetDataSource() to retrieve your datasource from the RDF service. For example, the above datasource would be accessable as follows: nsIRDFService* rdf; rv = nsServiceManager::GetService(kRDFServiceCID, kIRDFServiceIID, (nsISupports**) &rdf); if (NS_SUCCEEDED(rv)) { nsIRDFDataSource* myDataSource; rv = rdf->GetDataSource("rdf:my-datasource", &myDataSource); if (NS_SUCCEEDED(rv)) { // ...do something to myDataSource here... NS_RELEASE(myDataSource); } nsServiceManager::ReleaseService(kRDFServiceCID, rdf); } Displaying RDF as content Now that you've gone through all this pain to expose your information as a datasource, you pro...
A bird's-eye view of the Mozilla framework
Mozilla › Bird s Eye View of the Mozilla Framework
es a required layer for XPCOM components written in a scripting language. Let's consider a Resource Description Framework (RDF) example, where RDF is a framework for describing and interchangingmetadata, that is, information about information. In this example, we're interested in the RDF sub-graph underlying theContents Panel widget within theHelp Viewer window. Suppose the client already has an nsIRDFDataSource object representing a sub-graph of an RDF graph and calls nsIRDFDataSource.GetTarget(resource, NC_LINK, true) to obtain an nsIRDFNode representing a specific node in the graph, in this case a link to aHelp Viewer document page. The client is completely unaware of which C++ class (or other language) actually implements nsIRDFNode; it only interacts with the IDL interface. The client would like to...
...el. var tocTree = document.getElementById("help-toc-panel"); The document object is a XULDocument, and tocTree is theContents Panel XULElement. Using the database attribute of the XULElement, getLink() obtains an nsIRDFCompositeDataSource, which presents the individual datasources of the XULElement as a single RDF graph. var tocDS = tocTree.database; NsIRDFCompositeDataSource inherits from nsIRDFDataSource. Help.js declares an nsIRDFService as a compile time constant at the beginning of the file. const RDF = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService); The Components object is made available to JavaScript via XPConnect; it serves as a bridge connecting JavaScript and XPCOM. getLink() uses the nsIRDFService to obtain an nsIRDFResource fo...
... = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService); The Components object is made available to JavaScript via XPConnect; it serves as a bridge connecting JavaScript and XPCOM. getLink() uses the nsIRDFService to obtain an nsIRDFResource for the requested link. var resource = RDF.GetResource(rdfID); nsIRDFCompositeDataSource inherits from nsIRDFDataSource, which supports a GetTarget() method for obtaining the nsIRDFNode for a given resource and property. var link = tocDS.GetTarget(resource, NC_LINK, true); Now that getLink() has the nsIRDFNode for the link, it can call QueryInterface() to check whether the nsIRDFLiteral is supported. link = link.QueryInterface(Components.interfaces.nsIRDFLiteral); If nsIRDFLiteral is supported, getLink() u...
Enhanced Extension Installation - Archive of obsolete content
Archive › Add-ons › Enhanced Extension Installation
or special Extension System handling of the -register command line flag, so support for that has been removed. Datasource Structure Since there is now only a single RDF/XML datasource for storage of all installed items, the staggered datasource structure used by Firefox 1.0 and the use of an internal composite datasource is no longer required. The Extension System retains an object implementing nsIRDFDataSource (so that it can supply special properties in addition to the set stored simply in the XML datasource) and an internal member that holds the single RDF/XML datasource. Properties are read and are written directly to this, there are no shims. Tracking Install Locations Since there is now only a single datasource, Install Location information is tracked for every item in the single datasource in t...
XUL Template Primer - Bindings - Archive of obsolete content
Archive › Mozilla › XUL › XUL Template Primer - Bindings
bject does this: the value for the ?addr variable is computed by the first <binding> The predicate must name the URI of an RDF property, in this case, nc:address. The object must name a variable. The value of the object's variable will be computed by invoking the GetTarget() method using the object's value as the aSource argument, and the predicate's resource as the aProperty argument. (See the nsIRDFDataSource interface for more details.) In our example, the <rule> will be instantiated three times: once each for Alison, Jack, and Lumpy. However, in Lumpy's case, we won't be able to bind the ?addr variable because Lumpy has no home! (Well, there are no statements with Lumpy as the subject and a nc:address as the predicate, anyway.) Nevertheless, the rule still matches. In the content that's built for ...
nsIDownloadManager
Mozilla › Tech › XPCOM › Reference › Interface › nsIDownloadManager
ctiveDownloadCount long The number of files currently being downloaded. Read only. activeDownloads nsISimpleEnumerator An enumeration of active nsIDownloads. Read only. canCleanUp boolean Whether or not there are downloads that can be cleaned up (removed) that is downloads that have completed, have failed or have been canceled. Read only. datasource nsIRDFDataSource Read only. Obsolete since Gecko 1.8 DBConnection mozIStorageConnection The database connection to the downloads database. Read only. defaultDownloadsDirectory nsILocalFile Returns the platform default downloads directory. Read only. listener nsIDownloadProgressListener The Download Manager's progress listener. Obsolete since Gecko 1.8 use...
nsIXULTemplateQueryProcessor
Mozilla › Tech › XPCOM › Reference › Interface › nsIXULTemplateQueryProcessor
ate to compile the queries. When results need to be generated, the builder will call generateResults(). The initializeForBuilding(), compileQuery() and addBinding() methods may not be called after generateResults() has been called until the builder indicates that the generated output is being removed by calling the done() method. Currently, the datasource supplied to the methods will always be an nsIRDFDataSource or a DOM node, and will always be the same one in between calls to initializeForBuilding() and done(). Method overview void addBinding(in nsIDOMNode aRuleNode, in nsIAtom aVar, in nsIAtom aRef, in AString aExpr); PRInt32 compareResults(in nsIXULTemplateResult aLeft, in nsIXULTemplateResult aRight, in nsIAtom aVar, in unsigned long aSortHints); nsISupports compileQuery(in nsIXULTemplateBuil...