gedcom-x 0.5.10__py3-none-any.whl → 0.5.11__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {gedcom_x-0.5.10.dist-info → gedcom_x-0.5.11.dist-info}/METADATA +1 -1
- gedcom_x-0.5.11.dist-info/RECORD +57 -0
- gedcomx/Extensions/rs10/rsLink.py +2 -1
- gedcomx/__init__.py +5 -3
- gedcomx/address.py +3 -0
- gedcomx/agent.py +11 -6
- gedcomx/attribution.py +3 -1
- gedcomx/conclusion.py +9 -5
- gedcomx/converter.py +92 -27
- gedcomx/coverage.py +3 -1
- gedcomx/date.py +3 -0
- gedcomx/document.py +3 -1
- gedcomx/event.py +3 -0
- gedcomx/evidence_reference.py +30 -3
- gedcomx/fact.py +6 -2
- gedcomx/gedcom5x.py +21 -3
- gedcomx/gedcomx.py +3 -0
- gedcomx/gender.py +5 -1
- gedcomx/group.py +11 -2
- gedcomx/identifier.py +5 -2
- gedcomx/logging_hub.py +132 -22
- gedcomx/name.py +15 -6
- gedcomx/note.py +25 -10
- gedcomx/online_account.py +20 -0
- gedcomx/person.py +6 -5
- gedcomx/place_description.py +3 -1
- gedcomx/place_reference.py +5 -2
- gedcomx/qualifier.py +2 -0
- gedcomx/relationship.py +8 -5
- gedcomx/resource.py +20 -6
- gedcomx/schemas.py +521 -319
- gedcomx/serialization.py +36 -16
- gedcomx/source_citation.py +22 -0
- gedcomx/source_description.py +22 -18
- gedcomx/source_reference.py +25 -3
- gedcomx/subject.py +2 -3
- gedcomx/textvalue.py +19 -4
- gedcomx/uri.py +8 -6
- gedcom_x-0.5.10.dist-info/RECORD +0 -58
- gedcomx/Logging.py +0 -19
- {gedcom_x-0.5.10.dist-info → gedcom_x-0.5.11.dist-info}/WHEEL +0 -0
- {gedcom_x-0.5.10.dist-info → gedcom_x-0.5.11.dist-info}/top_level.txt +0 -0
gedcomx/person.py
CHANGED
@@ -12,6 +12,7 @@ from urllib.parse import urljoin
|
|
12
12
|
Updated:
|
13
13
|
- 2025-08-31: _as_dict_ to only create entries in dict for fields that hold data
|
14
14
|
- 2025-09-03: _from_json_ refactor
|
15
|
+
- 2025-09-09: added schema_class
|
15
16
|
|
16
17
|
======================================================================
|
17
18
|
"""
|
@@ -34,6 +35,7 @@ from .logging_hub import hub, logging
|
|
34
35
|
from .name import Name, QuickName
|
35
36
|
from .note import Note
|
36
37
|
from .resource import Resource
|
38
|
+
from .schemas import schema_class
|
37
39
|
from .source_reference import SourceReference
|
38
40
|
from .subject import Subject
|
39
41
|
from .logging_hub import hub, logging
|
@@ -48,7 +50,7 @@ deserial_log = "degedcomx.serialization"
|
|
48
50
|
#=====================================================================
|
49
51
|
|
50
52
|
|
51
|
-
|
53
|
+
@schema_class(toplevel=True)
|
52
54
|
class Person(Extensible,Subject):
|
53
55
|
"""A person in the system.
|
54
56
|
|
@@ -64,7 +66,7 @@ class Person(Extensible,Subject):
|
|
64
66
|
identifier = 'http://gedcomx.org/v1/Person'
|
65
67
|
version = 'http://gedcomx.org/conceptual-model/v1'
|
66
68
|
|
67
|
-
def __init__(self, id: str
|
69
|
+
def __init__(self, id: Optional[str] = None,
|
68
70
|
lang: str = 'en',
|
69
71
|
sources: Optional[List[SourceReference]] = None,
|
70
72
|
analysis: Optional[Resource] = None,
|
@@ -80,10 +82,9 @@ class Person(Extensible,Subject):
|
|
80
82
|
names: Optional[List[Name]] = None,
|
81
83
|
facts: Optional[List[Fact]] = None,
|
82
84
|
living: Optional[bool] = None,
|
83
|
-
links: Optional[_rsLinks] = None,
|
84
|
-
uri: Optional[Resource] = None) -> None:
|
85
|
+
links: Optional[_rsLinks] = None,) -> None:
|
85
86
|
# Call superclass initializer if needed
|
86
|
-
super().__init__(id, lang, sources, analysis, notes, confidence, attribution, extracted, evidence, media, identifiers,links=links
|
87
|
+
super().__init__(id, lang, sources, analysis, notes, confidence, attribution, extracted, evidence, media, identifiers,links=links)
|
87
88
|
|
88
89
|
# Initialize mutable attributes to empty lists if None
|
89
90
|
self.sources = sources if sources is not None else []
|
gedcomx/place_description.py
CHANGED
@@ -11,6 +11,7 @@ from typing import Any, Dict, List, Optional
|
|
11
11
|
Updated:
|
12
12
|
- 2025-09-01: filename PEP8 standard
|
13
13
|
- 2025-09-03: _from_json_ refactored
|
14
|
+
- 2025-09-09: added schema_class
|
14
15
|
|
15
16
|
======================================================================
|
16
17
|
"""
|
@@ -29,6 +30,7 @@ from .identifier import IdentifierList
|
|
29
30
|
from .note import Note
|
30
31
|
from .resource import Resource
|
31
32
|
from .source_reference import SourceReference
|
33
|
+
from .schemas import schema_class
|
32
34
|
from .subject import Subject
|
33
35
|
from .textvalue import TextValue
|
34
36
|
from .uri import URI
|
@@ -42,7 +44,7 @@ log = logging.getLogger("gedcomx")
|
|
42
44
|
serial_log = "gedcomx.serialization"
|
43
45
|
#=====================================================================
|
44
46
|
|
45
|
-
|
47
|
+
@schema_class(toplevel=True)
|
46
48
|
class PlaceDescription(Subject):
|
47
49
|
"""PlaceDescription describes the details of a place in terms of
|
48
50
|
its name and possibly its type, time period, and/or a geospatial description
|
gedcomx/place_reference.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
from __future__ import annotations
|
2
|
-
from typing import Optional, TYPE_CHECKING
|
2
|
+
from typing import Optional, Union, TYPE_CHECKING
|
3
3
|
if TYPE_CHECKING:
|
4
4
|
from .place_description import PlaceDescription
|
5
5
|
|
@@ -14,6 +14,7 @@ if TYPE_CHECKING:
|
|
14
14
|
Updated:
|
15
15
|
- 2025-08-31: _as_dict_ to only create entries in dict for fields that hold data
|
16
16
|
- 2025-09-03: _from_json refactored
|
17
|
+
- 2025-09-09: added schema_class
|
17
18
|
|
18
19
|
======================================================================
|
19
20
|
"""
|
@@ -24,6 +25,7 @@ GEDCOM Module Types
|
|
24
25
|
======================================================================
|
25
26
|
"""
|
26
27
|
from .resource import Resource
|
28
|
+
from .schemas import schema_class
|
27
29
|
from .logging_hub import hub, logging
|
28
30
|
from .uri import URI
|
29
31
|
"""
|
@@ -35,6 +37,7 @@ log = logging.getLogger("gedcomx")
|
|
35
37
|
serial_log = "gedcomx.serialization"
|
36
38
|
#=====================================================================
|
37
39
|
|
40
|
+
@schema_class()
|
38
41
|
class PlaceReference:
|
39
42
|
"""defines a reference to a PlaceDescription.
|
40
43
|
|
@@ -50,7 +53,7 @@ class PlaceReference:
|
|
50
53
|
|
51
54
|
def __init__(self,
|
52
55
|
original: Optional[str] = None,
|
53
|
-
description: Optional[
|
56
|
+
description: Optional[Union[URI, PlaceDescription]] = None) -> None:
|
54
57
|
self.original = original
|
55
58
|
self.description = description # descriptionRef
|
56
59
|
|
gedcomx/qualifier.py
CHANGED
@@ -16,6 +16,7 @@ from typing import Optional
|
|
16
16
|
======================================================================
|
17
17
|
"""
|
18
18
|
from .logging_hub import hub, logging
|
19
|
+
from .schemas import schema_class
|
19
20
|
"""
|
20
21
|
======================================================================
|
21
22
|
Logging
|
@@ -25,6 +26,7 @@ log = logging.getLogger("gedcomx")
|
|
25
26
|
serial_log = "gedcomx.serialization"
|
26
27
|
#=====================================================================
|
27
28
|
|
29
|
+
@schema_class()
|
28
30
|
class Qualifier:
|
29
31
|
"""defines the data structure used to supply additional details, annotations,
|
30
32
|
tags, or other qualifying data to a specific data element.
|
gedcomx/relationship.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
from enum import Enum
|
2
|
-
from typing import Any, Dict, Optional, List
|
2
|
+
from typing import Any, Dict, Optional, List, Union
|
3
3
|
"""
|
4
4
|
======================================================================
|
5
5
|
Project: Gedcom-X
|
@@ -11,6 +11,7 @@ from typing import Any, Dict, Optional, List
|
|
11
11
|
Updated:
|
12
12
|
- 2025-09-31: filename PEP8 standard
|
13
13
|
- 2025-09-03: _from_json_ refactor
|
14
|
+
- 2025-09-09: added schema_class
|
14
15
|
|
15
16
|
======================================================================
|
16
17
|
"""
|
@@ -29,6 +30,7 @@ from .identifier import Identifier, make_uid
|
|
29
30
|
from .note import Note
|
30
31
|
from .person import Person
|
31
32
|
from .resource import Resource
|
33
|
+
from .schemas import schema_class
|
32
34
|
from .source_reference import SourceReference
|
33
35
|
from .subject import Subject
|
34
36
|
from .logging_hub import hub, logging
|
@@ -53,7 +55,8 @@ class RelationshipType(Enum):
|
|
53
55
|
RelationshipType.ParentChild: "A relationship from a parent to a child."
|
54
56
|
}
|
55
57
|
return descriptions.get(self, "No description available.")
|
56
|
-
|
58
|
+
|
59
|
+
@schema_class(toplevel=True)
|
57
60
|
class Relationship(Subject):
|
58
61
|
"""Represents a relationship between two Person(s)
|
59
62
|
|
@@ -69,8 +72,8 @@ class Relationship(Subject):
|
|
69
72
|
version = 'http://gedcomx.org/conceptual-model/v1'
|
70
73
|
|
71
74
|
def __init__(self,
|
72
|
-
person1: Optional[Person
|
73
|
-
person2: Optional[Person
|
75
|
+
person1: Optional[Union[Resource,Person]] = None,
|
76
|
+
person2: Optional[Union[Resource,Person]] = None,
|
74
77
|
facts: Optional[List[Fact]] = None,
|
75
78
|
id: Optional[str] = None,
|
76
79
|
lang: Optional[str] = None,
|
@@ -90,7 +93,7 @@ class Relationship(Subject):
|
|
90
93
|
# Call superclass initializer if required
|
91
94
|
super().__init__(id, lang, sources, analysis, notes, confidence, attribution, extracted, evidence, media, identifiers,links=links)
|
92
95
|
|
93
|
-
self.id = id if id else make_uid()
|
96
|
+
#self.id = id if id else make_uid()
|
94
97
|
self.type = type
|
95
98
|
self.person1 = person1
|
96
99
|
self.person2 = person2
|
gedcomx/resource.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
from typing import Optional
|
1
|
+
from typing import Optional, Union
|
2
2
|
|
3
3
|
"""
|
4
4
|
======================================================================
|
@@ -23,6 +23,7 @@ GEDCOM Module Types
|
|
23
23
|
|
24
24
|
from .uri import URI
|
25
25
|
from .logging_hub import hub, logging
|
26
|
+
from .schemas import schema_class, SCHEMA
|
26
27
|
"""
|
27
28
|
======================================================================
|
28
29
|
Logging
|
@@ -31,7 +32,9 @@ Logging
|
|
31
32
|
log = logging.getLogger("gedcomx")
|
32
33
|
serial_log = "gedcomx.serialization"
|
33
34
|
#=====================================================================
|
34
|
-
|
35
|
+
|
36
|
+
|
37
|
+
@schema_class()
|
35
38
|
class Resource:
|
36
39
|
"""
|
37
40
|
Class used to track and resolve URIs and references between datastores.
|
@@ -45,7 +48,7 @@ class Resource:
|
|
45
48
|
If `id` is not a valid UUID.
|
46
49
|
"""
|
47
50
|
# TODO, Deal with a resouce being passed, as it may be unresolved.
|
48
|
-
def __init__(self,resource: URI
|
51
|
+
def __init__(self,resource: Union[URI, None] = None,resourceId: str | None = None, target: object = None) -> None:
|
49
52
|
|
50
53
|
#if (resource is None) and (target is None): #TODO
|
51
54
|
# raise ValueError('Resource object must point to something.')
|
@@ -64,18 +67,29 @@ class Resource:
|
|
64
67
|
self.resource = target.resource
|
65
68
|
self.resourceId = target.resourceId
|
66
69
|
self.target = target.target
|
70
|
+
elif isinstance(target,URI):
|
71
|
+
if hub.logEnabled: log.debug(f"Making a 'Resource' from '{type(target).__name__}': {target.value} ")
|
72
|
+
assert False
|
67
73
|
else:
|
68
|
-
log.debug(f"Target of type: {type(target)}
|
74
|
+
if hub.logEnabled: log.debug(f"Target of type: {type(target)}")
|
69
75
|
if hasattr(target,'uri'):
|
70
76
|
self.resource = target.uri
|
71
77
|
else:
|
72
78
|
self.resourceId = URI(fragment=target.id)
|
73
|
-
|
79
|
+
self.resourceId = target.id
|
80
|
+
if hub.logEnabled: log.debug(f"Resource '{self.value} ")
|
74
81
|
|
75
82
|
@property
|
76
83
|
def uri(self):
|
77
84
|
return self.resource
|
78
85
|
|
86
|
+
@property
|
87
|
+
def value(self):
|
88
|
+
res_dict = {}
|
89
|
+
if self.resource: res_dict['resource'] = self.resource
|
90
|
+
if self.resourceId: res_dict['resourceId'] = self.resourceId
|
91
|
+
return res_dict if res_dict != {} else None
|
92
|
+
|
79
93
|
@property
|
80
94
|
def _as_dict_(self):
|
81
95
|
from .serialization import Serialization
|
@@ -108,5 +122,5 @@ class Resource:
|
|
108
122
|
def __str__(self) -> str:
|
109
123
|
return f"resource={self.resource}{f', resourceId={self.resourceId}' if self.resourceId else ''}"
|
110
124
|
|
111
|
-
|
125
|
+
#SCHEMA.set_resource_class(Resource)
|
112
126
|
|