Skip to content

Commit f3985e9

Browse files
committed
Merge branch '298-more-info' into dev
2 parents b055169 + 9a6c7bd commit f3985e9

File tree

8 files changed

+156
-1
lines changed

8 files changed

+156
-1
lines changed

gatsby-node.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,10 @@ exports.onPreBootstrap = async ({ createContentDigest, actions, getNode }) => {
148148
deprecated,
149149
"dc:title": dc_title,
150150
"dc:description": dc_description,
151+
"dct:issued": issued,
152+
"dct:license": license,
153+
// "vann:preferredNamespaceUri": preferredNamespaceUri,
154+
// "vann:preferredNamespacePrefix": preferredNamespacePrefix,
151155
...properties
152156
} = graph
153157
const type = Array.isArray(properties.type)
@@ -209,6 +213,8 @@ exports.onPreBootstrap = async ({ createContentDigest, actions, getNode }) => {
209213
member___NODE: (member || []).map((member) => member.id),
210214
dc_title,
211215
dc_description,
216+
issued,
217+
license,
212218
}
213219
if (type === "Concept") {
214220
Object.assign(node, {})

src/components/ConceptScheme.jsx

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,38 @@ const ConceptScheme = ({
4141
<Markdown>{i18n(language)(description)}</Markdown>
4242
</div>
4343
)}
44+
{conceptScheme.publisher && (
45+
<div>
46+
<h3>Publisher</h3>
47+
<a href={conceptScheme.publisher.id}>
48+
{conceptScheme.publisher.id}
49+
</a>
50+
</div>
51+
)}
52+
{conceptScheme.issued && (
53+
<div>
54+
<h3>Issued</h3>
55+
<p>{conceptScheme.issued}</p>
56+
</div>
57+
)}
58+
{conceptScheme.license && (
59+
<div>
60+
<h3>License</h3>
61+
<a href={conceptScheme.license.id}>{conceptScheme.license.id}</a>
62+
</div>
63+
)}
64+
{conceptScheme.preferredNamespaceUri && (
65+
<div>
66+
<h3>Preferred Namespace URI</h3>
67+
<p>{conceptScheme.preferredNamespaceUri}</p>
68+
</div>
69+
)}
70+
{conceptScheme.preferredNamespacePrefix && (
71+
<div>
72+
<h3>Preferred Namespace Prefix</h3>
73+
<p>{conceptScheme.preferredNamespacePrefix}</p>
74+
</div>
75+
)}
4476
</div>
4577
</div>
4678
)

src/context.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ const jsonld = {
2727
"@id": "dct:description",
2828
"@container": "@language",
2929
},
30+
license: {
31+
"@id": "dct:license",
32+
"@container": "@language",
33+
},
3034
issued: {
3135
"@id": "dct:issued",
3236
"@type": "xsd:date",

src/queries.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,15 @@ module.exports.allConceptScheme = (languages) => `
160160
dc_description {
161161
${[...languages].join(" ")}
162162
}
163+
publisher {
164+
id
165+
}
166+
issued
167+
license {
168+
id
169+
}
170+
preferredNamespaceUri
171+
preferredNamespacePrefix
163172
hasTopConcept {
164173
...ConceptFields
165174
narrower {

src/types.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ module.exports = (languages) => `
1414
description: LanguageMap,
1515
dc_description: LanguageMap,
1616
hasTopConcept: [Concept] @link(from: "hasTopConcept___NODE"),
17-
languages: [String]
17+
languages: [String],
18+
issued: String,
19+
preferredNamespaceUri: String,
20+
preferredNamespacePrefix: String,
21+
publisher: Concept
1822
}
1923
2024
type Concept implements Node {

test/conceptScheme.test.jsx

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,4 +114,92 @@ describe.concurrent("Concept", () => {
114114
screen.getByRole("heading", { name: /dctitle DE/i })
115115
).toBeInTheDocument()
116116
})
117+
118+
it("renders conceptScheme component with publisher", () => {
119+
useSkoHubContext.mockReturnValue({
120+
data: {
121+
currentScheme: {},
122+
selectedLanguage: "de",
123+
},
124+
updateState: vi.fn(),
125+
})
126+
127+
const route = "/w3id.org/index.html"
128+
const history = createHistory(createMemorySource(route))
129+
const location = { search: "?lang=de" }
130+
renderConceptScheme(history, ConceptSchemePC, location)
131+
expect(
132+
screen.getByRole("heading", { name: /Publisher/i })
133+
).toBeInTheDocument()
134+
})
135+
136+
it("renders conceptScheme component with issued", () => {
137+
useSkoHubContext.mockReturnValue({
138+
data: {
139+
currentScheme: {},
140+
selectedLanguage: "de",
141+
},
142+
updateState: vi.fn(),
143+
})
144+
145+
const route = "/w3id.org/index.html"
146+
const history = createHistory(createMemorySource(route))
147+
const location = { search: "?lang=de" }
148+
renderConceptScheme(history, ConceptSchemePC, location)
149+
expect(screen.getByRole("heading", { name: /Issued/i })).toBeInTheDocument()
150+
})
151+
152+
it("renders conceptScheme component with license", () => {
153+
useSkoHubContext.mockReturnValue({
154+
data: {
155+
currentScheme: {},
156+
selectedLanguage: "de",
157+
},
158+
updateState: vi.fn(),
159+
})
160+
161+
const route = "/w3id.org/index.html"
162+
const history = createHistory(createMemorySource(route))
163+
const location = { search: "?lang=de" }
164+
renderConceptScheme(history, ConceptSchemePC, location)
165+
expect(
166+
screen.getByRole("heading", { name: /License/i })
167+
).toBeInTheDocument()
168+
})
169+
170+
it("renders conceptScheme component with preferredNamespaceUri", () => {
171+
useSkoHubContext.mockReturnValue({
172+
data: {
173+
currentScheme: {},
174+
selectedLanguage: "de",
175+
},
176+
updateState: vi.fn(),
177+
})
178+
179+
const route = "/w3id.org/index.html"
180+
const history = createHistory(createMemorySource(route))
181+
const location = { search: "?lang=de" }
182+
renderConceptScheme(history, ConceptSchemePC, location)
183+
expect(
184+
screen.getByRole("heading", { name: /Preferred Namespace URI/i })
185+
).toBeInTheDocument()
186+
})
187+
188+
it("renders conceptScheme component with preferredNamespace Prefix", () => {
189+
useSkoHubContext.mockReturnValue({
190+
data: {
191+
currentScheme: {},
192+
selectedLanguage: "de",
193+
},
194+
updateState: vi.fn(),
195+
})
196+
197+
const route = "/w3id.org/index.html"
198+
const history = createHistory(createMemorySource(route))
199+
const location = { search: "?lang=de" }
200+
renderConceptScheme(history, ConceptSchemePC, location)
201+
expect(
202+
screen.getByRole("heading", { name: /Preferred Namespace Prefix/i })
203+
).toBeInTheDocument()
204+
})
117205
})

test/data/pageContext.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,15 @@ export const ConceptScheme = {
156156
de: "Test Vokabular",
157157
en: "Test Vocabulary",
158158
},
159+
license: {
160+
id: "http://creativecommons.org/publicdomain/zero/1.0/",
161+
},
162+
publisher: {
163+
id: "https://oerworldmap.org/resource/urn:uuid:fd06253e-fe67-4910-b923-51db9d27e59f",
164+
},
165+
issued: "2019-12-11",
166+
preferredNamespaceUri: "https://w3id.org/kim/hcrt/",
167+
preferredNamespacePrefix: "hcrt",
159168
hasTopConcept: [topConcept],
160169
}
161170

test/data/ttl/slashURIConceptScheme.ttl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
dct:title "Test Vokabular"@de, "Test Vocabulary"@en ;
99
dct:description "Test Beschreibung"@de, "Test Description"@en ;
1010
dct:issued "2019-12-11" ;
11+
dct:license <http://creativecommons.org/publicdomain/zero/1.0/> ;
12+
vann:preferredNamespaceUri "https://w3id.org/" ;
13+
vann:preferredNamespacePrefix "test" ;
1114
dct:publisher <https://oerworldmap.org/resource/urn:uuid:fd06253e-fe67-4910-b923-51db9d27e59f> ;
1215
skos:hasTopConcept <c1> .
1316

0 commit comments

Comments
 (0)