The SPARQL property path where the children of resources can be read. This must be a valid SPARQL property path without any prefix, e.g. <http://schema.org> (including brackets).
children path
The URI of a property where the children of resources can be read. This should point to a URI.
children property
The datasource from which a property with value selection should fetch its data.
datasource
The SPARQL property path where the label of resources can be read. This must be a valid SPARQL property path without any prefix, e.g. <http://schema.org> (including brackets).
label path
The URI of a property where the label of resources can be read. This should point to a URI.
label property
Set this to true to disable client-side javascript sorting for a datasource. If set to true, the order of elements will be the one returned by the SPARQL query.
no sort
A reference to the datasource with which a tree widget will populate the children of a node in the tree.
tree children datasource
A reference to the datasource with which a tree widget will populate its root (first-level) nodes.
tree roots datasource
The SPARQL query template to be used in a SPARQL datasource. The SPARQL template holds a SPARQL query string in which the placeholders $domain, $property, $range will be replaced by their corresponding values before executing the query. For autocomplete field, the additionnal placeholders $key and $lang will also be replaced by their corresponding values before executing the query The placeholder $labelPath will be replaced by the value indicated in the SparqlDatasource in the labelPath (for a full SPARQL property path) or labelProperty (for a single property URI).
query template
The query string of a SPARQLQuery, or directly on a SPARQLDatasource
query string
A SPARQL endpoint URL to which the query should be sent.
SPARQL endpoint URL
A source of data to populate Sparnatural widgets (list, search fields, trees, etc.)
Datasource
A source of data for a Sparnatural widget implemented as a SPARQL query.
SPARQL datasource
A datasource to populate a list widget, implemented as a SPARQL query. The SPARQL query MUST return 2 variables : ?label and either ?uri or ?value (if returning a literal). It can return other variables as well. The following variables, if present in the SPARQL query, are automatically bound in the query : - $domain: bound to the URI of the subject class of the criteria - $property: bound to the URI or property path of the property of the criteria - $range: bound to the URI of the object class of the criteria - $lang: bound to the default language of Sparnatural - $type: bound to the typePredicate parameter of Sparnatural, rdf:type by default
SPARQL list datasource
A datasource to populate an autocomplete search widget, implemented as a SPARQL query. The SPARQL query MUST return 2 variables : ?label and either ?uri or ?value (if returning a literal). It can return other variables as well; The following variables, if present in the SPARQL query, are automatically bound in the query : - $domain: bound to the URI of the subject class of the criteria - $property: bound to the URI or property path of the property of the criteria - $range: bound to the URI of the object class of the criteria - $lang: bound to the default language of Sparnatural - $key: the characters entered by the user in the search field - $type: bound to the typePredicate parameter of Sparnatural, rdf:type by default
SPARQL search datasource
A datasource to populate the children of a node of a tree widget, when unfolded, implemented as a SPARQL query. The query MUST return the following variables: - ?uri - ?label - ?hasChildren: a boolean indicating if the node has some children In addition the query CAN return the following variables: - ?count: the number of times this entity is used as the value of the criteria
SPARQL tree datasource for children of a node
A datasource to populate the root of a tree widget, implemented as a SPARQL query.
SPARQL tree datasource for the roots of the tree
A datasource that returns a list of entities with their URI as a label ordered alphabetically based on the URI string.
A datasource that returns a list of entities with their URI as a label ordered by the descending number of times the entity is used as a value. This is typically the default behavior for a list without a datasource specified.
A datasource that returns a list of URI or Literals, ordered alphabetically based on their string representation. It can work indifferently with URIs or Literal values.
A datasource that returns a list of URIs or Literals, ordered alphabetically based on their string representation, with their number of occurrences in parenthesis.
A datasource that returns a list of URI or Literals, ordered on their descending number of occurrences. It can work indifferently with URIs or Literal values.
A datasource that returns a list of entities with their dcterms:title ordered alphabetically based on this property.
A datasource that returns a list of entities with their dcterms:title and the number of occurrences of the entity in parenthesis, ordered alphabetically based on this property.
A datasource that returns a list of entities with their dcterms:title ordered by the descending number of times the entity is used as a value.
A datasource that returns a list of entities with their foaf:name ordered alphabetically based on this property.
A datasource that returns a list of entities with their foaf:name and the number of occurrences of the entity in parenthesis, ordered alphabetically based on this property.
A datasource that returns a list of entities with their foaf:name ordered by the descending number of times the entity is used as a value.
A datasource that returns a list of entities with their rdfs:label ordered alphabetically based on this property.
A datasource that returns a list of entities with their rdfs:label and the number of occurrences of the entity in parenthesis, ordered alphabetically based on this property.
A datasource that returns a list of entities with their rdfs:label ordered by the descending number of times the entity is used as a value.
A datasource that returns a list of entities with their schema:name ordered alphabetically based on this property.
A datasource that returns a list of entities with their schema:name and the number of occurrences of the entity in parenthesis, ordered alphabetically based on this property.
A datasource that returns a list of entities with their schema:name ordered by the descending number of times the entity is used as a value.
A datasource that returns a list of entities with their skos:prefLabel ordered alphabetically based on this property.
A datasource that returns a list of entities with their skos:prefLabel and the number of occurrences of the entity in parenthesis, ordered alphabetically based on this property.
A datasource that returns a list of entities with their skos:prefLabel ordered by the descending number of times the entity is used as a value.
A datasource that returns a list of literal ordered alphabetically.
A datasource that returns a list of literal with count in parenthesis, ordered alphabetically.
A datasource that returns a list of literal ordered by descending number of occurrences.
SELECT DISTINCT ?uri (STR(?uri) AS ?label) WHERE { ?domain $type $domain . ?domain $property ?uri . FILTER(isIRI(?uri)) # Note how the range criteria is not used in this query } ORDER BY UCASE(?label) LIMIT 500
SELECT ?uri ?count (CONCAT(STR(?uri), ' (', STR(?count), ')') AS ?label) (STR(?uri) AS ?itemLabel) WHERE { { SELECT DISTINCT ?uri (COUNT(?domain) AS ?count) WHERE { ?domain $type $domain . ?domain $property ?uri . FILTER(isIRI(?uri)) # Note how the range criteria is not used in this query } GROUP BY ?uri } } ORDER BY DESC(?count) UCASE(?label) LIMIT 500
SELECT DISTINCT ?value (CONCAT(IF(isLiteral(?value) && LANG(?value) != '' && LANG(?value) != $lang,CONCAT(STR(?value), " (",LANG(?value),")"),STR(?value))) AS ?label) WHERE { ?domain $type $domain . { { ?domain $property ?value . FILTER(isIRI(?value)) } UNION { ?domain $property ?value . FILTER(isLiteral(?value) && (lang(?value) = $lang)) } UNION { ?domain $property ?value . FILTER(isLiteral(?value) && (lang(?value) = $defaultLang)) FILTER NOT EXISTS { ?domain $property ?valuePrefLang . FILTER(LANG(?valuePrefLang) = $lang) } } UNION { ?domain $property ?value . FILTER(isLiteral(?value) && (lang(?value) = "")) FILTER NOT EXISTS { ?domain $property ?valueAnyLang . FILTER((LANG(?valueAnyLang) = $lang) || (LANG(?valueAnyLang) = $defaultLang)) } } } # Note how the range criteria is not used in this query } ORDER BY UCASE(?label) LIMIT 500
SELECT DISTINCT ?value ?count (CONCAT(IF(isLiteral(?value) && LANG(?value) != '' && LANG(?value) != $lang,CONCAT(STR(?value), " (",LANG(?value),")"),STR(?value)), ' (', STR(?count), ')') AS ?label) (STR(?value) AS ?itemLabel) WHERE { { SELECT DISTINCT ?value (COUNT(DISTINCT ?domain) AS ?count) WHERE { ?domain $type $domain . { { ?domain $property ?value . FILTER(isIRI(?value)) } UNION { ?domain $property ?value . FILTER(isLiteral(?value) && (lang(?value) = $lang)) } UNION { ?domain $property ?value . FILTER(isLiteral(?value) && (lang(?value) = $defaultLang)) FILTER NOT EXISTS { ?domain $property ?valuePrefLang . FILTER(LANG(?valuePrefLang) = $lang) } } UNION { ?domain $property ?value . FILTER(isLiteral(?value) && (lang(?value) = "")) FILTER NOT EXISTS { ?domain $property ?valueAnyLang . FILTER((LANG(?valueAnyLang) = $lang) || (LANG(?valueAnyLang) = $defaultLang)) } } } } GROUP BY ?value } } ORDER BY UCASE(?label) LIMIT 500
SELECT ?value ?count (CONCAT(IF(isLiteral(?value) && LANG(?value) != '' && LANG(?value) != $lang,CONCAT(STR(?value), " (",LANG(?value),")"),STR(?value)), ' (', STR(?count), ')') AS ?label) (STR(?value) AS ?itemLabel) WHERE { { SELECT DISTINCT ?value (COUNT(DISTINCT ?domain) AS ?count) WHERE { ?domain $type $domain . { { ?domain $property ?value . FILTER(isIRI(?value)) } UNION { ?domain $property ?value . FILTER(isLiteral(?value) && (lang(?value) = $lang)) } UNION { ?domain $property ?value . FILTER(isLiteral(?value) && (lang(?value) = $defaultLang)) FILTER NOT EXISTS { ?domain $property ?valuePrefLang . FILTER(LANG(?valuePrefLang) = $lang) } } UNION { ?domain $property ?value . FILTER(isLiteral(?value) && (lang(?value) = "")) FILTER NOT EXISTS { ?domain $property ?valueAnyLang . FILTER((LANG(?valueAnyLang) = $lang) || (LANG(?valueAnyLang) = $defaultLang)) } } } } GROUP BY ?value } } ORDER BY DESC(?count) UCASE(?label) LIMIT 500
SELECT DISTINCT ?uri ?label WHERE { ?domain $type $domain . ?domain $property ?uri . # Note how the range criteria is not used in this query ?uri $labelPath ?label . FILTER(isIRI(?uri)) FILTER(lang(?label) = "" || lang(?label) = $lang) } ORDER BY UCASE(?label) LIMIT 500
SELECT ?uri ?count (CONCAT(STR(?theLabel), ' (', STR(?count), ')') AS ?label) (STR(?theLabel) AS ?itemLabel) WHERE { { SELECT ?uri ?count ?theLabel WHERE { { SELECT DISTINCT ?uri (COUNT(?domain) AS ?count) WHERE { ?domain $type $domain . ?domain $property ?uri . FILTER(isIRI(?uri)) } GROUP BY ?uri } ?uri $labelPath ?theLabel . FILTER(lang(?theLabel) = "" || lang(?theLabel) = $lang) } ORDER BY UCASE(?theLabel) LIMIT 500 } } ORDER BY UCASE(?label)
SELECT ?uri ?count (CONCAT(STR(?theLabel), ' (', STR(?count), ')') AS ?label) (STR(?theLabel) AS ?itemLabel) WHERE { { SELECT ?uri ?count ?theLabel WHERE { { SELECT DISTINCT ?uri (COUNT(?domain) AS ?count) WHERE { ?domain $type $domain . ?domain $property ?uri . FILTER(isIRI(?uri)) } GROUP BY ?uri } ?uri $labelPath ?theLabel . FILTER(lang(?theLabel) = "" || lang(?theLabel) = $lang) } ORDER BY DESC(?count) UCASE(?theLabel) LIMIT 500 } } ORDER BY DESC(?count) UCASE(?label)
SELECT DISTINCT ?uri ?label WHERE { ?domain $type $domain . ?domain $property ?uri . # range criteria ?uri $type $range . ?uri $labelPath ?label . FILTER(isIRI(?uri)) FILTER(lang(?label) = "" || lang(?label) = $lang) } ORDER BY UCASE(?label) LIMIT 500
SELECT ?uri ?count (CONCAT(STR(?theLabel), ' (', STR(?count), ')') AS ?label) (STR(?theLabel) AS ?itemLabel) WHERE { { SELECT ?uri ?count ?theLabel WHERE { { SELECT DISTINCT ?uri (COUNT(?domain) AS ?count) WHERE { ?domain $type $domain . ?domain $property ?uri . FILTER(isIRI(?uri)) # range criteria ?uri $type $range . } GROUP BY ?uri } ?uri $labelPath ?theLabel . FILTER(lang(?theLabel) = "" || lang(?theLabel) = $lang) } ORDER BY UCASE(?theLabel) LIMIT 500 } } ORDER BY UCASE(?label)
SELECT ?uri ?count (CONCAT(STR(?theLabel), ' (', STR(?count), ')') AS ?label) (STR(?theLabel) AS ?itemLabel) WHERE { { SELECT ?uri ?count ?theLabel WHERE { { SELECT DISTINCT ?uri (COUNT(?domain) AS ?count) WHERE { ?domain $type $domain . ?domain $property ?uri . FILTER(isIRI(?uri)) ?uri $type $range . } GROUP BY ?uri } ?uri $labelPath ?theLabel . FILTER(lang(?theLabel) = "" || lang(?theLabel) = $lang) } ORDER BY DESC(?count) UCASE(?theLabel) LIMIT 500 } } ORDER BY DESC(?count) UCASE(?label)
SELECT DISTINCT ?value (STR(?value) AS ?label) WHERE { ?domain $type $domain . ?domain $property ?value . } ORDER BY UCASE(?label) LIMIT 500
SELECT ?count (CONCAT(STR(?theLabel), ' (', STR(?count), ')') AS ?label) (STR(?theLabel) AS ?itemLabel) WHERE { { SELECT DISTINCT ?count ?theLabel WHERE { { SELECT DISTINCT ?theLabel (COUNT(?theLabel) AS ?count) WHERE { ?domain $type $domain . ?domain $property ?theLabel . FILTER(lang(?theLabel) = "" || lang(?theLabel) = $lang) } GROUP BY ?theLabel } } ORDER BY UCASE(?theLabel) LIMIT 500 } } ORDER BY UCASE(?label)
SELECT ?count (CONCAT(STR(?theLabel), ' (', STR(?count), ')') AS ?label) (STR(?theLabel) AS ?itemLabel) WHERE { { SELECT DISTINCT ?count ?theLabel WHERE { { SELECT DISTINCT ?theLabel (COUNT(?theLabel) AS ?count) WHERE { ?domain $type $domain . ?domain $property ?theLabel . FILTER(lang(?theLabel) = "" || lang(?theLabel) = $lang) } GROUP BY ?theLabel } } ORDER BY DESC(?count) UCASE(?theLabel) LIMIT 500 } } ORDER BY DESC(?count) UCASE(?label)
SELECT DISTINCT ?uri ?label WHERE { ?domain $type $domain . ?domain $property ?uri . ?uri $type $range . FILTER(isIRI(?uri)) BIND(STR(?uri) AS ?label) FILTER(CONTAINS(LCASE(?label), LCASE("$key"))) } ORDER BY UCASE(?label) LIMIT 15
PREFIX bif: <http://www.openlinksw.com/schemas/bif#> SELECT DISTINCT ?uri ?label WHERE { ?domain $type $domain . ?domain $property ?uri . ?uri $type $range . ?uri $labelPath ?label . FILTER(isIRI(?uri)) FILTER(lang(?label) = '' || lang(?label) = $lang ) # Note the single quote to handle space character ?label bif:contains "'$key'" . } ORDER BY UCASE(?label) LIMIT 15
SELECT DISTINCT ?uri ?label WHERE { ?domain $type $domain . ?domain $property ?uri . ?uri $type $range . ?uri $labelPath ?label . FILTER(isIRI(?uri)) FILTER(lang(?label) = '' || lang(?label) = $lang) FILTER(CONTAINS(LCASE(STR(?label)), LCASE("$key"))) } ORDER BY UCASE(?label) LIMIT 15
SELECT DISTINCT ?uri ?label WHERE { ?domain $type $domain . ?domain $property ?uri . ?uri $type $range . ?uri $labelPath ?label . FILTER(isIRI(?uri)) FILTER(lang(?label) = '' || lang(?label) = $lang) FILTER(STRSTARTS(LCASE(STR(?label)), LCASE("$key"))) } ORDER BY UCASE(?label) LIMIT 15
SELECT DISTINCT ?value ?label WHERE { ?domain $type $domain . ?domain $property ?value . FILTER(isLiteral(?value)) BIND(STR(?value) AS ?label) FILTER(CONTAINS(LCASE(STR(?value)), LCASE("$key"))) } ORDER BY UCASE(?label) LIMIT 15
SELECT DISTINCT ?value ?label WHERE { ?domain $type $domain . ?domain $property ?value . FILTER(isLiteral(?value)) BIND(STR(?value) AS ?label) FILTER(STRSTARTS(LCASE(STR(?value)), LCASE("$key"))) } ORDER BY UCASE(?label) LIMIT 15
# Selects the children of a node SELECT DISTINCT ?uri ?label ?hasChildren WHERE { $node $childrenPath ?uri . ?uri $labelPath ?label . FILTER(isIRI(?uri)) FILTER(lang(?label) = '' || lang(?label) = $lang) OPTIONAL { ?uri $childrenPath ?children . } BIND(IF(bound(?children),true,false) AS ?hasChildren) } ORDER BY UCASE(?label)
SELECT ?uri (CONCAT(STR(?theLabel), ' (', STR(?count), ')') AS ?label) ?hasChildren ?count (STR(?theLabel) AS ?itemLabel) WHERE { { SELECT DISTINCT ?uri ?theLabel ?hasChildren (COUNT(?x) AS ?count) WHERE { { SELECT ?uri ?theLabel ?hasChildren WHERE { $node $childrenPath ?uri . ?uri $labelPath ?theLabel . FILTER(isIRI(?uri)) FILTER(lang(?theLabel) = '' || lang(?theLabel) = $lang) OPTIONAL { ?uri $childrenPath ?children . } BIND(IF(bound(?children),true,false) AS ?hasChildren) } } OPTIONAL { ?x $type $domain . ?x $property ?uri . # no range criteria # ?uri a $range . } } GROUP BY ?uri ?theLabel ?hasChildren } } ORDER BY UCASE(?label)
SELECT ?uri ?label ?hasChildren WHERE { ?uri $type $range . FILTER NOT EXISTS { ?parent $childrenPath ?uri . } ?uri $labelPath ?label . FILTER(isIRI(?uri)) FILTER(lang(?label) = '' || lang(?label) = $lang) OPTIONAL { ?uri $childrenPath ?children . } BIND(IF(bound(?children),true,false) AS ?hasChildren) } ORDER BY UCASE(?label)
SELECT ?uri (CONCAT(STR(?theLabel), ' (', STR(?count), ')') AS ?label) ?hasChildren ?count (STR(?theLabel) AS ?itemLabel) WHERE { { SELECT ?uri ?theLabel ?hasChildren (COUNT(?x) AS ?count) WHERE { { SELECT ?uri ?theLabel ?hasChildren WHERE { ?uri $type $range . FILTER NOT EXISTS { ?parent $childrenPath ?uri . } ?uri $labelPath ?theLabel . FILTER(isIRI(?uri)) FILTER(lang(?theLabel) = '' || lang(?theLabel) = $lang) OPTIONAL { ?uri $childrenPath ?children . } BIND(IF(bound(?children),true,false) AS ?hasChildren) } } OPTIONAL { ?x $type $domain . ?x $property ?uri . } } GROUP BY ?uri ?theLabel ?hasChildren } } ORDER BY UCASE(?label)
Searches for entities by looking up the provided $key in their URI string using the CONTAINS SPARQL function.
Searches for entities by looking up the provided $key inside their dcterms:title using the bif:contains Virtuoso function.
Searches for entities by looking up the provided $key inside their dcterms:title using the CONTAINS SPARQL function.
Searches for entities by looking up the provided $key at the beginning of their dcterms;title using the STRSTARTS SPARQL function.
Searches for entities by looking up the provided $key inside their foaf:name using the bif:contains Virtuoso function.
Searches for entities by looking up the provided $key inside their foaf:name using the CONTAINS SPARQL function.
Searches for entities by looking up the provided $key at the beginning of their foaf:name using the STRSTARTS SPARQL function.
Searches for entities by looking up the provided $key inside their rdfs:label using the bif:contains Virtuoso function.
Searches for entities by looking up the provided $key inside their rdfs:label using the CONTAINS SPARQL function.
Searches for entities by looking up the provided $key at the beginning of their rdfs:label using the STRSTARTS SPARQL function.
Searches for entities by looking up the provided $key inside their schema:name using the bif:contains Virtuoso function.
Searches for entities by looking up the provided $key inside their schema:name using the CONTAINS SPARQL function.
Searches for entities by looking up the provided $key at the beginning of their schema:name using the STRSTARTS SPARQL function.
Searches for entities by looking up the provided $key inside their skos:prefLabel using the bif:contains Virtuoso function.
Searches for entities by looking up the provided $key inside their skos:prefLabel using the CONTAINS SPARQL function.
Searches for entities by looking up the provided $key at the beginning of their skos:prefLabel using the STRSTARTS SPARQL function.
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> SELECT DISTINCT ?uri ?label ?hasChildren WHERE { $range skos:hasTopConcept|^skos:topConceptOf ?uri . ?uri skos:prefLabel ?label . FILTER(isIRI(?uri)) FILTER(lang(?label) = '' || lang(?label) = $lang) OPTIONAL { ?uri skos:narrower|^skos:broader ?children . } BIND(IF(bound(?children),true,false) AS ?hasChildren) } ORDER BY UCASE(?label)
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> SELECT ?uri (CONCAT(STR(?theLabel), ' (', STR(?count), ')') AS ?label) ?hasChildren ?count WHERE { { SELECT ?uri ?theLabel ?hasChildren (COUNT(?x) AS ?count) WHERE { { SELECT ?uri ?theLabel ?hasChildren WHERE { $range skos:hasTopConcept|^skos:topConceptOf ?uri . ?uri skos:prefLabel ?theLabel . FILTER(isIRI(?uri)) FILTER(lang(?theLabel) = '' || lang(?theLabel) = $lang) OPTIONAL { ?uri skos:narrower|^skos:broader ?children . } BIND(IF(bound(?children),true,false) AS ?hasChildren) } } OPTIONAL { ?x a $domain . ?x $property ?uri . # no range criteria # ?uri a $range . } } GROUP BY ?uri ?theLabel ?hasChildren } } ORDER BY UCASE(?label)
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT DISTINCT ?uri ?label ?hasChildren WHERE { VALUES ?uri {$domain} ?uri $labelPath ?label . OPTIONAL { ?uri $childrenPath ?children . } FILTER(lang(?label) = '' || lang(?label) = $lang) BIND(IF(bound(?children),true,false) AS ?hasChildren) }
Assumes that the domain URI is the root of the tree we want to build. Useful to build hierarchies based on rdfs:subClassOf.