Documentation
¶
Index ¶
- func CreateFile(fname string) (*os.File, error)
- func WalkFamilyLines(keyPerson *model.Person) []*model.FamilyLine
- type Annotations
- func (o *Annotations) Add(kind string, id string, field string, value any) error
- func (o *Annotations) ApplyPerson(p *model.Person) error
- func (o *Annotations) ApplyPlace(p *model.Place) error
- func (o *Annotations) ApplySource(p *model.Source) error
- func (a *Annotations) MarshalJSON() ([]byte, error)
- func (o *Annotations) Replace(kind string, id string, field string, value any) error
- func (o *Annotations) Set(kind, id, field string, value any) error
- func (a *Annotations) UnmarshalJSON(data []byte) error
- type AnnotationsJSON
- type Config
- type Loader
- type ObjectAnnotationsJSON
- type PersonAnnotation
- type PersonMeta
- type PlaceAnnotation
- type SourceAnnotation
- type SurnameGroup
- type SurnameGroups
- type Tree
- func (t *Tree) AddPlaceAdjectives(pl *model.Place) error
- func (t *Tree) AddSpouses(f *model.Family) error
- func (t *Tree) ApplyPeopleMatching(m model.PersonMatcher, fn model.PersonActionFunc) error
- func (t *Tree) BuildOlb(p *model.Person) error
- func (t *Tree) BuildRelationsToKeyPerson()
- func (t *Tree) CanonicalID(scope string, sid string) string
- func (t *Tree) CrossReferenceCitations(p *model.Person)
- func (t *Tree) ExpandPersonTimeline(p *model.Person) error
- func (t *Tree) FindCitation(scope string, sid string) (*model.GeneralCitation, bool)
- func (t *Tree) FindFamily(scope string, sid string) *model.Family
- func (t *Tree) FindFamilyByParents(father *model.Person, mother *model.Person) *model.Family
- func (t *Tree) FindFamilyOneParent(parent *model.Person, child *model.Person) *model.Family
- func (t *Tree) FindMediaObject(path string) *model.MediaObject
- func (t *Tree) FindPerson(scope string, sid string) *model.Person
- func (t *Tree) FindPlace(scope string, sid string) *model.Place
- func (t *Tree) FindPlaceUnstructured(name string, hints ...place.Hint) *model.Place
- func (t *Tree) FindRepository(scope string, sid string) *model.Repository
- func (t *Tree) FindSource(scope string, sid string) *model.Source
- func (t *Tree) Generate(redactLiving bool) error
- func (t *Tree) GetCitation(id string) (*model.GeneralCitation, bool)
- func (t *Tree) GetPerson(id string) (*model.Person, bool)
- func (t *Tree) GetPlace(id string) (*model.Place, bool)
- func (t *Tree) GetSource(id string) (*model.Source, bool)
- func (t *Tree) InferFamilyRelationships(f *model.Family) error
- func (t *Tree) InferFamilyStartEndDates(f *model.Family) error
- func (t *Tree) ListPeopleMatching(m model.PersonMatcher, limit int) []*model.Person
- func (t *Tree) ListPlacesMatching(m model.PlaceMatcher, limit int) []*model.Place
- func (t *Tree) PropagateParents(p *model.Person) error
- func (t *Tree) Redact(redactLiving bool) error
- func (t *Tree) RefineFamilyNames(f *model.Family) error
- func (t *Tree) RefinePersonNames(p *model.Person) error
- func (t *Tree) RefinePersonOccupations(p *model.Person) error
- func (t *Tree) RefinePlaceNames(pl *model.Place) error
- func (t *Tree) SelectPersonBestBirthDeathEvents(p *model.Person) error
- func (t *Tree) SetKeyPerson(p *model.Person)
- func (t *Tree) TrimCitationEventsCited(c *model.GeneralCitation) error
- func (t *Tree) TrimCitationPeopleCited(c *model.GeneralCitation) error
- func (t *Tree) TrimPersonTimeline(p *model.Person) error
- func (t *Tree) TrimPlaceTimeline(p *model.Place) error
- func (t *Tree) TrimSourceTimeline(s *model.Source) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WalkFamilyLines ¶ added in v0.0.3
func WalkFamilyLines(keyPerson *model.Person) []*model.FamilyLine
WalkFamilyLines traverses the ancestor tree of keyPerson, following the paternal line at each generation and pushing maternal branches onto a stack. It returns one FamilyLine per direct line found.
Types ¶
type Annotations ¶
type Annotations struct {
// contains filtered or unexported fields
}
func LoadAnnotations ¶
func LoadAnnotations(filename string) (*Annotations, error)
func (*Annotations) ApplyPerson ¶
func (o *Annotations) ApplyPerson(p *model.Person) error
func (*Annotations) ApplyPlace ¶
func (o *Annotations) ApplyPlace(p *model.Place) error
func (*Annotations) ApplySource ¶
func (o *Annotations) ApplySource(p *model.Source) error
func (*Annotations) MarshalJSON ¶
func (a *Annotations) MarshalJSON() ([]byte, error)
func (*Annotations) Set ¶ added in v0.0.3
func (o *Annotations) Set(kind, id, field string, value any) error
Set applies a field value to the named kind/id, trying Replace first then Add.
func (*Annotations) UnmarshalJSON ¶
func (a *Annotations) UnmarshalJSON(data []byte) error
type AnnotationsJSON ¶
type AnnotationsJSON struct {
People []ObjectAnnotationsJSON `json:"people,omitempty"`
Places []ObjectAnnotationsJSON `json:"places,omitempty"`
Sources []ObjectAnnotationsJSON `json:"sources,omitempty"`
}
type Config ¶ added in v0.0.3
type Config struct {
ID string
Name string
Description string
SurnameGroups *SurnameGroups
Annotations *Annotations
}
Config holds the configuration for a tree.
func ReadConfig ¶ added in v0.0.3
ReadConfig reads a KDL config file and returns a *Config.
type ObjectAnnotationsJSON ¶
type PersonAnnotation ¶
type PersonMeta ¶
type PersonMeta struct {
Comment string
Annotations []PersonAnnotation
}
type PlaceAnnotation ¶
type SourceAnnotation ¶
type SurnameGroup ¶ added in v0.0.3
type SurnameGroup struct {
Surname string // canonical surname for this group
Names []string // sorted list of surnames in group other than the canonical one
}
func (*SurnameGroup) String ¶ added in v0.0.3
func (g *SurnameGroup) String() string
type SurnameGroups ¶ added in v0.0.3
type SurnameGroups struct {
// contains filtered or unexported fields
}
func LoadSurnameGroups ¶ added in v0.0.3
func LoadSurnameGroups(filename string) (*SurnameGroups, error)
func (*SurnameGroups) AddGroup ¶ added in v0.0.3
func (sg *SurnameGroups) AddGroup(canonical string, variants []string)
AddGroup registers a canonical surname and its variants in the group map.
func (*SurnameGroups) Lookup ¶ added in v0.0.3
func (sg *SurnameGroups) Lookup(name string) (*SurnameGroup, bool)
Lookup returns the SurnameGroup for the given name (canonical or variant), or nil if not found.
func (*SurnameGroups) UnmarshalJSON ¶ added in v0.0.3
func (sg *SurnameGroups) UnmarshalJSON(data []byte) error
type Tree ¶
type Tree struct {
ID string
Name string
Description string
Annotations *Annotations
SurnameGroups *SurnameGroups
People map[string]*model.Person
Citations map[string]*model.GeneralCitation
Sources map[string]*model.Source
Repositories map[string]*model.Repository
Places map[string]*model.Place
Families map[string]*model.Family
MediaObjects map[string]*model.MediaObject
KeyPerson *model.Person
}
func NewTree ¶
func NewTree(id string, a *Annotations, sg *SurnameGroups) *Tree
func (*Tree) AddPlaceAdjectives ¶ added in v0.0.3
func (*Tree) ApplyPeopleMatching ¶
func (t *Tree) ApplyPeopleMatching(m model.PersonMatcher, fn model.PersonActionFunc) error
ApplyPeopleMatching applies fn to each person that matches m until fn returns false or an error which is returned if encountered
func (*Tree) BuildRelationsToKeyPerson ¶
func (t *Tree) BuildRelationsToKeyPerson()
func (*Tree) CrossReferenceCitations ¶
func (*Tree) FindCitation ¶
func (*Tree) FindFamilyByParents ¶
func (*Tree) FindFamilyOneParent ¶
func (*Tree) FindMediaObject ¶
func (t *Tree) FindMediaObject(path string) *model.MediaObject
func (*Tree) FindPlaceUnstructured ¶
func (*Tree) FindRepository ¶
func (t *Tree) FindRepository(scope string, sid string) *model.Repository
func (*Tree) GetCitation ¶
func (t *Tree) GetCitation(id string) (*model.GeneralCitation, bool)
func (*Tree) InferFamilyRelationships ¶
func (*Tree) InferFamilyStartEndDates ¶
func (*Tree) ListPeopleMatching ¶
func (*Tree) ListPlacesMatching ¶
func (*Tree) RefineFamilyNames ¶ added in v0.0.3
func (*Tree) RefinePersonOccupations ¶
func (*Tree) RefinePlaceNames ¶ added in v0.0.3
func (*Tree) SelectPersonBestBirthDeathEvents ¶
func (*Tree) SetKeyPerson ¶
func (*Tree) TrimCitationEventsCited ¶
func (t *Tree) TrimCitationEventsCited(c *model.GeneralCitation) error
func (*Tree) TrimCitationPeopleCited ¶
func (t *Tree) TrimCitationPeopleCited(c *model.GeneralCitation) error