Options
All
  • Public
  • Public/Protected
  • All
Menu

A Property represents a property term, which is used to describe a relationship between subject resources (their domains) and object resources (their ranges). A Property is identified by its IRI (e.g. schema:name), where, by convention, the property name itself starts with a lowercase letter. A Property instance is created with SDOAdapter.getProperty() and offers the methods described below.

// following Property instance is used in the code examples below
const identifierProperty = mySdoAdapter.getProperty("schema:identifier");
// it is also possible to create a Property instance with an absolute IRI or a label
const identifierProperty2 = mySdoAdapter.getProperty("https://schema.org/identifier");
const identifierProperty3 = mySdoAdapter.getProperty("identifier");

Hierarchy

  • Term
    • Property

Index

Properties

IRI: string
graph: Graph

Methods

  • getDescription(language?: string): null | string
  • 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.

    example
    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."

    Parameters

    • language: string = "en"

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

    Returns null | string

    The description of this Term

  • getDescriptions(): null | Record<string, string>
  • 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)

    example
    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),俗称老虎、大虫,被人称为百獸之王,是現存体型最大的两种猫科动物之一(另一种是狮)"
    }

    Returns null | Record<string, string>

    The descriptions of this Term

  • Retrieves the classes and enumerations that are defined as domains for this Property

    example
    identifierProperty.getDomains();
    // returns all domains of the property "schema:identifier"
    [
    "schema:Thing",
    "schema:Event",
    "schema:Product",
    "schema:Organization",
    ...
    ]

    Parameters

    • Optional paramObj: 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 domains inherited from subclasses of the domains

    Returns string[]

    The domains of this Property

  • 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

    example
    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"

    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

  • Retrieves the inverse Property of this Property

    example
    const alumniProperty = mySdoAdapter.getProperty("schema:alumni");
    alumniProperty.getInverseOf();
    // returns the inverse properties of the property "schema:alumni"
    "schema:alumniOf"

    Parameters

    • outputIRIType: OutputIRIType = "Compact"

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

    Returns null | string

    The IRI of the inverse Property of this Property, if any

  • getName(language?: string): null | string
  • 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.

    example
    const hotelClass = mySdoAdapter.getClass("schema:Hotel");
    hotelClass.getName();
    // returns the (english) name of the class schema:Hotel
    "Hotel"

    Parameters

    • language: string = "en"

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

    Returns null | string

    The name of this Term

  • getNames(): null | Record<string, string>
  • 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).

    example
    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": "虎"
    }

    Returns null | Record<string, string>

    The names (with language tag) of this Term

  • Retrieves the classes, enumerations, and data-types that are defined as ranges for this Property

    example
    identifierProperty.getRanges();
    // returns all ranges of the property "schema:identifier"
    [
    "schema:Text",
    "schema:URL",
    "schema:PropertyValue",
    "schema:PronounceableText",
    ...
    ]

    Parameters

    • Optional paramObj: 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 ranges inherited from subclasses of the ranges

    Returns string[]

    The ranges of this Property

  • getSource(): null | string | string[]
  • 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.

    example
    const phoneticText = mySdoAdapter.getProperty("schema:phoneticText");
    phoneticText.getVocabulary();
    // returns source of the phoneticText property
    "https://github.com/schemaorg/schemaorg/issues/2108"

    Returns null | string | string[]

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

  • Retrieves the sub-properties of this Property

    example
    const recipientProperty = mySdoAdapter.getProperty("schema:recipient");
    recipientProperty.getSubProperties();
    // returns all sub-properties of the property "schema:recipient"
    [
    "schema:participant"
    ]

    Parameters

    • Optional paramObj: 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 sub-properties inherited recursively from sub-properties

    Returns string[]

    The sub-properties of this Property

  • Retrieves the super-properties of this Property

    example
    const bccRecipientProperty = mySdoAdapter.getProperty("schema:bccRecipient");
    bccRecipientProperty.getSuperProperties();
    // returns all super-properties of the property "schema:bccRecipient"
    [
    "schema:recipient",
    "schema:participant"
    ]

    Parameters

    • Optional paramObj: 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 super-properties inherited recursively from super-properties

    Returns string[]

    The super-properties of this Property

  • 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"

    example
    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"

    Returns TermTypeIRIValue

    The term-type-IRI of this Term

  • Retrieves the label (string) for the type of this Term:

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

    example
    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"

    Returns TermTypeLabelValue

    The term-type-label of this Term

  • getVocabURLs(): null | string[]
  • 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.

    example
    // 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 null | string[]

    The original vocabulary source urls of this Term

  • getVocabulary(): string
  • 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.

    example
    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 string

    The vocabulary URL of this term (extension or namespace)

  • Returns the IRI of the Term superseding this Term (defined with schema:supersededBy), if any. By default, the IRI is returned in compact form

    example
    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"

    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

  • isValidDomain(domainId: string, implicit?: boolean): boolean
  • Returns true, if the given domain (class or enumeration) is a valid domain of this property. The implicit parameter (default: true) allows to cover recursive relationships (e.g. the subclasses of a domain are also taken into account)

    example
    nameProperty.isValidDomain("schema:Thing"); // true
    nameProperty.isValidDomain("schema:Person"); // true
    nameProperty.isValidDomain("schema:DayOfWeek"); // true, it is an enumeration, but has "Enumeration" and therefore also "Thing" as superclass
    nameProperty.isValidDomain("schema:Person", true); // true
    nameProperty.isValidDomain("schema:Person", false); // false, since only direct domains are considered

    Parameters

    • domainId: string

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

    • implicit: boolean = true

      If true, includes also subclasses of domains

    Returns boolean

    if the given class/enumeration is a valid domain of this property

  • isValidInverseOf(inversePropertyId: string): boolean
  • Returns true, if the given property is the inverse property of this property

    example
    memberProperty.isValidInverseOf("schema:memberOf"); // true
    memberOfProperty.isValidInverseOf("schema:member"); // true
    brandProperty.isValidInverseOf("schema:name"); // false

    Parameters

    • inversePropertyId: string

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

    Returns boolean

    if the given property is the inverse property of this property

  • isValidRange(rangeId: string, implicit?: boolean): boolean
  • Returns true, if the given term (Class, Enumeration, DataType) is a valid range of this property. The implicit parameter (default: true) allows to cover recursive relationships (e.g. the subclasses/types of a range are also taken into account)

    example
    inLanguageProperty.isValidRange("schema:Text"); // true
    inLanguageProperty.isValidRange("schema:Language"); // true
    inLanguageProperty.isValidRange("schema:URL"); // true (subtype of Text)
    inLanguageProperty.isValidRange("schema:Text", true); // true
    inLanguageProperty.isValidRange("schema:URL", false); // false, since only direct ranges are considered

    Parameters

    • rangeId: string

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

    • implicit: boolean = true

      If true, includes also subclasses of ranges

    Returns boolean

    if the given class/enumeration/dataType is a valid range of this property

  • isValidSubPropertyOf(superPropertyId: string, implicit?: boolean): boolean
  • Returns true, if the given property is a valid super-property of this property. The implicit parameter (default: true) allows to cover recursive relationships (e.g. the super-properties of a super-property are also taken into account)

    example
    seasonProperty.isValidSubPropertyOf("schema:hasPart"); // true
    seasonProperty.isValidSubPropertyOf("schema:hasPart", true); // true
    seasonProperty.isValidSubPropertyOf("schema:hasPart", false); // true, (is a direct sub-property)

    Parameters

    • superPropertyId: string

      The identification string of the super-property in question, can be an IRI (absolute or compact) or a label

    • implicit: boolean = true

      If true, includes also super-properties of super-properties

    Returns boolean

    if the given property is a valid super-property of this property

  • isValidSuperPropertyOf(subPropertyId: string, implicit?: boolean): boolean
  • Returns true, if the given property is a valid sub-property of this property. The implicit parameter (default: true) allows to cover recursive relationships (e.g. the sub-properties of a sub-property are also taken into account)

    example
    hasPartProperty.isValidSuperPropertyOf("schema:season"); // true
    hasPartProperty.isValidSuperPropertyOf("schema:season", true); // true
    hasPartProperty.isValidSuperPropertyOf("schema:season", false); // true, (is a direct sub-property)

    Parameters

    • subPropertyId: string

      The identification string of the sub-property in question, can be an IRI (absolute or compact) or a label

    • implicit: boolean = true

      If true, includes also sub-properties of sub-properties

    Returns boolean

    if the given property is a valid sub-property of this property

  • Generates a JSON representation of this Property (as JavaScript Object)

    example
    identifierProperty.toJSON();
    // returns a JSON representing the property "schema:identifier"
    {
    id: 'schema:identifier',
    IRI: 'https://schema.org/identifier',
    typeLabel: 'Property',
    typeIRI: 'rdf:Property',
    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: 'identifier',
    description: 'The identifier property represents any kind of identifier for any kind of [[Thing]], such as ISBNs, GTIN codes, UUIDs etc. Schema.org provides dedicated properties for representing many of these, either as textual strings or as URL (IRI) links. See [background notes](/docs/datamodel.html#identifierBg) for more details.,
    ranges: [
    'schema:Text',
    'schema:URL',
    'schema:PropertyValue',
    ...
    ],
    domains: [
    'schema:Thing',
    'schema:Event',
    'schema:Product',
    ...
    ],
    superProperties: [],
    subProperties: [
    'schema:gtin12',
    'schema:globalLocationNumber',
    'schema:leiCode',
    ...
    ],
    inverseOf: null
    }

    Parameters

    • Optional paramObj: 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. domains, ranges, etc.)

    Returns ToJsonProperty

    The JSON representation of this Property as JavaScript Object

  • Generates a JSON representation of this Property (as string)

    Check .toJSON() for an example output

    example
    identifierProperty.toString();
    

    Parameters

    • Optional paramObj: 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. domains, ranges, etc.)

    Returns string

    The JSON representation of this Property as string