57 Ci = Components.interfaces;
58 Cc = Components.classes;
61 function RDFHelper(aRdf, aDatasource, aResource, aNamespaces) {
68 this.Value = aResource.Value;
70 _containerUtils =
Cc[
"@mozilla.org/rdf/container-utils;1"]
71 .getService(
Ci.nsIRDFContainerUtils);
73 var createProperties =
function() {
75 if (_containerUtils.IsContainer(aDatasource, aResource)) {
77 createContainerProperties(aResource);
81 createStandardProperties(aResource);
85 var createContainerProperties =
function(resource) {
86 var container = _containerUtils.MakeSeq(aDatasource, resource);
87 var contents = container.GetElements();
92 while (contents.hasMoreElements()) {
93 var resource = contents.getNext()
94 resource.QueryInterface(
Ci.nsIRDFResource);
106 var createStandardProperties =
function(resource) {
107 var labels = aDatasource.ArcLabelsOut(aResource);
108 while(labels.hasMoreElements()) {
109 var arc = labels.getNext().QueryInterface(
Ci.nsIRDFResource)
110 createStandardProperty(arc);
114 var createStandardProperty =
function(arc) {
115 var
alias = arc.Value;
116 for (n in aNamespaces) {
117 alias = alias.replace(n, aNamespaces[n]);
126 var getResult =
function() {
128 var itr = aDatasource.GetTargets(aResource, arc,
true);
129 while(itr.hasMoreElements()) {
130 var resource = itr.getNext();
131 if (resource instanceof
Ci.nsIRDFLiteral) {
133 ary.push(resource.Value);
159 that.__defineGetter__(alias, getResult);
170 RDFHelper.help =
function(datasource, resource, namespaces) {
172 var rdf =
Cc[
"@mozilla.org/rdf/rdf-service;1"].getService(
Ci.nsIRDFService);
175 rdf.GetDataSourceBlocking(datasource),
176 rdf.GetResource(resource),
183 "http://www.w3.org/1999/02/22-rdf-syntax-ns#":
"",
184 "http://www.mozilla.org/2004/em-rdf#":
"",
185 "http://www.songbirdnest.com/2007/addon-metadata-rdf#":
""
189 "http://www.w3.org/1999/02/22-rdf-syntax-ns#":
"rdf_",
190 "http://www.mozilla.org/2004/em-rdf#":
"moz_",
191 "http://www.songbirdnest.com/2007/addon-metadata-rdf#":
"sb_"
function RDFHelper(aRdf, aDatasource, aResource, aNamespaces)
_getSelectedPageStyle s i