@faubulous/mentor-rdf 0.2.49 → 0.2.50
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/out/index.d.ts +0 -0
- package/out/index.js +1 -1
- package/out/ontologies/index.d.ts +0 -0
- package/out/ontologies/owl.d.ts +0 -0
- package/out/ontologies/rdf.d.ts +0 -0
- package/out/ontologies/rdfa.d.ts +0 -0
- package/out/ontologies/rdfs.d.ts +0 -0
- package/out/ontologies/sh.d.ts +0 -0
- package/out/ontologies/skos-xl.d.ts +0 -0
- package/out/ontologies/skos.d.ts +0 -0
- package/out/ontologies/src.d.ts +0 -0
- package/out/ontologies/xsd.d.ts +0 -0
- package/out/rdf/class-repository.d.ts +0 -0
- package/out/rdf/concept-repository.d.ts +0 -0
- package/out/rdf/index.d.ts +0 -0
- package/out/rdf/individual-repository.d.ts +0 -0
- package/out/rdf/parsers/rdf-syntax.d.ts +0 -0
- package/out/rdf/parsers/sparql-syntax-parser.d.ts +0 -0
- package/out/rdf/parsers/syntax-parser.d.ts +0 -0
- package/out/rdf/parsers/trig-syntax-parser.d.ts +0 -0
- package/out/rdf/parsers/turtle-syntax-parser.d.ts +0 -0
- package/out/rdf/property-repository.d.ts +0 -0
- package/out/rdf/reasoners/owl-reasoner.d.ts +0 -0
- package/out/rdf/reasoners/rdfs-reasoner.d.ts +0 -0
- package/out/rdf/reasoners/reasoner.d.ts +0 -0
- package/out/rdf/reasoners/shacl-reasoner.d.ts +0 -0
- package/out/rdf/reasoners/skos-reasoner.d.ts +0 -0
- package/out/rdf/resource-repository.d.ts +31 -15
- package/out/rdf/shape-repository.d.ts +0 -0
- package/out/rdf/store.d.ts +0 -0
- package/out/rdf/uri.d.ts +0 -0
- package/out/rdf/vocabulary-repository.d.ts +0 -0
- package/package.json +66 -66
- package/out/index.js.map +0 -1
- package/out/ontologies/index.js +0 -44
- package/out/ontologies/index.js.map +0 -1
- package/out/ontologies/owl.js +0 -322
- package/out/ontologies/owl.js.map +0 -1
- package/out/ontologies/rdf.js +0 -102
- package/out/ontologies/rdf.js.map +0 -1
- package/out/ontologies/rdfa.js +0 -56
- package/out/ontologies/rdfa.js.map +0 -1
- package/out/ontologies/rdfs.js +0 -76
- package/out/ontologies/rdfs.js.map +0 -1
- package/out/ontologies/sh.js +0 -822
- package/out/ontologies/sh.js.map +0 -1
- package/out/ontologies/skos-xl.js +0 -40
- package/out/ontologies/skos-xl.js.map +0 -1
- package/out/ontologies/skos.js +0 -144
- package/out/ontologies/skos.js.map +0 -1
- package/out/ontologies/src.js +0 -3016
- package/out/ontologies/src.js.map +0 -1
- package/out/ontologies/xsd.js +0 -108
- package/out/ontologies/xsd.js.map +0 -1
- package/out/rdf/class-repository.js +0 -324
- package/out/rdf/class-repository.js.map +0 -1
- package/out/rdf/concept-repository.js +0 -220
- package/out/rdf/concept-repository.js.map +0 -1
- package/out/rdf/index.js +0 -18
- package/out/rdf/index.js.map +0 -1
- package/out/rdf/individual-repository.js +0 -77
- package/out/rdf/individual-repository.js.map +0 -1
- package/out/rdf/parsers/rdf-syntax.js +0 -19
- package/out/rdf/parsers/rdf-syntax.js.map +0 -1
- package/out/rdf/parsers/sparql-syntax-parser.js +0 -61
- package/out/rdf/parsers/sparql-syntax-parser.js.map +0 -1
- package/out/rdf/parsers/syntax-parser.js +0 -3
- package/out/rdf/parsers/syntax-parser.js.map +0 -1
- package/out/rdf/parsers/trig-syntax-parser.js +0 -30
- package/out/rdf/parsers/trig-syntax-parser.js.map +0 -1
- package/out/rdf/parsers/turtle-syntax-parser.js +0 -30
- package/out/rdf/parsers/turtle-syntax-parser.js.map +0 -1
- package/out/rdf/property-repository.js +0 -257
- package/out/rdf/property-repository.js.map +0 -1
- package/out/rdf/reasoners/owl-reasoner.js +0 -218
- package/out/rdf/reasoners/owl-reasoner.js.map +0 -1
- package/out/rdf/reasoners/rdfs-reasoner.js +0 -144
- package/out/rdf/reasoners/rdfs-reasoner.js.map +0 -1
- package/out/rdf/reasoners/reasoner.js +0 -106
- package/out/rdf/reasoners/reasoner.js.map +0 -1
- package/out/rdf/reasoners/shacl-reasoner.js +0 -170
- package/out/rdf/reasoners/shacl-reasoner.js.map +0 -1
- package/out/rdf/reasoners/skos-reasoner.js +0 -109
- package/out/rdf/reasoners/skos-reasoner.js.map +0 -1
- package/out/rdf/resource-repository.js +0 -136
- package/out/rdf/resource-repository.js.map +0 -1
- package/out/rdf/shape-repository.js +0 -298
- package/out/rdf/shape-repository.js.map +0 -1
- package/out/rdf/store.js +0 -240
- package/out/rdf/store.js.map +0 -1
- package/out/rdf/tests/helpers.d.ts +0 -39
- package/out/rdf/tests/helpers.js +0 -85
- package/out/rdf/tests/helpers.js.map +0 -1
- package/out/rdf/tests/vocabularies/bfo.d.ts +0 -413
- package/out/rdf/tests/vocabularies/bfo.js +0 -418
- package/out/rdf/tests/vocabularies/bfo.js.map +0 -1
- package/out/rdf/tests/vocabularies/cidoc-crm.d.ts +0 -2101
- package/out/rdf/tests/vocabularies/cidoc-crm.js +0 -2106
- package/out/rdf/tests/vocabularies/cidoc-crm.js.map +0 -1
- package/out/rdf/tests/vocabularies/emmo.d.ts +0 -5525
- package/out/rdf/tests/vocabularies/emmo.js +0 -5530
- package/out/rdf/tests/vocabularies/emmo.js.map +0 -1
- package/out/rdf/tests/vocabularies/fibo-agents.d.ts +0 -17
- package/out/rdf/tests/vocabularies/fibo-agents.js +0 -22
- package/out/rdf/tests/vocabularies/fibo-agents.js.map +0 -1
- package/out/rdf/tests/vocabularies/fibo-organization.d.ts +0 -69
- package/out/rdf/tests/vocabularies/fibo-organization.js +0 -74
- package/out/rdf/tests/vocabularies/fibo-organization.js.map +0 -1
- package/out/rdf/tests/vocabularies/gist.d.ts +0 -1071
- package/out/rdf/tests/vocabularies/gist.js +0 -1076
- package/out/rdf/tests/vocabularies/gist.js.map +0 -1
- package/out/rdf/tests/vocabularies/index.d.ts +0 -17
- package/out/rdf/tests/vocabularies/index.js +0 -90
- package/out/rdf/tests/vocabularies/index.js.map +0 -1
- package/out/rdf/tests/vocabularies/lob.d.ts +0 -5669
- package/out/rdf/tests/vocabularies/lob.js +0 -5674
- package/out/rdf/tests/vocabularies/lob.js.map +0 -1
- package/out/rdf/tests/vocabularies/multi.d.ts +0 -29
- package/out/rdf/tests/vocabularies/multi.js +0 -34
- package/out/rdf/tests/vocabularies/multi.js.map +0 -1
- package/out/rdf/tests/vocabularies/org.d.ts +0 -193
- package/out/rdf/tests/vocabularies/org.js +0 -198
- package/out/rdf/tests/vocabularies/org.js.map +0 -1
- package/out/rdf/tests/vocabularies/owl.d.ts +0 -317
- package/out/rdf/tests/vocabularies/owl.js +0 -322
- package/out/rdf/tests/vocabularies/owl.js.map +0 -1
- package/out/rdf/tests/vocabularies/prov-o.d.ts +0 -391
- package/out/rdf/tests/vocabularies/prov-o.js +0 -396
- package/out/rdf/tests/vocabularies/prov-o.js.map +0 -1
- package/out/rdf/tests/vocabularies/schema-nq.d.ts +0 -12079
- package/out/rdf/tests/vocabularies/schema-nq.js +0 -12084
- package/out/rdf/tests/vocabularies/schema-nq.js.map +0 -1
- package/out/rdf/tests/vocabularies/schema-nt.d.ts +0 -12079
- package/out/rdf/tests/vocabularies/schema-nt.js +0 -12084
- package/out/rdf/tests/vocabularies/schema-nt.js.map +0 -1
- package/out/rdf/tests/vocabularies/schema.d.ts +0 -12079
- package/out/rdf/tests/vocabularies/schema.js +0 -12084
- package/out/rdf/tests/vocabularies/schema.js.map +0 -1
- package/out/rdf/tests/vocabularies/shapes.d.ts +0 -53
- package/out/rdf/tests/vocabularies/shapes.js +0 -58
- package/out/rdf/tests/vocabularies/shapes.js.map +0 -1
- package/out/rdf/tests/vocabularies/skos.d.ts +0 -139
- package/out/rdf/tests/vocabularies/skos.js +0 -144
- package/out/rdf/tests/vocabularies/skos.js.map +0 -1
- package/out/rdf/tests/vocabularies/unesco.d.ts +0 -10517
- package/out/rdf/tests/vocabularies/unesco.js +0 -10522
- package/out/rdf/tests/vocabularies/unesco.js.map +0 -1
- package/out/rdf/uri.js +0 -84
- package/out/rdf/uri.js.map +0 -1
- package/out/rdf/vocabulary-generator.d.ts +0 -86
- package/out/rdf/vocabulary-generator.js +0 -294
- package/out/rdf/vocabulary-generator.js.map +0 -1
- package/out/rdf/vocabulary-repository.js +0 -121
- package/out/rdf/vocabulary-repository.js.map +0 -1
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ConceptRepository = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const n3 = tslib_1.__importStar(require("n3"));
|
|
6
|
-
const resource_repository_1 = require("./resource-repository");
|
|
7
|
-
const ontologies_1 = require("../ontologies");
|
|
8
|
-
class ConceptRepository extends resource_repository_1.ResourceRepository {
|
|
9
|
-
/**
|
|
10
|
-
* Get all concepts.
|
|
11
|
-
* @param graphUris URIs of the graphs to search for concepts.
|
|
12
|
-
* @returns A list of URIs of all concepts.
|
|
13
|
-
*/
|
|
14
|
-
getConcepts(graphUris) {
|
|
15
|
-
const result = new Set();
|
|
16
|
-
for (let q of this.store.match(graphUris, null, ontologies_1.rdf.type, ontologies_1.skos.Concept)) {
|
|
17
|
-
const s = q.subject;
|
|
18
|
-
result.add(s.value);
|
|
19
|
-
}
|
|
20
|
-
return Array.from(result);
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Get all concept schemes.
|
|
24
|
-
* @param graphUris URIs of the graphs to search for concepts.
|
|
25
|
-
* @returns A list of URIs of all concepts.
|
|
26
|
-
*/
|
|
27
|
-
getConceptSchemes(graphUris) {
|
|
28
|
-
const result = new Set();
|
|
29
|
-
for (let q of this.store.match(graphUris, null, ontologies_1.rdf.type, ontologies_1.skos.ConceptScheme)) {
|
|
30
|
-
const s = q.subject;
|
|
31
|
-
result.add(s.value);
|
|
32
|
-
}
|
|
33
|
-
return Array.from(result);
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Get all collections.
|
|
37
|
-
* @param graphUris URI of the graphs to search for collections.
|
|
38
|
-
* @returns A list of URIs of all collections.
|
|
39
|
-
*/
|
|
40
|
-
getCollections(graphUris) {
|
|
41
|
-
const result = new Set();
|
|
42
|
-
for (let q of this.store.match(graphUris, null, ontologies_1.rdf.type, ontologies_1.skos.Collection)) {
|
|
43
|
-
const s = q.subject;
|
|
44
|
-
result.add(s.value);
|
|
45
|
-
}
|
|
46
|
-
for (let q of this.store.match(graphUris, null, ontologies_1.rdf.type, ontologies_1.skos.OrderedCollection)) {
|
|
47
|
-
const s = q.subject;
|
|
48
|
-
result.add(s.value);
|
|
49
|
-
}
|
|
50
|
-
return Array.from(result);
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Get the members of a collection. This includes both `skos:member` and `skos:memberList` properties.
|
|
54
|
-
* @param graphUris URI of the graphs to search for collections.
|
|
55
|
-
* @param collectionUri URI of a collection.
|
|
56
|
-
* @returns An array of URIs of the members of the collection.
|
|
57
|
-
*/
|
|
58
|
-
getCollectionMembers(graphUris, collectionUri) {
|
|
59
|
-
const s = n3.DataFactory.namedNode(collectionUri);
|
|
60
|
-
let result = [];
|
|
61
|
-
for (let q of this.store.match(graphUris, s, ontologies_1.skos.member, null)) {
|
|
62
|
-
result.push(q.object.value);
|
|
63
|
-
}
|
|
64
|
-
for (let q of this.store.match(graphUris, s, ontologies_1.skos.memberList, null)) {
|
|
65
|
-
result = [...result, ...this.store.getListItems(graphUris, q.object.value)];
|
|
66
|
-
}
|
|
67
|
-
return result;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Get the members of a collection. This includes both `skos:member` and `skos:memberList` properties.
|
|
71
|
-
* @param graphUris URI of the graphs to search for collections.
|
|
72
|
-
* @param collectionUri URI of a collection.
|
|
73
|
-
* @returns An array of URIs of the members of the collection.
|
|
74
|
-
*/
|
|
75
|
-
hasCollectionMembers(graphUris, collectionUri) {
|
|
76
|
-
const s = n3.DataFactory.namedNode(collectionUri);
|
|
77
|
-
for (let _ of this.store.match(graphUris, s, ontologies_1.skos.member, null)) {
|
|
78
|
-
return true;
|
|
79
|
-
}
|
|
80
|
-
for (let _ of this.store.match(graphUris, s, ontologies_1.skos.memberList, null)) {
|
|
81
|
-
return true;
|
|
82
|
-
}
|
|
83
|
-
return false;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Indicates whether a collection is an ordered collection.
|
|
87
|
-
* @param graphUris URI of the graphs to search for collections.
|
|
88
|
-
* @param collectionUri URI of a collection.
|
|
89
|
-
* @returns `true` if the collection is an ordered collection, `false` otherwise.
|
|
90
|
-
*/
|
|
91
|
-
isOrderedCollection(graphUris, collectionUri) {
|
|
92
|
-
const s = n3.DataFactory.namedNode(collectionUri);
|
|
93
|
-
for (let _ of this.store.match(graphUris, s, ontologies_1.rdf.type, ontologies_1.skos.OrderedCollection)) {
|
|
94
|
-
return true;
|
|
95
|
-
}
|
|
96
|
-
return false;
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Get all broader concepts of a concept scheme.
|
|
100
|
-
* @param graphUris URIs of the graphs to search for concepts.
|
|
101
|
-
* @param subjectUri URI of a concept scheme.
|
|
102
|
-
*/
|
|
103
|
-
getBroaderConcepts(graphUris, subjectUri) {
|
|
104
|
-
const result = new Set();
|
|
105
|
-
const s = n3.DataFactory.namedNode(subjectUri);
|
|
106
|
-
for (let q of this.store.match(graphUris, null, ontologies_1.skos.hasTopConcept, s)) {
|
|
107
|
-
const s = q.subject;
|
|
108
|
-
result.add(s.value);
|
|
109
|
-
}
|
|
110
|
-
for (let q of this.store.match(graphUris, null, ontologies_1.skos.narrower, s)) {
|
|
111
|
-
const s = q.subject;
|
|
112
|
-
result.add(s.value);
|
|
113
|
-
}
|
|
114
|
-
for (let q of this.store.match(graphUris, s, ontologies_1.skos.topConceptOf, null)) {
|
|
115
|
-
const o = q.object;
|
|
116
|
-
result.add(o.value);
|
|
117
|
-
}
|
|
118
|
-
for (let q of this.store.match(graphUris, s, ontologies_1.skos.broader, null)) {
|
|
119
|
-
const o = q.object;
|
|
120
|
-
result.add(o.value);
|
|
121
|
-
}
|
|
122
|
-
return Array.from(result);
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Indicates whether a concept has broader concepts.
|
|
126
|
-
* @param graphUris URIs of the graphs to search for concepts.
|
|
127
|
-
* @param subjectUri URI of a concept.
|
|
128
|
-
*/
|
|
129
|
-
hasBroaderConcepts(graphUris, subjectUri) {
|
|
130
|
-
return this.getBroaderConcepts(graphUris, subjectUri).length > 0;
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Get all narrower concepts of a concept or top concepts of a concept scheme.
|
|
134
|
-
* @param graphUris URIs of the graphs to search for concepts.
|
|
135
|
-
* @param subjectUri URI of a concept or concept scheme.
|
|
136
|
-
*/
|
|
137
|
-
getNarrowerConcepts(graphUris, subjectUri) {
|
|
138
|
-
if (subjectUri) {
|
|
139
|
-
const result = new Set();
|
|
140
|
-
const s = n3.DataFactory.namedNode(subjectUri);
|
|
141
|
-
for (let q of this.store.match(graphUris, s, ontologies_1.skos.hasTopConcept, null)) {
|
|
142
|
-
const o = q.object;
|
|
143
|
-
result.add(o.value);
|
|
144
|
-
}
|
|
145
|
-
for (let q of this.store.match(graphUris, s, ontologies_1.skos.narrower, null)) {
|
|
146
|
-
const o = q.object;
|
|
147
|
-
result.add(o.value);
|
|
148
|
-
}
|
|
149
|
-
for (let q of this.store.match(graphUris, null, ontologies_1.skos.topConceptOf, s)) {
|
|
150
|
-
const s = q.subject;
|
|
151
|
-
result.add(s.value);
|
|
152
|
-
}
|
|
153
|
-
for (let q of this.store.match(graphUris, null, ontologies_1.skos.broader, s)) {
|
|
154
|
-
const s = q.subject;
|
|
155
|
-
result.add(s.value);
|
|
156
|
-
}
|
|
157
|
-
return Array.from(result);
|
|
158
|
-
}
|
|
159
|
-
else {
|
|
160
|
-
return this.getConceptSchemes(graphUris);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* Indicates whether a concept has narrower concepts.
|
|
165
|
-
* @param graphUris URIs of the graphs to search for concepts.
|
|
166
|
-
* @param subjectUri URI of a concept.
|
|
167
|
-
*/
|
|
168
|
-
hasNarrowerConcepts(graphUris, subjectUri) {
|
|
169
|
-
return this.getNarrowerConcepts(graphUris, subjectUri).length > 0;
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* Indicates whether a concept is a narrower concept of another concept.
|
|
173
|
-
* @param graphUris URIs of the graphs to search for concepts.
|
|
174
|
-
* @param subjectUri URI of a concept.
|
|
175
|
-
* @param broaderUri URI of a broader concept.
|
|
176
|
-
* @returns `true` if the concept is a narrower concept of the broader concept, `false` otherwise.
|
|
177
|
-
*/
|
|
178
|
-
isNarrowerConceptOf(graphUris, subjectUri, broaderUri) {
|
|
179
|
-
return this.getConceptSchemePath(graphUris, subjectUri).includes(broaderUri);
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Indicates whether a subject is a concept scheme.
|
|
183
|
-
* @param graphUris URIs of the graphs to search for concepts.
|
|
184
|
-
* @param subjectUri URI of a subject.
|
|
185
|
-
* @returns `true` if the subject is a concept scheme, `false` otherwise.
|
|
186
|
-
*/
|
|
187
|
-
isConceptScheme(graphUris, subjectUri) {
|
|
188
|
-
if (subjectUri) {
|
|
189
|
-
const s = n3.DataFactory.namedNode(subjectUri);
|
|
190
|
-
for (let _ of this.store.match(graphUris, s, ontologies_1.rdf.type, ontologies_1.skos.ConceptScheme)) {
|
|
191
|
-
return true;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
return false;
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* Get all broader concepts up to and including a concept scheme.
|
|
198
|
-
* @param graphUris URIs of the graphs to search for concepts.
|
|
199
|
-
* @param subjectUri URI of a concept.
|
|
200
|
-
*/
|
|
201
|
-
getConceptSchemePath(graphUris, subjectUri) {
|
|
202
|
-
return this._getConceptSchemePath(graphUris, subjectUri, [], new Set());
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* Recursively find the first path from a given class to a root class.
|
|
206
|
-
* @param subjectUri URI of a class.
|
|
207
|
-
* @param path The current class path.
|
|
208
|
-
* @param backtrack Set of URIs that have already been visited.
|
|
209
|
-
* @returns The first path that is found from the given class to a root class.
|
|
210
|
-
*/
|
|
211
|
-
_getConceptSchemePath(graphUris, subjectUri, path, backtrack) {
|
|
212
|
-
const broaderConcepts = this.getBroaderConcepts(graphUris, subjectUri);
|
|
213
|
-
for (let o of broaderConcepts.filter(o => !backtrack.has(o))) {
|
|
214
|
-
return this._getConceptSchemePath(graphUris, o, [...path, o], backtrack);
|
|
215
|
-
}
|
|
216
|
-
return path;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
exports.ConceptRepository = ConceptRepository;
|
|
220
|
-
//# sourceMappingURL=concept-repository.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"concept-repository.js","sourceRoot":"","sources":["../../src/rdf/concept-repository.ts"],"names":[],"mappings":";;;;AAAA,+CAAyB;AACzB,+DAA2D;AAC3D,8CAA0C;AAE1C,MAAa,iBAAkB,SAAQ,wCAAkB;IACrD;;;;OAIG;IACH,WAAW,CAAC,SAAwC;QAChD,MAAM,MAAM,GAAG,IAAI,GAAG,EAAU,CAAC;QAEjC,KAAK,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,EAAE,IAAI,EAAE,gBAAG,CAAC,IAAI,EAAE,iBAAI,CAAC,OAAO,CAAC,EAAE,CAAC;YACtE,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC;YAEpB,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QACxB,CAAC;QAED,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC9B,CAAC;IAED;;;;OAIG;IACH,iBAAiB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,SAAS,EAAE,CAAC,EAAE,gBAAG,CAAC,IAAI,EAAE,iBAAI,CAAC,aAAa,CAAC,EAAE,CAAC;gBACzE,OAAO,IAAI,CAAC;YAChB,CAAC;QACL,CAAC;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;IAED;;;;OAIG;IACH,oBAAoB,CAAC,SAAwC,EAAE,UAAkB;QAC7E,OAAO,IAAI,CAAC,qBAAqB,CAAC,SAAS,EAAE,UAAU,EAAE,EAAE,EAAE,IAAI,GAAG,EAAU,CAAC,CAAC;IACpF,CAAC;IAED;;;;;;OAMG;IACK,qBAAqB,CAAC,SAAwC,EAAE,UAAkB,EAAE,IAAc,EAAE,SAAsB;QAC9H,MAAM,eAAe,GAAG,IAAI,CAAC,kBAAkB,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QAEvE,KAAK,IAAI,CAAC,IAAI,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAC3D,OAAO,IAAI,CAAC,qBAAqB,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;QAC7E,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAxQD,8CAwQC"}
|
package/out/rdf/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
tslib_1.__exportStar(require("./class-repository"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./individual-repository"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./parsers/rdf-syntax"), exports);
|
|
7
|
-
tslib_1.__exportStar(require("./parsers/turtle-syntax-parser"), exports);
|
|
8
|
-
tslib_1.__exportStar(require("./parsers/trig-syntax-parser"), exports);
|
|
9
|
-
tslib_1.__exportStar(require("./parsers/sparql-syntax-parser"), exports);
|
|
10
|
-
tslib_1.__exportStar(require("./parsers/syntax-parser"), exports);
|
|
11
|
-
tslib_1.__exportStar(require("./property-repository"), exports);
|
|
12
|
-
tslib_1.__exportStar(require("./reasoners/owl-reasoner"), exports);
|
|
13
|
-
tslib_1.__exportStar(require("./reasoners/rdfs-reasoner"), exports);
|
|
14
|
-
tslib_1.__exportStar(require("./resource-repository"), exports);
|
|
15
|
-
tslib_1.__exportStar(require("./store"), exports);
|
|
16
|
-
tslib_1.__exportStar(require("./uri"), exports);
|
|
17
|
-
tslib_1.__exportStar(require("./vocabulary-repository"), exports);
|
|
18
|
-
//# sourceMappingURL=index.js.map
|
package/out/rdf/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/rdf/index.ts"],"names":[],"mappings":";;;AAAA,6DAAmC;AACnC,kEAAwC;AACxC,+DAAqC;AACrC,yEAA+C;AAC/C,uEAA6C;AAC7C,yEAA+C;AAC/C,kEAAwC;AACxC,gEAAsC;AACtC,mEAAyC;AACzC,oEAA0C;AAC1C,gEAAsC;AACtC,kDAAwB;AACxB,gDAAsB;AACtB,kEAAwC"}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IndividualRepository = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const n3 = tslib_1.__importStar(require("n3"));
|
|
6
|
-
const ontologies_1 = require("../ontologies");
|
|
7
|
-
const property_repository_1 = require("./property-repository");
|
|
8
|
-
/**
|
|
9
|
-
* A repository for retrieving classes from graphs.
|
|
10
|
-
*/
|
|
11
|
-
class IndividualRepository extends property_repository_1.PropertyRepository {
|
|
12
|
-
constructor(store) { super(store); }
|
|
13
|
-
/**
|
|
14
|
-
* Get all classes that have instances or all types of a specific individual.
|
|
15
|
-
* @param graphUris The graph URIs to search.
|
|
16
|
-
* @param subjectUri The URI of a subject for which to get the types (optional).
|
|
17
|
-
* @param options Options for retrieving the individuals.
|
|
18
|
-
* @returns A list of all individual types, or all types of a specific individual.
|
|
19
|
-
*/
|
|
20
|
-
getIndividualTypes(graphUris, subjectUri, options) {
|
|
21
|
-
const result = new Set();
|
|
22
|
-
const subject = subjectUri ? new n3.NamedNode(subjectUri) : null;
|
|
23
|
-
for (const q of this.store.match(graphUris, subject, ontologies_1.rdf.type, ontologies_1.owl.NamedIndividual)) {
|
|
24
|
-
if (this.skip(graphUris, q.subject, options)) {
|
|
25
|
-
continue;
|
|
26
|
-
}
|
|
27
|
-
// Note: We do not include inferred types here.
|
|
28
|
-
for (const p of this.store.match(graphUris, q.subject, ontologies_1.rdf.type, null, false)) {
|
|
29
|
-
if (p.object.equals(ontologies_1.owl.NamedIndividual)) {
|
|
30
|
-
continue;
|
|
31
|
-
}
|
|
32
|
-
result.add(p.object.value);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return Array.from(result);
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Get all individuals in the repository.
|
|
39
|
-
* @param typeUri The type of the individuals to get.
|
|
40
|
-
* @param options Options for retrieving the individuals.
|
|
41
|
-
* @returns A list of all individuals in the repository.
|
|
42
|
-
*/
|
|
43
|
-
getIndividuals(graphUris, typeUri, options) {
|
|
44
|
-
const result = new Set();
|
|
45
|
-
for (const q of this.store.match(graphUris, null, ontologies_1.rdf.type, ontologies_1.owl.NamedIndividual)) {
|
|
46
|
-
if (this.skip(graphUris, q.subject, options)) {
|
|
47
|
-
continue;
|
|
48
|
-
}
|
|
49
|
-
if (!typeUri || this.isInstanceOfType(graphUris, q.subject.value, typeUri)) {
|
|
50
|
-
result.add(q.subject.value);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
return Array.from(result);
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Indicate if the subject is an instance of the type, or of one of its super types.
|
|
57
|
-
* @param subjectUri URI of the subject.
|
|
58
|
-
* @param typeUri URI of the type to check.
|
|
59
|
-
* @returns true if the subject is an instance of the type, or of one of its super types.
|
|
60
|
-
*/
|
|
61
|
-
isInstanceOfType(graphUris, subjectUri, typeUri) {
|
|
62
|
-
const subject = new n3.NamedNode(subjectUri);
|
|
63
|
-
const type = new n3.NamedNode(typeUri);
|
|
64
|
-
for (const q of this.store.match(graphUris, subject, ontologies_1.rdf.type, null)) {
|
|
65
|
-
const o = q.object;
|
|
66
|
-
if (o.termType != "NamedNode") {
|
|
67
|
-
continue;
|
|
68
|
-
}
|
|
69
|
-
if (o.equals(type) || this.isSubClassOf(graphUris, o.value, type.value)) {
|
|
70
|
-
return true;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return false;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
exports.IndividualRepository = IndividualRepository;
|
|
77
|
-
//# sourceMappingURL=individual-repository.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"individual-repository.js","sourceRoot":"","sources":["../../src/rdf/individual-repository.ts"],"names":[],"mappings":";;;;AAAA,+CAAyB;AACzB,8CAAyC;AAEzC,+DAA2D;AAG3D;;GAEG;AACH,MAAa,oBAAqB,SAAQ,wCAAkB;IACxD,YAAY,KAAY,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAE3C;;;;;;OAMG;IACH,kBAAkB,CAAC,SAAwC,EAAE,UAAmB,EAAE,OAAgC;QAC9G,MAAM,MAAM,GAAG,IAAI,GAAG,EAAU,CAAC;QACjC,MAAM,OAAO,GAAG,UAAU,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAEjE,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,EAAE,OAAO,EAAE,gBAAG,CAAC,IAAI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C;QAED,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC9B,CAAC;IAED;;;;;OAKG;IACH,gBAAgB,CAAC,SAAwC,EAAE,UAAkB,EAAE,OAAe;QAC1F,MAAM,OAAO,GAAG,IAAI,EAAE,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QAC7C,MAAM,IAAI,GAAG,IAAI,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAEvC,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,EAAE,OAAO,EAAE,gBAAG,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC;YACnE,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC;YAEnB,IAAI,CAAC,CAAC,QAAQ,IAAI,WAAW,EAAE,CAAC;gBAC5B,SAAS;YACb,CAAC;YAED,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;gBACtE,OAAO,IAAI,CAAC;YAChB,CAAC;QACL,CAAC;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ;AA9ED,oDA8EC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RdfSyntax = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Enumerates the RDF syntaxes supported by the Mentor RDF library.
|
|
6
|
-
*/
|
|
7
|
-
var RdfSyntax;
|
|
8
|
-
(function (RdfSyntax) {
|
|
9
|
-
RdfSyntax["N3"] = "n3";
|
|
10
|
-
RdfSyntax["NTriples"] = "ntriples";
|
|
11
|
-
RdfSyntax["NQuads"] = "nquads";
|
|
12
|
-
RdfSyntax["Turtle"] = "turtle";
|
|
13
|
-
RdfSyntax["TriG"] = "trig";
|
|
14
|
-
RdfSyntax["TriX"] = "trix";
|
|
15
|
-
RdfSyntax["JsonLd"] = "jsonld";
|
|
16
|
-
RdfSyntax["RdfXml"] = "rdfxml";
|
|
17
|
-
RdfSyntax["Sparql"] = "sparql";
|
|
18
|
-
})(RdfSyntax || (exports.RdfSyntax = RdfSyntax = {}));
|
|
19
|
-
//# sourceMappingURL=rdf-syntax.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rdf-syntax.js","sourceRoot":"","sources":["../../../src/rdf/parsers/rdf-syntax.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,SAUX;AAVD,WAAY,SAAS;IACjB,sBAAS,CAAA;IACT,kCAAqB,CAAA;IACrB,8BAAiB,CAAA;IACjB,8BAAiB,CAAA;IACjB,0BAAa,CAAA;IACb,0BAAa,CAAA;IACb,8BAAiB,CAAA;IACjB,8BAAiB,CAAA;IACjB,8BAAiB,CAAA;AACrB,CAAC,EAVW,SAAS,yBAAT,SAAS,QAUpB"}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SparqlSyntaxParser = void 0;
|
|
4
|
-
const millan_1 = require("millan");
|
|
5
|
-
/**
|
|
6
|
-
* An extended version of the Millan SPARQL parser that also returns semantic errors such as undefined prefixes.
|
|
7
|
-
*/
|
|
8
|
-
class SparqlSyntaxParser {
|
|
9
|
-
constructor() {
|
|
10
|
-
this.parser = new millan_1.W3SpecSparqlParser();
|
|
11
|
-
this.parse = (document) => {
|
|
12
|
-
var _a;
|
|
13
|
-
const { cst, errors, comments } = this.parser.parse(document);
|
|
14
|
-
const tokens = this.parser.input;
|
|
15
|
-
const semanticErrors = [];
|
|
16
|
-
const declaredPrefixes = new Set();
|
|
17
|
-
for (let i = 0; i < tokens.length; i++) {
|
|
18
|
-
const token = tokens[i];
|
|
19
|
-
const tokenName = (_a = token.tokenType) === null || _a === void 0 ? void 0 : _a.name;
|
|
20
|
-
switch (tokenName) {
|
|
21
|
-
case "PNAME_NS": {
|
|
22
|
-
const prefix = token.image.split(":")[0];
|
|
23
|
-
declaredPrefixes.add(prefix);
|
|
24
|
-
break;
|
|
25
|
-
}
|
|
26
|
-
case "PNAME_LN": {
|
|
27
|
-
const prefix = token.image.split(":")[0];
|
|
28
|
-
if (!declaredPrefixes.has(prefix)) {
|
|
29
|
-
semanticErrors.push({
|
|
30
|
-
message: `Undefined prefix: ${prefix}`,
|
|
31
|
-
name: "NoNamespacePrefixError",
|
|
32
|
-
token: token,
|
|
33
|
-
resyncedTokens: [],
|
|
34
|
-
context: {
|
|
35
|
-
ruleStack: [],
|
|
36
|
-
ruleOccurrenceStack: []
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
break;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return {
|
|
45
|
-
comments: comments ? comments : [],
|
|
46
|
-
cst,
|
|
47
|
-
errors,
|
|
48
|
-
semanticErrors,
|
|
49
|
-
tokens,
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
get input() {
|
|
54
|
-
return this.parser.input;
|
|
55
|
-
}
|
|
56
|
-
tokenize(document) {
|
|
57
|
-
return this.parser.tokenize(document);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
exports.SparqlSyntaxParser = SparqlSyntaxParser;
|
|
61
|
-
//# sourceMappingURL=sparql-syntax-parser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sparql-syntax-parser.js","sourceRoot":"","sources":["../../../src/rdf/parsers/sparql-syntax-parser.ts"],"names":[],"mappings":";;;AACA,mCAA4C;AAG5C;;GAEG;AACH,MAAa,kBAAkB;IAA/B;QACa,WAAM,GAAuB,IAAI,2BAAkB,EAAE,CAAC;QAUxD,UAAK,GAAG,CAAC,QAAgB,EAAqB,EAAE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ACL,CAAC;YACL,CAAC;YAED,OAAO;gBACH,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE;gBAClC,GAAG;gBACH,MAAM;gBACN,cAAc;gBACd,MAAM;aACT,CAAC;QACN,CAAC,CAAC;IACN,CAAC;IAtDG,IAAW,KAAK;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;IAC7B,CAAC;IAEM,QAAQ,CAAC,QAAgB;QAC5B,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC1C,CAAC;CAgDJ;AAzDD,gDAyDC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"syntax-parser.js","sourceRoot":"","sources":["../../../src/rdf/parsers/syntax-parser.ts"],"names":[],"mappings":""}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TrigSyntaxParser = void 0;
|
|
4
|
-
const millan_1 = require("millan");
|
|
5
|
-
/**
|
|
6
|
-
* A TriG document parser that also returns comments.
|
|
7
|
-
*/
|
|
8
|
-
class TrigSyntaxParser extends millan_1.TrigParser {
|
|
9
|
-
constructor() {
|
|
10
|
-
super(...arguments);
|
|
11
|
-
this.parse = (content) => {
|
|
12
|
-
const result = this.lexer.tokenize(content);
|
|
13
|
-
this.input = result.tokens;
|
|
14
|
-
const cst = this.trigDoc(0, ['standard']);
|
|
15
|
-
const errors = [...this.errors];
|
|
16
|
-
const semanticErrors = [...this.semanticErrors];
|
|
17
|
-
const comments = result.groups.comments || [];
|
|
18
|
-
this.resetManagedState();
|
|
19
|
-
return {
|
|
20
|
-
comments,
|
|
21
|
-
cst,
|
|
22
|
-
errors,
|
|
23
|
-
semanticErrors,
|
|
24
|
-
tokens: result.tokens,
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
exports.TrigSyntaxParser = TrigSyntaxParser;
|
|
30
|
-
//# sourceMappingURL=trig-syntax-parser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"trig-syntax-parser.js","sourceRoot":"","sources":["../../../src/rdf/parsers/trig-syntax-parser.ts"],"names":[],"mappings":";;;AAAA,mCAAoC;AAGpC;;GAEG;AACH,MAAa,gBAAiB,SAAQ,mBAAU;IAAhD;;QACW,UAAK,GAAG,CAAC,OAAe,EAAqB,EAAE;YAClD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;YAE5C,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC;YAE3B,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;YAC1C,MAAM,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;YAChC,MAAM,cAAc,GAAG,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC,CAAC;YAChD,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,IAAI,EAAE,CAAC;YAE9C,IAAI,CAAC,iBAAiB,EAAE,CAAC;YAEzB,OAAO;gBACH,QAAQ;gBACR,GAAG;gBACH,MAAM;gBACN,cAAc;gBACd,MAAM,EAAE,MAAM,CAAC,MAAM;aACxB,CAAC;QACN,CAAC,CAAC;IACN,CAAC;CAAA;AArBD,4CAqBC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TurtleSyntaxParser = void 0;
|
|
4
|
-
const millan_1 = require("millan");
|
|
5
|
-
/**
|
|
6
|
-
* A Turtle document parser that also returns comments.
|
|
7
|
-
*/
|
|
8
|
-
class TurtleSyntaxParser extends millan_1.TrigParser {
|
|
9
|
-
constructor() {
|
|
10
|
-
super(...arguments);
|
|
11
|
-
this.parse = (content) => {
|
|
12
|
-
const result = this.lexer.tokenize(content);
|
|
13
|
-
this.input = result.tokens;
|
|
14
|
-
const cst = this.turtleDoc(0, ['standard']);
|
|
15
|
-
const errors = [...this.errors];
|
|
16
|
-
const semanticErrors = [...this.semanticErrors];
|
|
17
|
-
const comments = result.groups.comments || [];
|
|
18
|
-
this.resetManagedState();
|
|
19
|
-
return {
|
|
20
|
-
comments,
|
|
21
|
-
cst,
|
|
22
|
-
errors,
|
|
23
|
-
semanticErrors,
|
|
24
|
-
tokens: result.tokens,
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
exports.TurtleSyntaxParser = TurtleSyntaxParser;
|
|
30
|
-
//# sourceMappingURL=turtle-syntax-parser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"turtle-syntax-parser.js","sourceRoot":"","sources":["../../../src/rdf/parsers/turtle-syntax-parser.ts"],"names":[],"mappings":";;;AAAA,mCAAoC;AAGpC;;GAEG;AACH,MAAa,kBAAmB,SAAQ,mBAAU;IAAlD;;QACW,UAAK,GAAG,CAAC,OAAe,EAAqB,EAAE;YAClD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;YAE5C,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC;YAE3B,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;YAC5C,MAAM,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;YAChC,MAAM,cAAc,GAAG,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC,CAAC;YAChD,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,IAAI,EAAE,CAAC;YAE9C,IAAI,CAAC,iBAAiB,EAAE,CAAC;YAEzB,OAAO;gBACH,QAAQ;gBACR,GAAG;gBACH,MAAM;gBACN,cAAc;gBACd,MAAM,EAAE,MAAM,CAAC,MAAM;aACxB,CAAC;QACN,CAAC,CAAC;IACN,CAAC;CAAA;AArBD,gDAqBC"}
|