@semapps/ontologies 0.6.0-alpha.6 → 0.6.0-alpha.8
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/get.js +14 -6
- package/ontologies/core/acl.json +22 -1
- package/package.json +3 -3
package/actions/get.js
CHANGED
|
@@ -8,25 +8,33 @@ module.exports = {
|
|
|
8
8
|
cache: true,
|
|
9
9
|
async handler(ctx) {
|
|
10
10
|
let { prefix, namespace, uri } = ctx.params;
|
|
11
|
+
let ontology;
|
|
12
|
+
|
|
11
13
|
if (!prefix && !namespace && !uri) throw new Error('You must provide a prefix, namespace or uri parameter');
|
|
12
14
|
|
|
13
15
|
if (this.settings.persistRegistry) {
|
|
14
16
|
if (prefix) {
|
|
15
|
-
|
|
17
|
+
ontology = await ctx.call('ontologies.registry.getByPrefix', { prefix });
|
|
16
18
|
} else if (namespace) {
|
|
17
|
-
|
|
19
|
+
ontology = await ctx.call('ontologies.registry.getByNamespace', { namespace });
|
|
18
20
|
} else if (uri) {
|
|
19
21
|
const ontologies = await ctx.call('ontologies.registry.list');
|
|
20
|
-
|
|
22
|
+
ontology = ontologies.find(o => uri.startsWith(o.namespace));
|
|
21
23
|
}
|
|
22
24
|
} else {
|
|
23
25
|
if (prefix) {
|
|
24
|
-
|
|
26
|
+
ontology = this.ontologies[prefix] || false;
|
|
25
27
|
} else if (namespace) {
|
|
26
|
-
|
|
28
|
+
ontology = Object.values(this.ontologies).find(o => o.namespace === namespace);
|
|
27
29
|
} else if (uri) {
|
|
28
|
-
|
|
30
|
+
ontology = Object.values(this.ontologies).find(o => uri.startsWith(o.namespace));
|
|
29
31
|
}
|
|
30
32
|
}
|
|
33
|
+
|
|
34
|
+
// Must return null if no results, because the cache JsonSerializer cannot handle undefined values
|
|
35
|
+
// https://moleculer.services/docs/0.14/networking.html#JSON-serializer
|
|
36
|
+
if (ontology === undefined) ontology = null;
|
|
37
|
+
|
|
38
|
+
return ontology;
|
|
31
39
|
}
|
|
32
40
|
};
|
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/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.8",
|
|
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.8",
|
|
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": "6aee92c56df080421ee5e5dadea7395dfa4cf9a2"
|
|
19
19
|
}
|