Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


Storing and Using RDF in Mulgara : Page 2

The semantic web is about machine-processable metadata. As you accumulate this information, where do you plan on putting it, and how do you plan on accessing it? Check out this open source solution.

The Mulgara Semantic Store is an open source project that is a 100% Pure Java-based RDF quad store. It is scalable, supports transactions, and has a pluggable resolver architecture allowing you to interface with non-RDF data sources from within the RDF model. Mulgara currently supports hundreds of millions of triples within a single database instance, while maintaining decent query and storage performance.

Although Mulgara presently supports only Remote Method Invocation (RMI) and SOAP-based access, the developers are adding a RESTful interface to make it easier to use with other languages, tools, and platforms. The current Mulgara version 1.1 download was released recently and should be the basis of any investigation because it adds several features and bug fixes over earlier releases. After unpacking the release, use this command to run Mulgara:

java -jar mulgara-1.1.0.jar

You'll see a bunch of text scroll (see Figure 1). Take note of the last statement about the aliases for the server:

2007-08-14 22:22:52,313 INFO Database - Host name aliases for this server are: [HarryHood.local, localhost,,]

If you're going to start Mulgara on a machine that has a name that might change (for example, a notebook that hops on different networks), you'll want to bind the server instance to a predictable name because of the presence of the machine name in the model definition. This issue will be resolved in the next version but remains a difficulty for the time being. To bind the server to a particular hostname, enter:

java -jar mulgara-1.1.0.jar -k localhost -o localhost

This command binds the server name instance to the name localhost and establishes the server name to which HTTP requests will respond. If you want people on other machines to access your Mulgara instance, do not use localhost; choose either a valid name or the IP address (assuming it is not DHCP-assigned). Whatever name you use, substitute it for localhost in all of the examples here.

You can test your configuration by browsing to http://localhost:8080/webui, which takes you to a convenient test web application.

Figure 1. Unpack Mulgara: If you start Mulgara on a machine that has a name that's likely to change, you need to bind the server instance to a predictable name.

In the Mulgara test web application, insert triples into a model. Models provide ways of organizing RDF statements. (You may be wondering why you're putting triples into Mulgara if it is a quad store. The fourth element of the quad is the model name). To create a model you can do one of two things.

  1. Type in the Query Text field:

create <rmi://localhost/server1#devx>;

and then select the Submit Query button. You should see a result message that says something like:

Successfully created model rmi://localhost/server1#devx

  1. You can modify the Model URI text field to be rmi://localhost/server1#devx, and select "Step 1. Create a model" from the Example Queries menu to populate the query text, after which you can select the Submit Query button.

After creating the model, insert some RDF triples into it:

insert <user:brian> <foo:hasValue> '1' into <rmi://localhost/server1#devx>; insert <user:brian> <foo:hasFavoriteColor> 'blue' into <rmi://localhost/server1#devx>; insert <user:david> <foo:hasValue> '7' into <rmi://localhost/server1#devx>;

You should see some indications of successful insertions into the model. You've defined three statements referring to two URI subjects and two URI predicates. In general, you'll probably use terms from an existing vocabulary like Dublin Core rather than fake ones, which might look like this:

insert <http://myserver.com/somepage.html> <http://purl.org/dc/elements/1.1/title> 'My Cool Webpage' into <rmi://localhost/server1#devx>;

If you find that you have a lot of redundancy in your terms, you might benefit from using the alias command:

alias <http://purl.org/dc/elements/1.1/> as dc; insert <http://myserver.com/someotherpage.html> <dc:title> 'My Other Cool Webpage' into <rmi://localhost/server1#devx>;

Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date