blob: 6537619f0b0ca3b0d252b82fa558e2150b7af2eb (
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
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
|
"""
Cypher language parser
- clear logical separation between lexing/parsing still missing
- e_XXX class object should be considered internal
"""
import re
from collections import defaultdict
import logging
from enum import Enum
#
# meta label schema
#
META_LABEL__RZ_DOC = '__RZDOC_'
META_LABEL__RZ_DOC_PREFIX = '__RZ_DOC_ID_'
meta_label_set = [META_LABEL__RZ_DOC, # RZ doc node
'__HEAD',
'__USER', # user node
'__Commit', # diff commit node
'__Parent', # parent commit node
'__Authored-by',
# __RZ_DOC_ID_xxx, # [!] considered a meta label, excluded from set to allow returning nodes with this label
]
log = logging.getLogger('rhizi')
class Query_Struct_Type(Enum):
unkown = 1
r = 2
w = 3
rw = 4
def __add__(self, other):
if self == other or self == pt_root.Query_Struct_Type.rw:
return self
if self == Query_Struct_Type.unkown:
return other
if self == Query_Struct_Type.r and other != Query_Struct_Type.r:
return Query_Struct_Type.rw
if self == Query_Struct_Type.w and other != Query_Struct_Type.w:
return Query_Struct_Type.rw
def __str__(self):
if self == Query_Struct_Type.unkown: return 'unkown'
if self == Query_Struct_Type.r: return 'r'
if self == Query_Struct_Type.w: return 'w'
if self == Query_Struct_Type.rw: return 'rw'
assert False
"""
"""
@property
def query_struct_type(self):
"""
calc query_structure_type: read|write|read-write
"""
if kw == 'match':
|