I'm just getting started with TypeDB and have a basic question about the schema concepts:
How would I model that a Person has an Address? I.e. a composite attribute like an address that is composed of 3 values:
My understanding is that an attribute can have exactly ONE value definition, but it can own any number of other attributes.
My attempts:
street sub attribute, value string;
city sub attribute, value string;
zip sub attribute, value long;
address sub attribute,
// value ... (does not make sense here) ???
owns street,
owns city,
owns zip;
person sub entity,
owns address;
address sub relation,
relates street,
relates city,
relates zip,
relates subject; // ???
person sub entity,
plays address:subject;
address sub entity,
owns street,
owns city,
owns zip;
person sub entity,
owns address; // ??? is owning another entity possible?
Which one (if any) would be the recommended way to go?
An address works best as an entity because, as @2bigpigs said, an address is an entity as it has a distinct existence in the domain. Other examples of an entity include an organisation, a location or a person. You can see that an address fits right in among those.