Skip to content

Commit

Permalink
build(deps): replace local toCubeShape with barnard59-cube (#1515)
Browse files Browse the repository at this point in the history
* build(deps): replace local `toCubeShape` with `barnard59-cube`

* test(cli): remove redundant test

* wip: update cube shape building

* test: remove obsolete test case

* Update shaggy-numbers-shave.md

* Update shaggy-numbers-shave.md
  • Loading branch information
tpluscode authored May 23, 2024
1 parent 22f9b2f commit a7c3681
Show file tree
Hide file tree
Showing 14 changed files with 78 additions and 353 deletions.
5 changes: 5 additions & 0 deletions .changeset/shaggy-numbers-shave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cube-creator/cli": major
---

Using `barnard59-cube` for constructing the cube constraint shape (closes #1469, closes #1470)
5 changes: 0 additions & 5 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,5 @@
"no-unused-expressions": "off",
"prefer-regex-literals": "off"
}
}, {
"files": ["cli/lib/toCubeShape/*.js"],
"rules": {
"@typescript-eslint/no-var-requires": "off"
}
}]
}
1 change: 0 additions & 1 deletion cli.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ WORKDIR /app
ADD package.json yarn.lock ./
ADD ./cli/package.json ./cli/
ADD ./cli/shapes.ttl ./cli/
ADD ./cli/lib/toCubeShape ./cli/lib/toCubeShape/
ADD ./cli/pipelines ./cli/pipelines/
ADD ./packages/core/package.json ./packages/core/
ADD ./packages/model/package.json ./packages/model/
Expand Down
7 changes: 6 additions & 1 deletion cli/lib/cube.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { DatasetCore, Quad, Term } from '@rdfjs/types'
import type { DataFactory, DatasetCore, Quad, Term } from '@rdfjs/types'
import $rdf from 'rdf-ext'
import { cc } from '@cube-creator/core/namespace'
import clownface, { GraphPointer } from 'clownface'
Expand Down Expand Up @@ -28,6 +28,11 @@ export function getCubeId({ ptr }: { ptr: GraphPointer }) {
return ptr.out(cc.cube).term || ''
}

export function getCubeShapeId(this: { rdf: DataFactory }, { ptr }: { ptr: GraphPointer }) {
const cubeId = getCubeId({ ptr })
return this.rdf.namedNode(`${typeof cubeId === 'string' ? cubeId : cubeId.value}/shape/`)
}

export function expirePreviousVersions(this: Pick<Context, 'variables' | 'logger'>) {
const timestamp = this.variables.get('timestamp')
const baseCube = $rdf.namedNode(this.variables.get('namespace'))
Expand Down
59 changes: 0 additions & 59 deletions cli/lib/toCubeShape/Cube.js

This file was deleted.

116 changes: 0 additions & 116 deletions cli/lib/toCubeShape/Dimension.js

This file was deleted.

98 changes: 0 additions & 98 deletions cli/lib/toCubeShape/index.js

This file was deleted.

12 changes: 0 additions & 12 deletions cli/lib/toCubeShape/urlJoin.js

This file was deleted.

2 changes: 1 addition & 1 deletion cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"aws-sdk": "^2.559.0",
"barnard59": "^5.0.2",
"barnard59-base": "^2.4.2",
"barnard59-cube": "^1.4.3",
"barnard59-cube": "^1.4.6",
"barnard59-formats": "^2.1.1",
"barnard59-graph-store": "^5.1.2",
"barnard59-http": "^2.0.0",
Expand Down
15 changes: 13 additions & 2 deletions cli/pipelines/main.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .

<#Main> a :Pipeline ;
:variables
[
:variable
[
:name "executionUrl" ;
:required false
] ;
] ;
:steps [ :stepList ( <#loadMetadata> <#doTransform> <#validate> <#countOutputQuads> <#StreamOutput> ) ] .

<#StreamOutput>
Expand Down Expand Up @@ -172,8 +180,8 @@
] .

<#toCubeShape> a :Step;
code:implementedBy [ a code:EcmaScript;
code:link <file:../lib/toCubeShape>
code:implementedBy [ a code:EcmaScriptModule;
code:link <node:barnard59-cube/cube.js#buildCubeShape>
];
code:arguments [
code:name "excludeValuesOf";
Expand All @@ -185,6 +193,9 @@
] , [
code:name "cube" ;
code:value [ a code:EcmaScript ; code:link <file:../lib/cube#getCubeId> ]
] , [
code:name "shape" ;
code:value [ a code:EcmaScript ; code:link <file:../lib/cube#getCubeShapeId> ]
] .

<#flatten> a :Step;
Expand Down
2 changes: 1 addition & 1 deletion cli/pipelines/to-filesystem.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
:steps [ :stepList ( _:serialize _:save ) ] ;
:variables [ :variable [ a :Variable ;
:name "targetFile" ;
:value "./output/transformed.nt" ] ] .
:value "./output/transformed.nq" ] ] .

<#setGraph>
a :Step ;
Expand Down
Loading

0 comments on commit a7c3681

Please sign in to comment.