-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfactors.toml
127 lines (115 loc) · 2.58 KB
/
factors.toml
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
127
# =================================================
# Factor Fragments
# =================================================
[fragments]
FRAGMENT_FACTOR_SKELETON = """
fragment FRAGMENT_FACTOR_SKELETON on Factor {
id
label
tags
_variableOrderSymbols
}
"""
FRAGMENT_FACTOR_SUMMARY = """
fragment FRAGMENT_FACTOR_SUMMARY on Factor {
timestamp
nstime
}
"""
FRAGMENT_FACTOR = """
fragment FRAGMENT_FACTOR on Factor {
fnctype
solvable
data
metadata
_version
}
"""
# =================================================
# Factor Operations
# =================================================
[operations]
QUERY_GET_FACTOR = """
query getFactor(
$facId: ID!,
$fields_summary: Boolean! = true,
$fields_full: Boolean! = true
) {
factors(where: { id: $facId }) {
...FRAGMENT_FACTOR_SKELETON
...FRAGMENT_FACTOR_SUMMARY @include(if: $fields_summary)
...FRAGMENT_FACTOR @include(if: $fields_full)
}
}
"""
QUERY_GET_FACTORS = """
query getFactors(
$fgId: ID!,
$fields_summary: Boolean! = true,
$fields_full: Boolean! = true
) {
factorgraphs(where: { id: $fgId }) {
factors {
...FRAGMENT_FACTOR_SKELETON
...FRAGMENT_FACTOR_SUMMARY @include(if: $fields_summary)
...FRAGMENT_FACTOR @include(if: $fields_full)
}
}
}
"""
QUERY_GET_FACTORS_FILTERED = """
query getFactors_filtered(
$sessionId: ID!,
$factor_label_regexp: String = ".*",
$factor_tags: [String] = ["FACTOR"],
$solvable: Int! = 0,
$fields_summary: Boolean! = false,
$fields_full: Boolean! = false
){
factors( where: {
session: {id: $sessionId},
label_MATCHES: $factor_label_regexp,
tags: $factor_tags,
solvable_GTE: $solvable},
options: { sort: [{ label: ASC } ]}) {
...FRAGMENT_FACTOR_SKELETON
...FRAGMENT_FACTOR_SUMMARY @include(if: $fields_summary)
...FRAGMENT_FACTOR @include(if: $fields_full)
}
}
"""
MUTATION_ADD_FACTORS = """
mutation addFactors($factorsToCreate: [FactorCreateInput!]!) {
addFactors(
input: $factorsToCreate
) {
factors {
...FRAGMENT_FACTOR_SKELETON
...FRAGMENT_FACTOR_SUMMARY
...FRAGMENT_FACTOR
}
}
}
"""
QUERY_LISTFACTORS = """
query listFactors($fgId: ID!, $where: ListWhere = {}) {
listFactors(fgId: $fgId, where: $where)
}
"""
MUTATION_DELETE_FACTOR = """
mutation deleteFactor($factorId: ID!) {
deleteFactors(
where: { id: $factorId }
delete: {
blobEntries: {
where: {
node: { parentConnection: {Factor: { node: { id: $factorId } } } }
}
}
}
) {
nodesDeleted
relationshipsDeleted
}
}
"""