[SPARQL] RDF literals

RDF Literals in SPARQL

Definition

An RDF literal is a simple data value in the RDF model, often representing strings, numbers, or dates. It appears in SPARQL queries as a concrete value rather than an IRI. An RDF literal can have a language tag (e.g., "Hello"@en) or a datatype ("42"^^xsd:integer). In summary, RDF literals store concrete values (not IRIs) and can be language-tagged or typed. 

Types of RDF Literals

  • Plain Literals: Simple strings, possibly with a language tag.
 "Hello"@en.
  • Typed Literals: Values connected to a data type IRI.
"2020-01-01"^^xsd:dateTime.

Examples in SPARQL

  • Matching a Label

    A triple pattern with an exact string in English.

?subject rdfs:label "Example"@en .
  • Filtering by Date

    A range comparison using a typed literal.

?item wdt:P577 ?date .
FILTER(?date >= "2020-01-01T00:00:00Z"^^xsd:dateTime)

Comments