Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into sparql-oxigraph
Browse files Browse the repository at this point in the history
  • Loading branch information
tpluscode committed Jan 26, 2024
2 parents bfb87e3 + 91f14e4 commit ff6cec0
Show file tree
Hide file tree
Showing 115 changed files with 3,003 additions and 1,863 deletions.
6 changes: 0 additions & 6 deletions .changeset/young-geese-teach.md

This file was deleted.

26 changes: 24 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,14 @@ jobs:
- run: npm run lint

smoke-test-cli:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
Expand All @@ -92,16 +99,31 @@ jobs:
- run: npx barnard59 run test/e2e/definitions/world-clock/async.ttl
- run: npx barnard59 run test/e2e/definitions/world-clock/file.ttl
- run: npx barnard59 run test/e2e/definitions/world-clock/node.ttl
- run: npx barnard59 run test/e2e/definitions/code-imports/main.ttl

global-installation:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- run: npm ci
- name: pack all
run: npm pack -ws
- run: npm install -g barnard59-*.tgz
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
- run: cmd /c npm install -g (Get-ChildItem -Filter barnard59-*.tgz).FullName
if: matrix.os == 'windows-latest'
- run: which barnard59
- run: barnard59 --help
- run: barnard59 shacl validate --shapes test/support/pipeline-shapes.ttl < test/e2e/definitions/file-loader.ttl
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
- run: barnard59 shacl validate --shapes test/support/pipeline-shapes.ttl < test/e2e/definitions/file-loader.ttl
if: matrix.os == 'windows-latest'
shell: cmd
2,094 changes: 956 additions & 1,138 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
],
"devDependencies": {
"@changesets/cli": "^2.26.1",
"@tpluscode/eslint-config": "^0.4.4",
"@tpluscode/eslint-config": "^0.4.5",
"@types/node": "^18",
"@typescript-eslint/eslint-plugin": "^6.13.2",
"@typescript-eslint/parser": "^6.13.2",
Expand Down
6 changes: 6 additions & 0 deletions packages/base/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# barnard59-base

## 2.4.0

### Minor Changes

- 7456a6a: added batch operation

## 2.3.0

### Minor Changes
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/base/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export { default as glob } from './glob.js'
export { parse as jsonParse, stringify as jsonStringify } from './json.js'
export { default as limit } from './limit.js'
export { default as map } from './map.js'
export { default as nul } from './nul.js'
export { default as nul } from './dev-nul.js'
export { default as offset } from './offset.js'
export * from './process.js'
export { default as toString } from './toString.js'
2 changes: 1 addition & 1 deletion packages/base/manifest.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
rdfs:label "/dev/null";
rdfs:comment "Dummy output stream, just like /dev/null.";
code:implementedBy [ a code:EcmaScriptModule;
code:link <node:barnard59-base/nul.js#default>
code:link <node:barnard59-base/dev-nul.js#default>
].

<offset> a p:Operation, p:WritableObjectMode, p:ReadableObjectMode;
Expand Down
4 changes: 2 additions & 2 deletions packages/base/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "barnard59-base",
"version": "2.3.0",
"version": "2.4.0",
"description": "Linked Data pipelines",
"main": "index.js",
"type": "module",
Expand Down Expand Up @@ -39,7 +39,7 @@
"@types/readable-stream": "^4.0.10",
"@types/readable-to-readable": "^0.1.0",
"@types/through2": "^2.0.41",
"barnard59-core": "^5.3.0",
"barnard59-core": "^5.3.1",
"chai": "^4.3.10",
"get-stream": "^6.0.1",
"into-stream": "^7.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/base/test/batch.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { deepStrictEqual, strictEqual } from 'assert'
import { deepStrictEqual, strictEqual } from 'node:assert'
import { array } from 'get-stream'
import { isReadableStream as isReadable, isWritableStream as isWritable } from 'is-stream'
import { Readable } from 'readable-stream'
Expand Down
30 changes: 30 additions & 0 deletions packages/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,35 @@
# barnard59

## 4.5.2

### Patch Changes

- e82aa36: Remove references of `rdf-js` types package, repaced with `@rdfjs/types`
- Updated dependencies [e82aa36]
- [email protected]

## 4.5.1

### Patch Changes

- Updated dependencies [9178b7e]
- [email protected]

## 4.5.0

### Minor Changes

- 68dff05: Support [`code:imports`](https://github.com/zazuko/rdf-transform-graph-imports) when loading pipeline definitions (closes #93)

### Patch Changes

- 9d0ce9f: Improve Windows compatibility (re zazuko/rdf-loader-code#34)
- Updated dependencies [9d0ce9f]
- Updated dependencies [c090ff2]
- Updated dependencies [82dbe7e]
- [email protected]
- [email protected]

## 4.4.0

### Minor Changes
Expand Down
16 changes: 10 additions & 6 deletions packages/cli/lib/pipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import { isGraphPointer } from 'is-graph-pointer'
import { packageDirectory } from 'pkg-dir'
import iriResolve from 'rdf-loader-code/lib/iriResolve.js'
import isInstalledGlobally from 'is-installed-globally'
import transformImports from 'rdf-transform-graph-imports'
import findPipeline from '../findPipeline.js'
import discoverManifests from './discoverManifests.js'

/**
* @typedef {Map<import('rdf-js').Term, { type: import('rdf-js').NamedNode, link: import('rdf-js').NamedNode }>} OperationMap
* @typedef {Map<import('@rdfjs/types').Term, { type: import('@rdfjs/types').NamedNode, link: import('@rdfjs/types').NamedNode }>} OperationMap
*/

/**
Expand All @@ -34,12 +35,12 @@ const discoverOperations = async (pipelinePath) => {
}

/**
* @param {import('rdf-js').DatasetCore} dataset
* @param {import('@rdfjs/types').DatasetCore} dataset
* @param {object} options
* @param {import('winston').Logger} [options.logger]
* @param {OperationMap} [options.knownOperations]
* @param {string} options.pipelinePath
* @returns {Promise<import('rdf-js').DatasetCore>}
* @returns {Promise<import('@rdfjs/types').DatasetCore>}
*/
export const desugar = async (dataset, { logger, knownOperations, pipelinePath }) => {
const operations = knownOperations ?? await discoverOperations(pipelinePath)
Expand Down Expand Up @@ -94,15 +95,18 @@ export const desugar = async (dataset, { logger, knownOperations, pipelinePath }

/**
* @param {string} filename
* @return {Promise<import('rdf-js').DatasetCore>}
* @return {Promise<import('@rdfjs/types').DatasetCore>}
*/
async function fileToDataset(filename) {
return rdf.dataset().import(rdf.fromFile(filename))
const stream = rdf.fromFile(filename, {
implicitBaseIRI: true,
}).pipe(transformImports(rdf))
return rdf.dataset().import(stream)
}

/**
* @param {string} filename
* @param {string | import('@rdfjs/types').NamedNode | undefined} iri
* @param {string | import('@rdfjs/types').NamedNode} [iri]
* @param {object} [options]
* @param {import('winston').Logger} [options.logger]
* @return {Promise<{ basePath: string, ptr: import('clownface').GraphPointer }>}
Expand Down
15 changes: 9 additions & 6 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "barnard59",
"version": "4.4.0",
"version": "4.5.2",
"description": "Barnard59 Linked Data pipelines",
"type": "module",
"main": "index.js",
Expand Down Expand Up @@ -36,29 +36,32 @@
"@opentelemetry/semantic-conventions": "^0.24.0",
"@opentelemetry/tracing": "^0.24.0",
"@rdfjs/namespace": "^2.0.0",
"barnard59-core": "5.3.0",
"barnard59-env": "1.2.1",
"barnard59-core": "5.3.2",
"barnard59-env": "1.2.3",
"commander": "^11.0.0",
"pkgscan": "^1.0.24",
"find-up": "^7.0.0",
"is-installed-globally": "^1.0.0",
"is-graph-pointer": "^2.1.0",
"lodash": "^4.17.21",
"pkg-dir": "^8.0.0",
"rdf-loader-code": "^2.1.1",
"rdf-loader-code": "^2.1.3",
"rdf-transform-graph-imports": "^0.2.2",
"readable-stream": "^3.6.0"
},
"devDependencies": {
"@rdfjs-elements/formats-pretty": "^0.6.7",
"@types/lodash": "^4.14.202",
"@types/readable-stream": "^4.0.10",
"approvals": "^6.2.2",
"barnard59-base": "^2.3.0",
"barnard59-base": "^2.4.0",
"barnard59-formats": "^2.1.0",
"barnard59-graph-store": "^5.1.0",
"barnard59-graph-store": "^5.1.1",
"barnard59-http": "^2.0.0",
"barnard59-shell": "^0.1.0",
"barnard59-test-support": "^0.0.3",
"chai": "^4.3.7",
"mocha-chai-jest-snapshot": "^1.1.4",
"shelljs": "^0.8.4",
"strip-ansi": "^7.0.0"
},
Expand Down
41 changes: 41 additions & 0 deletions packages/cli/test/__snapshots__/codeImports.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`pipeline with code:imports merges the pipelines 1`] = `
"@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix p: <https://pipeline.described.at/> .
@prefix code: <https://code.described.at/> .
<http://example.org/pipeline/> a p:Pipeline ;
p:steps [
p:stepList (
[
rdf:type p:Step ;
code:arguments (
\\"foo\\"
\\"bar\\"
) ;
code:implementedBy [
rdf:type code:EcmaScriptModule ;
code:link <node:barnard59-base/Readable.js#from> ;
] ;
]
<http://example.org/pipeline/out>
) ;
] .
<http://example.org/pipeline/out> a p:Pipeline, p:Writable ;
p:steps [
p:stepList (
[
rdf:type p:Step ;
code:implementedBy [
rdf:type code:EcmaScriptModule ;
code:link <node:barnard59-base/process.js#stdout> ;
] ;
]
) ;
] .
"
`;
36 changes: 36 additions & 0 deletions packages/cli/test/codeImports.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { createRequire } from 'node:module'
import env from 'barnard59-env'
import formatsPretty from '@rdfjs-elements/formats-pretty'
import chai, { expect } from 'chai'
import { jestSnapshotPlugin } from 'mocha-chai-jest-snapshot'
import * as pipeline from '../lib/pipeline.js'

const require = createRequire(import.meta.url)
env.formats.import({
serializers: formatsPretty.serializers,
})

const prefixes = [
'sh',
'rdf',
['p', 'https://pipeline.described.at/'],
['code', 'https://code.described.at/'],
]

describe('pipeline', () => {
chai.use(jestSnapshotPlugin())

context('with code:imports', () => {
it('merges the pipelines', async () => {
// given
const filename = require.resolve('barnard59-test-e2e/definitions/code-imports/main.ttl')

// when
const { ptr } = await pipeline.parse(filename, env.namedNode('http://example.org/pipeline/'))

// then
const pretty = await ptr.dataset.serialize({ format: 'text/turtle', prefixes })
expect(pretty).toMatchSnapshot()
})
})
})
3 changes: 2 additions & 1 deletion packages/cli/test/simplify.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import rdf from 'barnard59-env'
import { pipelineDefinitionLoader } from 'barnard59-test-support/loadPipelineDefinition.js'
import { desugar } from '../lib/pipeline.js'

const dirname = resolve('test', 'support', 'approvals')
const __dirname = new URL('.', import.meta.url).pathname
const dirname = resolve(__dirname, 'support/approvals')

const loadPipelineDefinition = pipelineDefinitionLoader(import.meta.url)

Expand Down
12 changes: 12 additions & 0 deletions packages/core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# barnard59-core

## 5.3.2

### Patch Changes

- e82aa36: Remove references of `rdf-js` types package, repaced with `@rdfjs/types`

## 5.3.1

### Patch Changes

- 9d0ce9f: Improve Windows compatibility (re zazuko/rdf-loader-code#34)

## 5.3.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/core/lib/cloneTerm.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Term } from 'rdf-js'
import type { Term } from '@rdfjs/types'
import type { Environment } from 'barnard59-env'

function cloneTerm<T extends Term>(rdf: Environment, term: T | null | undefined): T | null {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/lib/factory/pipeline.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { DatasetCore, Term } from 'rdf-js'
import type { DatasetCore, Term } from '@rdfjs/types'
import type { GraphPointer, MultiPointer } from 'clownface'
import { Logger } from 'winston'
import { LoaderRegistry } from 'rdf-loaders-registry'
Expand Down
6 changes: 3 additions & 3 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "barnard59-core",
"version": "5.3.0",
"version": "5.3.2",
"description": "Core component of Barnard59 Linked Data pipelines",
"type": "module",
"main": "index.js",
Expand Down Expand Up @@ -29,7 +29,7 @@
"is-graph-pointer": "^2.1.0",
"is-stream": "^3.0.0",
"onetime": "^6.0.0",
"rdf-loader-code": "^2.1.1",
"rdf-loader-code": "^2.1.3",
"rdf-loaders-registry": "^1.0.1",
"readable-stream": "^3.6.0",
"untildify": "^5.0.0",
Expand All @@ -38,7 +38,7 @@
"devDependencies": {
"@rdfjs/namespace": "^2.0.0",
"@types/readable-stream": "^4.0.9",
"barnard59-env": "^1.2.1",
"barnard59-env": "^1.2.2",
"barnard59-http": "^2.0.0",
"barnard59-test-support": "^0.0.3",
"chai": "^4.3.7",
Expand Down
Loading

0 comments on commit ff6cec0

Please sign in to comment.