elliotchance / gedcom

👪 A Go library and CLI tools for encoding, decoding, traversing, merging, comparing, querying and publishing GEDCOM files.
MIT License
97 stars 22 forks source link

Adding NodesWithTagPath() to q #303

Closed elliotchance closed 4 years ago

elliotchance commented 4 years ago

NodesWithTagPath returns all of the nodes that have an exact tag path. The number of nodes returned can be zero and tag must match the tag path completely and exactly.

Find all Death nodes that belong to all individuals:

.Individuals | NodesWithTagPath("DEAT")

From the individuals find all the Date nodes within only the Birth nodes.

.Individuals | NodesWithTagPath("BIRT", "DATE")

Combine all of the birth and death dates:

Births are .Individuals | NodesWithTagPath("BIRT", "DATE") | {type: "birth", date: .String};
Deaths are .Individuals | NodesWithTagPath("DEAT", "DATE") | {type: "death", date: .String};
Combine(Births, Deaths)

Fixes #300


This change is Reviewable