Skip to content

custom_datatype

RDFLib can map between RDF data-typed literals and Python objects.

Mapping for integers, floats, dateTimes, etc. are already added, but you can also add your own.

This example shows how bind lets you register new mappings between literal datatypes and Python objects

Attributes:

EG module-attribute

EG = Namespace('http://example.com/')

c module-attribute

c = complex(2, 3)

g module-attribute

g = Graph()

g2 module-attribute

g2 = parse(data=serialize())

l module-attribute

l = Literal(c)

l2 module-attribute

l2 = list(g2)[0]