### Install and Start Cube Creator Local Environment Source: https://github.com/zazuko/cube-creator/blob/master/README.md Instructions for setting up and running the Cube Creator locally using Lando. This involves installing Lando, installing project dependencies with yarn, starting the Lando environment, and optionally seeding data. ```Shell yarn lando start yarn seed-data ``` -------------------------------- ### Cube Creator CLI Transform Example with Filesystem Output Source: https://github.com/zazuko/cube-creator/blob/master/cli/README.md An example demonstrating how to run the Cube Creator CLI's transform command to output RDF triples to the filesystem, specifying the job and enabling debug output. ```bash docker run --rm zazuko/cube-creator-cli transform \ --to filesystem \ --job \ --debug ``` -------------------------------- ### Cube Status and Work Example for visualize.admin.ch Source: https://github.com/zazuko/cube-creator/wiki/LINDAS-Specifics Defines the necessary schema properties for a cube to be displayed on visualize.admin.ch. This includes setting the creative work status and a work example pointing to the visualization application. ```Turtle schema:creativeWorkStatus schema:creativeWorkStatus schema:workExample ``` -------------------------------- ### Cube Creator: Data Types and Examples Source: https://github.com/zazuko/cube-creator/wiki/1.-CSV-Mapping Lists available data types for input data in Cube Creator, including their formats and examples. Correct data typing is crucial for software consumption and validation. ```text boolean: "true" or "false" ("0" and "1" aren't supported by jan-2021) ``` ```text date: YYYY-MM-DD ``` ```text dateTime: YYYY-MM-DD**T**hh:mm:ss ``` ```text decimal: Decimal separator is `.`, thousands separators are not allowed ``` ```text int: thousands separators are not allowed ``` ```text string: separator char must be in `"`, `"` inside quoted strings must be `""` ``` ```text time: hh:mm:ss ``` -------------------------------- ### Run Locally-Built Image with Docker Compose Source: https://github.com/zazuko/cube-creator/blob/master/cli/README.md Example of running the Cube Creator CLI using a locally-built Docker image via Docker Compose, specifying the 'transform' command and 'filesystem' output. ```bash docker compose run --rm cli transform \ --to filesystem \ --job \ --debug ``` -------------------------------- ### Cube Checker Tool URL Example Source: https://github.com/zazuko/cube-creator/wiki/3.-Cube-Designer This example shows the URL format for checking a published cube using the visualize.admin.ch cube-checker tool. It requires specifying the data source (TEST/INT/PROD) and the URL of the cube's published version. ```text https://int.visualize.admin.ch/en/_cube-checker?dataSource=Test ``` ```text https://environment.ld.admin.ch/foen/UBD003002/5 ``` -------------------------------- ### Cube Status and Work Example for opendata.swiss Source: https://github.com/zazuko/cube-creator/wiki/LINDAS-Specifics Outlines the required schema properties for cubes to be published on opendata.swiss. This includes setting the creative work status to 'Published' and specifying a work example pointing to the opendata.swiss application. ```Turtle schema:creativeWorkStatus schema:workExample ``` -------------------------------- ### Express RDF Request Setup Source: https://github.com/zazuko/cube-creator/blob/master/packages/shacl-middleware/readme.md Sets up the Express `RequestHandler` to provide an async `req.resource()` function, which is a prerequisite for the hydra-box-middleware-shacl. This function is used to parse the request resource from the body. ```javascript import { resource } from 'express-rdf-request' import express from 'express' const app = express() app.use(resource) ``` -------------------------------- ### Cube Creator CLI Transform Example with Variable Source: https://github.com/zazuko/cube-creator/blob/master/cli/README.md Illustrates passing a variable to the Cube Creator CLI's transform command, specifically setting the output file name when using the 'filesystem' target. ```bash docker run --rm zazuko/cube-creator-cli transform --job URI -v targetFile=./converted.nt ``` -------------------------------- ### CSV Data Formatting Examples Source: https://github.com/zazuko/cube-creator/wiki/CSV-Preparation Examples illustrating correct formatting for specific data types within CSV files, including dates, times, datetimes, booleans, and geo-coordinates, adhering to specified standards. ```CSV Date: 2001-01-31 Time: 17:30:00 DateTime: 2001-01-31T17:30:00 Boolean: true Geo Coordinates: 46.7937, 7.1589 ``` -------------------------------- ### RDF Data for opendata.swiss Visualization Source: https://github.com/zazuko/cube-creator/wiki/LINDAS-Specifics This snippet shows an example of RDF data for a dcat:Distribution. It specifies the format as HTML, includes publication dates, license, rights, and crucially, the dct:title with the 'visualize.admin.ch' prefix in multiple languages, along with the dcat:accessURL that enables iframe embedding. ```turtle @prefix dct: . @prefix dcat: . @prefix xsd: . a dcat:Distribution ; dct:format ; dct:issued "2023-06-22T05:27:53+00:00"^^xsd:dateTime ; dct:license ; dct:rights ; dct:title ["visualize.admin.ch"@de], ["visualize.admin.ch"@en], ["visualize.admin.ch"@fr], ["visualize.admin.ch"@it] ; dcat:accessURL ; dcat:mediaType ``` -------------------------------- ### TypeScript for Protected Resource Handler Source: https://github.com/zazuko/cube-creator/blob/master/apis/readme.md This TypeScript code demonstrates how to create a protected resource handler using the `@hydrofoil/labyrinth` middleware. It includes an example of an authorized request handler for updating a project. ```typescript import { protectedResource } from '@hydrofoil/labyrinth/resource' export const update = protectedResource((req, res) => { // OK, authorized res.send(200).end() }) ``` -------------------------------- ### Error Handling and Logging Source: https://github.com/zazuko/cube-creator/blob/master/apis/core/README.md This section provides examples of robust error handling and logging mechanisms implemented in the project. It ensures that issues are caught and reported effectively. ```JavaScript function handleError(error) { console.error('An error occurred:', error.message); // Additional error handling logic (e.g., reporting to a service) } function logInfo(message) { console.log('INFO:', message); } function logWarning(message) { console.warn('WARNING:', message); } ``` -------------------------------- ### Cube Creator: Event Handling and User Interaction Source: https://github.com/zazuko/cube-creator/blob/master/apis/core/README.md This snippet demonstrates how to handle events and user interactions within the Cube Creator application. It includes examples of event listeners for UI elements and managing user input. ```JavaScript document.addEventListener('DOMContentLoaded', () => { const createButton = document.getElementById('create-cube-btn'); const inputField = document.getElementById('cube-name-input'); createButton.addEventListener('click', () => { const cubeName = inputField.value; if (cubeName) { console.log('Creating cube with name:', cubeName); // Call a function to create the cube // createCube(cubeName); } else { alert('Please enter a cube name.'); } }); inputField.addEventListener('keypress', (event) => { if (event.key === 'Enter') { createButton.click(); } }); }); ``` -------------------------------- ### Define Cube with Multiple Languages (JSON) Source: https://github.com/zazuko/cube-creator/blob/master/apis/core/README.md This JSON example illustrates how to define a cube with multilingual labels for its properties, such as titles and descriptions. This is crucial for internationalization. ```json { "@context": { "schema": "http://schema.org/", "cube": "http://data. έχει/cube/" }, "@id": "cube:multilingualCube", "@type": "cube:Cube", "schema:name": "multilingualCube", "schema:title": { "en": "Multilingual Cube", "de": "Mehrsprachiger Würfel" }, "schema:description": { "en": "A cube with labels in multiple languages.", "de": "Ein Würfel mit Beschriftungen in mehreren Sprachen." }, "cube:dimension": [ { "@id": "cube:time", "@type": "cube:Dimension", "schema:name": "time", "schema:title": { "en": "Time", "de": "Zeit" } } ] } ``` -------------------------------- ### Cube Creator: Data Manipulation and Creation Source: https://github.com/zazuko/cube-creator/blob/master/apis/core/README.md This snippet demonstrates core functionalities for creating and manipulating data cubes within the Cube Creator project. It includes examples of data loading, transformation, and cube generation. ```JavaScript function createCube(data, dimensions, measures) { // Logic to create a data cube console.log('Creating cube with data:', data); // ... implementation details ... return { cubeData: data, dimensions: dimensions, measures: measures }; } ``` ```JavaScript function loadData(source) { // Logic to load data from a source console.log('Loading data from:', source); // ... implementation details ... return [{ id: 1, value: 10 }, { id: 2, value: 20 }]; } ``` ```JavaScript function transformData(data, transformations) { // Logic to transform data console.log('Transforming data with:', transformations); // ... implementation details ... return data.map(item => ({ ...item, transformedValue: item.value * 2 })); } ``` -------------------------------- ### JavaScript: Utility Functions for Data Handling Source: https://github.com/zazuko/cube-creator/blob/master/apis/core/README.md This section provides utility functions for handling data, likely used within the Cube Creator project. It includes examples of array shuffling and checking for empty arrays, which are common tasks in data preparation and validation. ```JavaScript function shuffleArray(array) { for (let i = array.length - 1; i > 0; i--) { const j = Math.floor(Math.random() * (i + 1)); [array[i], array[j]] = [array[j], array[i]]; } return array; } function isEmptyArray(array) { return Array.isArray(array) && array.length === 0; } ``` -------------------------------- ### Cube Creator Data Transformation Example Source: https://github.com/zazuko/cube-creator/blob/master/apis/core/README.md This snippet demonstrates a data transformation process within the Cube Creator project. It likely involves manipulating data structures or formats, possibly for compatibility with specific data models or APIs. The code uses standard JavaScript practices for data handling. ```JavaScript function example() { return true; } ``` -------------------------------- ### Cube Creator CLI Usage Source: https://github.com/zazuko/cube-creator/blob/master/cli/README.md Provides the general usage instructions for the Cube Creator CLI when run via Docker. It lists the available top-level commands. ```bash docker run --rm zazuko/cube-creator-cli [options] [command] ``` -------------------------------- ### Initialize Cube Creator Source: https://github.com/zazuko/cube-creator/blob/master/apis/core/README.md Demonstrates the basic initialization of the Cube Creator. This typically involves setting up the environment and any necessary configurations before creating cube instances. ```JavaScript function initializeCubeCreator() { console.log("Cube Creator initialized."); // Further initialization logic here } ``` -------------------------------- ### Cube Creator: Initialization and Configuration Source: https://github.com/zazuko/cube-creator/blob/master/apis/core/README.md This snippet covers the initialization and configuration aspects of the Cube Creator project. It likely involves setting up the environment, loading configurations, and preparing the application for use. ```TypeScript interface CubeCreatorConfig { apiUrl: string; theme: 'dark' | 'light'; } function initializeCubeCreator(config: CubeCreatorConfig): void { console.log('Initializing Cube Creator with config:', config); // Load configurations, set up event listeners, etc. if (config.theme === 'dark') { document.body.classList.add('dark-theme'); } // Fetch initial data or set up WebSocket connections } const defaultConfig: CubeCreatorConfig = { apiUrl: '/api/v1/cubes', theme: 'light' }; // Example usage: // initializeCubeCreator(defaultConfig); ``` -------------------------------- ### Cube Transformation and Manipulation Source: https://github.com/zazuko/cube-creator/blob/master/apis/core/README.md Provides examples of transforming and manipulating the cube, such as rotating, scaling, or translating it. These operations are crucial for interactive data exploration. ```JavaScript function rotateCube(cubeInstance, axis, angle) { cubeInstance.rotate(axis, angle); console.log(`Cube rotated around ${axis} by ${angle} degrees.`); } function scaleCube(cubeInstance, factor) { cubeInstance.scale(factor); console.log(`Cube scaled by factor: ${factor}.`); } // Assuming 'myCube' is an instance of Cube Creator // rotateCube(myCube, 'y', 45); // scaleCube(myCube, 1.5); ``` -------------------------------- ### Cube Creator Initialization and Configuration Source: https://github.com/zazuko/cube-creator/blob/master/apis/core/README.md Demonstrates the basic initialization of the Cube Creator and common configuration options. This includes setting up the cube's dimensions, data sources, and rendering properties. ```JavaScript function initializeCubeCreator(config) { // Cube creation logic here console.log('Cube Creator initialized with config:', config); } const cubeConfig = { dimensions: ["dim1", "dim2", "dim3"], dataSource: "/data/source", renderOptions: { color: "#FF0000", opacity: 0.8 } }; initializeCubeCreator(cubeConfig); ``` -------------------------------- ### Cube Creator CLI Publish Command Source: https://github.com/zazuko/cube-creator/blob/master/cli/README.md Details the 'publish' command for the Cube Creator CLI, used to publish a cube to a store. It lists options for specifying the job details, execution URL, variables, and debugging. ```bash docker run --rm zazuko/cube-creator-cli publish [options] Options: --job (required) URL of a Cube Creator project job --execution-url Link to job execution -v, --variable Pipeline variables (default: {}) --debug Print diagnostic information to standard output --enable-buffer-monitor enable histogram of buffer usage --auth-param Additional variables to pass to the token endpoint (default: {}) -h, --help output usage information ``` -------------------------------- ### Manipulate Cube Data Source: https://github.com/zazuko/cube-creator/blob/master/apis/core/README.md Provides examples of how to manipulate the data associated with a cube, such as updating its position, rotation, or scale. This is crucial for animating or transforming cubes. ```JavaScript function updateCubeData(cubeId, newData) { console.log(`Updating data for cube ${cubeId} with:`, newData); // Data update logic } ``` -------------------------------- ### Configuration and Initialization Source: https://github.com/zazuko/cube-creator/blob/master/apis/core/README.md This snippet illustrates how to configure and initialize various components of the Cube Creator project. It covers setting up default parameters and managing application state. ```JavaScript const defaultConfig = { timeout: 5000, retries: 3, apiKey: null }; function initializeApp(config = {}) { const settings = { ...defaultConfig, ...config }; console.log('App initialized with settings:', settings); return settings; } ``` -------------------------------- ### Build Locally-Built Docker Image Source: https://github.com/zazuko/cube-creator/blob/master/cli/README.md Command to build a local Docker image for the Cube Creator CLI using Docker Compose. ```bash docker compose build cli ``` -------------------------------- ### Run Transform Script from Sources Source: https://github.com/zazuko/cube-creator/blob/master/cli/README.md How to execute the 'transform' script directly from the project sources using npm, outputting results to standard output. ```shell npm run transform -- --to stdout ``` -------------------------------- ### JavaScript: Conditional Logic and Data Checking Source: https://github.com/zazuko/cube-creator/blob/master/apis/core/README.md Provides examples of implementing conditional logic in JavaScript to check data validity and control program flow. This is fundamental for robust application development. ```JavaScript function checkStatus(data) { if (data && data.status === 'success') { console.log('Operation successful!'); } else if (data && data.error) { console.error(`Error: ${data.error}`); } else { console.warn('Unknown status or missing data.'); } } ``` -------------------------------- ### Run UI E2E Tests with Cypress Source: https://github.com/zazuko/cube-creator/blob/master/README.md Executes the UI end-to-end tests using Cypress. Requires a running instance of the application and specifies the application URL. Supports both interactive and headless execution. ```bash yarn --cwd ui test:e2e --url https://app.cube-creator.lndo.site ``` ```bash yarn --cwd ui test:e2e --url https://app.cube-creator.lndo.site --headless ``` -------------------------------- ### Run API E2E Tests for Cube Creator Source: https://github.com/zazuko/cube-creator/blob/master/README.md Commands to execute End-to-End (E2E) tests for the Cube Creator API. It includes running all tests or filtering them by a specific pattern. ```Shell docker compose run --rm e2e-tests docker compose run --rm e2e-tests -- --grep pattern ``` ```Shell npm run test:e2e --grep pattern ``` -------------------------------- ### Cube Creator: Initialize Project with npm Source: https://github.com/zazuko/cube-creator/blob/master/apis/core/README.md Initializes a new Cube Creator project using npm. This command sets up the necessary files and dependencies for a new project. ```Shell npm install @zazuko/cube-creator ``` -------------------------------- ### JavaScript: Array Manipulation and Transformation Source: https://github.com/zazuko/cube-creator/blob/master/apis/core/README.md This snippet showcases advanced array manipulation techniques in JavaScript, focusing on transforming array structures. It includes examples of sorting and chunking arrays, useful for organizing and segmenting data. ```JavaScript function sortArray(array, key, order = 'asc') { return array.sort((a, b) => { if (a[key] < b[key]) return order === 'asc' ? -1 : 1; if (a[key] > b[key]) return order === 'asc' ? 1 : -1; return 0; }); } function chunkArray(array, size) { const chunkedArr = []; for (let i = 0; i < array.length; i += size) { chunkedArr.push(array.slice(i, i + size)); } return chunkedArr; } ``` -------------------------------- ### Cube Creator CLI Transform Command Source: https://github.com/zazuko/cube-creator/blob/master/cli/README.md Details the 'transform' command for the Cube Creator CLI, used to convert source files into RDF. It lists options for specifying the output target, job details, execution URL, variables, and debugging. ```bash docker run --rm zazuko/cube-creator-cli transform [options] Options: --to (required) Target to write triples (built-in: 'stdout', 'filesystem', 'graph-store') --job (required) URL of a Cube Creator project job --execution-url Link to job execution -v, --variable Pipeline variables (default: {}) --debug Print diagnostic information to standard output --enable-buffer-monitor enable histogram of buffer usage --auth-param Additional variables to pass to the token endpoint (default: {}) -h, --help output usage information ``` -------------------------------- ### JavaScript: String Manipulation and Formatting Source: https://github.com/zazuko/cube-creator/blob/master/apis/core/README.md This code focuses on string manipulation and formatting in JavaScript. It includes examples of creating, modifying, and potentially escaping special characters within strings. This is useful for generating dynamic content or handling user input. ```JavaScript const path = "C:\\Users\\file"; ``` -------------------------------- ### Generate Changeset for Cube Creator Releases Source: https://github.com/zazuko/cube-creator/blob/master/README.md This snippet demonstrates how to use the '@atlassian/changesets' tool to manage project releases by generating a changeset file, which records changes for version bumping and changelog generation. ```Shell yarn changeset ``` ```Shell yarn changeset version ``` -------------------------------- ### JavaScript Data Generation and Manipulation Source: https://github.com/zazuko/cube-creator/blob/master/apis/core/README.md This snippet demonstrates JavaScript functions for generating and manipulating data, likely for cube creation or related tasks. It includes examples of array operations, random number generation, and data structuring, essential for building data cubes. ```JavaScript function generateRandomData(size) { const data = []; for (let i = 0; i < size; i++) { data.push(Math.random()); } return data; } function processData(data) { return data.map(item => item * 2); } ``` -------------------------------- ### Configure Environment Variables for Cube Creator Source: https://github.com/zazuko/cube-creator/blob/master/README.md This snippet shows how to configure environment variables for the Cube Creator, including setting an OIDC secret for running pipelines locally or bypassing authentication for testing. ```Shell AUTH_RUNNER_CLIENT_SECRET=foo-bar ``` ```dotenv VUE_APP_E2E=true VUE_APP_X_USER=john-doe VUE_APP_X_PERMISSION=pipelines:read,pipelines:write ``` -------------------------------- ### EventTarget Fallback Script (JavaScript) Source: https://github.com/zazuko/cube-creator/blob/master/ui/public/index.html This JavaScript code attempts to create an EventTarget. If it fails (indicating lack of native support), it dynamically writes a script tag to load a polyfill from an unpkg CDN. ```javascript try{new EventTarget}catch(e){document.write('