blob: eb9230bf137c34b4ee51688dda452b7de81ebcda (
plain)
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
|
"""
SPARQL implementation for RDFLib
.. versionadded:: 4.0
"""
SPARQL_LOAD_GRAPHS = True
"""
If True, using FROM <uri> and FROM NAMED <uri>
will load/parse more data
"""
SPARQL_DEFAULT_GRAPH_UNION = True
"""
If True - the default graph in the RDF Dataset is the union of all
named graphs (like RDFLib's ConjunctiveGraph)
"""
CUSTOM_EVALS = {}
"""
Custom evaluation functions
These must be functions taking (ctx, part) and raise
NotImplementedError if they cannot handle a certain part
"""
PLUGIN_ENTRY_POINT = "rdf.plugins.sparqleval"
import sys
from . import parser
from . import operators
from . import parserutils
from .processor import prepareQuery, processUpdate
assert parser
assert operators
assert parserutils
if sys.version_info < (3, 8):
from importlib_metadata import entry_points
else:
from importlib.metadata import entry_points
all_entry_points = entry_points()
if isinstance(all_entry_points, dict):
# Prior to Python 3.10, this returns a dict instead of the selection interface
for ep in all_entry_points.get(PLUGIN_ENTRY_POINT, []):
CUSTOM_EVALS[ep.name] = ep.load()
else:
for ep in all_entry_points.select(group=PLUGIN_ENTRY_POINT):
CUSTOM_EVALS[ep.name] = ep.load()
|