■ Nouns

■ Nouns

Nouns are the things in a Graph. Every Noun has Properties that describe its attributes. Nouns relate to each other through Verbs. Triggers are the potential Events that can happen to a Noun. A Resource is a specific instance of a Noun.

Defining a Noun

The simple syntax for defining a Noun is:

${_icon} ${_name}: ${_description} (${_type})

So this example:

☁️ SaaS: Software as a Service (WebApplication)

Is the same as the full syntax:

SaaS:
  _id: saas
  _name: SaaS
  _icon: ☁️
  _description: Software as a Service
  _type: https://schema.org/WebApplication

Internal Properties

Properties that start with an underscore (_) are internal properties of a noun that provide semantic and functional information about the Noun.

_id

The _id property is the unique identifier for the Noun. It is used to reference the Noun in other parts of the Graph. It is also used to generate the URL for the Noun's representation in the App, API, Site, and Docs.

SaaS:
  _id: saas
  _name: SaaS
  _icon: ☁️
  _description: Software as a Service
  _type: https://schema.org/WebApplication

_name

The _name property is the name of the Noun. It is used to generate the human-readable title of the Noun's representation in the App, API, Site, and Docs.

SaaS:
  _id: saas
  _name: SaaS
  _icon: ☁️
  _description: Software as a Service
  _type: https://schema.org/WebApplication

_icon

The _icon property is the icon of the Noun. It provides the visual representation of the Noun in the App, API, Site, and Docs.

SaaS:
  _id: saas
  _name: SaaS
  _icon: ☁️
  _description: Software as a Service
  _type: https://schema.org/WebApplication

_description

The _description property is the description of the Noun. It is used to generate the human-readable description of the Noun's representation in the App, API, Site, and Docs.

SaaS:
  _id: saas
  _name: SaaS
  _icon: ☁️
  _description: Software as a Service
  _type: https://schema.org/WebApplication

_type

The _type property is the base class that Noun inherits from. It can be another Noun in the Graph, a Noun that was [imported], the name or URL of the Thing on Schema.org, or the URL of any JSON Schema or TypeScript Type. All Properties on the base Noun are inherited by the Noun.

SaaS:
  _id: saas
  _name: SaaS
  _icon: ☁️
  _description: Software as a Service
  _type: https://schema.org/WebApplication

_sameAs

The _sameAs property is the URL of the Noun's representation in Schema.org. It provides the synonymous or canonical representation of the Noun without inheriting any of the properties of the referenced Noun. This is useful for defining Nouns where you don't want to inherit all of the properties of the referenced Noun.

SaaS:
  _id: saas
  _name: SaaS
  _icon: ☁️
  _description: Software as a Service
  _sameAs: https://schema.org/WebApplication

_source

The _source property is the URL of the Noun's source data. A Noun with a _source property implies it is a read-only Noun in a Graph, so it's resources cannot be modified. It is useful for defining Nouns with Resources that are imported from external sources.

Country:
  _plural: Countries
  _source: https://json.fyi/countries.json
  _id:     cca2
  _name:   name.common
  _icon:   🌎

_seed

The _seed property is the URL of the Noun's seed data. A Noun with a _seed property gets its initial Resources seeded from the data at the URL, but Resources can be created, updated, and deleted.

Product:
  _id:   entityId
  _name: productName
  _seed: https://json.fyi/northwind/products.json

_state

The _state property of a Noun is a Finite State Machine and the _state of a Resource represents it's current state and context.

Switch:
  _state:
    initial: inactive
    states:
      inactive:
        on:
          toggle: active
      active:
        on:
          toggle: inactive
       

Properties

Calculated Properties

Property References

Properties can be calculated by referencing other properties in the Noun like _id: iata

Colo:
 _id:     iata
 _source: https://speed.cloudflare.com/locations
 iata:    string

String Literals

Properties can be calculated by using string literals like _name: ${iata} - ${city}, ${cca2}, ${region}

Colo:
_name:   ${iata} - ${city}, ${cca2}, ${region}
_source: https://speed.cloudflare.com/locations

JavaScript Functions

Calculated Properties can be written JavaScript expressions like Date.now() + 1000 * 60 * 60 * 24 * 30

Cache:
  expires: Date.now() + 1000 * 60 * 60 * 24 * 30

Relationships

A Noun can have several different types of relationships with another Noun

Embedded One-to-One

By referencing a Noun directly as the type, without a . or -> then the referenced Noun is embedded in the document as a property of the parent Noun.

Colo:
 _id:     iata
 _source: https://speed.cloudflare.com/locations
 iata:    string

Reference One-to-One

Embedded One-to-Many

Reference One-to-Many

Lookup One-to-Many

Reference Many-to-Many

Lookup Many-to-Many

Schema.org

Schema.org was created by Google, Microsoft, and other search engines as way to standardize the way that data is structured on the web.