gedcom-x 0.5.2__tar.gz → 0.5.6__tar.gz

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 (58) hide show
  1. gedcom_x-0.5.6/PKG-INFO +144 -0
  2. gedcom_x-0.5.6/README.md +126 -0
  3. gedcom_x-0.5.6/gedcom_x.egg-info/PKG-INFO +144 -0
  4. {gedcom_x-0.5.2 → gedcom_x-0.5.6}/gedcom_x.egg-info/SOURCES.txt +7 -3
  5. {gedcom_x-0.5.2 → gedcom_x-0.5.6}/gedcomx/Address.py +2 -0
  6. {gedcom_x-0.5.2 → gedcom_x-0.5.6}/gedcomx/Agent.py +9 -2
  7. {gedcom_x-0.5.2 → gedcom_x-0.5.6}/gedcomx/Attribution.py +10 -46
  8. {gedcom_x-0.5.2 → gedcom_x-0.5.6}/gedcomx/Conclusion.py +85 -21
  9. {gedcom_x-0.5.2 → gedcom_x-0.5.6}/gedcomx/Coverage.py +10 -0
  10. {gedcom_x-0.5.2 → gedcom_x-0.5.6}/gedcomx/Date.py +2 -7
  11. {gedcom_x-0.5.2 → gedcom_x-0.5.6}/gedcomx/Document.py +27 -6
  12. {gedcom_x-0.5.2 → gedcom_x-0.5.6}/gedcomx/Event.py +20 -1
  13. {gedcom_x-0.5.2 → gedcom_x-0.5.6}/gedcomx/Exceptions.py +6 -0
  14. gedcom_x-0.5.6/gedcomx/ExtensibleEnum.py +183 -0
  15. {gedcom_x-0.5.2 → gedcom_x-0.5.6}/gedcomx/Fact.py +7 -8
  16. gedcom_x-0.5.6/gedcomx/Gedcom.py +53 -0
  17. gedcom_x-0.5.6/gedcomx/Gedcom5x.py +579 -0
  18. {gedcom_x-0.5.2 → gedcom_x-0.5.6}/gedcomx/GedcomX.py +48 -26
  19. {gedcom_x-0.5.2 → gedcom_x-0.5.6}/gedcomx/Gender.py +6 -40
  20. gedcom_x-0.5.6/gedcomx/Identifier.py +226 -0
  21. gedcom_x-0.5.6/gedcomx/LoggingHub.py +186 -0
  22. gedcom_x-0.5.6/gedcomx/Mutations.py +228 -0
  23. {gedcom_x-0.5.2 → gedcom_x-0.5.6}/gedcomx/Name.py +6 -0
  24. {gedcom_x-0.5.2 → gedcom_x-0.5.6}/gedcomx/Person.py +49 -90
  25. {gedcom_x-0.5.2 → gedcom_x-0.5.6}/gedcomx/PlaceDescription.py +23 -14
  26. gedcom_x-0.5.6/gedcomx/PlaceReference.py +30 -0
  27. {gedcom_x-0.5.2 → gedcom_x-0.5.6}/gedcomx/Relationship.py +23 -54
  28. {gedcom_x-0.5.2 → gedcom_x-0.5.6}/gedcomx/Resource.py +17 -3
  29. gedcom_x-0.5.6/gedcomx/Serialization.py +401 -0
  30. {gedcom_x-0.5.2 → gedcom_x-0.5.6}/gedcomx/SourceDescription.py +6 -9
  31. {gedcom_x-0.5.2 → gedcom_x-0.5.6}/gedcomx/SourceReference.py +20 -86
  32. {gedcom_x-0.5.2 → gedcom_x-0.5.6}/gedcomx/Subject.py +4 -4
  33. gedcom_x-0.5.6/gedcomx/Translation.py +219 -0
  34. {gedcom_x-0.5.2 → gedcom_x-0.5.6}/gedcomx/URI.py +1 -0
  35. {gedcom_x-0.5.2 → gedcom_x-0.5.6}/gedcomx/__init__.py +8 -1
  36. {gedcom_x-0.5.2 → gedcom_x-0.5.6}/pyproject.toml +1 -1
  37. {gedcom_x-0.5.2 → gedcom_x-0.5.6}/setup.py +10 -4
  38. gedcom_x-0.5.2/PKG-INFO +0 -17
  39. gedcom_x-0.5.2/gedcom_x.egg-info/PKG-INFO +0 -17
  40. gedcom_x-0.5.2/gedcomx/Gedcom.py +0 -419
  41. gedcom_x-0.5.2/gedcomx/Identifier.py +0 -172
  42. gedcom_x-0.5.2/gedcomx/PlaceReference.py +0 -33
  43. gedcom_x-0.5.2/gedcomx/Serialization.py +0 -80
  44. gedcom_x-0.5.2/gedcomx/_Links.py +0 -37
  45. gedcom_x-0.5.2/gedcomx/g7interop.py +0 -205
  46. {gedcom_x-0.5.2 → gedcom_x-0.5.6}/gedcom_x.egg-info/dependency_links.txt +0 -0
  47. {gedcom_x-0.5.2 → gedcom_x-0.5.6}/gedcom_x.egg-info/top_level.txt +0 -0
  48. {gedcom_x-0.5.2 → gedcom_x-0.5.6}/gedcomx/EvidenceReference.py +0 -0
  49. {gedcom_x-0.5.2 → gedcom_x-0.5.6}/gedcomx/Group.py +0 -0
  50. {gedcom_x-0.5.2 → gedcom_x-0.5.6}/gedcomx/Logging.py +0 -0
  51. {gedcom_x-0.5.2 → gedcom_x-0.5.6}/gedcomx/Note.py +0 -0
  52. {gedcom_x-0.5.2 → gedcom_x-0.5.6}/gedcomx/OnlineAccount.py +0 -0
  53. {gedcom_x-0.5.2 → gedcom_x-0.5.6}/gedcomx/Qualifier.py +0 -0
  54. {gedcom_x-0.5.2 → gedcom_x-0.5.6}/gedcomx/SourceCitation.py +0 -0
  55. {gedcom_x-0.5.2 → gedcom_x-0.5.6}/gedcomx/TextValue.py +0 -0
  56. {gedcom_x-0.5.2 → gedcom_x-0.5.6}/gedcomx/TopLevelTypeCollection.py +0 -0
  57. {gedcom_x-0.5.2 → gedcom_x-0.5.6}/gedcomx/Zip.py +0 -0
  58. {gedcom_x-0.5.2 → gedcom_x-0.5.6}/setup.cfg +0 -0
@@ -0,0 +1,144 @@
1
+ Metadata-Version: 2.4
2
+ Name: gedcom-x
3
+ Version: 0.5.6
4
+ Summary: Python implimentation of gedcom-x standard
5
+ Author-email: "David J. Cartwright" <davidcartwright@hotmail.com>
6
+ License: MIT
7
+ Keywords: gedcom,gedcomx,ged
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Environment :: Console
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Topic :: Utilities
14
+ Classifier: Topic :: Software Development :: User Interfaces
15
+ Requires-Python: >=3.6
16
+ Description-Content-Type: text/markdown
17
+ Dynamic: requires-python
18
+
19
+ # GEDCOM-X Python Toolkit (gedcom-x beta 0.5.5)
20
+
21
+ A lightweight, class-based Python implementation of the [GEDCOM-X data model](https://github.com/FamilySearch/gedcomx).
22
+
23
+ ## ⚠️ Project Status
24
+
25
+ This project is currently in **beta**.
26
+ While the core GEDCOM-X classes and serialization are functional, some features may not be fully implemented or may not behave exactly as expected.
27
+
28
+ - Certain GEDCOM 7 tags are not yet mapped
29
+ - Some classes may be missing methods or fields
30
+ - Error handling and validation are still evolving
31
+ - Backward compatibility is **not guaranteed** until the first stable release
32
+
33
+ ### ✅ What You Can Do
34
+ - Create and manipulate GEDCOM-X objects in Python
35
+ - Serialize and deserialize data to/from JSON
36
+ - Experimentally convert GEDCOM 5x & 7 files into GEDCOM-X JSON
37
+ - Extend the classes to handle new GEDCOM tags or custom attributes
38
+ - Use the library as a foundation for genealogy-related tooling or RAG pipelines
39
+
40
+ ### ❌ What You Can’t Do (Yet)
41
+ - Rely on complete coverage of all GEDCOM 7 tags
42
+ - Expect perfect compliance with the GEDCOM-X specification
43
+ - Assume strong validation or error recovery on malformed input
44
+ - Use it as a drop-in replacement for production genealogy software
45
+ - Write GEDCOM-X to GEDCOM 5x / 7
46
+ - Create Graphs from Genealogies
47
+
48
+ Contributors and testers are welcome — feedback will help stabilize the library!
49
+
50
+ ---
51
+
52
+ This library aims to provide:
53
+
54
+ - Python classes for every GEDCOM-X type (Person, Fact, Source, etc.)
55
+ - Extensibility, with current GEDCOM RS etc, extension built in
56
+ - Serialization and Deserialization to/from GEDCOM-X JSON
57
+ - Utilities to convert GEDCOM 5x & 7 GEDCOM Files into GEDCOM-X and back
58
+ - Type-safe field definitions and extensibility hooks for future tags
59
+
60
+ ---
61
+
62
+ ## Features
63
+
64
+ - **Complete GEDCOM-X Class Coverage**
65
+ Each GEDCOM-X type is represented as a Python class with fields and types.
66
+
67
+ - **Serialization / Deserialization**
68
+ Every class can serialize to JSON and reconstruct from JSON via `_as_dict_()` and `_from_json()` methods.
69
+
70
+ - **Type Checking & Enum Validation**
71
+ Uses Python type hints and enums to ensure correct values (e.g. FactType, EventType, ConfidenceLevel).
72
+
73
+ - **Composable / Nestable Classes**
74
+ Nested objects (e.g. Person → Name → NameForm → TextValue) are constructed and validated recursively.
75
+
76
+ - **GEDCOM 7 → GEDCOM-X Conversion**
77
+ Experimental parser to read GEDCOM 7 files and convert them into structured GEDCOM-X JSON.
78
+
79
+ ---
80
+
81
+ ## Installation
82
+
83
+ Clone the repository and install dependencies:
84
+
85
+ ```bash
86
+ git clone https://github.com/yourusername/gedcom-x.git
87
+ cd gedcom-x
88
+ pip install -r requirements.txt
89
+ ```
90
+ or
91
+ ```
92
+ pip install gedcom-x
93
+ ```
94
+ ---
95
+
96
+ ## Examples
97
+
98
+ <details>
99
+
100
+ <summary>Create a Person Gedcom-X Type</summary>
101
+
102
+ ```python
103
+ import json
104
+ from gedcomx import Person, Name, NameForm, TextValue
105
+
106
+ person = Person(
107
+ id="P-123",
108
+ names=[Name(
109
+ nameForms=[NameForm(
110
+ fullText=TextValue(value="John Doe")
111
+ )]
112
+ )]
113
+ )
114
+
115
+ print(json.dumps(person._as_dict_,indent=4))
116
+ ```
117
+ result
118
+ ```text
119
+ {
120
+ "id": "P-123",
121
+ "lang": "en",
122
+ "private": false,
123
+ "living": false,
124
+ "gender": {
125
+ "lang": "en",
126
+ "type": "http://gedcomx.org/Unknown"
127
+ },
128
+ "names": [
129
+ {
130
+ "lang": "en",
131
+ "nameForms": [
132
+ {
133
+ "lang": "en",
134
+ "fullText": {
135
+ "lang": "en",
136
+ "value": "John Doe"
137
+ }
138
+ }
139
+ ]
140
+ }
141
+ ]
142
+ }
143
+
144
+ </details>
@@ -0,0 +1,126 @@
1
+ # GEDCOM-X Python Toolkit (gedcom-x beta 0.5.5)
2
+
3
+ A lightweight, class-based Python implementation of the [GEDCOM-X data model](https://github.com/FamilySearch/gedcomx).
4
+
5
+ ## ⚠️ Project Status
6
+
7
+ This project is currently in **beta**.
8
+ While the core GEDCOM-X classes and serialization are functional, some features may not be fully implemented or may not behave exactly as expected.
9
+
10
+ - Certain GEDCOM 7 tags are not yet mapped
11
+ - Some classes may be missing methods or fields
12
+ - Error handling and validation are still evolving
13
+ - Backward compatibility is **not guaranteed** until the first stable release
14
+
15
+ ### ✅ What You Can Do
16
+ - Create and manipulate GEDCOM-X objects in Python
17
+ - Serialize and deserialize data to/from JSON
18
+ - Experimentally convert GEDCOM 5x & 7 files into GEDCOM-X JSON
19
+ - Extend the classes to handle new GEDCOM tags or custom attributes
20
+ - Use the library as a foundation for genealogy-related tooling or RAG pipelines
21
+
22
+ ### ❌ What You Can’t Do (Yet)
23
+ - Rely on complete coverage of all GEDCOM 7 tags
24
+ - Expect perfect compliance with the GEDCOM-X specification
25
+ - Assume strong validation or error recovery on malformed input
26
+ - Use it as a drop-in replacement for production genealogy software
27
+ - Write GEDCOM-X to GEDCOM 5x / 7
28
+ - Create Graphs from Genealogies
29
+
30
+ Contributors and testers are welcome — feedback will help stabilize the library!
31
+
32
+ ---
33
+
34
+ This library aims to provide:
35
+
36
+ - Python classes for every GEDCOM-X type (Person, Fact, Source, etc.)
37
+ - Extensibility, with current GEDCOM RS etc, extension built in
38
+ - Serialization and Deserialization to/from GEDCOM-X JSON
39
+ - Utilities to convert GEDCOM 5x & 7 GEDCOM Files into GEDCOM-X and back
40
+ - Type-safe field definitions and extensibility hooks for future tags
41
+
42
+ ---
43
+
44
+ ## Features
45
+
46
+ - **Complete GEDCOM-X Class Coverage**
47
+ Each GEDCOM-X type is represented as a Python class with fields and types.
48
+
49
+ - **Serialization / Deserialization**
50
+ Every class can serialize to JSON and reconstruct from JSON via `_as_dict_()` and `_from_json()` methods.
51
+
52
+ - **Type Checking & Enum Validation**
53
+ Uses Python type hints and enums to ensure correct values (e.g. FactType, EventType, ConfidenceLevel).
54
+
55
+ - **Composable / Nestable Classes**
56
+ Nested objects (e.g. Person → Name → NameForm → TextValue) are constructed and validated recursively.
57
+
58
+ - **GEDCOM 7 → GEDCOM-X Conversion**
59
+ Experimental parser to read GEDCOM 7 files and convert them into structured GEDCOM-X JSON.
60
+
61
+ ---
62
+
63
+ ## Installation
64
+
65
+ Clone the repository and install dependencies:
66
+
67
+ ```bash
68
+ git clone https://github.com/yourusername/gedcom-x.git
69
+ cd gedcom-x
70
+ pip install -r requirements.txt
71
+ ```
72
+ or
73
+ ```
74
+ pip install gedcom-x
75
+ ```
76
+ ---
77
+
78
+ ## Examples
79
+
80
+ <details>
81
+
82
+ <summary>Create a Person Gedcom-X Type</summary>
83
+
84
+ ```python
85
+ import json
86
+ from gedcomx import Person, Name, NameForm, TextValue
87
+
88
+ person = Person(
89
+ id="P-123",
90
+ names=[Name(
91
+ nameForms=[NameForm(
92
+ fullText=TextValue(value="John Doe")
93
+ )]
94
+ )]
95
+ )
96
+
97
+ print(json.dumps(person._as_dict_,indent=4))
98
+ ```
99
+ result
100
+ ```text
101
+ {
102
+ "id": "P-123",
103
+ "lang": "en",
104
+ "private": false,
105
+ "living": false,
106
+ "gender": {
107
+ "lang": "en",
108
+ "type": "http://gedcomx.org/Unknown"
109
+ },
110
+ "names": [
111
+ {
112
+ "lang": "en",
113
+ "nameForms": [
114
+ {
115
+ "lang": "en",
116
+ "fullText": {
117
+ "lang": "en",
118
+ "value": "John Doe"
119
+ }
120
+ }
121
+ ]
122
+ }
123
+ ]
124
+ }
125
+
126
+ </details>
@@ -0,0 +1,144 @@
1
+ Metadata-Version: 2.4
2
+ Name: gedcom-x
3
+ Version: 0.5.6
4
+ Summary: Python implimentation of gedcom-x standard
5
+ Author-email: "David J. Cartwright" <davidcartwright@hotmail.com>
6
+ License: MIT
7
+ Keywords: gedcom,gedcomx,ged
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Environment :: Console
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Topic :: Utilities
14
+ Classifier: Topic :: Software Development :: User Interfaces
15
+ Requires-Python: >=3.6
16
+ Description-Content-Type: text/markdown
17
+ Dynamic: requires-python
18
+
19
+ # GEDCOM-X Python Toolkit (gedcom-x beta 0.5.5)
20
+
21
+ A lightweight, class-based Python implementation of the [GEDCOM-X data model](https://github.com/FamilySearch/gedcomx).
22
+
23
+ ## ⚠️ Project Status
24
+
25
+ This project is currently in **beta**.
26
+ While the core GEDCOM-X classes and serialization are functional, some features may not be fully implemented or may not behave exactly as expected.
27
+
28
+ - Certain GEDCOM 7 tags are not yet mapped
29
+ - Some classes may be missing methods or fields
30
+ - Error handling and validation are still evolving
31
+ - Backward compatibility is **not guaranteed** until the first stable release
32
+
33
+ ### ✅ What You Can Do
34
+ - Create and manipulate GEDCOM-X objects in Python
35
+ - Serialize and deserialize data to/from JSON
36
+ - Experimentally convert GEDCOM 5x & 7 files into GEDCOM-X JSON
37
+ - Extend the classes to handle new GEDCOM tags or custom attributes
38
+ - Use the library as a foundation for genealogy-related tooling or RAG pipelines
39
+
40
+ ### ❌ What You Can’t Do (Yet)
41
+ - Rely on complete coverage of all GEDCOM 7 tags
42
+ - Expect perfect compliance with the GEDCOM-X specification
43
+ - Assume strong validation or error recovery on malformed input
44
+ - Use it as a drop-in replacement for production genealogy software
45
+ - Write GEDCOM-X to GEDCOM 5x / 7
46
+ - Create Graphs from Genealogies
47
+
48
+ Contributors and testers are welcome — feedback will help stabilize the library!
49
+
50
+ ---
51
+
52
+ This library aims to provide:
53
+
54
+ - Python classes for every GEDCOM-X type (Person, Fact, Source, etc.)
55
+ - Extensibility, with current GEDCOM RS etc, extension built in
56
+ - Serialization and Deserialization to/from GEDCOM-X JSON
57
+ - Utilities to convert GEDCOM 5x & 7 GEDCOM Files into GEDCOM-X and back
58
+ - Type-safe field definitions and extensibility hooks for future tags
59
+
60
+ ---
61
+
62
+ ## Features
63
+
64
+ - **Complete GEDCOM-X Class Coverage**
65
+ Each GEDCOM-X type is represented as a Python class with fields and types.
66
+
67
+ - **Serialization / Deserialization**
68
+ Every class can serialize to JSON and reconstruct from JSON via `_as_dict_()` and `_from_json()` methods.
69
+
70
+ - **Type Checking & Enum Validation**
71
+ Uses Python type hints and enums to ensure correct values (e.g. FactType, EventType, ConfidenceLevel).
72
+
73
+ - **Composable / Nestable Classes**
74
+ Nested objects (e.g. Person → Name → NameForm → TextValue) are constructed and validated recursively.
75
+
76
+ - **GEDCOM 7 → GEDCOM-X Conversion**
77
+ Experimental parser to read GEDCOM 7 files and convert them into structured GEDCOM-X JSON.
78
+
79
+ ---
80
+
81
+ ## Installation
82
+
83
+ Clone the repository and install dependencies:
84
+
85
+ ```bash
86
+ git clone https://github.com/yourusername/gedcom-x.git
87
+ cd gedcom-x
88
+ pip install -r requirements.txt
89
+ ```
90
+ or
91
+ ```
92
+ pip install gedcom-x
93
+ ```
94
+ ---
95
+
96
+ ## Examples
97
+
98
+ <details>
99
+
100
+ <summary>Create a Person Gedcom-X Type</summary>
101
+
102
+ ```python
103
+ import json
104
+ from gedcomx import Person, Name, NameForm, TextValue
105
+
106
+ person = Person(
107
+ id="P-123",
108
+ names=[Name(
109
+ nameForms=[NameForm(
110
+ fullText=TextValue(value="John Doe")
111
+ )]
112
+ )]
113
+ )
114
+
115
+ print(json.dumps(person._as_dict_,indent=4))
116
+ ```
117
+ result
118
+ ```text
119
+ {
120
+ "id": "P-123",
121
+ "lang": "en",
122
+ "private": false,
123
+ "living": false,
124
+ "gender": {
125
+ "lang": "en",
126
+ "type": "http://gedcomx.org/Unknown"
127
+ },
128
+ "names": [
129
+ {
130
+ "lang": "en",
131
+ "nameForms": [
132
+ {
133
+ "lang": "en",
134
+ "fullText": {
135
+ "lang": "en",
136
+ "value": "John Doe"
137
+ }
138
+ }
139
+ ]
140
+ }
141
+ ]
142
+ }
143
+
144
+ </details>
@@ -1,3 +1,4 @@
1
+ README.md
1
2
  pyproject.toml
2
3
  setup.py
3
4
  gedcom_x.egg-info/PKG-INFO
@@ -14,13 +15,17 @@ gedcomx/Document.py
14
15
  gedcomx/Event.py
15
16
  gedcomx/EvidenceReference.py
16
17
  gedcomx/Exceptions.py
18
+ gedcomx/ExtensibleEnum.py
17
19
  gedcomx/Fact.py
18
20
  gedcomx/Gedcom.py
21
+ gedcomx/Gedcom5x.py
19
22
  gedcomx/GedcomX.py
20
23
  gedcomx/Gender.py
21
24
  gedcomx/Group.py
22
25
  gedcomx/Identifier.py
23
26
  gedcomx/Logging.py
27
+ gedcomx/LoggingHub.py
28
+ gedcomx/Mutations.py
24
29
  gedcomx/Name.py
25
30
  gedcomx/Note.py
26
31
  gedcomx/OnlineAccount.py
@@ -37,8 +42,7 @@ gedcomx/SourceReference.py
37
42
  gedcomx/Subject.py
38
43
  gedcomx/TextValue.py
39
44
  gedcomx/TopLevelTypeCollection.py
45
+ gedcomx/Translation.py
40
46
  gedcomx/URI.py
41
47
  gedcomx/Zip.py
42
- gedcomx/_Links.py
43
- gedcomx/__init__.py
44
- gedcomx/g7interop.py
48
+ gedcomx/__init__.py
@@ -61,6 +61,8 @@ class Address:
61
61
 
62
62
  @value.setter
63
63
  def value(self,value: str):
64
+ self._value = value
65
+ return
64
66
  raise NotImplementedError("Parsing of a full address is not implimented.")
65
67
 
66
68
  def _append(self,value):
@@ -139,6 +139,14 @@ class Agent:
139
139
  }
140
140
  return Serialization.serialize_dict(type_as_dict)
141
141
 
142
+ @classmethod
143
+ def _from_json_(cls, data: dict):
144
+ """
145
+ Create a Person instance from a JSON-dict (already parsed).
146
+ """
147
+ type_as_dict = Serialization.get_class_fields('Agent')
148
+ return Serialization.deserialize(data, type_as_dict)
149
+
142
150
  def __str__(self):
143
151
  """
144
152
  Return a human-readable string representation of the Agent.
@@ -179,8 +187,7 @@ class Agent:
179
187
  self.uri == other.uri
180
188
  )
181
189
  '''
182
- print(other)
183
- print(self)
190
+
184
191
  self_names = {n.value for n in self.names if hasattr(n, "value")}
185
192
  other_names = {n.value for n in other.names if hasattr(n, "value")}
186
193
  if self_names & other_names: # intersection not empty
@@ -10,11 +10,11 @@ class Attribution:
10
10
  """Attribution Information for a Genealogy, Conclusion, Subject and child classes
11
11
 
12
12
  Args:
13
- contributor (Agent): Contributor to object being attributed.
14
- modified (timestamp): timestamp for when this record was modified.
15
- changeMessage (str): Birth date (YYYY-MM-DD).
13
+ contributor (Agent, optional): Contributor to object being attributed.
14
+ modified (timestamp, optional): timestamp for when this record was modified.
15
+ changeMessage (str, optional): Birth date (YYYY-MM-DD).
16
16
  creator (Agent, optional): Creator of object being attributed.
17
- created (timestamp): timestamp for when this record was created
17
+ created (timestamp, optional): timestamp for when this record was created
18
18
 
19
19
  Raises:
20
20
 
@@ -56,45 +56,9 @@ class Attribution:
56
56
  """
57
57
  # contributor
58
58
 
59
- contrib = None
60
- if 'contributor' in data:
61
- contrib_data = data['contributor']
62
-
63
- contrib = Resource(contrib_data['resource'],contrib_data['resourceId'])
64
-
65
- # creator
66
- creat = None
67
- if 'creator' in data:
68
- raw = data['creator']
69
- if isinstance(raw, dict):
70
- creat = Resource._from_json_(raw)
71
- elif isinstance(raw, str):
72
- creat = Resource(uri=raw)
73
-
74
- # parse created date
75
- raw_created = data.get('created')
76
- if isinstance(raw_created, (int, float)):
77
- created_dt = datetime.fromtimestamp(raw_created / 1000.0)
78
- elif isinstance(raw_created, str):
79
- created_dt = datetime.fromisoformat(raw_created)
80
- else:
81
- created_dt = None
82
-
83
- # parse modified date
84
- raw_modified = data.get('modified')
85
- if isinstance(raw_modified, (int, float)):
86
- modified_dt = datetime.fromtimestamp(raw_modified / 1000.0)
87
- elif isinstance(raw_modified, str):
88
- modified_dt = datetime.fromisoformat(raw_modified)
89
- else:
90
- modified_dt = None
91
-
92
- change_msg = data.get('changeMessage')
93
-
94
- return cls(
95
- contributor=contrib,
96
- created=created_dt,
97
- creator=creat,
98
- modified=modified_dt,
99
- changeMessage=change_msg
100
- )
59
+ """
60
+ Create a Person instance from a JSON-dict (already parsed).
61
+ """
62
+ from .Serialization import Serialization
63
+
64
+ return Serialization.deserialize(data, Attribution)