@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.
@@ -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('An ontology with this prefix is already registered');
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('If preserveContextUri is true, jsonldContext must be one or more URI');
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) throw new Error('The ontology JSON-LD context is in conflict with the existing JSON-LD context');
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) {
@@ -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
  }
@@ -11,6 +11,9 @@
11
11
  },
12
12
  "dc:creator": {
13
13
  "@type": "@id"
14
+ },
15
+ "dc:source": {
16
+ "@type": "@id"
14
17
  }
15
18
  }
16
19
  }
@@ -8,6 +8,7 @@ module.exports = {
8
8
  rdfs: require('./rdfs.json'),
9
9
  sec: require('./sec.json'),
10
10
  semapps: require('./semapps.json'),
11
+ skos: require('./skos.json'),
11
12
  vcard: require('./vcard.json'),
12
13
  void: require('./void.json'),
13
14
  xsd: require('./xsd.json')
@@ -0,0 +1,4 @@
1
+ {
2
+ "prefix": "skos",
3
+ "namespace": "http://www.w3.org/2008/05/skos#"
4
+ }
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@semapps/ontologies",
3
- "version": "0.6.0-alpha.7",
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.7",
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": "7af60c59fc7524fe32a5931ba9609d55b228fea5"
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
  }