--- &test-M5DY
Title: Spec Example 2.11. Mapping between Sequences
Tags: [ complex-key, explicit-key, mapping, sequence, spec ]
? - Detroit Tigers
- Chicago cubs
:
- 2001-07-23
? [ New York Yankees,
Atlanta Braves ]
: [ 2001-07-02, 2001-08-12,
2001-08-14 ]
+STR
+DOC
+MAP
+SEQ
=VAL :Detroit Tigers
=VAL :Chicago cubs
-SEQ
+SEQ
=VAL :2001-07-23
-SEQ
+SEQ []
=VAL :New York Yankees
=VAL :Atlanta Braves
-SEQ
+SEQ []
=VAL :2001-07-02
=VAL :2001-08-12
=VAL :2001-08-14
-SEQ
-MAP
-DOC
-STR
diff
Minimal Events:
+STR
+DOC
+MAP
+SEQ
=VAL :Detroit Tigers
=VAL :Chicago cubs
-SEQ
+SEQ
=VAL :2001-07-23
-SEQ
+SEQ
=VAL :New York Yankees
=VAL :Atlanta Braves
-SEQ
+SEQ
=VAL :2001-07-02
=VAL :2001-08-12
=VAL :2001-08-14
-SEQ
-MAP
-DOC
-STR
Transformed Events:
+STR
+DOC
+MAP
=VAL :- Detroit Tigers
=VAL :
=VAL :- Chicago cubs
+SEQ
=VAL :2001-07-23
-SEQ
=VAL :[ New York Yankees, Atlanta Braves
=VAL :
=VAL :]
+SEQ
=VAL :2001-07-02
=VAL :2001-08-12
=VAL :2001-08-14
-SEQ
-MAP
-DOC
-STR
Got Events:
+STR
+DOC
+MAP
=VAL :- Detroit Tigers
=VAL :
=VAL :- Chicago cubs
+SEQ
=VAL :2001-07-23
-SEQ
=VAL :[ New York Yankees, Atlanta Braves
=VAL :
=VAL :]
+SEQ
=VAL :2001-07-02
=VAL :2001-08-12
=VAL :2001-08-14
-SEQ
-MAP
-DOC
-STR
error
YAML Error: Inconsistent indentation level
Code: YAML_PARSE_ERR_INCONSISTENT_INDENTATION
Line: 2
Document: 1
at /perl5/lib/perl5/YAML/Loader.pm line 804.
error
Traceback (most recent call last):
File "/yaml/bin/py-pyyaml-py", line 36, in <module>
for doc in yaml.load_all(sys.stdin.read(), Loader=yaml.FullLoader):
File "/python/lib/python3.12/site-packages/yaml/__init__.py", line 130, in load_all
yield loader.get_data()
^^^^^^^^^^^^^^^^^
File "/python/lib/python3.12/site-packages/yaml/constructor.py", line 45, in get_data
return self.construct_document(self.get_node())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/python/lib/python3.12/site-packages/yaml/constructor.py", line 60, in construct_document
for dummy in generator:
File "/python/lib/python3.12/site-packages/yaml/constructor.py", line 413, in construct_yaml_map
value = self.construct_mapping(node)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/python/lib/python3.12/site-packages/yaml/constructor.py", line 218, in construct_mapping
return super().construct_mapping(node, deep=deep)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/python/lib/python3.12/site-packages/yaml/constructor.py", line 141, in construct_mapping
raise ConstructorError("while constructing a mapping", node.start_mark,
yaml.constructor.ConstructorError: while constructing a mapping
in "<unicode string>", line 1, column 1:
? - Detroit Tigers
^
found unhashable key
in "<unicode string>", line 1, column 3:
? - Detroit Tigers
^
na
{
stdin:1:3: error: Non scalar keys are not allowed in JSON emit mode
? - Detroit Tigers
^~~~~~~~~~~~~~~~
- Chicago cubs
~~~~~~~~~~~~~~~~
na
{? ["Detroit Tigers", "Chicago cubs"] : ["2001-07-23"], ? ["New York Yankees", "Atlanta Braves"] : ["2001-07-02", "2001-08-12", "2001-08-14"]}
na
yaml: invalid map key: []interface {}{"Detroit Tigers", "Chicago cubs"}
na
{"[\"Detroit Tigers\",\"Chicago cubs\"]":["2001-07-23"],"[\"New York Yankees\",\"Atlanta Braves\"]":["2001-07-02","2001-08-12","2001-08-14"]}
na
Line Col Char Byte Token|Content
1 0 0 0 +DOC |
1 0 0 0 +NODE|
1 0 0 0 +MAP |
1 0 0 0 +PAIR|
1 0 0 0 =SYNX|?
1 1 1 1 =DENT|.
1 2 2 2 +NODE|
1 2 2 2 +SEQ |
1 2 2 2 =SYNX|-
1 3 3 3 =WSPC|.
1 4 4 4 +NODE|
1 4 4 4 +VAL |
1 4 4 4 =TEXT|Detroit.Tigers
1 18 18 18 -VAL |
1 18 18 18 -NODE|
1 18 18 18 =EOL |\x0a
2 0 19 19 =DENT|..
2 2 21 21 =SYNX|-
2 3 22 22 =WSPC|.
2 4 23 23 +NODE|
2 4 23 23 +VAL |
2 4 23 23 =TEXT|Chicago.cubs
2 16 35 35 -VAL |
2 16 35 35 -NODE|
2 16 35 35 =EOL |\x0a
3 0 36 36 -SEQ |
3 0 36 36 -NODE|
3 0 36 36 =SYNX|:
3 1 37 37 +NODE|
3 1 37 37 =EOL |\x0a
4 0 38 38 +SEQ |
4 0 38 38 =DENT|..
4 2 40 40 =SYNX|-
4 3 41 41 =WSPC|.
4 4 42 42 +NODE|
4 4 42 42 +VAL |
4 4 42 42 =TEXT|2001-07-23
4 14 52 52 -VAL |
4 14 52 52 -NODE|
4 14 52 52 =EOL |\x0a
5 0 53 53 =EOL |\x0a
6 0 54 54 -SEQ |
6 0 54 54 -NODE|
6 0 54 54 -PAIR|
6 0 54 54 +PAIR|
6 0 54 54 =SYNX|?
6 1 55 55 =WSPC|.
6 2 56 56 +NODE|
6 2 56 56 +SEQ |
6 2 56 56 =SYNX|[
6 3 57 57 =WSPC|.
6 4 58 58 +NODE|
6 4 58 58 +VAL |
6 4 58 58 =TEXT|New.York.Yankees
6 20 74 74 -VAL |
6 20 74 74 -NODE|
6 20 74 74 =SYNX|,
6 21 75 75 =EOL |\x0a
7 0 76 76 =DENT|.
7 1 77 77 =WSPC|...
7 4 80 80 +NODE|
7 4 80 80 +VAL |
7 4 80 80 =TEXT|Atlanta.Braves
7 18 94 94 -VAL |
7 18 94 94 -NODE|
7 18 94 94 =WSPC|.
7 19 95 95 =SYNX|]
7 20 96 96 -SEQ |
7 20 96 96 -NODE|
7 20 96 96 =EOL |\x0a
8 0 97 97 =SYNX|:
8 1 98 98 =WSPC|.
8 2 99 99 +NODE|
8 2 99 99 +SEQ |
8 2 99 99 =SYNX|[
8 3 100 100 =WSPC|.
8 4 101 101 +NODE|
8 4 101 101 +VAL |
8 4 101 101 =TEXT|2001-07-02
8 14 111 111 -VAL |
8 14 111 111 -NODE|
8 14 111 111 =SYNX|,
8 15 112 112 =WSPC|.
8 16 113 113 +NODE|
8 16 113 113 +VAL |
8 16 113 113 =TEXT|2001-08-12
8 26 123 123 -VAL |
8 26 123 123 -NODE|
8 26 123 123 =SYNX|,
8 27 124 124 =EOL |\x0a
9 0 125 125 =DENT|.
9 1 126 126 =WSPC|...
9 4 129 129 +NODE|
9 4 129 129 +VAL |
9 4 129 129 =TEXT|2001-08-14
9 14 139 139 -VAL |
9 14 139 139 -NODE|
9 14 139 139 =WSPC|.
9 15 140 140 =SYNX|]
9 16 141 141 -SEQ |
9 16 141 141 -NODE|
9 16 141 141 =EOL |\x0a
10 0 142 142 -PAIR|
10 0 142 142 -MAP |
10 0 142 142 -NODE|
10 0 142 142 -DOC |
na
{"Detroit Tigers,Chicago cubs":["2001-07-23T00:00:00.000Z"],"New York Yankees,Atlanta Braves":["2001-07-02T00:00:00.000Z","2001-08-12T00:00:00.000Z","2001-08-14T00:00:00.000Z"]}
na
{
"[ Detroit Tigers, Chicago cubs ]": [
"2001-07-23"
],
"[ New York Yankees, Atlanta Braves ]": [
"2001-07-02",
"2001-08-12",
"2001-08-14"
]
}
(node:2967) Warning: Keys with collection values will be stringified due to JS Object restrictions: "[ Detroit Tigers, Chicago cubs ]". Set mapAsMap: true to use object keys.
(Use `node --trace-warnings ...` to show where the warning was created)
na
luajit: /yaml/bin/lua-lyaml-json:8: Cannot serialise table: table key must be a number or string
stack traceback:
[C]: in function 'encode'
/yaml/bin/lua-lyaml-json:8: in main chunk
[C]: at 0x55a2fe106ed0
na
{
"['Detroit Tigers','Chicago cubs']" : [
"2001-07-23"
],
"['New York Yankees','Atlanta Braves']" : [
"2001-07-02",
"2001-08-12",
"2001-08-14"
]
}
na
{
'[\'Detroit Tigers\',\'Chicago cubs\']' => [
'2001-07-23'
],
'[\'New York Yankees\',\'Atlanta Braves\']' => [
'2001-07-02',
'2001-08-12',
'2001-08-14'
]
}
na
{
"['Detroit Tigers','Chicago cubs']" : [
"2001-07-23"
],
"['New York Yankees','Atlanta Braves']" : [
"2001-07-02",
"2001-08-12",
"2001-08-14"
]
}
na
{
'[\'Detroit Tigers\',\'Chicago cubs\']' => [
'2001-07-23'
],
'[\'New York Yankees\',\'Atlanta Braves\']' => [
'2001-07-02',
'2001-08-12',
'2001-08-14'
]
}
na
{
"ARRAY(0x7fb178fbe7f0)" : [
"2001-07-23"
],
"ARRAY(0x7fb178fe8ab0)" : [
"2001-07-02",
"2001-08-12",
"2001-08-14"
]
}
na
{
'ARRAY(0x7f12502ea808)' => [
'2001-07-02',
'2001-08-12',
'2001-08-14'
],
'ARRAY(0x7f1250337ce0)' => [
'2001-07-23'
]
}
na
YAML::Tiny does not support a feature in line '? - Detroit Tigers' at /yaml/bin/perl-tiny-json line 12.
na
{
"ARRAY(0x7fc3d49dd850)" : [
"2001-07-02",
"2001-08-12",
"2001-08-14"
],
"ARRAY(0x7fc3d49dd8e0)" : [
"2001-07-23"
]
}
na
{
'ARRAY(0x7fe1e06e7ad8)' => [
'2001-07-02',
'2001-08-12',
'2001-08-14'
],
'ARRAY(0x7fe1e0753608)' => [
'2001-07-23'
]
}
na
YAML Error: Inconsistent indentation level
Code: YAML_PARSE_ERR_INCONSISTENT_INDENTATION
Line: 2
Document: 1
at /perl5/lib/perl5/YAML/Loader.pm line 804.
na
Traceback (most recent call last):
File "/yaml/bin/py-pyyaml-json", line 19, in <module>
for doc in yaml.load_all(sys.stdin.read(), Loader=yaml.FullLoader):
File "/python/lib/python3.12/site-packages/yaml/__init__.py", line 130, in load_all
yield loader.get_data()
^^^^^^^^^^^^^^^^^
File "/python/lib/python3.12/site-packages/yaml/constructor.py", line 45, in get_data
return self.construct_document(self.get_node())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/python/lib/python3.12/site-packages/yaml/constructor.py", line 60, in construct_document
for dummy in generator:
File "/python/lib/python3.12/site-packages/yaml/constructor.py", line 413, in construct_yaml_map
value = self.construct_mapping(node)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/python/lib/python3.12/site-packages/yaml/constructor.py", line 218, in construct_mapping
return super().construct_mapping(node, deep=deep)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/python/lib/python3.12/site-packages/yaml/constructor.py", line 141, in construct_mapping
raise ConstructorError("while constructing a mapping", node.start_mark,
yaml.constructor.ConstructorError: while constructing a mapping
in "<unicode string>", line 1, column 1:
? - Detroit Tigers
^
found unhashable key
in "<unicode string>", line 1, column 3:
? - Detroit Tigers
^
na
{('Detroit Tigers', 'Chicago cubs'): [datetime.date(2001, 7, 23)],
('New York Yankees', 'Atlanta Braves'): [datetime.date(2001, 7, 2),
datetime.date(2001, 8, 12),
datetime.date(2001, 8, 14)]}
na
{"[\"Detroit Tigers\", \"Chicago cubs\"]":["2001-07-23"],"[\"New York Yankees\", \"Atlanta Braves\"]":["2001-07-02","2001-08-12","2001-08-14"]}
ni
YAML::Tiny does not support a feature in line '? - Detroit Tigers' at /yaml/bin/perl-tiny-perl line 15.