Skip to content

Commit

Permalink
merge s/datatype/data type/g change and enumset change
Browse files Browse the repository at this point in the history
  • Loading branch information
tychonievich committed Aug 30, 2022
1 parent ebcbdd3 commit c17fde2
Show file tree
Hide file tree
Showing 10 changed files with 70 additions and 47 deletions.
10 changes: 5 additions & 5 deletions build/uri-def.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ def get_prefixes(txt):
pfx[abbr] = lng
return pfx

def find_datatypes(txt, g7):
def find_data_types(txt, g7):
"""Returns datatype:uri and adds URI suffixes to g7"""
dturi = {}
for section in re.finditer(r'^#+ *([^\n]*)\n+((?:[^\n]|\n+[^\n#])*[^\n]*URI for[^\n]*datatypes? is(?:[^\n]|\n+[^\n#])*)', txt, re.M):
for dt, uri in re.findall(r'URI[^\n]*`([^\n`]*)` datatype[^\n]*`([^`\n:]*:[^\n`]*)`', section.group(0)):
for section in re.finditer(r'^#+ *([^\n]*)\n+((?:[^\n]|\n+[^\n#])*[^\n]*URI for[^\n]*data types? is(?:[^\n]|\n+[^\n#])*)', txt, re.M):
for dt, uri in re.findall(r'URI[^\n]*`([^\n`]*)` data type[^\n]*`([^`\n:]*:[^\n`]*)`', section.group(0)):
dturi[dt] = uri
if uri.startswith('g7:'):
if '#' in uri: uri = uri[:uri.find('#')]
if uri[3:] not in g7:
g7[uri[3:]] = ('datatype', [section.group(2).strip()])
g7[uri[3:]] = ('data type', [section.group(2).strip()])
return dturi

def find_cat_tables(txt, g7, tagsets):
Expand Down Expand Up @@ -312,7 +312,7 @@ def expand_prefix(txt, prefixes):
txt = get_text(specs)

prefixes = get_prefixes(txt)
dtypes = find_datatypes(txt, g7)
dtypes = find_data_types(txt, g7)
rules = parse_rules(txt)
ssp = parse_gedstruct(txt, rules, dtypes)
tagsets = find_descriptions(txt, g7, ssp)
Expand Down
38 changes: 19 additions & 19 deletions extracted-files/grammar.gedstruct
Original file line number Diff line number Diff line change
Expand Up @@ -307,11 +307,11 @@ n MARL [Y|<NULL>] {1:1} g7:MARL
+1 TYPE <Text> {0:1} g7:TYPE
+1 <<FAMILY_EVENT_DETAIL>> {0:1}
|
n MARS [Y|<NULL>] {1:1} g7:MARS
n MARR [Y|<NULL>] {1:1} g7:MARR
+1 TYPE <Text> {0:1} g7:TYPE
+1 <<FAMILY_EVENT_DETAIL>> {0:1}
|
n MARR [Y|<NULL>] {1:1} g7:MARR
n MARS [Y|<NULL>] {1:1} g7:MARS
+1 TYPE <Text> {0:1} g7:TYPE
+1 <<FAMILY_EVENT_DETAIL>> {0:1}
|
Expand Down Expand Up @@ -401,6 +401,13 @@ n AGE <Age> {0:1} g7:AGE

INDIVIDUAL_EVENT_STRUCTURE :=
[
n ADOP [Y|<NULL>] {1:1} g7:ADOP
+1 TYPE <Text> {0:1} g7:TYPE
+1 <<INDIVIDUAL_EVENT_DETAIL>> {0:1}
+1 FAMC @<XREF:FAM>@ {0:1} g7:ADOP-FAMC
+2 ADOP <Enum> {0:1} g7:FAMC-ADOP
+3 PHRASE <Text> {0:1} g7:PHRASE
|
n BAPM [Y|<NULL>] {1:1} g7:BAPM
+1 TYPE <Text> {0:1} g7:TYPE
+1 <<INDIVIDUAL_EVENT_DETAIL>> {0:1}
Expand All @@ -413,6 +420,11 @@ n BASM [Y|<NULL>] {1:1} g7:BASM
+1 TYPE <Text> {0:1} g7:TYPE
+1 <<INDIVIDUAL_EVENT_DETAIL>> {0:1}
|
n BIRT [Y|<NULL>] {1:1} g7:BIRT
+1 TYPE <Text> {0:1} g7:TYPE
+1 <<INDIVIDUAL_EVENT_DETAIL>> {0:1}
+1 FAMC @<XREF:FAM>@ {0:1} g7:FAMC
|
n BLES [Y|<NULL>] {1:1} g7:BLES
+1 TYPE <Text> {0:1} g7:TYPE
+1 <<INDIVIDUAL_EVENT_DETAIL>> {0:1}
Expand All @@ -425,6 +437,11 @@ n CENS [Y|<NULL>] {1:1} g7:INDI-CENS
+1 TYPE <Text> {0:1} g7:TYPE
+1 <<INDIVIDUAL_EVENT_DETAIL>> {0:1}
|
n CHR [Y|<NULL>] {1:1} g7:CHR
+1 TYPE <Text> {0:1} g7:TYPE
+1 <<INDIVIDUAL_EVENT_DETAIL>> {0:1}
+1 FAMC @<XREF:FAM>@ {0:1} g7:FAMC
|
n CHRA [Y|<NULL>] {1:1} g7:CHRA
+1 TYPE <Text> {0:1} g7:TYPE
+1 <<INDIVIDUAL_EVENT_DETAIL>> {0:1}
Expand Down Expand Up @@ -477,23 +494,6 @@ n WILL [Y|<NULL>] {1:1} g7:WILL
+1 TYPE <Text> {0:1} g7:TYPE
+1 <<INDIVIDUAL_EVENT_DETAIL>> {0:1}
|
n ADOP [Y|<NULL>] {1:1} g7:ADOP
+1 TYPE <Text> {0:1} g7:TYPE
+1 <<INDIVIDUAL_EVENT_DETAIL>> {0:1}
+1 FAMC @<XREF:FAM>@ {0:1} g7:ADOP-FAMC
+2 ADOP <Enum> {0:1} g7:FAMC-ADOP
+3 PHRASE <Text> {0:1} g7:PHRASE
|
n BIRT [Y|<NULL>] {1:1} g7:BIRT
+1 TYPE <Text> {0:1} g7:TYPE
+1 <<INDIVIDUAL_EVENT_DETAIL>> {0:1}
+1 FAMC @<XREF:FAM>@ {0:1} g7:FAMC
|
n CHR [Y|<NULL>] {1:1} g7:CHR
+1 TYPE <Text> {0:1} g7:TYPE
+1 <<INDIVIDUAL_EVENT_DETAIL>> {0:1}
+1 FAMC @<XREF:FAM>@ {0:1} g7:FAMC
|
n EVEN <Text> {1:1} g7:INDI-EVEN
+1 TYPE <Text> {1:1} g7:TYPE
+1 <<INDIVIDUAL_EVENT_DETAIL>> {0:1}
Expand Down
6 changes: 3 additions & 3 deletions extracted-files/tags/PHRASE
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ descriptions:
- Phrase
- |
Textual information that cannot be expressed in the superstructure due to
the limitations of its datatype. A PHRASE may restate information contained
in the superstructure, but doing so is not recommended unless it is needed
for clarity.
the limitations of its data type. A PHRASE may restate information
contained in the superstructure, but doing so is not recommended unless it
is needed for clarity.

A date interpreted from the phrase “The Feast of St John” might be

Expand Down
4 changes: 2 additions & 2 deletions extracted-files/tags/type-Age
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
---
lang: en-US

type: datatype
type: data type

uri: https://gedcom.io/terms/v7/type-Age

Expand Down Expand Up @@ -53,5 +53,5 @@ descriptions:
Versions 5.5 and 5.5.1 allowed a few specific phrases inside Age payloads.
Age phrases were moved to the PHRASE substructure in 7.0.

The URI for the Age datatype is https://gedcom.io/terms/v7/type-Age.
The URI for the Age data type is https://gedcom.io/terms/v7/type-Age.
...
11 changes: 6 additions & 5 deletions extracted-files/tags/type-Date
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
---
lang: en-US

type: datatype
type: data type

uri: https://gedcom.io/terms/v7/type-Date

Expand All @@ -12,7 +12,7 @@ descriptions:
approximate dates, date periods, and dates expressed in different
calendars.

Technically, there are 3 distinct date datatypes:
Technically, there are 3 distinct date data types:

- DateValue is a generic type that can express many kinds of dates.
- DateExact is used for timestamps and other fully-known dates.
Expand Down Expand Up @@ -103,11 +103,12 @@ descriptions:
2 DATE
3 PHRASE 5 January (year unknown)

The URI for the DateValue datatype is https://gedcom.io/terms/v7/type-Date.
The URI for the DateValue data type is
https://gedcom.io/terms/v7/type-Date.

The URI for the DateExact datatype is
The URI for the DateExact data type is
https://gedcom.io/terms/v7/type-Date#exact.

The URI for the DatePeriod datatype is
The URI for the DatePeriod data type is
https://gedcom.io/terms/v7/type-Date#period.
...
26 changes: 24 additions & 2 deletions extracted-files/tags/type-Enum
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
---
lang: en-US

type: datatype
type: data type

uri: https://gedcom.io/terms/v7/type-Enum

Expand All @@ -22,5 +22,27 @@ descriptions:
Each enumeration value has a distinct meaning as identified by its
corresponding URI.

The URI for the Enum datatype is https://gedcom.io/terms/v7/type-Enum.
The URI of a given tag in an enumeration payload is determined by the tag
itself and by the structure type of the structure it is in the payload of.

The tag HUSB is used in this document to represent two enumeration values.
Which one is meant can be identified by the structure type it appears in as
follows:

----------------------------------------------------------------------------------
Containing structure type Enumeration value identified by tag HUSB
-------------------------------------- -------------------------------------------
https://gedcom.io/terms/v7/FAMC-ADOP https://gedcom.io/terms/v7/enum-ADOP-HUSB

https://gedcom.io/terms/v7/ROLE https://gedcom.io/terms/v7/enum-HUSB
----------------------------------------------------------------------------------

An extension could also place either of these enumeration values in an
extension structure type; the extension authors should document which one
they permit.

The HUSB tag is also used to identify two different structure types,
https://gedcom.io/terms/v7/FAM-HUSB and https://gedcom.io/terms/v7/HUSB.

The URI for the Enum data type is https://gedcom.io/terms/v7/type-Enum.
...
10 changes: 5 additions & 5 deletions extracted-files/tags/type-List
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
---
lang: en-US

type: datatype
type: data type

uri: https://gedcom.io/terms/v7/type-List

descriptions:
- |
A list is a meta-syntax representing a sequence of values with another
datatype. Two list datatypes are used in this document: List:Text and
A list is a meta-syntax representing a sequence of values with another data
type. Two list data types are used in this document: List:Text and
List:Enum. Lists are serialized in a comma-separated form, delimited by a
comma (U+002C ,) and any number of spaces (U+0020) between each item. It is
recommended that a comma-space pair (U+002C U+0020) be used as the
Expand All @@ -33,9 +33,9 @@ descriptions:
There is no escaping mechanism to allow lists of entries that begin or end
with spaces or that contain comma characters.

The URI for the List:Text datatype is
The URI for the List:Text data type is
https://gedcom.io/terms/v7/type-List#Text.

The URI for the List:Enum datatype is
The URI for the List:Enum data type is
https://gedcom.io/terms/v7/type-List#Enum.
...
4 changes: 2 additions & 2 deletions extracted-files/tags/type-Name
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
---
lang: en-US

type: datatype
type: data type

uri: https://gedcom.io/terms/v7/type-Name

Expand All @@ -25,6 +25,6 @@ descriptions:
specification does not provide any standard way of representing names that
contain U+002F.

The URI for the PersonalName datatype is
The URI for the PersonalName data type is
https://gedcom.io/terms/v7/type-Name.
...
4 changes: 2 additions & 2 deletions extracted-files/tags/type-Time
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
---
lang: en-US

type: datatype
type: data type

uri: https://gedcom.io/terms/v7/type-Time

Expand All @@ -24,5 +24,5 @@ descriptions:
The above grammar prohibits end-of-day instant 24:00:00 and leap-seconds.
It allows both 02:50 and 2:50 as the same time.

The URI for the Time datatype is https://gedcom.io/terms/v7/type-Time.
The URI for the Time data type is https://gedcom.io/terms/v7/type-Time.
...
4 changes: 2 additions & 2 deletions specification/gedcom-01-serialization.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Each **structure type** is identified by a URI and defines several properties of
- The payload type of the structure's payload, which shall be one of
- no payload, or
- a pointer to a record with a specific structure type, or
- a [datatype](#datatypes);
- a [data type](#datatypes);
if an [enumeration](#enumeration) or [list of enumerations](#list), also a set of permitted enumeration values.
- Which structure types may appear as substructures of the structure and with what **cardinality** they may appear.
Cardinality is specified by two flags:
Expand Down Expand Up @@ -306,7 +306,7 @@ The recommended way to go beyond the set of standard structure types in this spe

This specification also provides multiple ways for extension authors to go beyond the specification without submitting a feature request, which are described in the remainder of this section.

Extensions can introduce new structure types, new enumeration values, new calendars with their associated months, and new datatypes.
Extensions can introduce new structure types, new enumeration values, new calendars with their associated months, and new data types.
They can also extend existing structures with new permitted substructure types and extend existing enumeration-type payloads with new permitted values.
Extensions cannot change existing meanings, cardinalities, or calendars.

Expand Down

0 comments on commit c17fde2

Please sign in to comment.