/usr/lib/python2.7/dist-packages/rdflib/serializer.py is in python-rdflib 4.1.2-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | """
Serializer plugin interface.
This module is useful for those wanting to write a serializer that can
plugin to rdflib. If you are wanting to invoke a serializer you likely
want to do so through the Graph class serialize method.
TODO: info for how to write a serializer that can plugin to rdflib.
See also rdflib.plugin
"""
from rdflib.term import URIRef
__all__ = ['Serializer']
class Serializer(object):
def __init__(self, store):
self.store = store
self.encoding = "UTF-8"
self.base = None
def serialize(self, stream, base=None, encoding=None, **args):
"""Abstract method"""
def relativize(self, uri):
base = self.base
if base is not None and uri.startswith(base):
uri = URIRef(uri.replace(base, "", 1))
return uri
|