@grafctory/core - v0.15.0
    Preparing search index...

    Function getIRILabel

    • Derives a readable label from an identifier.

      Provides a human-readable fallback wherever a resource must be shown but no label is at hand. The label is taken from the fragment or the last path segment, so vocabulary terms are named after themselves. Primary topic markers such as #this or #id are skipped, so a resource described by a document is named after that document. Camel, kebab and snake case are split into capitalised words, and digits stay attached to the word they follow.

      Important

      Never use labels as identifiers, since distinct resources may share the same label.

      Parameters

      • iri: string

        The identifier to derive the label from

      Returns Optional<string>

      A label for the resource identified by iri, or undefined if iri carries no segment to derive one from

      getIRILabel("https://example.com/terms#FineArts");      // "Fine Arts"
      getIRILabel("https://example.com/people/alice#this"); // "Alice"
      getIRILabel("urn:isbn:1234"); // "1234"