lutaml-model 0.8.180 → 0.8.181
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.
- checksums.yaml +4 -4
- data/bench/baselines/main_mml.json +20 -20
- data/bench/baselines/main_niso.json +12 -12
- data/bench/baselines/main_sts.json +20 -20
- data/bench/baselines/main_unitsml.json +5 -5
- data/bench/baselines/main_xmi.json +20 -20
- data/lib/lutaml/model/version.rb +1 -1
- data/lib/lutaml/xml/transformation/rule_applier.rb +7 -0
- data/spec/lutaml/model/mixed_content_spec.rb +58 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 461625987c7637612b57671b30897876e703d33fc0baa9354bcc59b8026666f7
|
|
4
|
+
data.tar.gz: 72ea3b59453e91f1272f86cf3c381684b736fa39fde338187dc5259239eeba80
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4b719debdf1a00a74b1cd48ad26d69b3688de6873d8bdace9cd4d9a2b79a3041f6a39dcdec56672b259dfd5af11e324d764e678515a543cec2110343a1716b2d
|
|
7
|
+
data.tar.gz: 9b05b26ab2260074cd58582f5709b07b56189fcb8dce0155927cfe2e824ee73819ca56500fa03b273137b774a5b230afe4f36842eba0506c7428d41853f0782e
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"complex1-46KB": {
|
|
3
|
-
"avg_time": 0.
|
|
4
|
-
"min_time": 0.
|
|
5
|
-
"max_time": 0.
|
|
6
|
-
"allocations":
|
|
7
|
-
"ips":
|
|
3
|
+
"avg_time": 0.035969980333324734,
|
|
4
|
+
"min_time": 0.03559261399999514,
|
|
5
|
+
"max_time": 0.036185082999992346,
|
|
6
|
+
"allocations": 50994,
|
|
7
|
+
"ips": 27.800960432373113
|
|
8
8
|
},
|
|
9
9
|
"complex4-50KB": {
|
|
10
|
-
"avg_time": 0.
|
|
11
|
-
"min_time": 0.
|
|
12
|
-
"max_time": 0.
|
|
13
|
-
"allocations":
|
|
14
|
-
"ips":
|
|
10
|
+
"avg_time": 0.04991650399999988,
|
|
11
|
+
"min_time": 0.04966256299999827,
|
|
12
|
+
"max_time": 0.050061231000000816,
|
|
13
|
+
"allocations": 71837,
|
|
14
|
+
"ips": 20.03345426594784
|
|
15
15
|
},
|
|
16
16
|
"size1000-245KB": {
|
|
17
|
-
"avg_time": 0.
|
|
18
|
-
"min_time": 0.
|
|
19
|
-
"max_time": 0.
|
|
20
|
-
"allocations":
|
|
21
|
-
"ips": 3.
|
|
17
|
+
"avg_time": 0.28591416999999336,
|
|
18
|
+
"min_time": 0.2818747909999786,
|
|
19
|
+
"max_time": 0.2920046950000028,
|
|
20
|
+
"allocations": 406438,
|
|
21
|
+
"ips": 3.4975531293185758
|
|
22
22
|
},
|
|
23
23
|
"complex3-567KB": {
|
|
24
|
-
"avg_time": 0.
|
|
25
|
-
"min_time": 0.
|
|
26
|
-
"max_time": 0.
|
|
27
|
-
"allocations":
|
|
28
|
-
"ips": 2.
|
|
24
|
+
"avg_time": 0.40071153599999815,
|
|
25
|
+
"min_time": 0.3966769870000064,
|
|
26
|
+
"max_time": 0.4045028329999809,
|
|
27
|
+
"allocations": 584888,
|
|
28
|
+
"ips": 2.49556079663253
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"metrology-4KB": {
|
|
3
|
-
"avg_time": 0.
|
|
4
|
-
"min_time": 0.
|
|
5
|
-
"max_time": 0.
|
|
3
|
+
"avg_time": 0.008145603666662282,
|
|
4
|
+
"min_time": 0.007795773999987432,
|
|
5
|
+
"max_time": 0.008779492999906324,
|
|
6
6
|
"allocations": 7544,
|
|
7
|
-
"ips":
|
|
7
|
+
"ips": 122.76560963710097
|
|
8
8
|
},
|
|
9
9
|
"bmj-49KB": {
|
|
10
|
-
"avg_time": 0.
|
|
11
|
-
"min_time": 0.
|
|
12
|
-
"max_time": 0.
|
|
10
|
+
"avg_time": 0.0723875503333223,
|
|
11
|
+
"min_time": 0.07129628399991361,
|
|
12
|
+
"max_time": 0.07395147099998667,
|
|
13
13
|
"allocations": 72378,
|
|
14
|
-
"ips":
|
|
14
|
+
"ips": 13.814530197462258
|
|
15
15
|
},
|
|
16
16
|
"pnas-152KB": {
|
|
17
|
-
"avg_time": 0.
|
|
18
|
-
"min_time": 0.
|
|
19
|
-
"max_time": 0.
|
|
17
|
+
"avg_time": 0.34388590966667226,
|
|
18
|
+
"min_time": 0.3415666549999514,
|
|
19
|
+
"max_time": 0.34598907000008694,
|
|
20
20
|
"allocations": 259437,
|
|
21
|
-
"ips":
|
|
21
|
+
"ips": 2.9079411859860658
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"feature-doc-23KB": {
|
|
3
|
-
"avg_time": 0.
|
|
4
|
-
"min_time": 0.
|
|
5
|
-
"max_time": 0.
|
|
6
|
-
"allocations":
|
|
7
|
-
"ips":
|
|
3
|
+
"avg_time": 0.05333307866665867,
|
|
4
|
+
"min_time": 0.05320582799998874,
|
|
5
|
+
"max_time": 0.05343820699999924,
|
|
6
|
+
"allocations": 33278,
|
|
7
|
+
"ips": 18.750089531680324
|
|
8
8
|
},
|
|
9
9
|
"tbx-nisosts-101KB": {
|
|
10
|
-
"avg_time": 0.
|
|
11
|
-
"min_time": 0.
|
|
12
|
-
"max_time": 0.
|
|
13
|
-
"allocations":
|
|
14
|
-
"ips":
|
|
10
|
+
"avg_time": 0.1555278476666615,
|
|
11
|
+
"min_time": 0.15451645799998914,
|
|
12
|
+
"max_time": 0.15693985299998303,
|
|
13
|
+
"allocations": 134268,
|
|
14
|
+
"ips": 6.429716703488832
|
|
15
15
|
},
|
|
16
16
|
"iso-13849-1MB": {
|
|
17
|
-
"avg_time":
|
|
18
|
-
"min_time":
|
|
19
|
-
"max_time":
|
|
20
|
-
"allocations":
|
|
21
|
-
"ips": 0.
|
|
17
|
+
"avg_time": 5.377177922666665,
|
|
18
|
+
"min_time": 5.361418570000012,
|
|
19
|
+
"max_time": 5.4017619889999935,
|
|
20
|
+
"allocations": 1735227,
|
|
21
|
+
"ips": 0.1859711570607798
|
|
22
22
|
},
|
|
23
23
|
"din-iso-1.1MB": {
|
|
24
|
-
"avg_time": 0.
|
|
25
|
-
"min_time": 0.
|
|
26
|
-
"max_time": 0.
|
|
27
|
-
"allocations":
|
|
28
|
-
"ips": 1.
|
|
24
|
+
"avg_time": 0.5874012496666694,
|
|
25
|
+
"min_time": 0.5822755989999848,
|
|
26
|
+
"max_time": 0.5889298150000002,
|
|
27
|
+
"allocations": 877606,
|
|
28
|
+
"ips": 1.7024138109468896
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"800-expressions": {
|
|
3
|
-
"avg_time": 0.
|
|
4
|
-
"min_time": 0.
|
|
5
|
-
"max_time": 0.
|
|
6
|
-
"allocations":
|
|
7
|
-
"ips":
|
|
3
|
+
"avg_time": 0.544940995666669,
|
|
4
|
+
"min_time": 0.5414146770000059,
|
|
5
|
+
"max_time": 0.5454735960000079,
|
|
6
|
+
"allocations": 138102,
|
|
7
|
+
"ips": 1.835061057897877
|
|
8
8
|
}
|
|
9
9
|
}
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"ea251": {
|
|
3
|
-
"avg_time": 0.
|
|
4
|
-
"min_time": 0.
|
|
5
|
-
"max_time": 0.
|
|
6
|
-
"allocations":
|
|
7
|
-
"ips": 5.
|
|
3
|
+
"avg_time": 0.17969961900000916,
|
|
4
|
+
"min_time": 0.17811001200001897,
|
|
5
|
+
"max_time": 0.18114700399999606,
|
|
6
|
+
"allocations": 182292,
|
|
7
|
+
"ips": 5.564842071256417
|
|
8
8
|
},
|
|
9
9
|
"medium": {
|
|
10
|
-
"avg_time": 0.
|
|
11
|
-
"min_time": 0.
|
|
12
|
-
"max_time": 0.
|
|
13
|
-
"allocations":
|
|
14
|
-
"ips": 2.
|
|
10
|
+
"avg_time": 0.44894484466666046,
|
|
11
|
+
"min_time": 0.43719278499997927,
|
|
12
|
+
"max_time": 0.45557199699999273,
|
|
13
|
+
"allocations": 471852,
|
|
14
|
+
"ips": 2.2274451124224304
|
|
15
15
|
},
|
|
16
16
|
"citygml": {
|
|
17
|
-
"avg_time": 0.
|
|
18
|
-
"min_time": 0.
|
|
19
|
-
"max_time": 0.
|
|
20
|
-
"allocations":
|
|
21
|
-
"ips": 1.
|
|
17
|
+
"avg_time": 0.506995725666665,
|
|
18
|
+
"min_time": 0.503759285000001,
|
|
19
|
+
"max_time": 0.5088972249999983,
|
|
20
|
+
"allocations": 583260,
|
|
21
|
+
"ips": 1.972403216388201
|
|
22
22
|
},
|
|
23
23
|
"large": {
|
|
24
|
-
"avg_time": 4.
|
|
25
|
-
"min_time": 4.
|
|
26
|
-
"max_time": 4.
|
|
27
|
-
"allocations":
|
|
28
|
-
"ips": 0.
|
|
24
|
+
"avg_time": 4.185453844333334,
|
|
25
|
+
"min_time": 4.1155831300000045,
|
|
26
|
+
"max_time": 4.230669285999994,
|
|
27
|
+
"allocations": 4506877,
|
|
28
|
+
"ips": 0.23892271595681203
|
|
29
29
|
}
|
|
30
30
|
}
|
data/lib/lutaml/model/version.rb
CHANGED
|
@@ -396,6 +396,13 @@ register_id, register)
|
|
|
396
396
|
content_index = index + 1
|
|
397
397
|
parent.add_child(value[content_index].to_s) if value[content_index]
|
|
398
398
|
end
|
|
399
|
+
|
|
400
|
+
# A trailing run of consecutive text entries has no element
|
|
401
|
+
# slots to interleave into; without this append every entry
|
|
402
|
+
# past children.size + 1 was silently dropped (#1164).
|
|
403
|
+
value[(existing_children.size + 1)..]&.each do |entry|
|
|
404
|
+
parent.add_child(entry.to_s) if entry
|
|
405
|
+
end
|
|
399
406
|
end
|
|
400
407
|
end
|
|
401
408
|
end
|
|
@@ -359,6 +359,30 @@ module MixedContentSpec
|
|
|
359
359
|
end
|
|
360
360
|
end
|
|
361
361
|
|
|
362
|
+
module MixedContentSpec
|
|
363
|
+
class ConsecutiveText < Lutaml::Model::Serializable
|
|
364
|
+
attribute :text, :string, collection: true
|
|
365
|
+
|
|
366
|
+
xml do
|
|
367
|
+
element "p"
|
|
368
|
+
mixed_content
|
|
369
|
+
map_content to: :text
|
|
370
|
+
end
|
|
371
|
+
end
|
|
372
|
+
|
|
373
|
+
class ConsecutiveTextWithElement < Lutaml::Model::Serializable
|
|
374
|
+
attribute :text, :string, collection: true
|
|
375
|
+
attribute :italic, :string, collection: true
|
|
376
|
+
|
|
377
|
+
xml do
|
|
378
|
+
element "p"
|
|
379
|
+
mixed_content
|
|
380
|
+
map_content to: :text
|
|
381
|
+
map_element "i", to: :italic
|
|
382
|
+
end
|
|
383
|
+
end
|
|
384
|
+
end
|
|
385
|
+
|
|
362
386
|
RSpec.describe "MixedContent" do
|
|
363
387
|
shared_examples "mixed content behavior" do |adapter_class|
|
|
364
388
|
around do |example|
|
|
@@ -647,6 +671,40 @@ RSpec.describe "MixedContent" do
|
|
|
647
671
|
end
|
|
648
672
|
end
|
|
649
673
|
|
|
674
|
+
context "when a built model holds a run of consecutive map_content entries" do
|
|
675
|
+
# lutaml-model#1164: the interleaving slots are element-shaped;
|
|
676
|
+
# a trailing run of text entries had no slots and was silently
|
|
677
|
+
# dropped.
|
|
678
|
+
it "serializes every consecutive text entry" do
|
|
679
|
+
model = MixedContentSpec::ConsecutiveText.new
|
|
680
|
+
model.text("First")
|
|
681
|
+
model.text("Second")
|
|
682
|
+
|
|
683
|
+
expect(model.to_xml).to include("First")
|
|
684
|
+
expect(model.to_xml).to include("Second")
|
|
685
|
+
expect(model.to_xml).to eq("<p>FirstSecond</p>")
|
|
686
|
+
end
|
|
687
|
+
|
|
688
|
+
it "appends the trailing run after the last mapped element" do
|
|
689
|
+
model = MixedContentSpec::ConsecutiveTextWithElement.new
|
|
690
|
+
model.text("A")
|
|
691
|
+
model.italic("i")
|
|
692
|
+
model.text("B")
|
|
693
|
+
model.text("C")
|
|
694
|
+
|
|
695
|
+
expect(model.to_xml).to eq("<p>A<i>i</i>BC</p>")
|
|
696
|
+
end
|
|
697
|
+
|
|
698
|
+
it "keeps the interleaved shape when entries alternate with elements" do
|
|
699
|
+
model = MixedContentSpec::ConsecutiveTextWithElement.new
|
|
700
|
+
model.text("AB")
|
|
701
|
+
model.italic("i")
|
|
702
|
+
model.text("CD")
|
|
703
|
+
|
|
704
|
+
expect(model.to_xml).to eq("<p>AB<i>i</i>CD</p>")
|
|
705
|
+
end
|
|
706
|
+
end
|
|
707
|
+
|
|
650
708
|
context "when mixed: true is used with map_element" do
|
|
651
709
|
it "raises an error" do
|
|
652
710
|
expect do
|