Schema.org Adapter
    Preparing search index...

    Class EnumerationMember

    An EnumerationMember represents an enumeration instance term. The understanding of SDO-Adapter for Classes, Enumerations and Enumeration Members is described in the Enumeration page. An EnumerationMember is created with SDOAdapter.getEnumerationMember() and offers the methods described below.

    // following EnumerationMember instance is used in the code examples below
    const mondayEM = mySdoAdapter.getEnumerationMember("schema:Monday");
    // it is also possible to create an EnumerationMember instance with an absolute IRI or a label
    const mondayEM2 = mySdoAdapter.getEnumerationMember("https://schema.org/Monday");
    const mondayEM3 = mySdoAdapter.getEnumerationMember("Monday");
    Index

    Properties

    graph: Graph

    The underlying data graph to enable the methods of this Term

    IRI: string

    The compact IRI of this Term

    Methods

    • Returns the description (rdfs:comment) of this Term. It is possible to pass a language tag as parameter to get the description in that language, as long as the vocabulary provides that language. The english ("en") language is understood as default.

      Parameters

      • language: string = "en"

        the wished language for the description (default = "en")

      Returns null | string

      The description of this Term

      const cwClass = mySdoAdapter.getClass("schema:CreativeWork");
      cwClass.getDescription();
      // returns the (english) description of the class schema:CreativeWork
      "The most generic kind of creative work, including books, movies, photographs, software programs, etc."
    • Returns all descriptions (rdfs:comment) of this Term as an Object. Each description (value) has a language tag (key) associated with it. Language tags are unique for each term (e.g. there is at most one description for any given language)

      Returns null | Record<string, string>

      The descriptions of this Term

      const tigerClass = mySdoAdapter.getClass("ex:Tiger");
      tigerClass.getDescriptions();
      // returns the descriptions of this class in all available languages:
      {
      "en": "The tiger (Panthera tigris) is the largest species among the Felidae and classified in the genus Panthera.",
      "zh": "虎(学名:Panthera tigris),俗称老虎、大虫,被人称为百獸之王,是現存体型最大的两种猫科动物之一(另一种是狮)"
      }
    • Retrieves the Enumerations for which this EnumerationMember is a valid instance - typically there is only one domain Enumeration

      Parameters

      • OptionalparamObj: ParamObjIRIListInference

        an optional parameter object that filters and formats the result, and defines the inference behaviour: The "implicit"-parameter defaults to true and returns also implicit domain enumerations inherited from super-enumerations

      Returns string[]

      The domain enumerations of this EnumerationMember

      mondayEM.getDomainEnumerations();
      // returns the Enumerations for which "schema:Monday" is a valid Enumeration Member
      [
      "schema:DayOfWeek",
      ]
    • Retrieves the IRI of this Term in compact (e.g. schema:Friday) or in absolute form (e.g. https://schema.org/Friday). By default, the absolute form is returned

      Parameters

      • outputIRIType: OutputIRIType = "Absolute"

        states the format of the returned IRI, either "Compact" for the compact form, e.g. schema:Friday, or "Absolute" for the absolute form, e.g. https://schema.org/Friday

      Returns string

      The IRI of this Term

      personClass.getIRI();
      // returns the absolute IRI of the "schema:Person" Class
      "https://schema.org/Person"

      nameProperty.getIRI("Compact");
      // returns the compact IRI of the "schema:name" Property
      "schema:name"
    • Returns the name (rdfs:label) of this Term. It is possible to pass a language tag as parameter to get the name in that language, as long as the vocabulary provides that language. The english ("en") language is understood as default.

      Parameters

      • language: string = "en"

        the wished language for the name (default = "en")

      Returns null | string

      The name of this Term

      const hotelClass = mySdoAdapter.getClass("schema:Hotel");
      hotelClass.getName();
      // returns the (english) name of the class schema:Hotel
      "Hotel"
    • Returns all names (rdfs:label) of this Term as an Object. Each name (value) has a language tag (key) associated with it. Language tags are unique for each term (e.g. there is at most one name for any given language).

      Returns null | Record<string, string>

      The names (with language tag) of this Term

      const tigerClass = mySdoAdapter.getClass("ex:Tiger");
      tigerClass.getNames();
      // returns the name of this class in all available languages:
      {
      "en": "Tiger",
      "de": "Tiger",
      "es": "Tigre",
      "zh": "虎"
      }
    • This method was introduced mainly to return of source(s) for a term, as defined in the vocabulary itself with dcterms:source or schema:source. The later has been used to link to related github issues for the schema.org vocabulary.

      Returns null | string | string[]

      The source IRI given by dcterms:source or schema:source of this Term

      const phoneticText = mySdoAdapter.getProperty("schema:phoneticText");
      phoneticText.getVocabulary();
      // returns source of the phoneticText property
      "https://github.com/schemaorg/schemaorg/issues/2108"
    • Retrieves the compact IRI for the type of this Term:

      Class -> "rdfs:Class"
      Property -> "rdf:Property"
      Enumeration -> "schema:Enumeration"
      EnumerationMember -> "soa:EnumerationMember"
      DataType -> "schema:DataType"

      Returns TermTypeIRIValue

      The term-type-IRI of this Term

      personClass.getTermTypeIRI();
      // returns the term type IRI of the "schema:Person" Class in compact form
      "rdfs:Class"

      nameProperty.getTermTypeIRI();
      // returns the term type IRI of the "schema:name" Property in compact form
      "rdf:Property"
    • Retrieves the label (string) for the type of this Term:

      Class -> "Class"
      Property -> "Property"
      Enumeration -> "Enumeration"
      EnumerationMember -> "EnumerationMember"
      DataType -> "DataType"

      Returns TermTypeLabelValue

      The term-type-label of this Term

      personClass.getTermTypeLabel();
      // returns the term type label of the "schema:Person" Class
      "Class"

      nameProperty.getTermTypeLabel();
      // returns the term type label of the "schema:name" Property
      "Property"
    • This method was introduced mainly to return the vocabulary extension URL of schema.org to which the term belongs. The extension URL is defined in the vocabulary through the schema:isPartOf property. If no such property is given, then the namespace URL for this term is returned.

      Returns string

      The vocabulary URL of this term (extension or namespace)

      const personClass = mySdoAdapter.getClass("schema:Person");
      personClass.getVocabulary();
      // returns the vocabulary url for the person class, which is the core vocabulary of schema.org
      "https://schema.org"

      const patientClass = mySdoAdapter.getClass("schema:Patient");
      patientClass.getVocabulary();
      // returns the vocabulary url for the patient class, which is the health extension of schema.org
      "https://health-lifesci.schema.org"
    • Returns the URL of all vocabularies in which this term has been defined. Works only if the corresponding vocabulary was added through a URL, and not as a JSON-LD object.

      Returns null | string[]

      The original vocabulary source urls of this Term

      // the parameter `schemaVersion: "12.0"` tells the SDO-Adapter instance to initialize with the schema.org vocabulary version 12.0
      const mySdoAdapter = await SOA.create({schemaVersion: "12.0"});

      const personClass = mySdoAdapter.getClass("schema:Person");
      personClass.getVocabURLs();
      // returns the source vocabulary url for this class - notice that this url points to version 12.0 of schema.org
      ["https://raw.githubusercontent.com/semantifyit/schemaorg/main/data/releases/12.0/schemaorg-all-https.jsonld"]
    • Returns the IRI of the Term superseding this Term (defined with schema:supersededBy), if any. By default, the IRI is returned in compact form

      Parameters

      • outputIRIType: OutputIRIType = "Compact"

        states the format of the returned IRI, either "Compact" for the compact form, e.g. schema:softwareRequirements, or "Absolute" for the absolute form, e.g. https://schema.org/softwareRequirements

      Returns null | string

      The Term superseding this Term, if any

      const requirementsProperty = mySdoAdapter.getProperty("schema:requirements");
      requirementsProperty.isSupersededBy();
      // returns IRI for the term that supersedes the property schema:requirements in compact form
      "schema:softwareRequirements"

      requirementsProperty.isSupersededBy("Absolute");
      // returns IRI for the term that supersedes the property schema:requirements in absolute form
      "https://schema.org/softwareRequirements"
    • Returns true, if this Enumeration Member is a valid instance for the given Enumeration. The implicit parameter (default: true) allows to include super-enumerations of domain enumerations

      Parameters

      • enumerationId: string

        The identification string of the domain enumeration in question, can be an IRI (absolute or compact) or a label

      • implicit: boolean = true

        If true, include super-enumerations of domain enumerations

      Returns boolean

      if this Enumeration Member is a valid instance of the given Enumeration

      eventPostponedEM.isValidEnumerationMemberOf("schema:name"); // true
      eventPostponedEM.isValidEnumerationMemberOf("schema:StatusEnumeration", true); // true
      eventPostponedEM.isValidEnumerationMemberOf("schema:StatusEnumeration", false); // false, since only direct members are considered
    • Generates a JSON representation of this EnumerationMember (as JavaScript Object)

      Parameters

      • OptionalparamObj: ParamObjIRIListInference

        an optional parameter object that filters and formats the result, and defines the inference behaviour: The "implicit"-parameter defaults to true and returns also implicit data (e.g. domain enumerations)

      Returns ToJsonEnumerationMember

      The JSON representation of this EnumerationMember as JavaScript Object

      mondayEM.toJSON();
      // returns a JSON representing the EnumerationMember "schema:Monday"
      {
      "id": "schema:Monday",
      "IRI": "https://schema.org/Monday",
      "typeLabel": "EnumerationMember",
      "typeIRI": "soa:EnumerationMember",
      "vocabURLs": [ "https://raw.githubusercontent.com/semantifyit/schemaorg/main/data/releases/12.0/schemaorg-all-https.jsonld" ],
      "vocabulary": "https://schema.org",
      "source": null,
      "supersededBy": null,
      "name": "Monday",
      "description": "The day of the week between Sunday and Tuesday.",
      "domainEnumerations": [ "schema:DayOfWeek" ]
      }
    • Generates a JSON representation of this EnumerationMember (as string)

      Check .toJSON() for an example output

      Parameters

      • OptionalparamObj: ParamObjIRIListInference

        an optional parameter object that filters and formats the result, and defines the inference behaviour: The "implicit"-parameter defaults to true and returns also implicit data (e.g. domain enumerations)

      Returns string

      The JSON representation of this EnumerationMember as string

      mondayEM.toString();