@rdfc/js-runner 0.2.0 → 0.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.
package/dist/index.js ADDED
@@ -0,0 +1,73 @@
1
+ import { Store } from "n3";
2
+ import { getArgs } from "./args.js";
3
+ import { load_store, LOG } from "./util.js";
4
+ export * from "./connectors.js";
5
+ import path from "path";
6
+ import { RDF } from "@treecg/types";
7
+ import { ChannelFactory, Conn, JsOntology } from "./connectors.js";
8
+ import { extractShapes } from "rdf-lens";
9
+ function safeJoin(a, b) {
10
+ if (b.startsWith("/")) {
11
+ return b;
12
+ }
13
+ return path.join(a, b);
14
+ }
15
+ export async function extractProcessors(source, apply) {
16
+ const store = new Store();
17
+ await load_store(source, store);
18
+ const quads = store.getQuads(null, null, null, null);
19
+ const config = extractShapes(quads, apply);
20
+ const subjects = quads
21
+ .filter((x) => x.predicate.equals(RDF.terms.type) &&
22
+ x.object.equals(JsOntology.JsProcess))
23
+ .map((x) => x.subject);
24
+ const processorLens = config.lenses[JsOntology.JsProcess.value];
25
+ const processors = subjects.map((id) => processorLens.execute({ id, quads }));
26
+ return { processors, quads, shapes: config };
27
+ }
28
+ export function extractSteps(proc, quads, config) {
29
+ const out = [];
30
+ const subjects = quads
31
+ .filter((x) => x.predicate.equals(RDF.terms.type) && x.object.equals(proc.ty))
32
+ .map((x) => x.subject);
33
+ const processorLens = config.lenses[proc.ty.value];
34
+ const fields = proc.mapping.parameters;
35
+ for (let id of subjects) {
36
+ const obj = processorLens.execute({ id, quads });
37
+ const functionArgs = new Array(fields.length);
38
+ for (let field of fields) {
39
+ functionArgs[field.position] = obj[field.parameter];
40
+ }
41
+ out.push(functionArgs);
42
+ }
43
+ return out;
44
+ }
45
+ export async function jsRunner() {
46
+ const args = getArgs();
47
+ const cwd = process.cwd();
48
+ const source = {
49
+ location: safeJoin(cwd, args.input).replaceAll("\\", "/"),
50
+ type: "remote",
51
+ };
52
+ const factory = new ChannelFactory();
53
+ const apply = {};
54
+ apply[Conn.ReaderChannel.value] = factory.createReader.bind(factory);
55
+ apply[Conn.WriterChannel.value] = factory.createWriter.bind(factory);
56
+ const { processors, quads, shapes: config, } = await extractProcessors(source, apply);
57
+ LOG.main("Found %d processors", processors.length);
58
+ const starts = [];
59
+ for (let proc of processors) {
60
+ const argss = extractSteps(proc, quads, config);
61
+ const jsProgram = await import("file://" + proc.file);
62
+ process.chdir(proc.location);
63
+ for (let args of argss) {
64
+ starts.push(await jsProgram[proc.func](...args));
65
+ }
66
+ }
67
+ await factory.init();
68
+ for (let s of starts) {
69
+ if (s && typeof s === "function") {
70
+ s();
71
+ }
72
+ }
73
+ }
@@ -0,0 +1 @@
1
+ {"program":{"fileNames":["../node_modules/typescript/lib/lib.es5.d.ts","../node_modules/typescript/lib/lib.es2015.d.ts","../node_modules/typescript/lib/lib.es2016.d.ts","../node_modules/typescript/lib/lib.es2017.d.ts","../node_modules/typescript/lib/lib.es2018.d.ts","../node_modules/typescript/lib/lib.es2019.d.ts","../node_modules/typescript/lib/lib.es2020.d.ts","../node_modules/typescript/lib/lib.es2021.d.ts","../node_modules/typescript/lib/lib.es2022.d.ts","../node_modules/typescript/lib/lib.es2015.core.d.ts","../node_modules/typescript/lib/lib.es2015.collection.d.ts","../node_modules/typescript/lib/lib.es2015.generator.d.ts","../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../node_modules/typescript/lib/lib.es2015.promise.d.ts","../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../node_modules/typescript/lib/lib.es2016.intl.d.ts","../node_modules/typescript/lib/lib.es2017.date.d.ts","../node_modules/typescript/lib/lib.es2017.object.d.ts","../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2017.string.d.ts","../node_modules/typescript/lib/lib.es2017.intl.d.ts","../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../node_modules/typescript/lib/lib.es2018.intl.d.ts","../node_modules/typescript/lib/lib.es2018.promise.d.ts","../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../node_modules/typescript/lib/lib.es2019.array.d.ts","../node_modules/typescript/lib/lib.es2019.object.d.ts","../node_modules/typescript/lib/lib.es2019.string.d.ts","../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../node_modules/typescript/lib/lib.es2019.intl.d.ts","../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../node_modules/typescript/lib/lib.es2020.date.d.ts","../node_modules/typescript/lib/lib.es2020.promise.d.ts","../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2020.string.d.ts","../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../node_modules/typescript/lib/lib.es2020.intl.d.ts","../node_modules/typescript/lib/lib.es2020.number.d.ts","../node_modules/typescript/lib/lib.es2021.promise.d.ts","../node_modules/typescript/lib/lib.es2021.string.d.ts","../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../node_modules/typescript/lib/lib.es2021.intl.d.ts","../node_modules/typescript/lib/lib.es2022.array.d.ts","../node_modules/typescript/lib/lib.es2022.error.d.ts","../node_modules/typescript/lib/lib.es2022.intl.d.ts","../node_modules/typescript/lib/lib.es2022.object.d.ts","../node_modules/typescript/lib/lib.es2022.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2022.string.d.ts","../node_modules/typescript/lib/lib.es2022.regexp.d.ts","../node_modules/typescript/lib/lib.esnext.intl.d.ts","../node_modules/typescript/lib/lib.decorators.d.ts","../node_modules/typescript/lib/lib.decorators.legacy.d.ts","../node_modules/@types/command-line-args/index.d.ts","../node_modules/@types/command-line-usage/index.d.ts","../src/args.ts","../node_modules/@types/node/assert.d.ts","../node_modules/@types/node/assert/strict.d.ts","../node_modules/buffer/index.d.ts","../node_modules/undici-types/header.d.ts","../node_modules/undici-types/readable.d.ts","../node_modules/undici-types/file.d.ts","../node_modules/undici-types/fetch.d.ts","../node_modules/undici-types/formdata.d.ts","../node_modules/undici-types/connector.d.ts","../node_modules/undici-types/client.d.ts","../node_modules/undici-types/errors.d.ts","../node_modules/undici-types/dispatcher.d.ts","../node_modules/undici-types/global-dispatcher.d.ts","../node_modules/undici-types/global-origin.d.ts","../node_modules/undici-types/pool-stats.d.ts","../node_modules/undici-types/pool.d.ts","../node_modules/undici-types/handlers.d.ts","../node_modules/undici-types/balanced-pool.d.ts","../node_modules/undici-types/agent.d.ts","../node_modules/undici-types/mock-interceptor.d.ts","../node_modules/undici-types/mock-agent.d.ts","../node_modules/undici-types/mock-client.d.ts","../node_modules/undici-types/mock-pool.d.ts","../node_modules/undici-types/mock-errors.d.ts","../node_modules/undici-types/proxy-agent.d.ts","../node_modules/undici-types/api.d.ts","../node_modules/undici-types/cookies.d.ts","../node_modules/undici-types/patch.d.ts","../node_modules/undici-types/filereader.d.ts","../node_modules/undici-types/diagnostics-channel.d.ts","../node_modules/undici-types/websocket.d.ts","../node_modules/undici-types/content-type.d.ts","../node_modules/undici-types/cache.d.ts","../node_modules/undici-types/interceptors.d.ts","../node_modules/undici-types/index.d.ts","../node_modules/@types/node/globals.d.ts","../node_modules/@types/node/async_hooks.d.ts","../node_modules/@types/node/buffer.d.ts","../node_modules/@types/node/child_process.d.ts","../node_modules/@types/node/cluster.d.ts","../node_modules/@types/node/console.d.ts","../node_modules/@types/node/constants.d.ts","../node_modules/@types/node/crypto.d.ts","../node_modules/@types/node/dgram.d.ts","../node_modules/@types/node/diagnostics_channel.d.ts","../node_modules/@types/node/dns.d.ts","../node_modules/@types/node/dns/promises.d.ts","../node_modules/@types/node/domain.d.ts","../node_modules/@types/node/dom-events.d.ts","../node_modules/@types/node/events.d.ts","../node_modules/@types/node/fs.d.ts","../node_modules/@types/node/fs/promises.d.ts","../node_modules/@types/node/http.d.ts","../node_modules/@types/node/http2.d.ts","../node_modules/@types/node/https.d.ts","../node_modules/@types/node/inspector.d.ts","../node_modules/@types/node/module.d.ts","../node_modules/@types/node/net.d.ts","../node_modules/@types/node/os.d.ts","../node_modules/@types/node/path.d.ts","../node_modules/@types/node/perf_hooks.d.ts","../node_modules/@types/node/process.d.ts","../node_modules/@types/node/punycode.d.ts","../node_modules/@types/node/querystring.d.ts","../node_modules/@types/node/readline.d.ts","../node_modules/@types/node/readline/promises.d.ts","../node_modules/@types/node/repl.d.ts","../node_modules/@types/node/stream.d.ts","../node_modules/@types/node/stream/promises.d.ts","../node_modules/@types/node/stream/consumers.d.ts","../node_modules/@types/node/stream/web.d.ts","../node_modules/@types/node/string_decoder.d.ts","../node_modules/@types/node/test.d.ts","../node_modules/@types/node/timers.d.ts","../node_modules/@types/node/timers/promises.d.ts","../node_modules/@types/node/tls.d.ts","../node_modules/@types/node/trace_events.d.ts","../node_modules/@types/node/tty.d.ts","../node_modules/@types/node/url.d.ts","../node_modules/@types/node/util.d.ts","../node_modules/@types/node/v8.d.ts","../node_modules/@types/node/vm.d.ts","../node_modules/@types/node/wasi.d.ts","../node_modules/@types/node/worker_threads.d.ts","../node_modules/@types/node/zlib.d.ts","../node_modules/@types/node/globals.global.d.ts","../node_modules/@types/node/index.d.ts","../node_modules/@rdfjs/types/data-model.d.ts","../node_modules/@rdfjs/types/stream.d.ts","../node_modules/@rdfjs/types/dataset.d.ts","../node_modules/@rdfjs/types/query/common.d.ts","../node_modules/@rdfjs/types/query/queryable.d.ts","../node_modules/@rdfjs/types/query.d.ts","../node_modules/@rdfjs/types/index.d.ts","../node_modules/@treecg/types/dist/lib/Bucketizer.d.ts","../node_modules/@treecg/types/dist/lib/BucketizerOptions.d.ts","../node_modules/@treecg/types/dist/lib/Member.d.ts","../node_modules/@treecg/types/dist/lib/RelationParameters.d.ts","../node_modules/@treecg/types/dist/lib/Fragment.d.ts","../node_modules/@treecg/types/dist/lib/utils/Logger-Browser.d.ts","../node_modules/@treecg/types/dist/lib/Vocabularies.d.ts","../node_modules/@treecg/types/dist/index.d.ts","../src/connectors/file.ts","../node_modules/@types/ws/index.d.ts","../src/connectors/ws.ts","../node_modules/kafkajs/types/index.d.ts","../src/connectors/kafka.ts","../src/connectors/http.ts","../node_modules/@types/n3/index.d.ts","../node_modules/rdf-lens/dist/lens.d.ts","../node_modules/rdf-lens/dist/shacl.d.ts","../node_modules/rdf-lens/dist/index.d.ts","../src/index.ts","../node_modules/@types/ms/index.d.ts","../node_modules/@types/debug/index.d.ts","../src/util.ts","../src/connectors.ts","../node_modules/@types/estree/index.d.ts","../node_modules/@types/graceful-fs/index.d.ts","../node_modules/@types/istanbul-lib-coverage/index.d.ts","../node_modules/@types/istanbul-lib-report/index.d.ts","../node_modules/@types/istanbul-reports/index.d.ts","../node_modules/@types/normalize-package-data/index.d.ts","../node_modules/@types/stack-utils/index.d.ts","../node_modules/@types/yargs-parser/index.d.ts","../node_modules/@types/yargs/index.d.ts"],"fileInfos":[{"version":"824cb491a40f7e8fdeb56f1df5edf91b23f3e3ee6b4cde84d4a99be32338faee","affectsGlobalScope":true},"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","9a68c0c07ae2fa71b44384a839b7b8d81662a236d4b9ac30916718f7510b1b2d","5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","5514e54f17d6d74ecefedc73c504eadffdeda79c7ea205cf9febead32d45c4bc",{"version":"138fb588d26538783b78d1e3b2c2cc12d55840b97bf5e08bca7f7a174fbe2f17","affectsGlobalScope":true},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true},{"version":"4443e68b35f3332f753eacc66a04ac1d2053b8b035a0e0ac1d455392b5e243b3","affectsGlobalScope":true},{"version":"bc47685641087c015972a3f072480889f0d6c65515f12bd85222f49a98952ed7","affectsGlobalScope":true},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true},{"version":"93495ff27b8746f55d19fcbcdbaccc99fd95f19d057aed1bd2c0cafe1335fbf0","affectsGlobalScope":true},{"version":"6fc23bb8c3965964be8c597310a2878b53a0306edb71d4b5a4dfe760186bcc01","affectsGlobalScope":true},{"version":"ea011c76963fb15ef1cdd7ce6a6808b46322c527de2077b6cfdf23ae6f5f9ec7","affectsGlobalScope":true},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true},{"version":"bb42a7797d996412ecdc5b2787720de477103a0b2e53058569069a0e2bae6c7e","affectsGlobalScope":true},{"version":"4738f2420687fd85629c9efb470793bb753709c2379e5f85bc1815d875ceadcd","affectsGlobalScope":true},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true},{"version":"9fc46429fbe091ac5ad2608c657201eb68b6f1b8341bd6d670047d32ed0a88fa","affectsGlobalScope":true},{"version":"61c37c1de663cf4171e1192466e52c7a382afa58da01b1dc75058f032ddf0839","affectsGlobalScope":true},{"version":"b541a838a13f9234aba650a825393ffc2292dc0fc87681a5d81ef0c96d281e7a","affectsGlobalScope":true},{"version":"b20fe0eca9a4e405f1a5ae24a2b3290b37cf7f21eba6cbe4fc3fab979237d4f3","affectsGlobalScope":true},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true},{"version":"49ed889be54031e1044af0ad2c603d627b8bda8b50c1a68435fe85583901d072","affectsGlobalScope":true},{"version":"e93d098658ce4f0c8a0779e6cab91d0259efb88a318137f686ad76f8410ca270","affectsGlobalScope":true},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true},{"version":"bf14a426dbbf1022d11bd08d6b8e709a2e9d246f0c6c1032f3b2edb9a902adbe","affectsGlobalScope":true},{"version":"5e07ed3809d48205d5b985642a59f2eba47c402374a7cf8006b686f79efadcbd","affectsGlobalScope":true},{"version":"2b72d528b2e2fe3c57889ca7baef5e13a56c957b946906d03767c642f386bbc3","affectsGlobalScope":true},{"version":"8073890e29d2f46fdbc19b8d6d2eb9ea58db9a2052f8640af20baff9afbc8640","affectsGlobalScope":true},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true},{"version":"51e547984877a62227042850456de71a5c45e7fe86b7c975c6e68896c86fa23b","affectsGlobalScope":true},{"version":"956d27abdea9652e8368ce029bb1e0b9174e9678a273529f426df4b3d90abd60","affectsGlobalScope":true},{"version":"4fa6ed14e98aa80b91f61b9805c653ee82af3502dc21c9da5268d3857772ca05","affectsGlobalScope":true},{"version":"e6633e05da3ff36e6da2ec170d0d03ccf33de50ca4dc6f5aeecb572cedd162fb","affectsGlobalScope":true},{"version":"d8670852241d4c6e03f2b89d67497a4bbefe29ecaa5a444e2c11a9b05e6fccc6","affectsGlobalScope":true},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true},{"version":"caccc56c72713969e1cfe5c3d44e5bab151544d9d2b373d7dbe5a1e4166652be","affectsGlobalScope":true},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true},{"version":"50d53ccd31f6667aff66e3d62adf948879a3a16f05d89882d1188084ee415bbc","affectsGlobalScope":true},{"version":"13f6e6380c78e15e140243dc4be2fa546c287c6d61f4729bc2dd7cf449605471","affectsGlobalScope":true},{"version":"33358442698bb565130f52ba79bfd3d4d484ac85fe33f3cb1759c54d18201393","affectsGlobalScope":true},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true},"5b7206ca5f2f6eeaac6daa285664f424e0b728f3e31937da89deb8696c5f1dbc","53dd92e141efe47b413a058f3fbcc6e40a84f5afdde16f45de550a476da25d98",{"version":"da5342725395c9c1bb7bb90e035613b480e9cafda92001a9e9e95c1261e27759","signature":"868c24a79becad6edb3001a86ccade1033cb9b3553b200e71f6eb43cb32f78e3"},"9004b6757fde33f153c3a7694c15b017531a0261fafb99e0542a8a6f61be1708","7394959e5a741b185456e1ef5d64599c36c60a323207450991e7a42e08911419","4967529644e391115ca5592184d4b63980569adf60ee685f968fd59ab1557188","5929864ce17fba74232584d90cb721a89b7ad277220627cc97054ba15a98ea8f","7180c03fd3cb6e22f911ce9ba0f8a7008b1a6ddbe88ccf16a9c8140ef9ac1686","25c8056edf4314820382a5fdb4bb7816999acdcb929c8f75e3f39473b87e85bc","54cb85a47d760da1c13c00add10d26b5118280d44d58e6908d8e89abbd9d7725","3e4825171442666d31c845aeb47fcd34b62e14041bb353ae2b874285d78482aa","c6fd2c5a395f2432786c9cb8deb870b9b0e8ff7e22c029954fabdd692bff6195","a967bfe3ad4e62243eb604bf956101e4c740f5921277c60debaf325c1320bf88","e9775e97ac4877aebf963a0289c81abe76d1ec9a2a7778dbe637e5151f25c5f3","471e1da5a78350bc55ef8cef24eb3aca6174143c281b8b214ca2beda51f5e04a","cadc8aced301244057c4e7e73fbcae534b0f5b12a37b150d80e5a45aa4bebcbd","385aab901643aa54e1c36f5ef3107913b10d1b5bb8cbcd933d4263b80a0d7f20","9670d44354bab9d9982eca21945686b5c24a3f893db73c0dae0fd74217a4c219","db3435f3525cd785bf21ec6769bf8da7e8a776be1a99e2e7efb5f244a2ef5fee","c3b170c45fc031db31f782e612adf7314b167e60439d304b49e704010e7bafe5","40383ebef22b943d503c6ce2cb2e060282936b952a01bea5f9f493d5fb487cc7","4893a895ea92c85345017a04ed427cbd6a1710453338df26881a6019432febdd","3a84b7cb891141824bd00ef8a50b6a44596aded4075da937f180c90e362fe5f6","13f6f39e12b1518c6650bbb220c8985999020fe0f21d818e28f512b7771d00f9","9b5369969f6e7175740bf51223112ff209f94ba43ecd3bb09eefff9fd675624a","4fe9e626e7164748e8769bbf74b538e09607f07ed17c2f20af8d680ee49fc1da","24515859bc0b836719105bb6cc3d68255042a9f02a6022b3187948b204946bd2","33203609eba548914dc83ddf6cadbc0bcb6e8ef89f6d648ca0908ae887f9fcc5","0db18c6e78ea846316c012478888f33c11ffadab9efd1cc8bcc12daded7a60b6","89167d696a849fce5ca508032aabfe901c0868f833a8625d5a9c6e861ef935d2","e53a3c2a9f624d90f24bf4588aacd223e7bec1b9d0d479b68d2f4a9e6011147f","339dc5265ee5ed92e536a93a04c4ebbc2128f45eeec6ed29f379e0085283542c","9f0a92164925aa37d4a5d9dd3e0134cff8177208dba55fd2310cd74beea40ee2","8bfdb79bf1a9d435ec48d9372dc93291161f152c0865b81fc0b2694aedb4578d","2e85db9e6fd73cfa3d7f28e0ab6b55417ea18931423bd47b409a96e4a169e8e6","c46e079fe54c76f95c67fb89081b3e399da2c7d109e7dca8e4b58d83e332e605","d32275be3546f252e3ad33976caf8c5e842c09cb87d468cb40d5f4cf092d1acc","4a0c3504813a3289f7fb1115db13967c8e004aa8e4f8a9021b95285502221bd1",{"version":"4d719cfab49ae4045d15cb6bed0f38ad3d7d6eb7f277d2603502a0f862ca3182","affectsGlobalScope":true},"39b1a50d543770780b0409a4caacb87f3ff1d510aedfeb7dc06ed44188256f89",{"version":"5fd58752ae77b0ef6a7cbde3294a5d99238ff2e7c3e113c7125eab953e28d41d","affectsGlobalScope":true},"1f2d8573577ad731813e4358b913b667923a94e6456f645918fba11134040d13","fe39ceafa361b6d339b518936275eff89a77e7dfe92f2efa5fb97abf9a95ca49",{"version":"815c751d4afee4651d61edf6204187372a55ca8e0126a906986b4859ec51f192","affectsGlobalScope":true},"a40826e8476694e90da94aa008283a7de50d1dafd37beada623863f1901cb7fb","8a67dc9edddace374b1a96852ab5bbb87b631d439a928e6df326587d1f4fe9f0","fbcf2c3cde728761b05dbf8e7a9b8be1f5514dc324c6f83b87ba5c0668119b98","7eb0662b995994db248290a0f0a1d8ed685991a162ff9eb4dee36f099cccd0d9","16bbaee4dd96ec8b67026329a4f5fdef6313e42a5c305ddeb498c3d65fb557b8","37a36483218b24a50be2548a71557603e01ce38154c9f3f635c6c8275abd9fb1","c6cf9428f45f3d78b07df7d7aab1569994c177d36549e3a962f952d89f026bc4",{"version":"2c71199d1fc83bf17636ad5bf63a945633406b7b94887612bba4ef027c662b3e","affectsGlobalScope":true},{"version":"6c7b9d2139abd8f2e83ed8fa018c3799ab3187755a6665621feb6e93d3429ac3","affectsGlobalScope":true},"d617229425b25df2046a9c1e321dd1b50825abc8e3b38048453345483f8601e1","badd4f5fe0cca51915ef597852d07598ca490f6d1d9d68d505a159f18cde792d","d46e19fef3e961431a9b85adff6a8de04a1e8fc37366f6541c40237fb8247626","e6d2e297c73016fc98095238b25428591d129481c50eb1b6e575d35f3f8c621e","e3baa0c5780c2c805ec33a999722a2f740b572eb3746fd0a5f93a0a5c3dbf7f6","48fedd2f8549a2ae7e62f30fdb015779c2a7b536760730c5269406cd3d17cab2",{"version":"e492737de7f023b47ff14ca54b9635ba3dcd64816ed3316c9f3a784cf5897173","affectsGlobalScope":true},"40798238bc2e17ee787a815dbce4f2c89c161e5ad2fde062fb50454c093fa433","f5ce35485541e817c2d4105d3eb78e3e538bbb009515ed014694363fa3e94ceb","323506ce173f7f865f42f493885ee3dacd18db6359ea1141d57676d3781ce10c",{"version":"e7391fb34deecd321ae15af659cbfb0b9abc995c5ed4b3d703ba768e44b89670","affectsGlobalScope":true},{"version":"0900d10c17bae29648b266c0ae7cef0c95ebb2a1d81541b833833ed0996ac85a","affectsGlobalScope":true},"58520d6ae3a339cd22ffc528b50b21e4e8f5247a87913eb1c697c1af62eb0395","186614c0f9ca0ec3cfa988f1dc01c6f392a798710072ff4bdf20ce56e09a6dfd","2de7a21c92226fb8abbeed7a0a9bd8aa6d37e4c68a8c7ff7938c644267e9fcc1","6d6070c5c81ba0bfe58988c69e3ba3149fc86421fd383f253aeb071cbf29cd41","48dab0d6e633b8052e7eaa0efb0bb3d58a733777b248765eafcb0b0349439834","6e4b2642721462bf62d19593770659f268a6ca1e9fd15543747efb3ac471cee3","269929a24b2816343a178008ac9ae9248304d92a8ba8e233055e0ed6dbe6ef71","93452d394fdd1dc551ec62f5042366f011a00d342d36d50793b3529bfc9bd633","cdaaf046791d7d588f28f32197c5d6acc43343e62540a67eed194c9c20535fdc","4b1ff655bd8edd879dd4f04f15338ce0109f58ccb424165d44fa07e7ea39c4bf",{"version":"6fa3d3f427475a5d21fed826d6457e7f9ee3a0abeb3124fc41f385f112368d2e","affectsGlobalScope":true},{"version":"b85e57e102a1df14980b46d745c9fe8e16a9b0a69a98fb1a2c558c9137ab30d6","affectsGlobalScope":true},"4e228e78c1e9b0a75c70588d59288f63a6258e8b1fe4a67b0c53fe03461421d9","e5ce801ce5e85d7281807d8a65a21ee9767c122c87da262891582b4afead5ec0","76a89af04f2ba1807309320dab5169c0d1243b80738b4a2005989e40a136733e","c045b664abf3fc2a4750fa96117ab2735e4ed45ddd571b2a6a91b9917e231a02",{"version":"057d7f56aacd575a6240838d2684d34a340acde815f84190ea5e9afd611aeee6","affectsGlobalScope":true},{"version":"40ed27386f21a739bd0d2e2cfed563760588f2aeaa7ad149c1bf1454a7ec743a","affectsGlobalScope":true},"d1ef1d8516286380fd0a6f498f1650d374a8cb5f03d91633b6124e4fb8fb131d","6244a29671c12a54fc5b1393dde60bac655bd778d84758a4db847f684d4da3a5","8bc733ffd630d49d495663bfecf590281c8f5412b33657430ab471b558206705",{"version":"171c1840775746917e7b813c9df0fc0b84876f96623a6cfef3b3de7ea816b8c5","affectsGlobalScope":true},"f2b9440f98d6f94c8105883a2b65aee2fce0248f71f41beafd0a80636f3a565d",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true},"b510d0a18e3db42ac9765d26711083ec1e8b4e21caaca6dc4d25ae6e8623f447","c0156ff6b3c5f5b6699fafa0e36635590651aa70a07314425cf212f11c2443f8","b1cac4e06205000177d05342bc524983550157a72fcf450b701e747deb19e6af","d2cdba5be077b28a91fd380157e423d093279590aedb605f51ed6b6f398657c1","0d278d3cf006676a7c6c30424326bd38aba8344c471b64289ab89e4dcdb6e799","8953bf122fc832d335954e3a9188cbe4766ee2ef9be51f577de52234cd8a630e","642970856d429003a8a04298231d0dedac726519411a8b88afd90e2ab689f094","25006341224db03de63a44dea009de6523428c1bfe214ce069d10d0748838f12","aa1196da64d7fb641934dbf9683d45c2feea84f8aed23795c7793564bb2b8e08","a8b9548c59b33326a9fe601dad0242350e801af3091d2cf8f29279bd3d766a84","691ca3c93dc4aa9e14880dfcaa141df361b8cff75a8d298ed026b3e342561e02","ad44c5b327076d4f9c1fa00aaa41a3a0d2858df3adfb8cd0cdd944e05dd4a86a","5ee0f472c2200c82722e5b0f33646ac2dc8529204d81a32ac74ec794a07758ac","4a7e35c3dca7a40e70c2eefd62458ba6d84fcac7e1a3ed7ffe90a76b576af6dd","344ffbbf371267ad3874d80e012e173fc67ff71af9fb886d8a18c89ac0a7a307","588f0e8ab710dca145e2ea80f0ecad3a072b06c110c31728027aa23024b5d06d",{"version":"0bb63a686c33cd8774f0c94d41ccf8a2ae4bbb5d7ac5502ed953f2ca68ecfd03","signature":"d60e1442381b68677b579286e409d292d7a72b05aca68cd12e6612ec8c581072"},"5562230b6ae4f2205fddf46ab28518d4b0a5727c1e04d4f568c76d0271ae3293",{"version":"7a38699ef13ab44b31fa51ab790904606299558a8e1dffb69ae2f10cb81f04de","signature":"bc7e6cc3b1a0f4bafb908fb25abe8f4e02f971ab3b6861e589a890e44082037f"},"c724034e22cbbde98550aca4ee32006f7f4c566885328949ac16ff9ff2f76e89",{"version":"45da32b5d99afc24a81e16da4d847a1cf1ddf72c65ebf7c42c28120d5d231ca9","signature":"663b1f2f533658817dbc0a077a3b7c7731912848ee265846207ea8f69b48d185"},{"version":"4f9f655e8028f5ee1d0d5f228de6ba4550c506e6cb1725551a5e7b5c653daeb9","signature":"96c7eabd37baeeb90ee8b4636a0e17aefd2d1ffd8062e8c34889793bc52b018f"},"74a4b426b437193f77a8ddcfa6059660403e0773f17f304b907542ebbb865b06","0df4c76f4dbf8986e9979ea8d4d9551d527bfe933c1d8d7c4c3743031455d469","1e7aa39114c8ecaec6292f8174d32cf8dfa2af491b29ce7b0d57b29063a3a21a","0231e5425f539b30c9665bbff15496ab31c7ce9f29fcfb834b988f790218fe87",{"version":"4755fa07d84e1bd7d204b58110e768f488dc169b39aac642ca3c60ab72474dea","signature":"0dcf71c7268ffcdbc4d406f6f26b32e32f8979e7d6cc5cd5f233717acdb59b03"},"68cc8d6fcc2f270d7108f02f3ebc59480a54615be3e09a47e14527f349e9d53e","3eb11dbf3489064a47a2e1cf9d261b1f100ef0b3b50ffca6c44dd99d6dd81ac1",{"version":"871860d7c7323bbef559e0c7b18a754b29a88e3d5e1ed0920f564c4cb62e7d3e","signature":"8d0e8d67470a52aca20ae9ce83a1b142c9cc9fc753e97041b1d78481ce7048fa"},{"version":"fc4adb06b4fe3e7669b22999164701b89a3ec8199a4297aef556ebf9af5f3e6e","signature":"2be8793e8d700d0c6741d4473b0e3a3f4cde1acdfb4f157ec1f0294266b3b1ff"},"ee7d8894904b465b072be0d2e4b45cf6b887cdba16a467645c4e200982ece7ea","afe73051ff6a03a9565cbd8ebb0e956ee3df5e913ad5c1ded64218aabfa3dcb5","035a5df183489c2e22f3cf59fc1ed2b043d27f357eecc0eb8d8e840059d44245","a4809f4d92317535e6b22b01019437030077a76fec1d93b9881c9ed4738fcc54","5f53fa0bd22096d2a78533f94e02c899143b8f0f9891a46965294ee8b91a9434","22293bd6fa12747929f8dfca3ec1684a3fe08638aa18023dd286ab337e88a592","ab82804a14454734010dcdcd43f564ff7b0389bee4c5692eec76ff5b30d4cf66","bae8d023ef6b23df7da26f51cea44321f95817c190342a36882e93b80d07a960","610960e660271e158ba1656254569c3d72ff172a5eae5999f8970fadab3f86e5"],"root":[61,164,166,168,169,174,177,178],"options":{"allowSyntheticDefaultImports":true,"declaration":true,"downlevelIteration":true,"esModuleInterop":true,"experimentalDecorators":true,"module":7,"outDir":"./","preserveConstEnums":true,"removeComments":true,"skipLibCheck":true,"strict":true,"strictFunctionTypes":false,"strictPropertyInitialization":false,"target":9},"fileIdsList":[[141],[141,149,150],[141,148,149,150,151,154],[141,152,153],[111,141,149],[141,149,152],[111,129,141,149],[141,156,157,158,159,160,161,162],[141,155],[141,155,158,159],[141,175],[112,141,148],[141,181],[141,182],[111,129,141,148,155],[62,141],[98,141],[99,104,132,141],[100,111,112,119,129,140,141],[100,101,111,119,141],[102,141],[103,104,112,120,141],[104,129,137,141],[105,107,111,119,141],[106,141],[107,108,141],[111,141],[109,111,141],[98,111,141],[111,112,113,129,140,141],[111,112,113,126,129,132,141],[96,141,145],[107,111,114,119,129,140,141],[111,112,114,115,119,129,137,140,141],[114,116,129,137,140,141],[62,63,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147],[111,117,141],[118,140,141,145],[107,111,119,129,141],[120,141],[121,141],[98,122,141],[123,139,141,145],[124,141],[125,141],[111,126,127,141],[126,128,141,143],[99,111,129,130,131,132,141],[99,129,131,141],[129,130,141],[132,141],[133,141],[98,129,141],[111,135,136,141],[135,136,141],[104,119,129,137,141],[138,141],[119,139,141],[99,114,125,140,141],[104,141],[129,141,142],[118,141,143],[141,144],[99,104,111,113,122,129,140,141,143,145],[129,141,146],[111,114,116,129,137,140,141,146,148],[141,186],[119,137,141,148],[141,171,172],[141,155,171],[73,77,140,141],[73,129,140,141],[68,141],[70,73,137,140,141],[119,137,141],[141,148],[68,141,148],[70,73,119,140,141],[65,66,69,72,99,111,129,140,141],[65,71,141],[69,73,99,132,140,141,148],[99,141,148],[89,99,141,148],[67,68,141,148],[73,141],[67,68,69,70,71,72,73,74,75,77,78,79,80,81,82,83,84,85,86,87,88,90,91,92,93,94,95,141],[73,80,81,141],[71,73,81,82,141],[72,141],[65,68,73,141],[73,77,81,82,141],[77,141],[71,73,76,140,141],[65,70,71,73,77,80,141],[99,129,141],[68,73,89,99,141,145,148],[59,60,141],[141,155,163,164,166,168,169,177],[112,113,121,141,178],[114,116,129,141,178],[112,141,167,178],[141,165,178],[61,121,141,155,163,170,173,177,178],[112,114,116,129,141,155,163,170,174,176],[155,163,164,166,168,169],[178],[167,178],[155,173,178],[129,155,163,170,174,176]],"referencedMap":[[149,1],[151,2],[155,3],[154,4],[152,5],[153,6],[150,7],[163,8],[156,9],[157,9],[160,10],[158,9],[159,9],[162,9],[161,1],[59,1],[60,1],[176,11],[179,1],[180,12],[181,1],[182,13],[183,14],[175,1],[170,15],[62,16],[63,16],[98,17],[99,18],[100,19],[101,20],[102,21],[103,22],[104,23],[105,24],[106,25],[107,26],[108,26],[110,27],[109,28],[111,29],[112,30],[113,31],[97,32],[147,1],[114,33],[115,34],[116,35],[148,36],[117,37],[118,38],[119,39],[120,40],[121,41],[122,42],[123,43],[124,44],[125,45],[126,46],[127,46],[128,47],[129,48],[131,49],[130,50],[132,51],[133,52],[134,53],[135,54],[136,55],[137,56],[138,57],[139,58],[140,59],[141,60],[142,61],[143,62],[144,63],[145,64],[146,65],[184,1],[185,1],[165,66],[186,1],[187,67],[64,1],[167,68],[173,69],[171,9],[172,70],[57,1],[58,1],[11,1],[10,1],[2,1],[12,1],[13,1],[14,1],[15,1],[16,1],[17,1],[18,1],[19,1],[3,1],[20,1],[4,1],[21,1],[25,1],[22,1],[23,1],[24,1],[26,1],[27,1],[28,1],[5,1],[29,1],[30,1],[31,1],[32,1],[6,1],[36,1],[33,1],[34,1],[35,1],[37,1],[7,1],[38,1],[43,1],[44,1],[39,1],[40,1],[41,1],[42,1],[8,1],[48,1],[45,1],[46,1],[47,1],[49,1],[9,1],[50,1],[51,1],[52,1],[55,1],[53,1],[54,1],[1,1],[56,1],[80,71],[87,72],[79,71],[94,73],[71,74],[70,75],[93,76],[88,77],[91,78],[73,79],[72,80],[68,81],[67,82],[90,83],[69,84],[74,85],[75,1],[78,85],[65,1],[96,86],[95,85],[82,87],[83,88],[85,89],[81,90],[84,91],[89,76],[76,92],[77,93],[86,94],[66,95],[92,96],[61,97],[178,98],[164,99],[169,100],[168,101],[166,102],[174,103],[177,104]],"exportedModulesMap":[[149,1],[151,2],[155,3],[154,4],[152,5],[153,6],[150,7],[163,8],[156,9],[157,9],[160,10],[158,9],[159,9],[162,9],[161,1],[59,1],[60,1],[176,11],[179,1],[180,12],[181,1],[182,13],[183,14],[175,1],[170,15],[62,16],[63,16],[98,17],[99,18],[100,19],[101,20],[102,21],[103,22],[104,23],[105,24],[106,25],[107,26],[108,26],[110,27],[109,28],[111,29],[112,30],[113,31],[97,32],[147,1],[114,33],[115,34],[116,35],[148,36],[117,37],[118,38],[119,39],[120,40],[121,41],[122,42],[123,43],[124,44],[125,45],[126,46],[127,46],[128,47],[129,48],[131,49],[130,50],[132,51],[133,52],[134,53],[135,54],[136,55],[137,56],[138,57],[139,58],[140,59],[141,60],[142,61],[143,62],[144,63],[145,64],[146,65],[184,1],[185,1],[165,66],[186,1],[187,67],[64,1],[167,68],[173,69],[171,9],[172,70],[57,1],[58,1],[11,1],[10,1],[2,1],[12,1],[13,1],[14,1],[15,1],[16,1],[17,1],[18,1],[19,1],[3,1],[20,1],[4,1],[21,1],[25,1],[22,1],[23,1],[24,1],[26,1],[27,1],[28,1],[5,1],[29,1],[30,1],[31,1],[32,1],[6,1],[36,1],[33,1],[34,1],[35,1],[37,1],[7,1],[38,1],[43,1],[44,1],[39,1],[40,1],[41,1],[42,1],[8,1],[48,1],[45,1],[46,1],[47,1],[49,1],[9,1],[50,1],[51,1],[52,1],[55,1],[53,1],[54,1],[1,1],[56,1],[80,71],[87,72],[79,71],[94,73],[71,74],[70,75],[93,76],[88,77],[91,78],[73,79],[72,80],[68,81],[67,82],[90,83],[69,84],[74,85],[75,1],[78,85],[65,1],[96,86],[95,85],[82,87],[83,88],[85,89],[81,90],[84,91],[89,76],[76,92],[77,93],[86,94],[66,95],[92,96],[178,105],[164,106],[169,106],[168,107],[166,106],[174,108],[177,109]],"semanticDiagnosticsPerFile":[149,151,155,154,152,153,150,163,156,157,160,158,159,162,161,59,60,176,179,180,181,182,183,175,170,62,63,98,99,100,101,102,103,104,105,106,107,108,110,109,111,112,113,97,147,114,115,116,148,117,118,119,120,121,122,123,124,125,126,127,128,129,131,130,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,184,185,165,186,187,64,167,173,171,172,57,58,11,10,2,12,13,14,15,16,17,18,19,3,20,4,21,25,22,23,24,26,27,28,5,29,30,31,32,6,36,33,34,35,37,7,38,43,44,39,40,41,42,8,48,45,46,47,49,9,50,51,52,55,53,54,1,56,80,87,79,94,71,70,93,88,91,73,72,68,67,90,69,74,75,78,65,96,95,82,83,85,81,84,89,76,77,86,66,92,61,178,164,169,168,166,174,177]},"version":"5.4.5"}
package/dist/util.d.ts ADDED
@@ -0,0 +1,44 @@
1
+ /// <reference types="node" />
2
+ import stream from "stream";
3
+ import { DataFactory, Store } from "n3";
4
+ import { Source } from "./index.js";
5
+ import { Quad, Term } from "@rdfjs/types";
6
+ import debug from "debug";
7
+ export declare const LOG: {
8
+ main: debug.Debugger;
9
+ channel: debug.Debugger;
10
+ util: debug.Debugger;
11
+ };
12
+ export declare function toArray<T>(stream: stream.Readable): Promise<T[]>;
13
+ export declare const OWL: {
14
+ namespace: string;
15
+ custom: (input: string) => string;
16
+ } & {
17
+ imports: string;
18
+ } & {
19
+ terms: import("@treecg/types").Namespace<"imports"[], import("@rdfjs/types").NamedNode<string>, string>;
20
+ };
21
+ export declare const CONN2: {
22
+ namespace: string;
23
+ custom: (input: string) => string;
24
+ } & {
25
+ path: string;
26
+ install: string;
27
+ build: string;
28
+ GitInstall: string;
29
+ LocalInstall: string;
30
+ url: string;
31
+ procFile: string;
32
+ EnvVariable: string;
33
+ envKey: string;
34
+ envDefault: string;
35
+ } & {
36
+ terms: import("@treecg/types").Namespace<("path" | "install" | "build" | "GitInstall" | "LocalInstall" | "url" | "procFile" | "EnvVariable" | "envKey" | "envDefault")[], import("@rdfjs/types").NamedNode<string>, string>;
37
+ };
38
+ export declare const namedNode: typeof DataFactory.namedNode, literal: typeof DataFactory.literal;
39
+ export type Keyed<T> = {
40
+ [Key in keyof T]: Term | undefined;
41
+ };
42
+ export type Map<V, K, T, O> = (value: V, key: K, item: T) => O;
43
+ export declare function load_quads(location: string, baseIRI?: string): Promise<Quad[]>;
44
+ export declare function load_store(location: Source, store: Store, recursive?: boolean): Promise<void>;
package/dist/util.js ADDED
@@ -0,0 +1,75 @@
1
+ import { createReadStream } from "fs";
2
+ import http from "http";
3
+ import https from "https";
4
+ import { DataFactory, Parser, StreamParser } from "n3";
5
+ import { createUriAndTermNamespace } from "@treecg/types";
6
+ import debug from "debug";
7
+ export const LOG = (function () {
8
+ const main = debug("js-runner");
9
+ const channel = main.extend("channel");
10
+ const util = main.extend("util");
11
+ return { main, channel, util };
12
+ })();
13
+ export function toArray(stream) {
14
+ const output = [];
15
+ return new Promise((res, rej) => {
16
+ stream.on("data", (x) => output.push(x));
17
+ stream.on("end", () => res(output));
18
+ stream.on("close", () => res(output));
19
+ stream.on("error", rej);
20
+ });
21
+ }
22
+ export const OWL = createUriAndTermNamespace("http://www.w3.org/2002/07/owl#", "imports");
23
+ export const CONN2 = createUriAndTermNamespace("https://w3id.org/conn#", "install", "build", "GitInstall", "LocalInstall", "url", "procFile", "path", "EnvVariable", "envKey", "envDefault");
24
+ export const { namedNode, literal } = DataFactory;
25
+ async function get_readstream(location) {
26
+ if (location.startsWith("https")) {
27
+ return new Promise((res) => {
28
+ https.get(location, res);
29
+ });
30
+ }
31
+ else if (location.startsWith("http")) {
32
+ return new Promise((res) => {
33
+ http.get(location, res);
34
+ });
35
+ }
36
+ else {
37
+ return createReadStream(location);
38
+ }
39
+ }
40
+ export async function load_quads(location, baseIRI) {
41
+ try {
42
+ LOG.util("Loading quads %s", location);
43
+ const parser = new StreamParser({ baseIRI: baseIRI || location });
44
+ const rdfStream = await get_readstream(location);
45
+ rdfStream.pipe(parser);
46
+ const quads = await toArray(parser);
47
+ return quads;
48
+ }
49
+ catch (ex) {
50
+ console.error("Failed to load_quads", location, baseIRI);
51
+ console.error(ex);
52
+ return [];
53
+ }
54
+ }
55
+ function load_memory_quads(value, baseIRI) {
56
+ const parser = new Parser({ baseIRI });
57
+ return parser.parse(value);
58
+ }
59
+ const loaded = new Set();
60
+ export async function load_store(location, store, recursive = true) {
61
+ if (loaded.has(location))
62
+ return;
63
+ loaded.add(location);
64
+ const quads = location.type === "remote"
65
+ ? await load_quads(location.location)
66
+ : load_memory_quads(location.value, location.baseIRI);
67
+ store.addQuads(quads);
68
+ if (recursive) {
69
+ const loc = location.type === "remote" ? location.location : location.baseIRI;
70
+ const other_imports = store.getObjects(namedNode(loc), OWL.terms.imports, null);
71
+ for (let other of other_imports) {
72
+ await load_store({ location: other.value, type: "remote" }, store, true);
73
+ }
74
+ }
75
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rdfc/js-runner",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "import": "./dist/index.js",