Using RDFQuery from within a Firefox extension

6 views
Skip to first unread message

Oshani Seneviratne

unread,
Jun 9, 2010, 4:25:18 PM6/9/10
to rdfq...@googlegroups.com
Hi all,

I am trying to use RDFQuery from a Firefox extension. It works, but
there's a problem. I am not sure if this is a bug with RDFQuery or a
problem with the way I give the context for JQuery. I would really
appreciate if someone can let me know if it is indeed a bug in
RDFQuery or a problem with setting the correct context or if it is
something else entirely.

Here's the extremely simplified version of my code:

************************************************************

//Setting up the correct context because it is run from an extension
jQuery.noConflict();
$ = function(selector,context){ return new
jQuery.fn.init(selector,context||window.content.document); };
$.fn = $.prototype = jQuery.fn;

//Getting the RDFa out of the page HTML
var data = $('html').rdf()
.where('?s ?p ?o')
.each(function(){

dump(this.s.value+"\t"+this.p.value+"\t"+this.o.value)
});

************************************************************

The above code gives me triples like:

<chrome://browser/content/browser.xul> <http://property1> <http://object1>
<chrome://browser/content/browser.xul> <http://property2> <http://object2>
...

The question is, these triples are not exactly the triples found in
the page. The subject (<chrome://browser/content/browser.xul>) in all
of these triples are wrong; it should give an HTTP URI--the
properties, objects and everything else appear to be correct.

Any idea why this is happening?

Thanks,
Oshani

Stéphane Corlosquet

unread,
Jun 9, 2010, 4:35:14 PM6/9/10
to rdfq...@googlegroups.com
Oshani,

Does your page explicitly define any subject via the @about attribute anywhere? Or do you rely on the URL of the document or some base element to be considered as (parent) subject?

Steph.


--
You received this message because you are subscribed to the Google Groups "rdfQuery" group.
To post to this group, send email to rdfq...@googlegroups.com.
To unsubscribe from this group, send email to rdfquery+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rdfquery?hl=en.


Oshani Seneviratne

unread,
Jun 9, 2010, 5:50:39 PM6/9/10
to rdfq...@googlegroups.com
Thanks Steph. You made me realize that it was a bug in my code :).
There is no @about for the subject in the documents I was looking at.
So, the subject should refer to the URL of the document. Setting the
context to the chrome level had made rdfquery to correctly think that
the the chrome window URL is the subject.

Case closed.

Thanks,
Oshani

Reply all
Reply to author
Forward
0 new messages