From d84a4d08002199133b15f22ba7d427e7821ffa2a Mon Sep 17 00:00:00 2001 From: Ludovic Muller Date: Tue, 24 Oct 2023 11:53:37 +0200 Subject: [PATCH] entity-renderer: use shrink from @zazuko/prefixes --- package-lock.json | 7 ++++--- packages/entity-renderer/package.json | 1 + packages/entity-renderer/renderer/common/shrink.js | 8 -------- packages/entity-renderer/renderer/metadata/namedGraphs.js | 2 +- packages/entity-renderer/renderer/web-component/N3Term.js | 2 +- 5 files changed, 7 insertions(+), 13 deletions(-) delete mode 100644 packages/entity-renderer/renderer/common/shrink.js diff --git a/package-lock.json b/package-lock.json index 210f8ce7..df43bd97 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5003,9 +5003,9 @@ } }, "node_modules/@zazuko/prefixes": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@zazuko/prefixes/-/prefixes-2.0.0.tgz", - "integrity": "sha512-WicT6lMnWFaaxudoBhccRzUOxrej0Tk5jwn9oGj308MP2Dlsqh8f6EEJdGu+nXYp3M1NLLokXbtZpTvtDM11PQ==" + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@zazuko/prefixes/-/prefixes-2.1.0.tgz", + "integrity": "sha512-dm0/YBNzuwJUm8cXoF3Dn9DfQetnRDaOJ8NdlgLY645OaUddCzUAAYcanm+xZmEo1SWX+/Tp3jbScwCaN2b/aQ==" }, "node_modules/@zazuko/rdf-entity-webcomponent": { "version": "0.7.7", @@ -20905,6 +20905,7 @@ "@rdfjs/formats-common": "^3.1.0", "@rdfjs/to-ntriples": "^2.0.0", "@zazuko/env": "^1.9.0", + "@zazuko/prefixes": "^2.1.0", "@zazuko/rdf-entity-webcomponent": "^0.7.7", "express": "^4.18.2", "hijackresponse": "^5.0.0", diff --git a/packages/entity-renderer/package.json b/packages/entity-renderer/package.json index 9e3dae23..9653df44 100644 --- a/packages/entity-renderer/package.json +++ b/packages/entity-renderer/package.json @@ -28,6 +28,7 @@ "@rdfjs/formats-common": "^3.1.0", "@rdfjs/to-ntriples": "^2.0.0", "@zazuko/env": "^1.9.0", + "@zazuko/prefixes": "^2.1.0", "@zazuko/rdf-entity-webcomponent": "^0.7.7", "express": "^4.18.2", "hijackresponse": "^5.0.0", diff --git a/packages/entity-renderer/renderer/common/shrink.js b/packages/entity-renderer/renderer/common/shrink.js deleted file mode 100644 index 01c64aff..00000000 --- a/packages/entity-renderer/renderer/common/shrink.js +++ /dev/null @@ -1,8 +0,0 @@ -import { splitIfVocab } from '@zazuko/rdf-entity-webcomponent/src/builder/utils.js' - -function shrink (urlStr) { - const { vocab, value } = splitIfVocab(urlStr) - return vocab ? `${vocab}:${value}` : `${value}` -} - -export { shrink } diff --git a/packages/entity-renderer/renderer/metadata/namedGraphs.js b/packages/entity-renderer/renderer/metadata/namedGraphs.js index 5e575dc7..b805c320 100644 --- a/packages/entity-renderer/renderer/metadata/namedGraphs.js +++ b/packages/entity-renderer/renderer/metadata/namedGraphs.js @@ -1,5 +1,5 @@ import rdf from '@zazuko/env' -import { shrink } from '../common/shrink.js' +import { shrink } from '@zazuko/prefixes' const namedCounts = (dataset) => { const namedGraphs = rdf.termMap() diff --git a/packages/entity-renderer/renderer/web-component/N3Term.js b/packages/entity-renderer/renderer/web-component/N3Term.js index a264382f..f9413f28 100644 --- a/packages/entity-renderer/renderer/web-component/N3Term.js +++ b/packages/entity-renderer/renderer/web-component/N3Term.js @@ -1,6 +1,6 @@ import toNT from '@rdfjs/to-ntriples' import { html } from 'lit' -import { shrink } from '../common/shrink.js' +import { shrink } from '@zazuko/prefixes' function renderTerm (term) { if (term.termType === 'NamedNode') {