@semapps/ontologies 1.1.4 → 1.2.1

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.
Files changed (102) hide show
  1. package/actions/{findNamespace.js → findNamespace.ts} +7 -3
  2. package/actions/{findPrefix.js → findPrefix.ts} +8 -4
  3. package/actions/{get.js → get.ts} +8 -2
  4. package/actions/getPrefixes.ts +16 -0
  5. package/actions/getRdfPrefixes.ts +15 -0
  6. package/actions/list.ts +11 -0
  7. package/actions/{prefixToUri.js → prefixToUri.ts} +8 -3
  8. package/actions/{register.js → register.ts} +11 -3
  9. package/dist/actions/findNamespace.d.ts +8 -0
  10. package/dist/actions/findNamespace.js +19 -0
  11. package/dist/actions/findNamespace.js.map +1 -0
  12. package/dist/actions/findPrefix.d.ts +8 -0
  13. package/dist/actions/findPrefix.js +23 -0
  14. package/dist/actions/findPrefix.js.map +1 -0
  15. package/dist/actions/get.d.ts +20 -0
  16. package/dist/actions/get.js +34 -0
  17. package/dist/actions/get.js.map +1 -0
  18. package/dist/actions/getPrefixes.d.ts +8 -0
  19. package/dist/actions/getPrefixes.js +12 -0
  20. package/dist/actions/getPrefixes.js.map +1 -0
  21. package/dist/actions/getRdfPrefixes.d.ts +6 -0
  22. package/dist/actions/getRdfPrefixes.js +13 -0
  23. package/dist/actions/getRdfPrefixes.js.map +1 -0
  24. package/dist/actions/list.d.ts +6 -0
  25. package/dist/actions/list.js +9 -0
  26. package/dist/actions/list.js.map +1 -0
  27. package/dist/actions/prefixToUri.d.ts +9 -0
  28. package/dist/actions/prefixToUri.js +27 -0
  29. package/dist/actions/prefixToUri.js.map +1 -0
  30. package/dist/actions/register.d.ts +28 -0
  31. package/dist/actions/register.js +59 -0
  32. package/dist/actions/register.js.map +1 -0
  33. package/dist/index.d.ts +7 -0
  34. package/dist/index.js +8 -0
  35. package/dist/index.js.map +1 -0
  36. package/dist/ontologies/core/acl.json +28 -0
  37. package/dist/ontologies/core/as.json +6 -0
  38. package/dist/ontologies/core/cred.json +22 -0
  39. package/dist/ontologies/core/dc.json +19 -0
  40. package/dist/ontologies/core/did.json +19 -0
  41. package/dist/ontologies/core/foaf.json +4 -0
  42. package/dist/ontologies/core/index.d.ts +16 -0
  43. package/dist/ontologies/core/index.js +17 -0
  44. package/dist/ontologies/core/index.js.map +1 -0
  45. package/dist/ontologies/core/ldp.json +4 -0
  46. package/dist/ontologies/core/rdf.json +4 -0
  47. package/dist/ontologies/core/rdfs.json +7 -0
  48. package/dist/ontologies/core/sec.json +88 -0
  49. package/dist/ontologies/core/semapps.json +12 -0
  50. package/dist/ontologies/core/skos.json +4 -0
  51. package/dist/ontologies/core/vcard.json +15 -0
  52. package/dist/ontologies/core/void.json +23 -0
  53. package/dist/ontologies/core/xsd.json +4 -0
  54. package/dist/ontologies/custom/index.d.ts +10 -0
  55. package/dist/ontologies/custom/index.js +11 -0
  56. package/dist/ontologies/custom/index.js.map +1 -0
  57. package/dist/ontologies/custom/mp.json +4 -0
  58. package/dist/ontologies/custom/oasis.json +4 -0
  59. package/dist/ontologies/custom/og.json +13 -0
  60. package/dist/ontologies/custom/pair.json +329 -0
  61. package/dist/ontologies/custom/petr.json +4 -0
  62. package/dist/ontologies/custom/schema.json +4 -0
  63. package/dist/ontologies/custom/skos.json +13 -0
  64. package/dist/ontologies/custom/syreen.json +43 -0
  65. package/dist/ontologies/custom/tutor.json +26 -0
  66. package/dist/ontologies/solid/apods.json +82 -0
  67. package/dist/ontologies/solid/index.d.ts +7 -0
  68. package/dist/ontologies/solid/index.js +8 -0
  69. package/dist/ontologies/solid/index.js.map +1 -0
  70. package/dist/ontologies/solid/interop.json +124 -0
  71. package/dist/ontologies/solid/notify.json +62 -0
  72. package/dist/ontologies/solid/oidc.json +22 -0
  73. package/dist/ontologies/solid/pim.json +15 -0
  74. package/dist/ontologies/solid/solid.json +27 -0
  75. package/dist/service.d.ts +108 -0
  76. package/dist/service.js +56 -0
  77. package/dist/service.js.map +1 -0
  78. package/dist/sub-services/registry.d.ts +32 -0
  79. package/dist/sub-services/registry.js +52 -0
  80. package/dist/sub-services/registry.js.map +1 -0
  81. package/dist/tsconfig.tsbuildinfo +1 -0
  82. package/dist/utils.d.ts +3 -0
  83. package/dist/utils.js +15 -0
  84. package/dist/utils.js.map +1 -0
  85. package/index.ts +9 -0
  86. package/ontologies/core/index.ts +34 -0
  87. package/ontologies/custom/index.ts +11 -0
  88. package/ontologies/solid/apods.json +3 -0
  89. package/ontologies/solid/index.ts +8 -0
  90. package/package.json +16 -5
  91. package/{service.js → service.ts} +25 -13
  92. package/sub-services/registry.ts +66 -0
  93. package/tsconfig.json +10 -0
  94. package/{utils.js → utils.ts} +3 -7
  95. package/actions/getPrefixes.js +0 -12
  96. package/actions/getRdfPrefixes.js +0 -11
  97. package/actions/list.js +0 -7
  98. package/index.js +0 -16
  99. package/ontologies/core/index.js +0 -17
  100. package/ontologies/custom/index.js +0 -11
  101. package/ontologies/solid/index.js +0 -8
  102. package/sub-services/registry.js +0 -44
@@ -1,8 +1,10 @@
1
- const fetch = require('node-fetch');
1
+ import fetch from 'node-fetch';
2
+ import type { ActionSchema } from 'moleculer';
2
3
 
3
- module.exports = {
4
+ const Schema = {
4
5
  visibility: 'public',
5
6
  params: {
7
+ // @ts-expect-error TS(2322): Type 'string' is not assignable to type 'Parameter... Remove this comment to see the full error message
6
8
  prefix: 'string'
7
9
  },
8
10
  async handler(ctx) {
@@ -18,4 +20,6 @@ module.exports = {
18
20
 
19
21
  return null;
20
22
  }
21
- };
23
+ } satisfies ActionSchema;
24
+
25
+ export default Schema;
@@ -1,9 +1,11 @@
1
- const fetch = require('node-fetch');
2
- const { isURL } = require('../utils');
1
+ import fetch from 'node-fetch';
2
+ import type { ActionSchema } from 'moleculer';
3
+ import { isURL } from '../utils.ts';
3
4
 
4
- module.exports = {
5
+ const Schema = {
5
6
  visibility: 'public',
6
7
  params: {
8
+ // @ts-expect-error TS(2322): Type 'string' is not assignable to type 'Parameter... Remove this comment to see the full error message
7
9
  uri: 'string'
8
10
  },
9
11
  async handler(ctx) {
@@ -23,4 +25,6 @@ module.exports = {
23
25
 
24
26
  return null;
25
27
  }
26
- };
28
+ } satisfies ActionSchema;
29
+
30
+ export default Schema;
@@ -1,4 +1,6 @@
1
- module.exports = {
1
+ import type { ActionSchema } from 'moleculer';
2
+
3
+ const Schema = {
2
4
  visibility: 'public',
3
5
  params: {
4
6
  prefix: { type: 'string', optional: true },
@@ -13,8 +15,10 @@ module.exports = {
13
15
  if (prefix) {
14
16
  ontology = this.ontologies[prefix] || false;
15
17
  } else if (namespace) {
18
+ // @ts-expect-error TS(18046): 'o' is of type 'unknown'.
16
19
  ontology = Object.values(this.ontologies).find(o => o.namespace === namespace);
17
20
  } else if (uri) {
21
+ // @ts-expect-error TS(18046): 'o' is of type 'unknown'.
18
22
  ontology = Object.values(this.ontologies).find(o => uri.startsWith(o.namespace));
19
23
  } else {
20
24
  throw new Error('You must provide a prefix, namespace or uri parameter');
@@ -26,4 +30,6 @@ module.exports = {
26
30
 
27
31
  return ontology;
28
32
  }
29
- };
33
+ } satisfies ActionSchema;
34
+
35
+ export default Schema;
@@ -0,0 +1,16 @@
1
+ import type { ActionSchema } from 'moleculer';
2
+
3
+ const Schema = {
4
+ visibility: 'public',
5
+ cache: true,
6
+ async handler(ctx) {
7
+ const ontologies = await this.actions.list({}, { parentCtx: ctx });
8
+ return Object.fromEntries(
9
+ ontologies
10
+ .sort((a: any, b: any) => (a.prefix < b.prefix ? -1 : a.prefix > b.prefix ? 1 : 0))
11
+ .map((ontology: any) => [ontology.prefix, ontology.namespace])
12
+ );
13
+ }
14
+ } satisfies ActionSchema;
15
+
16
+ export default Schema;
@@ -0,0 +1,15 @@
1
+ import type { ActionSchema } from 'moleculer';
2
+
3
+ const Schema = {
4
+ visibility: 'public',
5
+ cache: true,
6
+ async handler(ctx) {
7
+ const ontologies = await this.actions.list({}, { parentCtx: ctx });
8
+ return ontologies
9
+ .sort((a: any, b: any) => (a.prefix < b.prefix ? -1 : a.prefix > b.prefix ? 1 : 0))
10
+ .map((ontology: any) => `PREFIX ${ontology.prefix}: <${ontology.namespace}>`)
11
+ .join('\n');
12
+ }
13
+ } satisfies ActionSchema;
14
+
15
+ export default Schema;
@@ -0,0 +1,11 @@
1
+ import type { ActionSchema } from 'moleculer';
2
+
3
+ const Schema = {
4
+ visibility: 'public',
5
+ cache: true,
6
+ handler() {
7
+ return Object.values(this.ontologies);
8
+ }
9
+ } satisfies ActionSchema;
10
+
11
+ export default Schema;
@@ -1,10 +1,12 @@
1
- const { isURL } = require('../utils');
1
+ import type { ActionSchema } from 'moleculer';
2
+ import { isURL } from '../utils.ts';
2
3
 
3
4
  const regexPrefix = /^([^:]+):([^:]+)$/gm;
4
5
 
5
- module.exports = {
6
+ const Schema = {
6
7
  visibility: 'public',
7
8
  params: {
9
+ // @ts-expect-error TS(2322): Type 'string' is not assignable to type 'Parameter... Remove this comment to see the full error message
8
10
  value: 'string'
9
11
  },
10
12
  cache: true,
@@ -17,6 +19,7 @@ module.exports = {
17
19
  if (!value.match(regexPrefix)) throw new Error(`The provided value ${value} is neither prefixed, nor a full URI`);
18
20
 
19
21
  const matchResults = regexPrefix.exec(value);
22
+ // @ts-expect-error TS(18047): 'matchResults' is possibly 'null'.
20
23
  const prefix = matchResults[1];
21
24
 
22
25
  const ontology = await this.actions.get({ prefix });
@@ -24,4 +27,6 @@ module.exports = {
24
27
 
25
28
  return value.replace(`${ontology.prefix}:`, ontology.namespace);
26
29
  }
27
- };
30
+ } satisfies ActionSchema;
31
+
32
+ export default Schema;
@@ -1,17 +1,23 @@
1
- const { isURL, arrayOf } = require('../utils');
1
+ import type { ActionSchema } from 'moleculer';
2
+ import { isURL, arrayOf } from '../utils.ts';
2
3
 
3
- module.exports = {
4
+ const Schema = {
4
5
  visibility: 'public',
5
6
  params: {
7
+ // @ts-expect-error TS(2322): Type 'string' is not assignable to type 'Parameter... Remove this comment to see the full error message
6
8
  prefix: 'string',
9
+ // @ts-expect-error TS(2322): Type 'string' is not assignable to type 'Parameter... Remove this comment to see the full error message
7
10
  namespace: 'string',
8
11
  owl: { type: 'string', optional: true },
9
12
  jsonldContext: {
10
13
  type: 'multi',
14
+ // @ts-expect-error TS(2322): Type '{ type: "array"; }' is not assignable to typ... Remove this comment to see the full error message
11
15
  rules: [{ type: 'array' }, { type: 'object' }, { type: 'string' }],
12
16
  optional: true
13
17
  },
18
+ // @ts-expect-error TS(2322): Type '{ type: "boolean"; default: false; }' is not... Remove this comment to see the full error message
14
19
  preserveContextUri: { type: 'boolean', default: false },
20
+ // @ts-expect-error TS(2322): Type '{ type: "boolean"; default: false; }' is not... Remove this comment to see the full error message
15
21
  persist: { type: 'boolean', default: false }
16
22
  },
17
23
  async handler(ctx) {
@@ -56,4 +62,6 @@ module.exports = {
56
62
 
57
63
  ctx.emit('ontologies.registered', { prefix, namespace, owl, jsonldContext, preserveContextUri });
58
64
  }
59
- };
65
+ } satisfies ActionSchema;
66
+
67
+ export default Schema;
@@ -0,0 +1,8 @@
1
+ declare const Schema: {
2
+ visibility: "public";
3
+ params: {
4
+ prefix: string;
5
+ };
6
+ handler(ctx: import("moleculer").Context<any, any, import("moleculer").GenericObject>): Promise<any>;
7
+ };
8
+ export default Schema;
@@ -0,0 +1,19 @@
1
+ import fetch from 'node-fetch';
2
+ const Schema = {
3
+ visibility: 'public',
4
+ params: {
5
+ // @ts-expect-error TS(2322): Type 'string' is not assignable to type 'Parameter... Remove this comment to see the full error message
6
+ prefix: 'string'
7
+ },
8
+ async handler(ctx) {
9
+ const { prefix } = ctx.params;
10
+ const response = await fetch(`http://prefix.cc/${prefix}.file.json`);
11
+ if (response.ok) {
12
+ const json = await response.json();
13
+ return json && json[prefix];
14
+ }
15
+ return null;
16
+ }
17
+ };
18
+ export default Schema;
19
+ //# sourceMappingURL=findNamespace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findNamespace.js","sourceRoot":"","sources":["../../actions/findNamespace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,YAAY,CAAC;AAG/B,MAAM,MAAM,GAAG;IACb,UAAU,EAAE,QAAQ;IACpB,MAAM,EAAE;QACN,qIAAqI;QACrI,MAAM,EAAE,QAAQ;KACjB;IACD,KAAK,CAAC,OAAO,CAAC,GAAG;QACf,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC;QAE9B,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,oBAAoB,MAAM,YAAY,CAAC,CAAC;QAErE,IAAI,QAAQ,CAAC,EAAE,EAAE,CAAC;YAChB,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;YAEnC,OAAO,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC;QAC9B,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACqB,CAAC;AAEzB,eAAe,MAAM,CAAC"}
@@ -0,0 +1,8 @@
1
+ declare const Schema: {
2
+ visibility: "public";
3
+ params: {
4
+ uri: string;
5
+ };
6
+ handler(ctx: import("moleculer").Context<any, any, import("moleculer").GenericObject>): Promise<string | null | undefined>;
7
+ };
8
+ export default Schema;
@@ -0,0 +1,23 @@
1
+ import fetch from 'node-fetch';
2
+ import { isURL } from "../utils.js";
3
+ const Schema = {
4
+ visibility: 'public',
5
+ params: {
6
+ // @ts-expect-error TS(2322): Type 'string' is not assignable to type 'Parameter... Remove this comment to see the full error message
7
+ uri: 'string'
8
+ },
9
+ async handler(ctx) {
10
+ const { uri } = ctx.params;
11
+ if (!isURL(uri))
12
+ throw new Error(`The uri param of the ontologies.findPrefix action must be a full URL`);
13
+ const response = await fetch(`http://prefix.cc/?q=${encodeURIComponent(uri)}`, { redirect: 'manual' });
14
+ if (response.status === 302) {
15
+ const redirectUrl = response.headers.get('Location');
16
+ const result = redirectUrl?.replace('http://prefix.cc/', '').split(':');
17
+ return result && result[0];
18
+ }
19
+ return null;
20
+ }
21
+ };
22
+ export default Schema;
23
+ //# sourceMappingURL=findPrefix.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findPrefix.js","sourceRoot":"","sources":["../../actions/findPrefix.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,YAAY,CAAC;AAE/B,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,MAAM,MAAM,GAAG;IACb,UAAU,EAAE,QAAQ;IACpB,MAAM,EAAE;QACN,qIAAqI;QACrI,GAAG,EAAE,QAAQ;KACd;IACD,KAAK,CAAC,OAAO,CAAC,GAAG;QACf,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC;QAE3B,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,sEAAsE,CAAC,CAAC;QAEzG,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,uBAAuB,kBAAkB,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC;QAEvG,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;YAC5B,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YAErD,MAAM,MAAM,GAAG,WAAW,EAAE,OAAO,CAAC,mBAAmB,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAExE,OAAO,MAAM,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC;QAC7B,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACqB,CAAC;AAEzB,eAAe,MAAM,CAAC"}
@@ -0,0 +1,20 @@
1
+ declare const Schema: {
2
+ visibility: "public";
3
+ params: {
4
+ prefix: {
5
+ type: string;
6
+ optional: boolean;
7
+ };
8
+ namespace: {
9
+ type: string;
10
+ optional: boolean;
11
+ };
12
+ uri: {
13
+ type: string;
14
+ optional: boolean;
15
+ };
16
+ };
17
+ cache: true;
18
+ handler(ctx: import("moleculer").Context<any, any, import("moleculer").GenericObject>): Promise<any>;
19
+ };
20
+ export default Schema;
@@ -0,0 +1,34 @@
1
+ const Schema = {
2
+ visibility: 'public',
3
+ params: {
4
+ prefix: { type: 'string', optional: true },
5
+ namespace: { type: 'string', optional: true },
6
+ uri: { type: 'string', optional: true }
7
+ },
8
+ cache: true,
9
+ async handler(ctx) {
10
+ let { prefix, namespace, uri } = ctx.params;
11
+ let ontology;
12
+ if (prefix) {
13
+ ontology = this.ontologies[prefix] || false;
14
+ }
15
+ else if (namespace) {
16
+ // @ts-expect-error TS(18046): 'o' is of type 'unknown'.
17
+ ontology = Object.values(this.ontologies).find(o => o.namespace === namespace);
18
+ }
19
+ else if (uri) {
20
+ // @ts-expect-error TS(18046): 'o' is of type 'unknown'.
21
+ ontology = Object.values(this.ontologies).find(o => uri.startsWith(o.namespace));
22
+ }
23
+ else {
24
+ throw new Error('You must provide a prefix, namespace or uri parameter');
25
+ }
26
+ // Must return null if no results, because the cache JsonSerializer cannot handle undefined values
27
+ // https://moleculer.services/docs/0.14/networking.html#JSON-serializer
28
+ if (ontology === undefined)
29
+ ontology = null;
30
+ return ontology;
31
+ }
32
+ };
33
+ export default Schema;
34
+ //# sourceMappingURL=get.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get.js","sourceRoot":"","sources":["../../actions/get.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,GAAG;IACb,UAAU,EAAE,QAAQ;IACpB,MAAM,EAAE;QACN,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC1C,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC7C,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE;KACxC;IACD,KAAK,EAAE,IAAI;IACX,KAAK,CAAC,OAAO,CAAC,GAAG;QACf,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC;QAC5C,IAAI,QAAQ,CAAC;QAEb,IAAI,MAAM,EAAE,CAAC;YACX,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC;QAC9C,CAAC;aAAM,IAAI,SAAS,EAAE,CAAC;YACrB,wDAAwD;YACxD,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC;QACjF,CAAC;aAAM,IAAI,GAAG,EAAE,CAAC;YACf,wDAAwD;YACxD,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;QACnF,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;QAC3E,CAAC;QAED,kGAAkG;QAClG,uEAAuE;QACvE,IAAI,QAAQ,KAAK,SAAS;YAAE,QAAQ,GAAG,IAAI,CAAC;QAE5C,OAAO,QAAQ,CAAC;IAClB,CAAC;CACqB,CAAC;AAEzB,eAAe,MAAM,CAAC"}
@@ -0,0 +1,8 @@
1
+ declare const Schema: {
2
+ visibility: "public";
3
+ cache: true;
4
+ handler(ctx: import("moleculer").Context<any, any, import("moleculer").GenericObject>): Promise<{
5
+ [k: string]: any;
6
+ }>;
7
+ };
8
+ export default Schema;
@@ -0,0 +1,12 @@
1
+ const Schema = {
2
+ visibility: 'public',
3
+ cache: true,
4
+ async handler(ctx) {
5
+ const ontologies = await this.actions.list({}, { parentCtx: ctx });
6
+ return Object.fromEntries(ontologies
7
+ .sort((a, b) => (a.prefix < b.prefix ? -1 : a.prefix > b.prefix ? 1 : 0))
8
+ .map((ontology) => [ontology.prefix, ontology.namespace]));
9
+ }
10
+ };
11
+ export default Schema;
12
+ //# sourceMappingURL=getPrefixes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getPrefixes.js","sourceRoot":"","sources":["../../actions/getPrefixes.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,GAAG;IACb,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAE,IAAI;IACX,KAAK,CAAC,OAAO,CAAC,GAAG;QACf,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC;QACnE,OAAO,MAAM,CAAC,WAAW,CACvB,UAAU;aACP,IAAI,CAAC,CAAC,CAAM,EAAE,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;aAClF,GAAG,CAAC,CAAC,QAAa,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC,CACjE,CAAC;IACJ,CAAC;CACqB,CAAC;AAEzB,eAAe,MAAM,CAAC"}
@@ -0,0 +1,6 @@
1
+ declare const Schema: {
2
+ visibility: "public";
3
+ cache: true;
4
+ handler(ctx: import("moleculer").Context<any, any, import("moleculer").GenericObject>): Promise<any>;
5
+ };
6
+ export default Schema;
@@ -0,0 +1,13 @@
1
+ const Schema = {
2
+ visibility: 'public',
3
+ cache: true,
4
+ async handler(ctx) {
5
+ const ontologies = await this.actions.list({}, { parentCtx: ctx });
6
+ return ontologies
7
+ .sort((a, b) => (a.prefix < b.prefix ? -1 : a.prefix > b.prefix ? 1 : 0))
8
+ .map((ontology) => `PREFIX ${ontology.prefix}: <${ontology.namespace}>`)
9
+ .join('\n');
10
+ }
11
+ };
12
+ export default Schema;
13
+ //# sourceMappingURL=getRdfPrefixes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getRdfPrefixes.js","sourceRoot":"","sources":["../../actions/getRdfPrefixes.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,GAAG;IACb,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAE,IAAI;IACX,KAAK,CAAC,OAAO,CAAC,GAAG;QACf,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC;QACnE,OAAO,UAAU;aACd,IAAI,CAAC,CAAC,CAAM,EAAE,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;aAClF,GAAG,CAAC,CAAC,QAAa,EAAE,EAAE,CAAC,UAAU,QAAQ,CAAC,MAAM,MAAM,QAAQ,CAAC,SAAS,GAAG,CAAC;aAC5E,IAAI,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;CACqB,CAAC;AAEzB,eAAe,MAAM,CAAC"}
@@ -0,0 +1,6 @@
1
+ declare const Schema: {
2
+ visibility: "public";
3
+ cache: true;
4
+ handler(): unknown[];
5
+ };
6
+ export default Schema;
@@ -0,0 +1,9 @@
1
+ const Schema = {
2
+ visibility: 'public',
3
+ cache: true,
4
+ handler() {
5
+ return Object.values(this.ontologies);
6
+ }
7
+ };
8
+ export default Schema;
9
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../../actions/list.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,GAAG;IACb,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAE,IAAI;IACX,OAAO;QACL,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACxC,CAAC;CACqB,CAAC;AAEzB,eAAe,MAAM,CAAC"}
@@ -0,0 +1,9 @@
1
+ declare const Schema: {
2
+ visibility: "public";
3
+ params: {
4
+ value: string;
5
+ };
6
+ cache: true;
7
+ handler(ctx: import("moleculer").Context<any, any, import("moleculer").GenericObject>): Promise<any>;
8
+ };
9
+ export default Schema;
@@ -0,0 +1,27 @@
1
+ import { isURL } from "../utils.js";
2
+ const regexPrefix = /^([^:]+):([^:]+)$/gm;
3
+ const Schema = {
4
+ visibility: 'public',
5
+ params: {
6
+ // @ts-expect-error TS(2322): Type 'string' is not assignable to type 'Parameter... Remove this comment to see the full error message
7
+ value: 'string'
8
+ },
9
+ cache: true,
10
+ async handler(ctx) {
11
+ const { value } = ctx.params;
12
+ // Check if this is already a full URI
13
+ if (isURL(value))
14
+ return value;
15
+ if (!value.match(regexPrefix))
16
+ throw new Error(`The provided value ${value} is neither prefixed, nor a full URI`);
17
+ const matchResults = regexPrefix.exec(value);
18
+ // @ts-expect-error TS(18047): 'matchResults' is possibly 'null'.
19
+ const prefix = matchResults[1];
20
+ const ontology = await this.actions.get({ prefix });
21
+ if (!ontology)
22
+ throw new Error(`No ontology found with prefix ${prefix}`);
23
+ return value.replace(`${ontology.prefix}:`, ontology.namespace);
24
+ }
25
+ };
26
+ export default Schema;
27
+ //# sourceMappingURL=prefixToUri.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prefixToUri.js","sourceRoot":"","sources":["../../actions/prefixToUri.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,MAAM,WAAW,GAAG,qBAAqB,CAAC;AAE1C,MAAM,MAAM,GAAG;IACb,UAAU,EAAE,QAAQ;IACpB,MAAM,EAAE;QACN,qIAAqI;QACrI,KAAK,EAAE,QAAQ;KAChB;IACD,KAAK,EAAE,IAAI;IACX,KAAK,CAAC,OAAO,CAAC,GAAG;QACf,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC;QAE7B,sCAAsC;QACtC,IAAI,KAAK,CAAC,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC;QAE/B,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,sBAAsB,KAAK,sCAAsC,CAAC,CAAC;QAElH,MAAM,YAAY,GAAG,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC7C,iEAAiE;QACjE,MAAM,MAAM,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;QAE/B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;QACpD,IAAI,CAAC,QAAQ;YAAE,MAAM,IAAI,KAAK,CAAC,iCAAiC,MAAM,EAAE,CAAC,CAAC;QAE1E,OAAO,KAAK,CAAC,OAAO,CAAC,GAAG,QAAQ,CAAC,MAAM,GAAG,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;IAClE,CAAC;CACqB,CAAC;AAEzB,eAAe,MAAM,CAAC"}
@@ -0,0 +1,28 @@
1
+ declare const Schema: {
2
+ visibility: "public";
3
+ params: {
4
+ prefix: string;
5
+ namespace: string;
6
+ owl: {
7
+ type: string;
8
+ optional: boolean;
9
+ };
10
+ jsonldContext: {
11
+ type: string;
12
+ rules: {
13
+ type: string;
14
+ }[];
15
+ optional: boolean;
16
+ };
17
+ preserveContextUri: {
18
+ type: string;
19
+ default: boolean;
20
+ };
21
+ persist: {
22
+ type: string;
23
+ default: boolean;
24
+ };
25
+ };
26
+ handler(ctx: import("moleculer").Context<any, any, import("moleculer").GenericObject>): Promise<void>;
27
+ };
28
+ export default Schema;
@@ -0,0 +1,59 @@
1
+ import { isURL, arrayOf } from "../utils.js";
2
+ const Schema = {
3
+ visibility: 'public',
4
+ params: {
5
+ // @ts-expect-error TS(2322): Type 'string' is not assignable to type 'Parameter... Remove this comment to see the full error message
6
+ prefix: 'string',
7
+ // @ts-expect-error TS(2322): Type 'string' is not assignable to type 'Parameter... Remove this comment to see the full error message
8
+ namespace: 'string',
9
+ owl: { type: 'string', optional: true },
10
+ jsonldContext: {
11
+ type: 'multi',
12
+ // @ts-expect-error TS(2322): Type '{ type: "array"; }' is not assignable to typ... Remove this comment to see the full error message
13
+ rules: [{ type: 'array' }, { type: 'object' }, { type: 'string' }],
14
+ optional: true
15
+ },
16
+ // @ts-expect-error TS(2322): Type '{ type: "boolean"; default: false; }' is not... Remove this comment to see the full error message
17
+ preserveContextUri: { type: 'boolean', default: false },
18
+ // @ts-expect-error TS(2322): Type '{ type: "boolean"; default: false; }' is not... Remove this comment to see the full error message
19
+ persist: { type: 'boolean', default: false }
20
+ },
21
+ async handler(ctx) {
22
+ let { prefix, namespace, owl, jsonldContext, preserveContextUri, persist } = ctx.params;
23
+ if (preserveContextUri === true) {
24
+ if (!jsonldContext || !arrayOf(jsonldContext).every(context => isURL(context))) {
25
+ throw new Error(`Cannot register ${prefix} ontology. If preserveContextUri is true, jsonldContext must be one or more URI`);
26
+ }
27
+ }
28
+ if (persist) {
29
+ if (!this.settings.persistRegistry)
30
+ throw new Error(`Cannot persist ontology because the persistRegistry setting is false`);
31
+ if (owl || jsonldContext)
32
+ throw new Error(`The owl and jsonldContext params cannot be persisted`);
33
+ await ctx.call('ontologies.registry.updateOrCreate', {
34
+ prefix,
35
+ namespace
36
+ });
37
+ this.ontologies[prefix] = {
38
+ prefix,
39
+ namespace
40
+ };
41
+ }
42
+ else {
43
+ this.ontologies[prefix] = {
44
+ prefix,
45
+ namespace,
46
+ owl,
47
+ jsonldContext,
48
+ preserveContextUri
49
+ };
50
+ }
51
+ if (this.broker.cacher) {
52
+ this.broker.cacher.clean('ontologies.**');
53
+ this.broker.cacher.clean('jsonld.context.**');
54
+ }
55
+ ctx.emit('ontologies.registered', { prefix, namespace, owl, jsonldContext, preserveContextUri });
56
+ }
57
+ };
58
+ export default Schema;
59
+ //# sourceMappingURL=register.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register.js","sourceRoot":"","sources":["../../actions/register.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,MAAM,GAAG;IACb,UAAU,EAAE,QAAQ;IACpB,MAAM,EAAE;QACN,qIAAqI;QACrI,MAAM,EAAE,QAAQ;QAChB,qIAAqI;QACrI,SAAS,EAAE,QAAQ;QACnB,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE;QACvC,aAAa,EAAE;YACb,IAAI,EAAE,OAAO;YACb,qIAAqI;YACrI,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;YAClE,QAAQ,EAAE,IAAI;SACf;QACD,qIAAqI;QACrI,kBAAkB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE;QACvD,qIAAqI;QACrI,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE;KAC7C;IACD,KAAK,CAAC,OAAO,CAAC,GAAG;QACf,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,aAAa,EAAE,kBAAkB,EAAE,OAAO,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC;QAExF,IAAI,kBAAkB,KAAK,IAAI,EAAE,CAAC;YAChC,IAAI,CAAC,aAAa,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC;gBAC/E,MAAM,IAAI,KAAK,CACb,mBAAmB,MAAM,iFAAiF,CAC3G,CAAC;YACJ,CAAC;QACH,CAAC;QAED,IAAI,OAAO,EAAE,CAAC;YACZ,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,eAAe;gBAChC,MAAM,IAAI,KAAK,CAAC,sEAAsE,CAAC,CAAC;YAC1F,IAAI,GAAG,IAAI,aAAa;gBAAE,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;YAElG,MAAM,GAAG,CAAC,IAAI,CAAC,oCAAoC,EAAE;gBACnD,MAAM;gBACN,SAAS;aACV,CAAC,CAAC;YAEH,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG;gBACxB,MAAM;gBACN,SAAS;aACV,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG;gBACxB,MAAM;gBACN,SAAS;gBACT,GAAG;gBACH,aAAa;gBACb,kBAAkB;aACnB,CAAC;QACJ,CAAC;QAED,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;YACvB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;YAC1C,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;QAChD,CAAC;QAED,GAAG,CAAC,IAAI,CAAC,uBAAuB,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,aAAa,EAAE,kBAAkB,EAAE,CAAC,CAAC;IACnG,CAAC;CACqB,CAAC;AAEzB,eAAe,MAAM,CAAC"}
@@ -0,0 +1,7 @@
1
+ import OntologiesService from './service.ts';
2
+ import OntologiesRegistryService from './sub-services/registry.ts';
3
+ export { OntologiesService, OntologiesRegistryService };
4
+ export * from './ontologies/core/index.ts';
5
+ export * from './ontologies/solid/index.ts';
6
+ export * from './ontologies/custom/index.ts';
7
+ export { skos } from './ontologies/core/index.ts';
package/dist/index.js ADDED
@@ -0,0 +1,8 @@
1
+ import OntologiesService from "./service.js";
2
+ import OntologiesRegistryService from "./sub-services/registry.js";
3
+ export { OntologiesService, OntologiesRegistryService };
4
+ export * from "./ontologies/core/index.js";
5
+ export * from "./ontologies/solid/index.js";
6
+ export * from "./ontologies/custom/index.js";
7
+ export { skos } from "./ontologies/core/index.js";
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,MAAM,cAAc,CAAC;AAC7C,OAAO,yBAAyB,MAAM,4BAA4B,CAAC;AAEnE,OAAO,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,CAAC;AAExD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC"}
@@ -0,0 +1,28 @@
1
+ {
2
+ "prefix": "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
+ "acl:Authorization": {
25
+ "@type": "@id"
26
+ }
27
+ }
28
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "prefix": "as",
3
+ "namespace": "https://www.w3.org/ns/activitystreams#",
4
+ "jsonldContext": "https://www.w3.org/ns/activitystreams",
5
+ "preserveContextUri": true
6
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "prefix": "cred",
3
+ "namespace": "https://www.w3.org/2018/credentials#",
4
+ "preserveContextUri": false,
5
+ "jsonldContext": {
6
+ "credentialSubject": {
7
+ "@id": "https://www.w3.org/2018/credentials#credentialSubject",
8
+ "@type": "@id"
9
+ },
10
+ "holder": {
11
+ "@id": "https://www.w3.org/2018/credentials#holder",
12
+ "@type": "@id"
13
+ },
14
+ "issuer": {
15
+ "@id": "https://www.w3.org/2018/credentials#issuer",
16
+ "@type": "@id"
17
+ },
18
+ "verifiableCredential": "https://www.w3.org/2018/credentials#verifiableCredential",
19
+ "VerifiableCredential": "https://www.w3.org/2018/credentials#VerifiableCredential",
20
+ "VerifiablePresentation": "https://www.w3.org/2018/credentials#VerifiablePresentation"
21
+ }
22
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "prefix": "dc",
3
+ "namespace": "http://purl.org/dc/terms/",
4
+ "jsonldContext": {
5
+ "xsd": "http://www.w3.org/2001/XMLSchema#",
6
+ "dc:created": {
7
+ "@type": "xsd:dateTime"
8
+ },
9
+ "dc:modified": {
10
+ "@type": "xsd:dateTime"
11
+ },
12
+ "dc:creator": {
13
+ "@type": "@id"
14
+ },
15
+ "dc:source": {
16
+ "@type": "@id"
17
+ }
18
+ }
19
+ }