Skip to content

Commit

Permalink
build(deps): Downgrade Comunica (#1299)
Browse files Browse the repository at this point in the history
* test: Reproduce Comunica bug

* Revert "build(deps): bump the comunica group with 6 updates (#1288)"

This reverts commit 5ce8fed.
  • Loading branch information
ddeboer authored Apr 3, 2024
1 parent da60f50 commit 19ba682
Show file tree
Hide file tree
Showing 8 changed files with 1,691 additions and 3,587 deletions.
8 changes: 4 additions & 4 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ export default {
],
coverageThreshold: {
global: {
lines: 91.31,
statements: 91.31,
branches: 95.97,
functions: 93.22,
lines: 90.99,
statements: 90.99,
branches: 95.93,
functions: 91.52,
},
},
transform: {
Expand Down
5,227 changes: 1,668 additions & 3,559 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions packages/network-of-terms-catalog/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
"author": "Netwerk Digitaal Erfgoed",
"license": "EUPL-1.2",
"devDependencies": {
"@comunica/core": "^3.0.1",
"@comunica/types": "^3.0.1",
"@comunica/core": "^2.7.0",
"@comunica/types": "^2.8.2",
"@types/n3": "^1.16.4",
"@types/rdf-ext": "^2.5.0",
"gts": "^5.3.0",
Expand All @@ -43,8 +43,8 @@
},
"homepage": "https://github.com/netwerk-digitaal-erfgoed/network-of-terms-catalog#readme",
"dependencies": {
"@comunica/bindings-factory": "^3.0.1",
"@comunica/query-sparql-rdfjs": "^3.0.1",
"@comunica/bindings-factory": "^2.7.0",
"@comunica/query-sparql-rdfjs": "^2.10.2",
"@netwerk-digitaal-erfgoed/network-of-terms-query": "*",
"globby": "^14.0.1",
"rdf-parse": "^2.3.3",
Expand Down
19 changes: 7 additions & 12 deletions packages/network-of-terms-catalog/src/getCatalog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
import {fileURLToPath} from 'url';
import {DataFactory} from 'rdf-data-factory';
import {BindingsFactory} from '@comunica/bindings-factory';
import {Bindings, Store} from '@rdfjs/types';
import {Bindings} from '@rdfjs/types';

export async function getCatalog(path?: string): Promise<Catalog> {
const directory = (
Expand All @@ -27,7 +27,7 @@ export async function getCatalog(path?: string): Promise<Catalog> {
return fromStore(store);
}

export async function fromStore(store: RDF.Store): Promise<Catalog> {
export async function fromStore(store: RDF.Store[]): Promise<Catalog> {
// Collect all properties for SELECT and GROUP BY so we can flatten the schema:url values into a single value.
const properties =
'?dataset ?name ?description ?creator ?creatorName ?creatorAlternateName ?distribution ?endpointUrl ?searchQuery ?lookupQuery ?reconciliationUrlTemplate ?alternateName ?mainEntityOfPage ?inLanguage';
Expand Down Expand Up @@ -59,7 +59,7 @@ export async function fromStore(store: RDF.Store): Promise<Catalog> {
GROUP BY ${properties}
ORDER BY LCASE(?name)`;
const bindingsStream = await new QueryEngine().queryBindings(query, {
sources: [store],
sources: store as [RDF.Store, ...RDF.Store[]],
initialBindings: bindingsFactory.fromRecord({
reconciliationIri: dataFactory.namedNode(FeatureType.RECONCILIATION),
}) as unknown as Bindings,
Expand Down Expand Up @@ -128,18 +128,13 @@ export async function fromStore(store: RDF.Store): Promise<Catalog> {
* Return a separate RDF.Store for each catalog file because merging them into a single store
* causes blank nodes to be re-used instead of incremented when adding the next file.
*/
export async function fromFiles(directory: string): Promise<Store> {
export async function fromFiles(directory: string): Promise<RDF.Store[]> {
// Read all files except those in the queries/ directory.
const files = await globby([directory, '!' + directory + '/queries']);
return (await Promise.all(files.map(fromFile))).reduce(
(previous, current) => {
previous.import(current.match());
return previous;
}
);
return Promise.all(files.map(fromFile));
}

export async function fromFile(file: string): Promise<Store> {
export async function fromFile(file: string): Promise<RDF.Store> {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const quadStream = (rdfParser.default ?? RdfParser)
Expand All @@ -148,7 +143,7 @@ export async function fromFile(file: string): Promise<Store> {
})
.pipe(new InlineFiles())
.pipe(new SubstituteCredentialsFromEnvironmentVariables());
return storeStream(quadStream) as Promise<Store>;
return storeStream(quadStream);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/network-of-terms-catalog/test/catalog.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ describe('Catalog', () => {
'fixtures/credentials.jsonld'
)
);
const catalog = await fromStore(store);
const catalog = await fromStore([store]);
const distributionIri = new IRI(
'https://data.beeldengeluid.nl/id/datadownload/0027'
);
Expand Down
9 changes: 4 additions & 5 deletions packages/network-of-terms-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
"keywords": [],
"description": "Engine for querying sources in the Network of Terms",
"dependencies": {
"@comunica/bindings-factory": "^3.0.1",
"@comunica/bindings-factory": "^2.7.0",
"@comunica/data-factory": "^3.0.1",
"@comunica/query-sparql": "^3.0.1",
"@comunica/query-sparql": "^2.10.2",
"@hapi/hoek": "^11.0.4",
"@opentelemetry/api": "^1.8.0",
"@opentelemetry/exporter-metrics-otlp-proto": "0.49.1",
Expand All @@ -48,9 +48,8 @@
"rdf-store-stream": "^2.0.1"
},
"devDependencies": {
"@comunica/core": "^3.0.1",
"@comunica/query-sparql-file": "^3.0.1",
"@comunica/types": "^3.0.1",
"@comunica/core": "^2.7.0",
"@comunica/query-sparql-file": "^2.10.2",
"@jest/globals": "^29.6.2",
"asynciterator": "^3.9.0",
"jest-dev-server": "10.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/network-of-terms-query/src/helpers/logger-pino.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Logger} from '@comunica/types';
import {Logger} from '@comunica/core';
import Pino from 'pino';

export interface ConstructorOptions {
Expand Down
3 changes: 2 additions & 1 deletion packages/network-of-terms-query/src/server-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ export const testCatalog = (port: number) =>
?s skos:exactMatch ?match .
?match skos:prefLabel ?match_label .
}
}`,
}
LIMIT 1000`,
`
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
CONSTRUCT {
Expand Down

0 comments on commit 19ba682

Please sign in to comment.