Firefox Extension for Semantic Annotation

From AIRWiki

Jump to: navigation, search
Firefox Extension for Semantic Annotation
Corresponding Proposal: A firefox extension for semantic annotations
Coordinator: DavideEynard (
Tutor: DavideEynard (, DavidLaniado (, RiccardoTasso (
Students: VanVungPham (
Research Area: Social Software and Semantic Web
Research Topic: Semantic Annotations
Start: 2009/10/30
End: 2010/02/15
Status: Closed
Level: Ms
Type: Course




In every area of software development, the ease in extensibility and efficiency of the development is always a practical issue, especially in the world of JavaScript which is difficult to debug when things go wrong. Furthermore, it is always a benefit of having a generic methodology which allows the developers to develop applications in a declarative way using RDF technologies.

In this AIRLab project I would like to present a methodology which tries to satisfy the mentioned requirements. This methodology will present the development steps, design architectures, and technologies in development of extensible Firefox extension for Semantic Annotations.

The report first analyzes the generic components of Firefox extensions for semantic annotations to have clear idea of steps that should be followed to develop an extension providing semantic annotation functionalities. Basing on this analysis, the code for the generic components is implemented. Then later the programmers can just declaratively describe the components, using RDF technologies, and the code will automatically generate them based on the developers’ descriptions.

The report will next describes about each of the components, how they are described in RDF and how to use them in JavaScript code if needed.

For the developers who would like to extend this framework, there is also a part describing the coding ideas of this development methodology and the possible extensions of this project.

Development Architecture

Development architecture of this Firefox Extension for Semantic Annotations is depicted as follows:


For detail explanation of the architecture please refer to the PDF version of the report in the Downloads section.


PDF of the Report

The developed extensions

Sample Joseki configuration file



The installation platform was tested in Windows Vista, Windows XP and Ubuntu 9.10. There are two versions of this, one for Windows and another for Linux. The Linux version is only different from that for Windows by changing the “\\” to “/” in some parts of the code for file/directory paths. There is a readme.txt file inside each of the folder.

1. Install MySQL (

2. Create a database named "annotationdb", or any other name as long as you will change it in the file to reflect this.

3. Install Joseki (tested version is 3.4.1) - (

4. Add the data store (the database created) and setup the sparql read endpoint (read action) and the sparql update endpoint (update action) (please refer to file to see an example about setting up the enpoints to use MySQL DB as RDF Store).

5. In the sample file ( the lines starting from line 172 to the end are the setup used to set the RDF data store to "annotatiodb" database in MySQL Server (localhost). The read action is "sparql/myproject/read", and the update action is "sparql/myproject/update"

6. Install the *.xpi, the is for Window version and is for Linux version.

7. If you changed your joseki host (currently http://localhost:2020/), or your read action (currently "sparql/myproject/read"), or your update action (currently "sparql/myproject/update"), or the default user name (currently You will need to change this default options after installing the add-on. The add-on dialog (In Firefox: Toos > Add-ons). In our add-on there is an Options Button(for Window) Preferences Button (for Linux), you can click on that and change your host, read action, update action, and user, correspondingly.


We kept the application reasonably simple, since the idea is to demonstrate functional flexibility of this extension for semantic annotation. The extension is a reasonably flexible and extensible Firefox extension. However, the part that would be kind of trouble is it takes little time to initialize the extension when Firefox is loaded, due to the “eager” loading manner (not “lazy” loading). At the first time the menu is loaded into Firefox browser, the extension starts to read the RDF setting files to create all the objects for menus, menu items, menu popup, queries, functions, etc and these would take time. Therefore, user may experience a little slow performance at the first time user loads the menu (when user hovers the Semantic Annotation menu).

The good thing is that this loading will appear only once and the program will be executed faster since all the objects are loaded and ready. The “lazy” loading method may let user see the program is loaded quickly. However, it would be slow at runtime due to the need of loading objects at run-time.

Development resources

JavaScript Function (Object)

The main development idea started from the possibility to create new Function (Object in JavaScript) from its string descriptions.

"Function - MDC"

Loading local files with Firefox

In this extension we need to load the local files from local disk of computer which is running Firefox browser.

This uses Firefox nsILocalFile interface.

JavaScript RDF Parser

This is an RDF Parser which we use to parse RDF setting file. "Hercules RDF Library in JavaScript: SPARQL Engine Demo"

RDF Server

Joseki - A SPARQL Server for Jena


Only the Tagging Ontology and its design decisions are used in this development. The other two ontology are put here as references.

"Tagging Ontology"

"Ratings Ontology"

"Sioc Ontology”


"SPARQL Protocol for RDF",

"SPARQL Query Language for RDF"