@glossarist/concept-browser 0.7.58 → 0.7.60
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.
- package/data/colors.json +36 -0
- package/data/concept-model/README.md +34 -0
- package/data/concept-model/SOURCE.json +6 -0
- package/data/concept-model/glossarist.context.jsonld +261 -0
- package/data/concept-model/glossarist.ttl +1327 -0
- package/data/concept-model/prefixes.ttl +27 -0
- package/data/concept-model/shapes/glossarist.shacl.ttl +815 -0
- package/data/glossarist-vocab.json +130 -0
- package/package.json +3 -2
- package/scripts/generate-data.mjs +1 -1
- package/scripts/lib/vocab-turtle.mjs +26 -45
- package/src/__tests__/scripts/build-integration.test.ts +2 -2
- package/src/__tests__/scripts/vocab-turtle.test.ts +8 -8
- package/src/components/concept-rdf/rdf-prefixes.ts +60 -20
- package/src/utils/dataset-style.ts +9 -1
|
@@ -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.
|
|
3
|
+
"version": "0.7.60",
|
|
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.
|
|
34
|
+
"glossarist": "^0.4.9",
|
|
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",
|
|
@@ -1612,7 +1612,7 @@ for (const [id, count] of Object.entries(counts)) {
|
|
|
1612
1612
|
|
|
1613
1613
|
writeBuildActivity(total, registry.map(r => r.id));
|
|
1614
1614
|
|
|
1615
|
-
fs.writeFileSync(path.join(DATA, '_vocab.ttl'), buildVocabularyTurtle());
|
|
1615
|
+
fs.writeFileSync(path.join(DATA, '_vocab.ttl'), await buildVocabularyTurtle());
|
|
1616
1616
|
console.log('Emitted vocabulary graph: data/_vocab.ttl');
|
|
1617
1617
|
|
|
1618
1618
|
const contributors = config.contributors ?? [];
|
|
@@ -1,6 +1,21 @@
|
|
|
1
|
+
// Vocab turtle builder — emits SKOS ConceptSchemes for the
|
|
2
|
+
// glossarist enumeration IRIs.
|
|
3
|
+
//
|
|
4
|
+
// Delegates to glossarist-js's vocabulary emitter + writeTurtle so the
|
|
5
|
+
// canonical prefix list, CURIE handling, and serialization stay in one
|
|
6
|
+
// place. The output is byte-equivalent in semantics ( CURIEs resolved
|
|
7
|
+
// to absolute IRIs, then re-rendered via glossarist-js's n3 writer with
|
|
8
|
+
// the canonical prefix map ).
|
|
9
|
+
|
|
1
10
|
import { readFileSync } from 'node:fs';
|
|
2
11
|
import { join, dirname } from 'node:path';
|
|
3
12
|
import { fileURLToPath } from 'node:url';
|
|
13
|
+
import {
|
|
14
|
+
vocabularyToQuads,
|
|
15
|
+
collectQuads,
|
|
16
|
+
writeTurtle,
|
|
17
|
+
PREFIXES,
|
|
18
|
+
} from 'glossarist/rdf';
|
|
4
19
|
|
|
5
20
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
6
21
|
const VOCAB_PATH = join(__dirname, '..', '..', 'data', 'glossarist-vocab.json');
|
|
@@ -9,54 +24,20 @@ function loadVocab(path = VOCAB_PATH) {
|
|
|
9
24
|
return JSON.parse(readFileSync(path, 'utf8'));
|
|
10
25
|
}
|
|
11
26
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const colonIdx = qname.indexOf(':');
|
|
21
|
-
if (colonIdx < 0) return qname;
|
|
22
|
-
const local = qname.slice(colonIdx + 1);
|
|
23
|
-
const escaped = local.replace(/([/])/g, '\\$1');
|
|
24
|
-
return `${qname.slice(0, colonIdx + 1)}${escaped}`;
|
|
27
|
+
// n3's writer prefixes must omit the trailing # or / — those go in
|
|
28
|
+
// the local name. Build the prefix-only map for writeTurtle.
|
|
29
|
+
function writerPrefixes() {
|
|
30
|
+
const out = {};
|
|
31
|
+
for (const [k, v] of Object.entries(PREFIXES)) {
|
|
32
|
+
out[k] = v;
|
|
33
|
+
}
|
|
34
|
+
return out;
|
|
25
35
|
}
|
|
26
36
|
|
|
27
|
-
export function buildVocabularyTurtle() {
|
|
37
|
+
export async function buildVocabularyTurtle() {
|
|
28
38
|
const vocab = loadVocab();
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
'@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .',
|
|
32
|
-
'@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .',
|
|
33
|
-
'@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .',
|
|
34
|
-
'@prefix dcterms: <http://purl.org/dc/terms/> .',
|
|
35
|
-
'@prefix gloss: <https://www.glossarist.org/ontologies/> .',
|
|
36
|
-
'',
|
|
37
|
-
];
|
|
38
|
-
|
|
39
|
-
for (const scheme of vocab.schemes) {
|
|
40
|
-
const schemeLines = [
|
|
41
|
-
`${ttlPrefixed(scheme.schemeIri)} a skos:ConceptScheme ;`,
|
|
42
|
-
` rdfs:label ${ttlLit(scheme.label)} ;`,
|
|
43
|
-
];
|
|
44
|
-
for (const term of scheme.terms) {
|
|
45
|
-
schemeLines.push(` skos:hasTopConcept ${ttlPrefixed(term.iri)} ;`);
|
|
46
|
-
}
|
|
47
|
-
schemeLines[schemeLines.length - 1] = schemeLines[schemeLines.length - 1].replace(/ ;$/, ' .');
|
|
48
|
-
lines.push(...schemeLines);
|
|
49
|
-
|
|
50
|
-
for (const term of scheme.terms) {
|
|
51
|
-
lines.push(`${ttlPrefixed(term.iri)} a skos:Concept ;`);
|
|
52
|
-
lines.push(` rdfs:label ${ttlLit(term.label)} ;`);
|
|
53
|
-
lines.push(` skos:inScheme ${ttlPrefixed(scheme.schemeIri)} .`);
|
|
54
|
-
lines.push('');
|
|
55
|
-
}
|
|
56
|
-
lines.push('');
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return lines.join('\n') + '\n';
|
|
39
|
+
const quads = collectQuads(vocabularyToQuads(vocab.schemes));
|
|
40
|
+
return writeTurtle(quads, { prefixes: writerPrefixes() });
|
|
60
41
|
}
|
|
61
42
|
|
|
62
43
|
export function listVocabSchemes() {
|
|
@@ -15,7 +15,7 @@ function runInline(code: string): string {
|
|
|
15
15
|
|
|
16
16
|
describe('WS F Layer 8 — build pipeline integration', () => {
|
|
17
17
|
it('vocab-turtle.mjs produces parseable Turtle with 7 schemes', () => {
|
|
18
|
-
const out = runInline(`import { buildVocabularyTurtle } from './scripts/lib/vocab-turtle.mjs'; console.log(buildVocabularyTurtle());`);
|
|
18
|
+
const out = runInline(`import { buildVocabularyTurtle } from './scripts/lib/vocab-turtle.mjs'; console.log(await buildVocabularyTurtle());`);
|
|
19
19
|
const store = parseTurtle(out);
|
|
20
20
|
const schemes = [...store].filter(q =>
|
|
21
21
|
q.predicate.value === 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type' &&
|
|
@@ -119,7 +119,7 @@ describe('WS F Layer 8 — build pipeline integration', () => {
|
|
|
119
119
|
import { buildBibliographyTurtle } from './scripts/lib/bibliography-turtle.mjs';
|
|
120
120
|
import { buildVersionHistoryTurtle } from './scripts/lib/version-turtle.mjs';
|
|
121
121
|
const parts = [
|
|
122
|
-
buildVocabularyTurtle(),
|
|
122
|
+
await buildVocabularyTurtle(),
|
|
123
123
|
buildDatasetTurtle({ datasetIri: 'https://glossarist.org/test/', registerId: 'test', title: 't', modified: '2026-01-01', languages: ['eng'], distributions: [], topConceptUris: [], sections: [] }),
|
|
124
124
|
buildActivityTurtle({ runId: 'r', startedAt: '2026-01-01T00:00:00Z', endedAt: '2026-01-01T00:05:00Z', toolId: 'cb', toolVersion: '0', datasetRegisters: [], conceptCount: 0 }),
|
|
125
125
|
buildAgentsTurtle([{ name: 'Ada' }]),
|
|
@@ -13,22 +13,22 @@ const SKOS = 'http://www.w3.org/2004/02/skos/core#';
|
|
|
13
13
|
const RDF_TYPE = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type';
|
|
14
14
|
|
|
15
15
|
describe('buildVocabularyTurtle (mjs)', () => {
|
|
16
|
-
it('parses without errors and produces a non-empty graph', () => {
|
|
17
|
-
const ttl = buildVocabularyTurtle();
|
|
16
|
+
it('parses without errors and produces a non-empty graph', async () => {
|
|
17
|
+
const ttl = await buildVocabularyTurtle();
|
|
18
18
|
const store = parse(ttl);
|
|
19
19
|
expect(store.size).toBeGreaterThan(0);
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
-
it('declares at least one skos:ConceptScheme', () => {
|
|
23
|
-
const store = parse(buildVocabularyTurtle());
|
|
22
|
+
it('declares at least one skos:ConceptScheme', async () => {
|
|
23
|
+
const store = parse(await buildVocabularyTurtle());
|
|
24
24
|
const schemes = [...store].filter(q =>
|
|
25
25
|
q.predicate.value === RDF_TYPE && q.object.value === `${SKOS}ConceptScheme`,
|
|
26
26
|
);
|
|
27
27
|
expect(schemes.length).toBeGreaterThan(0);
|
|
28
28
|
});
|
|
29
29
|
|
|
30
|
-
it('declares enumeration IRIs as skos:Concept instances', () => {
|
|
31
|
-
const store = parse(buildVocabularyTurtle());
|
|
30
|
+
it('declares enumeration IRIs as skos:Concept instances', async () => {
|
|
31
|
+
const store = parse(await buildVocabularyTurtle());
|
|
32
32
|
const concepts = [...store].filter(q =>
|
|
33
33
|
q.predicate.value === RDF_TYPE && q.object.value === `${SKOS}Concept`,
|
|
34
34
|
);
|
|
@@ -53,8 +53,8 @@ describe('buildVocabularyTurtle (mjs)', () => {
|
|
|
53
53
|
expect(schemes.length).toBe(7);
|
|
54
54
|
});
|
|
55
55
|
|
|
56
|
-
it('emits skos:hasTopConcept and skos:inScheme bidirectionally', () => {
|
|
57
|
-
const store = parse(buildVocabularyTurtle());
|
|
56
|
+
it('emits skos:hasTopConcept and skos:inScheme bidirectionally', async () => {
|
|
57
|
+
const store = parse(await buildVocabularyTurtle());
|
|
58
58
|
const hasTopConcept = [...store].filter(q => q.predicate.value === `${SKOS}hasTopConcept`);
|
|
59
59
|
const inScheme = [...store].filter(q => q.predicate.value === `${SKOS}inScheme`);
|
|
60
60
|
expect(hasTopConcept.length).toBeGreaterThan(0);
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
// Prefix bindings for concept-browser's RDF emission.
|
|
2
2
|
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
|
|
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 {
|