@ldo/solid-type-index 0.0.1-alpha.29
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/LICENSE.txt +21 -0
- package/README.md +49 -0
- package/dist/.ldo/profile.context.d.ts +2 -0
- package/dist/.ldo/profile.context.js +16 -0
- package/dist/.ldo/profile.context.js.map +1 -0
- package/dist/.ldo/profile.schema.d.ts +2 -0
- package/dist/.ldo/profile.schema.js +59 -0
- package/dist/.ldo/profile.schema.js.map +1 -0
- package/dist/.ldo/profile.shapeTypes.d.ts +3 -0
- package/dist/.ldo/profile.shapeTypes.js +11 -0
- package/dist/.ldo/profile.shapeTypes.js.map +1 -0
- package/dist/.ldo/profile.typings.d.ts +11 -0
- package/dist/.ldo/profile.typings.js +3 -0
- package/dist/.ldo/profile.typings.js.map +1 -0
- package/dist/.ldo/typeIndex.context.d.ts +2 -0
- package/dist/.ldo/typeIndex.context.js +47 -0
- package/dist/.ldo/typeIndex.context.js.map +1 -0
- package/dist/.ldo/typeIndex.schema.d.ts +2 -0
- package/dist/.ldo/typeIndex.schema.js +141 -0
- package/dist/.ldo/typeIndex.schema.js.map +1 -0
- package/dist/.ldo/typeIndex.shapeTypes.d.ts +4 -0
- package/dist/.ldo/typeIndex.shapeTypes.js +16 -0
- package/dist/.ldo/typeIndex.shapeTypes.js.map +1 -0
- package/dist/.ldo/typeIndex.typings.d.ts +26 -0
- package/dist/.ldo/typeIndex.typings.js +3 -0
- package/dist/.ldo/typeIndex.typings.js.map +1 -0
- package/dist/constants.d.ts +5 -0
- package/dist/constants.js +9 -0
- package/dist/constants.js.map +1 -0
- package/dist/getTypeIndex.d.ts +8 -0
- package/dist/getTypeIndex.js +62 -0
- package/dist/getTypeIndex.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/react/useInstanceUris.d.ts +2 -0
- package/dist/react/useInstanceUris.js +26 -0
- package/dist/react/useInstanceUris.js.map +1 -0
- package/dist/react/useTypeIndexProfile.d.ts +2 -0
- package/dist/react/useTypeIndexProfile.js +13 -0
- package/dist/react/useTypeIndexProfile.js.map +1 -0
- package/dist/react/util/useSubscribeToUris.d.ts +1 -0
- package/dist/react/util/useSubscribeToUris.js +31 -0
- package/dist/react/util/useSubscribeToUris.js.map +1 -0
- package/dist/setTypeIndex.d.ts +14 -0
- package/dist/setTypeIndex.js +123 -0
- package/dist/setTypeIndex.js.map +1 -0
- package/dist/util/Options.d.ts +9 -0
- package/dist/util/Options.js +12 -0
- package/dist/util/Options.js.map +1 -0
- package/package.json +50 -0
- package/src/.ldo/profile.context.ts +19 -0
- package/src/.ldo/profile.schema.ts +64 -0
- package/src/.ldo/profile.shapeTypes.ts +19 -0
- package/src/.ldo/profile.typings.ts +27 -0
- package/src/.ldo/typeIndex.context.ts +50 -0
- package/src/.ldo/typeIndex.schema.ts +144 -0
- package/src/.ldo/typeIndex.shapeTypes.ts +28 -0
- package/src/.ldo/typeIndex.typings.ts +58 -0
- package/src/.shapes/profile.shex +10 -0
- package/src/.shapes/typeIndex.shex +23 -0
- package/src/constants.ts +7 -0
- package/src/getTypeIndex.ts +92 -0
- package/src/index.ts +4 -0
- package/src/react/useInstanceUris.ts +45 -0
- package/src/react/useTypeIndexProfile.ts +10 -0
- package/src/react/util/useSubscribeToUris.ts +35 -0
- package/src/setTypeIndex.ts +207 -0
- package/src/util/Options.ts +14 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useInstanceUris = void 0;
|
|
4
|
+
const useTypeIndexProfile_1 = require("./useTypeIndexProfile");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const useSubscribeToUris_1 = require("./util/useSubscribeToUris");
|
|
7
|
+
const solid_react_1 = require("@ldo/solid-react");
|
|
8
|
+
const typeIndex_shapeTypes_1 = require("../.ldo/typeIndex.shapeTypes");
|
|
9
|
+
const constants_1 = require("../constants");
|
|
10
|
+
const getTypeIndex_1 = require("../getTypeIndex");
|
|
11
|
+
function useInstanceUris(classUri) {
|
|
12
|
+
const { dataset } = (0, solid_react_1.useLdo)();
|
|
13
|
+
const profile = (0, useTypeIndexProfile_1.useTypeIndexProfile)();
|
|
14
|
+
const typeIndexUris = (0, react_1.useMemo)(() => (profile ? (0, getTypeIndex_1.getTypeIndexesUrisFromProfile)(profile) : []), [profile]);
|
|
15
|
+
(0, useSubscribeToUris_1.useSubscribeToUris)(typeIndexUris);
|
|
16
|
+
const [leafUris, setLeafUris] = (0, react_1.useState)([]);
|
|
17
|
+
const typeRegistrations = (0, solid_react_1.useMatchSubject)(typeIndex_shapeTypes_1.TypeRegistrationShapeType, constants_1.RDF_TYPE, constants_1.TYPE_REGISTRATION);
|
|
18
|
+
(0, react_1.useEffect)(() => {
|
|
19
|
+
(0, getTypeIndex_1.getInstanceUris)(classUri, typeRegistrations, {
|
|
20
|
+
solidLdoDataset: dataset,
|
|
21
|
+
}).then(setLeafUris);
|
|
22
|
+
}, [typeRegistrations]);
|
|
23
|
+
return leafUris;
|
|
24
|
+
}
|
|
25
|
+
exports.useInstanceUris = useInstanceUris;
|
|
26
|
+
//# sourceMappingURL=useInstanceUris.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useInstanceUris.js","sourceRoot":"","sources":["../../src/react/useInstanceUris.ts"],"names":[],"mappings":";;;AACA,+DAA4D;AAC5D,iCAAqD;AACrD,kEAA+D;AAC/D,kDAA2D;AAC3D,uEAAyE;AACzE,4CAA2D;AAC3D,kDAGyB;AAQzB,SAAgB,eAAe,CAAC,QAAgB;IAC9C,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,oBAAM,GAAE,CAAC;IAC7B,MAAM,OAAO,GAAG,IAAA,yCAAmB,GAAE,CAAC;IAEtC,MAAM,aAAa,GAAa,IAAA,eAAO,EACrC,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAA,4CAA6B,EAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAC7D,CAAC,OAAO,CAAC,CACV,CAAC;IAEF,IAAA,uCAAkB,EAAC,aAAa,CAAC,CAAC;IAElC,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,IAAA,gBAAQ,EAAY,EAAE,CAAC,CAAC;IAExD,MAAM,iBAAiB,GAAG,IAAA,6BAAe,EACvC,gDAAyB,EACzB,oBAAQ,EACR,6BAAiB,CAClB,CAAC;IAEF,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAA,8BAAe,EAAC,QAAQ,EAAE,iBAAiB,EAAE;YAC3C,eAAe,EAAE,OAAO;SACzB,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACvB,CAAC,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAExB,OAAO,QAAQ,CAAC;AAClB,CAAC;AA1BD,0CA0BC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useTypeIndexProfile = void 0;
|
|
4
|
+
const solid_react_1 = require("@ldo/solid-react");
|
|
5
|
+
const profile_shapeTypes_1 = require("../.ldo/profile.shapeTypes");
|
|
6
|
+
function useTypeIndexProfile() {
|
|
7
|
+
const { session } = (0, solid_react_1.useSolidAuth)();
|
|
8
|
+
(0, solid_react_1.useResource)(session.webId, { subscribe: true });
|
|
9
|
+
const profile = (0, solid_react_1.useSubject)(profile_shapeTypes_1.TypeIndexProfileShapeType, session.webId);
|
|
10
|
+
return profile;
|
|
11
|
+
}
|
|
12
|
+
exports.useTypeIndexProfile = useTypeIndexProfile;
|
|
13
|
+
//# sourceMappingURL=useTypeIndexProfile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTypeIndexProfile.js","sourceRoot":"","sources":["../../src/react/useTypeIndexProfile.ts"],"names":[],"mappings":";;;AAAA,kDAAyE;AAEzE,mEAAuE;AAEvE,SAAgB,mBAAmB;IACjC,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,0BAAY,GAAE,CAAC;IACnC,IAAA,yBAAW,EAAC,OAAO,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAChD,MAAM,OAAO,GAAG,IAAA,wBAAU,EAAC,8CAAyB,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IACrE,OAAO,OAAO,CAAC;AACjB,CAAC;AALD,kDAKC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useSubscribeToUris(uris: string[]): void;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useSubscribeToUris = void 0;
|
|
4
|
+
const solid_react_1 = require("@ldo/solid-react");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
function useSubscribeToUris(uris) {
|
|
7
|
+
const { dataset } = (0, solid_react_1.useLdo)();
|
|
8
|
+
const currentlySubscribed = (0, react_1.useRef)({});
|
|
9
|
+
(0, react_1.useEffect)(() => {
|
|
10
|
+
const resources = uris.map((uri) => dataset.getResource(uri));
|
|
11
|
+
const previousSubscriptions = { ...currentlySubscribed.current };
|
|
12
|
+
Promise.all(resources.map(async (resource) => {
|
|
13
|
+
if (!previousSubscriptions[resource.uri]) {
|
|
14
|
+
await resource.readIfUnfetched();
|
|
15
|
+
currentlySubscribed.current[resource.uri] =
|
|
16
|
+
await resource.subscribeToNotifications();
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
delete previousSubscriptions[resource.uri];
|
|
20
|
+
}
|
|
21
|
+
})).then(async () => {
|
|
22
|
+
await Promise.all(Object.entries(previousSubscriptions).map(async ([resourceUri, subscriptionId]) => {
|
|
23
|
+
delete currentlySubscribed.current[resourceUri];
|
|
24
|
+
const resource = dataset.getResource(resourceUri);
|
|
25
|
+
await resource.unsubscribeFromNotifications(subscriptionId);
|
|
26
|
+
}));
|
|
27
|
+
});
|
|
28
|
+
}, [uris]);
|
|
29
|
+
}
|
|
30
|
+
exports.useSubscribeToUris = useSubscribeToUris;
|
|
31
|
+
//# sourceMappingURL=useSubscribeToUris.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSubscribeToUris.js","sourceRoot":"","sources":["../../../src/react/util/useSubscribeToUris.ts"],"names":[],"mappings":";;;AAAA,kDAA0C;AAC1C,iCAA0C;AAE1C,SAAgB,kBAAkB,CAAC,IAAc;IAC/C,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,oBAAM,GAAE,CAAC;IAC7B,MAAM,mBAAmB,GAAG,IAAA,cAAM,EAAyB,EAAE,CAAC,CAAC;IAC/D,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;QAC9D,MAAM,qBAAqB,GAAG,EAAE,GAAG,mBAAmB,CAAC,OAAO,EAAE,CAAC;QACjE,OAAO,CAAC,GAAG,CACT,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE;YAC/B,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;gBAExC,MAAM,QAAQ,CAAC,eAAe,EAAE,CAAC;gBACjC,mBAAmB,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC;oBACvC,MAAM,QAAQ,CAAC,wBAAwB,EAAE,CAAC;aAC7C;iBAAM;gBACL,OAAO,qBAAqB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;aAC5C;QACH,CAAC,CAAC,CACH,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE;YAEhB,MAAM,OAAO,CAAC,GAAG,CACf,MAAM,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC,GAAG,CACvC,KAAK,EAAE,CAAC,WAAW,EAAE,cAAc,CAAC,EAAE,EAAE;gBAEtC,OAAO,mBAAmB,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;gBAChD,MAAM,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;gBAClD,MAAM,QAAQ,CAAC,4BAA4B,CAAC,cAAc,CAAC,CAAC;YAC9D,CAAC,CACF,CACF,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;AACb,CAAC;AA/BD,gDA+BC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type Options } from "./util/Options";
|
|
2
|
+
import type { TypeRegistration } from "./.ldo/typeIndex.typings";
|
|
3
|
+
import type { Container } from "@ldo/solid";
|
|
4
|
+
import type { ISolidLdoDataset } from "@ldo/solid";
|
|
5
|
+
export declare function initTypeIndex(webId: string, options?: Options): Promise<void>;
|
|
6
|
+
export declare function createIndex(webId: any, profileFolder: Container, dataset: ISolidLdoDataset, isPrivate: boolean): Promise<void>;
|
|
7
|
+
interface Instances {
|
|
8
|
+
instance?: string[];
|
|
9
|
+
instanceContainer?: string[];
|
|
10
|
+
}
|
|
11
|
+
export declare function addRegistration(indexUri: string, classUri: string, instances: Instances, options?: Options): void;
|
|
12
|
+
export declare function removeRegistration(indexUri: string, classUri: string, instances: Instances, options?: Options): Promise<void>;
|
|
13
|
+
export declare function findAppropriateTypeRegistration(indexUri: string, classUri: string, options?: Options): TypeRegistration;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findAppropriateTypeRegistration = exports.removeRegistration = exports.addRegistration = exports.createIndex = exports.initTypeIndex = void 0;
|
|
4
|
+
const uuid_1 = require("uuid");
|
|
5
|
+
const typeIndex_shapeTypes_1 = require("./.ldo/typeIndex.shapeTypes");
|
|
6
|
+
const constants_1 = require("./constants");
|
|
7
|
+
const Options_1 = require("./util/Options");
|
|
8
|
+
const data_model_1 = require("@rdfjs/data-model");
|
|
9
|
+
const getTypeIndex_1 = require("./getTypeIndex");
|
|
10
|
+
const profile_shapeTypes_1 = require("./.ldo/profile.shapeTypes");
|
|
11
|
+
async function initTypeIndex(webId, options) {
|
|
12
|
+
const { dataset } = (0, Options_1.guaranteeOptions)(options);
|
|
13
|
+
const profile = await (0, getTypeIndex_1.getProfile)(webId, options);
|
|
14
|
+
if (!profile.privateTypeIndex?.length || !profile.publicTypeIndex?.length) {
|
|
15
|
+
const profileFolder = await dataset.getResource(webId).getParentContainer();
|
|
16
|
+
if (profileFolder?.isError)
|
|
17
|
+
throw profileFolder;
|
|
18
|
+
if (!profileFolder)
|
|
19
|
+
throw new Error("No folder to save the type indexes to.");
|
|
20
|
+
if (!profile.privateTypeIndex?.length) {
|
|
21
|
+
await createIndex(webId, profileFolder, dataset, true);
|
|
22
|
+
}
|
|
23
|
+
if (!profile.publicTypeIndex?.length) {
|
|
24
|
+
await createIndex(webId, profileFolder, dataset, false);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.initTypeIndex = initTypeIndex;
|
|
29
|
+
async function createIndex(webId, profileFolder, dataset, isPrivate) {
|
|
30
|
+
const createResult = await profileFolder.createChildAndOverwrite(`${isPrivate ? "private" : "public"}_index_${(0, uuid_1.v4)()}`);
|
|
31
|
+
if (createResult.isError)
|
|
32
|
+
throw createResult;
|
|
33
|
+
const indexResource = createResult.resource;
|
|
34
|
+
const wacResult = await indexResource.setWac({
|
|
35
|
+
agent: {
|
|
36
|
+
[webId]: { read: true, write: true, append: true, control: true },
|
|
37
|
+
},
|
|
38
|
+
public: {
|
|
39
|
+
read: isPrivate ? false : true,
|
|
40
|
+
write: true,
|
|
41
|
+
append: true,
|
|
42
|
+
control: true,
|
|
43
|
+
},
|
|
44
|
+
authenticated: {
|
|
45
|
+
read: isPrivate ? false : true,
|
|
46
|
+
write: true,
|
|
47
|
+
append: true,
|
|
48
|
+
control: true,
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
if (wacResult.isError)
|
|
52
|
+
throw wacResult;
|
|
53
|
+
const transaction = dataset.startTransaction();
|
|
54
|
+
const cProfile = transaction
|
|
55
|
+
.usingType(profile_shapeTypes_1.TypeIndexProfileShapeType)
|
|
56
|
+
.write(dataset.getResource(webId).uri)
|
|
57
|
+
.fromSubject(webId);
|
|
58
|
+
if (isPrivate) {
|
|
59
|
+
cProfile.privateTypeIndex?.push({ "@id": indexResource.uri });
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
cProfile.publicTypeIndex?.push({ "@id": indexResource.uri });
|
|
63
|
+
}
|
|
64
|
+
const cTypeIndex = transaction
|
|
65
|
+
.usingType(typeIndex_shapeTypes_1.TypeIndexDocumentShapeType)
|
|
66
|
+
.write(indexResource.uri)
|
|
67
|
+
.fromSubject(indexResource.uri);
|
|
68
|
+
cTypeIndex.type = [{ "@id": "ListedDocument" }, { "@id": "TypeIndex" }];
|
|
69
|
+
const commitResult = await transaction.commitToPod();
|
|
70
|
+
if (commitResult.isError)
|
|
71
|
+
throw commitResult;
|
|
72
|
+
}
|
|
73
|
+
exports.createIndex = createIndex;
|
|
74
|
+
function addRegistration(indexUri, classUri, instances, options) {
|
|
75
|
+
const typeRegistration = findAppropriateTypeRegistration(indexUri, classUri, options);
|
|
76
|
+
instances.instance?.forEach((instance) => {
|
|
77
|
+
typeRegistration.instance?.push({ "@id": instance });
|
|
78
|
+
});
|
|
79
|
+
instances.instanceContainer?.forEach((instanceContainer) => {
|
|
80
|
+
typeRegistration.instanceContainer?.push({ "@id": instanceContainer });
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
exports.addRegistration = addRegistration;
|
|
84
|
+
async function removeRegistration(indexUri, classUri, instances, options) {
|
|
85
|
+
const typeRegistration = findAppropriateTypeRegistration(indexUri, classUri, options);
|
|
86
|
+
console.log(typeRegistration["@id"]);
|
|
87
|
+
instances.instance?.forEach((instance) => {
|
|
88
|
+
typeRegistration.instance?.splice(typeRegistration.instance.findIndex((val) => val["@id"] === instance), 1);
|
|
89
|
+
});
|
|
90
|
+
instances.instanceContainer?.forEach((instanceContainer) => {
|
|
91
|
+
console.log("Splicing instanceContainers", instanceContainer);
|
|
92
|
+
typeRegistration.instanceContainer?.splice(typeRegistration.instanceContainer.findIndex((val) => val["@id"] === instanceContainer), 1);
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
exports.removeRegistration = removeRegistration;
|
|
96
|
+
function findAppropriateTypeRegistration(indexUri, classUri, options) {
|
|
97
|
+
const { dataset } = (0, Options_1.guaranteeOptions)(options);
|
|
98
|
+
const existingRegistrationsUris = dataset
|
|
99
|
+
.match(null, (0, data_model_1.namedNode)(constants_1.RDF_TYPE), (0, data_model_1.namedNode)(constants_1.TYPE_REGISTRATION), (0, data_model_1.namedNode)(indexUri))
|
|
100
|
+
.toArray()
|
|
101
|
+
.map((quad) => quad.subject);
|
|
102
|
+
const existingRegistrationForClassUri = existingRegistrationsUris.find((registrationUri) => {
|
|
103
|
+
return dataset.has((0, data_model_1.quad)(registrationUri, (0, data_model_1.namedNode)(constants_1.FOR_CLASS), (0, data_model_1.namedNode)(classUri), (0, data_model_1.namedNode)(indexUri)));
|
|
104
|
+
})?.value;
|
|
105
|
+
let typeRegistration;
|
|
106
|
+
if (existingRegistrationForClassUri) {
|
|
107
|
+
typeRegistration = dataset
|
|
108
|
+
.usingType(typeIndex_shapeTypes_1.TypeRegistrationShapeType)
|
|
109
|
+
.write(indexUri)
|
|
110
|
+
.fromSubject(existingRegistrationForClassUri);
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
typeRegistration = dataset
|
|
114
|
+
.usingType(typeIndex_shapeTypes_1.TypeRegistrationShapeType)
|
|
115
|
+
.write(indexUri)
|
|
116
|
+
.fromSubject(`${indexUri}#${(0, uuid_1.v4)()}`);
|
|
117
|
+
typeRegistration.type = { "@id": "TypeRegistration" };
|
|
118
|
+
typeRegistration.forClass = { "@id": classUri };
|
|
119
|
+
}
|
|
120
|
+
return typeRegistration;
|
|
121
|
+
}
|
|
122
|
+
exports.findAppropriateTypeRegistration = findAppropriateTypeRegistration;
|
|
123
|
+
//# sourceMappingURL=setTypeIndex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setTypeIndex.js","sourceRoot":"","sources":["../src/setTypeIndex.ts"],"names":[],"mappings":";;;AAAA,+BAA0B;AAC1B,sEAGqC;AACrC,2CAAqE;AACrE,4CAAgE;AAChE,kDAAoD;AAEpD,iDAA4C;AAC5C,kEAAsE;AAU/D,KAAK,UAAU,aAAa,CACjC,KAAa,EACb,OAAiB;IAEjB,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,0BAAgB,EAAC,OAAO,CAAC,CAAC;IAC9C,MAAM,OAAO,GAAG,MAAM,IAAA,yBAAU,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACjD,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,MAAM,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,MAAM,EAAE;QACzE,MAAM,aAAa,GAAG,MAAM,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,kBAAkB,EAAE,CAAC;QAC5E,IAAI,aAAa,EAAE,OAAO;YAAE,MAAM,aAAa,CAAC;QAChD,IAAI,CAAC,aAAa;YAChB,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;QAC5D,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,MAAM,EAAE;YACrC,MAAM,WAAW,CAAC,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;SACxD;QACD,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,MAAM,EAAE;YACpC,MAAM,WAAW,CAAC,K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,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAgB,CAAC;IAE9C,MAAM,+BAA+B,GAAG,yBAAyB,CAAC,IAAI,CACpE,CAAC,eAAe,EAAE,EAAE;QAClB,OAAO,OAAO,CAAC,GAAG,CAChB,IAAA,iBAAI,EACF,eAAe,EACf,IAAA,sBAAS,EAAC,qBAAS,CAAC,EACpB,IAAA,sBAAS,EAAC,QAAQ,CAAC,EACnB,IAAA,sBAAS,EAAC,QAAQ,CAAC,CACpB,CACF,CAAC;IACJ,CAAC,CACF,EAAE,KAAK,CAAC;IAET,IAAI,gBAAkC,CAAC;IACvC,IAAI,+BAA+B,EAAE;QACnC,gBAAgB,GAAG,OAAO;aACvB,SAAS,CAAC,gDAAyB,CAAC;aACpC,KAAK,CAAC,QAAQ,CAAC;aACf,WAAW,CAAC,+BAA+B,CAAC,CAAC;KACjD;SAAM;QACL,gBAAgB,GAAG,OAAO;aACvB,SAAS,CAAC,gDAAyB,CAAC;aACpC,KAAK,CAAC,QAAQ,CAAC;aACf,WAAW,CAAC,GAAG,QAAQ,IAAI,IAAA,SAAE,GAAE,EAAE,CAAC,CAAC;QACtC,gBAAgB,CAAC,IAAI,GAAG,EAAE,KAAK,EAAE,kBAAkB,EAAE,CAAC;QACtD,gBAAgB,CAAC,QAAQ,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;KACjD;IACD,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AA7CD,0EA6CC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ISolidLdoDataset } from "@ldo/solid";
|
|
2
|
+
export interface Options {
|
|
3
|
+
solidLdoDataset?: ISolidLdoDataset;
|
|
4
|
+
fetch?: typeof fetch;
|
|
5
|
+
}
|
|
6
|
+
export declare function guaranteeOptions(options?: Options): {
|
|
7
|
+
fetch: typeof globalThis.fetch;
|
|
8
|
+
dataset: ISolidLdoDataset;
|
|
9
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.guaranteeOptions = void 0;
|
|
4
|
+
const solid_1 = require("@ldo/solid");
|
|
5
|
+
const guaranteeFetch_1 = require("@ldo/solid/dist/util/guaranteeFetch");
|
|
6
|
+
function guaranteeOptions(options) {
|
|
7
|
+
const fetch = (0, guaranteeFetch_1.guaranteeFetch)(options?.fetch);
|
|
8
|
+
const dataset = options?.solidLdoDataset ?? (0, solid_1.createSolidLdoDataset)({ fetch });
|
|
9
|
+
return { fetch, dataset };
|
|
10
|
+
}
|
|
11
|
+
exports.guaranteeOptions = guaranteeOptions;
|
|
12
|
+
//# sourceMappingURL=Options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Options.js","sourceRoot":"","sources":["../../src/util/Options.ts"],"names":[],"mappings":";;;AAAA,sCAAmD;AAEnD,wEAAqE;AAOrE,SAAgB,gBAAgB,CAAC,OAAiB;IAChD,MAAM,KAAK,GAAG,IAAA,+BAAc,EAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC7C,MAAM,OAAO,GAAG,OAAO,EAAE,eAAe,IAAI,IAAA,6BAAqB,EAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IAC7E,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AAC5B,CAAC;AAJD,4CAIC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ldo/solid-type-index",
|
|
3
|
+
"version": "0.0.1-alpha.29",
|
|
4
|
+
"description": "Solid Type Index support for LDO",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "tsc --project tsconfig.build.json",
|
|
8
|
+
"watch": "tsc --watch",
|
|
9
|
+
"test": "npm run test:integration",
|
|
10
|
+
"test:watch": "jest --watch",
|
|
11
|
+
"prepublishOnly": "npm run test && npm run build",
|
|
12
|
+
"build:ldo": "ldo build --input src/.shapes --output src/.ldo",
|
|
13
|
+
"lint": "eslint src/** --fix --no-error-on-unmatched-pattern",
|
|
14
|
+
"test:integration": "start-server-and-test start-test-server http://localhost:3003 start-integration-test",
|
|
15
|
+
"start-test-server": "ts-node ./test/test-server/runServer.ts",
|
|
16
|
+
"start-integration-test": "jest --coverage"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/o-development/ldobjects.git"
|
|
21
|
+
},
|
|
22
|
+
"author": "Jackson Morgan",
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/o-development/ldobjects/issues"
|
|
26
|
+
},
|
|
27
|
+
"homepage": "https://github.com/o-development/ldobjects/tree/main/packages/solid-react#readme",
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@ldo/rdf-utils": "^0.0.1-alpha.24",
|
|
30
|
+
"@rdfjs/types": "^1.0.1",
|
|
31
|
+
"@testing-library/react": "^14.1.2",
|
|
32
|
+
"@types/jest": "^27.0.3",
|
|
33
|
+
"jest-environment-jsdom": "^27.0.0",
|
|
34
|
+
"start-server-and-test": "^2.0.3",
|
|
35
|
+
"ts-jest": "^27.1.2",
|
|
36
|
+
"ts-node": "^10.9.2"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@ldo/solid": "^0.0.1-alpha.29",
|
|
40
|
+
"@ldo/solid-react": "^0.0.1-alpha.29"
|
|
41
|
+
},
|
|
42
|
+
"files": [
|
|
43
|
+
"dist",
|
|
44
|
+
"src"
|
|
45
|
+
],
|
|
46
|
+
"publishConfig": {
|
|
47
|
+
"access": "public"
|
|
48
|
+
},
|
|
49
|
+
"gitHead": "56f78cef2b1b0d668c47d356c5f13517fe714505"
|
|
50
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { LdoJsonldContext } from "@ldo/jsonld-dataset-proxy";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* =============================================================================
|
|
5
|
+
* profileContext: JSONLD Context for profile
|
|
6
|
+
* =============================================================================
|
|
7
|
+
*/
|
|
8
|
+
export const profileContext: LdoJsonldContext = {
|
|
9
|
+
privateTypeIndex: {
|
|
10
|
+
"@id": "http://www.w3.org/ns/solid/terms#privateTypeIndex",
|
|
11
|
+
"@type": "@id",
|
|
12
|
+
"@isCollection": true,
|
|
13
|
+
},
|
|
14
|
+
publicTypeIndex: {
|
|
15
|
+
"@id": "http://www.w3.org/ns/solid/terms#publicTypeIndex",
|
|
16
|
+
"@type": "@id",
|
|
17
|
+
"@isCollection": true,
|
|
18
|
+
},
|
|
19
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Schema } from "shexj";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* =============================================================================
|
|
5
|
+
* profileSchema: ShexJ Schema for profile
|
|
6
|
+
* =============================================================================
|
|
7
|
+
*/
|
|
8
|
+
export const profileSchema: Schema = {
|
|
9
|
+
type: "Schema",
|
|
10
|
+
shapes: [
|
|
11
|
+
{
|
|
12
|
+
id: "https://shaperepo.com/schemas/solidProfile#TypeIndexProfile",
|
|
13
|
+
type: "ShapeDecl",
|
|
14
|
+
shapeExpr: {
|
|
15
|
+
type: "Shape",
|
|
16
|
+
expression: {
|
|
17
|
+
type: "EachOf",
|
|
18
|
+
expressions: [
|
|
19
|
+
{
|
|
20
|
+
type: "TripleConstraint",
|
|
21
|
+
predicate: "http://www.w3.org/ns/solid/terms#privateTypeIndex",
|
|
22
|
+
valueExpr: {
|
|
23
|
+
type: "NodeConstraint",
|
|
24
|
+
nodeKind: "iri",
|
|
25
|
+
},
|
|
26
|
+
min: 0,
|
|
27
|
+
max: -1,
|
|
28
|
+
annotations: [
|
|
29
|
+
{
|
|
30
|
+
type: "Annotation",
|
|
31
|
+
predicate: "http://www.w3.org/2000/01/rdf-schema#comment",
|
|
32
|
+
object: {
|
|
33
|
+
value:
|
|
34
|
+
"A registry of all types used on the user's Pod (for private access only)",
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
type: "TripleConstraint",
|
|
41
|
+
predicate: "http://www.w3.org/ns/solid/terms#publicTypeIndex",
|
|
42
|
+
valueExpr: {
|
|
43
|
+
type: "NodeConstraint",
|
|
44
|
+
nodeKind: "iri",
|
|
45
|
+
},
|
|
46
|
+
min: 0,
|
|
47
|
+
max: -1,
|
|
48
|
+
annotations: [
|
|
49
|
+
{
|
|
50
|
+
type: "Annotation",
|
|
51
|
+
predicate: "http://www.w3.org/2000/01/rdf-schema#comment",
|
|
52
|
+
object: {
|
|
53
|
+
value:
|
|
54
|
+
"A registry of all types used on the user's Pod (for public access)",
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ShapeType } from "@ldo/ldo";
|
|
2
|
+
import { profileSchema } from "./profile.schema";
|
|
3
|
+
import { profileContext } from "./profile.context";
|
|
4
|
+
import { TypeIndexProfile } from "./profile.typings";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* =============================================================================
|
|
8
|
+
* LDO ShapeTypes profile
|
|
9
|
+
* =============================================================================
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* TypeIndexProfile ShapeType
|
|
14
|
+
*/
|
|
15
|
+
export const TypeIndexProfileShapeType: ShapeType<TypeIndexProfile> = {
|
|
16
|
+
schema: profileSchema,
|
|
17
|
+
shape: "https://shaperepo.com/schemas/solidProfile#TypeIndexProfile",
|
|
18
|
+
context: profileContext,
|
|
19
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ContextDefinition } from "jsonld";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* =============================================================================
|
|
5
|
+
* Typescript Typings for profile
|
|
6
|
+
* =============================================================================
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* TypeIndexProfile Type
|
|
11
|
+
*/
|
|
12
|
+
export interface TypeIndexProfile {
|
|
13
|
+
"@id"?: string;
|
|
14
|
+
"@context"?: ContextDefinition;
|
|
15
|
+
/**
|
|
16
|
+
* A registry of all types used on the user's Pod (for private access only)
|
|
17
|
+
*/
|
|
18
|
+
privateTypeIndex?: {
|
|
19
|
+
"@id": string;
|
|
20
|
+
}[];
|
|
21
|
+
/**
|
|
22
|
+
* A registry of all types used on the user's Pod (for public access)
|
|
23
|
+
*/
|
|
24
|
+
publicTypeIndex?: {
|
|
25
|
+
"@id": string;
|
|
26
|
+
}[];
|
|
27
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { LdoJsonldContext } from "@ldo/jsonld-dataset-proxy";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* =============================================================================
|
|
5
|
+
* typeIndexContext: JSONLD Context for typeIndex
|
|
6
|
+
* =============================================================================
|
|
7
|
+
*/
|
|
8
|
+
export const typeIndexContext: LdoJsonldContext = {
|
|
9
|
+
type: {
|
|
10
|
+
"@id": "@type"
|
|
11
|
+
},
|
|
12
|
+
TypeIndex: {
|
|
13
|
+
"@id": "http://www.w3.org/ns/solid/terms#TypeIndex",
|
|
14
|
+
"@context": {
|
|
15
|
+
type: {
|
|
16
|
+
"@id": "@type",
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
ListedDocument: {
|
|
21
|
+
"@id": "http://www.w3.org/ns/solid/terms#ListedDocument",
|
|
22
|
+
"@context": {
|
|
23
|
+
type: {
|
|
24
|
+
"@id": "@type",
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
TypeRegistration: {
|
|
29
|
+
"@id": "http://www.w3.org/ns/solid/terms#TypeRegistration",
|
|
30
|
+
"@context": {
|
|
31
|
+
type: {
|
|
32
|
+
"@id": "@type",
|
|
33
|
+
},
|
|
34
|
+
forClass: {
|
|
35
|
+
"@id": "http://www.w3.org/ns/solid/terms#forClass",
|
|
36
|
+
"@type": "@id",
|
|
37
|
+
},
|
|
38
|
+
instance: {
|
|
39
|
+
"@id": "http://www.w3.org/ns/solid/terms#instance",
|
|
40
|
+
"@type": "@id",
|
|
41
|
+
"@isCollection": true,
|
|
42
|
+
},
|
|
43
|
+
instanceContainer: {
|
|
44
|
+
"@id": "http://www.w3.org/ns/solid/terms#instanceContainer",
|
|
45
|
+
"@type": "@id",
|
|
46
|
+
"@isCollection": true,
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
};
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { Schema } from "shexj";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* =============================================================================
|
|
5
|
+
* typeIndexSchema: ShexJ Schema for typeIndex
|
|
6
|
+
* =============================================================================
|
|
7
|
+
*/
|
|
8
|
+
export const typeIndexSchema: Schema = {
|
|
9
|
+
type: "Schema",
|
|
10
|
+
shapes: [
|
|
11
|
+
{
|
|
12
|
+
id: "https://shaperepo.com/schemas/solidProfile#TypeIndexDocument",
|
|
13
|
+
type: "ShapeDecl",
|
|
14
|
+
shapeExpr: {
|
|
15
|
+
type: "Shape",
|
|
16
|
+
expression: {
|
|
17
|
+
type: "EachOf",
|
|
18
|
+
expressions: [
|
|
19
|
+
{
|
|
20
|
+
type: "TripleConstraint",
|
|
21
|
+
predicate: "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
|
|
22
|
+
valueExpr: {
|
|
23
|
+
type: "NodeConstraint",
|
|
24
|
+
values: ["http://www.w3.org/ns/solid/terms#TypeIndex"],
|
|
25
|
+
},
|
|
26
|
+
annotations: [
|
|
27
|
+
{
|
|
28
|
+
type: "Annotation",
|
|
29
|
+
predicate: "http://www.w3.org/2000/01/rdf-schema#comment",
|
|
30
|
+
object: {
|
|
31
|
+
value: "Defines the node as a TypeIndex",
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
type: "TripleConstraint",
|
|
38
|
+
predicate: "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
|
|
39
|
+
valueExpr: {
|
|
40
|
+
type: "NodeConstraint",
|
|
41
|
+
values: ["http://www.w3.org/ns/solid/terms#ListedDocument"],
|
|
42
|
+
},
|
|
43
|
+
annotations: [
|
|
44
|
+
{
|
|
45
|
+
type: "Annotation",
|
|
46
|
+
predicate: "http://www.w3.org/2000/01/rdf-schema#comment",
|
|
47
|
+
object: {
|
|
48
|
+
value: "Defines the node as a Listed Document",
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
},
|
|
55
|
+
extra: ["http://www.w3.org/1999/02/22-rdf-syntax-ns#type"],
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
id: "https://shaperepo.com/schemas/solidProfile#TypeRegistration",
|
|
60
|
+
type: "ShapeDecl",
|
|
61
|
+
shapeExpr: {
|
|
62
|
+
type: "Shape",
|
|
63
|
+
expression: {
|
|
64
|
+
type: "EachOf",
|
|
65
|
+
expressions: [
|
|
66
|
+
{
|
|
67
|
+
type: "TripleConstraint",
|
|
68
|
+
predicate: "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
|
|
69
|
+
valueExpr: {
|
|
70
|
+
type: "NodeConstraint",
|
|
71
|
+
values: ["http://www.w3.org/ns/solid/terms#TypeRegistration"],
|
|
72
|
+
},
|
|
73
|
+
annotations: [
|
|
74
|
+
{
|
|
75
|
+
type: "Annotation",
|
|
76
|
+
predicate: "http://www.w3.org/2000/01/rdf-schema#comment",
|
|
77
|
+
object: {
|
|
78
|
+
value: "Defines this node as a Type Registration",
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
type: "TripleConstraint",
|
|
85
|
+
predicate: "http://www.w3.org/ns/solid/terms#forClass",
|
|
86
|
+
valueExpr: {
|
|
87
|
+
type: "NodeConstraint",
|
|
88
|
+
nodeKind: "iri",
|
|
89
|
+
},
|
|
90
|
+
annotations: [
|
|
91
|
+
{
|
|
92
|
+
type: "Annotation",
|
|
93
|
+
predicate: "http://www.w3.org/2000/01/rdf-schema#comment",
|
|
94
|
+
object: {
|
|
95
|
+
value: "The class of object at this type.",
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
type: "TripleConstraint",
|
|
102
|
+
predicate: "http://www.w3.org/ns/solid/terms#instance",
|
|
103
|
+
valueExpr: {
|
|
104
|
+
type: "NodeConstraint",
|
|
105
|
+
nodeKind: "iri",
|
|
106
|
+
},
|
|
107
|
+
min: 0,
|
|
108
|
+
max: -1,
|
|
109
|
+
annotations: [
|
|
110
|
+
{
|
|
111
|
+
type: "Annotation",
|
|
112
|
+
predicate: "http://www.w3.org/2000/01/rdf-schema#comment",
|
|
113
|
+
object: {
|
|
114
|
+
value: "A specific resource that contains the class.",
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
type: "TripleConstraint",
|
|
121
|
+
predicate: "http://www.w3.org/ns/solid/terms#instanceContainer",
|
|
122
|
+
valueExpr: {
|
|
123
|
+
type: "NodeConstraint",
|
|
124
|
+
nodeKind: "iri",
|
|
125
|
+
},
|
|
126
|
+
min: 0,
|
|
127
|
+
max: -1,
|
|
128
|
+
annotations: [
|
|
129
|
+
{
|
|
130
|
+
type: "Annotation",
|
|
131
|
+
predicate: "http://www.w3.org/2000/01/rdf-schema#comment",
|
|
132
|
+
object: {
|
|
133
|
+
value: "Containers that contain resources with the class.",
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
],
|
|
137
|
+
},
|
|
138
|
+
],
|
|
139
|
+
},
|
|
140
|
+
extra: ["http://www.w3.org/1999/02/22-rdf-syntax-ns#type"],
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
],
|
|
144
|
+
};
|