My favorites | Sign in
Project Logo
                
Search
for
Updated Nov 20, 2009 by andrewfnewman
Servers  
Local and Distributed Querying of JRDF

Local and Distributed Querying of JRDF

The server component of JRDF provides a way to expose graphs for remote querying using RESTful model.

Starting a Single Servers

To start a single local server run the SpringLocalServer Java application. This can be done by running:

java -jar jrdf-server-0.5.6.jar

The server can be view by going to port 8182 on the local machine:

http://localhost:8182/graph

This will show a list of graphs on the current machine - which will typically be empty on initialization.

To create a new graph simply go to the URI of the graph you wish to query, for example graph "foo" will be created when you go to "http://localhost:8182/graph/foo". Using a web browser, you will be presented by a HTML presentation of the resource - which is a form to allow you to submit queries to the graph.

By default, new graphs will be created under the temporary directory of your operating system under "perstGraph" subdirectory. For Windows, this will probably be "C:\temp\perstGraph" and for Unix "/tmp/perstGraph". Under this directory a file is created called "graphs.nt" this is a NTriples formatted RDF file that lists the available graphs in the system and their id (an number beginning from 1). The id references the various graph files used in the directory, for example the graph "foo" with an id of 1 will have the files "dmspo1", "ospmd1", "posmd1" and "spomd1" as well as a shared node pool/string pool file(s) in Berkley JDB (usually called "00000000.jdb"). There is more detail on the persistent graphs page.

Queries can be submitted by GETting a encoded SPARQL query. For example, the SPARQL query:

SELECT *
WHERE {
    ?s ?p ?o .
}

Is equivalent to:

http://localhost:8182/graph/foo/?query=SELECT+*%0D%0AWHERE+{%0D%0A++++%3Fs+%3Fp+%3Fo+.%0D%0A}%0D%0A++++

You can override the format of the query by submitting a query parameter called "format", for example:

http://localhost:8182/graph/foo/?query=SELECT+*%0D%0AWHERE+{%0D%0A++++%3Fs+%3Fp+%3Fo+.%0D%0A}%0D%0A++++&format=html

The current representation supported are XML and HTML with JSON to follow.

Setting up Persistent Directories and Adding Triples

The default directory handler for JRDF Graphs is the Temporary Directory handler. This can be modified in the wiring configuration by changing the "directoryHandler" bean and implementing your own "DirectoryHandler".

Currently, while the server is running the files will be locked for concurrent access. This means that while the server is running you cannot use external programs to modify them.

In the future, extensions to SPARQL and the JRDF access point will allow external programs to update the code via the web interface. An external Java API could also be added in the future.

Distributed Querying

Distributed querying in JRDF allows a single point to be used to query multiple servers at the same time and the results aggregated together.

This can be done by running:

java -jar jrdf-distributed-server-0.5.6.jar

The server can be view by going to port 8183 on the local machine:

http://localhost:8183/

This will list the configured servers to be queried at the same time. Each time the server is started the list of servers will have to be added as the list of servers is not saved.

Querying remote servers assumes that the data being queried on the whole is different on each server and there is no post processing done on the queries returned. This means, that unlike SPARQL queries against a local JRDF server, duplicates can be returned.


Sign in to add a comment
Hosted by Google Code