The RelationshipCalculator Class¶
Classes for relationships.
- class gramps.gen.relationship.RelationshipCalculator[source]¶
Bases:
objectThe relationship calculator helps to determine the relationship between two people.
- DIST_AUNT = 'distant %(step)saunt%(inlaw)s'¶
- DIST_CHILD = 'distant %(step)sdescendant (%(level)d generations)'¶
- DIST_DAUGHTER = 'distant %(step)sdescendant%(inlaw)s (%(level)d generations)'¶
- DIST_FATHER = 'distant %(step)sancestor%(inlaw)s (%(level)d generations)'¶
- DIST_MOTHER = 'distant %(step)sancestor%(inlaw)s (%(level)d generations)'¶
- DIST_NEPHEW = 'distant %(step)snephew%(inlaw)s'¶
- DIST_NIECE = 'distant %(step)sniece%(inlaw)s'¶
- DIST_SIB = 'distant %(step)suncle/aunt%(inlaw)s'¶
- DIST_SON = 'distant %(step)sdescendant%(inlaw)s (%(level)d generations)'¶
- DIST_UNCLE = 'distant %(step)suncle%(inlaw)s'¶
- HALF = 'half-'¶
- HALF_SIB_FATHER = 2¶
- HALF_SIB_MOTHER = 1¶
- INLAW = '-in-law'¶
- NORM_SIB = 0¶
- PARTNER_CIVIL_UNION = 3¶
- PARTNER_EX_CIVIL_UNION = 7¶
- PARTNER_EX_MARRIED = 5¶
- PARTNER_EX_UNKNOWN_REL = 8¶
- PARTNER_EX_UNMARRIED = 6¶
- PARTNER_MARRIED = 1¶
- PARTNER_UNKNOWN_REL = 4¶
- PARTNER_UNMARRIED = 2¶
- REL_FAM_BIRTH = 'a'¶
- REL_FAM_BIRTH_FATH_ONLY = 'c'¶
- REL_FAM_BIRTH_MOTH_ONLY = 'b'¶
- REL_FAM_INLAW_PREFIX = 'L'¶
- REL_FAM_NONBIRTH = 'A'¶
- REL_FATHER = 'f'¶
- REL_FATHER_NOTBIRTH = 'F'¶
- REL_MOTHER = 'm'¶
- REL_MOTHER_NOTBIRTH = 'M'¶
- REL_SIBLING = 's'¶
- STEP = 'step'¶
- STEP_SIB = 3¶
- UNKNOWN_SIB = 4¶
- collapse_relations(relations)[source]¶
Internal method to condense the relationships as returned by get_relationship_distance_new. Common ancestors in the same family are collapsed to one entry, changing the person paths to family paths, eg ‘mf’ and ‘mm’ become ‘ma’
- relationslist of relations as returned by
get_relationship_distance_new with all_dist = True
- returnsthe same data as relations, but collapsed, hence the
handle entry is now a list of handles, and the path to common ancestors can now contain family identifiers (eg ‘a’, …) In the case of sibling, this is replaced by family with common ancestor handles empty list []!
- connect_db_signals(dbstate)[source]¶
We can save work by storing a map, however, if database changes this map must be regenerated. Before close, the calling app must call disconnect_db_signals
- disconnect_db_signals(dbstate)[source]¶
Method to disconnect to all signals the relationship calculator is subscribed
- get_all_relationships(db, orig_person, other_person)[source]¶
Return a tuple, of which the first entry is a list with all relationships in text, and the second a list of lists of all common ancestors that have that text as relationship
- get_birth_parents(db, person)[source]¶
Method that returns the birthparents of a person as tuple (mother handle, father handle), if no known birthparent, the handle is replaced by None
- get_one_relationship(db, orig_person, other_person, extra_info=False, olocale=<gramps.gen.utils.grampslocale.GrampsLocale object>)[source]¶
Returns a string representing the most relevant relationship between the two people. If extra_info = True, extra information is returned: (relation_string, distance_common_orig, distance_common_other)
If olocale is passed in (a GrampsLocale) that language will be used.
- Parameters:
olocale (a GrampsLocale instance) – allow selection of the relationship language
- get_partner_relationship_string(spouse_type, gender_a, gender_b)[source]¶
Determine the string giving the relation between two partners of type spouse_type. Eg: b is the spouse of a Here ‘spouse’ is the string we need to determine
Warning
DON’T TRANSLATE THIS PROCEDURE IF LOGIC IS EQUAL IN YOUR LANGUAGE, AS GETTEXT IS ALREADY USED !
- get_plural_relationship_string(Ga, Gb, reltocommon_a='', reltocommon_b='', only_birth=True, in_law_a=False, in_law_b=False)[source]¶
Provide a string that describes the relationsip between a person, and a group of people with the same relationship. E.g. “grandparents” or “children”.
Ga and Gb can be used to mathematically calculate the relationship.
- Parameters:
Ga (int) – The number of generations between the main person and the common ancestor.
Gb (int) – The number of generations between the group of people and the common ancestor
reltocommon_a (str) – relation path to common ancestor or common Family for person a. Note that length = Ga
reltocommon_b (str) – relation path to common ancestor or common Family for person b. Note that length = Gb
only_birth (bool) – True if relation between a and b is by birth only False otherwise
in_law_a (bool) – True if path to common ancestors is via the partner of person a
in_law_b (bool) – True if path to common ancestors is via the partner of person b
- Returns:
A string describing the relationship between the person and the group.
- Return type:
str
- get_relationship_distance_new(db, orig_person, other_person, all_families=False, all_dist=False, only_birth=True)[source]¶
Return if all_dist == True a ‘tuple, string’: (rank, person handle, firstRel_str, firstRel_fam, secondRel_str, secondRel_fam), msg or if all_dist == True a ‘list of tuple, string’: […..], msg:
Note
_new can be removed once all rel_xx modules no longer overwrite get_relationship_distance
The tuple or list of tuples consists of:
Element
Description
rank
Total number of generations from common ancestor to the two persons, rank is -1 if no relations found
person_handle
The Common ancestor
firstRel_str
String with the path to the common ancestor from orig Person
firstRel_fam
Family numbers along the path as a list, eg [0,0,1]. For parent in multiple families, eg [0. [0, 2], 1]
secondRel_str
String with the path to the common ancestor from otherPerson
secondRel_fam
Family numbers along the path, eg [0,0,1]. For parent in multiple families, eg [0. [0, 2], 1]
msg
List of messages indicating errors. Empyt list if no errors.
Example: firstRel_str = ‘ffm’ and firstRel_fam = [2,0,1] means common ancestor is mother of the second family of the father of the first family of the father of the third family.
Note that the same person might be present twice if the person is reached via a different branch too. Path (firstRel_str and secondRel_str) will of course be different.
- Parameters:
db – database to work on
orig_person (Person Obj) – first person
other_person (Person Obj) – second person, relation is sought between first and second person
all_families (bool) – if False only Main family is searched, otherwise all families are used
all_dist (bool) – if False only the shortest distance is returned, otherwise all relationships
only_birth (bool) – if True only parents with birth relation are considered
- get_sibling_relationship_string(sib_type, gender_a, gender_b, in_law_a=False, in_law_b=False)[source]¶
Determine the string giving the relation between two siblings of type sib_type. Eg: b is the brother of a Here ‘brother’ is the string we need to determine This method gives more details about siblings than get_single_relationship_string can do.
Warning
DON’T TRANSLATE THIS PROCEDURE IF LOGIC IS EQUAL IN YOUR LANGUAGE, AND SAME METHODS EXIST (get_uncle, get_aunt, get_sibling)
- get_sibling_type(db, orig, other)[source]¶
Translation free determination of type of orig and other as siblings The procedure returns sibling types, these can be passed to get_sibling_relationship_string. Only call this method if known that orig and other are siblings
- get_single_relationship_string(Ga, Gb, gender_a, gender_b, reltocommon_a, reltocommon_b, only_birth=True, in_law_a=False, in_law_b=False)[source]¶
Provide a string that describes the relationsip between a person, and another person. E.g. “grandparent” or “child”.
To be used as: ‘person b is the grandparent of a’, this will be in translation string: ‘person b is the %(relation)s of a’
Note that languages with gender should add ‘the’ inside the translation, so eg in french: ‘person b est %(relation)s de a’ where relation will be here: le grandparent
Ga and Gb can be used to mathematically calculate the relationship.
Some languages need to know the specific path to the common ancestor. Those languages should use reltocommon_a and reltocommon_b which is a string like ‘mfmf’.
The possible string codes are:
Code
Description
REL_MOTHER
# going up to mother
REL_FATHER
# going up to father
REL_MOTHER_NOTBIRTH
# going up to mother, not birth relation
REL_FATHER_NOTBIRTH
# going up to father, not birth relation
REL_FAM_BIRTH
# going up to family (mother and father)
REL_FAM_NONBIRTH
# going up to family, not birth relation
REL_FAM_BIRTH_MOTH_ONLY
# going up to fam, only birth rel to mother
REL_FAM_BIRTH_FATH_ONLY
# going up to fam, only birth rel to father
Prefix codes are stripped, so REL_FAM_INLAW_PREFIX is not present. If the relation starts with the inlaw of the person a, then ‘in_law_a’ is True, if it starts with the inlaw of person b, then ‘in_law_b’ is True.
Also REL_SIBLING (# going sideways to sibling (no parents)) is not passed to this routine. The collapse_relations changes this to a family relation.
Hence, calling routines should always strip REL_SIBLING and REL_FAM_INLAW_PREFIX before calling get_single_relationship_string() Note that only_birth=False, means that in the reltocommon one of the NOTBIRTH specifiers is present.
The REL_FAM identifiers mean that the relation is not via a common ancestor, but via a common family (note that that is not possible for direct descendants or direct ancestors!). If the relation to one of the parents in that common family is by birth, then ‘only_birth’ is not set to False. The only_birth() method is normally used for this.
- Parameters:
Ga (int) – The number of generations between the main person and the common ancestor.
Gb (int) – The number of generations between the other person and the common ancestor.
gender_a (int gender) – gender of person a
gender_b (int gender) – gender of person b
reltocommon_a (str) – relation path to common ancestor or common Family for person a. Note that length = Ga
reltocommon_b (str) – relation path to common ancestor or common Family for person b. Note that length = Gb
in_law_a (bool) – True if path to common ancestors is via the partner of person a
in_law_b (bool) – True if path to common ancestors is via the partner of person b
only_birth (bool) – True if relation between a and b is by birth only False otherwise
- Returns:
A string describing the relationship between the two people
- Return type:
str
Note
the self.REL_SIBLING should not be passed to this routine, so we should not check on it. All other self.
for better determination of siblings, use if Ga=1=Gb get_sibling_relationship_string
Localized Handlers¶
Relationship (Czech)¶
- class gramps.plugins.rel.rel_cs.RelationshipCalculator[source]¶
Bases:
RelationshipCalculatorRelationshipCalculator Class
- get_relationship(secondRel, firstRel, orig_person_gender, other_person_gender)[source]¶
Return a string representing the relationshp between the two people, along with a list of common ancestors (typically father,mother)
Special cases: relation strings “”, “undefined” and “spouse”.
- get_sibling_relationship_string(sib_type, gender_a, gender_b, in_law_a=False, in_law_b=False)[source]¶
Determine the string giving the relation between two siblings of type sib_type. Eg: b is the brother of a Here ‘brother’ is the string we need to determine This method gives more details about siblings than get_single_relationship_string can do.
Warning
DON’T TRANSLATE THIS PROCEDURE IF LOGIC IS EQUAL IN YOUR LANGUAGE, AND SAME METHODS EXIST (get_uncle, get_aunt, get_sibling)
- get_single_relationship_string(Ga, Gb, gender_a, gender_b, reltocommon_a, reltocommon_b, only_birth=True, in_law_a=False, in_law_b=False)[source]¶
Provide a string that describes the relationsip between a person, and another person. E.g. “grandparent” or “child”.
To be used as: ‘person b is the grandparent of a’, this will be in translation string: ‘person b is the %(relation)s of a’
Note that languages with gender should add ‘the’ inside the translation, so eg in french: ‘person b est %(relation)s de a’ where relation will be here: le grandparent
Ga and Gb can be used to mathematically calculate the relationship.
Some languages need to know the specific path to the common ancestor. Those languages should use reltocommon_a and reltocommon_b which is a string like ‘mfmf’.
The possible string codes are:
Code
Description
REL_MOTHER
# going up to mother
REL_FATHER
# going up to father
REL_MOTHER_NOTBIRTH
# going up to mother, not birth relation
REL_FATHER_NOTBIRTH
# going up to father, not birth relation
REL_FAM_BIRTH
# going up to family (mother and father)
REL_FAM_NONBIRTH
# going up to family, not birth relation
REL_FAM_BIRTH_MOTH_ONLY
# going up to fam, only birth rel to mother
REL_FAM_BIRTH_FATH_ONLY
# going up to fam, only birth rel to father
Prefix codes are stripped, so REL_FAM_INLAW_PREFIX is not present. If the relation starts with the inlaw of the person a, then ‘in_law_a’ is True, if it starts with the inlaw of person b, then ‘in_law_b’ is True.
Also REL_SIBLING (# going sideways to sibling (no parents)) is not passed to this routine. The collapse_relations changes this to a family relation.
Hence, calling routines should always strip REL_SIBLING and REL_FAM_INLAW_PREFIX before calling get_single_relationship_string() Note that only_birth=False, means that in the reltocommon one of the NOTBIRTH specifiers is present.
The REL_FAM identifiers mean that the relation is not via a common ancestor, but via a common family (note that that is not possible for direct descendants or direct ancestors!). If the relation to one of the parents in that common family is by birth, then ‘only_birth’ is not set to False. The only_birth() method is normally used for this.
- Parameters:
Ga (int) – The number of generations between the main person and the common ancestor.
Gb (int) – The number of generations between the other person and the common ancestor.
gender_a (int gender) – gender of person a
gender_b (int gender) – gender of person b
reltocommon_a (str) – relation path to common ancestor or common Family for person a. Note that length = Ga
reltocommon_b (str) – relation path to common ancestor or common Family for person b. Note that length = Gb
in_law_a (bool) – True if path to common ancestors is via the partner of person a
in_law_b (bool) – True if path to common ancestors is via the partner of person b
only_birth (bool) – True if relation between a and b is by birth only False otherwise
- Returns:
A string describing the relationship between the two people
- Return type:
str
Note
the self.REL_SIBLING should not be passed to this routine, so we should not check on it. All other self.
for better determination of siblings, use if Ga=1=Gb get_sibling_relationship_string
Relationship (Danish)¶
- class gramps.plugins.rel.rel_da.RelationshipCalculator[source]¶
Bases:
RelationshipCalculatorRelationshipCalculator Class
- get_sibling_relationship_string(sib_type, gender_a, gender_b, in_law_a=False, in_law_b=False)[source]¶
Determine the string giving the relation between two siblings of type sib_type. Eg: b is the brother of a Here ‘brother’ is the string we need to determine This method gives more details about siblings than get_single_relationship_string can do.
Warning
DON’T TRANSLATE THIS PROCEDURE IF LOGIC IS EQUAL IN YOUR LANGUAGE, AND SAME METHODS EXIST (get_uncle, get_aunt, get_sibling)
- get_single_relationship_string(Ga, Gb, gender_a, gender_b, reltocommon_a, reltocommon_b, only_birth=True, in_law_a=False, in_law_b=False)[source]¶
Provide a string that describes the relationsip between a person, and another person. E.g. “grandparent” or “child”.
To be used as: ‘person b is the grandparent of a’, this will be in translation string: ‘person b is the %(relation)s of a’
Note that languages with gender should add ‘the’ inside the translation, so eg in french: ‘person b est %(relation)s de a’ where relation will be here: le grandparent
Ga and Gb can be used to mathematically calculate the relationship.
Some languages need to know the specific path to the common ancestor. Those languages should use reltocommon_a and reltocommon_b which is a string like ‘mfmf’.
The possible string codes are:
Code
Description
REL_MOTHER
# going up to mother
REL_FATHER
# going up to father
REL_MOTHER_NOTBIRTH
# going up to mother, not birth relation
REL_FATHER_NOTBIRTH
# going up to father, not birth relation
REL_FAM_BIRTH
# going up to family (mother and father)
REL_FAM_NONBIRTH
# going up to family, not birth relation
REL_FAM_BIRTH_MOTH_ONLY
# going up to fam, only birth rel to mother
REL_FAM_BIRTH_FATH_ONLY
# going up to fam, only birth rel to father
Prefix codes are stripped, so REL_FAM_INLAW_PREFIX is not present. If the relation starts with the inlaw of the person a, then ‘in_law_a’ is True, if it starts with the inlaw of person b, then ‘in_law_b’ is True.
Also REL_SIBLING (# going sideways to sibling (no parents)) is not passed to this routine. The collapse_relations changes this to a family relation.
Hence, calling routines should always strip REL_SIBLING and REL_FAM_INLAW_PREFIX before calling get_single_relationship_string() Note that only_birth=False, means that in the reltocommon one of the NOTBIRTH specifiers is present.
The REL_FAM identifiers mean that the relation is not via a common ancestor, but via a common family (note that that is not possible for direct descendants or direct ancestors!). If the relation to one of the parents in that common family is by birth, then ‘only_birth’ is not set to False. The only_birth() method is normally used for this.
- Parameters:
Ga (int) – The number of generations between the main person and the common ancestor.
Gb (int) – The number of generations between the other person and the common ancestor.
gender_a (int gender) – gender of person a
gender_b (int gender) – gender of person b
reltocommon_a (str) – relation path to common ancestor or common Family for person a. Note that length = Ga
reltocommon_b (str) – relation path to common ancestor or common Family for person b. Note that length = Gb
in_law_a (bool) – True if path to common ancestors is via the partner of person a
in_law_b (bool) – True if path to common ancestors is via the partner of person b
only_birth (bool) – True if relation between a and b is by birth only False otherwise
- Returns:
A string describing the relationship between the two people
- Return type:
str
Note
the self.REL_SIBLING should not be passed to this routine, so we should not check on it. All other self.
for better determination of siblings, use if Ga=1=Gb get_sibling_relationship_string
Relationship (German)¶
- class gramps.plugins.rel.rel_de.RelationshipCalculator[source]¶
Bases:
RelationshipCalculatorRelationshipCalculator Class
- get_plural_relationship_string(Ga, Gb, reltocommon_a='', reltocommon_b='', only_birth=True, in_law_a=False, in_law_b=False)[source]¶
Provide a string that describes the relationsip between a person, and a group of people with the same relationship. E.g. “grandparents” or “children”.
Ga and Gb can be used to mathematically calculate the relationship.
- Parameters:
Ga (int) – The number of generations between the main person and the common ancestor.
Gb (int) – The number of generations between the group of people and the common ancestor
reltocommon_a (str) – relation path to common ancestor or common Family for person a. Note that length = Ga
reltocommon_b (str) – relation path to common ancestor or common Family for person b. Note that length = Gb
only_birth (bool) – True if relation between a and b is by birth only False otherwise
in_law_a (bool) – True if path to common ancestors is via the partner of person a
in_law_b (bool) – True if path to common ancestors is via the partner of person b
- Returns:
A string describing the relationship between the person and the group.
- Return type:
str
- get_sibling_relationship_string(sib_type, gender_a, gender_b, in_law_a=False, in_law_b=False)[source]¶
Determine the string giving the relation between two siblings of type sib_type. Eg: b is the brother of a Here ‘brother’ is the string we need to determine This method gives more details about siblings than get_single_relationship_string can do.
Warning
DON’T TRANSLATE THIS PROCEDURE IF LOGIC IS EQUAL IN YOUR LANGUAGE, AND SAME METHODS EXIST (get_uncle, get_aunt, get_sibling)
- get_single_relationship_string(Ga, Gb, gender_a, gender_b, reltocommon_a, reltocommon_b, only_birth=True, in_law_a=False, in_law_b=False)[source]¶
Provide a string that describes the relationsip between a person, and another person. E.g. “grandparent” or “child”.
To be used as: ‘person b is the grandparent of a’, this will be in translation string: ‘person b is the %(relation)s of a’
Note that languages with gender should add ‘the’ inside the translation, so eg in french: ‘person b est %(relation)s de a’ where relation will be here: le grandparent
Ga and Gb can be used to mathematically calculate the relationship.
Some languages need to know the specific path to the common ancestor. Those languages should use reltocommon_a and reltocommon_b which is a string like ‘mfmf’.
The possible string codes are:
Code
Description
REL_MOTHER
# going up to mother
REL_FATHER
# going up to father
REL_MOTHER_NOTBIRTH
# going up to mother, not birth relation
REL_FATHER_NOTBIRTH
# going up to father, not birth relation
REL_FAM_BIRTH
# going up to family (mother and father)
REL_FAM_NONBIRTH
# going up to family, not birth relation
REL_FAM_BIRTH_MOTH_ONLY
# going up to fam, only birth rel to mother
REL_FAM_BIRTH_FATH_ONLY
# going up to fam, only birth rel to father
Prefix codes are stripped, so REL_FAM_INLAW_PREFIX is not present. If the relation starts with the inlaw of the person a, then ‘in_law_a’ is True, if it starts with the inlaw of person b, then ‘in_law_b’ is True.
Also REL_SIBLING (# going sideways to sibling (no parents)) is not passed to this routine. The collapse_relations changes this to a family relation.
Hence, calling routines should always strip REL_SIBLING and REL_FAM_INLAW_PREFIX before calling get_single_relationship_string() Note that only_birth=False, means that in the reltocommon one of the NOTBIRTH specifiers is present.
The REL_FAM identifiers mean that the relation is not via a common ancestor, but via a common family (note that that is not possible for direct descendants or direct ancestors!). If the relation to one of the parents in that common family is by birth, then ‘only_birth’ is not set to False. The only_birth() method is normally used for this.
- Parameters:
Ga (int) – The number of generations between the main person and the common ancestor.
Gb (int) – The number of generations between the other person and the common ancestor.
gender_a (int gender) – gender of person a
gender_b (int gender) – gender of person b
reltocommon_a (str) – relation path to common ancestor or common Family for person a. Note that length = Ga
reltocommon_b (str) – relation path to common ancestor or common Family for person b. Note that length = Gb
in_law_a (bool) – True if path to common ancestors is via the partner of person a
in_law_b (bool) – True if path to common ancestors is via the partner of person b
only_birth (bool) – True if relation between a and b is by birth only False otherwise
- Returns:
A string describing the relationship between the two people
- Return type:
str
Note
the self.REL_SIBLING should not be passed to this routine, so we should not check on it. All other self.
for better determination of siblings, use if Ga=1=Gb get_sibling_relationship_string
Relationship (Spanish)¶
- class gramps.plugins.rel.rel_es.RelationshipCalculator[source]¶
Bases:
RelationshipCalculatorRelationshipCalculator Class
- get_plural_relationship_string(Ga, Gb, reltocommon_a='', reltocommon_b='', only_birth=True, in_law_a=False, in_law_b=False)[source]¶
Spanish version of method to create relation string - check relationship.py
Relationship (Finnish)¶
- class gramps.plugins.rel.rel_fi.RelationshipCalculator[source]¶
Bases:
RelationshipCalculatorRelationshipCalculator Class
- get_sibling_relationship_string(sib_type, gender_a, gender_b, in_law_a=False, in_law_b=False)[source]¶
Determine the string giving the relation between two siblings of type sib_type. Eg: b is the brother of a Here ‘brother’ is the string we need to determine This method gives more details about siblings than get_single_relationship_string can do.
Warning
DON’T TRANSLATE THIS PROCEDURE IF LOGIC IS EQUAL IN YOUR LANGUAGE, AND SAME METHODS EXIST (get_uncle, get_aunt, get_sibling)
- get_single_relationship_string(Ga, Gb, gender_a, gender_b, reltocommon_a, reltocommon_b, only_birth=True, in_law_a=False, in_law_b=False)[source]¶
Provide a string that describes the relationsip between a person, and another person. E.g. “grandparent” or “child”.
To be used as: ‘person b is the grandparent of a’, this will be in translation string: ‘person b is the %(relation)s of a’
Note that languages with gender should add ‘the’ inside the translation, so eg in french: ‘person b est %(relation)s de a’ where relation will be here: le grandparent
Ga and Gb can be used to mathematically calculate the relationship.
Some languages need to know the specific path to the common ancestor. Those languages should use reltocommon_a and reltocommon_b which is a string like ‘mfmf’.
The possible string codes are:
Code
Description
REL_MOTHER
# going up to mother
REL_FATHER
# going up to father
REL_MOTHER_NOTBIRTH
# going up to mother, not birth relation
REL_FATHER_NOTBIRTH
# going up to father, not birth relation
REL_FAM_BIRTH
# going up to family (mother and father)
REL_FAM_NONBIRTH
# going up to family, not birth relation
REL_FAM_BIRTH_MOTH_ONLY
# going up to fam, only birth rel to mother
REL_FAM_BIRTH_FATH_ONLY
# going up to fam, only birth rel to father
Prefix codes are stripped, so REL_FAM_INLAW_PREFIX is not present. If the relation starts with the inlaw of the person a, then ‘in_law_a’ is True, if it starts with the inlaw of person b, then ‘in_law_b’ is True.
Also REL_SIBLING (# going sideways to sibling (no parents)) is not passed to this routine. The collapse_relations changes this to a family relation.
Hence, calling routines should always strip REL_SIBLING and REL_FAM_INLAW_PREFIX before calling get_single_relationship_string() Note that only_birth=False, means that in the reltocommon one of the NOTBIRTH specifiers is present.
The REL_FAM identifiers mean that the relation is not via a common ancestor, but via a common family (note that that is not possible for direct descendants or direct ancestors!). If the relation to one of the parents in that common family is by birth, then ‘only_birth’ is not set to False. The only_birth() method is normally used for this.
- Parameters:
Ga (int) – The number of generations between the main person and the common ancestor.
Gb (int) – The number of generations between the other person and the common ancestor.
gender_a (int gender) – gender of person a
gender_b (int gender) – gender of person b
reltocommon_a (str) – relation path to common ancestor or common Family for person a. Note that length = Ga
reltocommon_b (str) – relation path to common ancestor or common Family for person b. Note that length = Gb
in_law_a (bool) – True if path to common ancestors is via the partner of person a
in_law_b (bool) – True if path to common ancestors is via the partner of person b
only_birth (bool) – True if relation between a and b is by birth only False otherwise
- Returns:
A string describing the relationship between the two people
- Return type:
str
Note
the self.REL_SIBLING should not be passed to this routine, so we should not check on it. All other self.
for better determination of siblings, use if Ga=1=Gb get_sibling_relationship_string
Relationship (French)¶
- class gramps.plugins.rel.rel_fr.RelationshipCalculator[source]¶
Bases:
RelationshipCalculatorRelationshipCalculator Class
- INLAW = ' (par alliance)'¶
- get_plural_relationship_string(Ga, Gb, reltocommon_a='', reltocommon_b='', only_birth=True, in_law_a=False, in_law_b=False)[source]¶
voir relationship.py
Relationship (Croatian)¶
- class gramps.plugins.rel.rel_hr.RelationshipCalculator[source]¶
Bases:
RelationshipCalculatorRelationshipCalculator Class
Relationship (Hungarian)¶
- class gramps.plugins.rel.rel_hu.RelationshipCalculator[source]¶
Bases:
RelationshipCalculatorRelationshipCalculator Class
- get_relationship(secondRel, firstRel, orig_person, other_person, in_law_a, in_law_b)[source]¶
returns a string representing the relationshp between the two people, along with a list of common ancestors (typically father,mother)
- get_sibling_relationship_string(sib_type, gender_a, gender_b, in_law_a=False, in_law_b=False)[source]¶
Determine the string giving the relation between two siblings of type sib_type. Eg: b is the brother of a Here ‘brother’ is the string we need to determine This method gives more details about siblings than get_single_relationship_string can do.
Warning
DON’T TRANSLATE THIS PROCEDURE IF LOGIC IS EQUAL IN YOUR LANGUAGE, AND SAME METHODS EXIST (get_uncle, get_aunt, get_sibling)
- get_single_relationship_string(Ga, Gb, gender_a, gender_b, reltocommon_a, reltocommon_b, only_birth=True, in_law_a=False, in_law_b=False)[source]¶
Provide a string that describes the relationsip between a person, and another person. E.g. “grandparent” or “child”.
To be used as: ‘person b is the grandparent of a’, this will be in translation string: ‘person b is the %(relation)s of a’
Note that languages with gender should add ‘the’ inside the translation, so eg in french: ‘person b est %(relation)s de a’ where relation will be here: le grandparent
Ga and Gb can be used to mathematically calculate the relationship.
Some languages need to know the specific path to the common ancestor. Those languages should use reltocommon_a and reltocommon_b which is a string like ‘mfmf’.
The possible string codes are:
Code
Description
REL_MOTHER
# going up to mother
REL_FATHER
# going up to father
REL_MOTHER_NOTBIRTH
# going up to mother, not birth relation
REL_FATHER_NOTBIRTH
# going up to father, not birth relation
REL_FAM_BIRTH
# going up to family (mother and father)
REL_FAM_NONBIRTH
# going up to family, not birth relation
REL_FAM_BIRTH_MOTH_ONLY
# going up to fam, only birth rel to mother
REL_FAM_BIRTH_FATH_ONLY
# going up to fam, only birth rel to father
Prefix codes are stripped, so REL_FAM_INLAW_PREFIX is not present. If the relation starts with the inlaw of the person a, then ‘in_law_a’ is True, if it starts with the inlaw of person b, then ‘in_law_b’ is True.
Also REL_SIBLING (# going sideways to sibling (no parents)) is not passed to this routine. The collapse_relations changes this to a family relation.
Hence, calling routines should always strip REL_SIBLING and REL_FAM_INLAW_PREFIX before calling get_single_relationship_string() Note that only_birth=False, means that in the reltocommon one of the NOTBIRTH specifiers is present.
The REL_FAM identifiers mean that the relation is not via a common ancestor, but via a common family (note that that is not possible for direct descendants or direct ancestors!). If the relation to one of the parents in that common family is by birth, then ‘only_birth’ is not set to False. The only_birth() method is normally used for this.
- Parameters:
Ga (int) – The number of generations between the main person and the common ancestor.
Gb (int) – The number of generations between the other person and the common ancestor.
gender_a (int gender) – gender of person a
gender_b (int gender) – gender of person b
reltocommon_a (str) – relation path to common ancestor or common Family for person a. Note that length = Ga
reltocommon_b (str) – relation path to common ancestor or common Family for person b. Note that length = Gb
in_law_a (bool) – True if path to common ancestors is via the partner of person a
in_law_b (bool) – True if path to common ancestors is via the partner of person b
only_birth (bool) – True if relation between a and b is by birth only False otherwise
- Returns:
A string describing the relationship between the two people
- Return type:
str
Note
the self.REL_SIBLING should not be passed to this routine, so we should not check on it. All other self.
for better determination of siblings, use if Ga=1=Gb get_sibling_relationship_string
Relationship (Italian)¶
- class gramps.plugins.rel.rel_it.RelationshipCalculator[source]¶
Bases:
RelationshipCalculatorRelationshipCalculator Class
- INLAW = ' acquisit%(gen)s'¶
- STEP = ' adottiv%(gen)s'¶
- get_relationship(db, orig_person, other_person)[source]¶
returns a string representing the relationshp between the two people, along with a list of common ancestors (typically father, mother)
- get_sibling_relationship_string(sib_type, gender_a, gender_b, in_law_a=False, in_law_b=False)[source]¶
Determine the string giving the relation between two siblings of type sib_type. Eg: b is the brother of a Here ‘brother’ is the string we need to determine This method gives more details about siblings than get_single_relationship_string can do.
Warning
DON’T TRANSLATE THIS PROCEDURE IF LOGIC IS EQUAL IN YOUR LANGUAGE, AND SAME METHODS EXIST (get_uncle, get_aunt, get_sibling)
Relationship (Dutch)¶
- class gramps.plugins.rel.rel_nl.RelationshipCalculator[source]¶
Bases:
RelationshipCalculatorRelationshipCalculator Class
- HALF = 'half'¶
- INLAW = 'aangetrouwde '¶
- STEP = 'stief'¶
- get_sibling_relationship_string(sib_type, gender_a, gender_b, in_law_a=False, in_law_b=False)[source]¶
Determine the string giving the relation between two siblings of type sib_type. Eg: b is the brother of a Here ‘brother’ is the string we need to determine This method gives more details about siblings than get_single_relationship_string can do.
Warning
DON’T TRANSLATE THIS PROCEDURE IF LOGIC IS EQUAL IN YOUR LANGUAGE, AND SAME METHODS EXIST (get_uncle, get_aunt, get_sibling)
Relationship (Norwegian)¶
- class gramps.plugins.rel.rel_no.RelationshipCalculator[source]¶
Bases:
RelationshipCalculatorRelationshipCalculator Class
- get_sibling_relationship_string(sib_type, gender_a, gender_b, in_law_a=False, in_law_b=False)[source]¶
Determine the string giving the relation between two siblings of type sib_type. Eg: b is the brother of a Here ‘brother’ is the string we need to determine This method gives more details about siblings than get_single_relationship_string can do.
Warning
DON’T TRANSLATE THIS PROCEDURE IF LOGIC IS EQUAL IN YOUR LANGUAGE, AND SAME METHODS EXIST (get_uncle, get_aunt, get_sibling)
- get_single_relationship_string(Ga, Gb, gender_a, gender_b, reltocommon_a, reltocommon_b, only_birth=True, in_law_a=False, in_law_b=False)[source]¶
Provide a string that describes the relationsip between a person, and another person. E.g. “grandparent” or “child”.
To be used as: ‘person b is the grandparent of a’, this will be in translation string: ‘person b is the %(relation)s of a’
Note that languages with gender should add ‘the’ inside the translation, so eg in french: ‘person b est %(relation)s de a’ where relation will be here: le grandparent
Ga and Gb can be used to mathematically calculate the relationship.
Some languages need to know the specific path to the common ancestor. Those languages should use reltocommon_a and reltocommon_b which is a string like ‘mfmf’.
The possible string codes are:
Code
Description
REL_MOTHER
# going up to mother
REL_FATHER
# going up to father
REL_MOTHER_NOTBIRTH
# going up to mother, not birth relation
REL_FATHER_NOTBIRTH
# going up to father, not birth relation
REL_FAM_BIRTH
# going up to family (mother and father)
REL_FAM_NONBIRTH
# going up to family, not birth relation
REL_FAM_BIRTH_MOTH_ONLY
# going up to fam, only birth rel to mother
REL_FAM_BIRTH_FATH_ONLY
# going up to fam, only birth rel to father
Prefix codes are stripped, so REL_FAM_INLAW_PREFIX is not present. If the relation starts with the inlaw of the person a, then ‘in_law_a’ is True, if it starts with the inlaw of person b, then ‘in_law_b’ is True.
Also REL_SIBLING (# going sideways to sibling (no parents)) is not passed to this routine. The collapse_relations changes this to a family relation.
Hence, calling routines should always strip REL_SIBLING and REL_FAM_INLAW_PREFIX before calling get_single_relationship_string() Note that only_birth=False, means that in the reltocommon one of the NOTBIRTH specifiers is present.
The REL_FAM identifiers mean that the relation is not via a common ancestor, but via a common family (note that that is not possible for direct descendants or direct ancestors!). If the relation to one of the parents in that common family is by birth, then ‘only_birth’ is not set to False. The only_birth() method is normally used for this.
- Parameters:
Ga (int) – The number of generations between the main person and the common ancestor.
Gb (int) – The number of generations between the other person and the common ancestor.
gender_a (int gender) – gender of person a
gender_b (int gender) – gender of person b
reltocommon_a (str) – relation path to common ancestor or common Family for person a. Note that length = Ga
reltocommon_b (str) – relation path to common ancestor or common Family for person b. Note that length = Gb
in_law_a (bool) – True if path to common ancestors is via the partner of person a
in_law_b (bool) – True if path to common ancestors is via the partner of person b
only_birth (bool) – True if relation between a and b is by birth only False otherwise
- Returns:
A string describing the relationship between the two people
- Return type:
str
Note
the self.REL_SIBLING should not be passed to this routine, so we should not check on it. All other self.
for better determination of siblings, use if Ga=1=Gb get_sibling_relationship_string
Relationship (Polish)¶
- class gramps.plugins.rel.rel_pl.RelationshipCalculator[source]¶
Bases:
RelationshipCalculatorRelationshipCalculator Class
- get_child_unknown(level, inlaw='')[source]¶
Podaje tekst zawierający informację, jak bardzo potomek o nieokreślonej płci jest spokrewniony dodanej osoby
- get_daughter(level, inlaw='')[source]¶
Podaje tekst zawierający informację, jak bardzo potomek żeński (np. córka) jest spokrewniony do danej osoby
- get_father(level, reltocommon, inlaw='')[source]¶
Podaje tekst zawierający informację, jak bardzo przodek męski (np. ojciec) jest spokrewniony do danej osoby
- get_mother(level, reltocommon, inlaw='')[source]¶
Podaje tekst zawierający informację, jak bardzo przodek żeński (np. matka) jest spokrewniony do danej osoby
- get_parent_unknown(level, inlaw='')[source]¶
Podaje tekst zawierający informację, jak bardzo przodek o nieokreślonej płci jest spokrewniony dodanej osoby
- get_plural_relationship_string(Ga, Gb, reltocommon_a='', reltocommon_b='', only_birth=True, in_law_a=False, in_law_b=False)[source]¶
Generate a text with information, how far away is a group of persons from a main person
- get_sibling_relationship_string(sib_type, gender_a, gender_b, in_law_a=False, in_law_b=False)[source]¶
Determine the string giving the relation between two siblings of type sib_type. Eg: b is the brother of a Here ‘brother’ is the string we need to determine This method gives more details about siblings than get_single_relationship_string can do.
Warning
DON’T TRANSLATE THIS PROCEDURE IF LOGIC IS EQUAL IN YOUR LANGUAGE, AND SAME METHODS EXIST (get_uncle, get_aunt, get_sibling)
- get_single_relationship_string(Ga, Gb, gender_a, gender_b, reltocommon_a, reltocommon_b, only_birth=True, in_law_a=False, in_law_b=False)[source]¶
Provide a string that describes the relationsip between a person, and another person. E.g. “grandparent” or “child”.
Relationship (Portuguese)¶
- class gramps.plugins.rel.rel_pt.RelationshipCalculator[source]¶
Bases:
RelationshipCalculatorRelationshipCalculator Class
- get_plural_relationship_string(Ga, Gb, reltocommon_a='', reltocommon_b='', only_birth=True, in_law_a=False, in_law_b=False)[source]¶
Cria o objeto KinshipReport que produz o relatório. Os argumentos são: database - a instância do banco de dados GRAMPS options_class - instância da classe das opções para este relatório O presente relatório tem os seguintes parâmetros (variáveis de classe) que entram na classe de opções. maxdescend - Máximo gerações de descendentes para incluir. maxascend - Máximo de gerações ancestrais para incluir. incspouses - Se deseja incluir cônjuges. inccousins - Se deseja incluir primos. incaunts - Se deseja incluir tios / sobrinhos. pid - A identificação Gramps da pessoa central para o relatório.
Preenche um mapa das matrizes contendo os descendentes da pessoa falecida. Esta função chama a si mesma recursivamente até atingir max_descend. Parâmetros:
- Parameters:
person_handle – o identificador da próxima pessoa
Ga – O número de gerações, desde a pessoa principal até o ancestral comum. É incrementado quando subir as gerações, e deixado inalterado quando descer as gerações.
Gb – O número de gerações desta pessoa (person_handle) até o ancestral comum. É incrementado quando descer as gerações and posto a zero quando subir as gerações.
skip_handle – Identificador opcional para pular quando descer. Isso é útil para pular o descendente que trouxe essa generação em primeiro lugar.
Preenche um mapa das matrizes contendo os ancestrais da pessoa falecida. Esta função chama a si mesma recursivamente até atingir max_ascend. Parâmetros:
- Parameters:
person_handle – o identificador da próxima pessoa
Ga – O número de gerações, desde a pessoa principal até o ancestral comum. É incrementado quando subir as gerações, e deixado inalterado quando descer as gerações.
Gb – O número de gerações desta pessoa (person_handle) até o ancestral comum. É incrementado quando descer as gerações and posto a zero quando subir as gerações.
- get_relationship(secondRel, firstRel, orig_person_gender, other_person_gender)[source]¶
returns a string representing the relationshp between the two people, along with a list of common ancestors (typically father, mother)
- get_sibling_relationship_string(sib_type, gender_a, gender_b, in_law_a=False, in_law_b=False)[source]¶
Determine the string giving the relation between two siblings of type sib_type. Eg: b is the brother of a Here ‘brother’ is the string we need to determine This method gives more details about siblings than get_single_relationship_string can do.
Warning
DON’T TRANSLATE THIS PROCEDURE IF LOGIC IS EQUAL IN YOUR LANGUAGE, AND SAME METHODS EXIST (get_uncle, get_aunt, get_sibling)
- get_single_relationship_string(Ga, Gb, gender_a, gender_b, reltocommon_a, reltocommon_b, only_birth=True, in_law_a=False, in_law_b=False)[source]¶
Provide a string that describes the relationsip between a person, and another person. E.g. “grandparent” or “child”.
To be used as: ‘person b is the grandparent of a’, this will be in translation string: ‘person b is the %(relation)s of a’
Note that languages with gender should add ‘the’ inside the translation, so eg in french: ‘person b est %(relation)s de a’ where relation will be here: le grandparent
Ga and Gb can be used to mathematically calculate the relationship.
Some languages need to know the specific path to the common ancestor. Those languages should use reltocommon_a and reltocommon_b which is a string like ‘mfmf’.
The possible string codes are:
Code
Description
REL_MOTHER
# going up to mother
REL_FATHER
# going up to father
REL_MOTHER_NOTBIRTH
# going up to mother, not birth relation
REL_FATHER_NOTBIRTH
# going up to father, not birth relation
REL_FAM_BIRTH
# going up to family (mother and father)
REL_FAM_NONBIRTH
# going up to family, not birth relation
REL_FAM_BIRTH_MOTH_ONLY
# going up to fam, only birth rel to mother
REL_FAM_BIRTH_FATH_ONLY
# going up to fam, only birth rel to father
Prefix codes are stripped, so REL_FAM_INLAW_PREFIX is not present. If the relation starts with the inlaw of the person a, then ‘in_law_a’ is True, if it starts with the inlaw of person b, then ‘in_law_b’ is True.
Also REL_SIBLING (# going sideways to sibling (no parents)) is not passed to this routine. The collapse_relations changes this to a family relation.
Hence, calling routines should always strip REL_SIBLING and REL_FAM_INLAW_PREFIX before calling get_single_relationship_string() Note that only_birth=False, means that in the reltocommon one of the NOTBIRTH specifiers is present.
The REL_FAM identifiers mean that the relation is not via a common ancestor, but via a common family (note that that is not possible for direct descendants or direct ancestors!). If the relation to one of the parents in that common family is by birth, then ‘only_birth’ is not set to False. The only_birth() method is normally used for this.
- Parameters:
Ga (int) – The number of generations between the main person and the common ancestor.
Gb (int) – The number of generations between the other person and the common ancestor.
gender_a (int gender) – gender of person a
gender_b (int gender) – gender of person b
reltocommon_a (str) – relation path to common ancestor or common Family for person a. Note that length = Ga
reltocommon_b (str) – relation path to common ancestor or common Family for person b. Note that length = Gb
in_law_a (bool) – True if path to common ancestors is via the partner of person a
in_law_b (bool) – True if path to common ancestors is via the partner of person b
only_birth (bool) – True if relation between a and b is by birth only False otherwise
- Returns:
A string describing the relationship between the two people
- Return type:
str
Note
the self.REL_SIBLING should not be passed to this routine, so we should not check on it. All other self.
for better determination of siblings, use if Ga=1=Gb get_sibling_relationship_string
Relationship (Russian)¶
- class gramps.plugins.rel.rel_ru.RelationshipCalculator[source]¶
Bases:
RelationshipCalculatorRelationshipCalculator Class
- get_plural_relationship_string(Ga, Gb, reltocommon_a='', reltocommon_b='', only_birth=True, in_law_a=False, in_law_b=False)[source]¶
Provide a string that describes the relationsip between a person, and a group of people with the same relationship. E.g. “grandparents” or “children”.
Ga and Gb can be used to mathematically calculate the relationship.
- Parameters:
Ga (int) – The number of generations between the main person and the common ancestor.
Gb (int) – The number of generations between the group of people and the common ancestor
reltocommon_a (str) – relation path to common ancestor or common Family for person a. Note that length = Ga
reltocommon_b (str) – relation path to common ancestor or common Family for person b. Note that length = Gb
only_birth (bool) – True if relation between a and b is by birth only False otherwise
in_law_a (bool) – True if path to common ancestors is via the partner of person a
in_law_b (bool) – True if path to common ancestors is via the partner of person b
- Returns:
A string describing the relationship between the person and the group.
- Return type:
str
- get_single_relationship_string(Ga, Gb, gender_a, gender_b, reltocommon_a, reltocommon_b, only_birth=True, in_law_a=False, in_law_b=False)[source]¶
Provide a string that describes the relationsip between a person, and another person. E.g. “grandparent” or “child”.
To be used as: ‘person b is the grandparent of a’, this will be in translation string: ‘person b is the %(relation)s of a’
Note that languages with gender should add ‘the’ inside the translation, so eg in french: ‘person b est %(relation)s de a’ where relation will be here: le grandparent
Ga and Gb can be used to mathematically calculate the relationship.
Some languages need to know the specific path to the common ancestor. Those languages should use reltocommon_a and reltocommon_b which is a string like ‘mfmf’.
The possible string codes are:
Code
Description
REL_MOTHER
# going up to mother
REL_FATHER
# going up to father
REL_MOTHER_NOTBIRTH
# going up to mother, not birth relation
REL_FATHER_NOTBIRTH
# going up to father, not birth relation
REL_FAM_BIRTH
# going up to family (mother and father)
REL_FAM_NONBIRTH
# going up to family, not birth relation
REL_FAM_BIRTH_MOTH_ONLY
# going up to fam, only birth rel to mother
REL_FAM_BIRTH_FATH_ONLY
# going up to fam, only birth rel to father
Prefix codes are stripped, so REL_FAM_INLAW_PREFIX is not present. If the relation starts with the inlaw of the person a, then ‘in_law_a’ is True, if it starts with the inlaw of person b, then ‘in_law_b’ is True.
Also REL_SIBLING (# going sideways to sibling (no parents)) is not passed to this routine. The collapse_relations changes this to a family relation.
Hence, calling routines should always strip REL_SIBLING and REL_FAM_INLAW_PREFIX before calling get_single_relationship_string() Note that only_birth=False, means that in the reltocommon one of the NOTBIRTH specifiers is present.
The REL_FAM identifiers mean that the relation is not via a common ancestor, but via a common family (note that that is not possible for direct descendants or direct ancestors!). If the relation to one of the parents in that common family is by birth, then ‘only_birth’ is not set to False. The only_birth() method is normally used for this.
- Parameters:
Ga (int) – The number of generations between the main person and the common ancestor.
Gb (int) – The number of generations between the other person and the common ancestor.
gender_a (int gender) – gender of person a
gender_b (int gender) – gender of person b
reltocommon_a (str) – relation path to common ancestor or common Family for person a. Note that length = Ga
reltocommon_b (str) – relation path to common ancestor or common Family for person b. Note that length = Gb
in_law_a (bool) – True if path to common ancestors is via the partner of person a
in_law_b (bool) – True if path to common ancestors is via the partner of person b
only_birth (bool) – True if relation between a and b is by birth only False otherwise
- Returns:
A string describing the relationship between the two people
- Return type:
str
Note
the self.REL_SIBLING should not be passed to this routine, so we should not check on it. All other self.
for better determination of siblings, use if Ga=1=Gb get_sibling_relationship_string
Relationship (Slovak)¶
- class gramps.plugins.rel.rel_sk.RelationshipCalculator[source]¶
Bases:
RelationshipCalculatorRelationshipCalculator Class
- INLAW = ' (m. zväzok)'¶
- get_plural_relationship_string(Ga, Gb, reltocommon_a='', reltocommon_b='', only_birth=True, in_law_a=False, in_law_b=False)[source]¶
see relationship.py
- get_sibling_relationship_string(sib_type, gender_a, gender_b, in_law_a=False, in_law_b=False)[source]¶
Determine the string giving the relation between two siblings of type sib_type. Eg: b is the brother of a Here ‘brother’ is the string we need to determine This method gives more details about siblings than get_single_relationship_string can do.
Warning
DON’T TRANSLATE THIS PROCEDURE IF LOGIC IS EQUAL IN YOUR LANGUAGE, AND SAME METHODS EXIST (get_uncle, get_aunt, get_sibling)
Relationship (Slovenian)¶
- class gramps.plugins.rel.rel_sl.RelationshipCalculator[source]¶
Bases:
RelationshipCalculatorRelationshipCalculator Class
- get_plural_relationship_string(Ga, Gb, reltocommon_a='', reltocommon_b='', only_birth=True, in_law_a=False, in_law_b=False)[source]¶
Provide a string that describes the relationsip between a person, and a group of people with the same relationship. E.g. “grandparents” or “children”.
Ga and Gb can be used to mathematically calculate the relationship.
- Parameters:
Ga (int) – The number of generations between the main person and the common ancestor.
Gb (int) – The number of generations between the group of people and the common ancestor
reltocommon_a (str) – relation path to common ancestor or common Family for person a. Note that length = Ga
reltocommon_b (str) – relation path to common ancestor or common Family for person b. Note that length = Gb
only_birth (bool) – True if relation between a and b is by birth only False otherwise
in_law_a (bool) – True if path to common ancestors is via the partner of person a
in_law_b (bool) – True if path to common ancestors is via the partner of person b
- Returns:
A string describing the relationship between the person and the group.
- Return type:
str
- get_sibling_relationship_string(sib_type, gender_a, gender_b, in_law_a=False, in_law_b=False)[source]¶
Determine the string giving the relation between two siblings of type sib_type. Eg: b is the brother of a Here ‘brother’ is the string we need to determine This method gives more details about siblings than get_single_relationship_string can do.
Warning
DON’T TRANSLATE THIS PROCEDURE IF LOGIC IS EQUAL IN YOUR LANGUAGE, AND SAME METHODS EXIST (get_uncle, get_aunt, get_sibling)
- get_single_relationship_string(Ga, Gb, gender_a, gender_b, reltocommon_a, reltocommon_b, only_birth=True, in_law_a=False, in_law_b=False)[source]¶
Provide a string that describes the relationsip between a person, and another person. E.g. “grandparent” or “child”.
To be used as: ‘person b is the grandparent of a’, this will be in translation string: ‘person b is the %(relation)s of a’
Note that languages with gender should add ‘the’ inside the translation, so eg in french: ‘person b est %(relation)s de a’ where relation will be here: le grandparent
Ga and Gb can be used to mathematically calculate the relationship.
Some languages need to know the specific path to the common ancestor. Those languages should use reltocommon_a and reltocommon_b which is a string like ‘mfmf’.
The possible string codes are:
Code
Description
REL_MOTHER
# going up to mother
REL_FATHER
# going up to father
REL_MOTHER_NOTBIRTH
# going up to mother, not birth relation
REL_FATHER_NOTBIRTH
# going up to father, not birth relation
REL_FAM_BIRTH
# going up to family (mother and father)
REL_FAM_NONBIRTH
# going up to family, not birth relation
REL_FAM_BIRTH_MOTH_ONLY
# going up to fam, only birth rel to mother
REL_FAM_BIRTH_FATH_ONLY
# going up to fam, only birth rel to father
Prefix codes are stripped, so REL_FAM_INLAW_PREFIX is not present. If the relation starts with the inlaw of the person a, then ‘in_law_a’ is True, if it starts with the inlaw of person b, then ‘in_law_b’ is True.
Also REL_SIBLING (# going sideways to sibling (no parents)) is not passed to this routine. The collapse_relations changes this to a family relation.
Hence, calling routines should always strip REL_SIBLING and REL_FAM_INLAW_PREFIX before calling get_single_relationship_string() Note that only_birth=False, means that in the reltocommon one of the NOTBIRTH specifiers is present.
The REL_FAM identifiers mean that the relation is not via a common ancestor, but via a common family (note that that is not possible for direct descendants or direct ancestors!). If the relation to one of the parents in that common family is by birth, then ‘only_birth’ is not set to False. The only_birth() method is normally used for this.
- Parameters:
Ga (int) – The number of generations between the main person and the common ancestor.
Gb (int) – The number of generations between the other person and the common ancestor.
gender_a (int gender) – gender of person a
gender_b (int gender) – gender of person b
reltocommon_a (str) – relation path to common ancestor or common Family for person a. Note that length = Ga
reltocommon_b (str) – relation path to common ancestor or common Family for person b. Note that length = Gb
in_law_a (bool) – True if path to common ancestors is via the partner of person a
in_law_b (bool) – True if path to common ancestors is via the partner of person b
only_birth (bool) – True if relation between a and b is by birth only False otherwise
- Returns:
A string describing the relationship between the two people
- Return type:
str
Note
the self.REL_SIBLING should not be passed to this routine, so we should not check on it. All other self.
for better determination of siblings, use if Ga=1=Gb get_sibling_relationship_string
Relationship (Swedish)¶
- class gramps.plugins.rel.rel_sv.RelationshipCalculator[source]¶
Bases:
RelationshipCalculatorRelationshipCalculator Class
- HALF = 'halv'¶
- INLAW = 'ingift '¶
- STEP = 'styv'¶
- get_plural_relationship_string(Ga, Gb, reltocommon_a='', reltocommon_b='', only_birth=True, in_law_a=False, in_law_b=False)[source]¶
Provide a string that describes the relationsip between a person, and a group of people with the same relationship. E.g. “grandparents” or “children”.
Ga and Gb can be used to mathematically calculate the relationship.
- Parameters:
Ga (int) – The number of generations between the main person and the common ancestor.
Gb (int) – The number of generations between the group of people and the common ancestor
reltocommon_a (str) – relation path to common ancestor or common Family for person a. Note that length = Ga
reltocommon_b (str) – relation path to common ancestor or common Family for person b. Note that length = Gb
only_birth (bool) – True if relation between a and b is by birth only False otherwise
in_law_a (bool) – True if path to common ancestors is via the partner of person a
in_law_b (bool) – True if path to common ancestors is via the partner of person b
- Returns:
A string describing the relationship between the person and the group.
- Return type:
str
- get_sibling_relationship_string(sib_type, gender_a, gender_b, in_law_a=False, in_law_b=False)[source]¶
Determine the string giving the relation between two siblings of type sib_type. Eg: b is the brother of a Here ‘brother’ is the string we need to determine This method gives more details about siblings than get_single_relationship_string can do.
Warning
DON’T TRANSLATE THIS PROCEDURE IF LOGIC IS EQUAL IN YOUR LANGUAGE, AND SAME METHODS EXIST (get_uncle, get_aunt, get_sibling)
- get_single_relationship_string(Ga, Gb, gender_a, gender_b, reltocommon_a, reltocommon_b, only_birth=True, in_law_a=False, in_law_b=False)[source]¶
Provide a string that describes the relationsip between a person, and another person. E.g. “grandparent” or “child”.
To be used as: ‘person b is the grandparent of a’, this will be in translation string: ‘person b is the %(relation)s of a’
Note that languages with gender should add ‘the’ inside the translation, so eg in french: ‘person b est %(relation)s de a’ where relation will be here: le grandparent
Ga and Gb can be used to mathematically calculate the relationship.
Some languages need to know the specific path to the common ancestor. Those languages should use reltocommon_a and reltocommon_b which is a string like ‘mfmf’.
The possible string codes are:
Code
Description
REL_MOTHER
# going up to mother
REL_FATHER
# going up to father
REL_MOTHER_NOTBIRTH
# going up to mother, not birth relation
REL_FATHER_NOTBIRTH
# going up to father, not birth relation
REL_FAM_BIRTH
# going up to family (mother and father)
REL_FAM_NONBIRTH
# going up to family, not birth relation
REL_FAM_BIRTH_MOTH_ONLY
# going up to fam, only birth rel to mother
REL_FAM_BIRTH_FATH_ONLY
# going up to fam, only birth rel to father
Prefix codes are stripped, so REL_FAM_INLAW_PREFIX is not present. If the relation starts with the inlaw of the person a, then ‘in_law_a’ is True, if it starts with the inlaw of person b, then ‘in_law_b’ is True.
Also REL_SIBLING (# going sideways to sibling (no parents)) is not passed to this routine. The collapse_relations changes this to a family relation.
Hence, calling routines should always strip REL_SIBLING and REL_FAM_INLAW_PREFIX before calling get_single_relationship_string() Note that only_birth=False, means that in the reltocommon one of the NOTBIRTH specifiers is present.
The REL_FAM identifiers mean that the relation is not via a common ancestor, but via a common family (note that that is not possible for direct descendants or direct ancestors!). If the relation to one of the parents in that common family is by birth, then ‘only_birth’ is not set to False. The only_birth() method is normally used for this.
- Parameters:
Ga (int) – The number of generations between the main person and the common ancestor.
Gb (int) – The number of generations between the other person and the common ancestor.
gender_a (int gender) – gender of person a
gender_b (int gender) – gender of person b
reltocommon_a (str) – relation path to common ancestor or common Family for person a. Note that length = Ga
reltocommon_b (str) – relation path to common ancestor or common Family for person b. Note that length = Gb
in_law_a (bool) – True if path to common ancestors is via the partner of person a
in_law_b (bool) – True if path to common ancestors is via the partner of person b
only_birth (bool) – True if relation between a and b is by birth only False otherwise
- Returns:
A string describing the relationship between the two people
- Return type:
str
Note
the self.REL_SIBLING should not be passed to this routine, so we should not check on it. All other self.
for better determination of siblings, use if Ga=1=Gb get_sibling_relationship_string