SML Mapping Syntax:

A Sparqlification Mapping Language (SML) configuration is essentially a set of CREATE VIEW statements, somewhat similar to the CREATE VIEW statement from SQL. Probably the easiest way to learn to syntax is to look at the following resources:

Two more examples are from

Additionally, for convenience, prefixes can be declared, which are valid throughout the config file. As comments, you can use //, /* */, and #.

For a first impression, here is a quick example:

/* This is a comment
 * /* You can even nest them! */
// Prefixes are valid throughout the file
Prefix dbp:<>
Prefix ex:<>

Create View myFirstView As
    Construct {
        ?s a dbp:Person .
        ?s ex:workPage ?w .
    ?s = uri('', ?id) // Define ?s to be an URI generated from the concatenation of a prefix with mytable's id-column.
    ?w = uri(?work_page) // ?w is assigned the URIs in the column 'work_page' of 'mytable'
    ?w prefix "" // Constraints can be used for optimization, e.g. to prune unsatisfiable join conditions
    mytable; // If you want to use an SQL query, the query (without trailing semicolon) must be enclosed in double square brackets: [[SELECT id, work_page FROM mytable]]

Notes for sparqlify-csv

For sparqlify-csv view definition syntax is almost the same as above; the differences being:

Colums can be referenced either by name (see the -h option) or by index (1-based).


// Assume a CSV file with the following columns (osm stands for OpenStreetMap)
(city\_name, country\_name, osm\_entity\_type, osm\_id, longitude, latitude)

Prefix fn:<> //Needed for urlEncode and urlDecode.
Prefix rdfs:<>
Prefix owl:<>
Prefix xsd:<>
Prefix geo:<>

Create View Template geocode As
  Construct {
      owl:sameAs ?lgdUri .

      rdfs:label ?cityLabel ;
      geo:long ?long ;
      geo:lat ?lat .
    ?cityUri = uri(concat("", fn:urlEncode(?2), "-", fn:urlEncode(?1)))
    ?cityLabel = plainLiteral(?1)
    ?lgdUri = uri(concat("", ?4, ?5))
    ?long = typedLiteral(?6, xsd:float)
    ?lat = typedLiteral(?7, xsd:float)
{{foo}} blubb