Skip to content

Commit

Permalink
feat: Add term definition (#1167)
Browse files Browse the repository at this point in the history
* Start by copying the value of scopeNote.
* Document in the GraphQL API that the value of scopeNote may change
  later.
  • Loading branch information
ddeboer authored Nov 23, 2023
1 parent 1fdf10b commit 517a5c7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
6 changes: 3 additions & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ export default {
],
coverageThreshold: {
global: {
lines: 90.94,
statements: 90.94,
branches: 95.86,
lines: 90.95,
statements: 90.95,
branches: 95.87,
functions: 91.52,
},
},
Expand Down
1 change: 1 addition & 0 deletions packages/network-of-terms-graphql/src/resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ function term(term: Term) {
hiddenLabel: term.hiddenLabels.map(
(hiddenLabel: RDF.Term) => hiddenLabel.value
),
description: term.scopeNotes.map((scopeNote: RDF.Term) => scopeNote.value),
scopeNote: term.scopeNotes.map((scopeNote: RDF.Term) => scopeNote.value),
seeAlso: term.seeAlso.map((seeAlso: RDF.NamedNode) => seeAlso.value),
broader: term.broaderTerms.map(related => ({
Expand Down
2 changes: 2 additions & 0 deletions packages/network-of-terms-graphql/src/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ export const schema = `
prefLabel: [String]!
altLabel: [String]!
hiddenLabel: [String]!
description: [String]!
"For the full description of the term, use \`description\` instead of scopeNote. The contents of \`scopeNote\` may change later."
scopeNote: [String]!
seeAlso: [String]!
broader: [RelatedTerm]
Expand Down
4 changes: 4 additions & 0 deletions packages/network-of-terms-graphql/test/server.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ describe('Server', () => {
term.uri === 'https://example.com/resources/artwork'
);
expect(artwork.seeAlso).toEqual(['https://example.com/html/artwork']);
expect(artwork.description).toEqual([
'One of the most famous Dutch paintings',
]);

const prefLabels = body.data.terms[0].result.terms.map(
({prefLabel}: {prefLabel: string[]}) => prefLabel[0] ?? ''
Expand Down Expand Up @@ -229,6 +232,7 @@ function termsQuery(sources: string[], query = 'nachtwacht') {
prefLabel
altLabel
hiddenLabel
description
scopeNote
seeAlso
broader {
Expand Down

0 comments on commit 517a5c7

Please sign in to comment.