Skip to content

CategoryCode Proposal (formerly EnumerationValue Proposal) #894

@RichardWallis

Description

@RichardWallis

Background

When marking-up with Schema.org there is often need to associate the Thing being described with a pre-defined value - a type, category, subject, topic, definition, etc.

In certain specific cases the vocabulary handles this using Enumerations and Enumeration subtypes to provide a specific type value. For example BookFormatType, which has subtypes of EBook, HardCover, PaperBack, and in the bib.schema.org extension, http://bib.schema.org/GraphicNovel. This mechanism works well with enumerations containing a small number of enumeration types and of fairly static content.

Where it is not practical, or desired, for Schema.org to become the authority for many, various, and or large sets of values, external enumerations are recommended. In a blog post referenced from the Schema.org documentation the mechanism for external enumerations is introduced for referencing lists of values external to the vocabulary.

What could be viewed as a compromise between these approaches is demonstrated in the DayOfWeek Type. It could be argued that the actual days of the week should have been defined in Schema.org, Monday, Tuesday, etc., as subtypes of DayOfWeek. Instead values in the GoodRelations vocabulary, for days of the week, are documented as commonly used. Thus both encouraging the use of external values whilst, expressing implied preference for a particular external set of values.

Markup for External Enumerations
What Schema.org does not yet address however, is the markup of external enumeration values in the context of them being shared on the web. The use-cases for this include potential addition of Schema.org markup for existing sets of values and for the creation of new sets. Examples include adding Schema markup to values, often referred to as authorities in the library domain, for subjects and persons at national level libraries such as The Library of Congress; the markup of a new authoritative list of sports types, or bank account types, or medical treatment types.

Previous discussions [1] [2] referencing an earlier MiniSKOS proposal provide background and some use cases to view this simple proposal against.

Proposal

This proposal consists of:

  • A new Type - EnumerationValue - a subtype of Enumeration ."An enumeration value"
  • A new Type - EnumerationValueSet - a subtype of CreativeWork. "A set of enumeration values."
  • Three new properties:
    • valueCode - Domain: EnumerationValue Range: Text. "Provides the ability to share item codes or similar which are often a key value in existing code sets.:
    • partOfValueSet - sub-property of isPartOf. Domain: EnumerationValue Range: EnumerationValueSet. "The value set of which this value is part of."
    • hasEnumerationValue - sub-property of hasPart Domain: EnumerationValueSet Range: EnumerationValue

Definition RDFa

<div typeof="rdfs:Class" resource="http://schema.org/EnumerationValue">
  <span class="h" property="rdfs:label">EnumerationValue</span>
  <span property="rdfs:comment">An enumeration value.</span>
  <span>Subclass of: <a property="rdfs:subClassOf" href="http://schema.org/Enumeration">Enumeration</a></span>
</div>

<div typeof="rdfs:Class" resource="http://schema.org/EnumerationValueSet">
  <span class="h" property="rdfs:label">EnumerationValueSet</span>
  <span property="rdfs:comment">A set of enumerated values.</span>
  <span>Subclass of: <a property="rdfs:subClassOf" href="http://schema.org/CreativeWork">CreativeWork</a></span>
</div>

<div typeof="rdf:Property" resource="http://schema.org/enumerationValueCode">
    <span class="h" property="rdfs:label">enumerationValueCode</span>
    <span property="rdfs:comment">A short textual code that uniquely identifies the value. The code is typically used in structured URLs.</span>
    <span>Domain: <a property="http://schema.org/domainIncludes" href="http://schema.org/EnumerationValue">EnumerationValue</a></span>
    <span>Range: <a property="http://schema.org/rangeIncludes" href="http://schema.org/Text">Text</a></span>
</div>

<div typeof="rdf:Property" resource="http://schema.org/partOfEnumerationValueSet">
    <span class="h" property="rdfs:label">partOfEnumerationValueSet</span>
    <span property="rdfs:comment">The set (enumeration) of values of which contains this value.</span>
    <link property="rdfs:subPropertyOf" href="http://schema.org/isPartOf" />
    <span>Domain: <a property="http://schema.org/domainIncludes" href="http://schema.org/EnumerationValue">EnumerationValue</a></span>
    <span>Range: <a property="http://schema.org/EnumerationValueSet" href="http://schema.org/Text">EnumerationValueSet</a></span>
</div>

<div typeof="rdf:Property" resource="http://schema.org/hasEnumerationValue">
    <span class="h" property="rdfs:label">hasEnumerationValue</span>
    <span property="rdfs:comment">Value contained in value set.</span>
    <link property="rdfs:subPropertyOf" href="http://schema.org/hasPart" />
    <span>Domain: <a property="http://schema.org/domainIncludes" href="http://schema.org/EnumerationValueSet">EnumerationValueSet</a></span>
    <span>Range: <a property="http://schema.org/EnumerationValue" href="http://schema.org/Text">EnumerationValue</a></span>
</div>

Examples (Turtle)

1- A Library of Congress resource type

    <http://id.loc.gov/vocabulary/resourceTypes/Man>
       a schema:EnumerationValue;
       schema:name "Manuscript";
       schema:enumerationvalueCode "Man";
       schema:partOfEnumerationValueSet <http://id.loc.gov/vocabulary/resourceTypes>.

2- An animal classification term and term set

    <http://mammals.example.com/Carnivore>
       a schema:EnumerationValue;
       schema:name "Carnivore";
       schema:description "A mammal that feeds on other animals";
       schema:partOfEnumerationValueSet <http://mammals.example.com>;
       schema:sameAs <https://www.wikidata.org/wiki/Q81875>.

    <http://mammals.example.com>
      a schema:EnumerationValueSet;
      schema:name "The Mammal Classification List".

3- Terms in a dictionary of legal terms

    <http://openjurist.org/dictionary/Ballentine>
      a schema:CreativeWork, schema:EnumerationValueSet;
      schema:name "Ballentine’s Law Dictionary".

    <http://openjurist.org/dictionary/Ballentine/term/schema> 
      a schema:EnumerationValue;
      schema:name "schema";
      schema:description "A representation of a plan or theory in the form of an    outline or model.";
      schema:partOfEnumerationValueSet <http://openjurist.org/dictionary/Ballentine>.

    <http://openjurist.org/dictionary/Ballentine/term/calendar-year> 
      a schema:EnumerationValue;
      schema:name "calendar year";
      schema:description "The period from January 1st to December 31st, inclusive, of any year.";
      schema:sameAs <https://www.wikidata.org/wiki/Q3186692>;
      schema:partOfEnumerationValueSet <http://openjurist.org/dictionary/Ballentine>.

4- A occupation term defined by O*Net Online

    <http://onetonline.org/link/details/51-6042.00> 
      a schema:EnumerationValue;
      schema:enumerationValueCode "51-6042.00";
      schema:name "Shoe Machine Operators and Tenders";
      schema:description "Operate or tend a variety of machines to join, decorate, reinforce, or finish shoes and shoe parts.";
      schema:partOfEnumerationValueSet <http://onetonline.org>.

5- An ISO639-2 Language Code

    <http://id.loc.gov/vocabulary/iso639-2>
      a schema:EnumerationValueSet;
      schema:name "ISO 639-2: Codes for the Representation of Names of Languages";
      schema:hasEnumerationValue <http://id.loc.gov/vocabulary/iso639-2/cze>.

    <http://id.loc.gov/vocabulary/iso639-2/cze> 
      a schema:EnumerationValue;
      schema:enumerationValueCode "cze";
      schema:name "Czech"@en;
      schema:name "tchèque"@fr;
      schema:name "Tschechisch"@de;
      schema:partOfEnumerationValueSet <http://id.loc.gov/vocabulary/iso639-2>.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions