Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@zazuko/cube-hierarchy-query

Package Overview
Dependencies
Maintainers
6
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zazuko/cube-hierarchy-query - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

6

CHANGELOG.md
# @zazuko/cube-hierarchy-query
## 1.0.1
### Patch Changes
- a00f28a: Roots without children were not returned by the `getHierarchy` function
## 1.0.0

@@ -4,0 +10,0 @@

7

index.js

@@ -28,6 +28,5 @@ import clownface from 'clownface';

export function getHierarchy(hierarchy) {
const query = DESCRIBE `*`
.WHERE `
${topDown(hierarchy)}
`;
const { described, where } = topDown(hierarchy);
const query = DESCRIBE `${described}`
.WHERE `${where}`;
return {

@@ -34,0 +33,0 @@ query,

@@ -9,3 +9,6 @@ import { Term } from 'rdf-js';

export declare function bottomUp(hierarchyLevel: MultiPointer, { restrictTypes, firstLevel }: GetHierarchyPatterns): SparqlTemplateResult;
export declare function topDown(hierarchy: GraphPointer): SparqlTemplateResult;
export declare function topDown(hierarchy: GraphPointer): {
described: SparqlTemplateResult;
where: SparqlTemplateResult;
};
export {};

@@ -54,6 +54,8 @@ import rdf from '@rdfjs/data-model';

export function topDown(hierarchy) {
const roots = hierarchy.out(meta.hierarchyRoot).terms.map((term) => ({ root: term }));
const rootTerms = hierarchy.out(meta.hierarchyRoot).terms;
const roots = rootTerms.map((term) => ({ root: term }));
let level = 0;
let currentLevel = hierarchy.out(meta.nextInHierarchy);
const levelPatterns = [];
const levels = [];
while (currentLevel) {

@@ -67,2 +69,5 @@ const path = currentLevel.out(sh.path);

let currentLevelPatterns = sparql `${subject} ${toSparql(path)} ${nextLevelSubject} .`;
if (level !== 0) {
levels.push(subject);
}
const targetClass = currentLevel.out(sh.targetClass).term;

@@ -89,3 +94,4 @@ if (targetClass) {

}, '');
return sparql `
const described = sparql `${rootTerms} ${levels}`;
const where = sparql `
${VALUES(...roots)}

@@ -95,2 +101,6 @@

`;
return {
described,
where,
};
}
{
"name": "@zazuko/cube-hierarchy-query",
"version": "1.0.0",
"version": "1.0.1",
"description": "Facilitates querying RDF cube hierarchies",

@@ -5,0 +5,0 @@ "type": "module",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc