View Source

h1. Overview

GraphDB 6.4 introduces support for SPARQL-MM, a multimedia-extension for SPARQL 1.1. The implementation is based on code by Thomas Kurz.

h1. Installation

The SPARQL-MM support is implemented as a GraphDB plugin, which is currently not enabled by default. To enable the plugin follow these steps:

# Locate the plugin {{zip}} file in the {{plugins/sparql-mm}} folder of the GraphDB distribution.
# Unzip the file into your plugins directory (by default {{root of unpacked web app}}/WEB-INF/classes/plugins}}.

h1. Usage examples

h5. Temporal Relations
{noformat}
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX mm: <http://linkedmultimedia.org/sparql-mm/ns/1.0.0/function#>

SELECT ?t1 ?t2 WHERE {
?f1 rdfs:label ?t1.
?f2 rdfs:label ?t2.
FILTER mm:precedes(?f1,?f2)
} ORDER BY ?t1 ?t2
{noformat}

h5. Temporal Aggregation
{noformat}
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX mm: <http://linkedmultimedia.org/sparql-mm/ns/1.0.0/function#>

SELECT ?f1 ?f2 (mm:temporalIntermediate(?f1,?f2) AS ?box) WHERE {
?f1 rdfs:label "a".
?f2 rdfs:label "b".
}
{noformat}

h5. Spatial Relations
{noformat}
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX mm: <http://linkedmultimedia.org/sparql-mm/ns/1.0.0/function#>

SELECT ?t1 ?t2 WHERE {
?f1 rdfs:label ?t1.
?f2 rdfs:label ?t2.
FILTER mm:rightBeside(?f1,?f2)
} ORDER BY ?t1 ?t2
{noformat}

h5. Spatial Aggregation
{noformat}
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX mm: <http://linkedmultimedia.org/sparql-mm/ns/1.0.0/function#>

SELECT ?f1 ?f2 (mm:spatialIntersection(?f1,?f2) AS ?box) WHERE {
?f1 rdfs:label "a".
?f2 rdfs:label "b".
}
{noformat}

h5. Combined Aggregation
{noformat}
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX mm: <http://linkedmultimedia.org/sparql-mm/ns/1.0.0/function#>

SELECT ?f1 ?f2 (mm:boundingBox(?f1,?f2) AS ?box) WHERE {
?f1 rdfs:label "a".
?f2 rdfs:label "b".
}
{noformat}

h5. Accessor Method
{noformat}
PREFIX ma: <http://www.w3.org/ns/ma-ont#>
PREFIX mm: <http://linkedmultimedia.org/sparql-mm/ns/1.0.0/function#>

SELECT ?f1 WHERE {
?f1 a ma:MediaFragment.
} ORDER BY mm:duration(?f1)
{noformat}

h1. More information

# [The SPARQL-MM Specification|http://mayor2.dia.fi.upm.es/oeg-upm/files/eswc2014/Posters%20and%20Demonstrations/eswc2014pd_submission_65.pdf]
# [List of SPARQL-MM functions|https://github.com/tkurz/sparql-mm/blob/master/ns/1.0.0/function/index.md]