@@ -37,29 +37,31 @@ def query_analysis(query, store, connection):
37
37
store .queryOptMarks [(_key , table )] = hits + 1
38
38
39
39
40
- def union_select (selectComponents , distinct = False , select_type = TRIPLE_SELECT ):
40
+ def union_select (select_components , distinct = False , select_type = TRIPLE_SELECT ):
41
41
"""
42
42
Helper function for building union all select statement.
43
43
44
- Terms: u - uri refs v - variables b - bnodes l - literal f - formula
44
+ Terms:
45
+ u - uri refs
46
+ v - variables
47
+ b - bnodes
48
+ l - literal
49
+ f - formula
50
+
51
+ :param select_components - iterable of (table_name, where_clause_string, table_type) tuples
45
52
46
- Takes a list of:
47
- - table name
48
- - table alias
49
- - table type (literal, type, asserted, quoted)
50
- - where clause string
51
53
"""
52
54
selects = []
53
- for table , whereClause , tableType in selectComponents :
55
+ for table , whereClause , tableType in select_components :
54
56
55
57
if select_type == COUNT_SELECT :
56
- selectClause = table .count (whereClause )
58
+ select_clause = table .count (whereClause )
57
59
elif select_type == CONTEXT_SELECT :
58
- selectClause = expression .select ([table .c .context ], whereClause )
60
+ select_clause = expression .select ([table .c .context ], whereClause )
59
61
elif tableType in FULL_TRIPLE_PARTITIONS :
60
- selectClause = table .select (whereClause )
62
+ select_clause = table .select (whereClause )
61
63
elif tableType == ASSERTED_TYPE_PARTITION :
62
- selectClause = expression .select (
64
+ select_clause = expression .select (
63
65
[table .c .id .label ("id" ),
64
66
table .c .member .label ("subject" ),
65
67
expression .literal (text_type (RDF .type )).label ("predicate" ),
@@ -70,14 +72,14 @@ def union_select(selectComponents, distinct=False, select_type=TRIPLE_SELECT):
70
72
expression .literal_column ("NULL" ).label ("objdatatype" )],
71
73
whereClause )
72
74
elif tableType == ASSERTED_NON_TYPE_PARTITION :
73
- selectClause = expression .select (
75
+ select_clause = expression .select (
74
76
[c for c in table .columns ] +
75
77
[expression .literal_column ("NULL" ).label ("objlanguage" ),
76
78
expression .literal_column ("NULL" ).label ("objdatatype" )],
77
79
whereClause ,
78
80
from_obj = [table ])
79
81
80
- selects .append (selectClause )
82
+ selects .append (select_clause )
81
83
82
84
order_statement = []
83
85
if select_type == TRIPLE_SELECT :
0 commit comments