expressir 2.4.37 → 2.4.39

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.
@@ -0,0 +1,77 @@
1
+ # frozen_string_literal: true
2
+
3
+ namespace :instance do
4
+ desc "Population rule-engine benchmark over a synthetic population " \
5
+ "(default 100000 instances; POPULATION_SIZE to override)"
6
+ task :benchmark do
7
+ require "expressir"
8
+ require "expressir/eval"
9
+ require "json"
10
+ require "tmpdir"
11
+
12
+ size = Integer(ENV.fetch("POPULATION_SIZE", "100 000").delete(" "), 10)
13
+ out = ENV["INSTANCE_BENCH_OUT"] || "instance-benchmark.json"
14
+
15
+ Dir.mktmpdir do |dir|
16
+ schema_path = File.join(dir, "bench.exp")
17
+ File.write(schema_path, <<~EXP)
18
+ SCHEMA bench;
19
+ ENTITY item;
20
+ code : INTEGER;
21
+ ref : item;
22
+ UNIQUE
23
+ u1 : code;
24
+ END_ENTITY;
25
+ RULE no_negative_codes FOR (item);
26
+ WHERE
27
+ ok : SIZEOF(QUERY(i <* item | i.code < 0)) = 0;
28
+ END_RULE;
29
+ END_SCHEMA;
30
+ EXP
31
+
32
+ population_path = File.join(dir, "bench.p21")
33
+ File.open(population_path, "w") do |file|
34
+ file.puts "ISO-10303-21;"
35
+ file.puts "HEADER;"
36
+ file.puts "FILE_NAME('bench','2026-01-01T00:00:00',('b'),('b')," \
37
+ "'p','s','a');"
38
+ file.puts "FILE_SCHEMA(('bench'));"
39
+ file.puts "ENDSEC;"
40
+ file.puts "DATA;"
41
+ size.times do |i|
42
+ ref = i.zero? ? "$" : "##{i}"
43
+ file.puts "##{i + 1}=ITEM(#{i},#{ref});"
44
+ end
45
+ file.puts "ENDSEC;"
46
+ file.puts "END-ISO-10303-21;"
47
+ end
48
+
49
+ clock = Process.method(:clock_gettime)
50
+ mono = Process::CLOCK_MONOTONIC
51
+ t0 = clock.call(mono)
52
+ schema = Expressir::Express::Parser.from_file(schema_path).schemas.first
53
+ population = Expressir::P21::Parser.parse(File.read(population_path))
54
+ timings = { load: (clock.call(mono) - t0).round(2) }
55
+
56
+ engine = Expressir::Eval::Population.new(schema, population)
57
+ t1 = clock.call(mono)
58
+ first = engine.check
59
+ timings[:check_first] = (clock.call(mono) - t1).round(2)
60
+ t2 = clock.call(mono)
61
+ second = engine.check
62
+ timings[:check_second] = (clock.call(mono) - t2).round(2)
63
+
64
+ report = {
65
+ instances: size,
66
+ rules: { where: 0, unique: 1, global: 1 },
67
+ findings: first.size,
68
+ deterministic: first == second,
69
+ timings_seconds: timings,
70
+ }
71
+ File.write(out, "#{JSON.pretty_generate(report)}\n")
72
+ puts "wrote #{out} (#{size} instances, findings #{first.size}, " \
73
+ "check #{timings[:check_first]}s, " \
74
+ "deterministic=#{report[:deterministic]})"
75
+ end
76
+ end
77
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: expressir
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.37
4
+ version: 2.4.39
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-10-21 00:00:00.000000000 Z
11
+ date: 2026-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rb_sys
@@ -315,6 +315,11 @@ files:
315
315
  - TODO.eengine/07-schema-compare-patch.md
316
316
  - TODO.eengine/08-official-corpus-gate.md
317
317
  - TODO.eengine/09-mim-mapping-parser.md
318
+ - TODO.instance/00-overview.md
319
+ - TODO.instance/01-instance-typing.md
320
+ - TODO.instance/02-population-rules.md
321
+ - TODO.instance/03-p21-ladder-and-population-management.md
322
+ - TODO.instance/04-arm-mim-instance-mapping.md
318
323
  - TODO.max-perf/01-restore-ci-green.md
319
324
  - TODO.max-perf/02-streaming-parse-path.md
320
325
  - TODO.max-perf/03-cli-parallel-opt-in.md
@@ -494,6 +499,7 @@ files:
494
499
  - lib/expressir/commands/non_ascii_violation_collection.rb
495
500
  - lib/expressir/commands/package.rb
496
501
  - lib/expressir/commands/parity_inputs.rb
502
+ - lib/expressir/commands/population.rb
497
503
  - lib/expressir/commands/smrl_xml_index.rb
498
504
  - lib/expressir/commands/validate.rb
499
505
  - lib/expressir/commands/validate_ascii.rb
@@ -515,6 +521,7 @@ files:
515
521
  - lib/expressir/eval/environment.rb
516
522
  - lib/expressir/eval/expression.rb
517
523
  - lib/expressir/eval/interpreter.rb
524
+ - lib/expressir/eval/population.rb
518
525
  - lib/expressir/eval/rules.rb
519
526
  - lib/expressir/eval/values.rb
520
527
  - lib/expressir/express.rb
@@ -618,6 +625,7 @@ files:
618
625
  - lib/expressir/manifest/resolver.rb
619
626
  - lib/expressir/manifest/validator.rb
620
627
  - lib/expressir/mapping.rb
628
+ - lib/expressir/mapping/instance_verification.rb
621
629
  - lib/expressir/mapping/refpath.rb
622
630
  - lib/expressir/model.rb
623
631
  - lib/expressir/model/cache.rb
@@ -717,10 +725,16 @@ files:
717
725
  - lib/expressir/model/supertype_expressions/oneof_supertype_expression.rb
718
726
  - lib/expressir/p21.rb
719
727
  - lib/expressir/p21/builder.rb
728
+ - lib/expressir/p21/dataset_manifest.rb
729
+ - lib/expressir/p21/diff.rb
720
730
  - lib/expressir/p21/grammar.rb
731
+ - lib/expressir/p21/json.rb
721
732
  - lib/expressir/p21/parser.rb
722
733
  - lib/expressir/p21/population.rb
734
+ - lib/expressir/p21/receipt.rb
735
+ - lib/expressir/p21/typing.rb
723
736
  - lib/expressir/p21/validator.rb
737
+ - lib/expressir/p21/writer.rb
724
738
  - lib/expressir/package.rb
725
739
  - lib/expressir/package/builder.rb
726
740
  - lib/expressir/package/metadata.rb
@@ -733,6 +747,7 @@ files:
733
747
  - lib/expressir/schema_manifest_entry.rb
734
748
  - lib/expressir/version.rb
735
749
  - lib/tasks/conformance.rake
750
+ - lib/tasks/instance.rake
736
751
  - lib/tasks/reference.rake
737
752
  - lib/tasks/verify_remarks.rake
738
753
  - rakelib/native.rake