This function will return all of the "ancestor" entries of the specified entry/entries.
Ancestors are defined as any entries that can be reached by following "IS A" relationships. For example, if Orca is an Oceanic dolphin, and Oceanic dolphin is a Mammal, then the ancestors of Orca are Oceanic dolphin and Mammal.
The result will include an annotation for "distance", which indicates how many "IS A" relationships there are between the original entry and the ancestor (see examples below). By default, the resulting ancestors will be sorted by distance, with the closest ancestors first.
First argument: an Entry or a set of Entries, whose ancestors we want to retrieve.
Ancestors of a specific entry:entry("demo-orca").ancestors()
Ancestors of a specific entry, and their "distance" from the original entry:entry("demo-orca").ancestors().map(apply=(entry -> entry.annotate(detail=entry.distance)))
- FOceanic dolphin(1)
- FOceanic dolphin
Ancestors of the current entry:
Ancestors of a multiple entries:[entry("demo-orca"), entry("demo-elk")].ancestors()
The elk is a type of Deer, and the orca is a type of Oceanic dolphin, and both are mammals, so we get the combined ancestors as seen above, in order of distance.
Ancestors of a multiple entries, on a graph:[entry("demo-orca"), entry("demo-elk")].ancestors().graph()
It's common to use
this.ancestors()when defining Property defaults / automatic properties, but we can't show a clickable demo here because this entry (about "ancestors()") doesn't have ancestors.