cassproject 0.5.29 → 0.5.30

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 CHANGED
@@ -44,6 +44,10 @@ Development unit tests presume you have a CaSS Repository running on `localhost:
44
44
 
45
45
  # Changelog
46
46
 
47
+ ## 0.5.30
48
+ * Optimized performance of EcFrameworkGraph
49
+ * Library Updates
50
+
47
51
  ## 0.5.28
48
52
  * Bug fixes and library updates.
49
53
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cassproject",
3
- "version": "0.5.29",
3
+ "version": "0.5.30",
4
4
  "description": "Competency and Skills Service",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -61,6 +61,7 @@
61
61
  "papaparse": "^5.3.1",
62
62
  "pem-jwk": "^2.0.0",
63
63
  "promise-worker": "^2.0.1",
64
+ "rdf-canonize": "^3.0.0",
64
65
  "web-worker": "^1.1.0"
65
66
  },
66
67
  "files": [
@@ -106,28 +106,44 @@ module.exports = class EcFrameworkGraph extends EcDirectedGraph {
106
106
  * @param {function()} success Method to invoke when the operation completes successfully.
107
107
  * @param {function(error)} failure Error method.
108
108
  */
109
- processAssertionsBoolean(assertions, success, failure) {
110
- return cassPromisify(
111
- Promise.all(
112
- assertions.map(async (assertion) => {
113
- if (!this.containsVertexById(assertion.competency)) {
114
- return;
115
- }
116
- let negative = await assertion.getNegative();
117
- await this.processAssertionsBooleanPerAssertion(
118
- assertion,
119
- negative,
120
- await this.getCompetency(assertion.competency),
121
- []
122
- );
123
- })
124
- ),
125
- success,
126
- failure
127
- );
109
+ async processAssertionsBoolean(assertions, success, failure) {
110
+ let competencies = {};
111
+ await Promise.all(
112
+ assertions.map(async (assertion) => {
113
+ if (!this.containsVertexById(assertion.competency)) {
114
+ return;
115
+ }
116
+ let negative = await assertion.getNegative();
117
+ if (competencies[assertion.competency] == null)
118
+ competencies[assertion.competency] = {positives:[],negatives:[]};
119
+ if (negative)
120
+ competencies[assertion.competency].negatives.push(assertion);
121
+ else
122
+ competencies[assertion.competency].positives.push(assertion);
123
+ })
124
+ )
125
+ await Promise.all(
126
+ Object.keys(competencies).map(async (label) => {
127
+ let competency = await this.getCompetency(label);
128
+ await this.processAssertionsBooleanPerAssertion(
129
+ competencies[label].negatives,
130
+ true,
131
+ competency,
132
+ []
133
+ );
134
+ await this.processAssertionsBooleanPerAssertion(
135
+ competencies[label].positives,
136
+ false,
137
+ competency,
138
+ []
139
+ );
140
+ })
141
+ )
142
+ if (success != null)
143
+ success();
128
144
  }
129
145
  async processAssertionsBooleanPerAssertion(
130
- assertion,
146
+ assertions,
131
147
  negative,
132
148
  competency,
133
149
  visited
@@ -137,18 +153,19 @@ module.exports = class EcFrameworkGraph extends EcDirectedGraph {
137
153
  }
138
154
  visited.push(competency);
139
155
  if (negative) {
140
- this.addToMetaStateArray(
141
- this.getMetaStateCompetency(competency),
142
- "negativeAssertion",
143
- assertion
144
- );
156
+ for (let assertion of assertions)
157
+ this.addToMetaStateArray(
158
+ this.getMetaStateCompetency(competency),
159
+ "negativeAssertion",
160
+ assertion
161
+ );
145
162
  await Promise.all(
146
163
  await this.getOutEdges(competency).map(async (alignment) =>
147
164
  await this.getCompetency(alignment.target).then(async (t) =>
148
165
  await this.processAssertionBooleanOutward(
149
166
  alignment,
150
167
  t,
151
- assertion,
168
+ assertions,
152
169
  negative,
153
170
  visited
154
171
  )
@@ -156,12 +173,12 @@ module.exports = class EcFrameworkGraph extends EcDirectedGraph {
156
173
  )
157
174
  ).then(async() =>
158
175
  await Promise.all(
159
- this.getInEdges(competency).map(async (alignment) =>
176
+ await this.getInEdges(competency).map(async (alignment) =>
160
177
  await this.getCompetency(alignment.source).then(async (s) =>
161
178
  await this.processAssertionBooleanInward(
162
179
  alignment,
163
180
  s,
164
- assertion,
181
+ assertions,
165
182
  negative,
166
183
  visited
167
184
  )
@@ -170,18 +187,19 @@ module.exports = class EcFrameworkGraph extends EcDirectedGraph {
170
187
  )
171
188
  );
172
189
  } else {
173
- this.addToMetaStateArray(
174
- this.getMetaStateCompetency(competency),
175
- "positiveAssertion",
176
- assertion
177
- );
190
+ for (let assertion of assertions)
191
+ this.addToMetaStateArray(
192
+ this.getMetaStateCompetency(competency),
193
+ "positiveAssertion",
194
+ assertion
195
+ );
178
196
  await Promise.all(
179
- this.getInEdges(competency).map((alignment) =>
180
- this.getCompetency(alignment.source).then((t) =>
181
- this.processAssertionBooleanOutward(
197
+ await this.getInEdges(competency).map(async (alignment) =>
198
+ await this.getCompetency(alignment.source).then(async (t) =>
199
+ await this.processAssertionBooleanOutward(
182
200
  alignment,
183
201
  t,
184
- assertion,
202
+ assertions,
185
203
  negative,
186
204
  visited
187
205
  )
@@ -189,12 +207,12 @@ module.exports = class EcFrameworkGraph extends EcDirectedGraph {
189
207
  )
190
208
  ).then(async () =>
191
209
  await Promise.all(
192
- this.getOutEdges(competency).map(async (alignment) =>
210
+ await this.getOutEdges(competency).map(async (alignment) =>
193
211
  await this.getCompetency(alignment.target).then(async (s) =>
194
212
  await this.processAssertionBooleanInward(
195
213
  alignment,
196
214
  s,
197
- assertion,
215
+ assertions,
198
216
  negative,
199
217
  visited
200
218
  )
@@ -207,20 +225,20 @@ module.exports = class EcFrameworkGraph extends EcDirectedGraph {
207
225
  async processAssertionBooleanOutward(
208
226
  alignment,
209
227
  c,
210
- assertion,
228
+ assertions,
211
229
  negative,
212
230
  visited
213
231
  ) {
214
232
  if (alignment.relationType == Relation.NARROWS)
215
233
  await this.processAssertionsBooleanPerAssertion(
216
- assertion,
234
+ assertions,
217
235
  negative,
218
236
  c,
219
237
  visited
220
238
  );
221
239
  else if (alignment.relationType == Relation.IS_EQUIVALENT_TO)
222
240
  await this.processAssertionsBooleanPerAssertion(
223
- assertion,
241
+ assertions,
224
242
  negative,
225
243
  c,
226
244
  visited
@@ -229,20 +247,20 @@ module.exports = class EcFrameworkGraph extends EcDirectedGraph {
229
247
  async processAssertionBooleanInward(
230
248
  alignment,
231
249
  c,
232
- assertion,
250
+ assertions,
233
251
  negative,
234
252
  visited
235
253
  ) {
236
254
  if (alignment.relationType == Relation.REQUIRES)
237
255
  await this.processAssertionsBooleanPerAssertion(
238
- assertion,
256
+ assertions,
239
257
  negative,
240
258
  c,
241
259
  visited
242
260
  );
243
261
  else if (alignment.relationType == Relation.IS_EQUIVALENT_TO)
244
262
  await this.processAssertionsBooleanPerAssertion(
245
- assertion,
263
+ assertions,
246
264
  negative,
247
265
  c,
248
266
  visited
@@ -248,6 +248,7 @@ describe("EcFrameworkGraph", () => {
248
248
  () => {}
249
249
  ).then(() => {
250
250
  let result = [];
251
+ console.log(fg.getMetaStateCompetency(c));
251
252
  result.push(fg.getMetaStateCompetency(c)["positiveAssertion"]?.length);
252
253
  result.push(fg.getMetaStateCompetency(c)["negativeAssertion"]?.length);
253
254
  return result;
@@ -1,3 +1,4 @@
1
+ const EcArray = require("../../../com/eduworks/ec/array/EcArray");
1
2
  const EcObject = require("../../../com/eduworks/ec/array/EcObject");
2
3
  const EcRepository = require("../../cassproject/ebac/repository/EcRepository");
3
4
 
@@ -237,7 +238,11 @@ module.exports = class CSVImport {
237
238
  ) {
238
239
  continue;
239
240
  } else {
240
- competency[colNames[idx]] = tabularData[i][idx];
241
+ if ((name === 'owner' || name === 'reader') && !EcArray.isArray(tabularData[i][idx])) {
242
+ competency[colNames[idx]] = [tabularData[i][idx]];
243
+ } else {
244
+ competency[colNames[idx]] = tabularData[i][idx];
245
+ }
241
246
  }
242
247
  }
243
248
  competencies.push(competency);