@_linked/core 0.0.1 → 1.0.0-next.20260216062729

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 (81) hide show
  1. package/CHANGELOG.md +71 -0
  2. package/LICENSE +1 -1
  3. package/README.md +147 -92
  4. package/lib/cjs/queries/SelectQuery.d.ts +5 -0
  5. package/lib/cjs/queries/SelectQuery.js +14 -0
  6. package/lib/cjs/queries/SelectQuery.js.map +1 -1
  7. package/lib/cjs/shapes/SHACL.d.ts +1 -0
  8. package/lib/cjs/shapes/SHACL.js +82 -2
  9. package/lib/cjs/shapes/SHACL.js.map +1 -1
  10. package/lib/cjs/shapes/Shape.d.ts +13 -1
  11. package/lib/cjs/shapes/Shape.js +6 -0
  12. package/lib/cjs/shapes/Shape.js.map +1 -1
  13. package/lib/cjs/test-helpers/query-fixtures.d.ts +583 -0
  14. package/lib/cjs/test-helpers/query-fixtures.js +39 -1
  15. package/lib/cjs/test-helpers/query-fixtures.js.map +1 -1
  16. package/lib/esm/queries/SelectQuery.d.ts +5 -0
  17. package/lib/esm/queries/SelectQuery.js +14 -0
  18. package/lib/esm/queries/SelectQuery.js.map +1 -1
  19. package/lib/esm/shapes/SHACL.d.ts +1 -0
  20. package/lib/esm/shapes/SHACL.js +82 -2
  21. package/lib/esm/shapes/SHACL.js.map +1 -1
  22. package/lib/esm/shapes/Shape.d.ts +13 -1
  23. package/lib/esm/shapes/Shape.js +6 -0
  24. package/lib/esm/shapes/Shape.js.map +1 -1
  25. package/lib/esm/test-helpers/query-fixtures.d.ts +583 -0
  26. package/lib/esm/test-helpers/query-fixtures.js +38 -0
  27. package/lib/esm/test-helpers/query-fixtures.js.map +1 -1
  28. package/package.json +17 -1
  29. package/.context/notes.md +0 -0
  30. package/.context/todos.md +0 -0
  31. package/AGENTS.md +0 -59
  32. package/docs/001-core-extraction.md +0 -305
  33. package/jest.config.js +0 -25
  34. package/scripts/dual-package.js +0 -25
  35. package/src/collections/CoreMap.ts +0 -127
  36. package/src/collections/CoreSet.ts +0 -171
  37. package/src/collections/ShapeSet.ts +0 -18
  38. package/src/index.ts +0 -88
  39. package/src/interfaces/ICoreIterable.ts +0 -35
  40. package/src/interfaces/IFileStore.ts +0 -28
  41. package/src/interfaces/IQuadStore.ts +0 -16
  42. package/src/interfaces/IQueryParser.ts +0 -51
  43. package/src/ontologies/lincd.ts +0 -25
  44. package/src/ontologies/npm.ts +0 -15
  45. package/src/ontologies/owl.ts +0 -26
  46. package/src/ontologies/rdf.ts +0 -32
  47. package/src/ontologies/rdfs.ts +0 -38
  48. package/src/ontologies/shacl.ts +0 -136
  49. package/src/ontologies/xsd.ts +0 -47
  50. package/src/package.ts +0 -11
  51. package/src/queries/CreateQuery.ts +0 -41
  52. package/src/queries/DeleteQuery.ts +0 -54
  53. package/src/queries/MutationQuery.ts +0 -287
  54. package/src/queries/QueryContext.ts +0 -41
  55. package/src/queries/QueryFactory.ts +0 -275
  56. package/src/queries/QueryParser.ts +0 -79
  57. package/src/queries/SelectQuery.ts +0 -2101
  58. package/src/queries/UpdateQuery.ts +0 -47
  59. package/src/shapes/List.ts +0 -52
  60. package/src/shapes/SHACL.ts +0 -653
  61. package/src/shapes/Shape.ts +0 -282
  62. package/src/test-helpers/query-fixtures.ts +0 -313
  63. package/src/tests/core-utils.test.ts +0 -286
  64. package/src/tests/metadata.test.ts +0 -65
  65. package/src/tests/query.test.ts +0 -599
  66. package/src/tests/query.types.test.ts +0 -606
  67. package/src/tests/store-routing.test.ts +0 -133
  68. package/src/utils/LinkedErrorLogging.ts +0 -25
  69. package/src/utils/LinkedFileStorage.ts +0 -75
  70. package/src/utils/LinkedStorage.ts +0 -120
  71. package/src/utils/NameSpace.ts +0 -5
  72. package/src/utils/NodeReference.ts +0 -16
  73. package/src/utils/Package.ts +0 -681
  74. package/src/utils/Prefix.ts +0 -108
  75. package/src/utils/ShapeClass.ts +0 -335
  76. package/src/utils/Types.ts +0 -19
  77. package/src/utils/URI.ts +0 -40
  78. package/src/utils/cached.ts +0 -53
  79. package/tsconfig-cjs.json +0 -8
  80. package/tsconfig-esm.json +0 -9
  81. package/tsconfig.json +0 -29
@@ -1,127 +0,0 @@
1
- /*
2
- * This Source Code Form is subject to the terms of the Mozilla Public
3
- * License, v. 2.0. If a copy of the MPL was not distributed with this
4
- * file, You can obtain one at https://mozilla.org/MPL/2.0/.
5
- */
6
- import {ICoreIterable} from '../interfaces/ICoreIterable.js';
7
-
8
- export class CoreMap<K, V> extends Map<K, V> implements ICoreIterable<V> {
9
- createNew(...args): this {
10
- return new (<any>this.constructor)(...args) as this;
11
- }
12
-
13
- /**
14
- * Determines whether all the members of an array satisfy the specified test.
15
- * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array.
16
- * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
17
- */
18
- every(
19
- callbackfn: (value: V, key: K, map: CoreMap<K, V>) => boolean,
20
- thisArg?: any,
21
- ): boolean {
22
- for (let [key, value] of this) {
23
- if (!callbackfn.apply(thisArg, [value, key, this])) {
24
- return false;
25
- }
26
- }
27
- return true;
28
- }
29
-
30
- /**
31
- * Determines whether the specified callback function returns true for any element of an array.
32
- * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array.
33
- * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
34
- */
35
- some(
36
- callbackfn: (value: V, key: K, map: CoreMap<K, V>) => boolean,
37
- thisArg?: any,
38
- ): boolean {
39
- for (let [key, value] of this) {
40
- if (callbackfn.apply(thisArg, [value, key, this])) {
41
- return true;
42
- }
43
- }
44
- return false;
45
- }
46
-
47
- /**
48
- * Calls a defined callback function on each element of an array, and returns an array that contains the results.
49
- * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.
50
- * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
51
- */
52
- map<U>(
53
- callbackfn: (value: V, key: K, map: Map<K, V>) => U,
54
- thisArg?: any,
55
- ): this {
56
- //create the result map, whos values will be 'mapped' into new values from the current values of this map
57
- //var mappedMap = new (<any> this.constructor)() as CoreMap<K,U>;
58
- var mappedMap = new (<any>this.constructor)(); // as CoreMap<K,U>;
59
- for (let [key, value] of this) {
60
- //do the mapping
61
- mappedMap.set(key, callbackfn.apply(thisArg, [value, key, this]));
62
- }
63
- return mappedMap;
64
- }
65
-
66
- /**
67
- * Returns the elements of an array that meet the condition specified in a callback function.
68
- * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.
69
- * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
70
- */
71
- filter(
72
- callbackfn: (value: V, key: K, map: Map<K, V>) => any,
73
- thisArg?: any,
74
- ): this {
75
- //create the result map, whos values will be 'mapped' into new values from the current values of this map
76
- var filteredMap = new (<any>this.constructor)(); //this.createNew();//new Map<K,V>();
77
- for (let [key, value] of this) {
78
- //do the mapping
79
- if (callbackfn.apply(thisArg, [value, key, this])) {
80
- filteredMap.set(key, value);
81
- }
82
- }
83
- return filteredMap;
84
- }
85
-
86
- first(): V | null {
87
- return this.values().next().value;
88
- }
89
-
90
- /**
91
- * Returns the value of the first element in the Set where predicate is true, and undefined
92
- * otherwise.
93
- */
94
- find(
95
- predicate: (value: V, index: K, obj: CoreMap<K, V>) => boolean,
96
- thisArg?: any,
97
- ): V | undefined {
98
- for (let [key, value] of this) {
99
- if (predicate.apply(thisArg, [value, key, this])) {
100
- return value;
101
- }
102
- }
103
- return undefined;
104
- }
105
-
106
- merge(...maps: CoreMap<K, V>[]) {
107
- var res = this.createNew(this);
108
- for (var map of maps) {
109
- map.forEach((value, index) => {
110
- res.set(index, value);
111
- });
112
- }
113
- return res;
114
- }
115
-
116
- toString() {
117
- let res = 'Map:\n';
118
- for (let [key, value] of this) {
119
- res += '\t[' + key.toString() + '] => ' + value.toString() + '\n';
120
- }
121
- return res;
122
- }
123
-
124
- print() {
125
- console.log(this.toString());
126
- }
127
- }
@@ -1,171 +0,0 @@
1
- /*
2
- * This Source Code Form is subject to the terms of the Mozilla Public
3
- * License, v. 2.0. If a copy of the MPL was not distributed with this
4
- * file, You can obtain one at https://mozilla.org/MPL/2.0/.
5
- */
6
- import {ICoreIterable} from '../interfaces/ICoreIterable.js';
7
-
8
- export class CoreSet<R> extends Set<R> implements ICoreIterable<R> {
9
- createNew(...args): this {
10
- return new (<any>this.constructor)(...args) as this;
11
- }
12
-
13
- filter(fn: (value: R, index: any, thisInstance: any) => any): this {
14
- var res: this = this.createNew();
15
- for (var item of this) {
16
- if (fn(item, item, this)) {
17
- res.add(item);
18
- }
19
- }
20
- return res;
21
- }
22
-
23
- reduce<U>(
24
- fn: (
25
- previousValue: U,
26
- currentValue: R,
27
- currentIndex: number,
28
- thisInstance: any,
29
- ) => U,
30
- initialValue: U,
31
- ): U {
32
- let i = 0;
33
- let res = initialValue;
34
- for (let item of this) {
35
- res = fn(res, item, i++, this);
36
- }
37
- return res;
38
- }
39
-
40
- /**
41
- * Returns the value of the first element in the Set where predicate is true, and undefined
42
- * otherwise.
43
- */
44
- find(
45
- predicate: (value: R, index: R, obj: CoreSet<R>) => boolean,
46
- thisArg?: any,
47
- ): R | undefined {
48
- for (let item of this) {
49
- if (predicate.apply(thisArg, [item, item, this])) {
50
- return item;
51
- }
52
- }
53
- return undefined;
54
- }
55
-
56
- first(): R | undefined {
57
- return this.values().next().value;
58
- }
59
-
60
- /**
61
- * Returns the last element added to the set
62
- */
63
- last(): R {
64
- //unfortunately there is no efficient way to do this. Either we convert the set to an array or we loop over all values to discover the last
65
- let item;
66
- for (item of this);
67
- return item;
68
- }
69
-
70
- getFirst(n: number) {
71
- return this.createNew([...this].slice(0, n));
72
- }
73
-
74
- slice(start?: number, end?: number) {
75
- return this.createNew([...this].slice(start, end));
76
- }
77
-
78
- sort(compareFn?: (a: R, b: R) => number, thisArg?): this {
79
- //convert this set to an array, sort it with provided parameters, create a new set of the same type and provide the sorted array as content
80
- var sortedArray = thisArg
81
- ? [...this].sort.apply(thisArg, [compareFn])
82
- : [...this].sort(compareFn);
83
- return this.createNew(sortedArray);
84
- }
85
-
86
- /**
87
- * Determines whether all the members of an array satisfy the specified test.
88
- * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array.
89
- * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
90
- */
91
- every(
92
- callbackfn: (item: R, set: CoreSet<R>) => boolean,
93
- thisArg?: any,
94
- ): boolean {
95
- for (let item of this) {
96
- if (!callbackfn.apply(thisArg, [item, this])) {
97
- return false;
98
- }
99
- }
100
- return true;
101
- }
102
-
103
- /**
104
- * Determines whether the specified callback function returns true for any element of an array.
105
- * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array.
106
- * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
107
- */
108
- some(
109
- callbackfn: (item: R, set: CoreSet<R>) => boolean,
110
- thisArg?: any,
111
- ): boolean {
112
- for (let item of this) {
113
- if (callbackfn.apply(thisArg, [item, this])) {
114
- return true;
115
- }
116
- }
117
- return false;
118
- }
119
-
120
- /**
121
- * Calls a defined callback function on each element of the set, and returns an ARRAY that contains the results.
122
- * Note that this method returns an array so that sets can be more easily used with for example JSX
123
- * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.
124
- * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
125
- */
126
- map<U>(callbackfn: (item: R, set: CoreSet<R>) => U, thisArg?: any): U[] {
127
- //NOTE: we changed this method so that it returns an array because it
128
- // causes trouble in ES5 when we create a new CoreSet and try to add the mapped results which may not have a unique toString() implementation (like in React)
129
-
130
- //create the result map, whos values will be 'mapped' into new values from the current values of this map
131
- var mapped: U[] = [];
132
- for (let item of this) {
133
- //do the mapping
134
- mapped.push(callbackfn.apply(thisArg, [item, this]));
135
- }
136
- return mapped;
137
- }
138
-
139
- concat(...sets: ICoreIterable<R>[]): this {
140
- var res = this.createNew(this);
141
- for (var set of sets) {
142
- set.forEach(res.add.bind(res));
143
- }
144
- return res;
145
- }
146
-
147
- clone(): this {
148
- return this.createNew(this);
149
- }
150
-
151
- reverse(): this {
152
- return this.createNew([...this].reverse());
153
- }
154
-
155
- print() {
156
- console.log(this.toString());
157
- }
158
-
159
- /**
160
- * Similar to concat, but adds all items to THIS set instead of creating a new one
161
- * @param sets
162
- */
163
- addFrom(...sets: ICoreIterable<R>[]): this {
164
- for (var set of sets) {
165
- if (set) {
166
- set.forEach(this.add.bind(this));
167
- }
168
- }
169
- return this;
170
- }
171
- }
@@ -1,18 +0,0 @@
1
- /*
2
- * This Source Code Form is subject to the terms of the Mozilla Public
3
- * License, v. 2.0. If a copy of the MPL was not distributed with this
4
- * file, You can obtain one at https://mozilla.org/MPL/2.0/.
5
- */
6
- import {CoreSet} from './CoreSet.js';
7
- import {Shape} from '../shapes/Shape.js';
8
- import {getLeastSpecificShapeClasses} from '../utils/ShapeClass.js';
9
-
10
- export class ShapeSet<R extends Shape = Shape> extends CoreSet<R> {
11
- constructor(iterable?: Iterable<R>) {
12
- super(iterable);
13
- }
14
-
15
- getLeastSpecificShape() {
16
- return getLeastSpecificShapeClasses(this).shift();
17
- }
18
- }
package/src/index.ts DELETED
@@ -1,88 +0,0 @@
1
- /*
2
- * This Source Code Form is subject to the terms of the Mozilla Public
3
- * License, v. 2.0. If a copy of the MPL was not distributed with this
4
- * file, You can obtain one at https://mozilla.org/MPL/2.0/.
5
- */
6
- import * as Package from './utils/Package.js';
7
- import * as LinkedErrorLogging from './utils/LinkedErrorLogging.js';
8
- import * as LinkedFileStorage from './utils/LinkedFileStorage.js';
9
- import * as LinkedStorage from './utils/LinkedStorage.js';
10
- import * as CoreSet from './collections/CoreSet.js';
11
- import * as CoreMap from './collections/CoreMap.js';
12
- import * as Shape from './shapes/Shape.js';
13
- import * as SHACLShapes from './shapes/SHACL.js';
14
- import * as ShapeSet from './collections/ShapeSet.js';
15
- import * as Prefix from './utils/Prefix.js';
16
- import * as URI from './utils/URI.js';
17
- import * as SelectQuery from './queries/SelectQuery.js';
18
- import * as UpdateQuery from './queries/UpdateQuery.js';
19
- import * as MutationQuery from './queries/MutationQuery.js';
20
- import * as DeleteQuery from './queries/DeleteQuery.js';
21
- import * as CreateQuery from './queries/CreateQuery.js';
22
- import * as QueryParser from './queries/QueryParser.js';
23
- import * as QueryFactory from './queries/QueryFactory.js';
24
- import * as NameSpace from './utils/NameSpace.js';
25
- import * as ShapeClass from './utils/ShapeClass.js';
26
- import * as cached from './utils/cached.js';
27
- import * as List from './shapes/List.js';
28
- import * as ICoreIterable from './interfaces/ICoreIterable.js';
29
- import * as IFileStore from './interfaces/IFileStore.js';
30
- import * as IQuadStore from './interfaces/IQuadStore.js';
31
- import * as rdf from './ontologies/rdf.js';
32
- import * as rdfs from './ontologies/rdfs.js';
33
- import * as xsd from './ontologies/xsd.js';
34
- import * as shacl from './ontologies/shacl.js';
35
- import * as lincd from './ontologies/lincd.js';
36
- import * as owl from './ontologies/owl.js';
37
- import * as npm from './ontologies/npm.js';
38
- import nextTick from 'next-tick';
39
- export {nextTick};
40
-
41
- export function initModularApp() {
42
- let publicFiles = {
43
- Package,
44
- LinkedErrorLogging,
45
- LinkedFileStorage,
46
- LinkedStorage,
47
- CoreSet,
48
- CoreMap,
49
- Shape,
50
- ShapeSet,
51
- Prefix,
52
- NameSpace,
53
- cached,
54
- URI,
55
- ShapeClass,
56
- List,
57
- ICoreIterable,
58
- IFileStore,
59
- IQuadStore,
60
- SelectQuery,
61
- UpdateQuery,
62
- MutationQuery,
63
- DeleteQuery,
64
- CreateQuery,
65
- QueryParser,
66
- QueryFactory,
67
- SHACLShapes,
68
- rdf,
69
- rdfs,
70
- xsd,
71
- shacl,
72
- lincd,
73
- owl,
74
- npm,
75
- };
76
- var lincdExport = {};
77
- for (let fileKey in publicFiles) {
78
- let exportedClasses = publicFiles[fileKey];
79
- for (let className in exportedClasses) {
80
- lincdExport[className] = exportedClasses[className];
81
- }
82
- }
83
- if (typeof window !== 'undefined') {
84
- Object.assign(window['lincd'], lincdExport);
85
- } else if (typeof global !== 'undefined') {
86
- Object.assign(global['lincd'], lincdExport);
87
- }
88
- }
@@ -1,35 +0,0 @@
1
- /*
2
- * This Source Code Form is subject to the terms of the Mozilla Public
3
- * License, v. 2.0. If a copy of the MPL was not distributed with this
4
- * file, You can obtain one at https://mozilla.org/MPL/2.0/.
5
- */
6
- /**
7
- * Pretty open and general interface that closely resembles JS Arrays.
8
- * other classes like CoreMap and CoreSet can implement this so that we know which methods are available
9
- */
10
- //extending Iterable<ANY> because Maps and Sets use different iterator setups that would not match with type definitions
11
- //this allows us to still use iterators for ICoreIterable but without typing information, although for all methods below it works
12
- export interface ICoreIterable<V> extends Iterable<any> {
13
- forEach: (
14
- callbackFn: (item: V, index?: any, iterable?: any) => void,
15
- context?: any,
16
- ) => void;
17
- size?: number;
18
- length?: number;
19
-
20
- filter(
21
- callbackfn: (value: V, index: any, thisInstance: any) => any,
22
- thisArg?: any,
23
- ): Iterable<any>;
24
-
25
- find(
26
- predicate: (value: V, index: any, obj: ICoreIterable<V>) => boolean,
27
- thisArg?: any,
28
- ): V | undefined;
29
-
30
- every(callbackfn: (item: V) => boolean, thisArg?: any): boolean;
31
-
32
- some(callbackfn: (item: V) => boolean, thisArg?: any): boolean;
33
-
34
- map<U>(callbackfn: (item: V) => U, thisArg?: any): any;
35
- }
@@ -1,28 +0,0 @@
1
- import type {Readable} from 'stream';
2
-
3
- export interface IFileStore {
4
- /**
5
- * The base URL to access the filestore's files. For example:
6
- * - http://localhost:4000
7
- * - https://s3.amazonaws.com/my-bucket
8
- * - https://my-bucket.nyc3.digitaloceanspaces.com
9
- */
10
- readonly accessURL: string;
11
-
12
- init?(): Promise<any>;
13
-
14
- deleteFile(filePath: string): Promise<void>;
15
-
16
- fileExists(filePath: string): Promise<boolean>;
17
-
18
- getFile(filePath: string): Promise<Buffer | null>;
19
-
20
- listFiles(prefix?: string): Promise<string[]>;
21
-
22
- saveFile(
23
- filePath: string,
24
- fileContent: string | Uint8Array | Buffer | Readable,
25
- mimeType?: string,
26
- preventDuplicates?: boolean,
27
- ): Promise<string | null>;
28
- }
@@ -1,16 +0,0 @@
1
- import {CreateQuery} from '../queries/CreateQuery.js';
2
- import {DeleteQuery, DeleteResponse} from '../queries/DeleteQuery.js';
3
- import {SelectQuery} from '../queries/SelectQuery.js';
4
- import {UpdateQuery} from '../queries/UpdateQuery.js';
5
-
6
- export interface IQuadStore {
7
- /**
8
- * Prepares the store to be used.
9
- */
10
- init?(): Promise<any>;
11
-
12
- selectQuery<ResultType>(query: SelectQuery<any>): Promise<ResultType>;
13
- updateQuery?<RType>(q: UpdateQuery<RType>): Promise<RType>;
14
- createQuery?<R>(q: CreateQuery<R>): Promise<R>;
15
- deleteQuery?(query: DeleteQuery): Promise<DeleteResponse>;
16
- }
@@ -1,51 +0,0 @@
1
- import {
2
- GetQueryResponseType,
3
- QueryResponseToResultType,
4
- SelectQueryFactory,
5
- } from '../queries/SelectQuery.js';
6
- import {Shape} from '../shapes/Shape.js';
7
- import {
8
- AddId,
9
- NodeReferenceValue,
10
- UpdatePartial,
11
- } from '../queries/QueryFactory.js';
12
- import {CreateResponse} from '../queries/CreateQuery.js';
13
- import {NodeId} from '../queries/MutationQuery.js';
14
- import {DeleteResponse} from '../queries/DeleteQuery.js';
15
-
16
- export interface IQueryParser {
17
- selectQuery<
18
- ShapeType extends Shape,
19
- ResponseType,
20
- Source,
21
- ResultType = QueryResponseToResultType<
22
- GetQueryResponseType<SelectQueryFactory<ShapeType, ResponseType>>,
23
- ShapeType
24
- >[],
25
- >(
26
- query: SelectQueryFactory<ShapeType, ResponseType, Source>,
27
- ): Promise<ResultType>;
28
-
29
- updateQuery<ShapeType extends Shape, U extends UpdatePartial<ShapeType>>(
30
- id: string | NodeReferenceValue,
31
- updateObjectOrFn: U,
32
- shapeClass: typeof Shape,
33
- ): Promise<AddId<U>>;
34
-
35
- createQuery<ShapeType extends Shape, U extends UpdatePartial<ShapeType>>(
36
- updateObjectOrFn: U,
37
- shapeClass: typeof Shape,
38
- ): Promise<CreateResponse<U>>;
39
-
40
- deleteQuery(
41
- id: NodeId | NodeId[] | NodeReferenceValue[],
42
- shapeClass: typeof Shape,
43
- ): Promise<DeleteResponse>;
44
- }
45
-
46
- /* class decorator */
47
- export function staticImplements<T>() {
48
- return <U extends T>(constructor: U) => {
49
- constructor;
50
- };
51
- }
@@ -1,25 +0,0 @@
1
- import {NodeReferenceValue} from '../utils/NodeReference.js';
2
- import {createNameSpace} from '../utils/NameSpace.js';
3
- import {Prefix} from '../utils/Prefix.js';
4
-
5
- export const ns = createNameSpace('https://purl.org/on/lincd/');
6
- export const _self: NodeReferenceValue = ns('');
7
- Prefix.add('lincd', _self.id);
8
-
9
- const Module = ns('Module');
10
- const ShapeClass = ns('ShapeClass');
11
- const definesShape = ns('definesShape');
12
- const moduleProperty = ns('module');
13
- const usesShapeClass = ns('usesShapeClass');
14
- const editInline = ns('editInline');
15
- const isExtending = ns('isExtending');
16
-
17
- export const lincd = {
18
- Module,
19
- ShapeClass,
20
- definesShape,
21
- module: moduleProperty,
22
- usesShapeClass,
23
- editInline,
24
- isExtending,
25
- };
@@ -1,15 +0,0 @@
1
- import {NodeReferenceValue} from '../utils/NodeReference.js';
2
- import {createNameSpace} from '../utils/NameSpace.js';
3
- import {Prefix} from '../utils/Prefix.js';
4
-
5
- const base = 'http://purl.org/on/npm/';
6
- export const ns = createNameSpace(base);
7
- Prefix.add('npm', base);
8
-
9
- const packageName: NodeReferenceValue = ns('packageName');
10
- const version: NodeReferenceValue = ns('version');
11
-
12
- export const npm = {
13
- version,
14
- packageName,
15
- };
@@ -1,26 +0,0 @@
1
- /*
2
- * This Source Code Form is subject to the terms of the Mozilla Public
3
- * License, v. 2.0. If a copy of the MPL was not distributed with this
4
- * file, You can obtain one at https://mozilla.org/MPL/2.0/.
5
- */
6
- import {NodeReferenceValue} from '../utils/NodeReference.js';
7
- import {Prefix} from '../utils/Prefix.js';
8
-
9
- //Important note: the actual ontology node is WITHOUT HASH, because in the ontology itself, that is how the node is defined
10
- //(other than RDF and RDFS who DO define their URL INCLUDING HASH as ontologies)
11
- //so here we make sure of that, by adding the hash after creating the ontology node
12
- let base = 'http://www.w3.org/2002/07/owl';
13
- export const _ontologyResource: NodeReferenceValue = {id: base};
14
- base += '#';
15
- Prefix.add('owl', base);
16
-
17
- const ObjectProperty = {id: base + 'ObjectProperty'};
18
- const DataProperty = {id: base + 'DataProperty'};
19
- const equivalentClass = {id: base + 'equivalentClass'};
20
-
21
- export const owl = {
22
- _ontologyResource,
23
- ObjectProperty,
24
- DataProperty,
25
- equivalentClass,
26
- };
@@ -1,32 +0,0 @@
1
- /*
2
- * This Source Code Form is subject to the terms of the Mozilla Public
3
- * License, v. 2.0. If a copy of the MPL was not distributed with this
4
- * file, You can obtain one at https://mozilla.org/MPL/2.0/.
5
- */
6
- import {NodeReferenceValue} from '../utils/NodeReference.js';
7
- import {Prefix} from '../utils/Prefix.js';
8
-
9
- const base = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#';
10
- export const ns = (term: string): NodeReferenceValue => ({id: base + term});
11
-
12
- export const _ontologyResource = ns('');
13
- Prefix.add('rdf', base);
14
-
15
- const langString = ns('langString');
16
- const type = ns('type');
17
- const Property = ns('Property');
18
- const List = ns('List');
19
- const rest = ns('rest');
20
- const first = ns('first');
21
- const nil = ns('nil');
22
-
23
- export const rdf = {
24
- _ontologyResource,
25
- langString,
26
- type,
27
- Property,
28
- List,
29
- rest,
30
- first,
31
- nil,
32
- };
@@ -1,38 +0,0 @@
1
- /*
2
- * This Source Code Form is subject to the terms of the Mozilla Public
3
- * License, v. 2.0. If a copy of the MPL was not distributed with this
4
- * file, You can obtain one at https://mozilla.org/MPL/2.0/.
5
- */
6
- import {NodeReferenceValue} from '../utils/NodeReference.js';
7
- import {Prefix} from '../utils/Prefix.js';
8
-
9
- const base = 'http://www.w3.org/2000/01/rdf-schema#';
10
- export const ns = (term: string): NodeReferenceValue => ({id: base + term});
11
-
12
- export const _ontologyResource = ns('');
13
- Prefix.add('rdfs', base);
14
-
15
- const subPropertyOf = ns('subPropertyOf');
16
- const subClassOf = ns('subClassOf');
17
- const range = ns('range');
18
- const isDefinedBy = ns('isDefinedBy');
19
- const label = ns('label');
20
- const comment = ns('comment');
21
- const Literal = ns('Literal');
22
- const Datatype = ns('Datatype');
23
- const Class = ns('Class');
24
- const Resource = ns('Resource');
25
-
26
- export const rdfs = {
27
- _ontologyResource,
28
- subPropertyOf,
29
- subClassOf,
30
- range,
31
- isDefinedBy,
32
- label,
33
- comment,
34
- Literal,
35
- Datatype,
36
- Class,
37
- Resource,
38
- };