sanity-plugin-taxonomy-manager 2.2.0 → 2.2.2
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/README.md +50 -2
- package/lib/index.d.ts +35 -1
- package/lib/index.esm.js +2 -2
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Children.tsx +8 -4
- package/src/components/ConceptDetailDialogue.tsx +91 -0
- package/src/components/Orphans.tsx +2 -0
- package/src/components/TopConcepts.tsx +2 -0
- package/src/components/inputs/Identifier.tsx +34 -0
- package/src/components/inputs/index.ts +1 -0
- package/src/helpers/branchFilter.ts +31 -0
- package/src/helpers/index.ts +2 -0
- package/src/helpers/schemeFilter.ts +25 -0
- package/src/index.ts +12 -6
- package/src/modules/baseIriField.tsx +3 -3
- package/src/queries.ts +9 -0
- package/src/skosConcept.tsx +314 -303
- package/src/skosConceptScheme.tsx +94 -87
- package/src/styles.ts +22 -0
package/README.md
CHANGED
|
@@ -52,13 +52,23 @@ export default defineConfig({
|
|
|
52
52
|
structure,
|
|
53
53
|
}),
|
|
54
54
|
// Include the taxonomy manager plugin
|
|
55
|
-
taxonomyManager(
|
|
55
|
+
taxonomyManager({
|
|
56
|
+
// Optional: Set a Base URI to use when
|
|
57
|
+
// creating new concepts & schemes
|
|
58
|
+
baseUri: 'https://example.com/'
|
|
59
|
+
}),
|
|
56
60
|
],
|
|
57
61
|
schema: {
|
|
58
62
|
types: schemaTypes,
|
|
59
63
|
},
|
|
60
64
|
})
|
|
61
65
|
```
|
|
66
|
+
The `baseURI` option allows you to set a default URI (Uniform Resource Identifier) for new concepts and concept schemes. Unique identifiers allow for the clear an unambiguous identification of concepts across namespaces, for example between `https://shipparts.com/vocab#Bow` and `https://wrappingsupplies.com/vocab#Bow`. The base URI of these concepts is `https://shipparts.com/` and `https://wrappingsupplies.com/`, respectively.
|
|
67
|
+
|
|
68
|
+
- In most cases, it makes sense for your base URI to be the root or a subdirectory of your website.
|
|
69
|
+
- In all cases, the URI you choose should be in a domain that you control.
|
|
70
|
+
- The `baseUri` default is optional. If you omit it, the Base URI for new concepts and concept schemes is pre-populated based on the most recently used Base URI value.
|
|
71
|
+
|
|
62
72
|
|
|
63
73
|
Use [Structure Builder](https://www.sanity.io/docs/structure-builder-reference) to create a separate area for your taxonomy tools and add the provided Concept Scheme Tree View component.
|
|
64
74
|
|
|
@@ -99,9 +109,47 @@ export const structure = (S) =>
|
|
|
99
109
|
1. Create and describe Concepts.
|
|
100
110
|
- All fields _except_ Preferred Label and Base IRI are optional, and are to be used as best fits the needs of your information modeling task.
|
|
101
111
|
- Preferred Label is the preferred lexical label for a resource in a given language. In the current version of Taxonomy Manager, the Preferred Label is automatically used as the final segment for a concept's unique identifier (its URI).
|
|
102
|
-
- Base IRI is the root IRI (Internationalized Resource Identifier) used to create unique concept identifiers. Unique identifiers allow for the clear an unambiguous identification of concepts across namespaces, for example between https://shipparts.com/vocab#Bow and https://wrappingsupplies.com/vocab#Bow
|
|
112
|
+
- Base IRI is the root IRI (Internationalized Resource Identifier) used to create unique concept identifiers. Unique identifiers allow for the clear an unambiguous identification of concepts across namespaces, for example between `https://shipparts.com/vocab#Bow` and `https://wrappingsupplies.com/vocab#Bow`. The base URI of these concepts is `https://shipparts.com/` and `https://wrappingsupplies.com/`, respectively. For a wider introduction to concept identifiers, see [Cool URIs for the Semantic Web](https://www.w3.org/TR/cooluris/).
|
|
103
113
|
- Concepts may optionally be added to a Concept Scheme as Top Concepts, to represent the broadest concepts of a particular hierarchy and provide efficient access points to broader/narrower concept hierarchies
|
|
104
114
|
- All Concept fields map to elements of the machine readable data model described in the [W3C SKOS Recommendation](https://www.w3.org/TR/skos-reference/).
|
|
115
|
+
1. Use Reference Filter helpers to easily include whole taxonomies or individual taxonomy branches in your document schemas:
|
|
116
|
+
- To allow a `reference` field to access any term in a SKOS Concept Scheme, use the `schemeFilter` helper. The `schemeFilter` helper takes one parameter: the RDF URI ID from the Concept Scheme you want to use, located just below the `Base URI` field. Copy the identifier that follows your Base URI:
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
import {schemeFilter} from 'sanity-plugin-taxonomy-manager'
|
|
120
|
+
|
|
121
|
+
...
|
|
122
|
+
|
|
123
|
+
defineField({
|
|
124
|
+
name: 'gradeLevel',
|
|
125
|
+
title: 'Grade Level',
|
|
126
|
+
type: 'reference',
|
|
127
|
+
to: {type: 'skosConcept'},
|
|
128
|
+
options: {
|
|
129
|
+
filter: () => schemeFilter({schemeId: 'f3deba'}),
|
|
130
|
+
disableNew: true,
|
|
131
|
+
},
|
|
132
|
+
}),
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
- To limit a `reference` field to a particular branch in a SKOS Concept Scheme, use the `branchFilter` helper. The `branchFilter` helper takes two parameter: the RDF URI ID from the Concept Scheme you want to use and the Concept ID in that Scheme to whose children your field is limited:
|
|
136
|
+
|
|
137
|
+
```
|
|
138
|
+
import {branchFilter} from 'sanity-plugin-taxonomy-manager'
|
|
139
|
+
|
|
140
|
+
...
|
|
141
|
+
|
|
142
|
+
defineField({
|
|
143
|
+
name: 'subject',
|
|
144
|
+
title: 'Subject',
|
|
145
|
+
type: 'reference',
|
|
146
|
+
to: {type: 'skosConcept'},
|
|
147
|
+
options: {
|
|
148
|
+
filter: () => branchFilter({schemeId: 'f3deba', branchId: '25f826'}),
|
|
149
|
+
disableNew: true,
|
|
150
|
+
},
|
|
151
|
+
}),
|
|
152
|
+
```
|
|
105
153
|
1. Tag resources with concepts and then integrate into search indexing, filtering, navigation, and semantic web services.
|
|
106
154
|
|
|
107
155
|
### Semantic Relationships
|
package/lib/index.d.ts
CHANGED
|
@@ -2,7 +2,41 @@
|
|
|
2
2
|
|
|
3
3
|
import {Plugin as Plugin_2} from 'sanity'
|
|
4
4
|
|
|
5
|
-
export declare
|
|
5
|
+
export declare function branchFilter(options: Options_2): branchFilterResult
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Pluggable Function for Filtering to a Top Concept Branch within a SKOS Concept Scheme
|
|
9
|
+
*/
|
|
10
|
+
declare type branchFilterResult = {
|
|
11
|
+
filter: string
|
|
12
|
+
params: {
|
|
13
|
+
schemeId: string
|
|
14
|
+
branchId: string
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
declare type Options = {
|
|
19
|
+
schemeId: string
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
declare type Options_2 = {
|
|
23
|
+
schemeId: string
|
|
24
|
+
branchId: string
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export declare function schemeFilter(options: Options): SchemeFilterResult
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Pluggable Function for Filtering to a Single SKOS Concept Scheme
|
|
31
|
+
*/
|
|
32
|
+
declare type SchemeFilterResult = {
|
|
33
|
+
filter: string
|
|
34
|
+
params: {
|
|
35
|
+
schemeId: string
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export declare const taxonomyManager: Plugin_2<any>
|
|
6
40
|
|
|
7
41
|
export declare const TreeView: ({document}: {document: any}) => JSX.Element
|
|
8
42
|
|