1 of 44

All About Taxonomies

and how they work in Islandora

Rosie Le Faive

Islandora Open Meeting June 25, 2024

Drupal

2 of 44

Today's Plan

  • What is "taxonomy"?
  • What's special about taxonomy terms
  • How to use taxonomy terms
  • Interacting with taxonomy terms
  • Managing Vocabularies
  • Vocabularies and terms in Islandora
  • Bonus: Entity reference views as a reference method

🎓: "graduation cap" means content is "academic" i.e. of a more technical nature.

3 of 44

What's Taxonomy in Drupal?

4 of 44

Taxonomy Basics

  • Taxonomy term could mean either an individual term in a vocabulary, or the category of all taxonomy terms (as the category, it is called an entity type.)
    • e.g. "Montgomery, L.M. (Lucy Maud), 1874-1942" is a taxonomy term.
    • e.g. The Genre field is a taxonomy term reference field.

  • Vocabulary is the ordered list of taxonomy terms that belong together. It defines what fields a taxonomy term can have. (If taxonomy term is an entity type, then a vocabulary is an entity sub-type or bundle.)
    • e.g. "Montgomery, L.M. (Lucy Maud), 1874-1942" is in the Person vocabulary.

5 of 44

Where to find "taxonomy" stuff

  • Taxonomy is part of Drupal Core and is enabled by the Standard profile.
  • Manage Vocabularies and Taxonomy terms under Structure > Taxonomy.

Vocabularies

6 of 44

Taxonomy terms

Vocabulary

7 of 44

Additional fields on taxonomy terms

  • All taxonomy terms have a "Name" - it's mandatory
    • 🎓 It's not really a field. (cf. Title for nodes)
  • Taxonomy terms can have fields - they're configured on the vocabulary.
    • e.g. Person has Alternate Name, Authority Sources, Birth Date, Death Date, Relationships

8 of 44

What's special about vocabularies and taxonomy terms?

9 of 44

Hierarchy in Vocabularies

  • Vocabularies have an ordering - you can drag and drop terms to re-order.
    • However this ordering rarely shows up to users, since they can't access the taxonomy overview page.
  • Vocabularies have hierarchy
    • E.g. Resource Type has Audio > Audio musical, Audio > Audio non-musical
  • Tips about using hierarchy:
    • In real life, a term might need to have two parents. Taxonomy only allows one ("monohierarchy").
    • 🎓 If using hierarchy, ensure your Views make use of "has taxonomy term (with depth)" to pick up child terms.
    • Hierarchy provides breadcrumbs right out of the box.

10 of 44

Taxonomy term breadcrumbs

display hierarchy.

[This is an example of a taxonomy term landing page]

11 of 44

Taxonomy Term "Landing page"

  • At [SITE-URL]/taxonomy/term/[TID] (e.g. http://137.149.200.93/taxonomy/term/193)
    • where [SITE-URL] is the root URL of your site
    • and [TID] is the taxonomy term's ID (tid).
    • this page is created and populated by a View.
  • Shows the term name, and whatever fields you have configured to display.
  • Shows Content (i.e. nodes) that have this term
    • This is controlled by the view, "Taxonomy term" (comes with standard Drupal but is editable)
      • the View is identifiable because it's "Displays" column contains "Page (/taxonomy/term/%)"
    • Does not, by default, show content tagged with child terms of the current term.
      • Use "has taxonomy term (with depth)" to make this happen.
    • With this view, you cannot see Media tagged with each term - i.e. "Original File" shows nothing, even if many media are tagged with it.
      • A View can only show one type of thing, Content (nodes) or Media. This view uses Content.

12 of 44

13 of 44

How to use Taxonomy Terms

14 of 44

How to use taxonomy terms - add a taxonomy term field.

Choose a content type (or media type, etc.)

Create a Reference field.

Below, choose the "taxonomy term" option.

15 of 44

Or, add a "Typed Relation" field.

  • It lets you link to a taxonomy term (see below) and also configure a "type" for the relationship.
    • Advanced: The "type" from a typed relation field becomes the predicate in JSON-LD.
  • Typed Relation is an extension of the Reference field type.
    • You can make a Typed Relation field point to content, media, users even, but we usually point it to taxonomy terms (e.g. Contributors field)

16 of 44

Configuring a Taxonomy Term field - Field Settings

  • Allowed number of values
    • limited (N) or unlimited
  • Help text (recommended)
  • Reference Type
    • Default is usual; entity reference view is optional but powerful
  • Vocabulary: Select which vocabulary this should be from
    • if using an entity reference view, use a filter in the view.

17 of 44

Interacting with taxonomy terms

18 of 44

Taxonomy term field - Manage Form Display options

Checkboxes (radio buttons)

Autocomplete

Autocomplete (tags style)

Select list

19 of 44

Taxonomy term field - the number in parentheses

Autocomplete

Autocomplete (tags style)

When using autocomplete, ensure that you select the desired term from the dropdown.

Doing so will populate the term ID (tid) in brackets after the term name.

This ensures you're linking to the existing term.

20 of 44

Typed Relation field - Manage Form Display options

Typed Relation Widget

21 of 44

Taxonomy term field - Display options

Display options include:

  • Label (most common. Option to link to referenced term)
  • Entity ID (not usually used for display)
  • Rendered entity (if you want to display more of the terms' fields)
  • RSS Category (not usually used)
  • Children entity count, Label (not usually used)

22 of 44

Typed Relation field - Display options

Display options include:

  • Typed Relation Formatter
  • Typed Relation Dedup Formatter

23 of 44

Managing Vocabularies

24 of 44

Taxonomy Manager (Contrib module)

  • Taxonomy Manager is another interface for managing vocabularies.
    • prioritizes Name, but can be used to quickly open the term edit interface.
    • Access at Structure > Taxonomy Manager

25 of 44

Term Merge (Contrib module)

  • Access at Structure > Taxonomy > [vocabulary] > Merge
  • The interface lies to you!
    • In the first step ("Terms to merge"), select the terms you don't want. In the second step, choose the term to merge them into
  • Only works on terms in the same vocabulary
  • Updates Taxonomy Reference fields to point to the preferred term
    • does NOT update Typed Relation fields.
    • Instead you get ghost references

26 of 44

🎓 "Ghost" references (not an official term)

  • If you delete a taxonomy term that's in use (or merge terms using Term Merge that are used by Typed relation fields) you may get "ghost" references
  • This means the node (or media, etc) still points to the term, as though it exists
    • Lack of referential integrity in the database!
    • You can see it if you append ?_format=json to the node URL
  • You probably want to fix these references - through Workbench, Migrate, a script, etc.
  • Use a view (see following slide) to find nodes with specific term IDs in specific fields.
  • Be careful if you edit entities in the interface if they have ghost references - you might delete the reference, making it harder to find and fix.

27 of 44

🎓 Ghost reference in JSON

28 of 44

🎓 A view to find ghost references

  • Most taxonomy term filtering in Views loads the term; this will not work with ghost references, it'll find nothing there.
  • Use a contextual filter, and select the one specific to the field that term was in
    • the field-agnostic "has taxonomy term ID" filters will NOT work for this!
  • Add the ghost term ID in the view's URL or the preview pane.

https://sandbox.islandora.ca/test/4

Contextual filter

Node with ghost reference

"Type" links to non-existent term, but it will not display

29 of 44

Terms are locked to their vocabularies

  • Can't move terms to a different vocabulary
    • Careful if creating new names (Person/Corporate Body/Family)
  • You could do a round trip using Workbench and then (again with Workbench) replace the references from the old term to the new term.

30 of 44

How to care for your taxonomy terms/vocabularies

  • Maintenance doesn't have to be one-by-one (but it could!)
  • Views Bulk Edit
    • a plugin for Views available from the Views Bulk Edit and Views Bulk Operations modules.
    • for setting fields to a common value, publishing/unpublishing, deleting
  • Islandora Workbench
    • A python command-line tool for updating Islandora content
    • `create_terms` and `update_terms` tasks (thanks Mark Jordan!)
  • Drupal Migrate
    • A tool that's part of Drupal that requires YAML editing
    • can create and update any entity.
  • Drush
    • DRUpal SHell, a command-line tool for managing Drupal
    • best for deleting terms

31 of 44

Vocabularies and Terms in Islandora

32 of 44

Vocabularies in the Starter Site

Corporate Body

Country

Family

Frequency

Genre

Geographic Location

Islandora Display

Islandora Media Use

Islandora Models

Issuance Mode

Language

Person

Physical Form

Resource Types (DCMI)

Resource Types (LC)

Subject

Tags

Temporal Subjects

33 of 44

Vocabularies in the Starter Site

Corporate Body

Country

Family

Frequency

Genre

Geographic Location

Islandora Display

Islandora Media Use

Islandora Models

Issuance Mode

Language

Person

Physical Form

Resource Types (DCMI)

Resource Types (LC)

Subject

Tags

Temporal Subjects

Legend:

Structural vocabularies

34 of 44

Vocabularies in the Starter Site

Corporate Body

Country

Family

Frequency

Genre

Geographic Location

Islandora Display

Islandora Media Use

Islandora Models

Issuance Mode

Language

Person

Physical Form

Resource Types (DCMI)

Resource Types (LC)

Subject

Tags

Temporal Subjects

Legend:

Prepopulated vocabularies

35 of 44

Special Islandora Taxonomy Term fields

  • Authority Sources (field_authority_link)
    • is a special field type (Authority Link) defined by Controlled Access Terms
    • technically: is a link field plus a select list
    • usually used when the external reference is an authority record

36 of 44

Special Islandora Taxonomy Term fields

  • External Link (field_external_link)
    • is a Link field
    • usually single-valued
    • usually used when the external reference is a linked data URI

37 of 44

Special Islandora Taxonomy Term-isms: "term with URI"

"A node is described by a URI"

"A node has a term with a URI"

Metadata model

Islandora Entity model

38 of 44

Special Islandora Taxonomy Term-isms: "term with URI"

  • In many cases we want to use URIs to describe our content.
    • e.g. "This node is a http://schema.org/Book"
  • We can take advantage of Drupal's Taxonomy features by creating a term "with" this URI.
    • Easier to autocomplete, fewer typos, easier to control who can create new values
    • More robust than referring to a term ID - so we can port config between sites more easily.
    • e.g. "Paged Content"(taxonomy term) has External URI value "https://schema.org/Book"
  • Either External Link or Authority Source fields are considered to are used by Islandora under the hood when asking "Get me a term with this URI".

39 of 44

Context Conditions provided by Islandora

  • Media has term with URI
  • Node has term with URI
  • Parent node for media has term with URI

note: these are field-agnostic. They do not care if the term is in the "Model" field or the "Display hints" field or the "Genre" field (etc).

40 of 44

Taxonomy Terms vs. Authority Records

  • In an ILS, you could (per local policy) enter a name even if you do not have an authority record for it. An authority record is created after authority work has been done: the name checked against relevant databases, disambiguation between other similar people, determination of the most common form of name, rules followed in constructing the authorized access point, adding biographical details, etc.
  • In Drupal, terms are "cheap" and when a term is a taxonomy term field, you have no choice but to create a new taxonomy term for a new value.
    • You can link to an authority record in Authority Sources
    • You could implement a checkbox to say this term has been locally authorized.

41 of 44

Taxonomy Terms in Views

  • Taxonomy terms are powerful filters in Views.
  • Relationships
    • Can make a relationship to terms in a given field, or any linked term (regardless of field).
  • Contextual Filters
    • Has taxonomy term ID
    • Has taxonomy term ID (with depth)
    • Has taxonomy term ID depth modifier
  • Works with Typed Relation as well as basic Taxonomy Term fields.

42 of 44

Bonus: Entity Reference Views as a Reference method

In field settings, you can select "Views: Filter by an entity reference view" instead of "Default" as the reference mechanism.

  • Then you must select from the existing views that have an Entity Reference display.
  • The view provides what the autocomplete searches (e.g. alternate name field) and how the autocomplete results display (e.g. it can show the vocabulary or alternate name field).
  • The view is in charge of filtering what terms are allowed, e.g. by filtering on the vocabularies

43 of 44

E.g.: Entity Reference View as a Reference method

44 of 44

Relevant Videos of updating linked agent fields

How to fix names in Islandora

How to export & manipulate name data from your islandora site