@myrmidon/cadmus-graph-ui-ex 0.0.1
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 +24 -0
- package/esm2020/lib/cadmus-graph-ui-ex.module.mjs +132 -0
- package/esm2020/lib/components/graph-walker/graph-walker.component.mjs +119 -0
- package/esm2020/lib/components/linked-literal-filter/linked-literal-filter.component.mjs +141 -0
- package/esm2020/lib/components/linked-node-filter/linked-node-filter.component.mjs +178 -0
- package/esm2020/lib/components/triple-filter/triple-filter.component.mjs +219 -0
- package/esm2020/lib/graph-walker.mjs +725 -0
- package/esm2020/lib/pipes/graph-node-label.pipe.mjs +29 -0
- package/esm2020/lib/services/graph-node-lookup.service.mjs +42 -0
- package/esm2020/lib/services/graph.service.mjs +343 -0
- package/esm2020/myrmidon-cadmus-graph-ui-ex.mjs +5 -0
- package/esm2020/public-api.mjs +13 -0
- package/fesm2015/myrmidon-cadmus-graph-ui-ex.mjs +1884 -0
- package/fesm2015/myrmidon-cadmus-graph-ui-ex.mjs.map +1 -0
- package/fesm2020/myrmidon-cadmus-graph-ui-ex.mjs +1876 -0
- package/fesm2020/myrmidon-cadmus-graph-ui-ex.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/cadmus-graph-ui-ex.module.d.ts +31 -0
- package/lib/components/graph-walker/graph-walker.component.d.ts +57 -0
- package/lib/components/linked-literal-filter/linked-literal-filter.component.d.ts +58 -0
- package/lib/components/linked-node-filter/linked-node-filter.component.d.ts +62 -0
- package/lib/components/triple-filter/triple-filter.component.d.ts +68 -0
- package/lib/graph-walker.d.ts +251 -0
- package/lib/pipes/graph-node-label.pipe.d.ts +13 -0
- package/lib/services/graph-node-lookup.service.d.ts +20 -0
- package/lib/services/graph.service.d.ts +200 -0
- package/package.json +43 -0
- package/public-api.d.ts +9 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { EventEmitter, OnInit } from '@angular/core';
|
|
2
|
+
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
|
3
|
+
import { PageEvent } from '@angular/material/paginator';
|
|
4
|
+
import { GraphNodeLookupService } from '../../services/graph-node-lookup.service';
|
|
5
|
+
import { GraphService, LinkedNodeFilter, UriNode, NodeSourceType } from '../../services/graph.service';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
/**
|
|
8
|
+
* Linked non-literal node filter.
|
|
9
|
+
*/
|
|
10
|
+
export declare class LinkedNodeFilterComponent implements OnInit {
|
|
11
|
+
lookupService: GraphNodeLookupService;
|
|
12
|
+
private _graphService;
|
|
13
|
+
private _filter;
|
|
14
|
+
/**
|
|
15
|
+
* True if this component is disabled.
|
|
16
|
+
*/
|
|
17
|
+
disabled: boolean | undefined | null;
|
|
18
|
+
/**
|
|
19
|
+
* True if this component should show a pager.
|
|
20
|
+
*/
|
|
21
|
+
hasPager: boolean | undefined | null;
|
|
22
|
+
/**
|
|
23
|
+
* The total number of nodes returned from the last
|
|
24
|
+
* page fetch operation. Used when hasPager is true.
|
|
25
|
+
*/
|
|
26
|
+
total: number;
|
|
27
|
+
/**
|
|
28
|
+
* The filter.
|
|
29
|
+
*/
|
|
30
|
+
get filter(): LinkedNodeFilter;
|
|
31
|
+
set filter(value: LinkedNodeFilter);
|
|
32
|
+
/**
|
|
33
|
+
* Emitted when filter changes.
|
|
34
|
+
*/
|
|
35
|
+
filterChange: EventEmitter<LinkedNodeFilter>;
|
|
36
|
+
otherNodeId: number;
|
|
37
|
+
predicateId: number;
|
|
38
|
+
isObject: boolean;
|
|
39
|
+
pageNumber: FormControl<number>;
|
|
40
|
+
pageSize: FormControl<number>;
|
|
41
|
+
uid: FormControl<string | null>;
|
|
42
|
+
isClass: FormControl<boolean | null>;
|
|
43
|
+
tag: FormControl<string | null>;
|
|
44
|
+
label: FormControl<string | null>;
|
|
45
|
+
sourceType: FormControl<NodeSourceType | null>;
|
|
46
|
+
sid: FormControl<string | null>;
|
|
47
|
+
isSidPrefix: FormControl<boolean>;
|
|
48
|
+
classes: FormControl<UriNode[]>;
|
|
49
|
+
form: FormGroup;
|
|
50
|
+
constructor(formBuilder: FormBuilder, lookupService: GraphNodeLookupService, _graphService: GraphService);
|
|
51
|
+
ngOnInit(): void;
|
|
52
|
+
private updateForm;
|
|
53
|
+
private getFilter;
|
|
54
|
+
private emitFilterChange;
|
|
55
|
+
onPageChange(page: PageEvent): void;
|
|
56
|
+
onClassAdd(node: UriNode | null): void;
|
|
57
|
+
onClassRemove(node: UriNode): void;
|
|
58
|
+
reset(): void;
|
|
59
|
+
apply(): void;
|
|
60
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LinkedNodeFilterComponent, never>;
|
|
61
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<LinkedNodeFilterComponent, "cadmus-linked-node-filter", never, { "disabled": "disabled"; "hasPager": "hasPager"; "total": "total"; "filter": "filter"; }, { "filterChange": "filterChange"; }, never, never, false, never>;
|
|
62
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { EventEmitter, OnInit } from '@angular/core';
|
|
2
|
+
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
|
3
|
+
import { PageEvent } from '@angular/material/paginator';
|
|
4
|
+
import { GraphNodeLookupService } from '../../services/graph-node-lookup.service';
|
|
5
|
+
import { GraphService, TripleFilter, UriNode } from '../../services/graph.service';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
/**
|
|
8
|
+
* Triples filter.
|
|
9
|
+
*/
|
|
10
|
+
export declare class TripleFilterComponent implements OnInit {
|
|
11
|
+
lookupService: GraphNodeLookupService;
|
|
12
|
+
private _graphService;
|
|
13
|
+
private _filter;
|
|
14
|
+
/**
|
|
15
|
+
* True if this component is disabled.
|
|
16
|
+
*/
|
|
17
|
+
disabled: boolean | undefined | null;
|
|
18
|
+
/**
|
|
19
|
+
* True if this component should show a pager.
|
|
20
|
+
*/
|
|
21
|
+
hasPager: boolean | undefined | null;
|
|
22
|
+
/**
|
|
23
|
+
* The total number of triples returned from the last
|
|
24
|
+
* page fetch operation. Used when hasPager is true.
|
|
25
|
+
*/
|
|
26
|
+
total: number;
|
|
27
|
+
/**
|
|
28
|
+
* The filter.
|
|
29
|
+
*/
|
|
30
|
+
get filter(): TripleFilter;
|
|
31
|
+
set filter(value: TripleFilter);
|
|
32
|
+
/**
|
|
33
|
+
* Emitted when filter changes.
|
|
34
|
+
*/
|
|
35
|
+
filterChange: EventEmitter<TripleFilter>;
|
|
36
|
+
pageNumber: FormControl<number>;
|
|
37
|
+
pageSize: FormControl<number>;
|
|
38
|
+
litPattern: FormControl<string | null>;
|
|
39
|
+
litType: FormControl<string | null>;
|
|
40
|
+
litLanguage: FormControl<string | null>;
|
|
41
|
+
minLitNumber: FormControl<number | null>;
|
|
42
|
+
maxLitNumber: FormControl<number | null>;
|
|
43
|
+
subj: FormControl<UriNode | null>;
|
|
44
|
+
isNotPred: FormControl<boolean>;
|
|
45
|
+
preds: FormControl<UriNode[]>;
|
|
46
|
+
notPreds: FormControl<UriNode[]>;
|
|
47
|
+
hasLiteralObj: FormControl<boolean | null>;
|
|
48
|
+
obj: FormControl<UriNode | null>;
|
|
49
|
+
sid: FormControl<string | null>;
|
|
50
|
+
isSidPrefix: FormControl<boolean>;
|
|
51
|
+
tag: FormControl<string | null>;
|
|
52
|
+
form: FormGroup;
|
|
53
|
+
constructor(formBuilder: FormBuilder, lookupService: GraphNodeLookupService, _graphService: GraphService);
|
|
54
|
+
ngOnInit(): void;
|
|
55
|
+
private updateForm;
|
|
56
|
+
private getFilter;
|
|
57
|
+
private emitFilterChange;
|
|
58
|
+
onPageChange(page: PageEvent): void;
|
|
59
|
+
onSubjectNodeChange(node: UriNode | null): void;
|
|
60
|
+
onObjectNodeChange(node: UriNode | null): void;
|
|
61
|
+
onPredicateNodeChange(node: UriNode | null): void;
|
|
62
|
+
deleteNotPred(node: UriNode): void;
|
|
63
|
+
deletePred(node: UriNode): void;
|
|
64
|
+
reset(): void;
|
|
65
|
+
apply(): void;
|
|
66
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TripleFilterComponent, never>;
|
|
67
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<TripleFilterComponent, "cadmus-triple-filter", never, { "disabled": "disabled"; "hasPager": "hasPager"; "total": "total"; "filter": "filter"; }, { "filterChange": "filterChange"; }, never, never, false, never>;
|
|
68
|
+
}
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { Edge, Node as GraphNode } from '@swimlane/ngx-graph';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { GraphService, LinkedLiteralFilter, LinkedNodeFilter, NodeSourceType, TripleFilter } from './services/graph.service';
|
|
4
|
+
/**
|
|
5
|
+
* Essential graph walker data.
|
|
6
|
+
*/
|
|
7
|
+
export interface WalkerData {
|
|
8
|
+
originId: string;
|
|
9
|
+
customColor?: string;
|
|
10
|
+
hidden?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Graph walker widget data, i.e. a node or a property group.
|
|
14
|
+
*/
|
|
15
|
+
export interface WalkerWidgetData extends WalkerData {
|
|
16
|
+
selected?: boolean;
|
|
17
|
+
expanded?: boolean;
|
|
18
|
+
error?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Graph walker node data.
|
|
22
|
+
* ID: "N" + nodeid (e.g. "N3").
|
|
23
|
+
*/
|
|
24
|
+
export interface WalkerNodeData extends WalkerWidgetData {
|
|
25
|
+
uri: string;
|
|
26
|
+
sourceType: NodeSourceType;
|
|
27
|
+
isClass?: boolean;
|
|
28
|
+
sid?: string;
|
|
29
|
+
tag?: string;
|
|
30
|
+
outFilter: TripleFilter;
|
|
31
|
+
inFilter: TripleFilter;
|
|
32
|
+
outTotal?: number;
|
|
33
|
+
inTotal?: number;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Graph walker property group data.
|
|
37
|
+
* ID: "P" + propertyid + "N" + source nodeid ("P2N3").
|
|
38
|
+
*/
|
|
39
|
+
export interface WalkerPropData extends WalkerWidgetData {
|
|
40
|
+
uri: string;
|
|
41
|
+
outFilter: LinkedNodeFilter;
|
|
42
|
+
inFilter: LinkedNodeFilter;
|
|
43
|
+
litFilter: LinkedLiteralFilter;
|
|
44
|
+
outTotal?: number;
|
|
45
|
+
inTotal?: number;
|
|
46
|
+
litTotal?: number;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Graph walker literal node data.
|
|
50
|
+
* ID: "L" + tripleid (e.g. "L5").
|
|
51
|
+
*/
|
|
52
|
+
export interface WalkerLitData extends WalkerWidgetData {
|
|
53
|
+
value: string;
|
|
54
|
+
type?: string;
|
|
55
|
+
language?: string;
|
|
56
|
+
number?: number;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The total counts of items fetched by each children graph nodes filter.
|
|
60
|
+
*/
|
|
61
|
+
export interface NodeChildTotals {
|
|
62
|
+
pOut: number;
|
|
63
|
+
pIn: number;
|
|
64
|
+
pLit: number;
|
|
65
|
+
nOut: number;
|
|
66
|
+
nIn: number;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Graph walker.
|
|
70
|
+
* This class encapsulates data used for interactively exploring a graph
|
|
71
|
+
* starting from a designated origin node.
|
|
72
|
+
*/
|
|
73
|
+
export declare class GraphWalker {
|
|
74
|
+
private _graphService;
|
|
75
|
+
private readonly _nodes$;
|
|
76
|
+
private readonly _edges$;
|
|
77
|
+
private readonly _loading$;
|
|
78
|
+
private readonly _error$;
|
|
79
|
+
private _rootNode?;
|
|
80
|
+
private readonly _selectedNode$;
|
|
81
|
+
private readonly _pOutFilter$;
|
|
82
|
+
private readonly _pInFilter$;
|
|
83
|
+
private readonly _pLitFilter$;
|
|
84
|
+
private readonly _nOutFilter$;
|
|
85
|
+
private readonly _nInFilter$;
|
|
86
|
+
private readonly _childTotals$;
|
|
87
|
+
/**
|
|
88
|
+
* The page size. Default is 10.
|
|
89
|
+
*/
|
|
90
|
+
pageSize: number;
|
|
91
|
+
/**
|
|
92
|
+
* Max length of literal value to show. Default is 30.
|
|
93
|
+
*/
|
|
94
|
+
maxLiteralLen: number;
|
|
95
|
+
/**
|
|
96
|
+
* The nodes of the walker graph, which can represent nodes, literals,
|
|
97
|
+
* or property groups. You can easily determine the type of each node
|
|
98
|
+
* by looking at the first character of its id (N=node, L=literal,
|
|
99
|
+
* P=property).
|
|
100
|
+
*/
|
|
101
|
+
get nodes$(): Observable<GraphNode[]>;
|
|
102
|
+
/**
|
|
103
|
+
* The edges connecting nodes.
|
|
104
|
+
*/
|
|
105
|
+
get edges$(): Observable<Edge[]>;
|
|
106
|
+
/**
|
|
107
|
+
* True if the walker is loading data.
|
|
108
|
+
*/
|
|
109
|
+
get loading$(): Observable<boolean>;
|
|
110
|
+
/**
|
|
111
|
+
* The last error occurred in communicating with the server, if any.
|
|
112
|
+
*/
|
|
113
|
+
get error$(): Observable<string | null>;
|
|
114
|
+
/**
|
|
115
|
+
* The selected node. Only one node at a time can be selected.
|
|
116
|
+
*/
|
|
117
|
+
get selectedNode$(): Observable<GraphNode | null>;
|
|
118
|
+
/**
|
|
119
|
+
* The outbound linked nodes filter for the selected P node.
|
|
120
|
+
*/
|
|
121
|
+
get pOutFilter$(): Observable<LinkedNodeFilter | null>;
|
|
122
|
+
/**
|
|
123
|
+
* The inbound linked nodes filter for the selected P node.
|
|
124
|
+
*/
|
|
125
|
+
get pInFilter$(): Observable<LinkedNodeFilter | null>;
|
|
126
|
+
/**
|
|
127
|
+
* The literal linked nodes filter for the selected P node.
|
|
128
|
+
*/
|
|
129
|
+
get pLitFilter$(): Observable<LinkedLiteralFilter | null>;
|
|
130
|
+
/**
|
|
131
|
+
* The outbound triples filter for the selected N node.
|
|
132
|
+
*/
|
|
133
|
+
get nOutFilter$(): Observable<TripleFilter | null>;
|
|
134
|
+
/**
|
|
135
|
+
* The inbound triples filter for the selected N node.
|
|
136
|
+
*/
|
|
137
|
+
get nInFilter$(): Observable<TripleFilter | null>;
|
|
138
|
+
/**
|
|
139
|
+
* The total items fetched for each filter of the selected node.
|
|
140
|
+
*/
|
|
141
|
+
get childTotals$(): Observable<NodeChildTotals>;
|
|
142
|
+
constructor(_graphService: GraphService);
|
|
143
|
+
getSelectedNode(): GraphNode | null;
|
|
144
|
+
private toggleLoading;
|
|
145
|
+
private setError;
|
|
146
|
+
private buildNodeId;
|
|
147
|
+
/**
|
|
148
|
+
* Get the numeric ID of the data node being the source of the graph node
|
|
149
|
+
* with the specified ID.
|
|
150
|
+
*
|
|
151
|
+
* @param id The graph node ID (...N + its data node numeric ID)
|
|
152
|
+
* @returns The data node numeric ID.
|
|
153
|
+
*/
|
|
154
|
+
private getNodeNumericId;
|
|
155
|
+
private getPredicateNumericId;
|
|
156
|
+
private buildEdgeId;
|
|
157
|
+
private buildPropertyId;
|
|
158
|
+
private buildLiteralId;
|
|
159
|
+
private scale;
|
|
160
|
+
private addEdgeIfAbsent;
|
|
161
|
+
private resetFilters;
|
|
162
|
+
/**
|
|
163
|
+
* Select the specified node. This also implies updating all the current
|
|
164
|
+
* filters, which depend on the selected node.
|
|
165
|
+
*
|
|
166
|
+
* @param id The node ID or null to deselect the selected node.
|
|
167
|
+
*/
|
|
168
|
+
selectNode(id: string | null): void;
|
|
169
|
+
/**
|
|
170
|
+
* Reset the graph setting its origin to the specified node.
|
|
171
|
+
*
|
|
172
|
+
* @param id The ID of the origin node to start from ("root origin").
|
|
173
|
+
*/
|
|
174
|
+
reset(id: number): void;
|
|
175
|
+
/**
|
|
176
|
+
* Get the source and target graph nodes IDs from the specified edge ID.
|
|
177
|
+
*
|
|
178
|
+
* @param edgeId The ID of the edge graph node.
|
|
179
|
+
* @returns IDs of the source and target graph nodes.
|
|
180
|
+
*/
|
|
181
|
+
private getEdgeEndIds;
|
|
182
|
+
/**
|
|
183
|
+
* Remove all the nodes with the specified origin node ID.
|
|
184
|
+
*
|
|
185
|
+
* @param originId The ID of the origin graph node.
|
|
186
|
+
* @param nodes The nodes array to remove nodes from.
|
|
187
|
+
* @param removedIds The IDs of all the removed nodes.
|
|
188
|
+
*/
|
|
189
|
+
private removeDescendantNodes;
|
|
190
|
+
/**
|
|
191
|
+
* Remove all the children graph nodes of the specified origin graph node.
|
|
192
|
+
*
|
|
193
|
+
* @param originId The ID of the origin graph node.
|
|
194
|
+
* @param nodes The nodes array to remove nodes from.
|
|
195
|
+
* @param edges The edges array to remove edges from.
|
|
196
|
+
*/
|
|
197
|
+
private removeChildren;
|
|
198
|
+
/**
|
|
199
|
+
* Build a new graph node representing a property.
|
|
200
|
+
*
|
|
201
|
+
* @param sourceId The source node ID.
|
|
202
|
+
* @param group The triple group emitting this node.
|
|
203
|
+
* @returns A new graph node.
|
|
204
|
+
*/
|
|
205
|
+
private buildPropertyNode;
|
|
206
|
+
/**
|
|
207
|
+
* Expand the specified node, by loading its property groups.
|
|
208
|
+
*
|
|
209
|
+
* @param node The node to expand.
|
|
210
|
+
* @param outFilter The properties to update for the output filter.
|
|
211
|
+
* @param inFilter The properties to update for the input filter.
|
|
212
|
+
*/
|
|
213
|
+
expandNode(node: GraphNode, outFilter?: Partial<TripleFilter> | null, inFilter?: Partial<TripleFilter> | null): void;
|
|
214
|
+
/**
|
|
215
|
+
* Expand the selected node, by loading its property groups.
|
|
216
|
+
*
|
|
217
|
+
* @param outFilter The properties to update for the output filter.
|
|
218
|
+
* @param inFilter The properties to update for the input filter.
|
|
219
|
+
*/
|
|
220
|
+
expandSelectedNode(outFilter?: Partial<TripleFilter> | null, inFilter?: Partial<TripleFilter> | null): void;
|
|
221
|
+
private buildLiteralLabel;
|
|
222
|
+
private buildNonLiteralNode;
|
|
223
|
+
private buildLiteralNode;
|
|
224
|
+
/**
|
|
225
|
+
* Expand the currently selected properties group node, by loading its
|
|
226
|
+
* outbound nodes, inbound nodes, and literal nodes.
|
|
227
|
+
*
|
|
228
|
+
* @param node The property group node to expand.
|
|
229
|
+
* @param outFilter The properties to update for the outbound nodes filter.
|
|
230
|
+
* @param inFilter The properties to update for the inbound nodes filter.
|
|
231
|
+
* @param litFilter The properties to update for the literal nodes filter.
|
|
232
|
+
*/
|
|
233
|
+
expandProperty(node: GraphNode, outFilter?: Partial<LinkedNodeFilter> | null, inFilter?: Partial<LinkedNodeFilter> | null, litFilter?: Partial<LinkedLiteralFilter> | null): void;
|
|
234
|
+
/**
|
|
235
|
+
* Expand the currently selected properties group node, by loading its
|
|
236
|
+
* outbound nodes, inbound nodes, and literal nodes. If there is no
|
|
237
|
+
* selection, or the selected node is not a properties group node, nothing
|
|
238
|
+
* is done.
|
|
239
|
+
*
|
|
240
|
+
* @param outFilter The properties to update for the outbound nodes filter.
|
|
241
|
+
* @param inFilter The properties to update for the inbound nodes filter.
|
|
242
|
+
* @param litFilter The properties to update for the literal nodes filter.
|
|
243
|
+
*/
|
|
244
|
+
expandSelectedProperty(outFilter?: Partial<LinkedNodeFilter> | null, inFilter?: Partial<LinkedNodeFilter> | null, litFilter?: Partial<LinkedLiteralFilter> | null): void;
|
|
245
|
+
/**
|
|
246
|
+
* Toggle the specified node by expanding or collapsing it.
|
|
247
|
+
*
|
|
248
|
+
* @param node The node to toggle.
|
|
249
|
+
*/
|
|
250
|
+
toggleNode(node: GraphNode): void;
|
|
251
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PipeTransform } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
/**
|
|
4
|
+
* Get the extended label for the specified graph node. This returns the label
|
|
5
|
+
* for N nodes, and the uri + "=" + the label for P nodes. That's because P
|
|
6
|
+
* nodes label is just the count of the triples group, so the predicate ID is
|
|
7
|
+
* got from the property node's data uri.
|
|
8
|
+
*/
|
|
9
|
+
export declare class GraphNodeLabelPipe implements PipeTransform {
|
|
10
|
+
transform(value: unknown, ...args: unknown[]): unknown;
|
|
11
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<GraphNodeLabelPipe, never>;
|
|
12
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<GraphNodeLabelPipe, "graphNodeLabel", false>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { RefLookupService } from '@myrmidon/cadmus-refs-lookup';
|
|
2
|
+
import { RefLookupFilter } from '@myrmidon/cadmus-refs-lookup/public-api';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
import { GraphService } from './graph.service';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
export interface GraphNodeLookupFilter extends RefLookupFilter {
|
|
7
|
+
isClass?: boolean | null;
|
|
8
|
+
tag?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Graph node lookup service.
|
|
12
|
+
*/
|
|
13
|
+
export declare class GraphNodeLookupService implements RefLookupService {
|
|
14
|
+
private _graphService;
|
|
15
|
+
constructor(_graphService: GraphService);
|
|
16
|
+
lookup(filter: GraphNodeLookupFilter, options?: any): Observable<any[]>;
|
|
17
|
+
getName(item: any): string;
|
|
18
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<GraphNodeLookupService, never>;
|
|
19
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<GraphNodeLookupService>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { HttpClient } from '@angular/common/http';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { DataPage, EnvService, ErrorService } from '@myrmidon/ng-tools';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare enum NodeSourceType {
|
|
6
|
+
User = 0,
|
|
7
|
+
Item = 1,
|
|
8
|
+
Part = 2,
|
|
9
|
+
Thesaurus = 3,
|
|
10
|
+
Implicit = 4
|
|
11
|
+
}
|
|
12
|
+
export interface Node {
|
|
13
|
+
id: number;
|
|
14
|
+
isClass?: boolean;
|
|
15
|
+
label: string;
|
|
16
|
+
sourceType: NodeSourceType;
|
|
17
|
+
tag?: string;
|
|
18
|
+
sid?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface UriNode extends Node {
|
|
21
|
+
uri: string;
|
|
22
|
+
}
|
|
23
|
+
interface NodeFilterBase {
|
|
24
|
+
pageNumber: number;
|
|
25
|
+
pageSize: number;
|
|
26
|
+
uid?: string;
|
|
27
|
+
isClass?: boolean;
|
|
28
|
+
tag?: string;
|
|
29
|
+
label?: string;
|
|
30
|
+
sourceType?: NodeSourceType;
|
|
31
|
+
sid?: string;
|
|
32
|
+
isSidPrefix?: boolean;
|
|
33
|
+
classIds?: number[];
|
|
34
|
+
}
|
|
35
|
+
export interface NodeFilter extends NodeFilterBase {
|
|
36
|
+
linkedNodeId?: number;
|
|
37
|
+
linkedNodeRole?: 'S' | 'O';
|
|
38
|
+
}
|
|
39
|
+
export interface Triple {
|
|
40
|
+
id: number;
|
|
41
|
+
subjectId: number;
|
|
42
|
+
predicateId: number;
|
|
43
|
+
objectId?: number;
|
|
44
|
+
objectLiteral?: string;
|
|
45
|
+
objectLiteralIx?: string;
|
|
46
|
+
literalType?: string;
|
|
47
|
+
literalLanguage?: string;
|
|
48
|
+
literalNumber?: number;
|
|
49
|
+
sid?: string;
|
|
50
|
+
tag?: string;
|
|
51
|
+
}
|
|
52
|
+
export interface UriTriple extends Triple {
|
|
53
|
+
subjectUri: string;
|
|
54
|
+
predicateUri: string;
|
|
55
|
+
objectUri?: string;
|
|
56
|
+
}
|
|
57
|
+
export interface TripleGroup {
|
|
58
|
+
predicateId: number;
|
|
59
|
+
predicateUri: string;
|
|
60
|
+
count: number;
|
|
61
|
+
}
|
|
62
|
+
export interface LiteralFilter {
|
|
63
|
+
pageNumber: number;
|
|
64
|
+
pageSize: number;
|
|
65
|
+
literalPattern?: string;
|
|
66
|
+
literalType?: string;
|
|
67
|
+
literalLanguage?: string;
|
|
68
|
+
minLiteralNumber?: number;
|
|
69
|
+
maxLiteralNumber?: number;
|
|
70
|
+
}
|
|
71
|
+
export interface TripleFilter extends LiteralFilter {
|
|
72
|
+
subjectId?: number;
|
|
73
|
+
predicateIds?: number[];
|
|
74
|
+
notPredicateIds?: number[];
|
|
75
|
+
hasLiteralObject?: boolean;
|
|
76
|
+
objectId?: number;
|
|
77
|
+
sid?: string;
|
|
78
|
+
isSidPrefix?: boolean;
|
|
79
|
+
tag?: string;
|
|
80
|
+
}
|
|
81
|
+
export interface LinkedNodeFilter extends NodeFilterBase {
|
|
82
|
+
/**
|
|
83
|
+
* The other node identifier, which is the subject node
|
|
84
|
+
* ID when isObject is true, otherwise the object node ID.
|
|
85
|
+
*/
|
|
86
|
+
otherNodeId: number;
|
|
87
|
+
predicateId: number;
|
|
88
|
+
/**
|
|
89
|
+
* Whether the node to match is the object (true) or
|
|
90
|
+
* the subject (false) of the triple having predicate
|
|
91
|
+
* predicateId.
|
|
92
|
+
*/
|
|
93
|
+
isObject?: boolean;
|
|
94
|
+
}
|
|
95
|
+
export interface LinkedLiteralFilter extends LiteralFilter {
|
|
96
|
+
subjectId?: number;
|
|
97
|
+
predicateId?: number;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Cadmus semantic graph service.
|
|
101
|
+
*/
|
|
102
|
+
export declare class GraphService {
|
|
103
|
+
private _http;
|
|
104
|
+
private _error;
|
|
105
|
+
private _env;
|
|
106
|
+
constructor(_http: HttpClient, _error: ErrorService, _env: EnvService);
|
|
107
|
+
/**
|
|
108
|
+
* Get the specified page of graph nodes.
|
|
109
|
+
*
|
|
110
|
+
* @param filter The nodes filter.
|
|
111
|
+
* @returns A page of nodes.
|
|
112
|
+
*/
|
|
113
|
+
getNodes(filter: NodeFilter): Observable<DataPage<UriNode>>;
|
|
114
|
+
/**
|
|
115
|
+
* Get the specified set of nodes.
|
|
116
|
+
*
|
|
117
|
+
* @param ids The nodes IDs.
|
|
118
|
+
* @returns List of nodes/nulls.
|
|
119
|
+
*/
|
|
120
|
+
getNodeSet(ids: number[]): Observable<(UriNode | null)[]>;
|
|
121
|
+
/**
|
|
122
|
+
* Get the node with the specified ID.
|
|
123
|
+
*
|
|
124
|
+
* @param id The node's ID.
|
|
125
|
+
* @returns The node.
|
|
126
|
+
*/
|
|
127
|
+
getNode(id: number): Observable<UriNode>;
|
|
128
|
+
/**
|
|
129
|
+
* Get the node with the specified URI.
|
|
130
|
+
*
|
|
131
|
+
* @param uri The node's URI.
|
|
132
|
+
* @returns The node.
|
|
133
|
+
*/
|
|
134
|
+
getNodeByUri(uri: string): Observable<UriNode>;
|
|
135
|
+
/**
|
|
136
|
+
* Add or update the specified node. A new node has id=0 and uri set;
|
|
137
|
+
* an existing node has its id.
|
|
138
|
+
*
|
|
139
|
+
* @param node The node to add.
|
|
140
|
+
* @returns The added node.
|
|
141
|
+
*/
|
|
142
|
+
addNode(node: UriNode): Observable<UriNode>;
|
|
143
|
+
/**
|
|
144
|
+
* Delete the node with the specified ID.
|
|
145
|
+
*
|
|
146
|
+
* @param id The node's ID.
|
|
147
|
+
*/
|
|
148
|
+
deleteNode(id: number): Observable<any>;
|
|
149
|
+
private applyTripleFilter;
|
|
150
|
+
/**
|
|
151
|
+
* Get the specified page of triples.
|
|
152
|
+
*
|
|
153
|
+
* @param filter The filter.
|
|
154
|
+
* @returns The page.
|
|
155
|
+
*/
|
|
156
|
+
getTriples(filter: TripleFilter): Observable<DataPage<UriTriple>>;
|
|
157
|
+
/**
|
|
158
|
+
* Get the triple with the specified ID.
|
|
159
|
+
*
|
|
160
|
+
* @param id The triple's ID.
|
|
161
|
+
* @returns The triple.
|
|
162
|
+
*/
|
|
163
|
+
getTriple(id: number): Observable<UriTriple>;
|
|
164
|
+
/**
|
|
165
|
+
* Add or update the specified triple.
|
|
166
|
+
*
|
|
167
|
+
* @param triple The triple to add.
|
|
168
|
+
* @returns The added triple.
|
|
169
|
+
*/
|
|
170
|
+
addTriple(triple: Triple): Observable<Triple>;
|
|
171
|
+
/**
|
|
172
|
+
* Delete the triple with the specified ID.
|
|
173
|
+
*
|
|
174
|
+
* @param id The triple's ID.
|
|
175
|
+
*/
|
|
176
|
+
deleteTriple(id: number): Observable<any>;
|
|
177
|
+
private applyLiteralFilter;
|
|
178
|
+
/**
|
|
179
|
+
* Get the specified page of triples grouped by their property.
|
|
180
|
+
*
|
|
181
|
+
* @param filter The filter.
|
|
182
|
+
* @returns The page of triples.
|
|
183
|
+
*/
|
|
184
|
+
getTripleGroups(filter: TripleFilter): Observable<DataPage<TripleGroup>>;
|
|
185
|
+
/**
|
|
186
|
+
* Get linked nodes.
|
|
187
|
+
* @param filter The filter.
|
|
188
|
+
* @returns Observable with data page.
|
|
189
|
+
*/
|
|
190
|
+
getLinkedNodes(filter: LinkedNodeFilter): Observable<DataPage<UriNode>>;
|
|
191
|
+
/**
|
|
192
|
+
* Get linked literals.
|
|
193
|
+
* @param filter The filter.
|
|
194
|
+
* @returns Observable with data page.
|
|
195
|
+
*/
|
|
196
|
+
getLinkedLiterals(filter: LinkedLiteralFilter): Observable<DataPage<UriTriple>>;
|
|
197
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<GraphService, never>;
|
|
198
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<GraphService>;
|
|
199
|
+
}
|
|
200
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@myrmidon/cadmus-graph-ui-ex",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Cadmus - extensions to semantic graph components.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"Cadmus"
|
|
7
|
+
],
|
|
8
|
+
"homepage": "https://github.com/vedph/cadmus-graph-shell",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/vedph/cadmus-graph-shell"
|
|
12
|
+
},
|
|
13
|
+
"author": {
|
|
14
|
+
"name": "Daniele Fusi"
|
|
15
|
+
},
|
|
16
|
+
"peerDependencies": {
|
|
17
|
+
"@angular/common": "^15.0.0",
|
|
18
|
+
"@angular/core": "^15.0.0"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"tslib": "^2.3.0"
|
|
22
|
+
},
|
|
23
|
+
"sideEffects": false,
|
|
24
|
+
"module": "fesm2015/myrmidon-cadmus-graph-ui-ex.mjs",
|
|
25
|
+
"es2020": "fesm2020/myrmidon-cadmus-graph-ui-ex.mjs",
|
|
26
|
+
"esm2020": "esm2020/myrmidon-cadmus-graph-ui-ex.mjs",
|
|
27
|
+
"fesm2020": "fesm2020/myrmidon-cadmus-graph-ui-ex.mjs",
|
|
28
|
+
"fesm2015": "fesm2015/myrmidon-cadmus-graph-ui-ex.mjs",
|
|
29
|
+
"typings": "index.d.ts",
|
|
30
|
+
"exports": {
|
|
31
|
+
"./package.json": {
|
|
32
|
+
"default": "./package.json"
|
|
33
|
+
},
|
|
34
|
+
".": {
|
|
35
|
+
"types": "./index.d.ts",
|
|
36
|
+
"esm2020": "./esm2020/myrmidon-cadmus-graph-ui-ex.mjs",
|
|
37
|
+
"es2020": "./fesm2020/myrmidon-cadmus-graph-ui-ex.mjs",
|
|
38
|
+
"es2015": "./fesm2015/myrmidon-cadmus-graph-ui-ex.mjs",
|
|
39
|
+
"node": "./fesm2015/myrmidon-cadmus-graph-ui-ex.mjs",
|
|
40
|
+
"default": "./fesm2020/myrmidon-cadmus-graph-ui-ex.mjs"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
package/public-api.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './lib/components/graph-walker/graph-walker.component';
|
|
2
|
+
export * from './lib/components/linked-literal-filter/linked-literal-filter.component';
|
|
3
|
+
export * from './lib/components/linked-node-filter/linked-node-filter.component';
|
|
4
|
+
export * from './lib/components/triple-filter/triple-filter.component';
|
|
5
|
+
export * from './lib/pipes/graph-node-label.pipe';
|
|
6
|
+
export * from './lib/services/graph-node-lookup.service';
|
|
7
|
+
export * from './lib/services/graph.service';
|
|
8
|
+
export * from './lib/graph-walker';
|
|
9
|
+
export * from './lib/cadmus-graph-ui-ex.module';
|