
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
@entryscape/csvw-js
Advanced tools
The library csvw-js provides tools for RDF-generation and validation of csv-files against schemas according to W3Cs specifications.
This library provides tools for RDF-generation and validation of csv-files against schemas according to W3Cs specifications.
npm install @entryscape/csvm-js
The following two validation-commands can be executed from the command line:
validatecsv csv schema rows
Or if the library has not been installed globally:
node bin/validateCSV.js csv schema rows
This command validates given csv-data against a given schema. The parameter "csv" accepts a filepath to csv-data and the parameter "schema" accepts a filepath to a schema-file. The parameter "rows" is optional and accepts a number that specifies the maximum amount of csv rows to validate. It also accepts "undefined" meaning unlimited, this is the default value. The command returns a report table with potential invalidations and/or warnings.
An example of how the report table looks is found below.
generateRDF csv schema options
This commands generates RDF from given csv-data and a given schema. The parameter "csv" accepts a filepath to csv-data and the parameter "schema" accepts a filepath toa schema-file. the parameter "options" is optional and accepts an object with "dontIgnoreInvalidRows" and "dontIgnoreWarningRows". GenerateRDF will return with only a report table if any row was invalid and "dontIgnoreInvalidRows" is true or any row has warnings and "dontIgnoreWarningRows" is true. The default value for both is false.
The command return an array with three elements: rdfxml, graph and report. Rdfxml is the generated RDF in the form of RDF/XML, graph is the generated RDF as a graph. The command also validates the data the same way as the command "validate does. The third element is therefore a report table identical to the one described earlier.
In order to view all possible parameters for a command, type:
validate -h
or
generateRDF -h
A report table may look like this:
=== Invalids ===
┌─────────┬────────────┬─────────────────────────────────┬───────────┬────────┐
│ (index) │ Source │ Message │ Row │ Column │
├─────────┼────────────┼─────────────────────────────────┼───────────┼────────┤
│ 0 │ 'Datatype' │ 'length not equal to 5, got 10' │ 1 │ 'date' │
└─────────┴────────────┴─────────────────────────────────┴───────────┴────────┘
=== Warnings ===
┌─────────┐
│ (index) │
├─────────┤
└─────────┘
A validation command may look like this:
validatecsv ./test/skoldata-test.csv ./test/skoldata-test.json
An RDF-generation-command may look like this:
generateRDF ./example.csv ./example.json --dontIgnoreInvalidRows
Here are some potential improvements to the library:
Tests are downloaded from the W3C CSVW repository on GitHub via the following command:
yarn synctests
After the tests are downloaded they can be run by executing the following command:
yarn test
Note that at the time of writing 87 tests fail while 301 test pass.
FAQs
The library csvw-js provides tools for RDF-generation and validation of csv-files against schemas according to W3Cs specifications.
We found that @entryscape/csvw-js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.