@glossarist/concept-browser 0.7.57 → 0.7.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,130 @@
1
+ {
2
+ "_comment": "Single source of truth for the Glossarist vocabulary. Consumed by vocabulary-emitter.ts (view-time) and vocab-turtle.mjs (build-time). Sourced from glossarist-ruby config.yml — keep in sync when concept-model expands the enum.",
3
+ "schemes": [
4
+ {
5
+ "schemeIri": "gloss:status-scheme",
6
+ "label": "Concept status",
7
+ "terms": [
8
+ { "iri": "gloss:status/valid", "label": "valid" },
9
+ { "iri": "gloss:status/superseded", "label": "superseded" },
10
+ { "iri": "gloss:status/withdrawn", "label": "withdrawn" },
11
+ { "iri": "gloss:status/draft", "label": "draft" }
12
+ ]
13
+ },
14
+ {
15
+ "schemeIri": "gloss:entstatus-scheme",
16
+ "label": "Entry status",
17
+ "terms": [
18
+ { "iri": "gloss:entstatus/valid", "label": "valid" },
19
+ { "iri": "gloss:entstatus/superseded", "label": "superseded" },
20
+ { "iri": "gloss:entstatus/withdrawn", "label": "withdrawn" },
21
+ { "iri": "gloss:entstatus/draft", "label": "draft" }
22
+ ]
23
+ },
24
+ {
25
+ "schemeIri": "gloss:norm-scheme",
26
+ "label": "Normative status",
27
+ "terms": [
28
+ { "iri": "gloss:norm/preferred", "label": "preferred" },
29
+ { "iri": "gloss:norm/admitted", "label": "admitted" },
30
+ { "iri": "gloss:norm/deprecated", "label": "deprecated" },
31
+ { "iri": "gloss:norm/superseded", "label": "superseded" }
32
+ ]
33
+ },
34
+ {
35
+ "schemeIri": "gloss:srcstatus-scheme",
36
+ "label": "Source status",
37
+ "terms": [
38
+ { "iri": "gloss:srcstatus/identical", "label": "identical" },
39
+ { "iri": "gloss:srcstatus/similar", "label": "similar" },
40
+ { "iri": "gloss:srcstatus/modified", "label": "modified" },
41
+ { "iri": "gloss:srcstatus/restyle", "label": "restyle" },
42
+ { "iri": "gloss:srcstatus/context_added", "label": "context_added" },
43
+ { "iri": "gloss:srcstatus/generalisation", "label": "generalisation" },
44
+ { "iri": "gloss:srcstatus/specialisation", "label": "specialisation" },
45
+ { "iri": "gloss:srcstatus/unspecified", "label": "unspecified" },
46
+ { "iri": "gloss:srcstatus/related", "label": "related" },
47
+ { "iri": "gloss:srcstatus/not_equal", "label": "not_equal" },
48
+ { "iri": "gloss:srcstatus/restyled", "label": "restyled" },
49
+ { "iri": "gloss:srcstatus/adapted", "label": "adapted" }
50
+ ]
51
+ },
52
+ {
53
+ "schemeIri": "gloss:srctype-scheme",
54
+ "label": "Source type",
55
+ "terms": [
56
+ { "iri": "gloss:srctype/authoritative", "label": "authoritative" },
57
+ { "iri": "gloss:srctype/lineage", "label": "lineage" }
58
+ ]
59
+ },
60
+ {
61
+ "schemeIri": "gloss:datetype-scheme",
62
+ "label": "Date type",
63
+ "terms": [
64
+ { "iri": "gloss:datetype/accepted", "label": "accepted" },
65
+ { "iri": "gloss:datetype/amended", "label": "amended" },
66
+ { "iri": "gloss:datetype/retired", "label": "retired" },
67
+ { "iri": "gloss:datetype/deprecated", "label": "deprecated" },
68
+ { "iri": "gloss:datetype/superseded", "label": "superseded" }
69
+ ]
70
+ },
71
+ {
72
+ "schemeIri": "gloss:rel-scheme",
73
+ "label": "Relationship type",
74
+ "_source": "glossarist-ruby config.yml related_concept.type — 52 types",
75
+ "terms": [
76
+ { "iri": "gloss:rel/deprecates", "label": "deprecates", "group": "lifecycle" },
77
+ { "iri": "gloss:rel/deprecated_by", "label": "deprecated_by", "group": "lifecycle" },
78
+ { "iri": "gloss:rel/supersedes", "label": "supersedes", "group": "lifecycle" },
79
+ { "iri": "gloss:rel/superseded_by", "label": "superseded_by", "group": "lifecycle" },
80
+ { "iri": "gloss:rel/replaces", "label": "replaces", "group": "lifecycle" },
81
+ { "iri": "gloss:rel/replaced_by", "label": "replaced_by", "group": "lifecycle" },
82
+ { "iri": "gloss:rel/invalidates", "label": "invalidates", "group": "lifecycle" },
83
+ { "iri": "gloss:rel/invalidated_by", "label": "invalidated_by", "group": "lifecycle" },
84
+ { "iri": "gloss:rel/retires", "label": "retires", "group": "lifecycle" },
85
+ { "iri": "gloss:rel/retired_by", "label": "retired_by", "group": "lifecycle" },
86
+ { "iri": "gloss:rel/narrower", "label": "narrower", "group": "hierarchical" },
87
+ { "iri": "gloss:rel/broader", "label": "broader", "group": "hierarchical" },
88
+ { "iri": "gloss:rel/broader_generic", "label": "broader_generic", "group": "hierarchical" },
89
+ { "iri": "gloss:rel/narrower_generic", "label": "narrower_generic", "group": "hierarchical" },
90
+ { "iri": "gloss:rel/broader_partitive", "label": "broader_partitive", "group": "hierarchical" },
91
+ { "iri": "gloss:rel/narrower_partitive", "label": "narrower_partitive", "group": "hierarchical" },
92
+ { "iri": "gloss:rel/has_part", "label": "has_part", "group": "hierarchical" },
93
+ { "iri": "gloss:rel/is_part_of", "label": "is_part_of", "group": "hierarchical" },
94
+ { "iri": "gloss:rel/broader_instantial", "label": "broader_instantial", "group": "hierarchical" },
95
+ { "iri": "gloss:rel/narrower_instantial", "label": "narrower_instantial", "group": "hierarchical" },
96
+ { "iri": "gloss:rel/instance_of", "label": "instance_of", "group": "hierarchical" },
97
+ { "iri": "gloss:rel/has_instance", "label": "has_instance", "group": "hierarchical" },
98
+ { "iri": "gloss:rel/equivalent", "label": "equivalent", "group": "equivalence" },
99
+ { "iri": "gloss:rel/exact_match", "label": "exact_match", "group": "equivalence" },
100
+ { "iri": "gloss:rel/close_match", "label": "close_match", "group": "equivalence" },
101
+ { "iri": "gloss:rel/broad_match", "label": "broad_match", "group": "equivalence" },
102
+ { "iri": "gloss:rel/narrow_match", "label": "narrow_match", "group": "equivalence" },
103
+ { "iri": "gloss:rel/related_match", "label": "related_match", "group": "equivalence" },
104
+ { "iri": "gloss:rel/compare", "label": "compare", "group": "comparative" },
105
+ { "iri": "gloss:rel/contrast", "label": "contrast", "group": "comparative" },
106
+ { "iri": "gloss:rel/see", "label": "see", "group": "associative" },
107
+ { "iri": "gloss:rel/references", "label": "references", "group": "associative" },
108
+ { "iri": "gloss:rel/related_concept", "label": "related_concept", "group": "associative" },
109
+ { "iri": "gloss:rel/related_concept_broader", "label": "related_concept_broader", "group": "associative" },
110
+ { "iri": "gloss:rel/related_concept_narrower", "label": "related_concept_narrower", "group": "associative" },
111
+ { "iri": "gloss:rel/sequentially_related", "label": "sequentially_related", "group": "associative" },
112
+ { "iri": "gloss:rel/spatially_related", "label": "spatially_related", "group": "associative" },
113
+ { "iri": "gloss:rel/temporally_related", "label": "temporally_related", "group": "associative" },
114
+ { "iri": "gloss:rel/homograph", "label": "homograph", "group": "lexical" },
115
+ { "iri": "gloss:rel/false_friend", "label": "false_friend", "group": "lexical" },
116
+ { "iri": "gloss:rel/has_concept", "label": "has_concept", "group": "register" },
117
+ { "iri": "gloss:rel/is_concept_of", "label": "is_concept_of", "group": "register" },
118
+ { "iri": "gloss:rel/has_definition", "label": "has_definition", "group": "register" },
119
+ { "iri": "gloss:rel/definition_of", "label": "definition_of", "group": "register" },
120
+ { "iri": "gloss:rel/inherits", "label": "inherits", "group": "versioning" },
121
+ { "iri": "gloss:rel/inherited_by", "label": "inherited_by", "group": "versioning" },
122
+ { "iri": "gloss:rel/has_version", "label": "has_version", "group": "versioning" },
123
+ { "iri": "gloss:rel/version_of", "label": "version_of", "group": "versioning" },
124
+ { "iri": "gloss:rel/current_version", "label": "current_version", "group": "versioning" },
125
+ { "iri": "gloss:rel/current_version_of", "label": "current_version_of", "group": "versioning" },
126
+ { "iri": "gloss:rel/derived", "label": "derived", "group": "legacy" }
127
+ ]
128
+ }
129
+ ]
130
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glossarist/concept-browser",
3
- "version": "0.7.57",
3
+ "version": "0.7.59",
4
4
  "description": "Vue SPA for browsing Glossarist terminology datasets with cross-reference resolution, graph visualization, and multi-language support",
5
5
  "type": "module",
6
6
  "bin": {
@@ -31,7 +31,7 @@
31
31
  "autoprefixer": "^10.4.21",
32
32
  "d3": "^7.9.0",
33
33
  "favicons": "^7.2.0",
34
- "glossarist": "^0.4.2",
34
+ "glossarist": "^0.4.8",
35
35
  "js-yaml": "^4.1.0",
36
36
  "jszip": "^3.10.1",
37
37
  "pinia": "^2.3.1",
@@ -85,6 +85,7 @@
85
85
  "cli",
86
86
  "scripts",
87
87
  "src",
88
+ "data",
88
89
  "public/favicon.svg",
89
90
  "index.html",
90
91
  "vite.config.ts",
@@ -15,29 +15,23 @@
15
15
  // `data/concept-model/shapes/glossarist.shacl.ttl` (synced from
16
16
  // glossarist/concept-model via `npm run sync:model`). Pass --shapes <path>
17
17
  // or set SHAPES_PATH to override.
18
+ //
19
+ // Delegates the actual validation to glossarist-js's validateShacl
20
+ // wrapper, which handles factory aggregation and shapes caching. The
21
+ // directory walk + CLI parsing stay here because they're build-pipeline
22
+ // specific.
18
23
 
19
24
  import { readFileSync, readdirSync, statSync } from 'node:fs';
20
25
  import { join, extname, dirname, resolve } from 'node:path';
21
26
  import { fileURLToPath } from 'node:url';
22
- import { Parser as N3Parser, DataFactory } from 'n3';
27
+ import { Parser as N3Parser } from 'n3';
23
28
  import rdfDataset from '@rdfjs/dataset';
24
- import ShaclValidator from 'rdf-validate-shacl';
29
+ import { validateShacl, quadsToDataset } from 'glossarist/rdf';
25
30
 
26
31
  const __dirname = dirname(fileURLToPath(import.meta.url));
27
32
  const VENDORED_SHAPES = resolve(__dirname, '..', 'data', 'concept-model', 'shapes', 'glossarist.shacl.ttl');
28
33
 
29
- const COMBINED_FACTORY = {
30
- namedNode: DataFactory.namedNode,
31
- blankNode: DataFactory.blankNode,
32
- literal: DataFactory.literal,
33
- defaultGraph: DataFactory.defaultGraph,
34
- quad: DataFactory.quad,
35
- fromTerm: DataFactory.fromTerm,
36
- fromQuad: DataFactory.fromQuad,
37
- dataset: rdfDataset.dataset.bind(rdfDataset),
38
- };
39
- const createDataset = COMBINED_FACTORY.dataset;
40
- const ShaclValidatorCtor = ShaclValidator.default ?? ShaclValidator;
34
+ const createDataset = rdfDataset.dataset.bind(rdfDataset);
41
35
 
42
36
  function parseArgs(argv) {
43
37
  const out = { dataRoot: 'public/data', shapesPath: null };
@@ -119,6 +113,10 @@ async function main() {
119
113
  const args = parseArgs(process.argv);
120
114
  const shapesPath = resolveShapesPath(args.shapesPath);
121
115
 
116
+ // Pre-parse the shapes file once so we can pass it explicitly via the
117
+ // { shapes } option. glossarist-js caches by path internally, but
118
+ // passing the dataset directly avoids a re-read of the file when the
119
+ // same path is reused for every validation call.
122
120
  let shapesDataset;
123
121
  try {
124
122
  const shapesText = readFileSync(shapesPath, 'utf8');
@@ -128,8 +126,6 @@ async function main() {
128
126
  process.exit(2);
129
127
  }
130
128
 
131
- const validator = new ShaclValidatorCtor(shapesDataset, { factory: COMBINED_FACTORY });
132
-
133
129
  let statDir;
134
130
  try {
135
131
  statDir = statSync(args.dataRoot);
@@ -158,7 +154,7 @@ async function main() {
158
154
  violations.push({ path, parseError: e.message });
159
155
  continue;
160
156
  }
161
- const report = validator.validate(graph);
157
+ const report = await validateShacl(graph, { shapes: shapesDataset });
162
158
  if (!report.conforms) {
163
159
  for (const v of report.results) {
164
160
  violations.push({ path, result: v });
@@ -1,9 +1,18 @@
1
1
  // Prefix bindings for concept-browser's RDF emission.
2
2
  //
3
- // The canonical SSOT for prefix bindings is `data/concept-model/prefixes.ttl`
4
- // (vendored from glossarist/concept-model). This list is the runtime subset
5
- // actually emitted by concept-browser. Keep it aligned with prefixes.ttl
6
- // whenever the upstream file changes.
3
+ // Sources PREFIXES (the canonical prefix→IRI map) from glossarist/rdf
4
+ // so the runtime list stays in sync with the upstream concept-model
5
+ // `prefixes.ttl` SSOT automatically. The per-prefix `description`
6
+ // strings remain local because they are presentation metadata, not
7
+ // part of the canonical bindings.
8
+ //
9
+ // glossarist-js's PREFIXES is generated from the JSON-LD context,
10
+ // which omits some well-known prefixes that ARE in `prefixes.ttl`
11
+ // and ARE used in instance data (dcat, foaf, sh). We supplement
12
+ // locally until upstream glossarist-js regenerates from the full
13
+ // prefixes.ttl.
14
+
15
+ import { PREFIXES as GLOSSARIST_PREFIXES } from 'glossarist/rdf/prefixes';
7
16
 
8
17
  export interface PrefixEntry {
9
18
  prefix: string;
@@ -11,22 +20,53 @@ export interface PrefixEntry {
11
20
  description: string;
12
21
  }
13
22
 
14
- export const RDF_PREFIXES: readonly PrefixEntry[] = [
15
- { prefix: 'gloss', iri: 'https://www.glossarist.org/ontologies/', description: 'Glossarist ontology' },
16
- { prefix: 'skos', iri: 'http://www.w3.org/2004/02/skos/core#', description: 'Simple Knowledge Organization System' },
17
- { prefix: 'skosxl', iri: 'http://www.w3.org/2008/05/skos-xl#', description: 'SKOS eXtension for Labels' },
18
- { prefix: 'iso-thes', iri: 'http://purl.org/iso25964/skos-thes#', description: 'ISO 25964 SKOS thesaurus extensions' },
19
- { prefix: 'rdf', iri: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#', description: 'RDF core vocabulary' },
20
- { prefix: 'rdfs', iri: 'http://www.w3.org/2000/01/rdf-schema#', description: 'RDF Schema' },
21
- { prefix: 'owl', iri: 'http://www.w3.org/2002/07/owl#', description: 'Web Ontology Language' },
22
- { prefix: 'dcterms', iri: 'http://purl.org/dc/terms/', description: 'Dublin Core terms' },
23
- { prefix: 'prov', iri: 'http://www.w3.org/ns/prov#', description: 'PROV-O provenance' },
24
- { prefix: 'dcat', iri: 'http://www.w3.org/ns/dcat#', description: 'Data Catalog vocabulary' },
25
- { prefix: 'foaf', iri: 'http://xmlns.com/foaf/0.1/', description: 'Friend-of-a-Friend agents' },
26
- { prefix: 'vann', iri: 'http://purl.org/vocab/vann/', description: 'Vocabulary annotations' },
27
- { prefix: 'xsd', iri: 'http://www.w3.org/2001/XMLSchema#', description: 'XML Schema datatypes' },
28
- { prefix: 'sh', iri: 'http://www.w3.org/ns/shacl#', description: 'SHACL shapes vocabulary' },
29
- ] as const;
23
+ // Prefixes declared in concept-model's canonical prefixes.ttl that
24
+ // glossarist-js's PREFIXES does not yet export (because they are
25
+ // absent from the JSON-LD context, even though they appear in
26
+ // instance data — dcat:Dataset, foaf:Person, sh:NodeShape).
27
+ const SUPPLEMENTAL_PREFIXES: Record<string, string> = {
28
+ dcat: 'http://www.w3.org/ns/dcat#',
29
+ foaf: 'http://xmlns.com/foaf/0.1/',
30
+ sh: 'http://www.w3.org/ns/shacl#',
31
+ };
32
+
33
+ const PREFIX_DESCRIPTIONS: Record<string, string> = {
34
+ gloss: 'Glossarist ontology',
35
+ skos: 'Simple Knowledge Organization System',
36
+ skosxl: 'SKOS eXtension for Labels',
37
+ 'iso-thes': 'ISO 25964 SKOS thesaurus extensions',
38
+ rdf: 'RDF core vocabulary',
39
+ rdfs: 'RDF Schema',
40
+ owl: 'Web Ontology Language',
41
+ dcterms: 'Dublin Core terms',
42
+ prov: 'PROV-O provenance',
43
+ dcat: 'Data Catalog vocabulary',
44
+ foaf: 'Friend-of-a-Friend agents',
45
+ vann: 'Vocabulary annotations',
46
+ xsd: 'XML Schema datatypes',
47
+ sh: 'SHACL shapes vocabulary',
48
+ };
49
+
50
+ function descriptionFor(prefix: string): string {
51
+ return PREFIX_DESCRIPTIONS[prefix] ?? '';
52
+ }
53
+
54
+ // Merge glossarist-js's canonical PREFIXES with the supplemental
55
+ // bindings. Order: glossarist PREFIXES first (canonical order), then
56
+ // any supplemental prefixes not already present.
57
+ const MERGED: Record<string, string> = {
58
+ ...GLOSSARIST_PREFIXES,
59
+ ...SUPPLEMENTAL_PREFIXES,
60
+ };
61
+
62
+ // Derive RDF_PREFIXES at module load.
63
+ export const RDF_PREFIXES: readonly PrefixEntry[] = Object.freeze(
64
+ Object.entries(MERGED).map(([prefix, iri]) => ({
65
+ prefix,
66
+ iri,
67
+ description: descriptionFor(prefix),
68
+ })),
69
+ );
30
70
 
31
71
  export function findPrefix(prefix: string): PrefixEntry | undefined {
32
72
  return RDF_PREFIXES.find(p => p.prefix === prefix);
@@ -1,6 +1,7 @@
1
1
  import { useVocabularyStore } from '../stores/vocabulary';
2
2
  import type { DatasetColorSpec } from '../config/types';
3
3
  import { createColorTheme } from './color-theme';
4
+ import { resolveColor as resolveColorGlossarist } from 'glossarist/models';
4
5
 
5
6
  const PALETTE = [
6
7
  '#3366ff', '#0d9488', '#d97706', '#8b5cf6',
@@ -45,10 +46,17 @@ function normalizeSpec(spec: DatasetColorSpec | undefined, fallback: string): {
45
46
  return { light: fallback, dark };
46
47
  }
47
48
  if (typeof spec === 'string') {
49
+ // Single hex applies to both modes, but dark mode needs the
50
+ // alpha-blended fallback for contrast on dark surfaces.
48
51
  const dark = hexToRgba(spec, 0.85);
49
52
  return { light: spec, dark };
50
53
  }
51
- return { light: spec.light, dark: spec.dark };
54
+ // Pair case: delegate to glossarist-js's resolveColor so the canonical
55
+ // "missing mode returns null" rule stays in one place. concept-browser
56
+ // then fills in any null with the other mode's value.
57
+ const light = resolveColorGlossarist(spec, 'light') ?? spec.dark ?? fallback;
58
+ const dark = resolveColorGlossarist(spec, 'dark') ?? spec.light ?? hexToRgba(light, 0.85);
59
+ return { light, dark };
52
60
  }
53
61
 
54
62
  export function paletteColor(index: number): string {