Resolvers and Content Handlers¶
Mulgara is capable of querying any type of data source by using Resolvers. Resolvers accept and process queries against data contained in a file, a database or some other data source. In most cases, the data being queried against is not in a meaningful format (that is, it is not RDF) so the resolver must convert the data first. Whether this is done by parsing the contents of a file, or converting rows of a database, it is left up to the inner workings of the resolver.
The resolver architecture is a query layer that sits between the Mulgara transport and storage layers. All resolvers are pluggable. That is, you can write new resolvers that cater for new protocols or file types, or provide a bridge to a particular store in the storage layer.
The resolver architecture consists of three layers, which are the:
1. Resolver API
2. Resolver SPI (service provider interface)
3. Content SPI
The Resolver SPI and Content SPI are of interest to developers who want to incorporate new stores or file types into the query layer, or to modify existing ones. The Resolver API is of interest to developers who want to interface with the query layer.
Queries passed to a Resolver API contain:
- A list of variables to find
- The data store URI to query from
- A set of constraints to limit the number and content of triples returned
The Resolver API first checks if the data store URI is stored as a Mulgara graph. If it is, the query is resolved against the internal resolver associated with that graph. Otherwise the scheme of the data URI is used to look up a resolver that handles that scheme, for instance, http: or file:.
If a resolver identifies a file instead of triples (as is the case with RDF/XML and N3 files), then a Content Handler is automatically selected to convert the file into triples. The type of content handler selected is determined by the MIME type of the file, or the file extension, if no MIME type is available.
Once the constraints are resolved, they are collapsed until only the tuples containing the required variables remain. The results are passed back to the API to be passed across the transport layer.
Mulgara provides resolvers and content handlers for querying different types of data stores, including:
- Local and remote Mulgara data stores
- Files referenced through URLs using the file: and HTTP: protocols
- RDF/XML files
- N3 files
- MBox files
- MP3 files
- JDBC stores, through D2RQ
- RLog program files
See the MP3 Resolver Tutorial section for information on how to develop your own resolvers.