ftr_ruby 0.1.1 → 0.1.2

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,966 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html lang="en">
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1">
7
+
8
+ <title>class FtrRuby::FDPIndex - RDoc Documentation</title>
9
+
10
+
11
+ <meta
12
+ name="keywords"
13
+ content="ruby,class,FtrRuby::FDPIndex"
14
+ >
15
+
16
+ <meta
17
+ name="description"
18
+ content="Documentation for the FtrRuby::FDPIndex class"
19
+ >
20
+
21
+
22
+
23
+
24
+
25
+ <!-- Open Graph / Facebook -->
26
+ <meta property="og:type" content="website">
27
+ <meta property="og:title" content="class FtrRuby::FDPIndex - RDoc Documentation">
28
+
29
+
30
+
31
+ <meta
32
+ property="og:description"
33
+ content="Documentation for FtrRuby::FDPIndex class - API reference and code examples"
34
+ >
35
+
36
+
37
+
38
+
39
+
40
+ <!-- Twitter -->
41
+ <meta name="twitter:card" content="summary">
42
+ <meta name="twitter:title" content="class FtrRuby::FDPIndex - RDoc Documentation">
43
+
44
+
45
+
46
+ <meta
47
+ name="twitter:description"
48
+ content="Documentation for FtrRuby::FDPIndex class - API reference and code examples"
49
+ >
50
+
51
+
52
+
53
+ <script type="text/javascript">
54
+ var rdoc_rel_prefix = "../";
55
+ var index_rel_prefix = "../";
56
+ </script>
57
+
58
+ <script
59
+ src="../js/theme-toggle.js?v=7.2.0"
60
+ ></script>
61
+
62
+ <script
63
+ src="../js/search_navigation.js?v=7.2.0"
64
+ defer
65
+ ></script>
66
+
67
+ <script
68
+ src="../js/search_data.js?v=7.2.0"
69
+ defer
70
+ ></script>
71
+
72
+ <script
73
+ src="../js/search_ranker.js?v=7.2.0"
74
+ defer
75
+ ></script>
76
+
77
+ <script
78
+ src="../js/search_controller.js?v=7.2.0"
79
+ defer
80
+ ></script>
81
+
82
+ <script
83
+ src="../js/c_highlighter.js?v=7.2.0"
84
+ defer
85
+ ></script>
86
+
87
+ <script
88
+ src="../js/bash_highlighter.js?v=7.2.0"
89
+ defer
90
+ ></script>
91
+
92
+ <script
93
+ src="../js/aliki.js?v=7.2.0"
94
+ defer
95
+ ></script>
96
+
97
+ <link
98
+ href="../css/rdoc.css?v=7.2.0"
99
+ rel="stylesheet"
100
+ >
101
+
102
+
103
+
104
+
105
+ <body role="document" class="class has-toc">
106
+ <svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
107
+ <!-- Chevron (right arrow) - used for expand/collapse -->
108
+ <symbol
109
+ id="icon-chevron"
110
+ viewBox="0 0 24 24"
111
+ fill="none"
112
+ stroke="currentColor"
113
+ stroke-width="2"
114
+ stroke-linecap="round"
115
+ stroke-linejoin="round"
116
+ >
117
+ <polyline points="9 18 15 12 9 6"></polyline>
118
+ </symbol>
119
+
120
+ <!-- File/Document - Pages section -->
121
+ <symbol
122
+ id="icon-file"
123
+ viewBox="0 0 24 24"
124
+ fill="none"
125
+ stroke="currentColor"
126
+ stroke-width="2"
127
+ stroke-linecap="round"
128
+ stroke-linejoin="round"
129
+ >
130
+ <path
131
+ d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"
132
+ ></path>
133
+
134
+ <polyline points="14 2 14 8 20 8"></polyline>
135
+ </symbol>
136
+
137
+ <!-- Layers/Stack - Classes and Modules section -->
138
+ <symbol
139
+ id="icon-layers"
140
+ viewBox="0 0 24 24"
141
+ fill="none"
142
+ stroke="currentColor"
143
+ stroke-width="2"
144
+ stroke-linecap="round"
145
+ stroke-linejoin="round"
146
+ >
147
+ <polygon points="12 2 2 7 12 12 22 7 12 2"></polygon>
148
+ <polyline points="2 17 12 22 22 17"></polyline>
149
+ <polyline points="2 12 12 17 22 12"></polyline>
150
+ </symbol>
151
+
152
+ <!-- Curly braces with C - Class Methods section -->
153
+ <symbol
154
+ id="icon-class-methods"
155
+ viewBox="0 0 24 24"
156
+ fill="none"
157
+ stroke="currentColor"
158
+ stroke-width="2"
159
+ stroke-linecap="round"
160
+ stroke-linejoin="round"
161
+ >
162
+ <path d="M6 3C3.5 3 2 4.5 2 7v3c0 1.5-1 2-1 2s1 .5 1 2v5c0 2.5 1.5 4 4 4"></path>
163
+ <path d="M18 3c2.5 0 4 1.5 4 4v3c0 1.5 1 2 1 2s-1 .5-1 2v5c0 2.5-1.5 4-4 4"></path>
164
+
165
+ <text
166
+ x="12"
167
+ y="17"
168
+ text-anchor="middle"
169
+ font-size="13"
170
+ font-weight="bold"
171
+ fill="currentColor"
172
+ stroke="none"
173
+ >
174
+ C
175
+ </text>
176
+ </symbol>
177
+
178
+ <!-- Curly braces with I - Instance Methods section -->
179
+ <symbol
180
+ id="icon-instance-methods"
181
+ viewBox="0 0 24 24"
182
+ fill="none"
183
+ stroke="currentColor"
184
+ stroke-width="2"
185
+ stroke-linecap="round"
186
+ stroke-linejoin="round"
187
+ >
188
+ <path d="M6 3C3.5 3 2 4.5 2 7v3c0 1.5-1 2-1 2s1 .5 1 2v5c0 2.5 1.5 4 4 4"></path>
189
+ <path d="M18 3c2.5 0 4 1.5 4 4v3c0 1.5 1 2 1 2s-1 .5-1 2v5c0 2.5-1.5 4-4 4"></path>
190
+
191
+ <text
192
+ x="12"
193
+ y="17"
194
+ text-anchor="middle"
195
+ font-size="13"
196
+ font-weight="bold"
197
+ fill="currentColor"
198
+ stroke="none"
199
+ >
200
+ I
201
+ </text>
202
+ </symbol>
203
+
204
+ <!-- Double chevrons up - Ancestors section -->
205
+ <symbol
206
+ id="icon-ancestors"
207
+ viewBox="0 0 24 24"
208
+ fill="none"
209
+ stroke="currentColor"
210
+ stroke-width="2"
211
+ stroke-linecap="round"
212
+ stroke-linejoin="round"
213
+ >
214
+ <polyline points="17 11 12 6 7 11"></polyline>
215
+ <polyline points="17 18 12 13 7 18"></polyline>
216
+ </symbol>
217
+
218
+ <!-- User with plus - Included Modules section -->
219
+ <symbol
220
+ id="icon-includes"
221
+ viewBox="0 0 24 24"
222
+ fill="none"
223
+ stroke="currentColor"
224
+ stroke-width="2"
225
+ stroke-linecap="round"
226
+ stroke-linejoin="round"
227
+ >
228
+ <path d="M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path>
229
+ <circle cx="8.5" cy="7" r="4"></circle>
230
+
231
+ <line
232
+ x1="20"
233
+ y1="8"
234
+ x2="20"
235
+ y2="14"
236
+ ></line>
237
+
238
+ <line
239
+ x1="23"
240
+ y1="11"
241
+ x2="17"
242
+ y2="11"
243
+ ></line>
244
+ </symbol>
245
+
246
+ <!-- User with check - Extended Modules section -->
247
+ <symbol
248
+ id="icon-extends"
249
+ viewBox="0 0 24 24"
250
+ fill="none"
251
+ stroke="currentColor"
252
+ stroke-width="2"
253
+ stroke-linecap="round"
254
+ stroke-linejoin="round"
255
+ >
256
+ <path d="M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path>
257
+ <circle cx="8.5" cy="7" r="4"></circle>
258
+ <polyline points="17 11 19 13 23 9"></polyline>
259
+ </symbol>
260
+
261
+ <!-- List - Sections section -->
262
+ <symbol
263
+ id="icon-list"
264
+ viewBox="0 0 24 24"
265
+ fill="none"
266
+ stroke="currentColor"
267
+ stroke-width="2"
268
+ stroke-linecap="round"
269
+ stroke-linejoin="round"
270
+ >
271
+ <line
272
+ x1="8"
273
+ y1="6"
274
+ x2="21"
275
+ y2="6"
276
+ ></line>
277
+
278
+ <line
279
+ x1="8"
280
+ y1="12"
281
+ x2="21"
282
+ y2="12"
283
+ ></line>
284
+
285
+ <line
286
+ x1="8"
287
+ y1="18"
288
+ x2="21"
289
+ y2="18"
290
+ ></line>
291
+
292
+ <line
293
+ x1="3"
294
+ y1="6"
295
+ x2="3.01"
296
+ y2="6"
297
+ ></line>
298
+
299
+ <line
300
+ x1="3"
301
+ y1="12"
302
+ x2="3.01"
303
+ y2="12"
304
+ ></line>
305
+
306
+ <line
307
+ x1="3"
308
+ y1="18"
309
+ x2="3.01"
310
+ y2="18"
311
+ ></line>
312
+ </symbol>
313
+ </svg>
314
+
315
+ <header class="top-navbar">
316
+ <a href="../index.html" class="navbar-brand">
317
+ RDoc Documentation
318
+ </a>
319
+
320
+ <!-- Desktop search bar -->
321
+ <div class="navbar-search navbar-search-desktop" role="search">
322
+ <form action="#" method="get" accept-charset="utf-8">
323
+ <input id="search-field" role="combobox" aria-label="Search"
324
+ aria-autocomplete="list" aria-controls="search-results-desktop"
325
+ type="text" name="search" placeholder="Search (/) for a class, method..."
326
+ spellcheck="false" autocomplete="off"
327
+ title="Type to search, Up and Down to navigate, Enter to load">
328
+ <ul id="search-results-desktop" aria-label="Search Results"
329
+ aria-busy="false" aria-expanded="false"
330
+ aria-atomic="false" class="initially-hidden search-results"></ul>
331
+ </form>
332
+ </div>
333
+
334
+ <!-- Mobile search icon button -->
335
+ <button id="search-toggle" class="navbar-search-mobile" aria-label="Open search" type="button">
336
+ <span aria-hidden="true">🔍</span>
337
+ </button>
338
+
339
+ <!-- Theme toggle button -->
340
+ <button id="theme-toggle" class="theme-toggle" aria-label="Switch to dark mode" type="button">
341
+ <span class="theme-toggle-icon" aria-hidden="true">🌙</span>
342
+ </button>
343
+ </header>
344
+
345
+ <!-- Search Modal (Mobile) -->
346
+ <div id="search-modal" class="search-modal" hidden aria-modal="true" role="dialog" aria-label="Search">
347
+ <div class="search-modal-backdrop"></div>
348
+ <div class="search-modal-content">
349
+ <div class="search-modal-header">
350
+ <form class="search-modal-form" action="#" method="get" accept-charset="utf-8">
351
+ <span class="search-modal-icon" aria-hidden="true">🔍</span>
352
+ <input id="search-field-mobile" role="combobox" aria-label="Search"
353
+ aria-autocomplete="list" aria-controls="search-results-mobile"
354
+ type="text" name="search" placeholder="Search documentation"
355
+ spellcheck="false" autocomplete="off">
356
+ <button type="button" class="search-modal-close" aria-label="Close search" id="search-modal-close">
357
+ <span aria-hidden="true">esc</span>
358
+ </button>
359
+ </form>
360
+ </div>
361
+ <div class="search-modal-body">
362
+ <ul id="search-results-mobile" aria-label="Search Results"
363
+ aria-busy="false" aria-expanded="false"
364
+ aria-atomic="false" class="search-results search-modal-results initially-hidden"></ul>
365
+ <div class="search-modal-empty">
366
+ <p>No recent searches</p>
367
+ </div>
368
+ </div>
369
+ </div>
370
+ </div>
371
+
372
+ <div id="navigation-toggle" role="button" tabindex="0" aria-label="Toggle sidebar" aria-expanded="true" aria-controls="navigation">
373
+ <span aria-hidden="true">&#9776;</span>
374
+ </div>
375
+
376
+
377
+ <nav id="navigation" role="navigation" hidden>
378
+
379
+
380
+
381
+
382
+
383
+ <div id="fileindex-section" class="nav-section">
384
+ <details class="nav-section-collapsible" >
385
+ <summary class="nav-section-header">
386
+ <span class="nav-section-icon">
387
+ <svg>
388
+ <use href="#icon-file"></use>
389
+ </svg>
390
+ </span>
391
+
392
+ <span class="nav-section-title">Pages</span>
393
+
394
+ <span class="nav-section-chevron">
395
+ <svg>
396
+ <use href="#icon-chevron"></use>
397
+ </svg>
398
+ </span>
399
+ </summary>
400
+
401
+ <ul class="nav-list">
402
+
403
+
404
+
405
+
406
+
407
+
408
+ <li>
409
+ <a href="../CHANGELOG_md.html">
410
+ CHANGELOG
411
+ </a>
412
+ </li>
413
+
414
+
415
+
416
+
417
+ <li>
418
+ <a href="../Gemfile.html">
419
+ Gemfile
420
+ </a>
421
+ </li>
422
+
423
+
424
+
425
+
426
+ <li>
427
+ <a href="../Gemfile_lock.html">
428
+ Gemfile.lock
429
+ </a>
430
+ </li>
431
+
432
+
433
+
434
+
435
+ <li>
436
+ <a href="../LICENSE_txt.html">
437
+ LICENSE
438
+ </a>
439
+ </li>
440
+
441
+
442
+
443
+
444
+ <li>
445
+ <a href="../README_md.html">
446
+ README
447
+ </a>
448
+ </li>
449
+
450
+
451
+
452
+
453
+ <li>
454
+ <a href="../Rakefile.html">
455
+ Rakefile
456
+ </a>
457
+ </li>
458
+
459
+
460
+
461
+
462
+ <li>
463
+ <a href="../bin/setup.html">
464
+ setup
465
+ </a>
466
+ </li>
467
+
468
+
469
+
470
+
471
+ <li>
472
+ <a href="../sig/ftr_ruby_rbs.html">
473
+ ftr_ruby.rbs
474
+ </a>
475
+ </li>
476
+
477
+ </ul>
478
+ </details>
479
+ </div>
480
+
481
+
482
+
483
+
484
+
485
+ <div id="parent-class-section" class="nav-section">
486
+ <details class="nav-section-collapsible" open>
487
+ <summary class="nav-section-header">
488
+ <span class="nav-section-icon">
489
+ <svg><use href="#icon-ancestors"></use></svg>
490
+ </span>
491
+ <span class="nav-section-title">Ancestors</span>
492
+ <span class="nav-section-chevron">
493
+ <svg><use href="#icon-chevron"></use></svg>
494
+ </span>
495
+ </summary>
496
+ <ul><li>Object</li></ul>
497
+ </details>
498
+ </div>
499
+
500
+
501
+
502
+
503
+
504
+
505
+
506
+ <div class="nav-section">
507
+ <details class="nav-section-collapsible" open>
508
+ <summary class="nav-section-header">
509
+ <span class="nav-section-icon">
510
+ <svg><use href="#icon-class-methods"></use></svg>
511
+ </span>
512
+ <span class="nav-section-title">Class Methods</span>
513
+ <span class="nav-section-chevron">
514
+ <svg><use href="#icon-chevron"></use></svg>
515
+ </span>
516
+ </summary>
517
+ <ul class="nav-list" role="directory">
518
+
519
+ <li ><a href="#method-c-get_metrics_labels_for_tests">get_metrics_labels_for_tests</a></li>
520
+
521
+ <li ><a href="#method-c-load_from_cache">load_from_cache</a></li>
522
+
523
+ <li ><a href="#method-c-retrieve_tests_from_index">retrieve_tests_from_index</a></li>
524
+
525
+ <li ><a href="#method-c-save_to_cache">save_to_cache</a></li>
526
+
527
+ </ul>
528
+ </details>
529
+ </div>
530
+
531
+
532
+
533
+
534
+ <div id="classindex-section" class="nav-section">
535
+ <details class="nav-section-collapsible" open>
536
+ <summary class="nav-section-header">
537
+ <span class="nav-section-icon">
538
+ <svg><use href="#icon-layers"></use></svg>
539
+ </span>
540
+ <span class="nav-section-title">Classes and Modules</span>
541
+ <span class="nav-section-chevron">
542
+ <svg><use href="#icon-chevron"></use></svg>
543
+ </span>
544
+ </summary>
545
+
546
+ <ul class="link-list nav-list"><li><details><summary><code><a href="../FtrRuby.html">FtrRuby</a></code></summary><ul class="link-list nav-list"><li><code><a href="../FtrRuby/DCAT_Record.html">DCAT_Record</a></code></li><li><code><a href="../FtrRuby/Error.html">Error</a></code></li><li><code><a href="../FtrRuby/FDPIndex.html">FDPIndex</a></code></li><li><code><a href="../FtrRuby/Output.html">Output</a></code></li><li><code><a href="../FtrRuby/TestInfra.html">TestInfra</a></code></li><li><code><a href="../FtrRuby/Tests.html">Tests</a></code></li></ul></details></li><li><code><a href="../OpenAPI.html">OpenAPI</a></code></li></ul>
547
+ </details>
548
+ </div>
549
+
550
+ </nav>
551
+
552
+ <main role="main" aria-labelledby="class-ftrruby-fdpindex">
553
+
554
+
555
+ <ol role="navigation" aria-label="Breadcrumb navigation" class="breadcrumb">
556
+
557
+ <li>
558
+
559
+ <a href="../FtrRuby.html">FtrRuby</a><span>::</span>
560
+
561
+ </li>
562
+
563
+ <li>
564
+
565
+ <span>FDPIndex</span>
566
+
567
+ </li>
568
+
569
+ </ol>
570
+
571
+
572
+ <span id="class-FtrRuby::FDPIndex" class="legacy-anchor"></span>
573
+ <h1 id="class-ftrruby-fdpindex" class="anchor-link class">
574
+ class FtrRuby::FDPIndex
575
+ </h1>
576
+
577
+ <section class="description">
578
+
579
+ </section>
580
+
581
+
582
+ <span id="5Buntitled-5D" class="legacy-anchor"></span>
583
+ <section class="documentation-section anchor-link">
584
+
585
+
586
+
587
+
588
+
589
+ <section class="constants-list">
590
+ <header>
591
+ <h3 id="untitled-constants"><a href="#untitled-constants">Constants</a></h3>
592
+ </header>
593
+ <dl>
594
+
595
+ <dt id="CACHE_DIR">CACHE_DIR</dt>
596
+
597
+ <dd>
598
+
599
+ <p>Cache directory and expiry time (in seconds, e.g., 24 hours)</p>
600
+ </dd>
601
+
602
+
603
+ <dt id="CACHE_EXPIRY">CACHE_EXPIRY</dt>
604
+
605
+ <dd>
606
+
607
+
608
+ </dd>
609
+
610
+
611
+ </dl>
612
+ </section>
613
+
614
+
615
+
616
+
617
+
618
+
619
+
620
+
621
+ <section id="public-class-untitled-method-details" class="method-section anchor-link">
622
+ <header>
623
+ <h3 id="public-class-untitled-methods"><a href="#public-class-untitled-methods">Public Class Methods</a></h3>
624
+ </header>
625
+
626
+
627
+ <div id="method-c-get_metrics_labels_for_tests" class="method-detail anchor-link ">
628
+ <div class="method-header">
629
+
630
+ <div class="method-heading">
631
+ <a href="#method-c-get_metrics_labels_for_tests" title="Link to this method">
632
+ <span class="method-name">get_metrics_labels_for_tests</span>
633
+ <span class="method-args">(tests:)</span>
634
+ </a>
635
+ </div>
636
+
637
+ </div>
638
+
639
+
640
+ <div class="method-controls">
641
+ <details class="method-source-toggle">
642
+ <summary>Source</summary>
643
+ </details>
644
+ </div>
645
+ <div class="method-source-code" id="get_metrics_labels_for_tests-source">
646
+ <pre class="ruby"><span class="ruby-comment"># File lib/fdp_index.rb, line 71</span>
647
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">get_metrics_labels_for_tests</span>(<span class="ruby-value">tests:</span>)
648
+ <span class="ruby-identifier">labels</span> = {}
649
+ <span class="ruby-identifier">cache</span> = {} <span class="ruby-comment"># In-memory cache for this request</span>
650
+
651
+ <span class="ruby-comment"># Ensure cache directory exists</span>
652
+ <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">mkdir_p</span>(<span class="ruby-constant">CACHE_DIR</span>)
653
+
654
+ <span class="ruby-identifier">tests</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">test</span><span class="ruby-operator">|</span>
655
+ <span class="ruby-identifier">metric</span> = <span class="ruby-identifier">test</span>[<span class="ruby-value">:benchmark_or_metric</span>] <span class="ruby-comment"># Assume required</span>
656
+ <span class="ruby-identifier">warn</span> <span class="ruby-node">&quot;Processing metric: #{metric}&quot;</span>
657
+
658
+ <span class="ruby-comment"># Generate a safe filename for the metric URL</span>
659
+ <span class="ruby-identifier">cache_key</span> = <span class="ruby-constant">Digest</span><span class="ruby-operator">::</span><span class="ruby-constant">SHA256</span>.<span class="ruby-identifier">hexdigest</span>(<span class="ruby-identifier">metric</span>)
660
+ <span class="ruby-identifier">cache_file</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">CACHE_DIR</span>, <span class="ruby-node">&quot;#{cache_key}.bin&quot;</span>)
661
+
662
+ <span class="ruby-comment"># Check in-memory cache first</span>
663
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">cache</span>[<span class="ruby-identifier">metric</span>]
664
+ <span class="ruby-identifier">repository</span> = <span class="ruby-identifier">cache</span>[<span class="ruby-identifier">metric</span>]
665
+ <span class="ruby-keyword">else</span>
666
+ <span class="ruby-comment"># Try to load from disk cache</span>
667
+ <span class="ruby-identifier">repository</span> = <span class="ruby-identifier">load_from_cache</span>(<span class="ruby-identifier">cache_file</span>)
668
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">repository</span>
669
+ <span class="ruby-identifier">warn</span> <span class="ruby-node">&quot;Loaded #{metric} from cache&quot;</span>
670
+ <span class="ruby-keyword">else</span>
671
+ <span class="ruby-comment"># Cache miss: fetch from URL</span>
672
+ <span class="ruby-identifier">warn</span> <span class="ruby-node">&quot;Fetching RDF for #{metric}&quot;</span>
673
+ <span class="ruby-identifier">repository</span> = <span class="ruby-constant">RDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Repository</span>.<span class="ruby-identifier">new</span>
674
+ <span class="ruby-identifier">headers</span> = { <span class="ruby-string">&quot;Accept&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-string">&quot;application/ld+json&quot;</span> }
675
+ <span class="ruby-keyword">begin</span>
676
+ <span class="ruby-constant">RDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Reader</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">metric</span>, <span class="ruby-value">headers:</span> <span class="ruby-identifier">headers</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">reader</span><span class="ruby-operator">|</span>
677
+ <span class="ruby-identifier">repository</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">reader</span>
678
+ <span class="ruby-keyword">end</span>
679
+ <span class="ruby-comment"># Save to disk cache with timestamp</span>
680
+ <span class="ruby-identifier">save_to_cache</span>(<span class="ruby-identifier">cache_file</span>, <span class="ruby-identifier">repository</span>)
681
+ <span class="ruby-identifier">warn</span> <span class="ruby-node">&quot;Cached #{metric} to disk&quot;</span>
682
+ <span class="ruby-keyword">rescue</span> <span class="ruby-constant">StandardError</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">e</span>
683
+ <span class="ruby-identifier">warn</span> <span class="ruby-node">&quot;Error fetching RDF for #{metric}: #{e.message}&quot;</span>
684
+ <span class="ruby-identifier">labels</span>[<span class="ruby-identifier">metric</span>] = <span class="ruby-node">&quot;Unable to resolve #{metric} to RDF metadata&quot;</span>
685
+ <span class="ruby-keyword">next</span>
686
+ <span class="ruby-keyword">end</span>
687
+ <span class="ruby-keyword">end</span>
688
+ <span class="ruby-identifier">cache</span>[<span class="ruby-identifier">metric</span>] = <span class="ruby-identifier">repository</span> <span class="ruby-comment"># Store in memory for this request</span>
689
+ <span class="ruby-keyword">end</span>
690
+
691
+ <span class="ruby-comment"># SPARQL query to get label</span>
692
+ <span class="ruby-identifier">fdpindexquery</span> = <span class="ruby-identifier">&lt;&lt;-METRICLABEL</span>
693
+ <span class="ruby-value"> PREFIX dct: &lt;http://purl.org/dc/terms/&gt;
694
+ PREFIX schema: &lt;http://schema.org/&gt;
695
+ SELECT DISTINCT ?label WHERE {
696
+ { ?sub dct:title ?label }
697
+ UNION
698
+ { ?sub schema:name ?label }
699
+ }</span>
700
+ <span class="ruby-identifier"> METRICLABEL</span>
701
+
702
+ <span class="ruby-comment"># Parse and execute the SPARQL query</span>
703
+ <span class="ruby-identifier">fdpindexquery</span> = <span class="ruby-constant">SPARQL</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">fdpindexquery</span>)
704
+ <span class="ruby-identifier">results</span> = <span class="ruby-identifier">fdpindexquery</span>.<span class="ruby-identifier">execute</span>(<span class="ruby-identifier">repository</span>)
705
+
706
+ <span class="ruby-comment"># Assign the label (first result or fallback)</span>
707
+ <span class="ruby-identifier">labels</span>[<span class="ruby-identifier">metric</span>] = <span class="ruby-keyword">if</span> <span class="ruby-identifier">results</span>&amp;.<span class="ruby-identifier">first</span>&amp;.<span class="ruby-identifier">[]</span>(<span class="ruby-value">:label</span>)&amp;.<span class="ruby-identifier">to_s</span>&amp;.<span class="ruby-identifier">length</span>&amp;.<span class="ruby-identifier">positive?</span>
708
+ <span class="ruby-identifier">results</span>.<span class="ruby-identifier">first</span>[<span class="ruby-value">:label</span>].<span class="ruby-identifier">to_s</span>
709
+ <span class="ruby-keyword">else</span>
710
+ <span class="ruby-string">&quot;Unnamed Metric&quot;</span>
711
+ <span class="ruby-keyword">end</span>
712
+ <span class="ruby-keyword">end</span>
713
+
714
+ <span class="ruby-identifier">labels</span>
715
+ <span class="ruby-keyword">end</span></pre>
716
+ </div>
717
+
718
+
719
+
720
+ <div class="method-description">
721
+
722
+
723
+
724
+
725
+
726
+ </div>
727
+
728
+
729
+
730
+
731
+
732
+ </div>
733
+
734
+
735
+ <div id="method-c-load_from_cache" class="method-detail anchor-link ">
736
+ <div class="method-header">
737
+
738
+ <div class="method-heading">
739
+ <a href="#method-c-load_from_cache" title="Link to this method">
740
+ <span class="method-name">load_from_cache</span>
741
+ <span class="method-args">(cache_file)</span>
742
+ </a>
743
+ </div>
744
+
745
+ </div>
746
+
747
+
748
+ <div class="method-controls">
749
+ <details class="method-source-toggle">
750
+ <summary>Source</summary>
751
+ </details>
752
+ </div>
753
+ <div class="method-source-code" id="load_from_cache-source">
754
+ <pre class="ruby"><span class="ruby-comment"># File lib/fdp_index.rb, line 142</span>
755
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">load_from_cache</span>(<span class="ruby-identifier">cache_file</span>)
756
+ <span class="ruby-keyword">return</span> <span class="ruby-keyword">nil</span> <span class="ruby-keyword">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">cache_file</span>)
757
+
758
+ <span class="ruby-comment"># Read timestamp and serialized data</span>
759
+ <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">cache_file</span>, <span class="ruby-string">&quot;rb&quot;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span>
760
+ <span class="ruby-identifier">timestamp</span> = <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">load</span>(<span class="ruby-identifier">file</span>)
761
+ <span class="ruby-keyword">if</span> <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">timestamp</span> <span class="ruby-operator">&lt;</span> <span class="ruby-constant">CACHE_EXPIRY</span>
762
+ <span class="ruby-keyword">return</span> <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">load</span>(<span class="ruby-identifier">file</span>) <span class="ruby-comment"># Return cached RDF::Repository</span>
763
+ <span class="ruby-keyword">end</span>
764
+ <span class="ruby-keyword">end</span>
765
+ <span class="ruby-keyword">nil</span> <span class="ruby-comment"># Cache expired or invalid</span>
766
+ <span class="ruby-keyword">rescue</span> <span class="ruby-constant">StandardError</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">e</span>
767
+ <span class="ruby-identifier">warn</span> <span class="ruby-node">&quot;Error loading cache from #{cache_file}: #{e.message}&quot;</span>
768
+ <span class="ruby-keyword">nil</span>
769
+ <span class="ruby-keyword">end</span></pre>
770
+ </div>
771
+
772
+
773
+
774
+ <div class="method-description">
775
+
776
+
777
+ <p>Load RDF::Repository from disk cache if not expired</p>
778
+
779
+
780
+ </div>
781
+
782
+
783
+
784
+
785
+
786
+ </div>
787
+
788
+
789
+ <div id="method-c-retrieve_tests_from_index" class="method-detail anchor-link ">
790
+ <div class="method-header">
791
+
792
+ <div class="method-heading">
793
+ <a href="#method-c-retrieve_tests_from_index" title="Link to this method">
794
+ <span class="method-name">retrieve_tests_from_index</span>
795
+ <span class="method-args">(indexendpoint: &quot;https://tools.ostrails.eu/repositories/fdpindex-fdp&quot;)</span>
796
+ </a>
797
+ </div>
798
+
799
+ </div>
800
+
801
+
802
+ <div class="method-controls">
803
+ <details class="method-source-toggle">
804
+ <summary>Source</summary>
805
+ </details>
806
+ </div>
807
+ <div class="method-source-code" id="retrieve_tests_from_index-source">
808
+ <pre class="ruby"><span class="ruby-comment"># File lib/fdp_index.rb, line 16</span>
809
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">retrieve_tests_from_index</span>(<span class="ruby-value">indexendpoint:</span> <span class="ruby-string">&quot;https://tools.ostrails.eu/repositories/fdpindex-fdp&quot;</span>)
810
+ <span class="ruby-identifier">sparql</span> = <span class="ruby-constant">SPARQL</span><span class="ruby-operator">::</span><span class="ruby-constant">Client</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">indexendpoint</span>)
811
+
812
+ <span class="ruby-identifier">fdpindexquery</span> = <span class="ruby-identifier">&lt;&lt;EOQUERY</span>
813
+ <span class="ruby-value"> PREFIX rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt;
814
+ PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;
815
+ PREFIX dqv: &lt;http://www.w3.org/ns/dqv#&gt;
816
+ PREFIX dct: &lt;http://purl.org/dc/terms/&gt;
817
+ PREFIX dcat: &lt;http://www.w3.org/ns/dcat#&gt;
818
+ PREFIX sio: &lt;http://semanticscience.org/resource/&gt;
819
+ PREFIX dpv: &lt;http://www.w3.org/ns/dpv#&gt;
820
+ PREFIX ftr: &lt;https://w3id.org/ftr#&gt;
821
+ SELECT distinct ?sub ?identifier ?title ?description ?endpoint ?openapi ?dimension ?objects ?domain ?benchmark_or_metric WHERE {
822
+ ?sub a &lt;https://w3id.org/ftr#Test&gt; ;
823
+ dct:title ?title ;
824
+ dct:description ?description ;
825
+ dct:identifier ?identifier .
826
+ OPTIONAL {?sub dpv:isApplicableFor ?objects }
827
+ OPTIONAL {?sub ftr:applicationArea ?domain }
828
+ OPTIONAL {?sub sio:SIO_000233 ?benchmark_or_metric } # implementation of#{&quot; &quot;}
829
+ OPTIONAL {?sub dcat:endpointDescription ?openapi }
830
+ OPTIONAL {?sub dcat:endpointURL ?endpoint }
831
+ OPTIONAL {?sub dqv:inDimension ?dimension }
832
+ }#{&quot; &quot;}</span>
833
+ <span class="ruby-identifier">EOQUERY</span>
834
+
835
+ <span class="ruby-identifier">alltests</span> = []
836
+
837
+ <span class="ruby-keyword">begin</span>
838
+ <span class="ruby-comment"># Execute the query</span>
839
+ <span class="ruby-identifier">results</span> = <span class="ruby-identifier">sparql</span>.<span class="ruby-identifier">query</span>(<span class="ruby-identifier">fdpindexquery</span>)
840
+
841
+ <span class="ruby-comment"># Process the results</span>
842
+ <span class="ruby-identifier">results</span>.<span class="ruby-identifier">each_solution</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">solution</span><span class="ruby-operator">|</span>
843
+ <span class="ruby-identifier">test_object</span> = {
844
+ <span class="ruby-value">subj:</span> <span class="ruby-identifier">solution</span>[<span class="ruby-value">:sub</span>]&amp;.<span class="ruby-identifier">to_s</span>,
845
+ <span class="ruby-value">identifier:</span> <span class="ruby-identifier">solution</span>[<span class="ruby-value">:identifier</span>]&amp;.<span class="ruby-identifier">to_s</span>,
846
+ <span class="ruby-value">title:</span> <span class="ruby-identifier">solution</span>[<span class="ruby-value">:title</span>]&amp;.<span class="ruby-identifier">to_s</span>,
847
+ <span class="ruby-value">description:</span> <span class="ruby-identifier">solution</span>[<span class="ruby-value">:description</span>]&amp;.<span class="ruby-identifier">to_s</span>,
848
+ <span class="ruby-value">endpoint:</span> <span class="ruby-identifier">solution</span>[<span class="ruby-value">:endpoint</span>]&amp;.<span class="ruby-identifier">to_s</span>,
849
+ <span class="ruby-value">openapi:</span> <span class="ruby-identifier">solution</span>[<span class="ruby-value">:openapi</span>]&amp;.<span class="ruby-identifier">to_s</span>,
850
+ <span class="ruby-value">dimension:</span> <span class="ruby-identifier">solution</span>[<span class="ruby-value">:dimension</span>]&amp;.<span class="ruby-identifier">to_s</span>,
851
+ <span class="ruby-value">objects:</span> <span class="ruby-identifier">solution</span>[<span class="ruby-value">:objects</span>]&amp;.<span class="ruby-identifier">to_s</span>,
852
+ <span class="ruby-value">domain:</span> <span class="ruby-identifier">solution</span>[<span class="ruby-value">:domain</span>]&amp;.<span class="ruby-identifier">to_s</span>,
853
+ <span class="ruby-value">benchmark_or_metric:</span> <span class="ruby-identifier">solution</span>[<span class="ruby-value">:benchmark_or_metric</span>]&amp;.<span class="ruby-identifier">to_s</span>
854
+ }
855
+ <span class="ruby-identifier">alltests</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">test_object</span>
856
+ <span class="ruby-keyword">end</span>
857
+ <span class="ruby-keyword">rescue</span> <span class="ruby-constant">StandardError</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">e</span>
858
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Error executing SPARQL query: #{e.message}&quot;</span>
859
+ <span class="ruby-keyword">end</span>
860
+
861
+ <span class="ruby-identifier">alltests</span>
862
+ <span class="ruby-keyword">end</span></pre>
863
+ </div>
864
+
865
+
866
+
867
+ <div class="method-description">
868
+
869
+
870
+
871
+
872
+
873
+ </div>
874
+
875
+
876
+
877
+
878
+
879
+ </div>
880
+
881
+
882
+ <div id="method-c-save_to_cache" class="method-detail anchor-link ">
883
+ <div class="method-header">
884
+
885
+ <div class="method-heading">
886
+ <a href="#method-c-save_to_cache" title="Link to this method">
887
+ <span class="method-name">save_to_cache</span>
888
+ <span class="method-args">(cache_file, repository)</span>
889
+ </a>
890
+ </div>
891
+
892
+ </div>
893
+
894
+
895
+ <div class="method-controls">
896
+ <details class="method-source-toggle">
897
+ <summary>Source</summary>
898
+ </details>
899
+ </div>
900
+ <div class="method-source-code" id="save_to_cache-source">
901
+ <pre class="ruby"><span class="ruby-comment"># File lib/fdp_index.rb, line 159</span>
902
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">save_to_cache</span>(<span class="ruby-identifier">cache_file</span>, <span class="ruby-identifier">repository</span>)
903
+ <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">cache_file</span>, <span class="ruby-string">&quot;wb&quot;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span>
904
+ <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">dump</span>(<span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>, <span class="ruby-identifier">file</span>) <span class="ruby-comment"># Store timestamp</span>
905
+ <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">dump</span>(<span class="ruby-identifier">repository</span>, <span class="ruby-identifier">file</span>) <span class="ruby-comment"># Store repository</span>
906
+ <span class="ruby-keyword">end</span>
907
+ <span class="ruby-keyword">rescue</span> <span class="ruby-constant">StandardError</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">e</span>
908
+ <span class="ruby-identifier">warn</span> <span class="ruby-node">&quot;Error saving cache to #{cache_file}: #{e.message}&quot;</span>
909
+ <span class="ruby-keyword">end</span></pre>
910
+ </div>
911
+
912
+
913
+
914
+ <div class="method-description">
915
+
916
+
917
+ <p>Save RDF::Repository to disk cache with timestamp</p>
918
+
919
+
920
+ </div>
921
+
922
+
923
+
924
+
925
+
926
+ </div>
927
+
928
+
929
+ </section>
930
+
931
+
932
+
933
+
934
+
935
+
936
+
937
+
938
+
939
+
940
+ </section>
941
+
942
+ </main>
943
+
944
+ <aside class="table-of-contents" role="complementary" aria-label="Table of Contents">
945
+ <div class="toc-sticky">
946
+ <h3 class="toc-heading">On This Page</h3>
947
+ <nav class="toc-nav" id="toc-nav" aria-label="Page sections">
948
+ <!-- Generated by JavaScript based on page headings -->
949
+ </nav>
950
+ </div>
951
+ </aside>
952
+
953
+
954
+ <footer class="site-footer">
955
+
956
+
957
+ <div class="footer-bottom">
958
+ <p>
959
+ Generated by <a href="https://ruby.github.io/rdoc/">RDoc 7.2.0</a>
960
+ using the Aliki theme by <a href="http://st0012.dev">Stan Lo</a>
961
+ </p>
962
+ </div>
963
+ </footer>
964
+
965
+ </body>
966
+