Mercurial > repos > shellac > guppy_basecaller
diff env/lib/python3.7/site-packages/rdflib/serializer.py @ 0:26e78fe6e8c4 draft
"planemo upload commit c699937486c35866861690329de38ec1a5d9f783"
author | shellac |
---|---|
date | Sat, 02 May 2020 07:14:21 -0400 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/env/lib/python3.7/site-packages/rdflib/serializer.py Sat May 02 07:14:21 2020 -0400 @@ -0,0 +1,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