Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@zazuko/query-rdf-data-cube
Advanced tools
Query (or introspect) [RDF Data Cubes](https://www.w3.org/TR/vocab-data-cube/) with a JavaScript API, without writing SPARQL.
Query and explore RDF Data Cubes with a JavaScript API, without writing SPARQL.
npm install @zazuko/query-rdf-data-cube
See https://zazuko.github.io/query-rdf-data-cube/
Changelog: https://github.com/zazuko/query-rdf-data-cube/blob/master/CHANGELOG.md
See the examples/
folder at the root of this repository.
git clone
npm ci
npm run build
npm run test
npm run docs:compile
npm run docs:publish
node examples/introspect-and-query.js
This library has two main use cases: exploring an RDF Data Cube and querying an RDF Data Cube. Both usually go hand in hand.
Instantiating a DataCube EntryPoint lets you access its DataCubes:
const { DataCubeEntryPoint } = require("query-rdf-data-cube");
// instantiate an RDF Data Cube with a SPARQL endpoint
const entryPoint = new DataCubeEntryPoint("https://ld.stadt-zuerich.ch/query");
// fetch all its dataCubes
const dataCubes = await entryPoint.dataCubes();
// assign the 4th datacube
const datacube = dataCubes[3];
You could also directly instantiate a DataCube.
A DataCube can retrieve its Components, ie. its Dimensions, Measures and Attributes:
const dimensions = await datacube.dimensions();
const measures = await datacube.measures();
const attributes = await datacube.attributes();
const zeitDimension = dimensions[0];
// const raumDimension = dimensions[1];
// Again, dimensions, measures and attributes can also be constructed from scratch:
const raumDimension = new Dimension({
label: "Raum",
iri: "https://ld.stadt-zuerich.ch/statistics/property/RAUM"
});
const betriebsartDimension = dimensions[2];
const geschlechtDimension = dimensions[3];
const beschaeftigteMeasure = measures[0];
const quelleAttribute = attributes[0];
const glossarAttribute = attributes[1];
const erwarteteAktualisierungAttribute = attributes[4];
const korrekturAttribute = attributes[5];
This setup is quite exhaustive, in many situations you won't want to create all of these or get all of these and rely on this lib to properly guess what to query.
const query = datacube
.query()
// .select({}) takes binding names as keys and Component (Dimension/Attribute/Measure) as values
.select({
betriebsart: betriebsartDimension,
geschlecht: geschlechtDimension,
raum: raumDimension,
zeit: zeitDimension,
bep: beschaeftigteMeasure.avg(),
// include some extra attributes, not all of them
quelle: quelleAttribute,
glossar: glossarAttribute,
erwarteteAktualisierung: erwarteteAktualisierungAttribute,
korrektur: korrekturAttribute,
})
.filter(raumDimension.equals("https://ld.stadt-zuerich.ch/statistics/code/R30000"))
.groupBy("zeit")
.having(({ bep }) => bep.gte(10000))
.limit(3);
Now that we built a query, we can generate SPARQL out of it:
const sparql = await query.toSparql();
Or execute the SPARQL query against the SPARQL endpoint:
const results = await query.execute();
FAQs
Query (or introspect) [RDF Data Cubes](https://www.w3.org/TR/vocab-data-cube/) with a JavaScript API, without writing SPARQL.
The npm package @zazuko/query-rdf-data-cube receives a total of 0 weekly downloads. As such, @zazuko/query-rdf-data-cube popularity was classified as not popular.
We found that @zazuko/query-rdf-data-cube demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.