# The starter model. An abstract parent contributing a key, a mixin contributing a
# shared property, and three edges. Everything else builds on this shape.
lpg: "1.0"
namespace:
  prefix: social
  iri: https://example.org/vocab/social#

mixins:
  Timestamped:
    id: m_stamp
    props:
      createdAt: { id: p_creat, type: ZONED_DATETIME, required: true }

nodes:
  # Abstract: no table, no instances. It contributes its key to every descendant.
  Party:
    id: n_party
    abstract: true
    key: [id]
    props:
      id: { id: p_pid, type: STRING, required: true }

  Person:
    id: n_person
    extends: Party
    mixins: [Timestamped]
    props:
      email: { id: p_mail, type: STRING, required: true, unique: true }
      born:  { id: p_born, type: DATE }

  Company:
    id: n_comp
    extends: Party
    props:
      vat: { id: p_vat, type: STRING }

  Car:
    id: n_car
    key: [vin]
    props:
      vin:   { id: p_vin, type: STRING, required: true }
      seats: { id: p_seat, type: INTEGER }

edges:
  # An abstract endpoint: both Person and Company may own a car.
  OWNS:
    id: e_owns
    from: Party
    to: Car
    props:
      since: { id: p_since, type: DATE }

  KNOWS:
    id: e_knows
    from: Person
    to: Person
    props:
      since: { id: p_ksince, type: DATE }

  # No properties, so RDF keeps it a plain object property rather than reifying it.
  LIKES:
    id: e_likes
    from: Person
    to: Company
