@myrmidon/cadmus-graph-ui-ex 10.2.1 → 12.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -20
- package/fesm2022/myrmidon-cadmus-graph-ui-ex.mjs +1222 -1244
- package/fesm2022/myrmidon-cadmus-graph-ui-ex.mjs.map +1 -1
- package/lib/components/graph-walker/graph-walker.component.d.ts +10 -10
- package/lib/components/linked-literal-filter/linked-literal-filter.component.d.ts +5 -13
- package/lib/components/linked-node-filter/linked-node-filter.component.d.ts +6 -15
- package/lib/components/triple-filter/triple-filter.component.d.ts +6 -15
- package/lib/pipes/graph-node-label.pipe.d.ts +1 -1
- package/package.json +4 -4
- package/public-api.d.ts +0 -1
- package/lib/cadmus-graph-ui-ex.module.d.ts +0 -31
|
@@ -1,803 +1,476 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { take } from 'rxjs
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import * as
|
|
11
|
-
import {
|
|
12
|
-
import * as i5$1 from '@angular/material/progress-bar';
|
|
13
|
-
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
|
14
|
-
import * as i6$2 from '@angular/material/tabs';
|
|
15
|
-
import { MatTabsModule } from '@angular/material/tabs';
|
|
16
|
-
import * as i9 from '@angular/material/tooltip';
|
|
17
|
-
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
18
|
-
import * as i8$1 from '@swimlane/ngx-graph';
|
|
19
|
-
import { NgxGraphModule } from '@swimlane/ngx-graph';
|
|
2
|
+
import { input, model, effect, Component, Pipe, output } from '@angular/core';
|
|
3
|
+
import { AsyncPipe } from '@angular/common';
|
|
4
|
+
import { forkJoin, from, BehaviorSubject, Subject, take as take$1 } from 'rxjs';
|
|
5
|
+
import { MatIconButton } from '@angular/material/button';
|
|
6
|
+
import { MatTooltip } from '@angular/material/tooltip';
|
|
7
|
+
import { MatIcon } from '@angular/material/icon';
|
|
8
|
+
import { MatProgressBar } from '@angular/material/progress-bar';
|
|
9
|
+
import { MatTabGroup, MatTab, MatTabLabel } from '@angular/material/tabs';
|
|
10
|
+
import * as i3$1 from '@swimlane/ngx-graph';
|
|
11
|
+
import { GraphModule } from '@swimlane/ngx-graph';
|
|
20
12
|
import * as i1 from '@angular/forms';
|
|
21
13
|
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
22
|
-
import
|
|
23
|
-
import {
|
|
24
|
-
import
|
|
25
|
-
import {
|
|
26
|
-
import
|
|
27
|
-
import { MatInputModule } from '@angular/material/input';
|
|
28
|
-
import * as i8 from '@angular/material/paginator';
|
|
29
|
-
import { MatPaginatorModule } from '@angular/material/paginator';
|
|
30
|
-
import * as i10 from '@myrmidon/cadmus-refs-lookup';
|
|
14
|
+
import { MatPaginator } from '@angular/material/paginator';
|
|
15
|
+
import { MatCheckbox } from '@angular/material/checkbox';
|
|
16
|
+
import { MatList, MatListItem } from '@angular/material/list';
|
|
17
|
+
import { MatFormField } from '@angular/material/form-field';
|
|
18
|
+
import { MatInput } from '@angular/material/input';
|
|
31
19
|
import { RefLookupComponent } from '@myrmidon/cadmus-refs-lookup';
|
|
32
|
-
import * as
|
|
33
|
-
import * as
|
|
34
|
-
import {
|
|
35
|
-
import
|
|
36
|
-
import {
|
|
37
|
-
import
|
|
38
|
-
import
|
|
39
|
-
import * as i9$1 from '@angular/material/list';
|
|
40
|
-
import { MatListModule } from '@angular/material/list';
|
|
41
|
-
import * as i12$1 from '@angular/common';
|
|
42
|
-
import { CommonModule } from '@angular/common';
|
|
43
|
-
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
|
|
44
|
-
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
45
|
-
import { CadmusCoreModule } from '@myrmidon/cadmus-core';
|
|
20
|
+
import * as i2 from '@myrmidon/cadmus-graph-ui';
|
|
21
|
+
import * as i3 from '@myrmidon/cadmus-api';
|
|
22
|
+
import { take } from 'rxjs/operators';
|
|
23
|
+
import { MatSelect } from '@angular/material/select';
|
|
24
|
+
import { MatOption } from '@angular/material/core';
|
|
25
|
+
import { MatChipListbox, MatChipOption, MatChipRemove } from '@angular/material/chips';
|
|
26
|
+
import * as i2$1 from '@myrmidon/ngx-mat-tools';
|
|
46
27
|
|
|
47
|
-
//#endregion
|
|
48
28
|
/**
|
|
49
|
-
*
|
|
50
|
-
* This class encapsulates data used for interactively exploring a graph
|
|
51
|
-
* starting from a designated origin node.
|
|
29
|
+
* Triples filter.
|
|
52
30
|
*/
|
|
53
|
-
class
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
* or property groups. You can easily determine the type of each node
|
|
57
|
-
* by looking at the first character of its id (N=node, L=literal,
|
|
58
|
-
* P=property).
|
|
59
|
-
*/
|
|
60
|
-
get nodes$() {
|
|
61
|
-
return this._nodes$.asObservable();
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* The edges connecting nodes.
|
|
65
|
-
*/
|
|
66
|
-
get edges$() {
|
|
67
|
-
return this._edges$.asObservable();
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* True if the walker is loading data.
|
|
71
|
-
*/
|
|
72
|
-
get loading$() {
|
|
73
|
-
return this._loading$.asObservable();
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* The last error occurred in communicating with the server, if any.
|
|
77
|
-
*/
|
|
78
|
-
get error$() {
|
|
79
|
-
return this._error$.asObservable();
|
|
80
|
-
}
|
|
31
|
+
class TripleFilterComponent {
|
|
32
|
+
lookupService;
|
|
33
|
+
_graphService;
|
|
81
34
|
/**
|
|
82
|
-
*
|
|
35
|
+
* True if this component is disabled.
|
|
83
36
|
*/
|
|
84
|
-
|
|
85
|
-
return this._selectedNode$.asObservable();
|
|
86
|
-
}
|
|
37
|
+
disabled = input(false);
|
|
87
38
|
/**
|
|
88
|
-
*
|
|
39
|
+
* True if this component should show a pager.
|
|
89
40
|
*/
|
|
90
|
-
|
|
91
|
-
return this._pOutFilter$.asObservable();
|
|
92
|
-
}
|
|
41
|
+
hasPager = input(false);
|
|
93
42
|
/**
|
|
94
|
-
* The
|
|
43
|
+
* The total number of triples returned from the last
|
|
44
|
+
* page fetch operation. Used when hasPager is true.
|
|
95
45
|
*/
|
|
96
|
-
|
|
97
|
-
return this._pInFilter$.asObservable();
|
|
98
|
-
}
|
|
46
|
+
total = input(0);
|
|
99
47
|
/**
|
|
100
|
-
* The
|
|
48
|
+
* The filter.
|
|
101
49
|
*/
|
|
102
|
-
|
|
103
|
-
|
|
50
|
+
filter = model({
|
|
51
|
+
pageNumber: 1,
|
|
52
|
+
pageSize: 10,
|
|
53
|
+
});
|
|
54
|
+
pageNumber;
|
|
55
|
+
pageSize;
|
|
56
|
+
litPattern;
|
|
57
|
+
litType;
|
|
58
|
+
litLanguage;
|
|
59
|
+
minLitNumber;
|
|
60
|
+
maxLitNumber;
|
|
61
|
+
subj;
|
|
62
|
+
isNotPred;
|
|
63
|
+
preds;
|
|
64
|
+
notPreds;
|
|
65
|
+
hasLiteralObj;
|
|
66
|
+
obj;
|
|
67
|
+
sid;
|
|
68
|
+
isSidPrefix;
|
|
69
|
+
tag;
|
|
70
|
+
form;
|
|
71
|
+
constructor(formBuilder, lookupService, _graphService) {
|
|
72
|
+
this.lookupService = lookupService;
|
|
73
|
+
this._graphService = _graphService;
|
|
74
|
+
// form
|
|
75
|
+
this.pageNumber = formBuilder.control(1, { nonNullable: true });
|
|
76
|
+
this.pageSize = formBuilder.control(10, { nonNullable: true });
|
|
77
|
+
this.litPattern = formBuilder.control(null);
|
|
78
|
+
this.litType = formBuilder.control(null);
|
|
79
|
+
this.litLanguage = formBuilder.control(null);
|
|
80
|
+
this.minLitNumber = formBuilder.control(null);
|
|
81
|
+
this.maxLitNumber = formBuilder.control(null);
|
|
82
|
+
this.subj = formBuilder.control(null);
|
|
83
|
+
this.preds = formBuilder.control([], { nonNullable: true });
|
|
84
|
+
this.isNotPred = formBuilder.control(false, { nonNullable: true });
|
|
85
|
+
this.notPreds = formBuilder.control([], { nonNullable: true });
|
|
86
|
+
this.hasLiteralObj = formBuilder.control(null);
|
|
87
|
+
this.obj = formBuilder.control(null);
|
|
88
|
+
this.sid = formBuilder.control(null);
|
|
89
|
+
this.isSidPrefix = formBuilder.control(false, { nonNullable: true });
|
|
90
|
+
this.tag = formBuilder.control(null);
|
|
91
|
+
this.form = formBuilder.group({
|
|
92
|
+
pageNumber: this.pageNumber,
|
|
93
|
+
pageSize: this.pageSize,
|
|
94
|
+
litPattern: this.litPattern,
|
|
95
|
+
litType: this.litType,
|
|
96
|
+
litLanguage: this.litLanguage,
|
|
97
|
+
minLitNumber: this.minLitNumber,
|
|
98
|
+
maxLitNumber: this.maxLitNumber,
|
|
99
|
+
subj: this.subj,
|
|
100
|
+
preds: this.preds,
|
|
101
|
+
isNotPred: this.isNotPred,
|
|
102
|
+
notPreds: this.notPreds,
|
|
103
|
+
hasLiteralObj: this.hasLiteralObj,
|
|
104
|
+
obj: this.obj,
|
|
105
|
+
sid: this.sid,
|
|
106
|
+
isSidPrefix: this.isSidPrefix,
|
|
107
|
+
tag: this.tag,
|
|
108
|
+
});
|
|
109
|
+
effect(() => {
|
|
110
|
+
this.updateForm(this.filter());
|
|
111
|
+
});
|
|
104
112
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
113
|
+
updateForm(filter) {
|
|
114
|
+
this.pageNumber.setValue(filter.pageNumber);
|
|
115
|
+
this.pageSize.setValue(filter.pageSize);
|
|
116
|
+
this.litPattern.setValue(filter.literalPattern || null);
|
|
117
|
+
this.litType.setValue(filter.literalType || null);
|
|
118
|
+
this.litLanguage.setValue(filter.literalLanguage || null);
|
|
119
|
+
this.minLitNumber.setValue(filter.minLiteralNumber || null);
|
|
120
|
+
this.maxLitNumber.setValue(filter.maxLiteralNumber || null);
|
|
121
|
+
this.hasLiteralObj.setValue(filter.hasLiteralObject || null);
|
|
122
|
+
this.sid.setValue(filter.sid || null);
|
|
123
|
+
this.isSidPrefix.setValue(filter.isSidPrefix || false);
|
|
124
|
+
this.tag.setValue(filter.tag || null);
|
|
125
|
+
// load the referenced nodes so we can show them by label
|
|
126
|
+
forkJoin({
|
|
127
|
+
s: filter.subjectId
|
|
128
|
+
? this._graphService.getNode(filter.subjectId)
|
|
129
|
+
: from([null]),
|
|
130
|
+
p: filter.predicateIds?.length
|
|
131
|
+
? this._graphService.getNodeSet(filter.predicateIds)
|
|
132
|
+
: from([]),
|
|
133
|
+
o: filter.objectId
|
|
134
|
+
? this._graphService.getNode(filter.objectId)
|
|
135
|
+
: from([null]),
|
|
136
|
+
}).subscribe((result) => {
|
|
137
|
+
this.subj.setValue(result.s);
|
|
138
|
+
this.preds.setValue(result.p.filter((n) => n));
|
|
139
|
+
this.obj.setValue(result.o);
|
|
140
|
+
this.form.markAsPristine();
|
|
141
|
+
});
|
|
110
142
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
143
|
+
getFilter() {
|
|
144
|
+
return {
|
|
145
|
+
pageNumber: +this.pageNumber.value,
|
|
146
|
+
pageSize: +this.pageSize.value,
|
|
147
|
+
literalPattern: this.litPattern.value || undefined,
|
|
148
|
+
literalType: this.litType.value || undefined,
|
|
149
|
+
literalLanguage: this.litLanguage.value || undefined,
|
|
150
|
+
minLiteralNumber: this.minLitNumber.value || undefined,
|
|
151
|
+
maxLiteralNumber: this.maxLitNumber.value || undefined,
|
|
152
|
+
subjectId: this.subj.value?.id || undefined,
|
|
153
|
+
predicateIds: this.preds.value?.length
|
|
154
|
+
? this.preds.value.map((n) => n.id)
|
|
155
|
+
: undefined,
|
|
156
|
+
notPredicateIds: this.notPreds.value?.length
|
|
157
|
+
? this.notPreds.value.map((n) => n.id)
|
|
158
|
+
: undefined,
|
|
159
|
+
hasLiteralObject: this.hasLiteralObj.value !== null
|
|
160
|
+
? this.hasLiteralObj.value
|
|
161
|
+
: undefined,
|
|
162
|
+
objectId: this.obj.value?.id || undefined,
|
|
163
|
+
sid: this.sid.value || undefined,
|
|
164
|
+
isSidPrefix: this.isSidPrefix.value,
|
|
165
|
+
tag: this.tag.value || undefined,
|
|
166
|
+
};
|
|
116
167
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
get childTotals$() {
|
|
121
|
-
return this._childTotals$.asObservable();
|
|
168
|
+
onPageChange(page) {
|
|
169
|
+
this.pageNumber.setValue(page.pageIndex + 1);
|
|
170
|
+
this.filter.set(this.getFilter());
|
|
122
171
|
}
|
|
123
|
-
|
|
124
|
-
this.
|
|
125
|
-
this._nodes$ = new BehaviorSubject([]);
|
|
126
|
-
this._edges$ = new BehaviorSubject([]);
|
|
127
|
-
this._loading$ = new BehaviorSubject(false);
|
|
128
|
-
this._error$ = new BehaviorSubject(null);
|
|
129
|
-
this._selectedNode$ = new BehaviorSubject(null);
|
|
130
|
-
this._pOutFilter$ = new BehaviorSubject(null);
|
|
131
|
-
this._pInFilter$ = new BehaviorSubject(null);
|
|
132
|
-
this._pLitFilter$ = new BehaviorSubject(null);
|
|
133
|
-
this._nOutFilter$ = new BehaviorSubject(null);
|
|
134
|
-
this._nInFilter$ = new BehaviorSubject(null);
|
|
135
|
-
this._childTotals$ = new BehaviorSubject({
|
|
136
|
-
nOut: 0,
|
|
137
|
-
nIn: 0,
|
|
138
|
-
pOut: 0,
|
|
139
|
-
pIn: 0,
|
|
140
|
-
pLit: 0,
|
|
141
|
-
});
|
|
142
|
-
// defaults
|
|
143
|
-
this.pageSize = 10;
|
|
144
|
-
this.maxLiteralLen = 30;
|
|
172
|
+
onSubjectNodeChange(node) {
|
|
173
|
+
this.subj.setValue(node);
|
|
145
174
|
}
|
|
146
|
-
|
|
147
|
-
|
|
175
|
+
onObjectNodeChange(node) {
|
|
176
|
+
this.obj.setValue(node);
|
|
148
177
|
}
|
|
149
|
-
|
|
150
|
-
if (
|
|
151
|
-
|
|
152
|
-
this._loading$.next(true);
|
|
153
|
-
}
|
|
154
|
-
else {
|
|
155
|
-
this._loading$.next(false);
|
|
178
|
+
onPredicateNodeChange(node) {
|
|
179
|
+
if (!node) {
|
|
180
|
+
return;
|
|
156
181
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
if (
|
|
161
|
-
|
|
162
|
-
console.error(error);
|
|
163
|
-
}
|
|
164
|
-
else {
|
|
165
|
-
this._error$.next('Walker error');
|
|
166
|
-
console.error(JSON.stringify(error));
|
|
182
|
+
const un = node;
|
|
183
|
+
if (this.isNotPred.value) {
|
|
184
|
+
const nodes = [...this.notPreds.value];
|
|
185
|
+
if (nodes.some((n) => n.id === un.id)) {
|
|
186
|
+
return;
|
|
167
187
|
}
|
|
188
|
+
nodes.push(un);
|
|
189
|
+
this.notPreds.setValue(nodes);
|
|
190
|
+
this.notPreds.updateValueAndValidity();
|
|
191
|
+
this.notPreds.markAsDirty();
|
|
168
192
|
}
|
|
169
193
|
else {
|
|
170
|
-
this.
|
|
194
|
+
const nodes = [...this.preds.value];
|
|
195
|
+
if (nodes.some((n) => n.id === un.id)) {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
nodes.push(un);
|
|
199
|
+
this.preds.setValue(nodes);
|
|
200
|
+
this.preds.updateValueAndValidity();
|
|
201
|
+
this.preds.markAsDirty();
|
|
171
202
|
}
|
|
172
203
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
* @param id The graph node ID (...N + its data node numeric ID)
|
|
181
|
-
* @returns The data node numeric ID.
|
|
182
|
-
*/
|
|
183
|
-
getNodeNumericId(id) {
|
|
184
|
-
const i = id.indexOf('N');
|
|
185
|
-
return i === -1 ? 0 : +id.substring(i + 1);
|
|
204
|
+
deleteNotPred(node) {
|
|
205
|
+
const nodes = [...this.notPreds.value];
|
|
206
|
+
const i = nodes.indexOf(node);
|
|
207
|
+
nodes.splice(i, 1);
|
|
208
|
+
this.notPreds.setValue(nodes);
|
|
209
|
+
this.notPreds.updateValueAndValidity();
|
|
210
|
+
this.notPreds.markAsDirty();
|
|
186
211
|
}
|
|
187
|
-
|
|
188
|
-
const
|
|
189
|
-
const
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
}
|
|
195
|
-
buildPropertyId(predicateId, nodeId) {
|
|
196
|
-
return `P${predicateId}N${nodeId}`;
|
|
197
|
-
}
|
|
198
|
-
buildLiteralId(tripleId) {
|
|
199
|
-
return `L${tripleId}`;
|
|
212
|
+
deletePred(node) {
|
|
213
|
+
const nodes = [...this.preds.value];
|
|
214
|
+
const i = nodes.indexOf(node);
|
|
215
|
+
nodes.splice(i, 1);
|
|
216
|
+
this.preds.setValue(nodes);
|
|
217
|
+
this.preds.updateValueAndValidity();
|
|
218
|
+
this.preds.markAsDirty();
|
|
200
219
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
domainMin);
|
|
220
|
+
reset() {
|
|
221
|
+
this.form.reset();
|
|
222
|
+
this.filter.set(this.getFilter());
|
|
205
223
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
if (edges.some((e) => e.id === id)) {
|
|
224
|
+
apply() {
|
|
225
|
+
if (this.form.invalid) {
|
|
209
226
|
return;
|
|
210
227
|
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
const invId = 'E' + id.substring(i + 1) + '_' + id.substring(1, i);
|
|
214
|
-
if (edges.some((e) => e.id === invId)) {
|
|
215
|
-
return;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
edges.push(edge);
|
|
219
|
-
}
|
|
220
|
-
resetFilters() {
|
|
221
|
-
this._nOutFilter$.next(null);
|
|
222
|
-
this._nInFilter$.next(null);
|
|
223
|
-
this._pOutFilter$.next(null);
|
|
224
|
-
this._pInFilter$.next(null);
|
|
225
|
-
this._pLitFilter$.next(null);
|
|
226
|
-
this._childTotals$.next({
|
|
227
|
-
nOut: 0,
|
|
228
|
-
nIn: 0,
|
|
229
|
-
pOut: 0,
|
|
230
|
-
pIn: 0,
|
|
231
|
-
pLit: 0,
|
|
232
|
-
});
|
|
228
|
+
this.filter.set(this.getFilter());
|
|
229
|
+
this.form.markAsPristine();
|
|
233
230
|
}
|
|
231
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: TripleFilterComponent, deps: [{ token: i1.FormBuilder }, { token: i2.GraphNodeLookupService }, { token: i3.GraphService }], target: i0.ɵɵFactoryTarget.Component });
|
|
232
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.3", type: TripleFilterComponent, isStandalone: true, selector: "cadmus-walker-triple-filter", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, hasPager: { classPropertyName: "hasPager", publicName: "hasPager", isSignal: true, isRequired: false, transformFunction: null }, total: { classPropertyName: "total", publicName: "total", isSignal: true, isRequired: false, transformFunction: null }, filter: { classPropertyName: "filter", publicName: "filter", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { filter: "filterChange" }, ngImport: i0, template: "<form [formGroup]=\"form\" (submit)=\"apply()\" [attr.disabled]=\"disabled()\">\n <!-- paginator -->\n @if (hasPager()) {\n <mat-paginator\n [length]=\"total\"\n [pageSize]=\"pageSize.value || 10\"\n [pageSizeOptions]=\"[5, 10, 20]\"\n (page)=\"onPageChange($event)\"\n aria-label=\"Select page\"\n />\n }\n <mat-tab-group>\n <!-- TRIPLE -->\n <mat-tab label=\"triple\">\n <!-- subject ID -->\n <div>\n <cadmus-ref-lookup\n label=\"subject\"\n [service]=\"lookupService\"\n (itemChange)=\"onSubjectNodeChange($event)\"\n />\n </div>\n <!-- predicate IDs -->\n <div>\n <cadmus-ref-lookup\n label=\"predicate\"\n [service]=\"lookupService\"\n [baseFilter]=\"{ tag: 'property' }\"\n (itemChange)=\"onPredicateNodeChange($event)\"\n />\n <mat-checkbox [formControl]=\"isNotPred\">not</mat-checkbox>\n <!-- notPreds -->\n @if (isNotPred.value) {\n <div>\n <mat-list dense>\n @for (n of notPreds.value; track n.id) {\n <mat-list-item>\n <span>{{ n.label }}</span>\n <button type=\"button\" mat-icon-button (click)=\"deleteNotPred(n)\">\n <mat-icon class=\"mat-warn\">clear</mat-icon>\n </button>\n </mat-list-item>\n }\n </mat-list>\n </div>\n }\n <!-- preds -->\n @if (!isNotPred.value) {\n <div>\n <mat-list dense>\n @for (n of preds.value; track n.id) {\n <mat-list-item>\n <span>{{ n.label }}</span>\n <button type=\"button\" mat-icon-button (click)=\"deletePred(n)\">\n <mat-icon class=\"mat-warn\">clear</mat-icon>\n </button>\n </mat-list-item>\n }\n </mat-list>\n </div>\n }\n </div>\n <!-- object ID -->\n <div>\n <cadmus-ref-lookup\n label=\"object\"\n [service]=\"lookupService\"\n (itemChange)=\"onObjectNodeChange($event)\"\n />\n </div>\n <!-- sid -->\n <div>\n <mat-form-field>\n <input\n matInput\n [formControl]=\"sid\"\n placeholder=\"sid\"\n maxlength=\"500\"\n />\n </mat-form-field>\n \n <mat-checkbox [formControl]=\"isSidPrefix\">prefix</mat-checkbox>\n </div>\n <!-- tag -->\n <div>\n <mat-form-field>\n <input\n matInput\n [formControl]=\"tag\"\n placeholder=\"tag\"\n maxlength=\"50\"\n />\n </mat-form-field>\n </div>\n </mat-tab>\n <!-- LITERAL -->\n <mat-tab label=\"literal\">\n <!-- litPattern -->\n <div>\n <mat-form-field>\n <input matInput [formControl]=\"litPattern\" placeholder=\"pattern\" />\n </mat-form-field>\n </div>\n <!-- litType -->\n <div>\n <mat-form-field>\n <input matInput [formControl]=\"litType\" placeholder=\"type\" />\n </mat-form-field>\n </div>\n <!-- litLanguage-->\n <div>\n <mat-form-field>\n <input matInput [formControl]=\"litLanguage\" placeholder=\"language\" />\n </mat-form-field>\n </div>\n <!-- minLitNumber, maxLitNumber -->\n <div>\n <mat-form-field style=\"width: 4em\">\n <input\n matInput\n type=\"number\"\n [formControl]=\"minLitNumber\"\n placeholder=\"min.\"\n />\n </mat-form-field>\n -\n <mat-form-field style=\"width: 4em\">\n <input\n matInput\n type=\"number\"\n [formControl]=\"maxLitNumber\"\n placeholder=\"max.\"\n />\n </mat-form-field>\n </div>\n </mat-tab>\n </mat-tab-group>\n <div\n class=\"btn-group\"\n role=\"group\"\n aria-label=\"toolbar\"\n style=\"margin-bottom: 10px\"\n >\n <button\n mat-icon-button\n type=\"button\"\n (click)=\"reset()\"\n matTooltip=\"Reset filters\"\n [disabled]=\"disabled()\"\n >\n <mat-icon class=\"mat-warn\">clear</mat-icon>\n </button>\n <button\n type=\"submit\"\n mat-icon-button\n [disabled]=\"disabled()\"\n matTooltip=\"Apply filters\"\n >\n <mat-icon class=\"mat-primary\">check_circle</mat-icon>\n </button>\n </div>\n</form>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: MatPaginator, selector: "mat-paginator", inputs: ["color", "pageIndex", "length", "pageSize", "pageSizeOptions", "hidePageSize", "showFirstLastButtons", "selectConfig", "disabled"], outputs: ["page"], exportAs: ["matPaginator"] }, { kind: "component", type: MatTabGroup, selector: "mat-tab-group", inputs: ["color", "fitInkBarToContent", "mat-stretch-tabs", "mat-align-tabs", "dynamicHeight", "selectedIndex", "headerPosition", "animationDuration", "contentTabIndex", "disablePagination", "disableRipple", "preserveContent", "backgroundColor", "aria-label", "aria-labelledby"], outputs: ["selectedIndexChange", "focusChange", "animationDone", "selectedTabChange"], exportAs: ["matTabGroup"] }, { kind: "component", type: MatTab, selector: "mat-tab", inputs: ["disabled", "label", "aria-label", "aria-labelledby", "labelClass", "bodyClass"], exportAs: ["matTab"] }, { kind: "component", type: RefLookupComponent, selector: "cadmus-ref-lookup", inputs: ["label", "limit", "baseFilter", "service", "item", "required", "hasMore", "linkTemplate", "optDialog", "options"], outputs: ["itemChange", "optionsChange", "moreRequest"] }, { kind: "component", type: MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "component", type: MatList, selector: "mat-list", exportAs: ["matList"] }, { kind: "component", type: MatListItem, selector: "mat-list-item, a[mat-list-item], button[mat-list-item]", inputs: ["activated"], exportAs: ["matListItem"] }, { kind: "component", type: MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "directive", type: MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }] });
|
|
233
|
+
}
|
|
234
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: TripleFilterComponent, decorators: [{
|
|
235
|
+
type: Component,
|
|
236
|
+
args: [{ selector: 'cadmus-walker-triple-filter', imports: [
|
|
237
|
+
FormsModule,
|
|
238
|
+
ReactiveFormsModule,
|
|
239
|
+
MatPaginator,
|
|
240
|
+
MatTabGroup,
|
|
241
|
+
MatTab,
|
|
242
|
+
RefLookupComponent,
|
|
243
|
+
MatCheckbox,
|
|
244
|
+
MatList,
|
|
245
|
+
MatListItem,
|
|
246
|
+
MatIconButton,
|
|
247
|
+
MatIcon,
|
|
248
|
+
MatFormField,
|
|
249
|
+
MatInput,
|
|
250
|
+
MatTooltip,
|
|
251
|
+
], template: "<form [formGroup]=\"form\" (submit)=\"apply()\" [attr.disabled]=\"disabled()\">\n <!-- paginator -->\n @if (hasPager()) {\n <mat-paginator\n [length]=\"total\"\n [pageSize]=\"pageSize.value || 10\"\n [pageSizeOptions]=\"[5, 10, 20]\"\n (page)=\"onPageChange($event)\"\n aria-label=\"Select page\"\n />\n }\n <mat-tab-group>\n <!-- TRIPLE -->\n <mat-tab label=\"triple\">\n <!-- subject ID -->\n <div>\n <cadmus-ref-lookup\n label=\"subject\"\n [service]=\"lookupService\"\n (itemChange)=\"onSubjectNodeChange($event)\"\n />\n </div>\n <!-- predicate IDs -->\n <div>\n <cadmus-ref-lookup\n label=\"predicate\"\n [service]=\"lookupService\"\n [baseFilter]=\"{ tag: 'property' }\"\n (itemChange)=\"onPredicateNodeChange($event)\"\n />\n <mat-checkbox [formControl]=\"isNotPred\">not</mat-checkbox>\n <!-- notPreds -->\n @if (isNotPred.value) {\n <div>\n <mat-list dense>\n @for (n of notPreds.value; track n.id) {\n <mat-list-item>\n <span>{{ n.label }}</span>\n <button type=\"button\" mat-icon-button (click)=\"deleteNotPred(n)\">\n <mat-icon class=\"mat-warn\">clear</mat-icon>\n </button>\n </mat-list-item>\n }\n </mat-list>\n </div>\n }\n <!-- preds -->\n @if (!isNotPred.value) {\n <div>\n <mat-list dense>\n @for (n of preds.value; track n.id) {\n <mat-list-item>\n <span>{{ n.label }}</span>\n <button type=\"button\" mat-icon-button (click)=\"deletePred(n)\">\n <mat-icon class=\"mat-warn\">clear</mat-icon>\n </button>\n </mat-list-item>\n }\n </mat-list>\n </div>\n }\n </div>\n <!-- object ID -->\n <div>\n <cadmus-ref-lookup\n label=\"object\"\n [service]=\"lookupService\"\n (itemChange)=\"onObjectNodeChange($event)\"\n />\n </div>\n <!-- sid -->\n <div>\n <mat-form-field>\n <input\n matInput\n [formControl]=\"sid\"\n placeholder=\"sid\"\n maxlength=\"500\"\n />\n </mat-form-field>\n \n <mat-checkbox [formControl]=\"isSidPrefix\">prefix</mat-checkbox>\n </div>\n <!-- tag -->\n <div>\n <mat-form-field>\n <input\n matInput\n [formControl]=\"tag\"\n placeholder=\"tag\"\n maxlength=\"50\"\n />\n </mat-form-field>\n </div>\n </mat-tab>\n <!-- LITERAL -->\n <mat-tab label=\"literal\">\n <!-- litPattern -->\n <div>\n <mat-form-field>\n <input matInput [formControl]=\"litPattern\" placeholder=\"pattern\" />\n </mat-form-field>\n </div>\n <!-- litType -->\n <div>\n <mat-form-field>\n <input matInput [formControl]=\"litType\" placeholder=\"type\" />\n </mat-form-field>\n </div>\n <!-- litLanguage-->\n <div>\n <mat-form-field>\n <input matInput [formControl]=\"litLanguage\" placeholder=\"language\" />\n </mat-form-field>\n </div>\n <!-- minLitNumber, maxLitNumber -->\n <div>\n <mat-form-field style=\"width: 4em\">\n <input\n matInput\n type=\"number\"\n [formControl]=\"minLitNumber\"\n placeholder=\"min.\"\n />\n </mat-form-field>\n -\n <mat-form-field style=\"width: 4em\">\n <input\n matInput\n type=\"number\"\n [formControl]=\"maxLitNumber\"\n placeholder=\"max.\"\n />\n </mat-form-field>\n </div>\n </mat-tab>\n </mat-tab-group>\n <div\n class=\"btn-group\"\n role=\"group\"\n aria-label=\"toolbar\"\n style=\"margin-bottom: 10px\"\n >\n <button\n mat-icon-button\n type=\"button\"\n (click)=\"reset()\"\n matTooltip=\"Reset filters\"\n [disabled]=\"disabled()\"\n >\n <mat-icon class=\"mat-warn\">clear</mat-icon>\n </button>\n <button\n type=\"submit\"\n mat-icon-button\n [disabled]=\"disabled()\"\n matTooltip=\"Apply filters\"\n >\n <mat-icon class=\"mat-primary\">check_circle</mat-icon>\n </button>\n </div>\n</form>\n" }]
|
|
252
|
+
}], ctorParameters: () => [{ type: i1.FormBuilder }, { type: i2.GraphNodeLookupService }, { type: i3.GraphService }] });
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Linked non-literal node filter.
|
|
256
|
+
*/
|
|
257
|
+
class LinkedNodeFilterComponent {
|
|
258
|
+
lookupService;
|
|
259
|
+
_graphService;
|
|
234
260
|
/**
|
|
235
|
-
*
|
|
236
|
-
* filters, which depend on the selected node.
|
|
237
|
-
*
|
|
238
|
-
* @param id The node ID or null to deselect the selected node.
|
|
261
|
+
* True if this component is disabled.
|
|
239
262
|
*/
|
|
240
|
-
|
|
241
|
-
const node = id ? this._nodes$.value.find((n) => n.id === id) : null;
|
|
242
|
-
if (!node) {
|
|
243
|
-
this._selectedNode$.next(null);
|
|
244
|
-
this.resetFilters();
|
|
245
|
-
return;
|
|
246
|
-
}
|
|
247
|
-
// deselect
|
|
248
|
-
const old = this._nodes$.value.find((n) => n.data?.selected);
|
|
249
|
-
if (old) {
|
|
250
|
-
old.data.selected = undefined;
|
|
251
|
-
}
|
|
252
|
-
// select
|
|
253
|
-
node.data.selected = true;
|
|
254
|
-
this._selectedNode$.next(node);
|
|
255
|
-
switch (node.id.charAt(0)) {
|
|
256
|
-
case 'N': // non-literal node
|
|
257
|
-
const nd = node.data;
|
|
258
|
-
this._nOutFilter$.next(nd.outFilter);
|
|
259
|
-
this._nInFilter$.next(nd.inFilter);
|
|
260
|
-
this._pOutFilter$.next(null);
|
|
261
|
-
this._pInFilter$.next(null);
|
|
262
|
-
this._pLitFilter$.next(null);
|
|
263
|
-
this._childTotals$.next({
|
|
264
|
-
nOut: nd.outTotal || 0,
|
|
265
|
-
nIn: nd.inTotal || 0,
|
|
266
|
-
pOut: 0,
|
|
267
|
-
pIn: 0,
|
|
268
|
-
pLit: 0,
|
|
269
|
-
});
|
|
270
|
-
break;
|
|
271
|
-
case 'P': // props group
|
|
272
|
-
const pd = node.data;
|
|
273
|
-
this._nOutFilter$.next(null);
|
|
274
|
-
this._nInFilter$.next(null);
|
|
275
|
-
this._pOutFilter$.next(pd.outFilter);
|
|
276
|
-
this._pInFilter$.next(pd.inFilter);
|
|
277
|
-
this._pLitFilter$.next(pd.litFilter);
|
|
278
|
-
this._childTotals$.next({
|
|
279
|
-
nOut: 0,
|
|
280
|
-
nIn: 0,
|
|
281
|
-
pOut: pd.outTotal || 0,
|
|
282
|
-
pIn: pd.inTotal || 0,
|
|
283
|
-
pLit: pd.litTotal || 0,
|
|
284
|
-
});
|
|
285
|
-
break;
|
|
286
|
-
case 'L': // literal node
|
|
287
|
-
this.resetFilters();
|
|
288
|
-
break;
|
|
289
|
-
}
|
|
290
|
-
}
|
|
263
|
+
disabled = input();
|
|
291
264
|
/**
|
|
292
|
-
*
|
|
293
|
-
*
|
|
294
|
-
* @param id The ID of the origin node to start from ("root origin").
|
|
265
|
+
* True if this component should show a pager.
|
|
295
266
|
*/
|
|
296
|
-
|
|
297
|
-
this.toggleLoading(true);
|
|
298
|
-
this._graphService
|
|
299
|
-
.getNode(id)
|
|
300
|
-
.pipe(take(1))
|
|
301
|
-
.subscribe({
|
|
302
|
-
next: (node) => {
|
|
303
|
-
const nodes = [];
|
|
304
|
-
const data = {
|
|
305
|
-
uri: node.uri,
|
|
306
|
-
sourceType: node.sourceType,
|
|
307
|
-
originId: '', // root origin
|
|
308
|
-
customColor: '#F89427',
|
|
309
|
-
outFilter: {
|
|
310
|
-
pageNumber: 1,
|
|
311
|
-
pageSize: this.pageSize,
|
|
312
|
-
},
|
|
313
|
-
inFilter: {
|
|
314
|
-
pageNumber: 1,
|
|
315
|
-
pageSize: this.pageSize,
|
|
316
|
-
},
|
|
317
|
-
sid: node.sid,
|
|
318
|
-
};
|
|
319
|
-
const n = {
|
|
320
|
-
id: this.buildNodeId(node.id),
|
|
321
|
-
label: node.label || node.uri,
|
|
322
|
-
data: data,
|
|
323
|
-
};
|
|
324
|
-
nodes.push(n);
|
|
325
|
-
this._rootNode = n;
|
|
326
|
-
this._edges$.next([]);
|
|
327
|
-
this._nodes$.next(nodes);
|
|
328
|
-
this.expandNode(n);
|
|
329
|
-
},
|
|
330
|
-
error: (error) => {
|
|
331
|
-
this.setError(error);
|
|
332
|
-
},
|
|
333
|
-
complete: () => {
|
|
334
|
-
this.toggleLoading(false);
|
|
335
|
-
},
|
|
336
|
-
});
|
|
337
|
-
}
|
|
267
|
+
hasPager = input(false);
|
|
338
268
|
/**
|
|
339
|
-
*
|
|
340
|
-
*
|
|
341
|
-
* @param edgeId The ID of the edge graph node.
|
|
342
|
-
* @returns IDs of the source and target graph nodes.
|
|
269
|
+
* The total number of nodes returned from the last
|
|
270
|
+
* page fetch operation. Used when hasPager is true.
|
|
343
271
|
*/
|
|
344
|
-
|
|
345
|
-
const m = new RegExp('^E([^_]+)_(.+)$').exec(edgeId);
|
|
346
|
-
return m ? [m[1], m[2]] : null;
|
|
347
|
-
}
|
|
272
|
+
total = input(0);
|
|
348
273
|
/**
|
|
349
|
-
*
|
|
350
|
-
*
|
|
351
|
-
* @param originId The ID of the origin graph node.
|
|
352
|
-
* @param nodes The nodes array to remove nodes from.
|
|
353
|
-
* @param removedIds The IDs of all the removed nodes.
|
|
274
|
+
* The filter.
|
|
354
275
|
*/
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
276
|
+
filter = model({
|
|
277
|
+
pageNumber: 1,
|
|
278
|
+
pageSize: 10,
|
|
279
|
+
otherNodeId: 0,
|
|
280
|
+
predicateId: 0,
|
|
281
|
+
});
|
|
282
|
+
otherNodeId;
|
|
283
|
+
predicateId;
|
|
284
|
+
isObject;
|
|
285
|
+
pageNumber;
|
|
286
|
+
pageSize;
|
|
287
|
+
uid;
|
|
288
|
+
isClass;
|
|
289
|
+
tag;
|
|
290
|
+
label;
|
|
291
|
+
sourceType;
|
|
292
|
+
sid;
|
|
293
|
+
isSidPrefix;
|
|
294
|
+
classes;
|
|
295
|
+
form;
|
|
296
|
+
constructor(formBuilder, lookupService, _graphService) {
|
|
297
|
+
this.lookupService = lookupService;
|
|
298
|
+
this._graphService = _graphService;
|
|
299
|
+
this.otherNodeId = 0;
|
|
300
|
+
this.predicateId = 0;
|
|
301
|
+
this.isObject = false;
|
|
302
|
+
// form
|
|
303
|
+
this.pageNumber = formBuilder.control(1, { nonNullable: true });
|
|
304
|
+
this.pageSize = formBuilder.control(10, { nonNullable: true });
|
|
305
|
+
this.uid = formBuilder.control(null);
|
|
306
|
+
this.isClass = formBuilder.control(null);
|
|
307
|
+
this.tag = formBuilder.control(null);
|
|
308
|
+
this.label = formBuilder.control(null);
|
|
309
|
+
this.sourceType = formBuilder.control(null);
|
|
310
|
+
this.sid = formBuilder.control(null);
|
|
311
|
+
this.isSidPrefix = formBuilder.control(false, { nonNullable: true });
|
|
312
|
+
this.classes = formBuilder.control([], { nonNullable: true });
|
|
313
|
+
this.form = formBuilder.group({
|
|
314
|
+
pageNumber: this.pageNumber,
|
|
315
|
+
pageSize: this.pageSize,
|
|
316
|
+
uid: this.uid,
|
|
317
|
+
isClass: this.isClass,
|
|
318
|
+
tag: this.tag,
|
|
319
|
+
label: this.label,
|
|
320
|
+
sourceType: this.sourceType,
|
|
321
|
+
sid: this.sid,
|
|
322
|
+
isSidPrefix: this.isSidPrefix,
|
|
323
|
+
classes: this.classes,
|
|
367
324
|
});
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
removedIds.add(id);
|
|
325
|
+
effect(() => {
|
|
326
|
+
this.updateForm(this.filter());
|
|
371
327
|
});
|
|
372
328
|
}
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
this.
|
|
386
|
-
//
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
* @param sourceId The source node ID.
|
|
403
|
-
* @param group The triple group emitting this node.
|
|
404
|
-
* @returns A new graph node.
|
|
405
|
-
*/
|
|
406
|
-
buildPropertyNode(sourceId, group) {
|
|
407
|
-
const nid = this.getNodeNumericId(sourceId);
|
|
408
|
-
const data = {
|
|
409
|
-
originId: sourceId,
|
|
410
|
-
uri: group.predicateUri,
|
|
411
|
-
customColor: '#FF5619',
|
|
412
|
-
outFilter: {
|
|
413
|
-
pageNumber: 1,
|
|
414
|
-
pageSize: this.pageSize,
|
|
415
|
-
otherNodeId: nid,
|
|
416
|
-
predicateId: group.predicateId,
|
|
417
|
-
},
|
|
418
|
-
inFilter: {
|
|
419
|
-
pageNumber: 1,
|
|
420
|
-
pageSize: this.pageSize,
|
|
421
|
-
otherNodeId: nid,
|
|
422
|
-
predicateId: group.predicateId,
|
|
423
|
-
},
|
|
424
|
-
litFilter: {
|
|
425
|
-
pageNumber: 1,
|
|
426
|
-
pageSize: this.pageSize,
|
|
427
|
-
predicateId: group.predicateId,
|
|
428
|
-
},
|
|
429
|
-
};
|
|
329
|
+
updateForm(filter) {
|
|
330
|
+
this.otherNodeId = filter.otherNodeId;
|
|
331
|
+
this.predicateId = filter.predicateId;
|
|
332
|
+
this.isObject = filter.isObject || false;
|
|
333
|
+
this.pageNumber.setValue(filter.pageNumber);
|
|
334
|
+
this.pageSize.setValue(filter.pageSize);
|
|
335
|
+
this.uid.setValue(filter.uid || null);
|
|
336
|
+
this.isClass.setValue(filter.isClass || null);
|
|
337
|
+
this.tag.setValue(filter.tag || null);
|
|
338
|
+
this.label.setValue(filter.label || null);
|
|
339
|
+
this.sourceType.setValue(filter.sourceType || null);
|
|
340
|
+
this.sid.setValue(filter.sid || null);
|
|
341
|
+
this.isSidPrefix.setValue(filter.isSidPrefix || false);
|
|
342
|
+
// load the referenced class nodes so we can show them by label
|
|
343
|
+
if (filter.classIds?.length) {
|
|
344
|
+
this._graphService
|
|
345
|
+
.getNodeSet(filter.classIds)
|
|
346
|
+
.pipe(take(1))
|
|
347
|
+
.subscribe((nodes) => {
|
|
348
|
+
this.classes.setValue(nodes.filter((n) => n));
|
|
349
|
+
this.form.markAsPristine();
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
else {
|
|
353
|
+
this.classes.setValue([]);
|
|
354
|
+
this.form.markAsPristine();
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
getFilter() {
|
|
430
358
|
return {
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
359
|
+
pageNumber: +this.pageNumber.value,
|
|
360
|
+
pageSize: +this.pageSize.value,
|
|
361
|
+
uid: this.uid.value || undefined,
|
|
362
|
+
isClass: this.isClass.value || undefined,
|
|
363
|
+
tag: this.tag.value || undefined,
|
|
364
|
+
label: this.label.value || undefined,
|
|
365
|
+
sourceType: this.sourceType.value || undefined,
|
|
366
|
+
sid: this.sid.value || undefined,
|
|
367
|
+
isSidPrefix: this.isSidPrefix.value ? true : undefined,
|
|
368
|
+
classIds: this.classes.value.length
|
|
369
|
+
? this.classes.value.map((n) => n.id)
|
|
370
|
+
: undefined,
|
|
371
|
+
otherNodeId: this.otherNodeId,
|
|
372
|
+
predicateId: this.predicateId,
|
|
373
|
+
isObject: this.isObject,
|
|
434
374
|
};
|
|
435
375
|
}
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
* @param node The node to expand.
|
|
440
|
-
* @param outFilter The properties to update for the output filter.
|
|
441
|
-
* @param inFilter The properties to update for the input filter.
|
|
442
|
-
*/
|
|
443
|
-
expandNode(node, outFilter, inFilter) {
|
|
444
|
-
// prepare filters
|
|
445
|
-
const nid = this.getNodeNumericId(node.id);
|
|
446
|
-
// outbound: node=S
|
|
447
|
-
const outf = outFilter
|
|
448
|
-
? Object.assign(node.data.outFilter, outFilter, {
|
|
449
|
-
subjectId: nid,
|
|
450
|
-
})
|
|
451
|
-
: {
|
|
452
|
-
pageNumber: 1,
|
|
453
|
-
pageSize: this.pageSize,
|
|
454
|
-
subjectId: nid,
|
|
455
|
-
};
|
|
456
|
-
// inbound: node=O
|
|
457
|
-
const inf = inFilter
|
|
458
|
-
? Object.assign(node.data.inFilter, inFilter, {
|
|
459
|
-
objectId: nid,
|
|
460
|
-
})
|
|
461
|
-
: {
|
|
462
|
-
pageNumber: 1,
|
|
463
|
-
pageSize: this.pageSize,
|
|
464
|
-
objectId: nid,
|
|
465
|
-
};
|
|
466
|
-
// load
|
|
467
|
-
this.toggleLoading(true);
|
|
468
|
-
const nodes = [...this._nodes$.value];
|
|
469
|
-
const edges = [...this._edges$.value];
|
|
470
|
-
forkJoin({
|
|
471
|
-
outs: this._graphService.getTripleGroups(outf.pageNumber, outf.pageSize, outf),
|
|
472
|
-
ins: this._graphService.getTripleGroups(inf.pageNumber, inf.pageSize, inf),
|
|
473
|
-
}).subscribe({
|
|
474
|
-
next: (result) => {
|
|
475
|
-
node.data.expanded = true;
|
|
476
|
-
// update origin's filters
|
|
477
|
-
node.data.outFilter = outf;
|
|
478
|
-
node.data.inFilter = inf;
|
|
479
|
-
// remove previous children
|
|
480
|
-
this.removeChildren(node.id, nodes, edges);
|
|
481
|
-
// add outbound children
|
|
482
|
-
node.data.outTotal = result.outs.total;
|
|
483
|
-
for (let i = 0; i < result.outs.items.length; i++) {
|
|
484
|
-
const group = result.outs.items[i];
|
|
485
|
-
const prop = this.buildPropertyNode(node.id, group);
|
|
486
|
-
// when expanding a node (e.g. N17) into props, the prop's ID is
|
|
487
|
-
// P + predicate ID + N + origin node ID (e.g. P30N17).
|
|
488
|
-
// This prop node can then be expanded, too, thus producing
|
|
489
|
-
// a node with ID = N + node ID. When this in turn gets expanded,
|
|
490
|
-
// it will produce also the prop node it comes from, which
|
|
491
|
-
// must not be re-inserted in the graph. This node in the new
|
|
492
|
-
// expansion context will get ID from the source node, which
|
|
493
|
-
// is different from the node at the other end of the prop node:
|
|
494
|
-
// this was e.g. N17, while the new node is e.g. N18. So, the
|
|
495
|
-
// prop previously identified as P30N17 would now be identified
|
|
496
|
-
// as P30N18, thus producing a duplicate. To avoid this, we
|
|
497
|
-
// calculate an alias ID from the origin's origin: for N18,
|
|
498
|
-
// its origin being P30N17, this will be N17. This produces an
|
|
499
|
-
// alias P30N17, which being already present will avoid duplicates.
|
|
500
|
-
// const aliasId = `P${group.predicateId}N${this.getNodeNumericId(
|
|
501
|
-
// node.data.originId
|
|
502
|
-
// )}`;
|
|
503
|
-
// if (!nodes.some((n) => n.id === prop.id || n.id === aliasId)) {
|
|
504
|
-
if (!nodes.some((n) => n.id === prop.id)) {
|
|
505
|
-
nodes.push(prop);
|
|
506
|
-
// edge from origin node to object property
|
|
507
|
-
const edge = {
|
|
508
|
-
id: this.buildEdgeId(node.id, prop.id),
|
|
509
|
-
label: group.predicateUri,
|
|
510
|
-
source: node.id,
|
|
511
|
-
target: prop.id,
|
|
512
|
-
data: {
|
|
513
|
-
originId: node.id,
|
|
514
|
-
},
|
|
515
|
-
};
|
|
516
|
-
this.addEdgeIfAbsent(edge, edges);
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
// add inbound children
|
|
520
|
-
node.data.inTotal = result.ins.total;
|
|
521
|
-
for (let i = 0; i < result.ins.items.length; i++) {
|
|
522
|
-
const g = result.ins.items[i];
|
|
523
|
-
// subject property
|
|
524
|
-
const p = this.buildPropertyNode(node.id, g);
|
|
525
|
-
// edge from object property to origin node
|
|
526
|
-
const edge = {
|
|
527
|
-
id: this.buildEdgeId(p.id, node.id),
|
|
528
|
-
label: g.predicateUri,
|
|
529
|
-
source: p.id,
|
|
530
|
-
target: node.id,
|
|
531
|
-
data: {
|
|
532
|
-
originId: node.id,
|
|
533
|
-
},
|
|
534
|
-
};
|
|
535
|
-
// do not add an edge having the same source P and target N,
|
|
536
|
-
// whatever the P's source node
|
|
537
|
-
const r = new RegExp('^EP' + g.predicateId + 'N[0-9]+_' + node.id + '$');
|
|
538
|
-
if (!edges.some((e) => r.test(e.id))) {
|
|
539
|
-
if (!nodes.some((n) => n.id === p.id)) {
|
|
540
|
-
nodes.push(p);
|
|
541
|
-
}
|
|
542
|
-
this.addEdgeIfAbsent(edge, edges);
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
// update
|
|
546
|
-
this._nodes$.next(nodes);
|
|
547
|
-
this._edges$.next(edges);
|
|
548
|
-
},
|
|
549
|
-
error: (error) => {
|
|
550
|
-
node.data.error = 'Error loading properties';
|
|
551
|
-
this._nodes$.next(nodes);
|
|
552
|
-
this.setError(error);
|
|
553
|
-
},
|
|
554
|
-
complete: () => {
|
|
555
|
-
this.toggleLoading(false);
|
|
556
|
-
},
|
|
557
|
-
});
|
|
376
|
+
onPageChange(page) {
|
|
377
|
+
this.pageNumber.setValue(page.pageIndex + 1);
|
|
378
|
+
this.filter.set(this.getFilter());
|
|
558
379
|
}
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
*
|
|
562
|
-
* @param outFilter The properties to update for the output filter.
|
|
563
|
-
* @param inFilter The properties to update for the input filter.
|
|
564
|
-
*/
|
|
565
|
-
expandSelectedNode(outFilter, inFilter) {
|
|
566
|
-
if (!this._selectedNode$.value ||
|
|
567
|
-
!this._selectedNode$.value.id.startsWith('N')) {
|
|
380
|
+
onClassAdd(node) {
|
|
381
|
+
if (!node) {
|
|
568
382
|
return;
|
|
569
383
|
}
|
|
570
|
-
const
|
|
571
|
-
|
|
384
|
+
const nodes = [...this.classes.value];
|
|
385
|
+
nodes.push(node);
|
|
386
|
+
this.classes.setValue(nodes);
|
|
387
|
+
this.classes.updateValueAndValidity();
|
|
388
|
+
this.classes.markAsDirty();
|
|
572
389
|
}
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
390
|
+
onClassRemove(node) {
|
|
391
|
+
const nodes = [...this.classes.value];
|
|
392
|
+
const i = nodes.indexOf(node);
|
|
393
|
+
if (i > -1) {
|
|
394
|
+
nodes.splice(i, 1);
|
|
395
|
+
this.classes.setValue(nodes);
|
|
396
|
+
this.classes.updateValueAndValidity();
|
|
397
|
+
this.classes.markAsDirty();
|
|
577
398
|
}
|
|
578
|
-
return value;
|
|
579
399
|
}
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
originId: sourceId,
|
|
584
|
-
customColor: '#80ff95',
|
|
585
|
-
uri: node.uri,
|
|
586
|
-
sourceType: node.sourceType,
|
|
587
|
-
isClass: node.isClass,
|
|
588
|
-
sid: node.sid,
|
|
589
|
-
tag: node.tag,
|
|
590
|
-
outFilter: {
|
|
591
|
-
pageNumber: 0,
|
|
592
|
-
pageSize: this.pageSize,
|
|
593
|
-
subjectId: nid,
|
|
594
|
-
},
|
|
595
|
-
inFilter: {
|
|
596
|
-
pageNumber: 0,
|
|
597
|
-
pageSize: this.pageSize,
|
|
598
|
-
objectId: nid,
|
|
599
|
-
},
|
|
600
|
-
};
|
|
601
|
-
return {
|
|
602
|
-
id: this.buildNodeId(node.id),
|
|
603
|
-
label: node.label,
|
|
604
|
-
data: data,
|
|
605
|
-
};
|
|
400
|
+
reset() {
|
|
401
|
+
this.form.reset();
|
|
402
|
+
this.filter.set(this.getFilter());
|
|
606
403
|
}
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
originId: sourceId,
|
|
610
|
-
customColor: '#ebe2e0',
|
|
611
|
-
value: triple.objectLiteral || '',
|
|
612
|
-
type: triple.literalType,
|
|
613
|
-
language: triple.literalLanguage,
|
|
614
|
-
number: triple.literalNumber,
|
|
615
|
-
};
|
|
616
|
-
return {
|
|
617
|
-
id: this.buildLiteralId(triple.id),
|
|
618
|
-
label: this.buildLiteralLabel(triple),
|
|
619
|
-
data: data,
|
|
620
|
-
};
|
|
621
|
-
}
|
|
622
|
-
/**
|
|
623
|
-
* Expand the currently selected properties group node, by loading its
|
|
624
|
-
* outbound nodes, inbound nodes, and literal nodes.
|
|
625
|
-
*
|
|
626
|
-
* @param node The property group node to expand.
|
|
627
|
-
* @param outFilter The properties to update for the outbound nodes filter.
|
|
628
|
-
* @param inFilter The properties to update for the inbound nodes filter.
|
|
629
|
-
* @param litFilter The properties to update for the literal nodes filter.
|
|
630
|
-
*/
|
|
631
|
-
expandProperty(node, outFilter, inFilter, litFilter) {
|
|
632
|
-
// prepare filters
|
|
633
|
-
const nid = this.getNodeNumericId(node.id);
|
|
634
|
-
const data = node.data;
|
|
635
|
-
const outf = Object.assign(data.outFilter, outFilter || {}, { isObject: true });
|
|
636
|
-
const inf = Object.assign(data.inFilter, inFilter || {}, {
|
|
637
|
-
isObject: false,
|
|
638
|
-
});
|
|
639
|
-
const litf = Object.assign(data.litFilter, litFilter || {}, { subjectId: nid, predicateId: this.getPredicateNumericId(node.id) });
|
|
640
|
-
// load
|
|
641
|
-
this.toggleLoading(true);
|
|
642
|
-
const nodes = [...this._nodes$.value];
|
|
643
|
-
const edges = [...this._edges$.value];
|
|
644
|
-
forkJoin({
|
|
645
|
-
outs: this._graphService.getLinkedNodes(outf.pageNumber, outf.pageSize, outf),
|
|
646
|
-
ins: this._graphService.getLinkedNodes(inf.pageNumber, inf.pageSize, inf),
|
|
647
|
-
lits: this._graphService.getLinkedLiterals(litf.pageNumber, litf.pageSize, litf),
|
|
648
|
-
}).subscribe({
|
|
649
|
-
next: (result) => {
|
|
650
|
-
node.data.expanded = true;
|
|
651
|
-
// update origin's filters
|
|
652
|
-
node.data.outFilter = outf;
|
|
653
|
-
node.data.inFilter = inf;
|
|
654
|
-
node.data.litFilter = litf;
|
|
655
|
-
// remove previous children
|
|
656
|
-
this.removeChildren(node.id, nodes, edges);
|
|
657
|
-
// add outbound children
|
|
658
|
-
node.data.outTotal = result.outs.total;
|
|
659
|
-
for (let i = 0; i < result.outs.items.length; i++) {
|
|
660
|
-
const child = result.outs.items[i];
|
|
661
|
-
const obj = this.buildNonLiteralNode(node.id, child);
|
|
662
|
-
if (!nodes.some((n) => n.id === obj.id)) {
|
|
663
|
-
nodes.push(obj);
|
|
664
|
-
}
|
|
665
|
-
// edge from property to non literal object node
|
|
666
|
-
const edge = {
|
|
667
|
-
id: this.buildEdgeId(node.id, obj.id),
|
|
668
|
-
label: '',
|
|
669
|
-
source: node.id,
|
|
670
|
-
target: obj.id,
|
|
671
|
-
data: {
|
|
672
|
-
originId: node.id,
|
|
673
|
-
},
|
|
674
|
-
};
|
|
675
|
-
this.addEdgeIfAbsent(edge, edges);
|
|
676
|
-
}
|
|
677
|
-
// add inbound children
|
|
678
|
-
node.data.inTotal = result.ins.total;
|
|
679
|
-
for (let i = 0; i < result.ins.items.length; i++) {
|
|
680
|
-
const child = result.ins.items[i];
|
|
681
|
-
const subj = this.buildNonLiteralNode(node.id, child);
|
|
682
|
-
if (!nodes.some((n) => n.id === subj.id)) {
|
|
683
|
-
nodes.push(subj);
|
|
684
|
-
}
|
|
685
|
-
// edge from subject node to property
|
|
686
|
-
const edge = {
|
|
687
|
-
id: this.buildEdgeId(subj.id, node.id),
|
|
688
|
-
label: '',
|
|
689
|
-
source: subj.id,
|
|
690
|
-
target: node.id,
|
|
691
|
-
data: {
|
|
692
|
-
originId: node.id,
|
|
693
|
-
},
|
|
694
|
-
};
|
|
695
|
-
this.addEdgeIfAbsent(edge, edges);
|
|
696
|
-
}
|
|
697
|
-
// add literal children
|
|
698
|
-
node.data.litTotal = result.lits.total;
|
|
699
|
-
for (let i = 0; i < result.lits.items.length; i++) {
|
|
700
|
-
const triple = result.lits.items[i];
|
|
701
|
-
const lit = this.buildLiteralNode(node.id, triple);
|
|
702
|
-
if (!nodes.some((n) => n.id === lit.id)) {
|
|
703
|
-
nodes.push(lit);
|
|
704
|
-
}
|
|
705
|
-
// edge from property to literal
|
|
706
|
-
const edge = {
|
|
707
|
-
id: this.buildEdgeId(node.id, lit.id),
|
|
708
|
-
label: lit.data.literalType || '',
|
|
709
|
-
source: node.id,
|
|
710
|
-
target: lit.id,
|
|
711
|
-
data: {
|
|
712
|
-
originId: node.id,
|
|
713
|
-
},
|
|
714
|
-
};
|
|
715
|
-
this.addEdgeIfAbsent(edge, edges);
|
|
716
|
-
}
|
|
717
|
-
// update
|
|
718
|
-
this._nodes$.next(nodes);
|
|
719
|
-
this._edges$.next(edges);
|
|
720
|
-
},
|
|
721
|
-
error: (error) => {
|
|
722
|
-
node.data.error = 'Error loading nodes';
|
|
723
|
-
this._nodes$.next(nodes);
|
|
724
|
-
this.setError(error);
|
|
725
|
-
},
|
|
726
|
-
complete: () => {
|
|
727
|
-
this.toggleLoading(false);
|
|
728
|
-
},
|
|
729
|
-
});
|
|
730
|
-
}
|
|
731
|
-
/**
|
|
732
|
-
* Expand the currently selected properties group node, by loading its
|
|
733
|
-
* outbound nodes, inbound nodes, and literal nodes. If there is no
|
|
734
|
-
* selection, or the selected node is not a properties group node, nothing
|
|
735
|
-
* is done.
|
|
736
|
-
*
|
|
737
|
-
* @param outFilter The properties to update for the outbound nodes filter.
|
|
738
|
-
* @param inFilter The properties to update for the inbound nodes filter.
|
|
739
|
-
* @param litFilter The properties to update for the literal nodes filter.
|
|
740
|
-
*/
|
|
741
|
-
expandSelectedProperty(outFilter, inFilter, litFilter) {
|
|
742
|
-
if (!this._selectedNode$.value ||
|
|
743
|
-
!this._selectedNode$.value.id.startsWith('P')) {
|
|
404
|
+
apply() {
|
|
405
|
+
if (this.form.invalid) {
|
|
744
406
|
return;
|
|
745
407
|
}
|
|
746
|
-
|
|
747
|
-
this.
|
|
748
|
-
}
|
|
749
|
-
/**
|
|
750
|
-
* Toggle the specified node by expanding or collapsing it.
|
|
751
|
-
*
|
|
752
|
-
* @param node The node to toggle.
|
|
753
|
-
*/
|
|
754
|
-
toggleNode(node) {
|
|
755
|
-
if (node.data.expanded) {
|
|
756
|
-
const nodes = [...this._nodes$.value];
|
|
757
|
-
const edges = [...this._edges$.value];
|
|
758
|
-
this.removeChildren(node.id, nodes, edges);
|
|
759
|
-
node.data.expanded = undefined;
|
|
760
|
-
this._nodes$.next(nodes);
|
|
761
|
-
this._edges$.next(edges);
|
|
762
|
-
}
|
|
763
|
-
else {
|
|
764
|
-
if (node.id.startsWith('N')) {
|
|
765
|
-
this.expandNode(node);
|
|
766
|
-
}
|
|
767
|
-
else if (node.id.startsWith('P')) {
|
|
768
|
-
this.expandProperty(node);
|
|
769
|
-
}
|
|
770
|
-
}
|
|
408
|
+
this.filter.set(this.getFilter());
|
|
409
|
+
this.form.markAsPristine();
|
|
771
410
|
}
|
|
411
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: LinkedNodeFilterComponent, deps: [{ token: i1.FormBuilder }, { token: i2.GraphNodeLookupService }, { token: i3.GraphService }], target: i0.ɵɵFactoryTarget.Component });
|
|
412
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.3", type: LinkedNodeFilterComponent, isStandalone: true, selector: "cadmus-walker-linked-node-filter", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, hasPager: { classPropertyName: "hasPager", publicName: "hasPager", isSignal: true, isRequired: false, transformFunction: null }, total: { classPropertyName: "total", publicName: "total", isSignal: true, isRequired: false, transformFunction: null }, filter: { classPropertyName: "filter", publicName: "filter", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { filter: "filterChange" }, ngImport: i0, template: "<form [formGroup]=\"form\" (submit)=\"apply()\" [attr.disabled]=\"disabled()\">\n <!-- paginator -->\n @if (hasPager()) {\n <mat-paginator\n [length]=\"total\"\n [pageSize]=\"pageSize.value || 10\"\n [pageSizeOptions]=\"[5, 10, 20]\"\n (page)=\"onPageChange($event)\"\n aria-label=\"Select page\"\n />\n }\n\n <!-- label -->\n <div>\n <mat-form-field>\n <input matInput [formControl]=\"label\" placeholder=\"label\" />\n </mat-form-field>\n </div>\n <!-- uid -->\n <div>\n <mat-form-field>\n <input matInput [formControl]=\"uid\" placeholder=\"UID\" />\n </mat-form-field>\n </div>\n <!-- isClass -->\n <div>\n <mat-form-field>\n <mat-select [formControl]=\"isClass\" placeholder=\"class\">\n <mat-option [value]=\"0\">(any)</mat-option>\n <mat-option [value]=\"1\">not-class</mat-option>\n <mat-option [value]=\"2\">class</mat-option>\n </mat-select>\n </mat-form-field>\n </div>\n <!-- tag -->\n <div>\n <mat-form-field>\n <input matInput [formControl]=\"tag\" placeholder=\"tag\" />\n </mat-form-field>\n </div>\n <!-- sourceType -->\n <div>\n <mat-form-field>\n <mat-select [formControl]=\"sourceType\" placeholder=\"source type\">\n <mat-option [value]=\"null\">(any)</mat-option>\n <mat-option [value]=\"0\">user</mat-option>\n <mat-option [value]=\"1\">item</mat-option>\n <mat-option [value]=\"2\">part</mat-option>\n <mat-option [value]=\"3\">thesaurus</mat-option>\n <mat-option [value]=\"4\">implicit</mat-option>\n </mat-select>\n </mat-form-field>\n </div>\n <div>\n <!-- sid -->\n <div>\n <mat-form-field>\n <input matInput [formControl]=\"sid\" placeholder=\"SID\" />\n </mat-form-field>\n\n <!-- isSidPrefix -->\n <mat-checkbox [formControl]=\"isSidPrefix\">prefix</mat-checkbox>\n </div>\n </div>\n <!-- classes -->\n <div>\n <fieldset>\n <legend>classes</legend>\n <cadmus-ref-lookup\n label=\"class\"\n [service]=\"lookupService\"\n [baseFilter]=\"{ isClass: true }\"\n (itemChange)=\"onClassAdd($event)\"\n />\n\n @if (classes.value.length) {\n <mat-chip-listbox>\n @for (node of classes.value; track node.id) {\n <mat-chip-option\n [removable]=\"true\"\n (removed)=\"onClassRemove(node)\"\n matTooltip=\"{{ node.uri }}\"\n >{{ node.label }}\n <button type=\"button\" matChipRemove>\n <mat-icon>cancel</mat-icon>\n </button>\n </mat-chip-option>\n }\n </mat-chip-listbox>\n }\n </fieldset>\n </div>\n\n <div\n class=\"btn-group\"\n role=\"group\"\n aria-label=\"toolbar\"\n style=\"margin-bottom: 10px\"\n >\n <button\n mat-icon-button\n type=\"button\"\n (click)=\"reset()\"\n matTooltip=\"Reset filters\"\n [disabled]=\"disabled()\"\n >\n <mat-icon class=\"mat-warn\">clear</mat-icon>\n </button>\n <button\n type=\"submit\"\n mat-icon-button\n [disabled]=\"disabled()\"\n matTooltip=\"Apply filters\"\n >\n <mat-icon class=\"mat-primary\">check_circle</mat-icon>\n </button>\n </div>\n</form>\n", styles: ["fieldset{border:1px solid silver;border-radius:4px;padding:4px}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: MatPaginator, selector: "mat-paginator", inputs: ["color", "pageIndex", "length", "pageSize", "pageSizeOptions", "hidePageSize", "showFirstLastButtons", "selectConfig", "disabled"], outputs: ["page"], exportAs: ["matPaginator"] }, { kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "component", type: MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "component", type: RefLookupComponent, selector: "cadmus-ref-lookup", inputs: ["label", "limit", "baseFilter", "service", "item", "required", "hasMore", "linkTemplate", "optDialog", "options"], outputs: ["itemChange", "optionsChange", "moreRequest"] }, { kind: "component", type: MatChipListbox, selector: "mat-chip-listbox", inputs: ["multiple", "aria-orientation", "selectable", "compareWith", "required", "hideSingleSelectionIndicator", "value"], outputs: ["change"] }, { kind: "component", type: MatChipOption, selector: "mat-basic-chip-option, [mat-basic-chip-option], mat-chip-option, [mat-chip-option]", inputs: ["selectable", "selected"], outputs: ["selectionChange"] }, { kind: "directive", type: MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: MatChipRemove, selector: "[matChipRemove]" }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }] });
|
|
772
413
|
}
|
|
414
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: LinkedNodeFilterComponent, decorators: [{
|
|
415
|
+
type: Component,
|
|
416
|
+
args: [{ selector: 'cadmus-walker-linked-node-filter', imports: [
|
|
417
|
+
FormsModule,
|
|
418
|
+
ReactiveFormsModule,
|
|
419
|
+
MatPaginator,
|
|
420
|
+
MatFormField,
|
|
421
|
+
MatInput,
|
|
422
|
+
MatSelect,
|
|
423
|
+
MatOption,
|
|
424
|
+
MatCheckbox,
|
|
425
|
+
RefLookupComponent,
|
|
426
|
+
MatChipListbox,
|
|
427
|
+
MatChipOption,
|
|
428
|
+
MatTooltip,
|
|
429
|
+
MatChipRemove,
|
|
430
|
+
MatIcon,
|
|
431
|
+
MatIconButton,
|
|
432
|
+
], template: "<form [formGroup]=\"form\" (submit)=\"apply()\" [attr.disabled]=\"disabled()\">\n <!-- paginator -->\n @if (hasPager()) {\n <mat-paginator\n [length]=\"total\"\n [pageSize]=\"pageSize.value || 10\"\n [pageSizeOptions]=\"[5, 10, 20]\"\n (page)=\"onPageChange($event)\"\n aria-label=\"Select page\"\n />\n }\n\n <!-- label -->\n <div>\n <mat-form-field>\n <input matInput [formControl]=\"label\" placeholder=\"label\" />\n </mat-form-field>\n </div>\n <!-- uid -->\n <div>\n <mat-form-field>\n <input matInput [formControl]=\"uid\" placeholder=\"UID\" />\n </mat-form-field>\n </div>\n <!-- isClass -->\n <div>\n <mat-form-field>\n <mat-select [formControl]=\"isClass\" placeholder=\"class\">\n <mat-option [value]=\"0\">(any)</mat-option>\n <mat-option [value]=\"1\">not-class</mat-option>\n <mat-option [value]=\"2\">class</mat-option>\n </mat-select>\n </mat-form-field>\n </div>\n <!-- tag -->\n <div>\n <mat-form-field>\n <input matInput [formControl]=\"tag\" placeholder=\"tag\" />\n </mat-form-field>\n </div>\n <!-- sourceType -->\n <div>\n <mat-form-field>\n <mat-select [formControl]=\"sourceType\" placeholder=\"source type\">\n <mat-option [value]=\"null\">(any)</mat-option>\n <mat-option [value]=\"0\">user</mat-option>\n <mat-option [value]=\"1\">item</mat-option>\n <mat-option [value]=\"2\">part</mat-option>\n <mat-option [value]=\"3\">thesaurus</mat-option>\n <mat-option [value]=\"4\">implicit</mat-option>\n </mat-select>\n </mat-form-field>\n </div>\n <div>\n <!-- sid -->\n <div>\n <mat-form-field>\n <input matInput [formControl]=\"sid\" placeholder=\"SID\" />\n </mat-form-field>\n\n <!-- isSidPrefix -->\n <mat-checkbox [formControl]=\"isSidPrefix\">prefix</mat-checkbox>\n </div>\n </div>\n <!-- classes -->\n <div>\n <fieldset>\n <legend>classes</legend>\n <cadmus-ref-lookup\n label=\"class\"\n [service]=\"lookupService\"\n [baseFilter]=\"{ isClass: true }\"\n (itemChange)=\"onClassAdd($event)\"\n />\n\n @if (classes.value.length) {\n <mat-chip-listbox>\n @for (node of classes.value; track node.id) {\n <mat-chip-option\n [removable]=\"true\"\n (removed)=\"onClassRemove(node)\"\n matTooltip=\"{{ node.uri }}\"\n >{{ node.label }}\n <button type=\"button\" matChipRemove>\n <mat-icon>cancel</mat-icon>\n </button>\n </mat-chip-option>\n }\n </mat-chip-listbox>\n }\n </fieldset>\n </div>\n\n <div\n class=\"btn-group\"\n role=\"group\"\n aria-label=\"toolbar\"\n style=\"margin-bottom: 10px\"\n >\n <button\n mat-icon-button\n type=\"button\"\n (click)=\"reset()\"\n matTooltip=\"Reset filters\"\n [disabled]=\"disabled()\"\n >\n <mat-icon class=\"mat-warn\">clear</mat-icon>\n </button>\n <button\n type=\"submit\"\n mat-icon-button\n [disabled]=\"disabled()\"\n matTooltip=\"Apply filters\"\n >\n <mat-icon class=\"mat-primary\">check_circle</mat-icon>\n </button>\n </div>\n</form>\n", styles: ["fieldset{border:1px solid silver;border-radius:4px;padding:4px}\n"] }]
|
|
433
|
+
}], ctorParameters: () => [{ type: i1.FormBuilder }, { type: i2.GraphNodeLookupService }, { type: i3.GraphService }] });
|
|
773
434
|
|
|
774
435
|
/**
|
|
775
436
|
* Linked literal filter.
|
|
776
437
|
*/
|
|
777
438
|
class LinkedLiteralFilterComponent {
|
|
439
|
+
lookupService;
|
|
440
|
+
_graphService;
|
|
441
|
+
/**
|
|
442
|
+
* True if this component is disabled.
|
|
443
|
+
*/
|
|
444
|
+
disabled = input();
|
|
445
|
+
/**
|
|
446
|
+
* True if this component should show a pager.
|
|
447
|
+
*/
|
|
448
|
+
hasPager = input();
|
|
449
|
+
/**
|
|
450
|
+
* The total number of triples returned from the last
|
|
451
|
+
* page fetch operation. Used when hasPager is true.
|
|
452
|
+
*/
|
|
453
|
+
total = input(0);
|
|
778
454
|
/**
|
|
779
455
|
* The filter.
|
|
780
456
|
*/
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
457
|
+
filter = model({
|
|
458
|
+
pageNumber: 1,
|
|
459
|
+
pageSize: 10,
|
|
460
|
+
});
|
|
461
|
+
pageNumber;
|
|
462
|
+
pageSize;
|
|
463
|
+
litPattern;
|
|
464
|
+
litType;
|
|
465
|
+
litLanguage;
|
|
466
|
+
minLitNumber;
|
|
467
|
+
maxLitNumber;
|
|
468
|
+
subj;
|
|
469
|
+
pred;
|
|
470
|
+
form;
|
|
791
471
|
constructor(formBuilder, lookupService, _graphService) {
|
|
792
472
|
this.lookupService = lookupService;
|
|
793
473
|
this._graphService = _graphService;
|
|
794
|
-
this._filter = {
|
|
795
|
-
pageNumber: 1,
|
|
796
|
-
pageSize: 10,
|
|
797
|
-
};
|
|
798
|
-
this.total = 0;
|
|
799
|
-
this.filterChange = new EventEmitter();
|
|
800
|
-
// form
|
|
801
474
|
this.pageNumber = formBuilder.control(1, { nonNullable: true });
|
|
802
475
|
this.pageSize = formBuilder.control(10, { nonNullable: true });
|
|
803
476
|
this.litPattern = formBuilder.control(null);
|
|
@@ -818,6 +491,9 @@ class LinkedLiteralFilterComponent {
|
|
|
818
491
|
subj: this.subj,
|
|
819
492
|
pred: this.pred,
|
|
820
493
|
});
|
|
494
|
+
effect(() => {
|
|
495
|
+
this.updateForm(this.filter());
|
|
496
|
+
});
|
|
821
497
|
}
|
|
822
498
|
updateForm(filter) {
|
|
823
499
|
this.pageNumber.setValue(filter.pageNumber);
|
|
@@ -854,9 +530,6 @@ class LinkedLiteralFilterComponent {
|
|
|
854
530
|
predicateId: this.pred.value?.id,
|
|
855
531
|
};
|
|
856
532
|
}
|
|
857
|
-
emitFilterChange() {
|
|
858
|
-
this.filterChange.emit(this.getFilter());
|
|
859
|
-
}
|
|
860
533
|
onSubjectNodeChange(node) {
|
|
861
534
|
this.subj.setValue(node);
|
|
862
535
|
}
|
|
@@ -865,457 +538,860 @@ class LinkedLiteralFilterComponent {
|
|
|
865
538
|
}
|
|
866
539
|
onPageChange(page) {
|
|
867
540
|
this.pageNumber.setValue(page.pageIndex + 1);
|
|
868
|
-
this.
|
|
541
|
+
this.filter.set(this.getFilter());
|
|
869
542
|
}
|
|
870
543
|
reset() {
|
|
871
544
|
this.form.reset();
|
|
872
|
-
this.
|
|
873
|
-
this.filterChange.emit(this._filter);
|
|
545
|
+
this.filter.set(this.getFilter());
|
|
874
546
|
}
|
|
875
547
|
apply() {
|
|
876
548
|
if (this.form.invalid) {
|
|
877
549
|
return;
|
|
878
550
|
}
|
|
879
|
-
this.
|
|
551
|
+
this.filter.set(this.getFilter());
|
|
880
552
|
this.form.markAsPristine();
|
|
881
553
|
}
|
|
882
|
-
static
|
|
883
|
-
static
|
|
554
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: LinkedLiteralFilterComponent, deps: [{ token: i1.FormBuilder }, { token: i2.GraphNodeLookupService }, { token: i3.GraphService }], target: i0.ɵɵFactoryTarget.Component });
|
|
555
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.3", type: LinkedLiteralFilterComponent, isStandalone: true, selector: "cadmus-walker-linked-literal-filter", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, hasPager: { classPropertyName: "hasPager", publicName: "hasPager", isSignal: true, isRequired: false, transformFunction: null }, total: { classPropertyName: "total", publicName: "total", isSignal: true, isRequired: false, transformFunction: null }, filter: { classPropertyName: "filter", publicName: "filter", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { filter: "filterChange" }, ngImport: i0, template: "<form [formGroup]=\"form\" (submit)=\"apply()\" [attr.disabled]=\"disabled()\">\n <!-- paginator -->\n @if (hasPager()) {\n <mat-paginator\n [length]=\"total()\"\n [pageSize]=\"pageSize.value || 10\"\n [pageSizeOptions]=\"[5, 10, 20]\"\n (page)=\"onPageChange($event)\"\n aria-label=\"Select page\"\n />\n }\n\n <!-- subject ID -->\n <div>\n <cadmus-ref-lookup\n label=\"subject\"\n [service]=\"lookupService\"\n (itemChange)=\"onSubjectNodeChange($event)\"\n />\n </div>\n\n <!-- predicate ID -->\n <div>\n <cadmus-ref-lookup\n label=\"predicate\"\n [service]=\"lookupService\"\n [baseFilter]=\"{ tag: 'property' }\"\n (itemChange)=\"onPredicateNodeChange($event)\"\n />\n </div>\n\n <!-- LITERAL -->\n <!-- litPattern -->\n <div>\n <mat-form-field>\n <input matInput [formControl]=\"litPattern\" placeholder=\"pattern\" />\n </mat-form-field>\n </div>\n <!-- litType -->\n <div>\n <mat-form-field>\n <input matInput [formControl]=\"litType\" placeholder=\"type\" />\n </mat-form-field>\n </div>\n <!-- litLanguage-->\n <div>\n <mat-form-field>\n <input matInput [formControl]=\"litLanguage\" placeholder=\"language\" />\n </mat-form-field>\n </div>\n <!-- minLitNumber, maxLitNumber -->\n <div>\n <mat-form-field style=\"width: 5em\">\n <input\n matInput\n type=\"number\"\n [formControl]=\"minLitNumber\"\n placeholder=\"min.\"\n />\n </mat-form-field>\n -\n <mat-form-field style=\"width: 5em\">\n <input\n matInput\n type=\"number\"\n [formControl]=\"maxLitNumber\"\n placeholder=\"max.\"\n />\n </mat-form-field>\n </div>\n <div\n class=\"btn-group\"\n role=\"group\"\n aria-label=\"toolbar\"\n style=\"margin-bottom: 10px\"\n >\n <button\n mat-icon-button\n type=\"button\"\n (click)=\"reset()\"\n matTooltip=\"Reset filters\"\n [disabled]=\"disabled\"\n >\n <mat-icon class=\"mat-warn\">clear</mat-icon>\n </button>\n <button\n type=\"submit\"\n mat-icon-button\n [disabled]=\"disabled\"\n matTooltip=\"Apply filters\"\n >\n <mat-icon class=\"mat-primary\">check_circle</mat-icon>\n </button>\n </div>\n</form>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: MatPaginator, selector: "mat-paginator", inputs: ["color", "pageIndex", "length", "pageSize", "pageSizeOptions", "hidePageSize", "showFirstLastButtons", "selectConfig", "disabled"], outputs: ["page"], exportAs: ["matPaginator"] }, { kind: "component", type: RefLookupComponent, selector: "cadmus-ref-lookup", inputs: ["label", "limit", "baseFilter", "service", "item", "required", "hasMore", "linkTemplate", "optDialog", "options"], outputs: ["itemChange", "optionsChange", "moreRequest"] }, { kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "directive", type: MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
|
|
884
556
|
}
|
|
885
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
557
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: LinkedLiteralFilterComponent, decorators: [{
|
|
886
558
|
type: Component,
|
|
887
|
-
args: [{ selector: 'cadmus-walker-linked-literal-filter',
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
559
|
+
args: [{ selector: 'cadmus-walker-linked-literal-filter', imports: [
|
|
560
|
+
FormsModule,
|
|
561
|
+
ReactiveFormsModule,
|
|
562
|
+
MatPaginator,
|
|
563
|
+
RefLookupComponent,
|
|
564
|
+
MatFormField,
|
|
565
|
+
MatInput,
|
|
566
|
+
MatIconButton,
|
|
567
|
+
MatTooltip,
|
|
568
|
+
MatIcon,
|
|
569
|
+
], template: "<form [formGroup]=\"form\" (submit)=\"apply()\" [attr.disabled]=\"disabled()\">\n <!-- paginator -->\n @if (hasPager()) {\n <mat-paginator\n [length]=\"total()\"\n [pageSize]=\"pageSize.value || 10\"\n [pageSizeOptions]=\"[5, 10, 20]\"\n (page)=\"onPageChange($event)\"\n aria-label=\"Select page\"\n />\n }\n\n <!-- subject ID -->\n <div>\n <cadmus-ref-lookup\n label=\"subject\"\n [service]=\"lookupService\"\n (itemChange)=\"onSubjectNodeChange($event)\"\n />\n </div>\n\n <!-- predicate ID -->\n <div>\n <cadmus-ref-lookup\n label=\"predicate\"\n [service]=\"lookupService\"\n [baseFilter]=\"{ tag: 'property' }\"\n (itemChange)=\"onPredicateNodeChange($event)\"\n />\n </div>\n\n <!-- LITERAL -->\n <!-- litPattern -->\n <div>\n <mat-form-field>\n <input matInput [formControl]=\"litPattern\" placeholder=\"pattern\" />\n </mat-form-field>\n </div>\n <!-- litType -->\n <div>\n <mat-form-field>\n <input matInput [formControl]=\"litType\" placeholder=\"type\" />\n </mat-form-field>\n </div>\n <!-- litLanguage-->\n <div>\n <mat-form-field>\n <input matInput [formControl]=\"litLanguage\" placeholder=\"language\" />\n </mat-form-field>\n </div>\n <!-- minLitNumber, maxLitNumber -->\n <div>\n <mat-form-field style=\"width: 5em\">\n <input\n matInput\n type=\"number\"\n [formControl]=\"minLitNumber\"\n placeholder=\"min.\"\n />\n </mat-form-field>\n -\n <mat-form-field style=\"width: 5em\">\n <input\n matInput\n type=\"number\"\n [formControl]=\"maxLitNumber\"\n placeholder=\"max.\"\n />\n </mat-form-field>\n </div>\n <div\n class=\"btn-group\"\n role=\"group\"\n aria-label=\"toolbar\"\n style=\"margin-bottom: 10px\"\n >\n <button\n mat-icon-button\n type=\"button\"\n (click)=\"reset()\"\n matTooltip=\"Reset filters\"\n [disabled]=\"disabled\"\n >\n <mat-icon class=\"mat-warn\">clear</mat-icon>\n </button>\n <button\n type=\"submit\"\n mat-icon-button\n [disabled]=\"disabled\"\n matTooltip=\"Apply filters\"\n >\n <mat-icon class=\"mat-primary\">check_circle</mat-icon>\n </button>\n </div>\n</form>\n" }]
|
|
570
|
+
}], ctorParameters: () => [{ type: i1.FormBuilder }, { type: i2.GraphNodeLookupService }, { type: i3.GraphService }] });
|
|
899
571
|
|
|
900
572
|
/**
|
|
901
|
-
*
|
|
573
|
+
* Get the extended label for the specified graph node. This returns the label
|
|
574
|
+
* for N nodes, and the uri + "=" + the label for P nodes. That's because P
|
|
575
|
+
* nodes label is just the count of the triples group, so the predicate ID is
|
|
576
|
+
* got from the property node's data uri.
|
|
902
577
|
*/
|
|
903
|
-
class
|
|
578
|
+
class GraphNodeLabelPipe {
|
|
579
|
+
transform(value, ...args) {
|
|
580
|
+
const node = value;
|
|
581
|
+
if (!node?.id || !node?.label) {
|
|
582
|
+
return value;
|
|
583
|
+
}
|
|
584
|
+
if (node.id.startsWith('P') && node.data.uri) {
|
|
585
|
+
return `${node.data.uri}=${node.label}`;
|
|
586
|
+
}
|
|
587
|
+
return node.label;
|
|
588
|
+
}
|
|
589
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: GraphNodeLabelPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
590
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.1.3", ngImport: i0, type: GraphNodeLabelPipe, isStandalone: true, name: "graphNodeLabel" });
|
|
591
|
+
}
|
|
592
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: GraphNodeLabelPipe, decorators: [{
|
|
593
|
+
type: Pipe,
|
|
594
|
+
args: [{ name: 'graphNodeLabel' }]
|
|
595
|
+
}] });
|
|
596
|
+
|
|
597
|
+
//#endregion
|
|
598
|
+
/**
|
|
599
|
+
* Graph walker.
|
|
600
|
+
* This class encapsulates data used for interactively exploring a graph
|
|
601
|
+
* starting from a designated origin node.
|
|
602
|
+
*/
|
|
603
|
+
class GraphWalker {
|
|
604
|
+
_graphService;
|
|
605
|
+
_nodes$;
|
|
606
|
+
_edges$;
|
|
607
|
+
// TODO: add clusters
|
|
608
|
+
_loading$;
|
|
609
|
+
_error$;
|
|
610
|
+
_rootNode;
|
|
611
|
+
_selectedNode$;
|
|
612
|
+
_pOutFilter$;
|
|
613
|
+
_pInFilter$;
|
|
614
|
+
_pLitFilter$;
|
|
615
|
+
_nOutFilter$;
|
|
616
|
+
_nInFilter$;
|
|
617
|
+
_childTotals$;
|
|
904
618
|
/**
|
|
905
|
-
* The
|
|
619
|
+
* The page size. Default is 10.
|
|
906
620
|
*/
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
621
|
+
pageSize;
|
|
622
|
+
/**
|
|
623
|
+
* Max length of literal value to show. Default is 30.
|
|
624
|
+
*/
|
|
625
|
+
maxLiteralLen;
|
|
626
|
+
/**
|
|
627
|
+
* The nodes of the walker graph, which can represent nodes, literals,
|
|
628
|
+
* or property groups. You can easily determine the type of each node
|
|
629
|
+
* by looking at the first character of its id (N=node, L=literal,
|
|
630
|
+
* P=property).
|
|
631
|
+
*/
|
|
632
|
+
get nodes$() {
|
|
633
|
+
return this._nodes$.asObservable();
|
|
916
634
|
}
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
this.
|
|
922
|
-
this.isObject = false;
|
|
923
|
-
this._filter = {
|
|
924
|
-
pageNumber: 1,
|
|
925
|
-
pageSize: 10,
|
|
926
|
-
otherNodeId: 0,
|
|
927
|
-
predicateId: 0,
|
|
928
|
-
};
|
|
929
|
-
this.total = 0;
|
|
930
|
-
this.filterChange = new EventEmitter();
|
|
931
|
-
// form
|
|
932
|
-
this.pageNumber = formBuilder.control(1, { nonNullable: true });
|
|
933
|
-
this.pageSize = formBuilder.control(10, { nonNullable: true });
|
|
934
|
-
this.uid = formBuilder.control(null);
|
|
935
|
-
this.isClass = formBuilder.control(null);
|
|
936
|
-
this.tag = formBuilder.control(null);
|
|
937
|
-
this.label = formBuilder.control(null);
|
|
938
|
-
this.sourceType = formBuilder.control(null);
|
|
939
|
-
this.sid = formBuilder.control(null);
|
|
940
|
-
this.isSidPrefix = formBuilder.control(false, { nonNullable: true });
|
|
941
|
-
this.classes = formBuilder.control([], { nonNullable: true });
|
|
942
|
-
this.form = formBuilder.group({
|
|
943
|
-
pageNumber: this.pageNumber,
|
|
944
|
-
pageSize: this.pageSize,
|
|
945
|
-
uid: this.uid,
|
|
946
|
-
isClass: this.isClass,
|
|
947
|
-
tag: this.tag,
|
|
948
|
-
label: this.label,
|
|
949
|
-
sourceType: this.sourceType,
|
|
950
|
-
sid: this.sid,
|
|
951
|
-
isSidPrefix: this.isSidPrefix,
|
|
952
|
-
classes: this.classes,
|
|
953
|
-
});
|
|
635
|
+
/**
|
|
636
|
+
* The edges connecting nodes.
|
|
637
|
+
*/
|
|
638
|
+
get edges$() {
|
|
639
|
+
return this._edges$.asObservable();
|
|
954
640
|
}
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
this.
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
this.
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
641
|
+
/**
|
|
642
|
+
* True if the walker is loading data.
|
|
643
|
+
*/
|
|
644
|
+
get loading$() {
|
|
645
|
+
return this._loading$.asObservable();
|
|
646
|
+
}
|
|
647
|
+
/**
|
|
648
|
+
* The last error occurred in communicating with the server, if any.
|
|
649
|
+
*/
|
|
650
|
+
get error$() {
|
|
651
|
+
return this._error$.asObservable();
|
|
652
|
+
}
|
|
653
|
+
/**
|
|
654
|
+
* The selected node. Only one node at a time can be selected.
|
|
655
|
+
*/
|
|
656
|
+
get selectedNode$() {
|
|
657
|
+
return this._selectedNode$.asObservable();
|
|
658
|
+
}
|
|
659
|
+
/**
|
|
660
|
+
* The outbound linked nodes filter for the selected P node.
|
|
661
|
+
*/
|
|
662
|
+
get pOutFilter$() {
|
|
663
|
+
return this._pOutFilter$.asObservable();
|
|
664
|
+
}
|
|
665
|
+
/**
|
|
666
|
+
* The inbound linked nodes filter for the selected P node.
|
|
667
|
+
*/
|
|
668
|
+
get pInFilter$() {
|
|
669
|
+
return this._pInFilter$.asObservable();
|
|
670
|
+
}
|
|
671
|
+
/**
|
|
672
|
+
* The literal linked nodes filter for the selected P node.
|
|
673
|
+
*/
|
|
674
|
+
get pLitFilter$() {
|
|
675
|
+
return this._pLitFilter$.asObservable();
|
|
676
|
+
}
|
|
677
|
+
/**
|
|
678
|
+
* The outbound triples filter for the selected N node.
|
|
679
|
+
*/
|
|
680
|
+
get nOutFilter$() {
|
|
681
|
+
return this._nOutFilter$.asObservable();
|
|
682
|
+
}
|
|
683
|
+
/**
|
|
684
|
+
* The inbound triples filter for the selected N node.
|
|
685
|
+
*/
|
|
686
|
+
get nInFilter$() {
|
|
687
|
+
return this._nInFilter$.asObservable();
|
|
688
|
+
}
|
|
689
|
+
/**
|
|
690
|
+
* The total items fetched for each filter of the selected node.
|
|
691
|
+
*/
|
|
692
|
+
get childTotals$() {
|
|
693
|
+
return this._childTotals$.asObservable();
|
|
694
|
+
}
|
|
695
|
+
constructor(_graphService) {
|
|
696
|
+
this._graphService = _graphService;
|
|
697
|
+
this._nodes$ = new BehaviorSubject([]);
|
|
698
|
+
this._edges$ = new BehaviorSubject([]);
|
|
699
|
+
this._loading$ = new BehaviorSubject(false);
|
|
700
|
+
this._error$ = new BehaviorSubject(null);
|
|
701
|
+
this._selectedNode$ = new BehaviorSubject(null);
|
|
702
|
+
this._pOutFilter$ = new BehaviorSubject(null);
|
|
703
|
+
this._pInFilter$ = new BehaviorSubject(null);
|
|
704
|
+
this._pLitFilter$ = new BehaviorSubject(null);
|
|
705
|
+
this._nOutFilter$ = new BehaviorSubject(null);
|
|
706
|
+
this._nInFilter$ = new BehaviorSubject(null);
|
|
707
|
+
this._childTotals$ = new BehaviorSubject({
|
|
708
|
+
nOut: 0,
|
|
709
|
+
nIn: 0,
|
|
710
|
+
pOut: 0,
|
|
711
|
+
pIn: 0,
|
|
712
|
+
pLit: 0,
|
|
713
|
+
});
|
|
714
|
+
// defaults
|
|
715
|
+
this.pageSize = 10;
|
|
716
|
+
this.maxLiteralLen = 30;
|
|
717
|
+
}
|
|
718
|
+
getSelectedNode() {
|
|
719
|
+
return this._selectedNode$.value;
|
|
720
|
+
}
|
|
721
|
+
toggleLoading(on) {
|
|
722
|
+
if (on) {
|
|
723
|
+
this._error$.next(null);
|
|
724
|
+
this._loading$.next(true);
|
|
978
725
|
}
|
|
979
726
|
else {
|
|
980
|
-
this.
|
|
981
|
-
this.form.markAsPristine();
|
|
727
|
+
this._loading$.next(false);
|
|
982
728
|
}
|
|
983
729
|
}
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
otherNodeId: this.otherNodeId,
|
|
999
|
-
predicateId: this.predicateId,
|
|
1000
|
-
isObject: this.isObject,
|
|
1001
|
-
};
|
|
730
|
+
setError(error) {
|
|
731
|
+
if (error) {
|
|
732
|
+
if (typeof error === 'string') {
|
|
733
|
+
this._error$.next(error);
|
|
734
|
+
console.error(error);
|
|
735
|
+
}
|
|
736
|
+
else {
|
|
737
|
+
this._error$.next('Walker error');
|
|
738
|
+
console.error('Walker error', error);
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
else {
|
|
742
|
+
this._error$.next('Walker error');
|
|
743
|
+
}
|
|
1002
744
|
}
|
|
1003
|
-
|
|
1004
|
-
|
|
745
|
+
buildNodeId(id) {
|
|
746
|
+
return `N${id}`;
|
|
1005
747
|
}
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
748
|
+
/**
|
|
749
|
+
* Get the numeric ID of the data node being the source of the graph node
|
|
750
|
+
* with the specified ID.
|
|
751
|
+
*
|
|
752
|
+
* @param id The graph node ID (...N + its data node numeric ID)
|
|
753
|
+
* @returns The data node numeric ID.
|
|
754
|
+
*/
|
|
755
|
+
getNodeNumericId(id) {
|
|
756
|
+
const i = id.indexOf('N');
|
|
757
|
+
return i === -1 ? 0 : +id.substring(i + 1);
|
|
1009
758
|
}
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
const nodes = [...this.classes.value];
|
|
1015
|
-
nodes.push(node);
|
|
1016
|
-
this.classes.setValue(nodes);
|
|
1017
|
-
this.classes.updateValueAndValidity();
|
|
1018
|
-
this.classes.markAsDirty();
|
|
759
|
+
getPredicateNumericId(id) {
|
|
760
|
+
const i = id.indexOf('P');
|
|
761
|
+
const j = id.indexOf('N');
|
|
762
|
+
return i === -1 ? 0 : +id.substring(i + 1, j);
|
|
1019
763
|
}
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
const i = nodes.indexOf(node);
|
|
1023
|
-
if (i > -1) {
|
|
1024
|
-
nodes.splice(i, 1);
|
|
1025
|
-
this.classes.setValue(nodes);
|
|
1026
|
-
this.classes.updateValueAndValidity();
|
|
1027
|
-
this.classes.markAsDirty();
|
|
1028
|
-
}
|
|
764
|
+
buildEdgeId(source, target) {
|
|
765
|
+
return `E${source}_${target}`;
|
|
1029
766
|
}
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
this._filter = this.getFilter();
|
|
1033
|
-
this.filterChange.emit(this._filter);
|
|
767
|
+
buildPropertyId(predicateId, nodeId) {
|
|
768
|
+
return `P${predicateId}N${nodeId}`;
|
|
1034
769
|
}
|
|
1035
|
-
|
|
1036
|
-
|
|
770
|
+
buildLiteralId(tripleId) {
|
|
771
|
+
return `L${tripleId}`;
|
|
772
|
+
}
|
|
773
|
+
scale(n, domainMin, domainMax, rangeMin, rangeMax) {
|
|
774
|
+
// https://stackoverflow.com/questions/5294955/how-to-scale-down-a-range-of-numbers-with-a-known-min-and-max-value
|
|
775
|
+
return (((domainMax - domainMin) * (n - rangeMin)) / (rangeMax - rangeMin) +
|
|
776
|
+
domainMin);
|
|
777
|
+
}
|
|
778
|
+
addEdgeIfAbsent(edge, edges) {
|
|
779
|
+
const id = edge.id;
|
|
780
|
+
if (edges.some((e) => e.id === id)) {
|
|
1037
781
|
return;
|
|
1038
782
|
}
|
|
1039
|
-
|
|
1040
|
-
|
|
783
|
+
const i = id.indexOf('_');
|
|
784
|
+
if (i > -1) {
|
|
785
|
+
const invId = 'E' + id.substring(i + 1) + '_' + id.substring(1, i);
|
|
786
|
+
if (edges.some((e) => e.id === invId)) {
|
|
787
|
+
return;
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
edges.push(edge);
|
|
791
|
+
}
|
|
792
|
+
resetFilters() {
|
|
793
|
+
this._nOutFilter$.next(null);
|
|
794
|
+
this._nInFilter$.next(null);
|
|
795
|
+
this._pOutFilter$.next(null);
|
|
796
|
+
this._pInFilter$.next(null);
|
|
797
|
+
this._pLitFilter$.next(null);
|
|
798
|
+
this._childTotals$.next({
|
|
799
|
+
nOut: 0,
|
|
800
|
+
nIn: 0,
|
|
801
|
+
pOut: 0,
|
|
802
|
+
pIn: 0,
|
|
803
|
+
pLit: 0,
|
|
804
|
+
});
|
|
1041
805
|
}
|
|
1042
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: LinkedNodeFilterComponent, deps: [{ token: i1.FormBuilder }, { token: i2.GraphNodeLookupService }, { token: i3.GraphService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1043
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: LinkedNodeFilterComponent, isStandalone: false, selector: "cadmus-walker-linked-node-filter", inputs: { disabled: "disabled", hasPager: "hasPager", total: "total", filter: "filter" }, outputs: { filterChange: "filterChange" }, ngImport: i0, template: "<form [formGroup]=\"form\" (submit)=\"apply()\" ng-disabled=\"disabled\">\n <!-- paginator -->\n @if (hasPager) {\n <mat-paginator\n [length]=\"total\"\n [pageSize]=\"pageSize.value || 10\"\n [pageSizeOptions]=\"[5, 10, 20]\"\n (page)=\"onPageChange($event)\"\n aria-label=\"Select page\"\n >\n </mat-paginator>\n }\n\n <!-- label -->\n <div>\n <mat-form-field>\n <input matInput [formControl]=\"label\" placeholder=\"label\" />\n </mat-form-field>\n </div>\n <!-- uid -->\n <div>\n <mat-form-field>\n <input matInput [formControl]=\"uid\" placeholder=\"UID\" />\n </mat-form-field>\n </div>\n <!-- isClass -->\n <div>\n <mat-form-field>\n <mat-select [formControl]=\"isClass\" placeholder=\"class\">\n <mat-option [value]=\"0\">(any)</mat-option>\n <mat-option [value]=\"1\">not-class</mat-option>\n <mat-option [value]=\"2\">class</mat-option>\n </mat-select>\n </mat-form-field>\n </div>\n <!-- tag -->\n <div>\n <mat-form-field>\n <input matInput [formControl]=\"tag\" placeholder=\"tag\" />\n </mat-form-field>\n </div>\n <!-- sourceType -->\n <div>\n <mat-form-field>\n <mat-select [formControl]=\"sourceType\" placeholder=\"source type\">\n <mat-option [value]=\"null\">(any)</mat-option>\n <mat-option [value]=\"0\">user</mat-option>\n <mat-option [value]=\"1\">item</mat-option>\n <mat-option [value]=\"2\">part</mat-option>\n <mat-option [value]=\"3\">thesaurus</mat-option>\n <mat-option [value]=\"4\">implicit</mat-option>\n </mat-select>\n </mat-form-field>\n </div>\n <div>\n <!-- sid -->\n <div>\n <mat-form-field>\n <input matInput [formControl]=\"sid\" placeholder=\"SID\" />\n </mat-form-field>\n\n <!-- isSidPrefix -->\n <mat-checkbox [formControl]=\"isSidPrefix\">prefix</mat-checkbox>\n </div>\n </div>\n <!-- classes -->\n <div>\n <fieldset>\n <legend>classes</legend>\n <cadmus-ref-lookup\n label=\"class\"\n [service]=\"lookupService\"\n [baseFilter]=\"{ isClass: true }\"\n (itemChange)=\"onClassAdd($event)\"\n />\n\n @if (classes.value.length) {\n <mat-chip-listbox>\n @for (node of classes.value; track node.id) {\n <mat-chip-option\n [removable]=\"true\"\n (removed)=\"onClassRemove(node)\"\n matTooltip=\"{{ node.uri }}\"\n >{{ node.label }}\n <button type=\"button\" matChipRemove>\n <mat-icon>cancel</mat-icon>\n </button>\n </mat-chip-option>\n }\n </mat-chip-listbox>\n }\n </fieldset>\n </div>\n\n <div\n class=\"btn-group\"\n role=\"group\"\n aria-label=\"toolbar\"\n style=\"margin-bottom: 10px\"\n >\n <button\n mat-icon-button\n type=\"button\"\n (click)=\"reset()\"\n matTooltip=\"Reset filters\"\n [disabled]=\"disabled\"\n >\n <mat-icon class=\"mat-warn\">clear</mat-icon>\n </button>\n <button\n type=\"submit\"\n mat-icon-button\n [disabled]=\"disabled\"\n matTooltip=\"Apply filters\"\n >\n <mat-icon class=\"mat-primary\">check_circle</mat-icon>\n </button>\n </div>\n</form>\n", styles: ["fieldset{border:1px solid silver;border-radius:4px;padding:4px}\n"], dependencies: [{ kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i4$1.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "component", type: i4.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "component", type: i6$1.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "component", type: i7$1.MatChipListbox, selector: "mat-chip-listbox", inputs: ["multiple", "aria-orientation", "selectable", "compareWith", "required", "hideSingleSelectionIndicator", "value"], outputs: ["change"] }, { kind: "component", type: i7$1.MatChipOption, selector: "mat-basic-chip-option, [mat-basic-chip-option], mat-chip-option, [mat-chip-option]", inputs: ["selectable", "selected"], outputs: ["selectionChange"] }, { kind: "directive", type: i7$1.MatChipRemove, selector: "[matChipRemove]" }, { kind: "component", type: i5.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "component", type: i6.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i7.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: i8.MatPaginator, selector: "mat-paginator", inputs: ["color", "pageIndex", "length", "pageSize", "pageSizeOptions", "hidePageSize", "showFirstLastButtons", "selectConfig", "disabled"], outputs: ["page"], exportAs: ["matPaginator"] }, { kind: "component", type: i12.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "directive", type: i9.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: i10.RefLookupComponent, selector: "cadmus-ref-lookup", inputs: ["label", "limit", "baseFilter", "service", "item", "required", "hasMore", "linkTemplate", "optDialog", "options"], outputs: ["itemChange", "optionsChange", "moreRequest"] }] }); }
|
|
1044
|
-
}
|
|
1045
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: LinkedNodeFilterComponent, decorators: [{
|
|
1046
|
-
type: Component,
|
|
1047
|
-
args: [{ selector: 'cadmus-walker-linked-node-filter', standalone: false, template: "<form [formGroup]=\"form\" (submit)=\"apply()\" ng-disabled=\"disabled\">\n <!-- paginator -->\n @if (hasPager) {\n <mat-paginator\n [length]=\"total\"\n [pageSize]=\"pageSize.value || 10\"\n [pageSizeOptions]=\"[5, 10, 20]\"\n (page)=\"onPageChange($event)\"\n aria-label=\"Select page\"\n >\n </mat-paginator>\n }\n\n <!-- label -->\n <div>\n <mat-form-field>\n <input matInput [formControl]=\"label\" placeholder=\"label\" />\n </mat-form-field>\n </div>\n <!-- uid -->\n <div>\n <mat-form-field>\n <input matInput [formControl]=\"uid\" placeholder=\"UID\" />\n </mat-form-field>\n </div>\n <!-- isClass -->\n <div>\n <mat-form-field>\n <mat-select [formControl]=\"isClass\" placeholder=\"class\">\n <mat-option [value]=\"0\">(any)</mat-option>\n <mat-option [value]=\"1\">not-class</mat-option>\n <mat-option [value]=\"2\">class</mat-option>\n </mat-select>\n </mat-form-field>\n </div>\n <!-- tag -->\n <div>\n <mat-form-field>\n <input matInput [formControl]=\"tag\" placeholder=\"tag\" />\n </mat-form-field>\n </div>\n <!-- sourceType -->\n <div>\n <mat-form-field>\n <mat-select [formControl]=\"sourceType\" placeholder=\"source type\">\n <mat-option [value]=\"null\">(any)</mat-option>\n <mat-option [value]=\"0\">user</mat-option>\n <mat-option [value]=\"1\">item</mat-option>\n <mat-option [value]=\"2\">part</mat-option>\n <mat-option [value]=\"3\">thesaurus</mat-option>\n <mat-option [value]=\"4\">implicit</mat-option>\n </mat-select>\n </mat-form-field>\n </div>\n <div>\n <!-- sid -->\n <div>\n <mat-form-field>\n <input matInput [formControl]=\"sid\" placeholder=\"SID\" />\n </mat-form-field>\n\n <!-- isSidPrefix -->\n <mat-checkbox [formControl]=\"isSidPrefix\">prefix</mat-checkbox>\n </div>\n </div>\n <!-- classes -->\n <div>\n <fieldset>\n <legend>classes</legend>\n <cadmus-ref-lookup\n label=\"class\"\n [service]=\"lookupService\"\n [baseFilter]=\"{ isClass: true }\"\n (itemChange)=\"onClassAdd($event)\"\n />\n\n @if (classes.value.length) {\n <mat-chip-listbox>\n @for (node of classes.value; track node.id) {\n <mat-chip-option\n [removable]=\"true\"\n (removed)=\"onClassRemove(node)\"\n matTooltip=\"{{ node.uri }}\"\n >{{ node.label }}\n <button type=\"button\" matChipRemove>\n <mat-icon>cancel</mat-icon>\n </button>\n </mat-chip-option>\n }\n </mat-chip-listbox>\n }\n </fieldset>\n </div>\n\n <div\n class=\"btn-group\"\n role=\"group\"\n aria-label=\"toolbar\"\n style=\"margin-bottom: 10px\"\n >\n <button\n mat-icon-button\n type=\"button\"\n (click)=\"reset()\"\n matTooltip=\"Reset filters\"\n [disabled]=\"disabled\"\n >\n <mat-icon class=\"mat-warn\">clear</mat-icon>\n </button>\n <button\n type=\"submit\"\n mat-icon-button\n [disabled]=\"disabled\"\n matTooltip=\"Apply filters\"\n >\n <mat-icon class=\"mat-primary\">check_circle</mat-icon>\n </button>\n </div>\n</form>\n", styles: ["fieldset{border:1px solid silver;border-radius:4px;padding:4px}\n"] }]
|
|
1048
|
-
}], ctorParameters: () => [{ type: i1.FormBuilder }, { type: i2.GraphNodeLookupService }, { type: i3.GraphService }], propDecorators: { disabled: [{
|
|
1049
|
-
type: Input
|
|
1050
|
-
}], hasPager: [{
|
|
1051
|
-
type: Input
|
|
1052
|
-
}], total: [{
|
|
1053
|
-
type: Input
|
|
1054
|
-
}], filter: [{
|
|
1055
|
-
type: Input
|
|
1056
|
-
}], filterChange: [{
|
|
1057
|
-
type: Output
|
|
1058
|
-
}] } });
|
|
1059
|
-
|
|
1060
|
-
/**
|
|
1061
|
-
* Triples filter.
|
|
1062
|
-
*/
|
|
1063
|
-
class TripleFilterComponent {
|
|
1064
806
|
/**
|
|
1065
|
-
*
|
|
807
|
+
* Select the specified node. This also implies updating all the current
|
|
808
|
+
* filters, which depend on the selected node.
|
|
809
|
+
*
|
|
810
|
+
* @param id The node ID or null to deselect the selected node.
|
|
1066
811
|
*/
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
812
|
+
selectNode(id) {
|
|
813
|
+
const node = id ? this._nodes$.value.find((n) => n.id === id) : null;
|
|
814
|
+
if (!node) {
|
|
815
|
+
this._selectedNode$.next(null);
|
|
816
|
+
this.resetFilters();
|
|
1072
817
|
return;
|
|
1073
818
|
}
|
|
1074
|
-
|
|
1075
|
-
this.
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
sid: this.sid,
|
|
1118
|
-
isSidPrefix: this.isSidPrefix,
|
|
1119
|
-
tag: this.tag,
|
|
1120
|
-
});
|
|
819
|
+
// deselect
|
|
820
|
+
const old = this._nodes$.value.find((n) => n.data?.selected);
|
|
821
|
+
if (old) {
|
|
822
|
+
old.data.selected = undefined;
|
|
823
|
+
}
|
|
824
|
+
// select
|
|
825
|
+
node.data.selected = true;
|
|
826
|
+
this._selectedNode$.next(node);
|
|
827
|
+
switch (node.id.charAt(0)) {
|
|
828
|
+
case 'N': // non-literal node
|
|
829
|
+
const nd = node.data;
|
|
830
|
+
this._nOutFilter$.next(nd.outFilter);
|
|
831
|
+
this._nInFilter$.next(nd.inFilter);
|
|
832
|
+
this._pOutFilter$.next(null);
|
|
833
|
+
this._pInFilter$.next(null);
|
|
834
|
+
this._pLitFilter$.next(null);
|
|
835
|
+
this._childTotals$.next({
|
|
836
|
+
nOut: nd.outTotal || 0,
|
|
837
|
+
nIn: nd.inTotal || 0,
|
|
838
|
+
pOut: 0,
|
|
839
|
+
pIn: 0,
|
|
840
|
+
pLit: 0,
|
|
841
|
+
});
|
|
842
|
+
break;
|
|
843
|
+
case 'P': // props group
|
|
844
|
+
const pd = node.data;
|
|
845
|
+
this._nOutFilter$.next(null);
|
|
846
|
+
this._nInFilter$.next(null);
|
|
847
|
+
this._pOutFilter$.next(pd.outFilter);
|
|
848
|
+
this._pInFilter$.next(pd.inFilter);
|
|
849
|
+
this._pLitFilter$.next(pd.litFilter);
|
|
850
|
+
this._childTotals$.next({
|
|
851
|
+
nOut: 0,
|
|
852
|
+
nIn: 0,
|
|
853
|
+
pOut: pd.outTotal || 0,
|
|
854
|
+
pIn: pd.inTotal || 0,
|
|
855
|
+
pLit: pd.litTotal || 0,
|
|
856
|
+
});
|
|
857
|
+
break;
|
|
858
|
+
case 'L': // literal node
|
|
859
|
+
this.resetFilters();
|
|
860
|
+
break;
|
|
861
|
+
}
|
|
1121
862
|
}
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
this.
|
|
1129
|
-
this.
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
863
|
+
/**
|
|
864
|
+
* Reset the graph setting its origin to the specified node.
|
|
865
|
+
*
|
|
866
|
+
* @param id The ID of the origin node to start from ("root origin").
|
|
867
|
+
*/
|
|
868
|
+
reset(id) {
|
|
869
|
+
this.toggleLoading(true);
|
|
870
|
+
this._graphService
|
|
871
|
+
.getNode(id)
|
|
872
|
+
.pipe(take(1))
|
|
873
|
+
.subscribe({
|
|
874
|
+
next: (node) => {
|
|
875
|
+
const nodes = [];
|
|
876
|
+
const data = {
|
|
877
|
+
uri: node.uri,
|
|
878
|
+
sourceType: node.sourceType,
|
|
879
|
+
originId: '', // root origin
|
|
880
|
+
customColor: '#F89427',
|
|
881
|
+
outFilter: {
|
|
882
|
+
pageNumber: 1,
|
|
883
|
+
pageSize: this.pageSize,
|
|
884
|
+
},
|
|
885
|
+
inFilter: {
|
|
886
|
+
pageNumber: 1,
|
|
887
|
+
pageSize: this.pageSize,
|
|
888
|
+
},
|
|
889
|
+
sid: node.sid,
|
|
890
|
+
};
|
|
891
|
+
const n = {
|
|
892
|
+
id: this.buildNodeId(node.id),
|
|
893
|
+
label: node.label || node.uri,
|
|
894
|
+
data: data,
|
|
895
|
+
};
|
|
896
|
+
nodes.push(n);
|
|
897
|
+
this._rootNode = n;
|
|
898
|
+
this._edges$.next([]);
|
|
899
|
+
this._nodes$.next(nodes);
|
|
900
|
+
this.expandNode(n);
|
|
901
|
+
},
|
|
902
|
+
error: (error) => {
|
|
903
|
+
this.setError(error);
|
|
904
|
+
},
|
|
905
|
+
complete: () => {
|
|
906
|
+
this.toggleLoading(false);
|
|
907
|
+
},
|
|
1151
908
|
});
|
|
1152
909
|
}
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
subjectId: this.subj.value?.id || undefined,
|
|
1163
|
-
predicateIds: this.preds.value?.length
|
|
1164
|
-
? this.preds.value.map((n) => n.id)
|
|
1165
|
-
: undefined,
|
|
1166
|
-
notPredicateIds: this.notPreds.value?.length
|
|
1167
|
-
? this.notPreds.value.map((n) => n.id)
|
|
1168
|
-
: undefined,
|
|
1169
|
-
hasLiteralObject: this.hasLiteralObj.value !== null
|
|
1170
|
-
? this.hasLiteralObj.value
|
|
1171
|
-
: undefined,
|
|
1172
|
-
objectId: this.obj.value?.id || undefined,
|
|
1173
|
-
sid: this.sid.value || undefined,
|
|
1174
|
-
isSidPrefix: this.isSidPrefix.value,
|
|
1175
|
-
tag: this.tag.value || undefined,
|
|
1176
|
-
};
|
|
910
|
+
/**
|
|
911
|
+
* Get the source and target graph nodes IDs from the specified edge ID.
|
|
912
|
+
*
|
|
913
|
+
* @param edgeId The ID of the edge graph node.
|
|
914
|
+
* @returns IDs of the source and target graph nodes.
|
|
915
|
+
*/
|
|
916
|
+
getEdgeEndIds(edgeId) {
|
|
917
|
+
const m = new RegExp('^E([^_]+)_(.+)$').exec(edgeId);
|
|
918
|
+
return m ? [m[1], m[2]] : null;
|
|
1177
919
|
}
|
|
1178
|
-
|
|
1179
|
-
|
|
920
|
+
/**
|
|
921
|
+
* Remove all the nodes with the specified origin node ID.
|
|
922
|
+
*
|
|
923
|
+
* @param originId The ID of the origin graph node.
|
|
924
|
+
* @param nodes The nodes array to remove nodes from.
|
|
925
|
+
* @param removedIds The IDs of all the removed nodes.
|
|
926
|
+
*/
|
|
927
|
+
removeDescendantNodes(originId, nodes, removedIds) {
|
|
928
|
+
const ids = new Set();
|
|
929
|
+
for (let i = nodes.length - 1; i > -1; i--) {
|
|
930
|
+
if (nodes[i].data.originId === originId) {
|
|
931
|
+
ids.add(nodes[i].id);
|
|
932
|
+
nodes.splice(i, 1);
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
// recurse for each removed node
|
|
936
|
+
// (edges never derive from other edges directly)
|
|
937
|
+
ids.forEach((id) => {
|
|
938
|
+
this.removeDescendantNodes(id, nodes, removedIds);
|
|
939
|
+
});
|
|
940
|
+
// update the received IDs set
|
|
941
|
+
ids.forEach((id) => {
|
|
942
|
+
removedIds.add(id);
|
|
943
|
+
});
|
|
1180
944
|
}
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
945
|
+
/**
|
|
946
|
+
* Remove all the children graph nodes of the specified origin graph node.
|
|
947
|
+
*
|
|
948
|
+
* @param originId The ID of the origin graph node.
|
|
949
|
+
* @param nodes The nodes array to remove nodes from.
|
|
950
|
+
* @param edges The edges array to remove edges from.
|
|
951
|
+
*/
|
|
952
|
+
removeChildren(originId, nodes, edges) {
|
|
953
|
+
const selectedId = this._selectedNode$.value?.id;
|
|
954
|
+
// remove all the nodes whose origin ID matches,
|
|
955
|
+
// collecting their IDs
|
|
956
|
+
const removedIds = new Set();
|
|
957
|
+
this.removeDescendantNodes(originId, nodes, removedIds);
|
|
958
|
+
// remove all the affected edges
|
|
959
|
+
for (let i = edges.length - 1; i > -1; i--) {
|
|
960
|
+
const endIds = this.getEdgeEndIds(edges[i].id);
|
|
961
|
+
if (endIds?.length &&
|
|
962
|
+
(removedIds.has(endIds[0]) || removedIds.has(endIds[1]))) {
|
|
963
|
+
edges.splice(i, 1);
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
// if the removed node was the selected one, select the root origin
|
|
967
|
+
if (selectedId && removedIds.has(selectedId)) {
|
|
968
|
+
this.selectNode(this._rootNode.id);
|
|
969
|
+
}
|
|
1184
970
|
}
|
|
1185
|
-
|
|
1186
|
-
|
|
971
|
+
/**
|
|
972
|
+
* Build a new graph node representing a property.
|
|
973
|
+
*
|
|
974
|
+
* @param sourceId The source node ID.
|
|
975
|
+
* @param group The triple group emitting this node.
|
|
976
|
+
* @returns A new graph node.
|
|
977
|
+
*/
|
|
978
|
+
buildPropertyNode(sourceId, group) {
|
|
979
|
+
const nid = this.getNodeNumericId(sourceId);
|
|
980
|
+
const data = {
|
|
981
|
+
originId: sourceId,
|
|
982
|
+
uri: group.predicateUri,
|
|
983
|
+
customColor: '#FF5619',
|
|
984
|
+
outFilter: {
|
|
985
|
+
pageNumber: 1,
|
|
986
|
+
pageSize: this.pageSize,
|
|
987
|
+
otherNodeId: nid,
|
|
988
|
+
predicateId: group.predicateId,
|
|
989
|
+
},
|
|
990
|
+
inFilter: {
|
|
991
|
+
pageNumber: 1,
|
|
992
|
+
pageSize: this.pageSize,
|
|
993
|
+
otherNodeId: nid,
|
|
994
|
+
predicateId: group.predicateId,
|
|
995
|
+
},
|
|
996
|
+
litFilter: {
|
|
997
|
+
pageNumber: 1,
|
|
998
|
+
pageSize: this.pageSize,
|
|
999
|
+
predicateId: group.predicateId,
|
|
1000
|
+
},
|
|
1001
|
+
};
|
|
1002
|
+
return {
|
|
1003
|
+
id: this.buildPropertyId(group.predicateId, nid),
|
|
1004
|
+
label: group.count.toString(),
|
|
1005
|
+
data: data,
|
|
1006
|
+
};
|
|
1187
1007
|
}
|
|
1188
|
-
|
|
1189
|
-
|
|
1008
|
+
/**
|
|
1009
|
+
* Expand the specified node, by loading its property groups.
|
|
1010
|
+
*
|
|
1011
|
+
* @param node The node to expand.
|
|
1012
|
+
* @param outFilter The properties to update for the output filter.
|
|
1013
|
+
* @param inFilter The properties to update for the input filter.
|
|
1014
|
+
*/
|
|
1015
|
+
expandNode(node, outFilter, inFilter) {
|
|
1016
|
+
// prepare filters
|
|
1017
|
+
const nid = this.getNodeNumericId(node.id);
|
|
1018
|
+
// outbound: node=S
|
|
1019
|
+
const outf = outFilter
|
|
1020
|
+
? Object.assign(node.data.outFilter, outFilter, {
|
|
1021
|
+
subjectId: nid,
|
|
1022
|
+
})
|
|
1023
|
+
: {
|
|
1024
|
+
pageNumber: 1,
|
|
1025
|
+
pageSize: this.pageSize,
|
|
1026
|
+
subjectId: nid,
|
|
1027
|
+
};
|
|
1028
|
+
// inbound: node=O
|
|
1029
|
+
const inf = inFilter
|
|
1030
|
+
? Object.assign(node.data.inFilter, inFilter, {
|
|
1031
|
+
objectId: nid,
|
|
1032
|
+
})
|
|
1033
|
+
: {
|
|
1034
|
+
pageNumber: 1,
|
|
1035
|
+
pageSize: this.pageSize,
|
|
1036
|
+
objectId: nid,
|
|
1037
|
+
};
|
|
1038
|
+
// load
|
|
1039
|
+
this.toggleLoading(true);
|
|
1040
|
+
const nodes = [...this._nodes$.value];
|
|
1041
|
+
const edges = [...this._edges$.value];
|
|
1042
|
+
forkJoin({
|
|
1043
|
+
outs: this._graphService.getTripleGroups(outf.pageNumber, outf.pageSize, outf),
|
|
1044
|
+
ins: this._graphService.getTripleGroups(inf.pageNumber, inf.pageSize, inf),
|
|
1045
|
+
}).subscribe({
|
|
1046
|
+
next: (result) => {
|
|
1047
|
+
node.data.expanded = true;
|
|
1048
|
+
// update origin's filters
|
|
1049
|
+
node.data.outFilter = outf;
|
|
1050
|
+
node.data.inFilter = inf;
|
|
1051
|
+
// remove previous children
|
|
1052
|
+
this.removeChildren(node.id, nodes, edges);
|
|
1053
|
+
// add outbound children
|
|
1054
|
+
node.data.outTotal = result.outs.total;
|
|
1055
|
+
for (let i = 0; i < result.outs.items.length; i++) {
|
|
1056
|
+
const group = result.outs.items[i];
|
|
1057
|
+
const prop = this.buildPropertyNode(node.id, group);
|
|
1058
|
+
// when expanding a node (e.g. N17) into props, the prop's ID is
|
|
1059
|
+
// P + predicate ID + N + origin node ID (e.g. P30N17).
|
|
1060
|
+
// This prop node can then be expanded, too, thus producing
|
|
1061
|
+
// a node with ID = N + node ID. When this in turn gets expanded,
|
|
1062
|
+
// it will produce also the prop node it comes from, which
|
|
1063
|
+
// must not be re-inserted in the graph. This node in the new
|
|
1064
|
+
// expansion context will get ID from the source node, which
|
|
1065
|
+
// is different from the node at the other end of the prop node:
|
|
1066
|
+
// this was e.g. N17, while the new node is e.g. N18. So, the
|
|
1067
|
+
// prop previously identified as P30N17 would now be identified
|
|
1068
|
+
// as P30N18, thus producing a duplicate. To avoid this, we
|
|
1069
|
+
// calculate an alias ID from the origin's origin: for N18,
|
|
1070
|
+
// its origin being P30N17, this will be N17. This produces an
|
|
1071
|
+
// alias P30N17, which being already present will avoid duplicates.
|
|
1072
|
+
// const aliasId = `P${group.predicateId}N${this.getNodeNumericId(
|
|
1073
|
+
// node.data.originId
|
|
1074
|
+
// )}`;
|
|
1075
|
+
// if (!nodes.some((n) => n.id === prop.id || n.id === aliasId)) {
|
|
1076
|
+
if (!nodes.some((n) => n.id === prop.id)) {
|
|
1077
|
+
nodes.push(prop);
|
|
1078
|
+
// edge from origin node to object property
|
|
1079
|
+
const edge = {
|
|
1080
|
+
id: this.buildEdgeId(node.id, prop.id),
|
|
1081
|
+
label: group.predicateUri,
|
|
1082
|
+
source: node.id,
|
|
1083
|
+
target: prop.id,
|
|
1084
|
+
data: {
|
|
1085
|
+
originId: node.id,
|
|
1086
|
+
},
|
|
1087
|
+
};
|
|
1088
|
+
this.addEdgeIfAbsent(edge, edges);
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
// add inbound children
|
|
1092
|
+
node.data.inTotal = result.ins.total;
|
|
1093
|
+
for (let i = 0; i < result.ins.items.length; i++) {
|
|
1094
|
+
const g = result.ins.items[i];
|
|
1095
|
+
// subject property
|
|
1096
|
+
const p = this.buildPropertyNode(node.id, g);
|
|
1097
|
+
// edge from object property to origin node
|
|
1098
|
+
const edge = {
|
|
1099
|
+
id: this.buildEdgeId(p.id, node.id),
|
|
1100
|
+
label: g.predicateUri,
|
|
1101
|
+
source: p.id,
|
|
1102
|
+
target: node.id,
|
|
1103
|
+
data: {
|
|
1104
|
+
originId: node.id,
|
|
1105
|
+
},
|
|
1106
|
+
};
|
|
1107
|
+
// do not add an edge having the same source P and target N,
|
|
1108
|
+
// whatever the P's source node
|
|
1109
|
+
const r = new RegExp('^EP' + g.predicateId + 'N[0-9]+_' + node.id + '$');
|
|
1110
|
+
if (!edges.some((e) => r.test(e.id))) {
|
|
1111
|
+
if (!nodes.some((n) => n.id === p.id)) {
|
|
1112
|
+
nodes.push(p);
|
|
1113
|
+
}
|
|
1114
|
+
this.addEdgeIfAbsent(edge, edges);
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
// update
|
|
1118
|
+
this._nodes$.next(nodes);
|
|
1119
|
+
this._edges$.next(edges);
|
|
1120
|
+
},
|
|
1121
|
+
error: (error) => {
|
|
1122
|
+
node.data.error = 'Error loading properties';
|
|
1123
|
+
this._nodes$.next(nodes);
|
|
1124
|
+
this.setError(error);
|
|
1125
|
+
},
|
|
1126
|
+
complete: () => {
|
|
1127
|
+
this.toggleLoading(false);
|
|
1128
|
+
},
|
|
1129
|
+
});
|
|
1190
1130
|
}
|
|
1191
|
-
|
|
1192
|
-
|
|
1131
|
+
/**
|
|
1132
|
+
* Expand the selected node, by loading its property groups.
|
|
1133
|
+
*
|
|
1134
|
+
* @param outFilter The properties to update for the output filter.
|
|
1135
|
+
* @param inFilter The properties to update for the input filter.
|
|
1136
|
+
*/
|
|
1137
|
+
expandSelectedNode(outFilter, inFilter) {
|
|
1138
|
+
if (!this._selectedNode$.value ||
|
|
1139
|
+
!this._selectedNode$.value.id.startsWith('N')) {
|
|
1193
1140
|
return;
|
|
1194
1141
|
}
|
|
1195
|
-
const
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
this.notPreds.setValue(nodes);
|
|
1203
|
-
this.notPreds.updateValueAndValidity();
|
|
1204
|
-
this.notPreds.markAsDirty();
|
|
1205
|
-
}
|
|
1206
|
-
else {
|
|
1207
|
-
const nodes = [...this.preds.value];
|
|
1208
|
-
if (nodes.some((n) => n.id === un.id)) {
|
|
1209
|
-
return;
|
|
1210
|
-
}
|
|
1211
|
-
nodes.push(un);
|
|
1212
|
-
this.preds.setValue(nodes);
|
|
1213
|
-
this.preds.updateValueAndValidity();
|
|
1214
|
-
this.preds.markAsDirty();
|
|
1142
|
+
const node = this._selectedNode$.value;
|
|
1143
|
+
this.expandNode(node, outFilter, inFilter);
|
|
1144
|
+
}
|
|
1145
|
+
buildLiteralLabel(triple) {
|
|
1146
|
+
let value = triple.objectLiteral || '';
|
|
1147
|
+
if (this.maxLiteralLen && value.length > this.maxLiteralLen) {
|
|
1148
|
+
value = value.substring(0, this.maxLiteralLen) + '\u2026';
|
|
1215
1149
|
}
|
|
1150
|
+
return value;
|
|
1216
1151
|
}
|
|
1217
|
-
|
|
1218
|
-
const
|
|
1219
|
-
const
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1152
|
+
buildNonLiteralNode(sourceId, node) {
|
|
1153
|
+
const nid = this.getNodeNumericId(sourceId);
|
|
1154
|
+
const data = {
|
|
1155
|
+
originId: sourceId,
|
|
1156
|
+
customColor: '#80ff95',
|
|
1157
|
+
uri: node.uri,
|
|
1158
|
+
sourceType: node.sourceType,
|
|
1159
|
+
isClass: node.isClass,
|
|
1160
|
+
sid: node.sid,
|
|
1161
|
+
tag: node.tag,
|
|
1162
|
+
outFilter: {
|
|
1163
|
+
pageNumber: 0,
|
|
1164
|
+
pageSize: this.pageSize,
|
|
1165
|
+
subjectId: nid,
|
|
1166
|
+
},
|
|
1167
|
+
inFilter: {
|
|
1168
|
+
pageNumber: 0,
|
|
1169
|
+
pageSize: this.pageSize,
|
|
1170
|
+
objectId: nid,
|
|
1171
|
+
},
|
|
1172
|
+
};
|
|
1173
|
+
return {
|
|
1174
|
+
id: this.buildNodeId(node.id),
|
|
1175
|
+
label: node.label,
|
|
1176
|
+
data: data,
|
|
1177
|
+
};
|
|
1224
1178
|
}
|
|
1225
|
-
|
|
1226
|
-
const
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1179
|
+
buildLiteralNode(sourceId, triple) {
|
|
1180
|
+
const data = {
|
|
1181
|
+
originId: sourceId,
|
|
1182
|
+
customColor: '#ebe2e0',
|
|
1183
|
+
value: triple.objectLiteral || '',
|
|
1184
|
+
type: triple.literalType,
|
|
1185
|
+
language: triple.literalLanguage,
|
|
1186
|
+
number: triple.literalNumber,
|
|
1187
|
+
};
|
|
1188
|
+
return {
|
|
1189
|
+
id: this.buildLiteralId(triple.id),
|
|
1190
|
+
label: this.buildLiteralLabel(triple),
|
|
1191
|
+
data: data,
|
|
1192
|
+
};
|
|
1232
1193
|
}
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1194
|
+
/**
|
|
1195
|
+
* Expand the currently selected properties group node, by loading its
|
|
1196
|
+
* outbound nodes, inbound nodes, and literal nodes.
|
|
1197
|
+
*
|
|
1198
|
+
* @param node The property group node to expand.
|
|
1199
|
+
* @param outFilter The properties to update for the outbound nodes filter.
|
|
1200
|
+
* @param inFilter The properties to update for the inbound nodes filter.
|
|
1201
|
+
* @param litFilter The properties to update for the literal nodes filter.
|
|
1202
|
+
*/
|
|
1203
|
+
expandProperty(node, outFilter, inFilter, litFilter) {
|
|
1204
|
+
// prepare filters
|
|
1205
|
+
const nid = this.getNodeNumericId(node.id);
|
|
1206
|
+
const data = node.data;
|
|
1207
|
+
const outf = Object.assign(data.outFilter, outFilter || {}, { isObject: true });
|
|
1208
|
+
const inf = Object.assign(data.inFilter, inFilter || {}, {
|
|
1209
|
+
isObject: false,
|
|
1210
|
+
});
|
|
1211
|
+
const litf = Object.assign(data.litFilter, litFilter || {}, { subjectId: nid, predicateId: this.getPredicateNumericId(node.id) });
|
|
1212
|
+
// load
|
|
1213
|
+
this.toggleLoading(true);
|
|
1214
|
+
const nodes = [...this._nodes$.value];
|
|
1215
|
+
const edges = [...this._edges$.value];
|
|
1216
|
+
forkJoin({
|
|
1217
|
+
outs: this._graphService.getLinkedNodes(outf.pageNumber, outf.pageSize, outf),
|
|
1218
|
+
ins: this._graphService.getLinkedNodes(inf.pageNumber, inf.pageSize, inf),
|
|
1219
|
+
lits: this._graphService.getLinkedLiterals(litf.pageNumber, litf.pageSize, litf),
|
|
1220
|
+
}).subscribe({
|
|
1221
|
+
next: (result) => {
|
|
1222
|
+
node.data.expanded = true;
|
|
1223
|
+
// update origin's filters
|
|
1224
|
+
node.data.outFilter = outf;
|
|
1225
|
+
node.data.inFilter = inf;
|
|
1226
|
+
node.data.litFilter = litf;
|
|
1227
|
+
// remove previous children
|
|
1228
|
+
this.removeChildren(node.id, nodes, edges);
|
|
1229
|
+
// add outbound children
|
|
1230
|
+
node.data.outTotal = result.outs.total;
|
|
1231
|
+
for (let i = 0; i < result.outs.items.length; i++) {
|
|
1232
|
+
const child = result.outs.items[i];
|
|
1233
|
+
const obj = this.buildNonLiteralNode(node.id, child);
|
|
1234
|
+
if (!nodes.some((n) => n.id === obj.id)) {
|
|
1235
|
+
nodes.push(obj);
|
|
1236
|
+
}
|
|
1237
|
+
// edge from property to non literal object node
|
|
1238
|
+
const edge = {
|
|
1239
|
+
id: this.buildEdgeId(node.id, obj.id),
|
|
1240
|
+
label: '',
|
|
1241
|
+
source: node.id,
|
|
1242
|
+
target: obj.id,
|
|
1243
|
+
data: {
|
|
1244
|
+
originId: node.id,
|
|
1245
|
+
},
|
|
1246
|
+
};
|
|
1247
|
+
this.addEdgeIfAbsent(edge, edges);
|
|
1248
|
+
}
|
|
1249
|
+
// add inbound children
|
|
1250
|
+
node.data.inTotal = result.ins.total;
|
|
1251
|
+
for (let i = 0; i < result.ins.items.length; i++) {
|
|
1252
|
+
const child = result.ins.items[i];
|
|
1253
|
+
const subj = this.buildNonLiteralNode(node.id, child);
|
|
1254
|
+
if (!nodes.some((n) => n.id === subj.id)) {
|
|
1255
|
+
nodes.push(subj);
|
|
1256
|
+
}
|
|
1257
|
+
// edge from subject node to property
|
|
1258
|
+
const edge = {
|
|
1259
|
+
id: this.buildEdgeId(subj.id, node.id),
|
|
1260
|
+
label: '',
|
|
1261
|
+
source: subj.id,
|
|
1262
|
+
target: node.id,
|
|
1263
|
+
data: {
|
|
1264
|
+
originId: node.id,
|
|
1265
|
+
},
|
|
1266
|
+
};
|
|
1267
|
+
this.addEdgeIfAbsent(edge, edges);
|
|
1268
|
+
}
|
|
1269
|
+
// add literal children
|
|
1270
|
+
node.data.litTotal = result.lits.total;
|
|
1271
|
+
for (let i = 0; i < result.lits.items.length; i++) {
|
|
1272
|
+
const triple = result.lits.items[i];
|
|
1273
|
+
const lit = this.buildLiteralNode(node.id, triple);
|
|
1274
|
+
if (!nodes.some((n) => n.id === lit.id)) {
|
|
1275
|
+
nodes.push(lit);
|
|
1276
|
+
}
|
|
1277
|
+
// edge from property to literal
|
|
1278
|
+
const edge = {
|
|
1279
|
+
id: this.buildEdgeId(node.id, lit.id),
|
|
1280
|
+
label: lit.data.literalType || '',
|
|
1281
|
+
source: node.id,
|
|
1282
|
+
target: lit.id,
|
|
1283
|
+
data: {
|
|
1284
|
+
originId: node.id,
|
|
1285
|
+
},
|
|
1286
|
+
};
|
|
1287
|
+
this.addEdgeIfAbsent(edge, edges);
|
|
1288
|
+
}
|
|
1289
|
+
// update
|
|
1290
|
+
this._nodes$.next(nodes);
|
|
1291
|
+
this._edges$.next(edges);
|
|
1292
|
+
},
|
|
1293
|
+
error: (error) => {
|
|
1294
|
+
node.data.error = 'Error loading nodes';
|
|
1295
|
+
this._nodes$.next(nodes);
|
|
1296
|
+
this.setError(error);
|
|
1297
|
+
},
|
|
1298
|
+
complete: () => {
|
|
1299
|
+
this.toggleLoading(false);
|
|
1300
|
+
},
|
|
1301
|
+
});
|
|
1237
1302
|
}
|
|
1238
|
-
|
|
1239
|
-
|
|
1303
|
+
/**
|
|
1304
|
+
* Expand the currently selected properties group node, by loading its
|
|
1305
|
+
* outbound nodes, inbound nodes, and literal nodes. If there is no
|
|
1306
|
+
* selection, or the selected node is not a properties group node, nothing
|
|
1307
|
+
* is done.
|
|
1308
|
+
*
|
|
1309
|
+
* @param outFilter The properties to update for the outbound nodes filter.
|
|
1310
|
+
* @param inFilter The properties to update for the inbound nodes filter.
|
|
1311
|
+
* @param litFilter The properties to update for the literal nodes filter.
|
|
1312
|
+
*/
|
|
1313
|
+
expandSelectedProperty(outFilter, inFilter, litFilter) {
|
|
1314
|
+
if (!this._selectedNode$.value ||
|
|
1315
|
+
!this._selectedNode$.value.id.startsWith('P')) {
|
|
1240
1316
|
return;
|
|
1241
1317
|
}
|
|
1242
|
-
this.
|
|
1243
|
-
this.
|
|
1318
|
+
const node = this._selectedNode$.value;
|
|
1319
|
+
this.expandProperty(node, outFilter, inFilter, litFilter);
|
|
1244
1320
|
}
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
type: Input
|
|
1259
|
-
}], filterChange: [{
|
|
1260
|
-
type: Output
|
|
1261
|
-
}] } });
|
|
1262
|
-
|
|
1263
|
-
/**
|
|
1264
|
-
* Get the extended label for the specified graph node. This returns the label
|
|
1265
|
-
* for N nodes, and the uri + "=" + the label for P nodes. That's because P
|
|
1266
|
-
* nodes label is just the count of the triples group, so the predicate ID is
|
|
1267
|
-
* got from the property node's data uri.
|
|
1268
|
-
*/
|
|
1269
|
-
class GraphNodeLabelPipe {
|
|
1270
|
-
transform(value, ...args) {
|
|
1271
|
-
const node = value;
|
|
1272
|
-
if (!node?.id || !node?.label) {
|
|
1273
|
-
return value;
|
|
1321
|
+
/**
|
|
1322
|
+
* Toggle the specified node by expanding or collapsing it.
|
|
1323
|
+
*
|
|
1324
|
+
* @param node The node to toggle.
|
|
1325
|
+
*/
|
|
1326
|
+
toggleNode(node) {
|
|
1327
|
+
if (node.data.expanded) {
|
|
1328
|
+
const nodes = [...this._nodes$.value];
|
|
1329
|
+
const edges = [...this._edges$.value];
|
|
1330
|
+
this.removeChildren(node.id, nodes, edges);
|
|
1331
|
+
node.data.expanded = undefined;
|
|
1332
|
+
this._nodes$.next(nodes);
|
|
1333
|
+
this._edges$.next(edges);
|
|
1274
1334
|
}
|
|
1275
|
-
|
|
1276
|
-
|
|
1335
|
+
else {
|
|
1336
|
+
if (node.id.startsWith('N')) {
|
|
1337
|
+
this.expandNode(node);
|
|
1338
|
+
}
|
|
1339
|
+
else if (node.id.startsWith('P')) {
|
|
1340
|
+
this.expandProperty(node);
|
|
1341
|
+
}
|
|
1277
1342
|
}
|
|
1278
|
-
return node.label;
|
|
1279
1343
|
}
|
|
1280
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: GraphNodeLabelPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
1281
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.0.5", ngImport: i0, type: GraphNodeLabelPipe, isStandalone: false, name: "graphNodeLabel" }); }
|
|
1282
1344
|
}
|
|
1283
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: GraphNodeLabelPipe, decorators: [{
|
|
1284
|
-
type: Pipe,
|
|
1285
|
-
args: [{
|
|
1286
|
-
name: 'graphNodeLabel',
|
|
1287
|
-
standalone: false,
|
|
1288
|
-
}]
|
|
1289
|
-
}] });
|
|
1290
1345
|
|
|
1291
1346
|
/**
|
|
1292
1347
|
* Graph walker component. This starts from a given node, and let users
|
|
1293
1348
|
* walk along edges to discover new nodes.
|
|
1294
1349
|
*/
|
|
1295
1350
|
class GraphWalkerComponent {
|
|
1351
|
+
_dialog;
|
|
1352
|
+
_sub;
|
|
1353
|
+
_walker;
|
|
1296
1354
|
/**
|
|
1297
1355
|
* The root origin node ID.
|
|
1298
1356
|
*/
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1357
|
+
nodeId = input(0);
|
|
1358
|
+
/**
|
|
1359
|
+
* True if user can pick a node from the graph.
|
|
1360
|
+
*/
|
|
1361
|
+
canPick = input();
|
|
1362
|
+
/**
|
|
1363
|
+
* True if user can move to the source of a picked node when
|
|
1364
|
+
* shift-clicking it.
|
|
1365
|
+
*/
|
|
1366
|
+
canMoveToSource = input();
|
|
1367
|
+
/**
|
|
1368
|
+
* Emitted when a graph node is picked by user.
|
|
1369
|
+
*/
|
|
1370
|
+
nodePick = output();
|
|
1371
|
+
/**
|
|
1372
|
+
* Emitted when the user requests to move to the source of a picked node.
|
|
1373
|
+
*/
|
|
1374
|
+
moveToSource = output();
|
|
1375
|
+
// graph
|
|
1376
|
+
nodes$;
|
|
1377
|
+
edges$;
|
|
1378
|
+
loading$;
|
|
1379
|
+
error$;
|
|
1380
|
+
// selected node
|
|
1381
|
+
selectedNode$;
|
|
1382
|
+
pOutFilter$;
|
|
1383
|
+
pInFilter$;
|
|
1384
|
+
pLitFilter$;
|
|
1385
|
+
nOutFilter$;
|
|
1386
|
+
nInFilter$;
|
|
1387
|
+
childTotals$;
|
|
1388
|
+
// ngx-graph actions
|
|
1389
|
+
update$ = new Subject();
|
|
1390
|
+
center$ = new Subject();
|
|
1391
|
+
zoomToFit$ = new Subject();
|
|
1309
1392
|
constructor(graphService, _dialog) {
|
|
1310
1393
|
this._dialog = _dialog;
|
|
1311
|
-
// ngx-graph actions
|
|
1312
|
-
this.update$ = new Subject();
|
|
1313
|
-
this.center$ = new Subject();
|
|
1314
|
-
this.zoomToFit$ = new Subject();
|
|
1315
1394
|
this._walker = new GraphWalker(graphService);
|
|
1316
|
-
this._nodeId = 0;
|
|
1317
|
-
this.nodePick = new EventEmitter();
|
|
1318
|
-
this.moveToSource = new EventEmitter();
|
|
1319
1395
|
this.nodes$ = this._walker.nodes$;
|
|
1320
1396
|
this.edges$ = this._walker.edges$;
|
|
1321
1397
|
this.loading$ = this._walker.loading$;
|
|
@@ -1327,12 +1403,21 @@ class GraphWalkerComponent {
|
|
|
1327
1403
|
this.nOutFilter$ = this._walker.nOutFilter$;
|
|
1328
1404
|
this.nInFilter$ = this._walker.nInFilter$;
|
|
1329
1405
|
this.childTotals$ = this._walker.childTotals$;
|
|
1406
|
+
effect(() => {
|
|
1407
|
+
const id = this.nodeId();
|
|
1408
|
+
if (id) {
|
|
1409
|
+
this.reset(id);
|
|
1410
|
+
}
|
|
1411
|
+
});
|
|
1330
1412
|
}
|
|
1331
1413
|
ngOnInit() {
|
|
1332
|
-
this.update$.subscribe((_) => {
|
|
1414
|
+
this._sub = this.update$.subscribe((_) => {
|
|
1333
1415
|
this.onReset();
|
|
1334
1416
|
});
|
|
1335
1417
|
}
|
|
1418
|
+
ngOnDestroy() {
|
|
1419
|
+
this._sub?.unsubscribe();
|
|
1420
|
+
}
|
|
1336
1421
|
onNodeSelect(node) {
|
|
1337
1422
|
this._walker.selectNode(node.id);
|
|
1338
1423
|
}
|
|
@@ -1340,7 +1425,7 @@ class GraphWalkerComponent {
|
|
|
1340
1425
|
this._walker.reset(id);
|
|
1341
1426
|
}
|
|
1342
1427
|
onReset() {
|
|
1343
|
-
if (!this.
|
|
1428
|
+
if (!this.nodeId()) {
|
|
1344
1429
|
return;
|
|
1345
1430
|
}
|
|
1346
1431
|
this._dialog
|
|
@@ -1348,7 +1433,7 @@ class GraphWalkerComponent {
|
|
|
1348
1433
|
.pipe(take$1(1))
|
|
1349
1434
|
.subscribe((yes) => {
|
|
1350
1435
|
if (yes) {
|
|
1351
|
-
this.reset(this.
|
|
1436
|
+
this.reset(this.nodeId());
|
|
1352
1437
|
}
|
|
1353
1438
|
});
|
|
1354
1439
|
}
|
|
@@ -1375,7 +1460,7 @@ class GraphWalkerComponent {
|
|
|
1375
1460
|
if (!node) {
|
|
1376
1461
|
return;
|
|
1377
1462
|
}
|
|
1378
|
-
if (this.canMoveToSource && event.shiftKey) {
|
|
1463
|
+
if (this.canMoveToSource() && event.shiftKey) {
|
|
1379
1464
|
if (node.data.sid) {
|
|
1380
1465
|
this.moveToSource.emit(node);
|
|
1381
1466
|
}
|
|
@@ -1384,134 +1469,27 @@ class GraphWalkerComponent {
|
|
|
1384
1469
|
this.nodePick.emit(node);
|
|
1385
1470
|
}
|
|
1386
1471
|
}
|
|
1387
|
-
static
|
|
1388
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: GraphWalkerComponent, isStandalone: false, selector: "cadmus-graph-walker", inputs: { nodeId: "nodeId", canPick: "canPick", canMoveToSource: "canMoveToSource" }, outputs: { nodePick: "nodePick", moveToSource: "moveToSource" }, ngImport: i0, template: "<div id=\"container\">\n <!-- graph -->\n <div id=\"graph\">\n <ngx-graph\n class=\"chart-container\"\n [showMiniMap]=\"true\"\n [links]=\"(edges$ | async) || []\"\n [nodes]=\"(nodes$ | async) || []\"\n [update$]=\"update$\"\n [center$]=\"center$\"\n [zoomToFit$]=\"zoomToFit$\"\n layout=\"colaForceDirected\"\n (select)=\"onNodeSelect($event)\"\n >\n <ng-template #defsTemplate>\n <svg:marker\n id=\"arrow\"\n viewBox=\"0 -5 10 10\"\n refX=\"8\"\n refY=\"0\"\n markerWidth=\"4\"\n markerHeight=\"4\"\n orient=\"auto\"\n >\n <svg:path d=\"M0,-5L10,0L0,5\" class=\"arrow-head\" />\n </svg:marker>\n </ng-template>\n\n <!-- cluster template -->\n <ng-template #clusterTemplate let-cluster>\n <svg:g class=\"node cluster\">\n <svg:rect\n rx=\"5\"\n ry=\"5\"\n [attr.width]=\"cluster.dimension.width\"\n [attr.height]=\"cluster.dimension.height\"\n [attr.fill]=\"cluster.data.color\"\n />\n </svg:g>\n </ng-template>\n\n <!-- node template -->\n <ng-template #nodeTemplate let-node>\n <svg:g class=\"node\" (dblclick)=\"onNodeDblClick(node)\">\n <svg:rect\n [class.selected]=\"node.data?.selected\"\n [attr.width]=\"node.dimension.width\"\n [attr.height]=\"node.dimension.height\"\n [attr.fill]=\"node.data.customColor || node.data.color\"\n />\n <svg:text\n alignment-baseline=\"central\"\n [attr.x]=\"10\"\n [attr.y]=\"node.dimension.height / 2\"\n >\n {{ node.label }}\n </svg:text>\n </svg:g>\n </ng-template>\n\n <!-- link template -->\n <ng-template #linkTemplate let-link>\n <svg:g class=\"edge\">\n <svg:path\n class=\"line\"\n stroke-width=\"2\"\n marker-end=\"url(#arrow)\"\n ></svg:path>\n <svg:text class=\"edge-label\" text-anchor=\"middle\">\n <textPath\n class=\"text-path\"\n [attr.href]=\"'#' + link.id\"\n [style.dominant-baseline]=\"link.dominantBaseline\"\n startOffset=\"50%\"\n >\n {{ link.label }}\n </textPath>\n </svg:text>\n </svg:g>\n </ng-template>\n </ngx-graph>\n </div>\n\n <!-- tools -->\n <div id=\"tools\">\n <div id=\"bar\">\n <button\n type=\"button\"\n mat-icon-button\n matTooltip=\"Center\"\n (click)=\"center$.next(true)\"\n >\n <mat-icon>filter_center_focus</mat-icon>\n </button>\n <button\n type=\"button\"\n mat-icon-button\n matTooltip=\"Zoom to fit\"\n (click)=\"zoomToFit$.next({ force: true })\"\n >\n <mat-icon>fit_screen</mat-icon>\n </button>\n <button\n type=\"button\"\n mat-icon-button\n matTooltip=\"Reset\"\n (click)=\"update$.next(true)\"\n >\n <mat-icon class=\"mat-warn\">restart_alt</mat-icon>\n </button>\n @if (nodes$ | async; as nodes) {\n <span class=\"muted\"\n >N:{{ nodes.length }} E:{{ (edges$ | async)?.length }}</span\n >\n } @if (selectedNode$ | async; as selectedNode) {\n <button\n type=\"button\"\n mat-icon-button\n matTooltip=\"Toggle the selected node\"\n [disabled]=\"!selectedNode\"\n (click)=\"onNodeDblClick(selectedNode)\"\n >\n <mat-icon class=\"mat-primary\">unfold_more</mat-icon>\n </button>\n } @if (canPick) {\n <button\n type=\"button\"\n mat-icon-button\n [matTooltip]=\"\n canMoveToSource\n ? 'Pick selected node or (shift) its source'\n : 'Pick the selected node'\n \"\n [disabled]=\"!(selectedNode$ | async)\"\n (click)=\"pickSelectedNode($event)\"\n >\n <mat-icon class=\"mat-primary\">check_circle</mat-icon>\n </button>\n }\n </div>\n <!-- progress -->\n <div id=\"progress\">\n @if (loading$ | async) {\n <mat-progress-bar mode=\"indeterminate\"></mat-progress-bar>\n }\n </div>\n <div id=\"filters\">\n @if (selectedNode$ | async; as node) {\n <div id=\"filter-head\">\n <span [style.color]=\"node.data.color || 'black'\">⬤</span>\n <span style=\"margin-left: 6px\" matTooltip=\"{{ node.data.uri }}\">{{\n node | graphNodeLabel\n }}</span>\n <span class=\"muted\" style=\"margin-left: 8px; font-size: 90%\">{{\n node.id\n }}</span>\n </div>\n }\n <mat-tab-group>\n <!-- N-outs -->\n @if (nOutFilter$ | async; as nOutFilter) {\n <mat-tab>\n <ng-template mat-tab-label>\n N<mat-icon>logout</mat-icon>\n </ng-template>\n <cadmus-walker-triple-filter\n [filter]=\"nOutFilter\"\n (filterChange)=\"onNOutFilterChange($event)\"\n ></cadmus-walker-triple-filter>\n </mat-tab>\n }\n <!-- N-ins -->\n @if (nInFilter$ | async; as nInFilter) {\n <mat-tab>\n <ng-template mat-tab-label> N<mat-icon>login</mat-icon> </ng-template>\n <cadmus-walker-triple-filter\n [filter]=\"nInFilter\"\n (filterChange)=\"onNInFilterChange($event)\"\n ></cadmus-walker-triple-filter>\n </mat-tab>\n }\n <!-- P-outs -->\n @if (pOutFilter$ | async; as pOutFilter) {\n <mat-tab>\n <ng-template mat-tab-label>\n P<mat-icon>logout</mat-icon>\n </ng-template>\n <cadmus-walker-linked-node-filter\n [filter]=\"pOutFilter\"\n (filterChange)=\"onPOutFilterChange($event)\"\n ></cadmus-walker-linked-node-filter>\n </mat-tab>\n }\n <!-- P-ins -->\n @if (pInFilter$ | async; as pInFilter) {\n <mat-tab>\n <ng-template mat-tab-label> P<mat-icon>login</mat-icon> </ng-template>\n <cadmus-walker-linked-node-filter\n [filter]=\"pInFilter\"\n (filterChange)=\"onPInFilterChange($event)\"\n ></cadmus-walker-linked-node-filter>\n </mat-tab>\n }\n <!-- P-lit -->\n @if (pLitFilter$ | async; as pLitFilter) {\n <mat-tab>\n <ng-template mat-tab-label>\n P<mat-icon>exit_to_app</mat-icon>\n </ng-template>\n <cadmus-walker-linked-literal-filter\n [filter]=\"pLitFilter\"\n (filterChange)=\"onPLitFilterChange($event)\"\n ></cadmus-walker-linked-literal-filter>\n </mat-tab>\n }\n </mat-tab-group>\n </div>\n </div>\n</div>\n", styles: ["div#filter-head{border:1px solid #f8f1ae;border-radius:4px;padding:4px;margin-bottom:4px;background-color:#f8f1ae;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.muted{color:silver}.selected{stroke-width:2px;stroke:#e7d211}#container{width:100%;max-width:100%;height:100%;max-height:100%;display:grid;grid-template-rows:1fr;grid-template-columns:auto 1fr;grid-template-areas:\"tools graph\";gap:8px}#graph{grid-area:graph}#tools{grid-area:tools;padding:8px;border:1px solid silver;height:100%;max-height:100%;min-width:324px;background-color:#fdfdfd}#tools #bar{display:flex;align-items:center;flex-wrap:wrap}@media only screen and (max-width: 959px){#container{grid-template-rows:auto 1fr;grid-template-columns:1fr;grid-template-areas:\"tools\" \"graph\"}}\n"], dependencies: [{ kind: "component", type: i4.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "component", type: i6.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i5$1.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "directive", type: i6$2.MatTabLabel, selector: "[mat-tab-label], [matTabLabel]" }, { kind: "component", type: i6$2.MatTab, selector: "mat-tab", inputs: ["disabled", "label", "aria-label", "aria-labelledby", "labelClass", "bodyClass"], exportAs: ["matTab"] }, { kind: "component", type: i6$2.MatTabGroup, selector: "mat-tab-group", inputs: ["color", "fitInkBarToContent", "mat-stretch-tabs", "mat-align-tabs", "dynamicHeight", "selectedIndex", "headerPosition", "animationDuration", "contentTabIndex", "disablePagination", "disableRipple", "preserveContent", "backgroundColor", "aria-label", "aria-labelledby"], outputs: ["selectedIndexChange", "focusChange", "animationDone", "selectedTabChange"], exportAs: ["matTabGroup"] }, { kind: "directive", type: i9.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: i8$1.GraphComponent, selector: "ngx-graph", inputs: ["nodes", "clusters", "compoundNodes", "links", "activeEntries", "curve", "draggingEnabled", "nodeHeight", "nodeMaxHeight", "nodeMinHeight", "nodeWidth", "nodeMinWidth", "nodeMaxWidth", "panningEnabled", "panningAxis", "enableZoom", "zoomSpeed", "minZoomLevel", "maxZoomLevel", "autoZoom", "panOnZoom", "animate", "autoCenter", "update$", "center$", "zoomToFit$", "panToNode$", "layout", "layoutSettings", "enableTrackpadSupport", "showMiniMap", "miniMapMaxWidth", "miniMapMaxHeight", "miniMapPosition", "view", "scheme", "customColors", "animations", "deferDisplayUntilPosition", "centerNodesOnPositionChange", "enablePreUpdateTransform", "groupResultsBy", "zoomLevel", "panOffsetX", "panOffsetY"], outputs: ["select", "activate", "deactivate", "zoomChange", "clickHandler", "stateChange"] }, { kind: "component", type: LinkedLiteralFilterComponent, selector: "cadmus-walker-linked-literal-filter", inputs: ["disabled", "hasPager", "total", "filter"], outputs: ["filterChange"] }, { kind: "component", type: LinkedNodeFilterComponent, selector: "cadmus-walker-linked-node-filter", inputs: ["disabled", "hasPager", "total", "filter"], outputs: ["filterChange"] }, { kind: "component", type: TripleFilterComponent, selector: "cadmus-walker-triple-filter", inputs: ["disabled", "hasPager", "total", "filter"], outputs: ["filterChange"] }, { kind: "pipe", type: i12$1.AsyncPipe, name: "async" }, { kind: "pipe", type: GraphNodeLabelPipe, name: "graphNodeLabel" }] }); }
|
|
1472
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: GraphWalkerComponent, deps: [{ token: i3.GraphService }, { token: i2$1.DialogService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1473
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.3", type: GraphWalkerComponent, isStandalone: true, selector: "cadmus-graph-walker", inputs: { nodeId: { classPropertyName: "nodeId", publicName: "nodeId", isSignal: true, isRequired: false, transformFunction: null }, canPick: { classPropertyName: "canPick", publicName: "canPick", isSignal: true, isRequired: false, transformFunction: null }, canMoveToSource: { classPropertyName: "canMoveToSource", publicName: "canMoveToSource", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { nodePick: "nodePick", moveToSource: "moveToSource" }, ngImport: i0, template: "<div id=\"container\">\n <!-- graph -->\n <div id=\"graph\">\n <ngx-graph\n class=\"chart-container\"\n [showMiniMap]=\"true\"\n [links]=\"(edges$ | async) || []\"\n [nodes]=\"(nodes$ | async) || []\"\n [update$]=\"update$\"\n [center$]=\"center$\"\n [zoomToFit$]=\"zoomToFit$\"\n layout=\"colaForceDirected\"\n (select)=\"onNodeSelect($event)\"\n >\n <ng-template #defsTemplate>\n <svg:marker\n id=\"arrow\"\n viewBox=\"0 -5 10 10\"\n refX=\"8\"\n refY=\"0\"\n markerWidth=\"4\"\n markerHeight=\"4\"\n orient=\"auto\"\n >\n <svg:path d=\"M0,-5L10,0L0,5\" class=\"arrow-head\" />\n </svg:marker>\n </ng-template>\n\n <!-- cluster template -->\n <ng-template #clusterTemplate let-cluster>\n <svg:g class=\"node cluster\">\n <svg:rect\n rx=\"5\"\n ry=\"5\"\n [attr.width]=\"cluster.dimension.width\"\n [attr.height]=\"cluster.dimension.height\"\n [attr.fill]=\"cluster.data.color\"\n />\n </svg:g>\n </ng-template>\n\n <!-- node template -->\n <ng-template #nodeTemplate let-node>\n <svg:g class=\"node\" (dblclick)=\"onNodeDblClick(node)\">\n <svg:rect\n [class.selected]=\"node.data?.selected\"\n [attr.width]=\"node.dimension.width\"\n [attr.height]=\"node.dimension.height\"\n [attr.fill]=\"node.data.customColor || node.data.color\"\n />\n <svg:text\n alignment-baseline=\"central\"\n [attr.x]=\"10\"\n [attr.y]=\"node.dimension.height / 2\"\n >\n {{ node.label }}\n </svg:text>\n </svg:g>\n </ng-template>\n\n <!-- link template -->\n <ng-template #linkTemplate let-link>\n <svg:g class=\"edge\">\n <svg:path\n class=\"line\"\n stroke-width=\"2\"\n marker-end=\"url(#arrow)\"\n ></svg:path>\n <svg:text class=\"edge-label\" text-anchor=\"middle\">\n <textPath\n class=\"text-path\"\n [attr.href]=\"'#' + link.id\"\n [style.dominant-baseline]=\"link.dominantBaseline\"\n startOffset=\"50%\"\n >\n {{ link.label }}\n </textPath>\n </svg:text>\n </svg:g>\n </ng-template>\n </ngx-graph>\n </div>\n\n <!-- tools -->\n <div id=\"tools\">\n <div id=\"bar\">\n <button\n type=\"button\"\n mat-icon-button\n matTooltip=\"Center\"\n (click)=\"center$.next(true)\"\n >\n <mat-icon>filter_center_focus</mat-icon>\n </button>\n <button\n type=\"button\"\n mat-icon-button\n matTooltip=\"Zoom to fit\"\n (click)=\"zoomToFit$.next({ force: true })\"\n >\n <mat-icon>fit_screen</mat-icon>\n </button>\n <button\n type=\"button\"\n mat-icon-button\n matTooltip=\"Reset\"\n (click)=\"update$.next(true)\"\n >\n <mat-icon class=\"mat-warn\">restart_alt</mat-icon>\n </button>\n @if (nodes$ | async; as nodes) {\n <span class=\"muted\"\n >N:{{ nodes.length }} E:{{ (edges$ | async)?.length }}</span\n >\n } @if (selectedNode$ | async; as selectedNode) {\n <button\n type=\"button\"\n mat-icon-button\n matTooltip=\"Toggle the selected node\"\n [disabled]=\"!selectedNode\"\n (click)=\"onNodeDblClick(selectedNode)\"\n >\n <mat-icon class=\"mat-primary\">unfold_more</mat-icon>\n </button>\n } @if (canPick()) {\n <button\n type=\"button\"\n mat-icon-button\n [matTooltip]=\"\n canMoveToSource()\n ? 'Pick selected node or (shift) its source'\n : 'Pick the selected node'\n \"\n [disabled]=\"!(selectedNode$ | async)\"\n (click)=\"pickSelectedNode($event)\"\n >\n <mat-icon class=\"mat-primary\">check_circle</mat-icon>\n </button>\n }\n </div>\n <!-- progress -->\n <div id=\"progress\">\n @if (loading$ | async) {\n <mat-progress-bar mode=\"indeterminate\"></mat-progress-bar>\n }\n </div>\n <div id=\"filters\">\n @if (selectedNode$ | async; as node) {\n <div id=\"filter-head\">\n <span [style.color]=\"node.data.color || 'black'\">⬤</span>\n <span style=\"margin-left: 6px\" matTooltip=\"{{ node.data.uri }}\">{{\n node | graphNodeLabel\n }}</span>\n <span class=\"muted\" style=\"margin-left: 8px; font-size: 90%\">{{\n node.id\n }}</span>\n </div>\n }\n <mat-tab-group>\n <!-- N-outs -->\n @if (nOutFilter$ | async; as nOutFilter) {\n <mat-tab>\n <ng-template mat-tab-label>\n N<mat-icon>logout</mat-icon>\n </ng-template>\n <cadmus-walker-triple-filter\n [filter]=\"nOutFilter\"\n (filterChange)=\"onNOutFilterChange($event)\"\n ></cadmus-walker-triple-filter>\n </mat-tab>\n }\n <!-- N-ins -->\n @if (nInFilter$ | async; as nInFilter) {\n <mat-tab>\n <ng-template mat-tab-label> N<mat-icon>login</mat-icon> </ng-template>\n <cadmus-walker-triple-filter\n [filter]=\"nInFilter\"\n (filterChange)=\"onNInFilterChange($event)\"\n ></cadmus-walker-triple-filter>\n </mat-tab>\n }\n <!-- P-outs -->\n @if (pOutFilter$ | async; as pOutFilter) {\n <mat-tab>\n <ng-template mat-tab-label>\n P<mat-icon>logout</mat-icon>\n </ng-template>\n <cadmus-walker-linked-node-filter\n [filter]=\"pOutFilter\"\n (filterChange)=\"onPOutFilterChange($event)\"\n />\n </mat-tab>\n }\n <!-- P-ins -->\n @if (pInFilter$ | async; as pInFilter) {\n <mat-tab>\n <ng-template mat-tab-label> P<mat-icon>login</mat-icon> </ng-template>\n <cadmus-walker-linked-node-filter\n [filter]=\"pInFilter\"\n (filterChange)=\"onPInFilterChange($event)\"\n />\n </mat-tab>\n }\n <!-- P-lit -->\n @if (pLitFilter$ | async; as pLitFilter) {\n <mat-tab>\n <ng-template mat-tab-label>\n P<mat-icon>exit_to_app</mat-icon>\n </ng-template>\n <cadmus-walker-linked-literal-filter\n [filter]=\"pLitFilter\"\n (filterChange)=\"onPLitFilterChange($event)\"\n />\n </mat-tab>\n }\n </mat-tab-group>\n </div>\n </div>\n</div>\n", styles: ["div#filter-head{border:1px solid #f8f1ae;border-radius:4px;padding:4px;margin-bottom:4px;background-color:#f8f1ae;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.muted{color:silver}.selected{stroke-width:2px;stroke:#e7d211}#container{width:100%;max-width:100%;height:100%;max-height:100%;display:grid;grid-template-rows:1fr;grid-template-columns:auto 1fr;grid-template-areas:\"tools graph\";gap:8px}#graph{grid-area:graph}#tools{grid-area:tools;padding:8px;border:1px solid silver;height:100%;max-height:100%;min-width:324px;background-color:#fdfdfd}#tools #bar{display:flex;align-items:center;flex-wrap:wrap}@media only screen and (max-width: 959px){#container{grid-template-rows:auto 1fr;grid-template-columns:1fr;grid-template-areas:\"tools\" \"graph\"}}\n"], dependencies: [{ kind: "ngmodule", type: GraphModule }, { kind: "component", type: i3$1.GraphComponent, selector: "ngx-graph", inputs: ["nodes", "clusters", "compoundNodes", "links", "activeEntries", "curve", "draggingEnabled", "nodeHeight", "nodeMaxHeight", "nodeMinHeight", "nodeWidth", "nodeMinWidth", "nodeMaxWidth", "panningEnabled", "panningAxis", "enableZoom", "zoomSpeed", "minZoomLevel", "maxZoomLevel", "autoZoom", "panOnZoom", "animate", "autoCenter", "update$", "center$", "zoomToFit$", "panToNode$", "layout", "layoutSettings", "enableTrackpadSupport", "showMiniMap", "miniMapMaxWidth", "miniMapMaxHeight", "miniMapPosition", "view", "scheme", "customColors", "animations", "deferDisplayUntilPosition", "centerNodesOnPositionChange", "enablePreUpdateTransform", "groupResultsBy", "zoomLevel", "panOffsetX", "panOffsetY"], outputs: ["select", "activate", "deactivate", "zoomChange", "clickHandler", "stateChange"] }, { kind: "component", type: MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "directive", type: MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "component", type: MatTabGroup, selector: "mat-tab-group", inputs: ["color", "fitInkBarToContent", "mat-stretch-tabs", "mat-align-tabs", "dynamicHeight", "selectedIndex", "headerPosition", "animationDuration", "contentTabIndex", "disablePagination", "disableRipple", "preserveContent", "backgroundColor", "aria-label", "aria-labelledby"], outputs: ["selectedIndexChange", "focusChange", "animationDone", "selectedTabChange"], exportAs: ["matTabGroup"] }, { kind: "component", type: MatTab, selector: "mat-tab", inputs: ["disabled", "label", "aria-label", "aria-labelledby", "labelClass", "bodyClass"], exportAs: ["matTab"] }, { kind: "directive", type: MatTabLabel, selector: "[mat-tab-label], [matTabLabel]" }, { kind: "component", type: TripleFilterComponent, selector: "cadmus-walker-triple-filter", inputs: ["disabled", "hasPager", "total", "filter"], outputs: ["filterChange"] }, { kind: "component", type: LinkedNodeFilterComponent, selector: "cadmus-walker-linked-node-filter", inputs: ["disabled", "hasPager", "total", "filter"], outputs: ["filterChange"] }, { kind: "component", type: LinkedLiteralFilterComponent, selector: "cadmus-walker-linked-literal-filter", inputs: ["disabled", "hasPager", "total", "filter"], outputs: ["filterChange"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "pipe", type: GraphNodeLabelPipe, name: "graphNodeLabel" }] });
|
|
1389
1474
|
}
|
|
1390
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
1475
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: GraphWalkerComponent, decorators: [{
|
|
1391
1476
|
type: Component,
|
|
1392
|
-
args: [{ selector: 'cadmus-graph-walker',
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
}], moveToSource: [{
|
|
1402
|
-
type: Output
|
|
1403
|
-
}] } });
|
|
1404
|
-
|
|
1405
|
-
class CadmusGraphUiExModule {
|
|
1406
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: CadmusGraphUiExModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1407
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.5", ngImport: i0, type: CadmusGraphUiExModule, declarations: [GraphNodeLabelPipe,
|
|
1408
|
-
GraphWalkerComponent,
|
|
1409
|
-
LinkedLiteralFilterComponent,
|
|
1410
|
-
LinkedNodeFilterComponent,
|
|
1411
|
-
TripleFilterComponent], imports: [CommonModule,
|
|
1412
|
-
FormsModule,
|
|
1413
|
-
ReactiveFormsModule,
|
|
1414
|
-
// material
|
|
1415
|
-
MatAutocompleteModule,
|
|
1416
|
-
MatButtonModule,
|
|
1417
|
-
MatCheckboxModule,
|
|
1418
|
-
MatChipsModule,
|
|
1419
|
-
MatFormFieldModule,
|
|
1420
|
-
MatIconModule,
|
|
1421
|
-
MatInputModule,
|
|
1422
|
-
MatListModule,
|
|
1423
|
-
MatPaginatorModule,
|
|
1424
|
-
MatProgressBarModule,
|
|
1425
|
-
MatSelectModule,
|
|
1426
|
-
MatTabsModule,
|
|
1427
|
-
MatTooltipModule,
|
|
1428
|
-
// vendor
|
|
1429
|
-
NgxGraphModule,
|
|
1430
|
-
// Cadmus
|
|
1431
|
-
CadmusCoreModule,
|
|
1432
|
-
CadmusApiModule,
|
|
1433
|
-
// CadmusRefsLookupModule,
|
|
1434
|
-
RefLookupComponent,
|
|
1435
|
-
CadmusGraphUiModule], exports: [GraphNodeLabelPipe,
|
|
1436
|
-
GraphWalkerComponent,
|
|
1437
|
-
CadmusApiModule,
|
|
1438
|
-
LinkedLiteralFilterComponent,
|
|
1439
|
-
LinkedNodeFilterComponent,
|
|
1440
|
-
TripleFilterComponent] }); }
|
|
1441
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: CadmusGraphUiExModule, providers: [provideHttpClient(withInterceptorsFromDi())], imports: [CommonModule,
|
|
1442
|
-
FormsModule,
|
|
1443
|
-
ReactiveFormsModule,
|
|
1444
|
-
// material
|
|
1445
|
-
MatAutocompleteModule,
|
|
1446
|
-
MatButtonModule,
|
|
1447
|
-
MatCheckboxModule,
|
|
1448
|
-
MatChipsModule,
|
|
1449
|
-
MatFormFieldModule,
|
|
1450
|
-
MatIconModule,
|
|
1451
|
-
MatInputModule,
|
|
1452
|
-
MatListModule,
|
|
1453
|
-
MatPaginatorModule,
|
|
1454
|
-
MatProgressBarModule,
|
|
1455
|
-
MatSelectModule,
|
|
1456
|
-
MatTabsModule,
|
|
1457
|
-
MatTooltipModule,
|
|
1458
|
-
// vendor
|
|
1459
|
-
NgxGraphModule,
|
|
1460
|
-
// Cadmus
|
|
1461
|
-
CadmusCoreModule,
|
|
1462
|
-
CadmusApiModule,
|
|
1463
|
-
// CadmusRefsLookupModule,
|
|
1464
|
-
RefLookupComponent,
|
|
1465
|
-
CadmusGraphUiModule, CadmusApiModule] }); }
|
|
1466
|
-
}
|
|
1467
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: CadmusGraphUiExModule, decorators: [{
|
|
1468
|
-
type: NgModule,
|
|
1469
|
-
args: [{
|
|
1470
|
-
declarations: [
|
|
1471
|
-
GraphNodeLabelPipe,
|
|
1472
|
-
GraphWalkerComponent,
|
|
1473
|
-
LinkedLiteralFilterComponent,
|
|
1474
|
-
LinkedNodeFilterComponent,
|
|
1477
|
+
args: [{ selector: 'cadmus-graph-walker', imports: [
|
|
1478
|
+
GraphModule,
|
|
1479
|
+
MatIconButton,
|
|
1480
|
+
MatTooltip,
|
|
1481
|
+
MatIcon,
|
|
1482
|
+
MatProgressBar,
|
|
1483
|
+
MatTabGroup,
|
|
1484
|
+
MatTab,
|
|
1485
|
+
MatTabLabel,
|
|
1475
1486
|
TripleFilterComponent,
|
|
1476
|
-
],
|
|
1477
|
-
exports: [
|
|
1478
|
-
GraphNodeLabelPipe,
|
|
1479
|
-
GraphWalkerComponent,
|
|
1480
|
-
CadmusApiModule,
|
|
1481
|
-
LinkedLiteralFilterComponent,
|
|
1482
1487
|
LinkedNodeFilterComponent,
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
ReactiveFormsModule,
|
|
1489
|
-
// material
|
|
1490
|
-
MatAutocompleteModule,
|
|
1491
|
-
MatButtonModule,
|
|
1492
|
-
MatCheckboxModule,
|
|
1493
|
-
MatChipsModule,
|
|
1494
|
-
MatFormFieldModule,
|
|
1495
|
-
MatIconModule,
|
|
1496
|
-
MatInputModule,
|
|
1497
|
-
MatListModule,
|
|
1498
|
-
MatPaginatorModule,
|
|
1499
|
-
MatProgressBarModule,
|
|
1500
|
-
MatSelectModule,
|
|
1501
|
-
MatTabsModule,
|
|
1502
|
-
MatTooltipModule,
|
|
1503
|
-
// vendor
|
|
1504
|
-
NgxGraphModule,
|
|
1505
|
-
// Cadmus
|
|
1506
|
-
CadmusCoreModule,
|
|
1507
|
-
CadmusApiModule,
|
|
1508
|
-
// CadmusRefsLookupModule,
|
|
1509
|
-
RefLookupComponent,
|
|
1510
|
-
CadmusGraphUiModule,
|
|
1511
|
-
],
|
|
1512
|
-
providers: [provideHttpClient(withInterceptorsFromDi())],
|
|
1513
|
-
}]
|
|
1514
|
-
}] });
|
|
1488
|
+
LinkedLiteralFilterComponent,
|
|
1489
|
+
AsyncPipe,
|
|
1490
|
+
GraphNodeLabelPipe,
|
|
1491
|
+
], template: "<div id=\"container\">\n <!-- graph -->\n <div id=\"graph\">\n <ngx-graph\n class=\"chart-container\"\n [showMiniMap]=\"true\"\n [links]=\"(edges$ | async) || []\"\n [nodes]=\"(nodes$ | async) || []\"\n [update$]=\"update$\"\n [center$]=\"center$\"\n [zoomToFit$]=\"zoomToFit$\"\n layout=\"colaForceDirected\"\n (select)=\"onNodeSelect($event)\"\n >\n <ng-template #defsTemplate>\n <svg:marker\n id=\"arrow\"\n viewBox=\"0 -5 10 10\"\n refX=\"8\"\n refY=\"0\"\n markerWidth=\"4\"\n markerHeight=\"4\"\n orient=\"auto\"\n >\n <svg:path d=\"M0,-5L10,0L0,5\" class=\"arrow-head\" />\n </svg:marker>\n </ng-template>\n\n <!-- cluster template -->\n <ng-template #clusterTemplate let-cluster>\n <svg:g class=\"node cluster\">\n <svg:rect\n rx=\"5\"\n ry=\"5\"\n [attr.width]=\"cluster.dimension.width\"\n [attr.height]=\"cluster.dimension.height\"\n [attr.fill]=\"cluster.data.color\"\n />\n </svg:g>\n </ng-template>\n\n <!-- node template -->\n <ng-template #nodeTemplate let-node>\n <svg:g class=\"node\" (dblclick)=\"onNodeDblClick(node)\">\n <svg:rect\n [class.selected]=\"node.data?.selected\"\n [attr.width]=\"node.dimension.width\"\n [attr.height]=\"node.dimension.height\"\n [attr.fill]=\"node.data.customColor || node.data.color\"\n />\n <svg:text\n alignment-baseline=\"central\"\n [attr.x]=\"10\"\n [attr.y]=\"node.dimension.height / 2\"\n >\n {{ node.label }}\n </svg:text>\n </svg:g>\n </ng-template>\n\n <!-- link template -->\n <ng-template #linkTemplate let-link>\n <svg:g class=\"edge\">\n <svg:path\n class=\"line\"\n stroke-width=\"2\"\n marker-end=\"url(#arrow)\"\n ></svg:path>\n <svg:text class=\"edge-label\" text-anchor=\"middle\">\n <textPath\n class=\"text-path\"\n [attr.href]=\"'#' + link.id\"\n [style.dominant-baseline]=\"link.dominantBaseline\"\n startOffset=\"50%\"\n >\n {{ link.label }}\n </textPath>\n </svg:text>\n </svg:g>\n </ng-template>\n </ngx-graph>\n </div>\n\n <!-- tools -->\n <div id=\"tools\">\n <div id=\"bar\">\n <button\n type=\"button\"\n mat-icon-button\n matTooltip=\"Center\"\n (click)=\"center$.next(true)\"\n >\n <mat-icon>filter_center_focus</mat-icon>\n </button>\n <button\n type=\"button\"\n mat-icon-button\n matTooltip=\"Zoom to fit\"\n (click)=\"zoomToFit$.next({ force: true })\"\n >\n <mat-icon>fit_screen</mat-icon>\n </button>\n <button\n type=\"button\"\n mat-icon-button\n matTooltip=\"Reset\"\n (click)=\"update$.next(true)\"\n >\n <mat-icon class=\"mat-warn\">restart_alt</mat-icon>\n </button>\n @if (nodes$ | async; as nodes) {\n <span class=\"muted\"\n >N:{{ nodes.length }} E:{{ (edges$ | async)?.length }}</span\n >\n } @if (selectedNode$ | async; as selectedNode) {\n <button\n type=\"button\"\n mat-icon-button\n matTooltip=\"Toggle the selected node\"\n [disabled]=\"!selectedNode\"\n (click)=\"onNodeDblClick(selectedNode)\"\n >\n <mat-icon class=\"mat-primary\">unfold_more</mat-icon>\n </button>\n } @if (canPick()) {\n <button\n type=\"button\"\n mat-icon-button\n [matTooltip]=\"\n canMoveToSource()\n ? 'Pick selected node or (shift) its source'\n : 'Pick the selected node'\n \"\n [disabled]=\"!(selectedNode$ | async)\"\n (click)=\"pickSelectedNode($event)\"\n >\n <mat-icon class=\"mat-primary\">check_circle</mat-icon>\n </button>\n }\n </div>\n <!-- progress -->\n <div id=\"progress\">\n @if (loading$ | async) {\n <mat-progress-bar mode=\"indeterminate\"></mat-progress-bar>\n }\n </div>\n <div id=\"filters\">\n @if (selectedNode$ | async; as node) {\n <div id=\"filter-head\">\n <span [style.color]=\"node.data.color || 'black'\">⬤</span>\n <span style=\"margin-left: 6px\" matTooltip=\"{{ node.data.uri }}\">{{\n node | graphNodeLabel\n }}</span>\n <span class=\"muted\" style=\"margin-left: 8px; font-size: 90%\">{{\n node.id\n }}</span>\n </div>\n }\n <mat-tab-group>\n <!-- N-outs -->\n @if (nOutFilter$ | async; as nOutFilter) {\n <mat-tab>\n <ng-template mat-tab-label>\n N<mat-icon>logout</mat-icon>\n </ng-template>\n <cadmus-walker-triple-filter\n [filter]=\"nOutFilter\"\n (filterChange)=\"onNOutFilterChange($event)\"\n ></cadmus-walker-triple-filter>\n </mat-tab>\n }\n <!-- N-ins -->\n @if (nInFilter$ | async; as nInFilter) {\n <mat-tab>\n <ng-template mat-tab-label> N<mat-icon>login</mat-icon> </ng-template>\n <cadmus-walker-triple-filter\n [filter]=\"nInFilter\"\n (filterChange)=\"onNInFilterChange($event)\"\n ></cadmus-walker-triple-filter>\n </mat-tab>\n }\n <!-- P-outs -->\n @if (pOutFilter$ | async; as pOutFilter) {\n <mat-tab>\n <ng-template mat-tab-label>\n P<mat-icon>logout</mat-icon>\n </ng-template>\n <cadmus-walker-linked-node-filter\n [filter]=\"pOutFilter\"\n (filterChange)=\"onPOutFilterChange($event)\"\n />\n </mat-tab>\n }\n <!-- P-ins -->\n @if (pInFilter$ | async; as pInFilter) {\n <mat-tab>\n <ng-template mat-tab-label> P<mat-icon>login</mat-icon> </ng-template>\n <cadmus-walker-linked-node-filter\n [filter]=\"pInFilter\"\n (filterChange)=\"onPInFilterChange($event)\"\n />\n </mat-tab>\n }\n <!-- P-lit -->\n @if (pLitFilter$ | async; as pLitFilter) {\n <mat-tab>\n <ng-template mat-tab-label>\n P<mat-icon>exit_to_app</mat-icon>\n </ng-template>\n <cadmus-walker-linked-literal-filter\n [filter]=\"pLitFilter\"\n (filterChange)=\"onPLitFilterChange($event)\"\n />\n </mat-tab>\n }\n </mat-tab-group>\n </div>\n </div>\n</div>\n", styles: ["div#filter-head{border:1px solid #f8f1ae;border-radius:4px;padding:4px;margin-bottom:4px;background-color:#f8f1ae;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.muted{color:silver}.selected{stroke-width:2px;stroke:#e7d211}#container{width:100%;max-width:100%;height:100%;max-height:100%;display:grid;grid-template-rows:1fr;grid-template-columns:auto 1fr;grid-template-areas:\"tools graph\";gap:8px}#graph{grid-area:graph}#tools{grid-area:tools;padding:8px;border:1px solid silver;height:100%;max-height:100%;min-width:324px;background-color:#fdfdfd}#tools #bar{display:flex;align-items:center;flex-wrap:wrap}@media only screen and (max-width: 959px){#container{grid-template-rows:auto 1fr;grid-template-columns:1fr;grid-template-areas:\"tools\" \"graph\"}}\n"] }]
|
|
1492
|
+
}], ctorParameters: () => [{ type: i3.GraphService }, { type: i2$1.DialogService }] });
|
|
1515
1493
|
|
|
1516
1494
|
/*
|
|
1517
1495
|
* Public API Surface of cadmus-graph-ui-ex
|
|
@@ -1521,5 +1499,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
|
|
|
1521
1499
|
* Generated bundle index. Do not edit.
|
|
1522
1500
|
*/
|
|
1523
1501
|
|
|
1524
|
-
export {
|
|
1502
|
+
export { GraphNodeLabelPipe, GraphWalker, GraphWalkerComponent, LinkedLiteralFilterComponent, LinkedNodeFilterComponent, TripleFilterComponent };
|
|
1525
1503
|
//# sourceMappingURL=myrmidon-cadmus-graph-ui-ex.mjs.map
|