{"id":25205174,"url":"https://github.com/sparna-git/spoty-query-engine","last_synced_at":"2025-10-30T00:48:32.467Z","repository":{"id":263809902,"uuid":"891456023","full_name":"sparna-git/spoty-query-engine","owner":"sparna-git","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-12T07:51:40.000Z","size":162,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-10-30T00:48:27.769Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sparna-git.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-11-20T11:17:15.000Z","updated_at":"2025-02-12T07:51:43.000Z","dependencies_parsed_at":"2025-02-05T16:31:09.946Z","dependency_job_id":"19ebcaf8-cc97-42bf-8947-7692db07383d","html_url":"https://github.com/sparna-git/spoty-query-engine","commit_stats":null,"previous_names":["sparna-git/spoty-query-engine"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sparna-git/spoty-query-engine","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sparna-git%2Fspoty-query-engine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sparna-git%2Fspoty-query-engine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sparna-git%2Fspoty-query-engine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sparna-git%2Fspoty-query-engine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sparna-git","download_url":"https://codeload.github.com/sparna-git/spoty-query-engine/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sparna-git%2Fspoty-query-engine/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281726183,"owners_count":26550920,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-29T02:00:06.901Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-10T09:19:16.236Z","updated_at":"2025-10-30T00:48:32.439Z","avatar_url":"https://github.com/sparna-git.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# spoty-query-engine\n\nThis is an attempt to compile a Comunica Query Engine by following the tutorial at https://comunica.dev/docs/modify/getting_started/\n\n\n## Test the default query engine\n\n- `npm init`\n- Add dependency `npm install @comunica/query-sparql`\n- Copy code in `query-sparql-engine.js`\n- Make sure to use an \"await\" function\n- Run code with `node query-sparql-engine.js`\n\n## Test the use of a custom config\n\n- Copy `query-sparql-engine.js` into `query-custom.js`\n- Create a config file in `config/config.json` and copy inside it the default Comunica config file found at https://github.com/comunica/comunica/blob/master/engines/config-query-sparql/config/config-default.json (**/!\\ do NOT use the one provided in the documentation**)\n- Adapt the code:\n\n```typescript\n\tconst myEngine = await new QueryEngineFactory().create({\n\t    configPath: 'config/config.json', // Relative or absolute path \n\t});\n```\n\n- run with `node query-custom.js`\n\n## Test a link traversal config\n\n- Make a copy of the config file from https://github.com/comunica/comunica-feature-link-traversal/blob/2d170e26821d6f242ac1aefd4b7a2e011c5c87ee/engines/config-query-sparql-link-traversal/config/config-solid-single-pod.json\n- Added the dependency : :\n\t- `@comunica/config-query-sparql-link-traversal`\n\t- `@comunica/query-sparql-link-traversal`\n\t- `@comunica/config-query-sparql-solid`\n\t- `@comunica/query-sparql-link-traversal-solid`\n- Make a copy of `query-custom.js` into `query-custom-link-traversal.js`\n- Adapt the code:\n\n```typescript\n\tconst myEngine = await new QueryEngineFactory().create({\n\t    // configPath: 'config/config.json', // Relative or absolute path \n\t    configPath: 'config/config-spoty.json', // Relative or absolute path \n\t});\n\n\tconst bindingsStream = await myEngine.queryBindings(`\n\t  SELECT ?s ?p ?o WHERE {\n\t    ?s ?p ?o\n\t  } LIMIT 10`, {\n\t  sources: ['https://fragments.dbpedia.org/2015/en'],\n\t});\n```\n\n- run with `node query-custom-link-traversal.js`\n\n\n## Compile as an NPM package\n\n- Follow documentation at https://comunica.dev/docs/modify/getting_started/custom_init/\n- Copy the config file into config-default.json : `cp config/config-spoty.json config/config-default.json`\n- Added compile script in `package.json`:\n\n```json\n{\n  ...\n  \"scripts\": {\n    ...\n    \"build:engine\": \"comunica-compile-config config/config-default.json \u003e engine-default.js\",\n    \"build:lib\": \"tsc\",\n    \"build\": \"npm run build:lib \u0026\u0026 npm run build:engine\",\n    \"prepare\": \"npm run build\"\n  },\n}\n```\n\n- Compile with `npm run build:engine`\n\n- Create `lib` folder\n- Add in `lib` folder `QueryEngine.ts`, `QueryEngineFactory.ts`, `index.ts` and `index-browser.ts` with the content as provided in the doc\n- Added entries in the package.json file:\n\n```json\n\"main\": \"lib/index.js\",\n  \"types\": \"lib/index\",\n  \"browser\": {\n    \"./lib/index.js\": \"./lib/index-browser.js\",\n    \"./lib/index.js.map\": \"./lib/index-browser.js.map\"\n  },\n```\n\n- Added .npmignore and .gitignore as documented\n- Added `files` section in package.json as documented:\n\n```json\n\"files\": [\n    \"components\",\n    \"config\",\n    \"bin/**/*.d.ts\",\n    \"bin/**/*.js\",\n    \"bin/**/*.js.map\",\n    \"lib/**/*.d.ts\",\n    \"lib/**/*.js\",\n    \"lib/**/*.js.map\",\n    \"engine-default.js\"\n  ]\n```\n\n- added a `tsconfig.json` to allow Typescript compiling\n- added Typescript dependency : `npm i typescript --save-dev`\n- **/!\\ downgrade Typescript version to 5.5.4 to avoid error with LRUCache**. See https://github.com/isaacs/node-lru-cache/issues/354#issuecomment-2351174972:\n\n```json\n  \"devDependencies\": {\n    \"typescript\": \"5.5.4\"\n  }\n```\n\n\n## Add as a dependency to the SPoTy project\n\n- See https://medium.com/dailyjs/how-to-use-npm-link-7375b6219557\n- in `spoty-query-engine`, run `sudo npm link`\n- Then in project spoty, link to the local dependency:\n\n```\ncd ../spoty\nnpm link spoty-query-engine\n```\n\nUse the dependency:\n\n```typescript\n  import { QueryEngine } from 'spoty-query-engine';\n\n  const myEngine = new QueryEngine();\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsparna-git%2Fspoty-query-engine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsparna-git%2Fspoty-query-engine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsparna-git%2Fspoty-query-engine/lists"}