← Basic Queries
Review foundational SPARQL concepts.
Go BackTransform and manipulate data with SPARQL's powerful expression functions. Work with strings, dates, numbers, and hashes to extract precisely the information you need.
SPARQL expressions allow you to transform, filter, and compute new values from your query results. Whether you need to extract a year from a date, concatenate strings, perform calculations, or generate identifiers, expression functions provide the tools you need.
Expressions are used in FILTER clauses, BIND statements, and
SELECT projections to manipulate and derive new data.
Manipulate text with functions like CONCAT, SUBSTR, STRLEN, REPLACE, UCASE, LCASE, CONTAINS, STRSTARTS, STRENDS, and more.
Explore StringsWork with temporal data using YEAR, MONTH, DAY, HOURS, MINUTES, SECONDS, TIMEZONE, and NOW functions.
Explore DatesPerform calculations with ABS, ROUND, CEIL, FLOOR, RAND, and arithmetic operators (+, -, *, /).
Explore MathGenerate identifiers and checksums with MD5, SHA1, SHA256, SHA384, and SHA512 hash functions.
Explore HashesSELECT ?lang ?langLabel
(UCASE(?langLabel) AS ?upperName)
(STRLEN(?langLabel) AS ?nameLength)
WHERE {
?lang wdt:P31 wd:Q9143 .
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en" .
}
}
LIMIT 10
SELECT ?lang ?langLabel ?inception
(YEAR(?inception) AS ?year)
(MONTH(?inception) AS ?month)
WHERE {
?lang wdt:P31 wd:Q9143 ;
wdt:P571 ?inception .
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en" .
}
}
ORDER BY DESC(?inception)
LIMIT 10
SELECT ?langLabel ?inception
(YEAR(NOW()) - YEAR(?inception) AS ?age)
WHERE {
?lang wdt:P31 wd:Q9143 ;
wdt:P571 ?inception .
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en" .
}
}
ORDER BY DESC(?age)
LIMIT 10
| Function | Category | Description |
|---|---|---|
STR() |
String | Convert to string |
CONCAT() |
String | Concatenate strings |
SUBSTR() |
String | Extract substring |
UCASE() / LCASE() |
String | Convert case |
YEAR() / MONTH() / DAY() |
Date | Extract date components |
NOW() |
Date | Current datetime |
ABS() / ROUND() / FLOOR() / CEIL() |
Math | Numeric operations |
MD5() / SHA256() |
Hash | Generate hash |