Skip to content

Full schema preview
initial_schema/place/place.esdl
# abstract object types
abstract type Place {
    required name: str {
        delegated constraint exclusive;
    };
}

# object types
type Landmark extending Place;
type Location extending Place;
type Store extending Place;

Abstract object types

Place為一抽象概念的abstract object type,只有一個必填的name property。其有一個delegated constraint exclusiveconstraint,這與constraint exclusive不同。如果加上delegated,代表exclusive是會施加在後續各個extending Placeobject type上。

舉例來說,假如LandmarkLocationextending Place,而我們想生成一個名叫有間客棧object

  • 使用delegated constraint exclusive,可以讓我們同時生成一個name有間客棧Landmark及一個name有間客棧Location

  • 使用constraint exclusive,只能生成一個name有間客棧Landmark一個name有間客棧Location

Place

abstract type Place {
    required name: str {
        delegated constraint exclusive;
    };
}

Object types

Landmark

Landmark用來代表知名度較高的地標。

type Landmark extending Place;

Location

Location用來代表一般地點。

type Location extending Place;

Store

Store用來代表店鋪。

type Store extending Place;