I can include URIs and variables in my queries, but I can\'t include literals in my queries.
Here, I have some code which successfully reads an RDF file, finds all the
If the literals in your data have datatypes, or are strings with language tags, then a plain literal, that is, one without a datatype or language tag, injected into the query won't match.
The RDFLib docs on Literals show ways of creating literals with datatypes, but don't have an example of creating one with a language tag. However, the docs also have the source attached and the signature for Literal's __new__ is:
static __new__(lexical_or_value, lang=None, datatype=None, normalize=None)
Since the literal in your data has a language tag ('en'
), you should to create your literal as
o = rdflib.Literal(u'Jackkifing',lang='en')
so that the language tag is associated with the literal.