# virtuoso-uid **Repository Path**: mirrors_crs4/virtuoso-uid ## Basic Information - **Project Name**: virtuoso-uid - **Description**: Create unique ID for resources stored on Virtuoso. It creates a random code and adds it to a certain prefix and verifies if the this IRI is already used. - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-08 - **Last Updated**: 2026-05-23 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README Virtuoso unique ID generator for Node.js ============================================= ## Description This module allows to create unique ID for resources stored on Virtuoso. It creates a random code and adds it to a certain prefix and verifies if this IRI is already used, if not the module inserts a triple with: Subject : The new ID (prefix+code) Predicate : dcterms:created Object : The current date [new Date().toISOString()] ## Install ``` npm install [--save] virtuoso-uid ``` ## Usage ```js const ID = require("virtuoso-uid"); ID.config({ endpoint: 'http://dbpedia.org/sparql', graph: 'http://www.example.org/myGraph', prefix: 'http://dbpedia.org/resource/' }); ID.create().then((id)=>{ console.log(id); }).catch(console.log); ``` ## Methods #### `create([echo])` Creates an unused IRI and store the new triple: date^^xsd:dateTimeStamp. Returns a Promise that, when resolved, gives the complete result object. - `echo` set to 'true' to print query in standard console, 'false' is the default value; #### `config(opts)` Sets the options ```js let opts = { endpoint: 'http://dbpedia.org/sparql', // Virtuoso SPARQL endpoint graph: 'http://www.example.org/myGraph', // The graph where insert the new ID prefix: 'http://dbpedia.org/resource/', // The prefix alphabet : 'abcdeABCDE', // The set of chars used to create the code idLength : 10 // the code length } ``` Default values are: ```js let defaults = { endpoint: null, graph: null, prefix: null, alphabet : '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', length : 5 } ```