Skip to content

Commit

Permalink
Update to non-beta version of Comunica 2
Browse files Browse the repository at this point in the history
  • Loading branch information
rubensworks committed Mar 3, 2022
1 parent 03bd8cc commit 48102f8
Show file tree
Hide file tree
Showing 18 changed files with 1,762 additions and 1,951 deletions.
7 changes: 4 additions & 3 deletions engines/query-sparql-link-traversal-solid/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
FROM node:10
FROM node:16

# Install location
ENV dir /var/www/@comunica/actor-init-sparql-link-traversal-solid/
ENV dir /var/www/@comunica/query-sparql-link-traversal-solid/

# Copy the engine files (generated from package.json!files)
COPY config ${dir}/config/
COPY lib/*.js ${dir}/lib/
COPY bin/*.js ${dir}/bin/
COPY index.js index-browser.js engine-default.js package.json ${dir}
COPY engine-default.js package.json ${dir}

# Set the npm registry
ARG NPM_REGISTRY=https://registry.npmjs.org/
Expand Down
13 changes: 8 additions & 5 deletions engines/query-sparql-link-traversal-solid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
],
"dependencies": {
"@comunica/query-sparql-link-traversal": "^0.0.1",
"@comunica/query-sparql-solid": "2.0.1-alpha.2.0",
"@comunica/query-sparql-solid": "^2.0.1",
"@comunica/actor-rdf-join-entries-sort-traversal-zero-knowledge": "^0.0.1",
"@comunica/actor-rdf-metadata-extract-traverse-all": "^0.0.1",
"@comunica/actor-rdf-metadata-extract-traverse-content-policies": "^0.0.1",
Expand All @@ -54,14 +54,17 @@
"@comunica/actor-rdf-resolve-hypermedia-links-traverse-replace-conditional": "^0.0.1",
"@comunica/actor-rdf-resolve-hypermedia-links-queue-wrapper-limit-count": "^0.0.1",
"@comunica/actor-rdf-resolve-hypermedia-links-queue-wrapper-limit-depth": "^0.0.1",
"@comunica/actor-init-query": "^2.0.1-alpha.9.0",
"@comunica/context-entries": "^2.0.1-alpha.9.0",
"@comunica/core": "^2.0.1-alpha.9.0",
"@comunica/runner-cli": "^2.0.1-alpha.9.0"
"@comunica/actor-init-query": "^2.0.3",
"@comunica/context-entries": "^2.0.1",
"@comunica/core": "^2.0.1",
"@comunica/runner-cli": "^2.0.3"
},
"scripts": {
"build": "npm run build:ts",
"build:ts": "node \"../../node_modules/typescript/bin/tsc\"",
"prepare": "comunica-compile-config config/config-default.json > engine-default.js"
},
"browser": {
"./lib/index.js": "./lib/index-browser.js"
}
}
7 changes: 4 additions & 3 deletions engines/query-sparql-link-traversal/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
FROM node:10
FROM node:16

# Install location
ENV dir /var/www/@comunica/actor-init-sparql-link-traversal/
ENV dir /var/www/@comunica/query-sparql-link-traversal/

# Copy the engine files (generated from package.json!files)
COPY config ${dir}/config/
COPY lib/*.js ${dir}/lib/
COPY bin/*.js ${dir}/bin/
COPY index.js index-browser.js engine-default.js package.json ${dir}
COPY engine-default.js package.json ${dir}

# Set the npm registry
ARG NPM_REGISTRY=https://registry.npmjs.org/
Expand Down
9 changes: 6 additions & 3 deletions engines/query-sparql-link-traversal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
],
"dependencies": {
"@comunica/actor-optimize-query-operation-set-seed-sources-quadpattern-iris": "^0.0.1",
"@comunica/query-sparql": "^2.0.1-alpha.9.0",
"@comunica/query-sparql": "^2.0.3",
"@comunica/actor-rdf-join-entries-sort-traversal-zero-knowledge": "^0.0.1",
"@comunica/actor-rdf-metadata-extract-traverse-all": "^0.0.1",
"@comunica/actor-rdf-metadata-extract-traverse-content-policies": "^0.0.1",
Expand All @@ -53,12 +53,15 @@
"@comunica/actor-rdf-resolve-hypermedia-links-traverse-replace-conditional": "^0.0.1",
"@comunica/actor-rdf-resolve-hypermedia-links-queue-wrapper-limit-count": "^0.0.1",
"@comunica/actor-rdf-resolve-hypermedia-links-queue-wrapper-limit-depth": "^0.0.1",
"@comunica/actor-init-query": "^2.0.1-alpha.9.0",
"@comunica/runner-cli": "^2.0.1-alpha.9.0"
"@comunica/actor-init-query": "^2.0.3",
"@comunica/runner-cli": "^2.0.3"
},
"scripts": {
"build": "npm run build:ts",
"build:ts": "node \"../../node_modules/typescript/bin/tsc\"",
"prepare": "comunica-compile-config config/config-default.json > engine-default.js"
},
"browser": {
"./lib/index.js": "./lib/index-browser.js"
}
}
8 changes: 2 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"@babel/core": "^7.16.0",
"@babel/polyfill": "^7.12.1",
"@babel/preset-env": "^7.16.4",
"@comunica/actor-http-native": "^2.0.1-alpha.9.0",
"rdf-data-factory": "^1.1.0",
"@types/jest": "^26.0.0",
"@types/node": "^16.0.0",
Expand All @@ -18,7 +17,7 @@
"arrayify-stream": "^1.0.0",
"asynciterator": "^3.0.3",
"babel-loader": "^8.2.3",
"componentsjs-generator": "3.0.0-beta.5",
"componentsjs-generator": "^3.0.1",
"eslint": "^8.3.0",
"eslint-config-es": "4.1.0",
"eslint-import-resolver-typescript": "^2.5.0",
Expand Down Expand Up @@ -80,9 +79,6 @@
"version": "manual-git-changelog onversion"
},
"resolutions": {
"@types/yargs": "17.0.8",
"@rdfjs/types": "1.1.0",
"@comunica/bindings-factory": "^2.0.1-alpha.9.0",
"componentsjs": "5.0.0-beta.3"
"@types/yargs": "17.0.8"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
"lib/**/*.js"
],
"dependencies": {
"@comunica/core": "^2.0.1-alpha.9.0",
"@comunica/bus-optimize-query-operation": "^2.0.1-alpha.9.0",
"@comunica/context-entries": "^2.0.1-alpha.9.0",
"@comunica/types": "^2.0.1-alpha.9.0",
"@comunica/core": "^2.0.1",
"@comunica/bus-optimize-query-operation": "^2.0.1",
"@comunica/context-entries": "^2.0.1",
"@comunica/types": "^2.0.1",
"sparqlalgebrajs": "^4.0.2"
},
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
"lib/**/*.js"
],
"dependencies": {
"@comunica/bus-rdf-join-entries-sort": "^2.0.1-alpha.9.0",
"@comunica/bus-rdf-resolve-quad-pattern": "^2.0.1-alpha.9.0",
"@comunica/core": "^2.0.1-alpha.9.0",
"@comunica/context-entries": "^2.0.1-alpha.9.0",
"@comunica/types": "^2.0.1-alpha.9.0",
"@comunica/bus-rdf-join-entries-sort": "^2.0.1",
"@comunica/bus-rdf-resolve-quad-pattern": "^2.0.1",
"@comunica/core": "^2.0.1",
"@comunica/context-entries": "^2.0.1",
"@comunica/types": "^2.0.1",
"@rdfjs/types": "*",
"rdf-terms": "^1.7.0",
"sparqlalgebrajs": "^4.0.2"
Expand Down
4 changes: 2 additions & 2 deletions packages/actor-rdf-metadata-extract-traverse-all/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
"lib/**/*.js"
],
"dependencies": {
"@comunica/core": "^2.0.1-alpha.9.0",
"@comunica/bus-rdf-metadata-extract": "^2.0.1-alpha.9.0",
"@comunica/core": "^2.0.1",
"@comunica/bus-rdf-metadata-extract": "^2.0.1",
"rdf-terms": "^1.6.2"
},
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type { ILink } from '@comunica/bus-rdf-resolve-hypermedia-links';
import { KeysQueryOperation } from '@comunica/context-entries';
import type { IActorArgs, IActorTest } from '@comunica/core';
import { ActionContext, ActionContextKey } from '@comunica/core';
import type { Bindings, IActionContext, IQueryBindingsEnhanced } from '@comunica/types';
import type { Bindings, IActionContext } from '@comunica/types';
import type * as RDF from 'rdf-js';
import { storeStream } from 'rdf-store-stream';
import { matchPatternComplete } from 'rdf-terms';
Expand Down Expand Up @@ -44,16 +44,16 @@ export class ActorRdfMetadataExtractTraverseContentPolicies extends ActorRdfMeta

protected async getContentPoliciesFromDocument(documentIri: string, store: RDF.Store): Promise<ContentPolicy[]> {
// Query the content policies that apply to the current document
const result = <IQueryBindingsEnhanced> await this.queryEngine
.query(`
const bindingsStream = await this.queryEngine
.queryBindings(`
PREFIX scl: <https://w3id.org/scl/vocab#>
SELECT ?scope WHERE {
?policy scl:appliesTo <${documentIri}>;
scl:scope ?scope.
}`, { sources: [ store ]});

// Parse all found content policies
return (await result.bindings())
return (await bindingsStream.toArray())
.map(binding => this.sclParser.parse(binding.get('scope')!.value, documentIri));
}

Expand Down Expand Up @@ -105,11 +105,11 @@ export class ActorRdfMetadataExtractTraverseContentPolicies extends ActorRdfMeta
}

// Find all matching results
const result = <IQueryBindingsEnhanced> await this.queryEngine
.query(contentPolicy.graphPattern, { sources: [ store ]});
const bindingsStream = await this.queryEngine
.queryBindings(contentPolicy.graphPattern, { sources: [ store ]});

// Extract all bound named nodes from the policy's variables
const bindings: Bindings[] = await result.bindings();
const bindings: Bindings[] = await bindingsStream.toArray();
for (const binding of bindings) {
// If the content policy has a filter, apply it on the links to traverse
let transform: ((input: RDF.Stream) => Promise<RDF.Stream>) | undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
"lib/**/*.js"
],
"dependencies": {
"@comunica/actor-init-query": "^2.0.1-alpha.9.0",
"@comunica/bus-rdf-metadata-extract": "^2.0.1-alpha.9.0",
"@comunica/bus-query-operation": "^2.0.1-alpha.9.0",
"@comunica/core": "^2.0.1-alpha.9.0",
"@comunica/context-entries": "^2.0.1-alpha.9.0",
"@comunica/actor-init-query": "^2.0.3",
"@comunica/bus-rdf-metadata-extract": "^2.0.1",
"@comunica/bus-query-operation": "^2.0.1",
"@comunica/core": "^2.0.1",
"@comunica/context-entries": "^2.0.1",
"rdf-data-factory": "^1.1.0",
"rdf-store-stream": "^1.3.0",
"rdf-terms": "^1.7.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ describe('ActorRdfMetadataExtractTraverseContentPolicies', () => {
DF.quad(DF.namedNode('ex:s'), DF.namedNode('ex:p'), DF.namedNode('ex:o')),
]);
}),
query: jest.fn(pattern => {
queryBindings: jest.fn(pattern => {
if (typeof pattern === 'string') {
// Query in getContentPoliciesFromDocument
return {
bindings() {
toArray() {
if (pattern.includes('one_policy')) {
return Promise.resolve([
BF.bindings([
Expand Down Expand Up @@ -95,7 +95,7 @@ describe('ActorRdfMetadataExtractTraverseContentPolicies', () => {
}
// FOLLOW clause
return {
bindings: () => [
toArray: () => [
BF.bindings([[ DF.variable('varA'), DF.namedNode('ex:match1') ]]),
BF.bindings([
[ DF.variable('varA'), DF.blankNode('ex:match2') ],
Expand Down Expand Up @@ -325,12 +325,12 @@ describe('ActorRdfMetadataExtractTraverseContentPolicies', () => {
expect(result.metadata.traverse[0].transform).toBeInstanceOf(Function);
expect(result.metadata.traverse[1].transform).toBeInstanceOf(Function);

expect(queryEngine.query).toHaveBeenCalledTimes(1);
expect(queryEngine.queryBindings).toHaveBeenCalledTimes(1);
expect(queryEngine.queryQuads).toHaveBeenCalledTimes(0);
expect(await arrayifyStream(await result.metadata.traverse[0].transform(new ArrayIterator()))).toEqual([
DF.quad(DF.namedNode('ex:s'), DF.namedNode('ex:p'), DF.namedNode('ex:o')),
]);
expect(queryEngine.query).toHaveBeenCalledTimes(1);
expect(queryEngine.queryBindings).toHaveBeenCalledTimes(1);
expect(queryEngine.queryQuads).toHaveBeenCalledTimes(1);
expect(queryEngine.queryQuads).toHaveBeenNthCalledWith(1, filter, {
sources: [ expect.anything() ],
Expand All @@ -339,7 +339,7 @@ describe('ActorRdfMetadataExtractTraverseContentPolicies', () => {
expect(await arrayifyStream(await result.metadata.traverse[1].transform(new ArrayIterator()))).toEqual([
DF.quad(DF.namedNode('ex:s'), DF.namedNode('ex:p'), DF.namedNode('ex:o')),
]);
expect(queryEngine.query).toHaveBeenCalledTimes(1);
expect(queryEngine.queryBindings).toHaveBeenCalledTimes(1);
expect(queryEngine.queryQuads).toHaveBeenCalledTimes(2);
expect(queryEngine.queryQuads).toHaveBeenNthCalledWith(2, filter, {
sources: [ expect.anything() ],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
"lib/**/*.js"
],
"dependencies": {
"@comunica/context-entries": "^2.0.1-alpha.9.0",
"@comunica/core": "^2.0.1-alpha.9.0",
"@comunica/bus-rdf-metadata-extract": "^2.0.1-alpha.9.0",
"@comunica/types": "^2.0.1-alpha.9.0",
"@comunica/context-entries": "^2.0.1",
"@comunica/core": "^2.0.1",
"@comunica/bus-rdf-metadata-extract": "^2.0.1",
"@comunica/types": "^2.0.1",
"@rdfjs/types": "*",
"rdf-terms": "^1.7.0",
"sparqlalgebrajs": "^4.0.2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
"lib/**/*.js"
],
"dependencies": {
"@comunica/context-entries": "^2.0.1-alpha.9.0",
"@comunica/core": "^2.0.1-alpha.9.0",
"@comunica/bus-rdf-metadata-extract": "^2.0.1-alpha.9.0",
"@comunica/types": "^2.0.1-alpha.9.0",
"@comunica/context-entries": "^2.0.1",
"@comunica/core": "^2.0.1",
"@comunica/bus-rdf-metadata-extract": "^2.0.1",
"@comunica/types": "^2.0.1",
"rdf-terms": "^1.7.0",
"sparqlalgebrajs": "^4.0.2"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
"lib/**/*.js"
],
"dependencies": {
"@comunica/core": "^2.0.1-alpha.9.0",
"@comunica/bus-rdf-resolve-hypermedia-links-queue": "^2.0.1-alpha.9.0"
"@comunica/core": "^2.0.1",
"@comunica/bus-rdf-resolve-hypermedia-links-queue": "^2.0.1"
},
"scripts": {
"build": "npm run build:ts && npm run build:components",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
"lib/**/*.js"
],
"dependencies": {
"@comunica/core": "^2.0.1-alpha.9.0",
"@comunica/bus-rdf-resolve-hypermedia-links-queue": "^2.0.1-alpha.9.0"
"@comunica/core": "^2.0.1",
"@comunica/bus-rdf-resolve-hypermedia-links-queue": "^2.0.1"
},
"scripts": {
"build": "npm run build:ts && npm run build:components",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
"lib/**/*.js"
],
"dependencies": {
"@comunica/core": "^2.0.1-alpha.9.0",
"@comunica/bus-rdf-resolve-hypermedia-links": "^2.0.1-alpha.9.0"
"@comunica/core": "^2.0.1",
"@comunica/bus-rdf-resolve-hypermedia-links": "^2.0.1"
},
"scripts": {
"build": "npm run build:ts && npm run build:components",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
"lib/**/*.js"
],
"dependencies": {
"@comunica/core": "^2.0.1-alpha.9.0",
"@comunica/bus-rdf-resolve-hypermedia-links": "^2.0.1-alpha.9.0"
"@comunica/core": "^2.0.1",
"@comunica/bus-rdf-resolve-hypermedia-links": "^2.0.1"
},
"scripts": {
"build": "npm run build:ts && npm run build:components",
Expand Down

0 comments on commit 48102f8

Please sign in to comment.