Mercurial > repos > shellac > guppy_basecaller
comparison env/lib/python3.7/site-packages/rdflib/serializer.py @ 5:9b1c78e6ba9c draft default tip
"planemo upload commit 6c0a8142489327ece472c84e558c47da711a9142"
| author | shellac |
|---|---|
| date | Mon, 01 Jun 2020 08:59:25 -0400 |
| parents | 79f47841a781 |
| children |
comparison
equal
deleted
inserted
replaced
| 4:79f47841a781 | 5:9b1c78e6ba9c |
|---|---|
| 1 """ | |
| 2 Serializer plugin interface. | |
| 3 | |
| 4 This module is useful for those wanting to write a serializer that can | |
| 5 plugin to rdflib. If you are wanting to invoke a serializer you likely | |
| 6 want to do so through the Graph class serialize method. | |
| 7 | |
| 8 TODO: info for how to write a serializer that can plugin to rdflib. | |
| 9 See also rdflib.plugin | |
| 10 | |
| 11 """ | |
| 12 | |
| 13 from rdflib.term import URIRef | |
| 14 | |
| 15 __all__ = ['Serializer'] | |
| 16 | |
| 17 | |
| 18 class Serializer(object): | |
| 19 | |
| 20 def __init__(self, store): | |
| 21 self.store = store | |
| 22 self.encoding = "UTF-8" | |
| 23 self.base = None | |
| 24 | |
| 25 def serialize(self, stream, base=None, encoding=None, **args): | |
| 26 """Abstract method""" | |
| 27 | |
| 28 def relativize(self, uri): | |
| 29 base = self.base | |
| 30 if base is not None and uri.startswith(base): | |
| 31 uri = URIRef(uri.replace(base, "", 1)) | |
| 32 return uri |
