Registry / data / barnard59-cube

barnard59-cube

JSON →
library1.4.10jsnpmunverified

barnard59-cube is a JavaScript package offering a suite of operations and command-line interfaces for managing RDF cubes within Barnard59 Linked Data pipelines. It provides functionalities like `toObservation` for creating cube observations aligned with the Cube Schema specification and `buildCubeShape` for deriving SHACL shapes from observation streams. The package also includes robust CLI commands for fetching, validating, and checking RDF cube metadata and observations against defined constraints using SPARQL endpoints. Currently at version 1.4.10, this package is part of the actively developed `barnard59` monorepo, benefiting from continuous updates that incorporate dependency upgrades and minor feature enhancements. Its key differentiator is the seamless integration of RDF cube lifecycle management into stream-based data processing workflows.

npm install barnard59-cube
INSTALL
IMPORT
SIG · BARNARD59-CUBE
B
barnard59-cube
datajavascriptv1.4.10
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

toObservation
import { toObservation } from 'barnard59-cube';
const toObservation = require('barnard59-cube').toObservation;
ESM is the primary module system for current Barnard59 versions. Operations are typically named exports.
buildCubeShape
import { buildCubeShape } from 'barnard59-cube';
import buildCubeShape from 'barnard59-cube/lib/buildCubeShape';
Import specific operations as named exports. Direct path imports might break with future refactoring.
cube
barnard59 cube fetch-cube --help
The 'cube' namespace primarily exposes CLI commands via the main `barnard59` executable, not directly importable functions for programmatic use in a typical JS module fashion.

Demonstrates how to use the `fetch-cube` CLI command to retrieve RDF cube data from a SPARQL endpoint, capturing its output.

import { createRequire } from 'module'; const require = createRequire(import.meta.url); const { spawn } = require('child_process'); const cubeUri = 'https://agriculture.ld.admin.ch/agroscope/PRIFm8t15/2'; const endpoint = 'https://int.lindas.admin.ch/query'; console.log(`Fetching cube data for ${cubeUri} from ${endpoint}...`); const child = spawn('barnard59', ['cube', 'fetch-cube', '--cube', cubeUri, '--endpoint', endpoint]); let stdoutData = ''; let stderrData = ''; child.stdout.on('data', (data) => { stdoutData += data.toString(); }); child.stderr.on('data', (data) => { stderrData += data.toString(); }); child.on('close', (code) => { if (code === 0) { console.log('Cube data fetched successfully (truncated to first 500 chars):'); console.log(stdoutData.substring(0, 500) + (stdoutData.length > 500 ? '...' : '')); } else { console.error(`Error fetching cube data. Exit code: ${code}`); console.error(`Stderr: ${stderrData}`); } }); // Example of programmatic use (assuming operations are exported): // import { toObservation, buildCubeShape } from 'barnard59-cube'; // async function processCubeData() { // // This would typically involve setting up a Barnard59 pipeline // // For example: sourceStream.pipe(toObservation()).pipe(buildCubeShape()).pipe(sinkStream); // console.log('\nProgrammatic operations would go here, e.g., using toObservation or buildCubeShape.'); // console.log('Refer to Barnard59 pipeline documentation for detailed programmatic usage.'); // } // processCubeData();
barnard59-cube --version
Debug
Known issues
breakingUpdating `rdf-literal` to v2, a core dependency, changes how RDF literals are handled. RDF 1.1 specifies that all literals, including plain ones, are now considered typed (e.g., plain literals implicitly have `xsd:string`). Code that relied on distinguishing plain literals without a datatype from those explicitly typed as `xsd:string` may exhibit changed behavior.
fix
Review any code that inspects or manipulates RDF literals, particularly comparisons or type checks, to account for implicit `xsd:string` datatypes on plain literals. Explicitly check for `rdf:langString` if language-tagged strings are expected.
affects: >=1.4.10
breakingThe `rdfxml-streaming-parser` dependency was updated to v3. Major version bumps in parsers typically involve breaking changes in configuration options, error handling, or stricter adherence to specifications, which could affect how RDF/XML input is processed or validated.
fix
Consult the `rdfxml-streaming-parser` v3 changelog for specific breaking changes. Adjust parser configuration, error handling logic, or input RDF/XML documents if issues arise during parsing.
affects: >=1.4.10
breakingThe `@zazuko/env-node` dependency has been updated to v3. This environment provides the RDF/JS factories and utilities. A major version update might introduce breaking changes in the RDF/JS data model factories, default behaviors for creating terms/datasets, or how specific environment extensions operate.
fix
Examine the `@zazuko/env-node` v3 release notes for breaking changes related to RDF/JS factory usage or environment setup. Update code that directly interacts with the RDF/JS environment or creates RDF terms.
affects: >=1.2.7 (via `barnard59-env`)
breakingThe `rdf-validate-shacl` dependency, used by `barnard59-shacl` (a dependency of barnard59-cube), has been updated to 0.6. This may introduce stricter SHACL validation rules, changes in how validation reports are generated, or require updates to SHACL shapes themselves to ensure compatibility.
fix
Review SHACL shapes and validation logic. If validation failures occur unexpectedly or report formats change, consult the `rdf-validate-shacl` 0.6 changelog for necessary adjustments.
affects: >=1.4.10 (via `barnard59-shacl`)
gotchaBarnard59 pipelines, including those within `barnard59-cube`, are inherently stream-based. For optimal performance and memory efficiency, avoid collecting entire streams into memory when processing large datasets, especially for operations like `buildCubeShape` which might process many observations before emitting a single result.
fix
Design pipelines to process data chunk-by-chunk using back-pressure mechanisms. Utilize `pipeline.stream.pipe()` and `pipeline.stream.on()` events rather than buffering large amounts of data in JavaScript arrays.
affects: >=1.0.0
Errors
Common errors & fixes
Pipeline failed because the profile remote address does not include a correct `content-type` header.
When using `check-metadata` with a remote `--profile` URL, the HTTP response header might lack a proper `Content-Type`, preventing the pipeline from identifying the RDF format.
fix
Specify the RDF format explicitly using the `--profileFormat` option. For example: `barnard59 cube check-metadata --profile https://example.org/my-profile.ttl --profileFormat 'text/turtle'`.
Error: Command failed with exit code 1
Generic error from CLI commands, often indicating incorrect arguments, missing environment variables, network issues (for SPARQL endpoints), or malformed input RDF.
fix
Check the stderr output for more specific error messages. Verify `--cube` and `--endpoint` URIs are correct and accessible. Ensure input RDF (if from stdin) is well-formed. Use `--help` for the specific command to review expected arguments.
Upgrade
Version history
1.4.10latest on npm
Audit
Dependencies
barnard59-formatsrequiredProvides RDF serialization and parsing capabilities essential for handling cube data.
barnard59-rdfrequiredCore RDF data model utilities for processing RDF terms and datasets.
barnard59-shaclrequiredUsed for SHACL-based validation of cube shapes and metadata.
barnard59-envrequiredProvides the RDF/JS environment used throughout Barnard59 packages.
Agent activity
24 hits · last 30 days
node
22
OpenAI (training)
1
Resources
barnard59-cube — npm install barnard59-cube · libregistry