mulgara - semantic store

skip navigation

SHOW SITE NAV
fixed
fluid
straight

HTTP Resolver and MP3 Content Handler Tutorial

External resolvers are usually, but not always, related to parsing content from a file into data that is meaningful to Mulgara. To make it easier to resolve a file's URL (which can be of any protocol) the resolver architecture and construction of statements is split into two parts, the:

  1. Protocol resolver

    Protocol resolvers are in charge of communicating with the database via the resolver SPI.

  2. Content handler

    Content handlers convert the data supplied into statements that can be used for resolving queries against.

The purpose of this tutorial is to show you how to construct a protocol resolver and content handler, which can be used together to query an MP3 file across an http connection.

The following example queries an MP3 file for the data contained within its id3 tags:

select $subject $predicate $object
from <http://mp3server.com/mysongs/U2/Vertigo.mp3>
where $subject $predicate $object;

This query could return information like the following:

$subject $predicate $object
node_2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://mulgara.org#ID3v1>
node_2 <http://mulgara.org#comment> 'The latest hit from U2'
node_2 <http://mulgara.org#title> 'Vertigo'
node_2 <http://musicbrainz.org/mm/mm-2.1#sortName> 'U2'
node_2 <http://musicbrainz.org/mm/mm-2.1#trackNum> '1'
node_2 <http://mulgara.org#releaseYear> '2004'
node_2 <http://musicbrainz.org/mm/mm-2.1#trmid> '78'

This general query is useful for finding out everything about a single MP3 file located on a server. However, using more complex queries, it is possible to query across several MP3 files to discover information such as:

 

An RDF schema file (mp3.rdfs) is provided with the tutorial source to allow you to know the available predicates and classes to be able to construct your queries. It is located in the src/jar/content-mp3/rdfs/ directory of the your Mulgara installation.

Valid XHTML 1.0 TransitionalValid CSS 3.0!