├── engines ├── query-sparql-solid │ ├── .npmignore │ ├── .dockerignore │ ├── .gitignore │ ├── .browserslistrc │ ├── lib │ │ ├── index.ts │ │ ├── index-browser.ts │ │ ├── QueryEngine.ts │ │ ├── QueryEngineFactory.ts │ │ └── CliArgsHandlerSolidAuth.ts │ ├── .babelrc │ ├── config │ │ └── config-default.json │ ├── bin │ │ ├── http.ts │ │ ├── query-dynamic.ts │ │ └── query.ts │ ├── Dockerfile │ ├── webpack.config.js │ ├── README.md │ └── package.json └── config-query-sparql-solid │ ├── .npmignore │ ├── lib │ └── index.ts │ ├── .gitignore │ ├── config │ ├── http │ │ ├── actors.json │ │ └── actors-inrupt-solid-client-authn.json │ └── config-default.json │ ├── README.md │ └── package.json ├── packages ├── actor-http-inrupt-solid-client-authn │ ├── .npmignore │ ├── lib │ │ ├── index.ts │ │ └── ActorHttpInruptSolidClientAuthn.ts │ ├── package.json │ ├── README.md │ └── test │ │ └── ActorHttpInruptSolidClientAuthn-test.ts └── actor-init-sparql-solid │ ├── README.md │ └── package.json ├── setup-jest.js ├── .eslintignore ├── typedoc.base.json ├── CONTRIBUTING.md ├── typedoc.js ├── tsconfig.eslint.json ├── .github ├── labeler.yml ├── ISSUE_TEMPLATE │ ├── Question.md │ ├── Feature_request.md │ ├── Performance_issue.md │ └── Bug_report.md ├── get-next-alpha-version.sh ├── workflows │ ├── new-issue-label.yml │ ├── issue-label-commenter.yml │ ├── issue-label-to-project-board.yml │ ├── close-issues-no-response.yml │ └── ci.yml ├── typedoc-json.sh ├── issue-commenter.yml └── ISSUE_TEMPLATE.md ├── .componentsjs-generator-config.json ├── renovate.json ├── .gitignore ├── lerna.json ├── jest.config.js ├── tsconfig.json ├── LICENSE.txt ├── eslint.config.js ├── package.json ├── CHANGELOG.md └── README.md /engines/query-sparql-solid/.npmignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /engines/config-query-sparql-solid/.npmignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/actor-http-inrupt-solid-client-authn/.npmignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /engines/config-query-sparql-solid/lib/index.ts: -------------------------------------------------------------------------------- 1 | // Empty file 2 | -------------------------------------------------------------------------------- /setup-jest.js: -------------------------------------------------------------------------------- 1 | jest.setTimeout(20000); 2 | require('jest-rdf'); 3 | -------------------------------------------------------------------------------- /engines/query-sparql-solid/.dockerignore: -------------------------------------------------------------------------------- 1 | dist 2 | test 3 | node_modules 4 | -------------------------------------------------------------------------------- /engines/query-sparql-solid/.gitignore: -------------------------------------------------------------------------------- 1 | comunica-browser.js* 2 | engine-default.js 3 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | coverage 3 | 4 | **/*.js 5 | **/*.d.ts 6 | **/*.js.map 7 | -------------------------------------------------------------------------------- /packages/actor-http-inrupt-solid-client-authn/lib/index.ts: -------------------------------------------------------------------------------- 1 | export * from './ActorHttpInruptSolidClientAuthn'; 2 | -------------------------------------------------------------------------------- /typedoc.base.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://typedoc.org/schema.json", 3 | "includeVersion": true 4 | } 5 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Want to contribute? That's great! 2 | 3 | [Click here for the full contribution guide](https://comunica.dev/contribute/). 4 | -------------------------------------------------------------------------------- /engines/query-sparql-solid/.browserslistrc: -------------------------------------------------------------------------------- 1 | # Build for most browsers 2 | >2% 3 | last 2 Chrome versions 4 | last 2 Firefox versions 5 | last 2 iOS versions 6 | -------------------------------------------------------------------------------- /engines/query-sparql-solid/lib/index.ts: -------------------------------------------------------------------------------- 1 | export * from './CliArgsHandlerSolidAuth'; 2 | export * from './QueryEngine'; 3 | export * from './QueryEngineFactory'; 4 | -------------------------------------------------------------------------------- /engines/query-sparql-solid/lib/index-browser.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable unicorn/filename-case */ 2 | /* eslint-enable unicorn/filename-case */ 3 | export * from './QueryEngine'; 4 | -------------------------------------------------------------------------------- /engines/config-query-sparql-solid/.gitignore: -------------------------------------------------------------------------------- 1 | comunica-browser.js* 2 | engine-default.js 3 | index-browser.d.ts 4 | index-browser.js 5 | index-browser.js.map 6 | *.sparql 7 | dist 8 | -------------------------------------------------------------------------------- /typedoc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: 'Comunica Solid', 3 | out: 'documentation', 4 | theme: 'default', 5 | entryPointStrategy: 'packages', 6 | entryPoints: [ 'engines/*', 'packages/*' ], 7 | }; 8 | -------------------------------------------------------------------------------- /tsconfig.eslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": [ 4 | "engines/**/*.ts", 5 | "packages/**/*.ts" 6 | ], 7 | "exclude": [ 8 | "**/node_modules" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /.github/labeler.yml: -------------------------------------------------------------------------------- 1 | bug 🐛: 2 | - '- :bug: Bug' 3 | feature ➕: 4 | - '- :heavy_plus_sign: Feature request' 5 | performance 🐌: 6 | - '- :snail: Performance issue' 7 | question ❓: 8 | - '- :question: Question' 9 | -------------------------------------------------------------------------------- /engines/query-sparql-solid/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | presets: [ 3 | ["@babel/preset-env"], 4 | ], 5 | env: { 6 | module: { 7 | presets: [ 8 | ["@babel/preset-env", { modules: false }], 9 | ], 10 | }, 11 | }, 12 | } 13 | -------------------------------------------------------------------------------- /packages/actor-init-sparql-solid/README.md: -------------------------------------------------------------------------------- 1 | # Comunica SPARQL Slid - Deprecated 2 | 3 | This package has been deprecated in favor of [`@comunica/query-sparql-solid`](https://github.com/comunica/comunica-feature-solid/tree/master/engines/query-sparql-solid). 4 | -------------------------------------------------------------------------------- /engines/query-sparql-solid/config/config-default.json: -------------------------------------------------------------------------------- 1 | { 2 | "@context": [ 3 | "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/config-query-sparql-solid/^3.0.0/components/context.jsonld" 4 | ], 5 | "import": [ 6 | "ccqss:config/config-default.json" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/Question.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "❓ Question" 3 | about: A general question 4 | 5 | --- 6 | 7 | #### Issue type: 8 | 9 | - :question: Question 10 | 11 | ____ 12 | #### Question: 13 | 14 | 15 | -------------------------------------------------------------------------------- /.github/get-next-alpha-version.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Obtain the next alpha version id of Comunica 3 | latest=$(yarn tag list @comunica/actor-http-inrupt-solid-client-authn | grep "next:" | sed "s/^.*next: \(.*\)$/\1/") 4 | latest_id=$(echo $latest | sed "s/^.*-alpha\.\(.*\)\.0$/\1/") 5 | next_id=$(($latest_id+1)) 6 | echo $next_id 7 | -------------------------------------------------------------------------------- /.componentsjs-generator-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "source": "lib", 3 | "ignorePackagePaths": [ 4 | "engines/query-sparql-solid", 5 | "packages/actor-init-sparql-solid" 6 | ], 7 | "ignoreComponents": [ 8 | "Response", 9 | "RequestInfo", 10 | "RequestInit", 11 | "Session" 12 | ], 13 | "modulePrefix": {} 14 | } 15 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/Feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "➕ Feature request" 3 | about: Suggest an idea for this project 4 | 5 | --- 6 | 7 | #### Issue type: 8 | 9 | - :heavy_plus_sign: Feature request 10 | 11 | ____ 12 | #### Description: 13 | 14 | 15 | -------------------------------------------------------------------------------- /.github/workflows/new-issue-label.yml: -------------------------------------------------------------------------------- 1 | name: "Label new issues" 2 | on: 3 | issues: 4 | types: [opened, edited] 5 | 6 | jobs: 7 | triage: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: github/issue-labeler@v2.5 11 | with: 12 | repo-token: "${{ secrets.PAT }}" 13 | configuration-path: .github/labeler.yml 14 | enable-versioned-regex: 0 15 | -------------------------------------------------------------------------------- /engines/config-query-sparql-solid/config/http/actors.json: -------------------------------------------------------------------------------- 1 | { 2 | "@context": [ 3 | "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/config-query-sparql/^3.0.0/components/context.jsonld", 4 | "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/config-query-sparql-solid/^3.0.0/components/context.jsonld" 5 | ], 6 | "import": [ 7 | "ccqss:config/http/actors-inrupt-solid-client-authn.json", 8 | "ccqs:config/http/actors-wayback.json" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /.github/typedoc-json.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | typedocjson='{ 4 | "extends": [ 5 | "../../typedoc.base.json" 6 | ], 7 | "entryPoints": [ 8 | "lib/index.ts" 9 | ] 10 | }' 11 | 12 | for package in packages/* engines/*; do 13 | tdpath="$package/typedoc.json" 14 | indexpath="$package/lib/index.ts" 15 | if [[ "$1" = "create" && -f "$indexpath" ]]; then 16 | echo "$typedocjson" > "$tdpath" 17 | elif [[ "$1" = "remove" && -f "$tdpath" ]]; then 18 | rm "$tdpath" 19 | fi 20 | done 21 | -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "github>rubensworks/renovate-presets:js" 4 | ], 5 | "rangeStrategy": "replace", 6 | "packageRules": [ 7 | { 8 | "matchSourceUrlPrefixes": ["https://github.com/comunica/comunica"], 9 | "groupName": "Comunica monorepo packages", 10 | "rangeStrategy": "bump", 11 | "automerge": true, 12 | "stabilityDays": 0, 13 | "schedule": null, 14 | "prConcurrentLimit": 0, 15 | "branchConcurrentLimit": 0 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .rdf-test-suite-cache 3 | .idea 4 | lerna-debug.log 5 | yarn-error.log 6 | **/lib/**/*.js 7 | **/lib/**/*.js.map 8 | **/lib/**/*.d.ts 9 | **/test/**/*.js 10 | **/test/**/*.js.map 11 | **/test/**/*.d.ts 12 | **/bin/**/*.js 13 | **/bin/**/*.js.map 14 | **/bin/**/*.d.ts 15 | **/index.js 16 | **/index.js.map 17 | **/index.d.ts 18 | coverage 19 | documentation 20 | earl.ttl 21 | .eslintcache 22 | web-clients/builds 23 | componentsjs-error-state.json 24 | engines/*/components 25 | packages/*/components 26 | -------------------------------------------------------------------------------- /packages/actor-init-sparql-solid/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@comunica/actor-init-sparql-solid", 3 | "version": "3.0.1", 4 | "description": "Deprecated: A SPARQL query engine for querying over Solid pods", 5 | "license": "MIT", 6 | "homepage": "https://comunica.dev/", 7 | "repository": { 8 | "type": "git", 9 | "url": "https://github.com/comunica/comunica-feature-solid.git", 10 | "directory": "packages/actor-init-sparql-solid" 11 | }, 12 | "publishConfig": { 13 | "access": "public" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /engines/query-sparql-solid/lib/QueryEngine.ts: -------------------------------------------------------------------------------- 1 | import { QueryEngineBase } from '@comunica/actor-init-query'; 2 | import type { ActorInitQueryBase } from '@comunica/actor-init-query'; 3 | 4 | // eslint-disable-next-line ts/no-require-imports,ts/no-var-requires,import/extensions 5 | const engineDefault = require('../engine-default.js'); 6 | 7 | /** 8 | * A Comunica SPARQL query engine. 9 | */ 10 | export class QueryEngine extends QueryEngineBase { 11 | public constructor(engine: ActorInitQueryBase = engineDefault()) { 12 | super(engine); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/Performance_issue.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "🐌 Performance issue" 3 | about: An issue with the performance, such as abnormally slow queries. 4 | 5 | --- 6 | 7 | #### Issue type: 8 | 9 | - :snail: Performance issue 10 | 11 | ____ 12 | #### Description: 13 | 14 | 15 | 16 | ____ 17 | #### Environment: 18 | 19 | 20 | -------------------------------------------------------------------------------- /lerna.json: -------------------------------------------------------------------------------- 1 | { 2 | "lerna": "2.4.0", 3 | "command": { 4 | "publish": { 5 | "ignoreChanges": [ 6 | "*.md" 7 | ], 8 | "message": "Bump to release version %s", 9 | "allowBranch": [ 10 | "master", 11 | "next/major" 12 | ], 13 | "npmClient": "npm" 14 | } 15 | }, 16 | "packages": [ 17 | "engines/*", 18 | "packages/*" 19 | ], 20 | "version": "3.0.1", 21 | "loglevel": "success", 22 | "registry": "https://registry.npmjs.org/", 23 | "npmClient": "yarn", 24 | "npmClientArgs": [ 25 | "--frozen-lockfile" 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /engines/query-sparql-solid/lib/QueryEngineFactory.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable node/no-path-concat */ 2 | import { QueryEngineFactoryBase } from '@comunica/actor-init-query'; 3 | import { QueryEngine } from './QueryEngine'; 4 | 5 | /** 6 | * A factory that can create query engines dynamically based on a given config. 7 | */ 8 | export class QueryEngineFactory extends QueryEngineFactoryBase { 9 | public constructor() { 10 | super( 11 | `${__dirname}/../`, 12 | `${__dirname}/../config/config-default.json`, 13 | actorInitQuery => new QueryEngine(actorInitQuery), 14 | ); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | transform: { 3 | '^.+\\.ts$': 'ts-jest', 4 | }, 5 | testRegex: '/test/.*-test.ts$', 6 | moduleFileExtensions: [ 7 | 'ts', 8 | 'js', 9 | ], 10 | globals: { 11 | 'ts-jest': { 12 | isolatedModules: true, 13 | }, 14 | }, 15 | setupFilesAfterEnv: [ './setup-jest.js' ], 16 | collectCoverage: true, 17 | coveragePathIgnorePatterns: [ 18 | '/node_modules/', 19 | '/mocks/', 20 | 'index.js', 21 | ], 22 | testEnvironment: 'node', 23 | coverageThreshold: { 24 | global: { 25 | branches: 100, 26 | functions: 100, 27 | lines: 100, 28 | statements: 100, 29 | }, 30 | }, 31 | }; 32 | -------------------------------------------------------------------------------- /engines/query-sparql-solid/bin/http.ts: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | /* eslint-disable node/no-path-concat */ 3 | import { HttpServiceSparqlEndpoint } from '@comunica/actor-init-query'; 4 | import { CliArgsHandlerSolidAuth } from '../lib/CliArgsHandlerSolidAuth'; 5 | 6 | const defaultConfigPath = `${__dirname}/../config/config-default.json`; 7 | 8 | HttpServiceSparqlEndpoint.runArgsInProcess( 9 | process.argv.slice(2), 10 | process.stdout, 11 | process.stderr, 12 | `${__dirname}/../`, 13 | process.env, 14 | defaultConfigPath, 15 | (code) => { 16 | process.exit(code); 17 | }, 18 | [ new CliArgsHandlerSolidAuth() ], 19 | ).catch(error => process.stderr.write(`${error.message}/n`)); 20 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/Bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "🐛 Bug report" 3 | about: If something is not working as expected or crashes 4 | 5 | --- 6 | 7 | #### Issue type: 8 | 9 | - :bug: Bug 10 | 11 | ____ 12 | #### Description: 13 | 14 | 15 | 16 | ____ 17 | #### Environment: 18 | 19 | 20 | 21 | 22 | #### Crash log: 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /engines/query-sparql-solid/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:16 2 | 3 | # Install location 4 | ENV dir /var/www/@comunica/query-sparql-solid/ 5 | 6 | # Copy the engine files (generated from package.json!files) 7 | COPY config ${dir}/config/ 8 | COPY lib/*.js ${dir}/lib/ 9 | COPY bin/*.js ${dir}/bin/ 10 | COPY engine-default.js package.json ${dir} 11 | 12 | # Set the npm registry 13 | ARG NPM_REGISTRY=https://registry.npmjs.org/ 14 | RUN npm config set @comunica:registry $NPM_REGISTRY 15 | 16 | # Install the node module 17 | RUN cd ${dir} && npm install --only=production 18 | 19 | # Run base binary (generated from package.json!bin) 20 | WORKDIR ${dir} 21 | ENTRYPOINT ["node", "./bin/query.js"] 22 | 23 | # Default command 24 | CMD ["--help"] 25 | -------------------------------------------------------------------------------- /engines/query-sparql-solid/webpack.config.js: -------------------------------------------------------------------------------- 1 | // Copied from: https://github.com/comunica/comunica/blob/master/packages/actor-init-sparql/webpack.config.js 2 | const path = require('node:path'); 3 | const ProgressPlugin = require('webpack').ProgressPlugin; 4 | 5 | module.exports = { 6 | entry: [ path.resolve(__dirname, 'lib/index-browser.js') ], 7 | output: { 8 | filename: 'comunica-browser.js', 9 | path: __dirname, 10 | libraryTarget: 'var', 11 | library: 'Comunica', 12 | }, 13 | devtool: 'source-map', 14 | module: { 15 | rules: [ 16 | { 17 | test: /\.js$/u, 18 | loader: 'babel-loader', 19 | exclude: /node_modules/u, 20 | }, 21 | ], 22 | }, 23 | plugins: [ 24 | new ProgressPlugin(), 25 | ], 26 | }; 27 | -------------------------------------------------------------------------------- /.github/workflows/issue-label-commenter.yml: -------------------------------------------------------------------------------- 1 | name: "Comment on issues by label" 2 | on: 3 | issues: 4 | types: [labeled] 5 | 6 | jobs: 7 | comment: 8 | runs-on: ubuntu-18.04 9 | steps: 10 | - name: get comment count 11 | id: getCommentCount 12 | env: 13 | comments: ${{ github.event.issue.comments }} 14 | run: | 15 | echo "$comments" 16 | CL=$(echo $comments | jq '. | length' ) 17 | echo "::set-output name=comments_length::$CL" 18 | - uses: actions/checkout@v2 19 | if: steps.getCommentCount.outputs.comments_length == 0 20 | - uses: peaceiris/actions-label-commenter@v1 21 | if: steps.getCommentCount.outputs.comments_length == 0 22 | with: 23 | github_token: ${{ secrets.GITHUB_TOKEN }} 24 | config_file: .github/issue-commenter.yml 25 | -------------------------------------------------------------------------------- /.github/issue-commenter.yml: -------------------------------------------------------------------------------- 1 | labels: 2 | - name: "bug 🐛" 3 | labeled: 4 | issue: 5 | body: Thanks for reporting! 6 | - name: "feature ➕" 7 | labeled: 8 | issue: 9 | body: Thanks for the suggestion! 10 | - name: "performance 🐌" 11 | labeled: 12 | issue: 13 | body: Thanks for reporting! 14 | - name: "question ❓" 15 | labeled: 16 | issue: 17 | body: Someone will answer your question soon. In the meantime, you might be able to get help more quickly on our [Gitter channel](https://gitter.im/comunica/Lobby). 18 | - name: invalid-template 19 | labeled: 20 | issue: 21 | body: '@{{ issue.user.login }} Your issue appears to be not following one of the allowed issue templates, which breaks our automation tools. Please update your issue to the proper template.' 22 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": true, 3 | "compilerOptions": { 4 | "target": "es2021", 5 | "lib": [ 6 | "es2021", 7 | "dom" 8 | ], 9 | "module": "commonjs", 10 | "resolveJsonModule": true, 11 | 12 | "strict": true, 13 | "strictFunctionTypes": true, 14 | "strictPropertyInitialization": false, 15 | "noImplicitOverride": true, 16 | "declaration": true, 17 | "downlevelIteration": true, 18 | "inlineSources": true, 19 | "preserveConstEnums": true, 20 | "removeComments": false, 21 | "sourceMap": true, 22 | "esModuleInterop": true 23 | }, 24 | "include": [ 25 | "engines/*/bin/**/*", 26 | "engines/*/lib/**/*", 27 | "packages/*/bin/**/*", 28 | "packages/*/lib/**/*", 29 | "packages/*/benchmarks/**/*" 30 | ], 31 | "exclude": [ 32 | "**/node_modules" 33 | ] 34 | } 35 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | #### Issue type: 2 | 3 | _Only keep the issue types that are applicable._ 4 | 5 | - :bug: Bug 6 | - :heavy_plus_sign: Feature request 7 | - :snail: Performance issue 8 | - :question: Question 9 | 10 | #### Description: 11 | 12 | ____ 13 | #### Environment: 14 | 15 | _Exact versions of the software in your environment, not just *latest*. Only needed for :bug: and :snail:._ 16 | 17 | | software | version(s) 18 | | ------------------- | ------- 19 | | Comunica Init Actor | 20 | | Comunica | 21 | | node | 22 | | npm | 23 | | yarn | 24 | | Operating System | 25 | -------------------------------------------------------------------------------- /engines/query-sparql-solid/bin/query-dynamic.ts: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | /* eslint-disable node/no-path-concat */ 3 | import { KeysInitQuery } from '@comunica/context-entries'; 4 | import { ActionContext } from '@comunica/core'; 5 | import { runArgsInProcess } from '@comunica/runner-cli'; 6 | import { CliArgsHandlerSolidAuth } from '../lib/CliArgsHandlerSolidAuth'; 7 | 8 | const cliArgsHandlerSolidAuth = new CliArgsHandlerSolidAuth(); 9 | runArgsInProcess(`${__dirname}/../`, `${__dirname}/../config/config-default.json`, { 10 | context: new ActionContext({ 11 | [KeysInitQuery.cliArgsHandlers.name]: [ cliArgsHandlerSolidAuth ], 12 | }), 13 | onDone() { 14 | if (cliArgsHandlerSolidAuth.session) { 15 | cliArgsHandlerSolidAuth.session.logout() 16 | // eslint-disable-next-line no-console 17 | .catch(error => console.log(error)); 18 | } 19 | }, 20 | }); 21 | -------------------------------------------------------------------------------- /engines/query-sparql-solid/bin/query.ts: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | import { KeysInitQuery } from '@comunica/context-entries'; 3 | import { ActionContext } from '@comunica/core'; 4 | import { runArgsInProcessStatic } from '@comunica/runner-cli'; 5 | import { CliArgsHandlerSolidAuth } from '../lib/CliArgsHandlerSolidAuth'; 6 | 7 | const cliArgsHandlerSolidAuth = new CliArgsHandlerSolidAuth(); 8 | // eslint-disable-next-line ts/no-require-imports,ts/no-var-requires,import/extensions 9 | runArgsInProcessStatic(require('../engine-default.js')(), { 10 | context: new ActionContext({ 11 | [KeysInitQuery.cliArgsHandlers.name]: [ cliArgsHandlerSolidAuth ], 12 | }), 13 | onDone() { 14 | if (cliArgsHandlerSolidAuth.session) { 15 | cliArgsHandlerSolidAuth.session.logout() 16 | // eslint-disable-next-line no-console 17 | .catch(error => console.log(error)); 18 | } 19 | }, 20 | }); 21 | -------------------------------------------------------------------------------- /engines/config-query-sparql-solid/README.md: -------------------------------------------------------------------------------- 1 | # Comunica SPARQL Solid Config 2 | 3 | [![npm version](https://badge.fury.io/js/%40comunica%2Fconfig-query-sparql-solid.svg)](https://www.npmjs.com/package/@comunica/config-query-sparql-solid) 4 | 5 | The default configuration files for [Comunica SPARQL Solid](https://github.com/comunica/comunica-feature-solid/tree/master/packages/query-sparql-solid#readme). 6 | 7 | This package should be used if you want to create your own Comunica query configuration, and build upon the default SPARQL Solid configurations. 8 | 9 | [Click here if you just want to query with Comunica](https://comunica.dev/docs/query/). 10 | 11 | ## Installation 12 | 13 | ```bash 14 | $ yarn add @comunica/config-query-sparql-solid 15 | ``` 16 | 17 | ## Usage 18 | 19 | Guides on how to use these configuration files and package them into a new engine can be found on our [website](https://comunica.dev/docs/modify/). 20 | -------------------------------------------------------------------------------- /.github/workflows/issue-label-to-project-board.yml: -------------------------------------------------------------------------------- 1 | name: "Add labeled issues to project board" 2 | on: 3 | issues: 4 | types: [labeled] 5 | 6 | env: 7 | MY_GITHUB_TOKEN: ${{ secrets.PAT }} 8 | 9 | jobs: 10 | assign: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - name: Maintenance Issues 14 | uses: srggrs/assign-one-project-github-action@1.3.1 15 | if: | 16 | contains(github.event.issue.labels.*.name, 'bug 🐛') || 17 | contains(github.event.issue.labels.*.name, 'performance 🐌') || 18 | contains(github.event.issue.labels.*.name, 'question ❓') 19 | with: 20 | project: 'https://github.com/orgs/comunica/projects/2' 21 | column_name: 'Triage' 22 | - name: Development Issues 23 | uses: srggrs/assign-one-project-github-action@1.3.1 24 | if: | 25 | contains(github.event.issue.labels.*.name, 'feature ➕') 26 | with: 27 | project: 'https://github.com/orgs/comunica/projects/3' 28 | column_name: 'Triage' 29 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright © 2021-now Ruben Taelman 4 | Ghent University – imec, Belgium 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /.github/workflows/close-issues-no-response.yml: -------------------------------------------------------------------------------- 1 | name: "Close issues that received no response" 2 | on: 3 | schedule: 4 | - cron: "0 0 * * *" 5 | 6 | jobs: 7 | stale: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: actions/stale@v3 11 | with: 12 | repo-token: "${{ secrets.GITHUB_TOKEN }}" 13 | stale-issue-label: "more-information-needed" 14 | stale-issue-message: 'This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we do not have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.' 15 | days-before-close: 14 16 | days-before-stale: -1 17 | - uses: actions/stale@v3 18 | with: 19 | repo-token: "${{ secrets.GITHUB_TOKEN }}" 20 | only-labels: "invalid-template" 21 | stale-issue-label: "invalid-template" 22 | stale-issue-message: 'This issue has been automatically closed because it does not follow the issue template. Feel free to recreate this issue' 23 | days-before-close: 7 24 | days-before-stale: -1 25 | -------------------------------------------------------------------------------- /engines/config-query-sparql-solid/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@comunica/config-query-sparql-solid", 3 | "version": "3.0.1", 4 | "description": "default configuration files for Comunica SPARQL Solid", 5 | "lsd:module": true, 6 | "license": "MIT", 7 | "homepage": "https://comunica.dev/", 8 | "repository": { 9 | "type": "git", 10 | "url": "https://github.com/comunica/comunica-feature-solid.git", 11 | "directory": "engines/config-query-sparql-solid" 12 | }, 13 | "bugs": { 14 | "url": "https://github.com/comunica/comunica-feature-solid/issues" 15 | }, 16 | "keywords": [ 17 | "comunica", 18 | "sparql", 19 | "engine", 20 | "query", 21 | "update", 22 | "config", 23 | "solid" 24 | ], 25 | "sideEffects": false, 26 | "main": "lib/index.js", 27 | "typings": "lib/index", 28 | "publishConfig": { 29 | "access": "public" 30 | }, 31 | "files": [ 32 | "components", 33 | "config", 34 | "lib/**/*.d.ts", 35 | "lib/**/*.js", 36 | "lib/**/*.js.map" 37 | ], 38 | "scripts": { 39 | "build": "npm run build:ts && npm run build:components", 40 | "build:ts": "node \"../../node_modules/typescript/bin/tsc\"", 41 | "build:components": "componentsjs-generator" 42 | }, 43 | "dependencies": { 44 | "@comunica/config-query-sparql": "^3.0.1" 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /packages/actor-http-inrupt-solid-client-authn/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@comunica/actor-http-inrupt-solid-client-authn", 3 | "version": "3.0.1", 4 | "description": "A inrupt-solid-client-authn http actor", 5 | "lsd:module": true, 6 | "license": "MIT", 7 | "homepage": "https://comunica.dev/", 8 | "repository": { 9 | "type": "git", 10 | "url": "https://github.com/comunica/comunica.git", 11 | "directory": "packages/actor-http-inrupt-solid-client-authn" 12 | }, 13 | "bugs": { 14 | "url": "https://github.com/comunica/comunica/issues" 15 | }, 16 | "keywords": [ 17 | "comunica", 18 | "actor", 19 | "http", 20 | "inrupt-solid-client-authn" 21 | ], 22 | "sideEffects": false, 23 | "main": "lib/index.js", 24 | "typings": "lib/index", 25 | "publishConfig": { 26 | "access": "public" 27 | }, 28 | "files": [ 29 | "components", 30 | "lib/**/*.d.ts", 31 | "lib/**/*.js", 32 | "lib/**/*.js.map" 33 | ], 34 | "scripts": { 35 | "build": "npm run build:ts && npm run build:components", 36 | "build:ts": "node \"../../node_modules/typescript/bin/tsc\"", 37 | "build:components": "componentsjs-generator" 38 | }, 39 | "dependencies": { 40 | "@comunica/bus-http": "^3.0.3", 41 | "@comunica/context-entries": "^3.0.3", 42 | "@comunica/core": "^3.0.3", 43 | "@rubensworks/solid-client-authn-isomorphic": "^2.0.1" 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /engines/query-sparql-solid/lib/CliArgsHandlerSolidAuth.ts: -------------------------------------------------------------------------------- 1 | import type { ICliArgsHandler } from '@comunica/types'; 2 | import type { Session } from '@rubensworks/solid-client-authn-isomorphic'; 3 | import type { Argv } from 'yargs'; 4 | 5 | // eslint-disable-next-line ts/no-require-imports,ts/no-var-requires 6 | const { interactiveLogin } = require('solid-node-interactive-auth'); 7 | 8 | /** 9 | * Adds and handles CLI options for Solid authentication. 10 | */ 11 | export class CliArgsHandlerSolidAuth implements ICliArgsHandler { 12 | public session: Session | undefined; 13 | 14 | public populateYargs(argumentsBuilder: Argv): Argv { 15 | return argumentsBuilder 16 | .options({ 17 | identityProvider: { 18 | alias: 'idp', 19 | type: 'string', 20 | describe: 'Solid identity provider to authenticate with (set to \'void\' to disable auth)', 21 | default: 'https://solidcommunity.net/', 22 | group: 'Recommended options:', 23 | }, 24 | }); 25 | } 26 | 27 | public async handleArgs(args: Record, context: Record): Promise { 28 | if (args.identityProvider !== 'void') { 29 | this.session = await interactiveLogin({ 30 | oidcIssuer: args.identityProvider, 31 | }); 32 | context['@comunica/actor-http-inrupt-solid-client-authn:session'] = this.session; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /engines/config-query-sparql-solid/config/http/actors-inrupt-solid-client-authn.json: -------------------------------------------------------------------------------- 1 | { 2 | "@context": [ 3 | "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/runner/^3.0.0/components/context.jsonld", 4 | 5 | "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-http-inrupt-solid-client-authn/^3.0.0/components/context.jsonld", 6 | "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-http-fetch/^3.0.0/components/context.jsonld", 7 | "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-http-proxy/^3.0.0/components/context.jsonld" 8 | ], 9 | "@id": "urn:comunica:default:Runner", 10 | "@type": "Runner", 11 | "actors": [ 12 | { 13 | "@id": "urn:comunica:default:http/actors#proxy", 14 | "@type": "ActorHttpProxy", 15 | "mediatorHttp": { "@id": "urn:comunica:default:http/mediators#main" }, 16 | "beforeActors": [ 17 | { "@id": "urn:comunica:default:http/actors#fetch" }, 18 | { "@id": "urn:comunica:default:http/actors#inrupt-solid-client-authn" } 19 | ] 20 | }, 21 | { 22 | "@id": "urn:comunica:default:http/actors#inrupt-solid-client-authn", 23 | "@type": "ActorHttpInruptSolidClientAuthn", 24 | "mediatorHttp": { "@id": "urn:comunica:default:http/mediators#main" }, 25 | "beforeActors": { "@id": "urn:comunica:default:http/actors#fetch" } 26 | }, 27 | { 28 | "@id": "urn:comunica:default:http/actors#fetch", 29 | "@type": "ActorHttpFetch" 30 | } 31 | ] 32 | } 33 | -------------------------------------------------------------------------------- /packages/actor-http-inrupt-solid-client-authn/README.md: -------------------------------------------------------------------------------- 1 | # Comunica Inrupt Solid Client Authn Http Actor 2 | 3 | [![npm version](https://badge.fury.io/js/%40comunica%2Factor-http-inrupt-solid-client-authn.svg)](https://www.npmjs.com/package/@comunica/actor-http-inrupt-solid-client-authn) 4 | 5 | An [HTTP](https://github.com/comunica/comunica/tree/master/packages/bus-http) actor that 6 | does authenticated Solid requests using [Inrupt's solid-client-authn-js libraries](https://github.com/inrupt/solid-client-authn-js). 7 | 8 | To make this actor apply, the context must contain an authenticated `Session` object at the `'@comunica/actor-http-inrupt-solid-client-authn:session'` entry, for example: 9 | ```typescript 10 | const { interactiveLogin } = require('solid-node-interactive-auth'); 11 | const session = await interactiveLogin({ oidcIssuer: 'https://solidcommunity.net/' }); 12 | 13 | await newEngine().query('SELECT * WHERE { ?s ?p ?o }', { 14 | sources: [ 'http://example.org/some-page' ], 15 | '@comunica/actor-http-inrupt-solid-client-authn:session': session, 16 | }); 17 | ``` 18 | 19 | This module is part of the [Comunica framework](https://github.com/comunica/comunica), 20 | and should only be used by [developers that want to build their own query engine](https://comunica.dev/docs/modify/). 21 | 22 | [Click here if you just want to query with Comunica](https://comunica.dev/docs/query/). 23 | 24 | ## Install 25 | 26 | ```bash 27 | $ yarn add @comunica/actor-http-inrupt-solid-client-authn 28 | ``` 29 | 30 | ## Configure 31 | 32 | After installing, this package can be added to your engine's configuration as follows: 33 | ```text 34 | { 35 | "@context": [ 36 | ... 37 | "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-http-inrupt-solid-client-authn/^3.0.0/components/context.jsonld" 38 | ], 39 | "actors": [ 40 | ... 41 | { 42 | "@id": "urn:comunica:default:http/actors#inrupt-solid-client-authn", 43 | "@type": "ActorHttpInruptSolidClientAuthn" 44 | } 45 | ] 46 | } 47 | ``` 48 | -------------------------------------------------------------------------------- /packages/actor-http-inrupt-solid-client-authn/lib/ActorHttpInruptSolidClientAuthn.ts: -------------------------------------------------------------------------------- 1 | import type { IActionHttp, IActorHttpOutput } from '@comunica/bus-http'; 2 | import { ActorHttp } from '@comunica/bus-http'; 3 | import { KeysHttp } from '@comunica/context-entries'; 4 | import type { IActorArgs, IActorTest, Mediator } from '@comunica/core'; 5 | import { ActionContextKey } from '@comunica/core'; 6 | import type { Session } from '@rubensworks/solid-client-authn-isomorphic'; 7 | 8 | /** 9 | * A comunica Inrupt Solid Client Authn Http Actor. 10 | */ 11 | export class ActorHttpInruptSolidClientAuthn extends ActorHttp { 12 | public static readonly CONTEXT_KEY_SESSION = 13 | new ActionContextKey('@comunica/actor-http-inrupt-solid-client-authn:session'); 14 | 15 | public readonly mediatorHttp: Mediator; 16 | 17 | public constructor(args: IActorHttpInruptSolidClientAuthnArgs) { 18 | super(args); 19 | } 20 | 21 | public async test(action: IActionHttp): Promise { 22 | if (!action.context || !action.context.has(ActorHttpInruptSolidClientAuthn.CONTEXT_KEY_SESSION)) { 23 | throw new Error(`Unable to find Solid authn session in context with key '${ActorHttpInruptSolidClientAuthn.CONTEXT_KEY_SESSION.name}'`); 24 | } 25 | if (action.context.has(KeysHttp.fetch)) { 26 | throw new Error(`Unable to run when a custom fetch function has been configured`); 27 | } 28 | const session: Session = action.context.get(ActorHttpInruptSolidClientAuthn.CONTEXT_KEY_SESSION)!; 29 | if (!session.info.isLoggedIn) { 30 | throw new Error(`The provided Solid authn session is not in a logged in state, make sure to call session.login() first`); 31 | } 32 | return true; 33 | } 34 | 35 | public async run(action: IActionHttp): Promise { 36 | const session: Session = action.context.get(ActorHttpInruptSolidClientAuthn.CONTEXT_KEY_SESSION)!; 37 | // Log request 38 | this.logInfo(action.context, `Handling request to ${typeof action.input === 'string' ? 39 | action.input : 40 | action.input.url} as authenticated request for ${session.info.webId}`); 41 | 42 | // Override fetch function in context 43 | return this.mediatorHttp.mediate({ 44 | ...action, 45 | context: action.context 46 | .delete(ActorHttpInruptSolidClientAuthn.CONTEXT_KEY_SESSION) 47 | .set(KeysHttp.fetch, session.fetch), 48 | }); 49 | } 50 | } 51 | 52 | export interface IActorHttpInruptSolidClientAuthnArgs extends IActorArgs { 53 | mediatorHttp: Mediator; 54 | } 55 | -------------------------------------------------------------------------------- /eslint.config.js: -------------------------------------------------------------------------------- 1 | const config = require('@rubensworks/eslint-config'); 2 | 3 | module.exports = config([ 4 | { 5 | files: [ '**/*.ts' ], 6 | languageOptions: { 7 | parserOptions: { 8 | tsconfigRootDir: __dirname, 9 | project: [ './tsconfig.eslint.json' ], 10 | }, 11 | }, 12 | }, 13 | { 14 | rules: { 15 | // Default 16 | 'unicorn/consistent-destructuring': 'off', 17 | 'unicorn/no-array-callback-reference': 'off', 18 | 19 | // TODO: check if these can be enabled 20 | 'ts/naming-convention': 'off', 21 | 'ts/no-unsafe-return': 'off', 22 | 'ts/no-unsafe-argument': 'off', 23 | 'ts/no-unsafe-assignment': 'off', 24 | 25 | 'ts/no-require-imports': [ 'error', { allow: [ 26 | 'process/', 27 | 'web-streams-ponyfill', 28 | 'is-stream', 29 | 'readable-stream-node-to-web', 30 | 'stream-to-string', 31 | ]}], 32 | 'ts/no-var-requires': [ 'error', { allow: [ 33 | 'process/', 34 | 'web-streams-ponyfill', 35 | 'is-stream', 36 | 'readable-stream-node-to-web', 37 | 'stream-to-string', 38 | ]}], 39 | }, 40 | }, 41 | { 42 | // Specific rules for NodeJS-specific files 43 | files: [ 44 | '**/test/**/*.ts', 45 | ], 46 | rules: { 47 | 'import/no-nodejs-modules': 'off', 48 | 'unused-imports/no-unused-vars': 'off', 49 | 'ts/no-require-imports': 'off', 50 | 'ts/no-var-requires': 'off', 51 | }, 52 | }, 53 | { 54 | // The config packages use an empty index.ts 55 | files: [ 56 | 'engines/config-*/lib/index.ts', 57 | ], 58 | rules: { 59 | 'import/unambiguous': 'off', 60 | }, 61 | }, 62 | { 63 | // Some test files import 'jest-rdf' which triggers this 64 | // The http actors import 'cross-fetch/polyfill' which also triggers this 65 | // Some jest tests import '../../lib' which triggers this 66 | files: [ 67 | '**/test/*-test.ts', 68 | '**/test/*-util.ts', 69 | ], 70 | rules: { 71 | 'import/no-unassigned-import': 'off', 72 | }, 73 | }, 74 | { 75 | // Files that do not require linting 76 | ignores: [ 77 | 'setup-jest.js', 78 | '**/engine-default.js', 79 | '**/engine-browser.js', 80 | '**/comunica-browser.js', 81 | '.github/**', 82 | '**/bintest/**', 83 | ], 84 | }, 85 | { 86 | files: [ '**/*.js' ], 87 | rules: { 88 | 'ts/no-require-imports': 'off', 89 | 'ts/no-var-requires': 'off', 90 | 'import/no-nodejs-modules': 'off', 91 | 'import/no-extraneous-dependencies': 'off', 92 | 'import/extensions': 'off', 93 | }, 94 | }, 95 | ]); 96 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "repository": "https://github.com/comunica/comunica-feature-solid/", 4 | "workspaces": [ 5 | "engines/*", 6 | "packages/*" 7 | ], 8 | "scripts": { 9 | "test-changed": "lerna run test --since HEAD", 10 | "build-changed": "lerna run build --since HEAD", 11 | "test": "jest", 12 | "test-ci": "jest --ci --maxWorkers=4 --coverage", 13 | "lint": "eslint . --cache", 14 | "clean": "rm -rf ./node_modules && rm -rf ./packages/*/node_modules", 15 | "build": "npm run build:ts && npm run build:components", 16 | "build:ts": "tsc", 17 | "build:components": "componentsjs-generator engines/* packages/*", 18 | "build-watch": "nodemon -e ts --ignore '*.d.ts' --exec yarn run build", 19 | "build-watch:ts": "tsc --watch", 20 | "build-watch:components": "nodemon -e d.ts --exec yarn run build:components", 21 | "publish": "yarn run build", 22 | "publish-release": "lerna publish", 23 | "publish-bare": "lerna exec -- npm publish --silent", 24 | "publish-canary": "yarn run build && lerna version prerelease --preid alpha.$(.github/get-next-alpha-version.sh) --exact --ignore-scripts --force-publish --no-push --no-git-tag-version --yes && git update-index --assume-unchanged $(git ls-files | tr '\\n' ' ') && lerna publish from-package --no-git-reset --pre-dist-tag next --force-publish --no-push --no-git-tag-version --yes && git update-index --no-assume-unchanged $(git ls-files | tr '\\n' ' ') && git checkout .", 25 | "doc": "./.github/typedoc-json.sh create && typedoc && ./.github/typedoc-json.sh remove", 26 | "postinstall": "yarn run build && lerna run prepare", 27 | "version": "manual-git-changelog onversion" 28 | }, 29 | "devDependencies": { 30 | "@babel/core": "^7.16.0", 31 | "@babel/preset-env": "^7.16.4", 32 | "@rubensworks/eslint-config": "^3.0.0", 33 | "@types/jest": "^29.0.0", 34 | "@types/node": "^20.0.0", 35 | "asynciterator": "^3.2.1", 36 | "babel-loader": "^9.0.0", 37 | "componentsjs-generator": "^4.0.1", 38 | "cross-fetch": "^4.0.0", 39 | "eslint": "^8.57.0", 40 | "immutable": "^4.0.0", 41 | "jest": "^29.0.0", 42 | "jest-rdf": "^1.7.0", 43 | "lerna": "^8.0.0", 44 | "manual-git-changelog": "^1.0.0", 45 | "nodemon": "^3.0.0", 46 | "pre-commit": "^1.2.2", 47 | "rdf-data-factory": "^1.1.0", 48 | "rdf-quad": "^1.5.0", 49 | "sparqlalgebrajs": "^4.0.0", 50 | "stream-to-string": "^1.1.0", 51 | "streamify-array": "^1.0.0", 52 | "streamify-string": "^1.0.1", 53 | "ts-jest": "^29.0.0", 54 | "typedoc": "^0.25.1", 55 | "typescript": "^5.3.3", 56 | "webpack": "^5.64.4", 57 | "webpack-cli": "^5.0.0" 58 | }, 59 | "pre-commit": [ 60 | "build", 61 | "lint", 62 | "test" 63 | ] 64 | } 65 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | All notable changes to this project will be documented in this file. 3 | 4 | 5 | ## [v3.0.1](https://github.com/comunica/comunica-feature-solid/compare/v3.0.0...v3.0.1) - 2024-03-20 6 | 7 | ### BREAKING CHANGES 8 | * [Update to Comunica v3](https://github.com/comunica/comunica-feature-solid/commit/1eef6427fcb32808c66e666bdcbd5cbe94c2a557) 9 | 10 | 11 | ## [v2.4.0](https://github.com/comunica/comunica-feature-solid/compare/v2.3.0...v2.4.0) - 2022-11-16 12 | 13 | ### Changed 14 | * [Update to Comunica 2.5](https://github.com/comunica/comunica-feature-solid/commit/164171e8ed51ff6c5eb2cb48cf3e0c6138f07ffc) 15 | * [Package .js.map files](https://github.com/comunica/comunica-feature-solid/commit/56e614145024be95e95dbd6a2b1575ac05126702) 16 | 17 | 18 | ## [v2.3.0](https://github.com/comunica/comunica-feature-solid/compare/v2.2.0...v2.3.0) - 2022-08-26 19 | 20 | ### Changed 21 | * [Update to Comunica 2.4](https://github.com/comunica/comunica-feature-solid/commit/39ac3d4191330fdd32b7590e1098a8ee95031725) 22 | 23 | 24 | ## [v2.2.0](https://github.com/comunica/comunica-feature-solid/compare/v2.1.0...v2.2.0) - 2022-07-26 25 | 26 | ### Changed 27 | * [Bump solid-authn-isomorphic to v2](https://github.com/comunica/comunica-feature-solid/commit/d65eea0308811ccaad87aaedf2ca9b9eb700d866) 28 | 29 | 30 | ## [v2.1.0](https://github.com/comunica/comunica-feature-solid/compare/v2.0.1...v2.1.0) - 2022-06-02 31 | 32 | ### Added 33 | * [Allow auth to be disabled on CLI with --idp void, Closes #28](https://github.com/comunica/comunica-feature-solid/commit/877290efb787a35555647d0d32ab169f7c0a1521) 34 | 35 | 36 | ## [v2.0.1](https://github.com/comunica/comunica-feature-solid/compare/v1.0.2...v2.0.1) - 2022-03-03 37 | 38 | ### BREAKING CHANGES 39 | * [Update to Comunica 2](https://github.com/comunica/comunica-feature-solid/commit/bd53d241b481f92d7e59839a48cad29fdf5ba4dd) 40 | * Please refer to the [CHANGELOG of Comunica for more details](https://github.com/comunica/comunica/blob/master/CHANGELOG.md#v201---2022-03-02). 41 | 42 | 43 | ## [v1.0.2](https://github.com/comunica/comunica-feature-solid/compare/v1.0.1...v1.0.2) - 2022-02-14 44 | 45 | ### Fixed 46 | * [Fix invalid browser entrypoint](https://github.com/comunica/comunica-feature-solid/commit/0c08656fa556edcb30f7bfb2174e2678340e562d) 47 | 48 | 49 | ## [v1.0.1](https://github.com/comunica/comunica-feature-solid/compare/v1.0.0...v1.0.1) - 2021-10-06 50 | 51 | ### Changed 52 | * [Use context key shortcut in query-dynamic.ts](https://github.com/comunica/comunica-feature-solid/commit/0b300e7d2bfc9e37bf031c9d617df4736ff863d4) 53 | 54 | ### Fixed 55 | * [Fix components dir not being deployed to npm](https://github.com/comunica/comunica-feature-solid/commit/cfc55a25e4ffafe4c30abe37f97791d0cac6272e) 56 | 57 | 58 | ## [v1.0.0] - 2021-10-01 59 | 60 | Initial release 61 | -------------------------------------------------------------------------------- /engines/config-query-sparql-solid/config/config-default.json: -------------------------------------------------------------------------------- 1 | { 2 | "@context": [ 3 | "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/config-query-sparql/^3.0.0/components/context.jsonld", 4 | "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/config-query-sparql-solid/^3.0.0/components/context.jsonld" 5 | ], 6 | "import": [ 7 | "ccqs:config/context-preprocess/actors.json", 8 | "ccqs:config/context-preprocess/mediators.json", 9 | "ccqs:config/hash-bindings/actors.json", 10 | "ccqs:config/hash-bindings/mediators.json", 11 | "ccqss:config/http/actors.json", 12 | "ccqs:config/http/mediators.json", 13 | "ccqs:config/http-invalidate/actors.json", 14 | "ccqs:config/http-invalidate/mediators.json", 15 | "ccqs:config/init/actors.json", 16 | "ccqs:config/merge-bindings-context/actors.json", 17 | "ccqs:config/merge-bindings-context/mediators.json", 18 | "ccqs:config/optimize-query-operation/actors.json", 19 | "ccqs:config/optimize-query-operation/mediators.json", 20 | "ccqs:config/query-operation/actors.json", 21 | "ccqs:config/query-operation/mediators.json", 22 | "ccqs:config/query-parse/actors.json", 23 | "ccqs:config/query-parse/mediators.json", 24 | "ccqs:config/query-process/actors.json", 25 | "ccqs:config/query-process/mediators.json", 26 | "ccqs:config/query-result-serialize/actors.json", 27 | "ccqs:config/query-result-serialize/mediators.json", 28 | "ccqs:config/query-source-identify/actors.json", 29 | "ccqs:config/query-source-identify/mediators.json", 30 | "ccqs:config/query-source-identify-hypermedia/actors.json", 31 | "ccqs:config/query-source-identify-hypermedia/mediators.json", 32 | "ccqs:config/dereference/actors.json", 33 | "ccqs:config/dereference/mediators.json", 34 | "ccqs:config/dereference-rdf/actors.json", 35 | "ccqs:config/dereference-rdf/mediators.json", 36 | "ccqs:config/rdf-join/actors.json", 37 | "ccqs:config/rdf-join/mediators.json", 38 | "ccqs:config/rdf-join-entries-sort/actors.json", 39 | "ccqs:config/rdf-join-entries-sort/mediators.json", 40 | "ccqs:config/rdf-join-selectivity/actors.json", 41 | "ccqs:config/rdf-join-selectivity/mediators.json", 42 | "ccqs:config/rdf-metadata/actors.json", 43 | "ccqs:config/rdf-metadata/mediators.json", 44 | "ccqs:config/rdf-metadata-accumulate/actors.json", 45 | "ccqs:config/rdf-metadata-accumulate/mediators.json", 46 | "ccqs:config/rdf-metadata-extract/actors.json", 47 | "ccqs:config/rdf-metadata-extract/mediators.json", 48 | "ccqs:config/rdf-parse/actors.json", 49 | "ccqs:config/rdf-parse/mediators.json", 50 | "ccqs:config/rdf-parse-html/actors.json", 51 | "ccqs:config/rdf-resolve-hypermedia-links/actors.json", 52 | "ccqs:config/rdf-resolve-hypermedia-links/mediators.json", 53 | "ccqs:config/rdf-resolve-hypermedia-links-queue/actors.json", 54 | "ccqs:config/rdf-resolve-hypermedia-links-queue/mediators.json", 55 | "ccqs:config/rdf-serialize/actors.json", 56 | "ccqs:config/rdf-serialize/mediators.json", 57 | "ccqs:config/rdf-update-hypermedia/actors.json", 58 | "ccqs:config/rdf-update-hypermedia/mediators.json", 59 | "ccqs:config/rdf-update-quads/actors.json", 60 | "ccqs:config/rdf-update-quads/mediators.json" 61 | ] 62 | } 63 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 | Comunica 4 | 5 |

6 | 7 |

8 | Comunica for Solid 9 |

10 | 11 |

12 | Build Status 13 | Coverage Status 14 | Gitter chat 15 |

16 | 17 | **[Learn more about Comunica on our website](https://comunica.dev/).** 18 | 19 | This is a monorepo that contains packages for allowing [Comunica](https://github.com/comunica/comunica) to query over [Solid](https://solidproject.org/) data pods. 20 | **If you want to _use_ a Solid-enabled Comunica engine, have a look at [Comunica SPARQL Solid](https://github.com/comunica/comunica-feature-solid/tree/master/engines/query-sparql-solid).** 21 | 22 | Concretely, this monorepo adds Solid support to Comunica using the following packages: 23 | 24 | * [Comunica SPARQL Solid](https://github.com/comunica/comunica-feature-solid/tree/master/engines/query-sparql-solid): A Comunica query engine that includes all Solid-related packages. 25 | * [Solid Auth Http Actor](https://github.com/comunica/comunica-feature-solid/tree/master/packages/actor-http-inrupt-solid-client-authn): HTTP actor that enables Solid authentication. 26 | 27 | [Click here to learn more about Comunica Solid, or to see live examples](https://comunica.dev/docs/query/advanced/solid/). 28 | 29 | ## Development Setup 30 | 31 | _(JSDoc: https://comunica.github.io/comunica-feature-solid/)_ 32 | 33 | This repository should be used by Comunica module **developers** as it contains multiple Comunica modules that can be composed. 34 | This repository is managed as a [monorepo](https://github.com/babel/babel/blob/master/doc/design/monorepo.md) 35 | using [Lerna](https://lernajs.io/). 36 | 37 | If you want to develop new features 38 | or use the (potentially unstable) in-development version, 39 | you can set up a development environment for Comunica. 40 | 41 | Comunica requires [Node.JS](http://nodejs.org/) 8.0 or higher and the [Yarn](https://yarnpkg.com/en/) package manager. 42 | Comunica is tested on OSX, Linux and Windows. 43 | 44 | This project can be setup by cloning and installing it as follows: 45 | 46 | ```bash 47 | $ git clone https://github.com/comunica/comunica.git 48 | $ cd comunica 49 | $ yarn install 50 | ``` 51 | 52 | **Note: `npm install` is not supported at the moment, as this project makes use of Yarn's [workspaces](https://yarnpkg.com/lang/en/docs/workspaces/) functionality** 53 | 54 | This will install the dependencies of all modules, and bootstrap the Lerna monorepo. 55 | After that, all [Comunica packages](https://github.com/comunica/comunica-feature-solid/tree/master/packages) are available in the `packages/` folder 56 | and can be used in a development environment, such as querying with [Comunica SPARQL Solid (`engines/query-sparql-solid`)](https://github.com/comunica/comunica-feature-solid/tree/master/engines/query-sparql-solid). 57 | 58 | Furthermore, this will add [pre-commit hooks](https://www.npmjs.com/package/pre-commit) 59 | to build, lint and test. 60 | These hooks can temporarily be disabled at your own risk by adding the `-n` flag to the commit command. 61 | 62 | ## License 63 | This code is copyrighted by [Ghent University – imec](http://idlab.ugent.be/) 64 | and released under the [MIT license](http://opensource.org/licenses/MIT). 65 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: "CI" 2 | on: [push, pull_request] 3 | 4 | concurrency: 5 | group: ${{ github.workflow }}-${{ github.ref }} 6 | cancel-in-progress: true 7 | 8 | jobs: 9 | 10 | test: 11 | runs-on: ${{ matrix.os }} 12 | strategy: 13 | matrix: 14 | os: [ubuntu-latest] 15 | node-version: 16 | - 18.x 17 | - 20.x 18 | steps: 19 | - name: Use Node.js ${{ matrix.node-version }} 20 | uses: actions/setup-node@v3 21 | with: 22 | node-version: ${{ matrix.node-version }} 23 | - name: Ensure line endings are consistent 24 | run: git config --global core.autocrlf input 25 | - name: Check out repository 26 | uses: actions/checkout@v3 27 | - name: Load cache 28 | uses: actions/cache@v3 29 | with: 30 | path: | 31 | **/node_modules 32 | key: ${{ runner.os }}-test-modules-v1-${{ hashFiles('**/yarn.lock') }} 33 | - name: Install dependencies 34 | run: yarn install --frozen-lockfile --ignore-engines 35 | - name: Build project 36 | run: yarn run build 37 | - name: Run tests 38 | run: yarn run test-ci 39 | - name: Submit coverage results 40 | uses: coverallsapp/github-action@master 41 | with: 42 | github-token: ${{ secrets.github_token }} 43 | flag-name: run-${{ matrix.node-version }} 44 | parallel: true 45 | 46 | coveralls: 47 | needs: test 48 | runs-on: ubuntu-latest 49 | steps: 50 | - name: Consolidate test coverage from different jobs 51 | uses: coverallsapp/github-action@master 52 | with: 53 | github-token: ${{ secrets.github_token }} 54 | parallel-finished: true 55 | 56 | lint: 57 | runs-on: ubuntu-latest 58 | steps: 59 | - name: Use Node.js 60 | uses: actions/setup-node@v3 61 | with: 62 | node-version: 18.x 63 | - name: Check out repository 64 | uses: actions/checkout@v3 65 | - name: Load cache 66 | uses: actions/cache@v3 67 | with: 68 | path: '**/node_modules' 69 | key: ${{ runner.os }}-lint-modules-v1-${{ hashFiles('**/yarn.lock') }} 70 | - name: Install dependencies 71 | run: yarn install --frozen-lockfile --ignore-engines 72 | - name: Run linter 73 | run: yarn run lint 74 | 75 | docker: 76 | needs: 77 | - test 78 | - lint 79 | runs-on: ubuntu-latest 80 | steps: 81 | - name: Use Node.js 82 | uses: actions/setup-node@v3 83 | with: 84 | node-version: 18.x 85 | - name: Check out repository 86 | uses: actions/checkout@v3 87 | - name: Load cache 88 | uses: actions/cache@v3 89 | with: 90 | path: '**/node_modules' 91 | key: ${{ runner.os }}-docker-modules-v1-${{ hashFiles('**/yarn.lock') }} 92 | - name: Install dependencies 93 | run: yarn install --frozen-lockfile --ignore-engines 94 | - name: Install Lerna Docker 95 | run: sh -c "`curl -fsSl https://raw.githubusercontent.com/rubensworks/lerna-docker/master/install.sh`" 96 | - name: Build Docker images 97 | run: ~/.lerna-docker/bin/lerna-docker comunica build 98 | - name: Deploy Docker images 99 | if: startsWith(github.ref, 'refs/heads/master') || startsWith(github.ref, 'refs/tags/') 100 | run: ~/.lerna-docker/bin/lerna-docker comunica push 101 | env: 102 | DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} 103 | DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} 104 | 105 | docs: 106 | runs-on: ubuntu-latest 107 | steps: 108 | - name: Use Node.js 109 | uses: actions/setup-node@v3 110 | with: 111 | node-version: 18.x 112 | - name: Check out repository 113 | uses: actions/checkout@v3 114 | - name: Load cache 115 | uses: actions/cache@v3 116 | with: 117 | path: '**/node_modules' 118 | key: ${{ runner.os }}-docs-modules-v1-${{ hashFiles('**/yarn.lock') }} 119 | - name: Install dependencies 120 | run: yarn install --frozen-lockfile --ignore-engines 121 | - name: Build docs 122 | run: yarn run doc 123 | - name: Deploy TSDoc to GitHub Pages 124 | if: startsWith(github.ref, 'refs/heads/master') 125 | uses: JamesIves/github-pages-deploy-action@v4 126 | with: 127 | branch: gh-pages 128 | folder: documentation 129 | clean: true 130 | -------------------------------------------------------------------------------- /packages/actor-http-inrupt-solid-client-authn/test/ActorHttpInruptSolidClientAuthn-test.ts: -------------------------------------------------------------------------------- 1 | import { KeysCore, KeysHttp } from '@comunica/context-entries'; 2 | import { ActionContext, Bus } from '@comunica/core'; 3 | import { LoggerVoid } from '@comunica/logger-void'; 4 | import type { Session } from '@rubensworks/solid-client-authn-isomorphic'; 5 | import { ActorHttpInruptSolidClientAuthn } from '../lib/ActorHttpInruptSolidClientAuthn'; 6 | import 'cross-fetch/polyfill'; 7 | 8 | describe('ActorHttpInruptSolidClientAuthn', () => { 9 | let bus: any; 10 | let mediatorHttp: any; 11 | 12 | beforeEach(() => { 13 | bus = new Bus({ name: 'bus' }); 14 | mediatorHttp = { 15 | mediate: jest.fn((args) => { 16 | return { output: 'ABC', headers: new Headers({}) }; 17 | }), 18 | }; 19 | }); 20 | 21 | describe('An ActorHttpInruptSolidClientAuthn instance', () => { 22 | let sessionNotLoggedIn: Session; 23 | let sessionLoggedIn: Session; 24 | let actor: ActorHttpInruptSolidClientAuthn; 25 | 26 | beforeEach(() => { 27 | actor = new ActorHttpInruptSolidClientAuthn({ name: 'actor', bus, mediatorHttp }); 28 | sessionNotLoggedIn = { 29 | info: { 30 | isLoggedIn: false, 31 | }, 32 | }; 33 | sessionLoggedIn = { 34 | info: { 35 | isLoggedIn: true, 36 | webId: 'WEBID', 37 | }, 38 | fetch: jest.fn(async() => 'RESPONSE'), 39 | }; 40 | }); 41 | 42 | it('should not test with empty context', async() => { 43 | await expect(actor.test({ input: 'DUMMY', context: new ActionContext({}) })).rejects 44 | .toThrow(`Unable to find Solid authn session in context with key '@comunica/actor-http-inrupt-solid-client-authn:session'`); 45 | }); 46 | 47 | it('should not test with non-logged in session', async() => { 48 | await expect(actor.test({ input: 'DUMMY', context: new ActionContext({ 49 | '@comunica/actor-http-inrupt-solid-client-authn:session': sessionNotLoggedIn, 50 | }) })).rejects 51 | .toThrow(`The provided Solid authn session is not in a logged in state, make sure to call session.login() first`); 52 | }); 53 | 54 | it('should not test with a fetch method', async() => { 55 | await expect(actor.test({ input: 'DUMMY', context: new ActionContext({ 56 | '@comunica/actor-http-inrupt-solid-client-authn:session': sessionNotLoggedIn, 57 | [KeysHttp.fetch.name]: true, 58 | }) })).rejects 59 | .toThrow(`Unable to run when a custom fetch function has been configured`); 60 | }); 61 | 62 | it('should test with logged in session', async() => { 63 | await expect(actor.test({ input: 'DUMMY', context: new ActionContext({ 64 | '@comunica/actor-http-inrupt-solid-client-authn:session': sessionLoggedIn, 65 | }) })).resolves.toBeTruthy(); 66 | }); 67 | 68 | it('should run', async() => { 69 | await actor.run({ 70 | input: 'DUMMY', 71 | context: new ActionContext({ 72 | '@comunica/actor-http-inrupt-solid-client-authn:session': sessionLoggedIn, 73 | }), 74 | }); 75 | expect(mediatorHttp.mediate).toHaveBeenCalledWith( 76 | { 77 | input: 'DUMMY', 78 | context: new ActionContext({ 79 | [KeysHttp.fetch.name]: sessionLoggedIn.fetch, 80 | }), 81 | }, 82 | ); 83 | }); 84 | 85 | it('should run with a logger', async() => { 86 | const logger = new LoggerVoid(); 87 | const spy = jest.spyOn(logger, 'info'); 88 | 89 | await actor.run({ 90 | input: { url: 'https://www.google.com/' }, 91 | init: { headers: new Headers({ a: 'b' }) }, 92 | context: new ActionContext({ 93 | [KeysCore.log.name]: logger, 94 | '@comunica/actor-http-inrupt-solid-client-authn:session': sessionLoggedIn, 95 | }), 96 | }); 97 | expect(mediatorHttp.mediate).toHaveBeenCalledWith( 98 | { 99 | input: { url: 'https://www.google.com/' }, 100 | init: { headers: new Headers({ a: 'b' }) }, 101 | context: new ActionContext({ 102 | [KeysCore.log.name]: logger, 103 | [KeysHttp.fetch.name]: sessionLoggedIn.fetch, 104 | }), 105 | }, 106 | ); 107 | 108 | expect(spy).toHaveBeenCalledWith(`Handling request to https://www.google.com/ as authenticated request for WEBID`, { 109 | actor: 'actor', 110 | }); 111 | }); 112 | 113 | it('should run with a logger without init', async() => { 114 | const logger = new LoggerVoid(); 115 | const spy = jest.spyOn(logger, 'info'); 116 | 117 | await actor.run({ 118 | input: { url: 'https://www.google.com/' }, 119 | context: new ActionContext({ 120 | [KeysCore.log.name]: logger, 121 | '@comunica/actor-http-inrupt-solid-client-authn:session': sessionLoggedIn, 122 | }), 123 | }); 124 | expect(mediatorHttp.mediate).toHaveBeenCalledWith( 125 | { 126 | input: { url: 'https://www.google.com/' }, 127 | context: new ActionContext({ 128 | [KeysCore.log.name]: logger, 129 | [KeysHttp.fetch.name]: sessionLoggedIn.fetch, 130 | }), 131 | }, 132 | ); 133 | 134 | expect(spy).toHaveBeenCalledWith(`Handling request to https://www.google.com/ as authenticated request for WEBID`, { 135 | actor: 'actor', 136 | }); 137 | }); 138 | }); 139 | }); 140 | -------------------------------------------------------------------------------- /engines/query-sparql-solid/README.md: -------------------------------------------------------------------------------- 1 | # Comunica SPARQL Solid 2 | 3 | [![npm version](https://badge.fury.io/js/%40comunica%2Fquery-sparql-solid.svg)](https://www.npmjs.com/package/@comunica/query-sparql-solid) 4 | [![Docker Pulls](https://img.shields.io/docker/pulls/comunica/query-sparql-solid.svg)](https://hub.docker.com/r/comunica/query-sparql-solid/) 5 | 6 | Comunica SPARQL Solid is a SPARQL query engine for JavaScript that can query over [Solid](https://solidproject.org/) data pods. 7 | 8 | This package is safe to use in both Node.js and browser environments. 9 | 10 | This module is part of the [Comunica framework](https://comunica.dev/). 11 | [Click here to learn more about Comunica and Solid](https://comunica.dev/docs/query/advanced/solid/). 12 | 13 | ## Known issues 14 | 15 | This library has the following known issues in certain cases, that are out of our control (but have been reported). 16 | 17 | * **Web Workers**: This library can not be used within due to an open issue in https://github.com/inrupt/solid-client-authn-js/issues/1657 18 | * **Enterprise Solid Server** (https://pod.inrupt.com/): 19 | * Patch requests are not accepted, so only new documents can be created, but existing ones can not be modified. 20 | * Due to missing `Accept-Patch`, and `Accept-Put` headers, [the destination type has to be forced](https://comunica.dev/docs/query/advanced/destination_types/). This will only work for creating new documents via the `putLdp` destination type. Updating existing documents via `patchSparqlUpdate` are currently not possible because of the previous issue. 21 | * **Node Solid Server** (https://solidcommunity.net/): 22 | * Querying or updating existing documents fails with the error `Error translating between RDF formats` (https://github.com/solid/node-solid-server/issues/1618). Creating new documents does work. 23 | 24 | No issues are known with the [Community Solid Server](https://github.com/solid/community-server/) 25 | 26 | ## Install 27 | 28 | ```bash 29 | $ yarn add @comunica/query-sparql-solid 30 | ``` 31 | 32 | or 33 | 34 | ```bash 35 | $ npm install -g @comunica/query-sparql-solid 36 | ``` 37 | 38 | ## Usage 39 | 40 | Show 100 triples from a private resource 41 | by authenticating through the https://solidcommunity.net/ identity provider (when using https://pod.inrupt.com/, your IDP will be https://broker.pod.inrupt.com/): 42 | 43 | ```bash 44 | $ comunica-sparql-solid --idp https://solidcommunity.net/ \ 45 | http://example.org/private-resource.ttl \ 46 | "SELECT * WHERE { 47 | ?s ?p ?o 48 | } LIMIT 100" 49 | ``` 50 | 51 | This command will connect with the given identity provider, 52 | and open your browser to log in with your WebID. 53 | After logging in, the query engine will be able to access all the documents you have access to. 54 | 55 | Show the help with all options: 56 | 57 | ```bash 58 | $ comunica-sparql-solid --help 59 | ``` 60 | 61 | Just like [Comunica SPARQL](https://github.com/comunica/comunica/tree/master/packages/query-sparql), 62 | a [dynamic variant](https://github.com/comunica/comunica/tree/master/packages/query-sparql#usage-from-the-command-line) (`comunica-dynamic-sparql-solid`) also exists. 63 | 64 | _[**Read more** about querying from the command line](https://comunica.dev/docs/query/getting_started/query_cli/)._ 65 | 66 | ### Usage within application 67 | 68 | This engine can be used in JavaScript/TypeScript applications as follows: 69 | 70 | ```javascript 71 | const QueryEngine = require('@comunica/query-sparql-solid').QueryEngine; 72 | const { interactiveLogin } = require('solid-node-interactive-auth'); 73 | 74 | // This will open your Web browser to log in 75 | const session = await interactiveLogin({ oidcIssuer: 'https://solidcommunity.net/' }); 76 | const myEngine = new QueryEngine(); 77 | 78 | const bindingsStream = await myEngine.queryBindings(` 79 | SELECT * WHERE { 80 | ?s ?p ?o 81 | } LIMIT 100`, { 82 | sources: [session.info.webId], // Sets your profile as query source 83 | '@comunica/actor-http-inrupt-solid-client-authn:session': session, 84 | }); 85 | 86 | // Consume results as a stream (best performance) 87 | bindingsStream.on('data', (binding) => { 88 | console.log(binding.toString()); // Quick way to print bindings for testing 89 | 90 | console.log(binding.has('s')); // Will be true 91 | 92 | // Obtaining values 93 | console.log(binding.get('s').value); 94 | console.log(binding.get('s').termType); 95 | console.log(binding.get('p').value); 96 | console.log(binding.get('o').value); 97 | }); 98 | bindingsStream.on('end', () => { 99 | // The data-listener will not be called anymore once we get here. 100 | }); 101 | bindingsStream.on('error', (error) => { 102 | console.error(error); 103 | }); 104 | 105 | // Consume results as an array (easier) 106 | const bindings = await bindingsStream.toArray(); 107 | console.log(bindings[0].get('s').value); 108 | console.log(bindings[0].get('s').termType); 109 | ``` 110 | 111 | **Note that `solid-node-interactive-auth` only works within Node.js apps. Please refer to [`@inrupt/solid-client-authn-browser`](https://www.npmjs.com/package/@inrupt/solid-client-authn-browser) if yoyou want to login via a browser app.** 112 | 113 | _[**Read more** about querying an application](https://comunica.dev/docs/query/getting_started/query_app/)._ 114 | 115 | ### Usage as a SPARQL endpoint 116 | 117 | Start a webservice exposing a private resource via the SPARQL protocol, i.e., a _SPARQL endpoint_, 118 | by authenticating through the https://solidcommunity.net/ identity provider. 119 | 120 | ```bash 121 | $ comunica-sparql-solid-http --idp https://solidcommunity.net/ \ 122 | http://example.org/private-resource.ttl 123 | ``` 124 | 125 | Show the help with all options: 126 | 127 | ```bash 128 | $ comunica-sparql-solid-http --help 129 | ``` 130 | 131 | The SPARQL endpoint can only be started dynamically. 132 | An alternative config file can be passed via the `COMUNICA_CONFIG` environment variable. 133 | 134 | Use `bin/http.js` when running in the Comunica monorepo development environment. 135 | 136 | _[**Read more** about setting up a SPARQL endpoint](https://comunica.dev/docs/query/getting_started/setup_endpoint/)._ 137 | -------------------------------------------------------------------------------- /engines/query-sparql-solid/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@comunica/query-sparql-solid", 3 | "version": "3.0.1", 4 | "description": "A Comunica engine for query evaluation over Solid data pods", 5 | "lsd:module": true, 6 | "license": "MIT", 7 | "homepage": "https://comunica.dev/", 8 | "repository": "https://github.com/comunica/comunica-feature-solid/tree/master/engines/query-sparql-solid", 9 | "bugs": { 10 | "url": "https://github.com/comunica/comunica/issues" 11 | }, 12 | "keywords": [ 13 | "comunica", 14 | "sparql", 15 | "engine", 16 | "query", 17 | "update", 18 | "sparql engine", 19 | "sparql query", 20 | "sparql update", 21 | "sparql 1.1", 22 | "solid" 23 | ], 24 | "sideEffects": false, 25 | "main": "lib/index.js", 26 | "typings": "lib/index", 27 | "publishConfig": { 28 | "access": "public" 29 | }, 30 | "bin": { 31 | "comunica-sparql-solid": "bin/query.js", 32 | "comunica-sparql-solid-http": "bin/http.js", 33 | "comunica-dynamic-sparql-solid": "bin/query-dynamic.js" 34 | }, 35 | "files": [ 36 | "bin/**/*.d.ts", 37 | "bin/**/*.js", 38 | "bin/**/*.js.map", 39 | "components", 40 | "config", 41 | "engine-default.js", 42 | "lib/**/*.d.ts", 43 | "lib/**/*.js", 44 | "lib/**/*.js.map" 45 | ], 46 | "scripts": { 47 | "build": "npm run build:ts", 48 | "build:ts": "node \"../../node_modules/typescript/bin/tsc\"", 49 | "prepare": "comunica-compile-config config/config-default.json > engine-default.js", 50 | "browser": "npm run prepare && \"../../node_modules/webpack/bin/webpack.js\" --config webpack.config.js --mode production" 51 | }, 52 | "dependencies": { 53 | "@comunica/actor-context-preprocess-convert-shortcuts": "^3.0.3", 54 | "@comunica/actor-context-preprocess-query-source-identify": "^3.0.3", 55 | "@comunica/actor-context-preprocess-query-source-skolemize": "^3.0.3", 56 | "@comunica/actor-context-preprocess-set-defaults": "^3.0.3", 57 | "@comunica/actor-context-preprocess-source-to-destination": "^3.0.3", 58 | "@comunica/actor-dereference-fallback": "^3.0.3", 59 | "@comunica/actor-dereference-http": "^3.0.3", 60 | "@comunica/actor-dereference-rdf-parse": "^3.0.3", 61 | "@comunica/actor-hash-bindings-sha1": "^3.0.3", 62 | "@comunica/actor-http-fetch": "^3.0.3", 63 | "@comunica/actor-http-inrupt-solid-client-authn": "^3.0.1", 64 | "@comunica/actor-http-proxy": "^3.0.3", 65 | "@comunica/actor-http-wayback": "^3.0.3", 66 | "@comunica/actor-init-query": "^3.0.3", 67 | "@comunica/actor-optimize-query-operation-assign-sources-exhaustive": "^3.0.3", 68 | "@comunica/actor-optimize-query-operation-bgp-to-join": "^3.0.3", 69 | "@comunica/actor-optimize-query-operation-describe-to-constructs-subject": "^3.0.3", 70 | "@comunica/actor-optimize-query-operation-filter-pushdown": "^3.0.3", 71 | "@comunica/actor-optimize-query-operation-group-sources": "^3.0.3", 72 | "@comunica/actor-optimize-query-operation-join-bgp": "^3.0.3", 73 | "@comunica/actor-optimize-query-operation-join-connected": "^3.0.3", 74 | "@comunica/actor-optimize-query-operation-prune-empty-source-operations": "^3.0.3", 75 | "@comunica/actor-optimize-query-operation-rewrite-add": "^3.0.3", 76 | "@comunica/actor-optimize-query-operation-rewrite-copy": "^3.0.3", 77 | "@comunica/actor-optimize-query-operation-rewrite-move": "^3.0.3", 78 | "@comunica/actor-query-operation-ask": "^3.0.3", 79 | "@comunica/actor-query-operation-bgp-join": "^3.0.3", 80 | "@comunica/actor-query-operation-construct": "^3.0.3", 81 | "@comunica/actor-query-operation-distinct-hash": "^3.0.3", 82 | "@comunica/actor-query-operation-extend": "^3.0.3", 83 | "@comunica/actor-query-operation-filter": "^3.0.3", 84 | "@comunica/actor-query-operation-from-quad": "^3.0.3", 85 | "@comunica/actor-query-operation-group": "^3.0.3", 86 | "@comunica/actor-query-operation-join": "^3.0.3", 87 | "@comunica/actor-query-operation-leftjoin": "^3.0.3", 88 | "@comunica/actor-query-operation-minus": "^3.0.3", 89 | "@comunica/actor-query-operation-nop": "^3.0.3", 90 | "@comunica/actor-query-operation-orderby": "^3.0.3", 91 | "@comunica/actor-query-operation-path-alt": "^3.0.3", 92 | "@comunica/actor-query-operation-path-inv": "^3.0.3", 93 | "@comunica/actor-query-operation-path-link": "^3.0.3", 94 | "@comunica/actor-query-operation-path-nps": "^3.0.3", 95 | "@comunica/actor-query-operation-path-one-or-more": "^3.0.3", 96 | "@comunica/actor-query-operation-path-seq": "^3.0.3", 97 | "@comunica/actor-query-operation-path-zero-or-more": "^3.0.3", 98 | "@comunica/actor-query-operation-path-zero-or-one": "^3.0.3", 99 | "@comunica/actor-query-operation-project": "^3.0.3", 100 | "@comunica/actor-query-operation-reduced-hash": "^3.0.3", 101 | "@comunica/actor-query-operation-service": "^3.0.3", 102 | "@comunica/actor-query-operation-slice": "^3.0.3", 103 | "@comunica/actor-query-operation-source": "^3.0.3", 104 | "@comunica/actor-query-operation-union": "^3.0.3", 105 | "@comunica/actor-query-operation-update-clear": "^3.0.3", 106 | "@comunica/actor-query-operation-update-compositeupdate": "^3.0.3", 107 | "@comunica/actor-query-operation-update-create": "^3.0.3", 108 | "@comunica/actor-query-operation-update-deleteinsert": "^3.0.3", 109 | "@comunica/actor-query-operation-update-drop": "^3.0.3", 110 | "@comunica/actor-query-operation-update-load": "^3.0.3", 111 | "@comunica/actor-query-operation-values": "^3.0.3", 112 | "@comunica/actor-query-parse-graphql": "^3.0.3", 113 | "@comunica/actor-query-parse-sparql": "^3.0.3", 114 | "@comunica/actor-query-process-explain-logical": "^3.0.3", 115 | "@comunica/actor-query-process-explain-parsed": "^3.0.3", 116 | "@comunica/actor-query-process-explain-physical": "^3.0.3", 117 | "@comunica/actor-query-process-sequential": "^3.0.3", 118 | "@comunica/actor-query-result-serialize-json": "^3.0.3", 119 | "@comunica/actor-query-result-serialize-rdf": "^3.0.3", 120 | "@comunica/actor-query-result-serialize-simple": "^3.0.3", 121 | "@comunica/actor-query-result-serialize-sparql-csv": "^3.0.3", 122 | "@comunica/actor-query-result-serialize-sparql-json": "^3.0.3", 123 | "@comunica/actor-query-result-serialize-sparql-tsv": "^3.0.3", 124 | "@comunica/actor-query-result-serialize-sparql-xml": "^3.0.3", 125 | "@comunica/actor-query-result-serialize-stats": "^3.0.3", 126 | "@comunica/actor-query-result-serialize-table": "^3.0.3", 127 | "@comunica/actor-query-result-serialize-tree": "^3.0.3", 128 | "@comunica/actor-query-source-identify-hypermedia": "^3.0.3", 129 | "@comunica/actor-query-source-identify-hypermedia-none": "^3.0.3", 130 | "@comunica/actor-query-source-identify-hypermedia-qpf": "^3.0.3", 131 | "@comunica/actor-query-source-identify-hypermedia-sparql": "^3.0.3", 132 | "@comunica/actor-query-source-identify-rdfjs": "^3.0.3", 133 | "@comunica/actor-query-source-identify-serialized": "^3.0.3", 134 | "@comunica/actor-rdf-join-entries-sort-cardinality": "^3.0.3", 135 | "@comunica/actor-rdf-join-inner-hash": "^3.0.3", 136 | "@comunica/actor-rdf-join-inner-multi-bind": "^3.0.3", 137 | "@comunica/actor-rdf-join-inner-multi-bind-source": "^3.0.3", 138 | "@comunica/actor-rdf-join-inner-multi-empty": "^3.0.3", 139 | "@comunica/actor-rdf-join-inner-multi-smallest": "^3.0.3", 140 | "@comunica/actor-rdf-join-inner-multi-smallest-filter-bindings": "^3.0.3", 141 | "@comunica/actor-rdf-join-inner-nestedloop": "^3.0.3", 142 | "@comunica/actor-rdf-join-inner-none": "^3.0.3", 143 | "@comunica/actor-rdf-join-inner-single": "^3.0.3", 144 | "@comunica/actor-rdf-join-inner-symmetrichash": "^3.0.3", 145 | "@comunica/actor-rdf-join-minus-hash": "^3.0.3", 146 | "@comunica/actor-rdf-join-minus-hash-undef": "^3.0.3", 147 | "@comunica/actor-rdf-join-optional-bind": "^3.0.3", 148 | "@comunica/actor-rdf-join-optional-nestedloop": "^3.0.3", 149 | "@comunica/actor-rdf-join-selectivity-variable-counting": "^3.0.3", 150 | "@comunica/actor-rdf-metadata-accumulate-cancontainundefs": "^3.0.3", 151 | "@comunica/actor-rdf-metadata-accumulate-cardinality": "^3.0.3", 152 | "@comunica/actor-rdf-metadata-accumulate-pagesize": "^3.0.3", 153 | "@comunica/actor-rdf-metadata-accumulate-requesttime": "^3.0.3", 154 | "@comunica/actor-rdf-metadata-all": "^3.0.3", 155 | "@comunica/actor-rdf-metadata-extract-allow-http-methods": "^3.0.3", 156 | "@comunica/actor-rdf-metadata-extract-hydra-controls": "^3.0.3", 157 | "@comunica/actor-rdf-metadata-extract-hydra-count": "^3.0.3", 158 | "@comunica/actor-rdf-metadata-extract-hydra-pagesize": "^3.0.3", 159 | "@comunica/actor-rdf-metadata-extract-patch-sparql-update": "^3.0.3", 160 | "@comunica/actor-rdf-metadata-extract-put-accepted": "^3.0.3", 161 | "@comunica/actor-rdf-metadata-extract-request-time": "^3.0.3", 162 | "@comunica/actor-rdf-metadata-extract-sparql-service": "^3.0.3", 163 | "@comunica/actor-rdf-metadata-primary-topic": "^3.0.3", 164 | "@comunica/actor-rdf-parse-html": "^3.0.3", 165 | "@comunica/actor-rdf-parse-html-microdata": "^3.0.3", 166 | "@comunica/actor-rdf-parse-html-rdfa": "^3.0.3", 167 | "@comunica/actor-rdf-parse-html-script": "^3.0.3", 168 | "@comunica/actor-rdf-parse-jsonld": "^3.0.3", 169 | "@comunica/actor-rdf-parse-n3": "^3.0.3", 170 | "@comunica/actor-rdf-parse-rdfxml": "^3.0.3", 171 | "@comunica/actor-rdf-parse-shaclc": "^3.0.3", 172 | "@comunica/actor-rdf-parse-xml-rdfa": "^3.0.3", 173 | "@comunica/actor-rdf-resolve-hypermedia-links-next": "^3.0.3", 174 | "@comunica/actor-rdf-resolve-hypermedia-links-queue-fifo": "^3.0.3", 175 | "@comunica/actor-rdf-serialize-jsonld": "^3.0.3", 176 | "@comunica/actor-rdf-serialize-n3": "^3.0.3", 177 | "@comunica/actor-rdf-serialize-shaclc": "^3.0.3", 178 | "@comunica/actor-rdf-update-hypermedia-patch-sparql-update": "^3.0.3", 179 | "@comunica/actor-rdf-update-hypermedia-put-ldp": "^3.0.3", 180 | "@comunica/actor-rdf-update-hypermedia-sparql": "^3.0.3", 181 | "@comunica/actor-rdf-update-quads-hypermedia": "^3.0.3", 182 | "@comunica/actor-rdf-update-quads-rdfjs-store": "^3.0.3", 183 | "@comunica/bus-http-invalidate": "^3.0.3", 184 | "@comunica/bus-query-operation": "^3.0.3", 185 | "@comunica/config-query-sparql": "^3.0.1", 186 | "@comunica/config-query-sparql-solid": "^3.0.1", 187 | "@comunica/context-entries": "^3.0.3", 188 | "@comunica/core": "^3.0.3", 189 | "@comunica/logger-void": "^3.0.3", 190 | "@comunica/mediator-all": "^3.0.3", 191 | "@comunica/mediator-combine-pipeline": "^3.0.3", 192 | "@comunica/mediator-combine-union": "^3.0.3", 193 | "@comunica/mediator-join-coefficients-fixed": "^3.0.3", 194 | "@comunica/mediator-number": "^3.0.3", 195 | "@comunica/mediator-race": "^3.0.3", 196 | "@comunica/runner": "^3.0.3", 197 | "@comunica/runner-cli": "^3.0.3", 198 | "@comunica/types": "^3.0.3", 199 | "@rubensworks/solid-client-authn-isomorphic": "^2.0.0", 200 | "solid-node-interactive-auth": "^1.0.2" 201 | }, 202 | "browser": { 203 | "./lib/index.js": "./lib/index-browser.js" 204 | } 205 | } 206 | --------------------------------------------------------------------------------