gedcom-x 0.5.9__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.
Files changed (48) hide show
  1. {gedcom_x-0.5.9.dist-info → gedcom_x-0.5.11.dist-info}/METADATA +1 -1
  2. gedcom_x-0.5.11.dist-info/RECORD +57 -0
  3. gedcomx/Extensions/rs10/rsLink.py +2 -1
  4. gedcomx/__init__.py +8 -3
  5. gedcomx/address.py +3 -0
  6. gedcomx/agent.py +11 -6
  7. gedcomx/attribution.py +3 -1
  8. gedcomx/conclusion.py +10 -6
  9. gedcomx/converter.py +92 -27
  10. gedcomx/coverage.py +3 -1
  11. gedcomx/date.py +3 -0
  12. gedcomx/document.py +3 -1
  13. gedcomx/event.py +3 -0
  14. gedcomx/evidence_reference.py +30 -3
  15. gedcomx/extensible.py +86 -0
  16. gedcomx/fact.py +6 -2
  17. gedcomx/gedcom5x.py +21 -3
  18. gedcomx/gedcom7/GedcomStructure.py +1 -3
  19. gedcomx/gedcom7/__init__.py +1 -1
  20. gedcomx/gedcom7/gedcom7.py +3 -3
  21. gedcomx/gedcom7/specification.py +4817 -0
  22. gedcomx/gedcomx.py +3 -0
  23. gedcomx/gender.py +5 -1
  24. gedcomx/group.py +11 -2
  25. gedcomx/identifier.py +5 -2
  26. gedcomx/logging_hub.py +132 -22
  27. gedcomx/name.py +15 -6
  28. gedcomx/note.py +25 -10
  29. gedcomx/online_account.py +20 -0
  30. gedcomx/person.py +8 -6
  31. gedcomx/place_description.py +3 -1
  32. gedcomx/place_reference.py +5 -2
  33. gedcomx/qualifier.py +2 -0
  34. gedcomx/relationship.py +8 -5
  35. gedcomx/resource.py +20 -6
  36. gedcomx/schemas.py +530 -0
  37. gedcomx/serialization.py +36 -16
  38. gedcomx/source_citation.py +22 -0
  39. gedcomx/source_description.py +22 -18
  40. gedcomx/source_reference.py +25 -3
  41. gedcomx/subject.py +2 -3
  42. gedcomx/textvalue.py +19 -4
  43. gedcomx/uri.py +8 -6
  44. gedcom_x-0.5.9.dist-info/RECORD +0 -56
  45. gedcomx/Logging.py +0 -19
  46. gedcomx/gedcom7/Specification.py +0 -347
  47. {gedcom_x-0.5.9.dist-info → gedcom_x-0.5.11.dist-info}/WHEEL +0 -0
  48. {gedcom_x-0.5.9.dist-info → gedcom_x-0.5.11.dist-info}/top_level.txt +0 -0
@@ -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["URI | PlaceDescription"] = None) -> None:
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 | Resource] = None,
73
- person2: Optional[Person | Resource] = None,
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 | None = None,resourceId: str | None = None, target: object = None) -> None:
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)}, {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
- self.resourceId = target.id
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