SPARQL Query Examples
Jump to navigation
Jump to search
References and tutorials
Query examples
All datasets
PREFIX cewd: <https://congruence-engine.wikibase.cloud/entity/>
PREFIX cewdt: <https://congruence-engine.wikibase.cloud/prop/direct/>
SELECT ?dataset ?datasetLabel ?datasetDescription
WHERE
{
# Entity is 'instance of (P1)' 'Dataset (Q1)'
?dataset cewdt:P1 cewd:Q1.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }
}
# sort the results alphabetically in ascending order, based on entity labels that have been
# converted to string (language agnostic) and uppercase (case insensitive).
ORDER BY ASC(UCASE(STR(?datasetLabel)))
All datasets including the holder information
PREFIX cewd: <https://congruence-engine.wikibase.cloud/entity/>
PREFIX cewdt: <https://congruence-engine.wikibase.cloud/prop/direct/>
PREFIX cep: <https://congruence-engine.wikibase.cloud/prop/>
PREFIX ceps: <https://congruence-engine.wikibase.cloud/prop/statement/>
PREFIX cepq: <https://congruence-engine.wikibase.cloud/prop/qualifier/>
SELECT ?dataset ?datasetLabel ?datasetDescription ?heldBy ?heldByURL
WHERE
{
# Entity is 'instance of (P1)' 'Dataset (Q1)'
?dataset cewdt:P1 cewd:Q1.
# and if available, include 'held by (P5)' property and its 'described at URL (P2)' qualifier
OPTIONAL {
?dataset cep:P5 ?heldByStatement.
?heldByStatement ceps:P5 ?heldBy.
?heldByStatement cepq:P2 ?heldByURL.
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "en,en-gb". }
}
# sort the results alphabetically in ascending order, based on entity labels that have been
# converted to string (language agnostic) and uppercase (case insensitive).
ORDER BY ASC(UCASE(STR(?datasetLabel)))
Datasets with URLs
PREFIX cewd: <https://congruence-engine.wikibase.cloud/entity/>
PREFIX cewdt: <https://congruence-engine.wikibase.cloud/prop/direct/>
SELECT ?dataset ?datasetLabel ?datasetDescription ?availableAtURL
WHERE
{
# Entity is 'instance of (P1)' 'Dataset (Q1)' and has 'available at URL (P6)' property
?dataset cewdt:P1 cewd:Q1;
cewdt:P6 ?availableAtURL.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }
}
# sort the results alphabetically in ascending order, based on entity labels that have been
# converted to string (language agnostic) and uppercase (case insensitive).
ORDER BY ASC(UCASE(STR(?datasetLabel)))
Datasets with Digital Cultural Heritage Datasheet
PREFIX cewd: <https://congruence-engine.wikibase.cloud/entity/>
PREFIX cewdt: <https://congruence-engine.wikibase.cloud/prop/direct/>
SELECT ?dataset ?datasetLabel ?datasetDescription ?datasheetURL
WHERE
{
# Entity is 'instance of (P1)' 'Dataset (Q1)' and has 'Digital Cultural Heritage Datasheet URL (P9)' property
?dataset cewdt:P1 cewd:Q1;
cewdt:P9 ?datasheetURL.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }
}
# sort the results alphabetically in ascending order, based on entity labels that have been
# converted to string (language agnostic) and uppercase (case insensitive).
ORDER BY ASC(UCASE(STR(?datasetLabel)))
All datasets including copyright information
PREFIX cewd: <https://congruence-engine.wikibase.cloud/entity/>
PREFIX cewdt: <https://congruence-engine.wikibase.cloud/prop/direct/>
SELECT ?dataset ?datasetLabel ?datasetDescription ?copyrightStatus ?copyrightLicense
WHERE
{
# Entity is 'instance of (P1)' 'Dataset (Q1)'
?dataset cewdt:P1 cewd:Q1.
# and if available, include 'copyright status (P7)' and 'copyright license (P8)' properties
OPTIONAL {
?dataset cewdt:P7 ?copyrightStatus.
?dataset cewdt:P8 ?copyrightLicense.
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". }
}
# sort the results alphabetically in ascending order, based on entity labels that have been
# converted to string (language agnostic) and uppercase (case insensitive).
ORDER BY ASC(UCASE(STR(?datasetLabel)))