Skip to content

Instantly share code, notes, and snippets.

@jindrichmynarz
Created June 28, 2016 06:47
Show Gist options
  • Select an option

  • Save jindrichmynarz/1a54943db87c94e0ad561b36169d9d51 to your computer and use it in GitHub Desktop.

Select an option

Save jindrichmynarz/1a54943db87c94e0ad561b36169d9d51 to your computer and use it in GitHub Desktop.
Generating SPARQL: Mustache template
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?person
{{#properties}}
(SAMPLE(?_{{varname}}) AS ?{{varname}})
{{/properties}}
WHERE {
{
SELECT ?person
WHERE {
{
SELECT DISTINCT ?person
WHERE {
?person a foaf:Person .
{{#properties}}
{{#required?}}
?person <{{{property}}}> [] .
{{/required?}}
{{/properties}}
}
ORDER BY ?person
}
}
LIMIT {{limit}}
OFFSET {{offset}}
}
{{#properties}}
{{^required?}} OPTIONAL { {{/required?}}
?person <{{{property}}}> ?_{{varname}} .
{{^required?}} } {{/required?}}
{{/properties}}
}
GROUP BY ?person
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment