/usr/lib/python2.7/dist-packages/rdflib/plugin.py is in python-rdflib 2.4.2-3build1.
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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | from rdflib.store import Store
from rdflib.syntax import serializer, serializers
from rdflib.syntax import parsers
from rdflib import sparql
from rdflib.QueryResult import QueryResult
_kinds = {}
_adaptors = {}
def register(name, kind, module_path, class_name):
_module_info = _kinds.get(kind, None)
if _module_info is None:
_module_info = _kinds[kind] = {}
_module_info[name] = (module_path, class_name)
def get(name, kind):
_module_info = _kinds.get(kind)
if _module_info and name in _module_info:
module_path, class_name = _module_info[name]
module = __import__(module_path, globals(), locals(), [""])
return getattr(module, class_name)
else:
Adaptor = kind # TODO: look up of adaptor, for now just use kind
try:
Adaptee = get(name, _adaptors[kind])
except Exception, e:
raise Exception("could not get plugin for %s, %s: %s" % (name, kind, e))
def const(*args, **keywords):
return Adaptor(Adaptee(*args, **keywords))
return const
def register_adaptor(adaptor, adaptee):
_adaptors[adaptor] = adaptee
register_adaptor(serializer.Serializer, serializers.Serializer)
#register_adaptor(parser.Parser, parsers.Parser)
register('rdf', serializers.Serializer,
'rdflib.syntax.serializers.XMLSerializer', 'XMLSerializer')
register('xml', serializers.Serializer,
'rdflib.syntax.serializers.XMLSerializer', 'XMLSerializer')
register('rdf/xml', serializers.Serializer,
'rdflib.syntax.serializers.XMLSerializer', 'XMLSerializer')
register('pretty-xml', serializers.Serializer,
'rdflib.syntax.serializers.PrettyXMLSerializer', 'PrettyXMLSerializer')
register('nt', serializers.Serializer,
'rdflib.syntax.serializers.NTSerializer', 'NTSerializer')
register('turtle', serializers.Serializer,
'rdflib.syntax.serializers.TurtleSerializer', 'TurtleSerializer')
register('n3', serializers.Serializer,
'rdflib.syntax.serializers.N3Serializer', 'N3Serializer')
register('xml', parsers.Parser,
'rdflib.syntax.parsers.RDFXMLParser', 'RDFXMLParser')
register('trix', parsers.Parser,
'rdflib.syntax.parsers.TriXParser', 'TriXParser')
register('n3', parsers.Parser,
'rdflib.syntax.parsers.N3Parser', 'N3Parser')
register('notation3', parsers.Parser,
'rdflib.syntax.parsers.N3Parser', 'N3Parser')
register('nt', parsers.Parser,
'rdflib.syntax.parsers.NTParser', 'NTParser')
register('n3', parsers.Parser,
'rdflib.syntax.parsers.N3Parser', 'N3Parser')
register('rdfa', parsers.Parser,
'rdflib.syntax.parsers.RDFaParser', 'RDFaParser')
register('default', Store,
'rdflib.store.IOMemory', 'IOMemory')
register('IOMemory', Store,
'rdflib.store.IOMemory', 'IOMemory')
register('Memory', Store,
'rdflib.store.Memory', 'Memory')
register('Sleepycat', Store,
'rdflib.store.Sleepycat', 'Sleepycat')
register('BerkeleyDB', Store,
'rdflib.store.BerkeleyDB', 'BerkeleyDB')
register('BDBOptimized', Store,
'rdflib.store.BDBOptimized', 'BDBOptimized')
register('PostgreSQL', Store,
'rdflib.store.PostgreSQL', 'PostgreSQL')
register('MySQL', Store,
'rdflib.store.MySQL', 'MySQL')
register('SQLite', Store,
'rdflib.store.SQLite', 'SQLite')
register('ZODB', Store,
'rdflib.store.ZODB', 'ZODB')
register('sqlobject', Store,
'rdflib.store._sqlobject', 'SQLObject')
register('Redland', Store,
'rdflib.store.Redland', 'Redland')
register('MySQL', Store,
'rdflib.store.MySQL', 'MySQL')
register("sparql", sparql.Processor,
'rdflib.sparql.bison.Processor', 'Processor')
register("SPARQLQueryResult", QueryResult,
'rdflib.sparql.QueryResult', 'SPARQLQueryResult')
|