DS Specifications
draft
draft
  • DS Specifications Overview
  • Domain Specifications
    • DS-V7
      • DS-V7 - Changelog
      • DS-V7 - Developer Notes
      • DS-V7 - Grammar
        • Domain Specification
          • @Context
          • Domain Specification Node
          • Property Node
          • Class Node
          • DataType Node
          • Enumeration Node
        • VerificationReport
          • Error List for the basic verification
          • Verification of schema.org annotations
          • Error List for the DS-based verification
          • Error List for the Meta verification of DS
      • DS-V7 - Examples
    • DS-V6
    • DS-V5
      • DS-V5 - Grammar
        • VerificationReport
          • Verification of schema.org annotations
          • Error List for the Meta verification of DS (unfinished)
          • Error List for the DS-based verification
        • Grammar and semantics of Domain Specifications
          • Property Node
          • Domain Specification Node
          • Class Node
          • Terms used in Domain Specifications
          • @Context
      • DS-V5 - Examples
    • DS-V4
    • DS-V3
      • DS-V3 - Examples
      • DS-V3 - Grammar
        • Grammar and semantics of Domain Specifications
          • SDO Enumeration
          • SDO Property
          • Domain Specification
          • SDO Class
          • SDO Datatype
          • @Context
    • DS-V2
      • DS-V2 - Grammar
        • Grammar and semantics of Domain Specifications
          • Grammar Documentation for node type "RestrictedEnumeration"
          • Grammar Documentation for node type "CustomEnumerationValue"
          • Grammar Documentation for node type "Enumeration"
          • Grammar Documentation for node type "Property"
          • Grammar Documentation for node type "RestrictedProperty"
          • Grammar Documentation for node type "DomainSpecification"
          • Grammar Documentation for node type "RestrictedClass"
          • Grammar Documentation for node type "EnumerationValue"
          • Grammar Documentation for node type "Class"
          • Grammar Documentation for node type "DataType"
        • Numeric Pattern
        • Grammar Documentation for node type "VerificationReport"
          • Grammar Documentation for node type "Error"
          • Error codes for Verification Reports
        • Rules Grammar
          • Grammar Documentation for node type "ComplexRule"
          • Grammar Documentation for node type "DateRule"
          • Grammar Documentation for node type "TextRule"
          • Grammar Documentation for node type "TimeRule"
          • Grammar Documentation for node type "NumberRule"
          • Grammar Documentation for node type "BooleanRule"
          • Grammar Documentation for node type "DateTimeRule"
      • DS-V2 - Examples
    • DS-V1
      • DS-V1 - Examples
      • DS-V1 - Grammar
  • SDO-Verification
  • Lists
    • List-V1
  • Vocabularies
  • DS-Vocabulary
    • Input
      • Vocabulary for Domain Specifications
      • DS-Vocabulary
    • DS-Vocab-V1
Powered by GitBook
On this page
  • $type
  • $class
  • properties
  • additionalPropertiesAllowed
  • subClassesAllowed
  • rules
  • name
  • description
  1. Domain Specifications
  2. DS-V2
  3. DS-V2 - Grammar
  4. Grammar and semantics of Domain Specifications

Grammar Documentation for node type "RestrictedClass"

PreviousGrammar Documentation for node type "DomainSpecification"NextGrammar Documentation for node type "EnumerationValue"

Last updated 4 years ago

This is a node specifying the usage of a restricted class, hence a class from Schema.org that has syntactic constraints. The definition of semantic constraints is also possible through the usage of rules.

$type

Required. Has always the string "RestrictedClass" as value.

Based on "@type" from JSON-LD (Indicates the type of the node/object). This value is a short form for the URI identifying this node type in the DS grammar.

$class

Required. Has an array of strings as value.

properties

Required. Has always an array as value.

Specifies the allowed properties for this class. Each object in that array MUST have the $type "RestrictedProperty" or "Property".

additionalPropertiesAllowed

Optional. Has a boolean as value.

Indicates if additional properties from the Schema.org vocabulary (which have not been specified in the "properties" Array, and are in the range of the class/classes) are allowed in the annotation instance. These properties have no further restriction, they are validated as if there were standard "Property" nodes.

By default "additionalPropertiesAllowed" is set to false, and is handled as such if the option is not used.

subClassesAllowed

Optional (not recommended). Has a boolean, or an array as value.

Indicates if (or which) subClasses of this class(es) are allowed to be used. e.g. A "LocalBusiness" with "subClassesAllowed": false, allows an entity with the @type "LocalBusiness", but not one with @type "Hotel".

Following possible values:

  • false: The class(es) specified in $class must be used.

  • true: Any subclasses (and their subclasses) of the class(es) specified in $class can be used in any combination. For multi-typed entities it also could be possible to add any additional classes, since the entity would still be a valid subclass in the perspective of Schema.org

  • Array of $class definitions: Any class(es) array from this array can be seen as a valid type for this definition. Note that the items of this array are again array, which can contain more than 1 class, to allow multi-typed entities.

Any restrictions for the specified classes are also valid for the subclasses. The usage of this option is only recommended if all syntactic and semantic restrictions are the same for a specific set of subclasses. In any other case it is recommended to define "RestrictedClass" nodes for the subclasses and add them to the "expectedTypes" of the parent property. (Note that similar properties and restrictions can (and should) be reused using "$ref"-objects)

By default "subClassesAllowed" is set to false, and is handled as such if the option is not used.

Examples:

No subclasses allowed (value is boolean)

{
    "$type": "RestrictedClass",
    "$class": [
      "LodgingBusiness",
      "Restaurant"
    ],
    "subClassesAllowed": false
}

All subclasses allowed (value is boolean)

{
    "$type": "RestrictedClass",
    "$class": [
      "LodgingBusiness",
      "Restaurant"
    ],
    "subClassesAllowed": true
}

A specific set of subclasses is allowed (value is array of classes-arrays (multi-typed entities))

{
    "$type": "RestrictedClass",
    "$class": [
      "LodgingBusiness",
      "Restaurant"
    ],
    "subClassesAllowed": [
        ["Motel", "Restaurant"],
        ["Restaurant"],
        ["Hotel", "Restaurant"],
        ["Resort", "Restaurant"]
    ]
}

rules

Optional. Has an array of rules as value.

Each value in the array must be an Object containing a rule. Each rule must be valid for the validated value instance, so that the semantic check is successful. More details in "Meta_Rules.md".

name

Optional. Has always a string as value.

Same as the property "name" from Schema.org (meta information about the entity).

description

Optional. Has always a string as value.

Same as the property "description" from Schema.org (meta information about the entity).

The values in this array are always strings, which indicate the class or classes (multi-typed entities) from Schema.org which is/are referenced here. The classes are specified in a short form instead of the URI ("Hotel" instead of "").

Based on "sh:closed" from SHACL, and "additionalProperties" from JSON Schema. Not to be confused with

https://schema.org/Hotel
https://schema.org/additionalProperty
Syntax diagram