HuyAms / sanity-plugin-taxonomy-manager

Create and manage SKOS compliant taxonomies, thesauri, and classification schemes in Sanity Studio.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sanity Taxonomy Manager Plugin

NPM Version License

This is a Sanity Studio v3 plugin. For the v2 version, please refer to the v2-branch.

Taxonomies are crucial tools for organization and interoperability between and across data sets. Taxonomy Manager provides a way for content authors to create, use, and maintain standards compliant taxonomies in Sanity Studio.

The Taxonomy Manager document schema is based on the World Wide Web Consortium (W3C) Simple Knowledge Organization Scheme (SKOS) recommendation. Concept and concept scheme editor tools include standard SKOS properties, hints for creating consistent concepts and vocabularies, and validation functions for preventing consistency errors.

Features

Installation

Install using the Sanity CLI.

$ npm i sanity-plugin-taxonomy-manager

Configuration

Add the plugin to your project configuration to make the skosConcept and skosConceptScheme document types available in your studio.

// sanity.config.js

import {defineConfig} from 'sanity'
import {deskTool} from 'sanity/desk'
import {structure} from "./deskStructure"
import {taxonomyManager} from 'sanity-plugin-taxonomy-manager'
import {schemaTypes} from './schemas'

export default defineConfig({
  name: 'default',
  title: 'Sanity Studio',
  projectId: 'project-id',
  dataset: 'production',
  plugins: [
    deskTool({
      structure
    }), 
    // Include the taxonomy manager plugin
    taxonomyManager()
  ],
  schema: {
    types: schemaTypes,
  },
});

Use Structure Builder to create a separate area for your taxonomy tools and add the provided Concept Scheme Tree View component.

// ./deskStructure.js
import {TreeView} from 'sanity-plugin-taxonomy-manager' 

export const structure = (S) =>
  S.list()
    .title('Content')
    .items([
      S.listItem()
        .title('Concept Schemes')
        .schemaType('skosConceptScheme')
        .child(
          S.documentTypeList('skosConceptScheme')
            .title('Concept Schemes')
            .child(id =>
              S.document()
                .schemaType('skosConceptScheme')
                .documentId(id)
                .views([
                  S.view.component(TreeView).title('Tree View'),
                  S.view.form()
                ]) 
            )
      ),
      S.documentTypeListItem("skosConcept").title("Concepts"),
      S.divider(),

      // Remove Taxonomy Manager types from the default document type list
      ...S.documentTypeListItems().filter(
        (listItem) => !['skosConcept', 'skosConceptScheme'].includes(listItem.getId())
      ),
    ])

Usage

  1. Create a Concept Scheme to group related concepts
  2. Create and describe Top Concepts. Top concepts represent the broadest concepts of a particular hierarchy and provide efficient access points to broader/narrower concept hierarchies
  3. Create and describe Concepts.
    • All fields except PrefLabel are optional, and are to be used as best fits the needs of your information modeling task.
    • All Concept fields map to elements of the machine readable data model described in the W3C SKOS Recommendation.
  4. Tag resources with concepts and then integrate into search indexing, filtering, navigation, and semantic web services.

Semantic Relationships

The concept editor includes filtering and validation to help you create consistent SKOS vocabularies:

SKOS Broader and Related Concepts
Adding the same concept to Broader and Related fields is not allowed, and the editor validates disjunction of Related concepts with Broader Transitive up to five hierarchical levels in either direction.

Preferred, Alternative, and Hidden Labels
Preferred Labels are validated for uniqueness across concepts, and Preferred, Alternative, and Hidden are validated to prevent duplicates and overlap.

Scope Notes, Definition, and Examples
Standard optional SKOS documentation fields are included by default.

Support for Single or Multiple Taxonomy Schemes (or none)
For cases where more than one taxonomy is needed, multiple SKOS Concept Schemes are supported. Schemes can be used to configure filtered views of concepts in Sanity Structure Builder and can be used to scope values for reference arrays.

SKOS Overview

The Simple Knowledge Organization System (SKOS) is a common data model for sharing and linking knowledge organization systems via the Web.

Many knowledge organization systems, such as thesauri, taxonomies, classification schemes and subject heading systems, share a similar structure, and are used in similar applications. SKOS captures much of this similarity and makes it explicit, to enable data and technology sharing across diverse applications.

The SKOS data model provides a standard, low-cost migration path for porting existing knowledge organization systems to the Semantic Web. SKOS also provides a lightweight, intuitive language for developing and sharing new knowledge organization systems. It may be used on its own, or in combination with formal knowledge representation languages such as the Web Ontology language (OWL).

License

MIT © Andy Fitzgerald See LICENSE

About

Create and manage SKOS compliant taxonomies, thesauri, and classification schemes in Sanity Studio.

License:MIT License


Languages

Language:TypeScript 96.6%Language:CSS 2.1%Language:JavaScript 1.3%