schemamarkup.wikiThe schema.org and structured data reference

DefinedTerm and DefinedTermSet

From schemamarkup.wiki, the sourced reference on schema.org and structured data

A DefinedTerm is "a word, name, acronym, phrase, etc. with a formal definition," and a DefinedTermSet is "a set of defined terms, for example a set of categories or a classification scheme, a glossary, dictionary or enumeration."[1][2] Together they let a site mark up a glossary, a list of service categories or a classification code so that each term is a node other markup can point to. Schema.org sets out the pattern: use name for the term, termCode for any code, description for the definition and about for what the term is about.[1] Google documents no search feature for these types.[3]

Definitions

PropertyExpected valuesSchema.org definition (quoted)
hasDefinedTermDefinedTerm"A Defined Term contained in this term set."[4]
inDefinedTermSetDefinedTermSet, URL"A DefinedTermSet that contains this term."[5]
termCodeText"A code that identifies this DefinedTerm within a DefinedTermSet."[6]
nameText"The name of the item."[7]
descriptionText, TextObject"A description of the item."[8]

DefinedTerm is an Intangible; DefinedTermSet is a CreativeWork, so a glossary can carry author, publisher, dateModified and the other creative work properties.[1][2] inDefinedTermSet accepts a DefinedTermSet or a URL, so a term can point to its set by @id or by the set's page address.[5]

The glossary pattern

The pattern has two directions. The set lists its terms with hasDefinedTerm, "a Defined Term contained in this term set"; each term points back with inDefinedTermSet, "a DefinedTermSet that contains this term."[4][5] On a glossary page, the WebPage's mainEntity can be the DefinedTermSet, with each term given a fragment @id such as #term-backflow so other pages can refer to it.[9][10]

Each term's description should be the definition shown on the page, and its about can link to the thing the term names, for example a Thing with a sameAs to a Wikidata entry.[1][11]

Codes and classification schemes

termCode is "a code that identifies this DefinedTerm within a DefinedTermSet."[6] The subtype CategoryCode, with CategoryCodeSet, is meant for codes in a category scheme.[12][13] Google's merchant listing documentation uses CategoryCode for a Google Product Category: "Set @type to CategoryCode. Set inCodeSet to a Google Product Taxonomy URL" and set codeValue to the category ID or path.[14] Schema.org's occupationalCategory property similarly prefers "a term from a taxonomy such as BLS O*NET-SOC, ISCO-08 or similar," with both the label and the code.[15]

Terms as property values

Several schema.org properties accept a DefinedTerm as a value, so a defined vocabulary can be reused across the graph. Examples in the current release include jobTitle, which takes Text or DefinedTerm, and competencyRequired.[16][17] A service business can use a DefinedTermSet for its service categories and point each Service's category to a term, keeping the names consistent across pages.[18]

CategoryCode properties

CategoryCode is the only direct subtype of DefinedTerm, and it has one subtype of its own, MedicalCode.[12] Its two own properties link a code to its code list:

PropertyExpected valuesSchema.org definition (quoted)
termCodeText"A code that identifies this DefinedTerm within a DefinedTermSet."[6]
codeValueText"A short textual code that uniquely identifies the value."[19]
inCodeSetCategoryCodeSet, URL"A CategoryCodeSet that contains this category code."[20]

DefinedTermSet has a matching subtype, CategoryCodeSet, defined as "A set of Category Code values."[13] The inverse links are hasDefinedTerm on the set and inDefinedTermSet on the term, so a code list can either list its codes or each code can point back to its list.

Common mistakes

  • Terms without the set. A DefinedTerm with no inDefinedTermSet floats free of the vocabulary it belongs to.[5]
  • Definitions that differ from the page. The description should match the visible definition.[21]
  • Codes without a scheme. A termCode is meaningful only within its DefinedTermSet.[6]
  • One-way links only. hasDefinedTerm and inDefinedTermSet can both be given, so either node leads to the other.[4]

Example

A fictional plumbing glossary with two terms.

{
  "@context": "https://schema.org",
  "@type": "DefinedTermSet",
  "@id": "https://www.example.com/glossary#terms",
  "name": "Example Plumbing glossary",
  "hasDefinedTerm": [
    { "@type": "DefinedTerm", "@id": "https://www.example.com/glossary#term-backflow",
      "name": "Backflow", "description": "Water flowing in the reverse of its intended direction.",
      "inDefinedTermSet": { "@id": "https://www.example.com/glossary#terms" } },
    { "@type": "DefinedTerm", "@id": "https://www.example.com/glossary#term-trap",
      "name": "P-trap", "description": "A curved pipe section that holds water to block sewer gas.",
      "inDefinedTermSet": { "@id": "https://www.example.com/glossary#terms" } }
  ]
}

Common questions

Is DefinedTermSet a creative work?

Yes. It descends from CreativeWork.[2]

Does Google show glossary rich results?

Google documents no feature for DefinedTerm or DefinedTermSet.[3]

Where does a term code go?

In termCode.[6]

References

  1. ^ "DefinedTerm (type)". Schema.org.
  2. ^ "DefinedTermSet (type)". Schema.org.
  3. ^ "Structured data markup that Google Search supports (search gallery)". Google Search Central.
  4. ^ "hasDefinedTerm (property)". Schema.org.
  5. ^ "inDefinedTermSet (property)". Schema.org.
  6. ^ "termCode (property)". Schema.org.
  7. ^ "name (property)". Schema.org.
  8. ^ "description (property)". Schema.org.
  9. ^ "mainEntity (property)". Schema.org.
  10. ^ "JSON-LD 1.1, section 3.3 Node Identifiers". World Wide Web Consortium (W3C).
  11. ^ "sameAs (property)". Schema.org.
  12. ^ "CategoryCode (type)". Schema.org.
  13. ^ "CategoryCodeSet (type)". Schema.org.
  14. ^ "Merchant listing (Product, Offer) structured data". Google Search Central.
  15. ^ "occupationalCategory (property)". Schema.org.
  16. ^ "jobTitle (property)". Schema.org.
  17. ^ "competencyRequired (property)". Schema.org.
  18. ^ "Service (type)". Schema.org.
  19. ^ "codeValue (property)". Schema.org.
  20. ^ "inCodeSet (property)". Schema.org.
  21. ^ "Introduction to structured data markup in Google Search". Google Search Central.