DCTERMS.format not working · Issue #932 · RDFLib/rdflib (original) (raw)

When using the inbuilt DCTERMS namespace, from rdflib.namespace import DCTERMS, an error is thrown if the following triple is added to a graph:

g.add((r, DCTERMS.format, Literal('application/pdf')))

error: AssertionError: Predicate <built-in method format of Namespace object at 0x10e8e2de0> must be an rdflib term

Presumably there's a Python reserved word 'format' collision somewhere.

Have to do this as a workaround:

g.add((r, URIRef('http://purl.org/dc/terms/format'), Literal('application/pdf')))