Friday, 21. May 2004

Mozilla RDF Javascript support

Part II of the seriesdiving into Mozilla.

Simple XUL example

To get going with RDF in Mozilla, it is good to make a Hello World-kind of Application. I did this by the way of "jslib", a javascript library that helps Mozilla developers.

Step1 - Download and Install jslib
from http://jslib.mozdev.org/downloads/index.html
and install it in your mozilla (it is a XPI, so no problem there)
Test the library by opening this url: chrome://jslib/content/
see also installation doc.

Step2 - write a XUL file to test
I did it with this ugly file that extracts the firstname from my public FOAF file: rdflib_hello (xul, 1 KB).

Step3 - configure it to run
The problem is that the XUL file must be placed where XUL files are usually placed. If you know how to do this, fine. If you don't, you have to configure jslib so that it accepts files outside the chrome. This may be a security risk. Description to use jslib from local XUL files.

Step4 - run rdflib_hello.xul
Start Mozilla, go to "open file" and open the XUL file (or use chrome:// if you managed to put it in your chrome).
You should see a single button. Press it and the String "Leo" should come.

What it does:
It loads my foaf file from my public homepage and extracts a literal property from a resource. To do this, there are fine XPCOM objects in Mozilla. But the XPCOM are hard to use, so the jslib guys made this system of Javascript helper objects to handle RDF. The script loads these jslib functions. Then, in the function testresult(), it uses an RDF object to get the RDF data from the homepage, select a resource from it and query an attribute of the resource.

You can also use the XPCOM RDF objects directly. So, at first glance Mozilla proves to be RDF-capable.
QR barcode by i-nigma.com/CreateBarcodes

Trackback URL:
http://leobard.twoday.net/stories/223480/modTrackback

icon

semantic weltbild 2.0

Building the Semantic Web is easier together

and then...

foaf explorer
foaf

Geo Visitors Map
I am a hard bloggin' scientist. Read the Manifesto.
www.flickr.com
lebard's photos More of lebard's photos
Skype Me™!

Search

 

Users Status

You are not logged in.

I support

Wikipedia Affiliate Button

Archive

May 2004
Sun
Mon
Tue
Wed
Thu
Fri
Sat
 
 
 
 
 
 
 1 
 2 
 4 
 5 
 6 
 7 
 8 
 9 
10
12
13
14
15
16
18
22
23
24
25
26
27
28
29
30
 
 
 
 
 
 

Credits

vi knallgrau GmbH

powered by Antville powered by Helma


Creative Commons License

xml version of this page
xml version of this page (with comments)

twoday.net AGB


austriaca
Chucknorrism
digitalcouch
gnowsis
Jesus
NeueHeimat
route planning
SemWeb
travel
zoot
Profil
Logout
Subscribe Weblog