@semapps/ontologies 0.6.0-alpha.7 → 0.6.0-alpha.9
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/actions/register.js +8 -3
- package/ontologies/core/acl.json +22 -1
- package/ontologies/core/dc.json +3 -0
- package/ontologies/core/index.js +1 -0
- package/ontologies/core/skos.json +4 -0
- package/package.json +3 -3
- package/service.js +3 -0
package/actions/register.js
CHANGED
|
@@ -20,12 +20,14 @@ module.exports = {
|
|
|
20
20
|
const ontology = await this.actions.get({ prefix }, { parentCtx: ctx });
|
|
21
21
|
|
|
22
22
|
if (!overwrite && ontology) {
|
|
23
|
-
throw new Error(
|
|
23
|
+
throw new Error(`Cannot register ${prefix} ontology. An ontology with the prefix is already registered`);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
if (preserveContextUri === true) {
|
|
27
27
|
if (!jsonldContext || !arrayOf(jsonldContext).every(context => isURL(context))) {
|
|
28
|
-
throw new Error(
|
|
28
|
+
throw new Error(
|
|
29
|
+
`Cannot register ${prefix} ontology. If preserveContextUri is true, jsonldContext must be one or more URI`
|
|
30
|
+
);
|
|
29
31
|
}
|
|
30
32
|
}
|
|
31
33
|
|
|
@@ -35,7 +37,10 @@ module.exports = {
|
|
|
35
37
|
const existingContext = await ctx.call('jsonld.context.get');
|
|
36
38
|
const newContext = [].concat(existingContext, jsonldContext);
|
|
37
39
|
const isValid = await ctx.call('jsonld.context.validate', { context: newContext });
|
|
38
|
-
if (!isValid)
|
|
40
|
+
if (!isValid)
|
|
41
|
+
throw new Error(
|
|
42
|
+
`Cannot register ${prefix} ontology. The ontology's JSON-LD context is in conflict with the existing JSON-LD context`
|
|
43
|
+
);
|
|
39
44
|
}
|
|
40
45
|
|
|
41
46
|
if (this.settings.persistRegistry) {
|
package/ontologies/core/acl.json
CHANGED
|
@@ -1,4 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"prefix": "acl",
|
|
3
|
-
"namespace": "http://www.w3.org/ns/auth/acl#"
|
|
3
|
+
"namespace": "http://www.w3.org/ns/auth/acl#",
|
|
4
|
+
"jsonldContext": {
|
|
5
|
+
"xsd": "http://www.w3.org/2001/XMLSchema#",
|
|
6
|
+
"acl:accessTo": {
|
|
7
|
+
"@type": "@id"
|
|
8
|
+
},
|
|
9
|
+
"acl:agent": {
|
|
10
|
+
"@type": "@id"
|
|
11
|
+
},
|
|
12
|
+
"acl:agentGroup": {
|
|
13
|
+
"@type": "@id"
|
|
14
|
+
},
|
|
15
|
+
"acl:agentClass": {
|
|
16
|
+
"@type": "@id"
|
|
17
|
+
},
|
|
18
|
+
"acl:default": {
|
|
19
|
+
"@type": "@id"
|
|
20
|
+
},
|
|
21
|
+
"acl:mode": {
|
|
22
|
+
"@type": "@id"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
4
25
|
}
|
package/ontologies/core/dc.json
CHANGED
package/ontologies/core/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semapps/ontologies",
|
|
3
|
-
"version": "0.6.0-alpha.
|
|
3
|
+
"version": "0.6.0-alpha.9",
|
|
4
4
|
"description": "SemApps ontologies",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Virtual Assembly",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@semapps/triplestore": "0.6.0-alpha.
|
|
8
|
+
"@semapps/triplestore": "0.6.0-alpha.9",
|
|
9
9
|
"moleculer-db": "^0.8.16",
|
|
10
10
|
"node-fetch": "^2.6.6"
|
|
11
11
|
},
|
|
@@ -15,5 +15,5 @@
|
|
|
15
15
|
"engines": {
|
|
16
16
|
"node": ">=14"
|
|
17
17
|
},
|
|
18
|
-
"gitHead": "
|
|
18
|
+
"gitHead": "141e537ab60a0cdb1f6a2eae268e21086cad3db4"
|
|
19
19
|
}
|
package/service.js
CHANGED
|
@@ -44,6 +44,9 @@ module.exports = {
|
|
|
44
44
|
async registerAll() {
|
|
45
45
|
if (this.settings.persistRegistry) await this.broker.waitForServices(['ontologies.registry']);
|
|
46
46
|
for (const ontology of this.settings.ontologies) {
|
|
47
|
+
if (!ontology || !ontology.prefix || !ontology.namespace) {
|
|
48
|
+
throw new Error(`Cannot register ontologies ! At least one ontology is incorrect.`);
|
|
49
|
+
}
|
|
47
50
|
await this.actions.register({ ...ontology, overwrite: true });
|
|
48
51
|
}
|
|
49
52
|
}
|