Skip to content

Commit a7d78c3

Browse files
committed
update extraction script: file, sorting
1 parent 0f0d7af commit a7d78c3

File tree

5 files changed

+177
-42
lines changed

5 files changed

+177
-42
lines changed

testing/assertions.csv

+36-35
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,36 @@
1-
"ID","Status","Comment"
2-
"arch-action-dataschema","null",
3-
"arch-action-functions","null",
4-
"arch-action-process","null",
5-
"arch-affordances","null",
6-
"arch-discovery-metadata-after-authorization","null",
7-
"arch-discovery-no-metadata-in-introduction","null",
8-
"arch-discovery-no-metadata-in-introduction-urls","null",
9-
"arch-discovery-should-use-standard","null",
10-
"arch-event-dataschema","null",
11-
"arch-event-trigger","null",
12-
"arch-form-iris","null",
13-
"arch-form-iris2","null",
14-
"arch-hypermedia","null",
15-
"arch-hypermedia-caching","null",
16-
"arch-hypermedia-protocol-binding","null",
17-
"arch-id-correlation","null",
18-
"arch-intermediary-td-extra-protocols","null",
19-
"arch-media-type","null",
20-
"arch-media-type-extra","null",
21-
"arch-op-expected-request","null",
22-
"arch-op-extension-comparison","null",
23-
"arch-op-extension-lowercase","null",
24-
"arch-op-extension-uri","null",
25-
"arch-op-form-fields-protocol","null",
26-
"arch-op-request-method","null",
27-
"arch-op-wellknown","null",
28-
"arch-other-thing-representations","null",
29-
"arch-property-dataschema","null",
30-
"arch-rel-type-lowercase","null",
31-
"arch-rel-types","null",
32-
"arch-schema","null",
33-
"arch-td-linking","null",
34-
"arch-td-mandatory","null",
35-
"arch-td-metadata","null",
1+
"Index","ID","Status","Comment","Assertion"
2+
0,"arch-td-metadata","null","not testable with Assertion Tester","In W3C WoT, the description metadata for a Thing instance MUST be available as a WoT Thing Description (TD) [[?WOT-THING-DESCRIPTION]]."
3+
2,"arch-td-mandatory","null","not testable with Assertion Tester","To be considered a Thing, however, at least one TD representation MUST be available."
4+
3,"arch-td-linking","null","not testable with Assertion Tester","WoT Thing Descriptions and WoT Thing Models MAY link to other Things, WoT Thing Models, and other resources on the Web to form a Web of Things."
5+
29,"arch-schema","null","not testable with Assertion Tester","Thus, the corresponding Interaction Affordances SHOULD declare a data schema to provide more detailed syntactic metadata for the data exchanged."
6+
4,"arch-rel-types","null","not testable with Assertion Tester","Things MUST be hosted on networked system components with a software stack to realize interaction through a network-facing interface, the WoT Interface of a Thing."
7+
13,"arch-rel-types","null","not testable with Assertion Tester","Extension relation types MUST be compared as strings using a case-insensitive comparison. (If they are serialized in a different format they are to be converted to URIs)."
8+
14,"arch-rel-type-lowercase","null","not testable with Assertion Tester","Nevertheless, all-lowercase URIs SHOULD be used for extension relation types. [[!RFC8288]]"
9+
7,"arch-property-dataschema","null","not testable with Assertion Tester","If the data is not fully specified by the Protocol Binding used (e.g., through a media type), Properties MAY contain one data schema for the exposed state."
10+
1,"arch-other-thing-representations","null","not testable with Assertion Tester","There MAY be other representations of a Thing such as an HTML-based user interface, simply an image of the physical entity, or even non-Web representations in closed systems."
11+
17,"arch-op-wellknown","null","not testable with Assertion Tester","Well-known operation types MUST follow the ABNF LOALPHA *( LOALPHA / DIGIT / ""."" / ""-"" )."
12+
21,"arch-op-request-method","null","not testable with Assertion Tester","The request method MUST identify one method of the standard set of the protocol identified by the submission target URI scheme."
13+
23,"arch-op-form-fields-protocol","null","not testable with Assertion Tester","Form fields MAY depend on the protocol used for the submission target as specified in the URI scheme."
14+
18,"arch-op-extension-uri","null","not testable with Assertion Tester","Extension operation types MUST be URIs [[!RFC3986]] that uniquely identify the type."
15+
20,"arch-op-extension-lowercase","null","not testable with Assertion Tester","Nevertheless, all-lowercase URIs SHOULD be used for extension operation types."
16+
19,"arch-op-extension-comparison","null","not testable with Assertion Tester","Extension operation types MUST be compared as strings using a case-insensitive comparison."
17+
22,"arch-op-expected-request","null","not testable with Assertion Tester","Form fields are optional and MAY further specify the expected request message for the given operation."
18+
28,"arch-media-type-extra","null","not testable with Assertion Tester","Protocol Bindings MAY have additional information that specifies representation formats in more detail than the media type alone."
19+
27,"arch-media-type","null","not testable with Assertion Tester","All data (a.k.a. content) exchanged when activating Interaction Affordances MUST be identified by a media type [[!RFC2046]] in the Protocol Binding."
20+
30,"arch-intermediary-td-extra-protocols","null","not testable with Assertion Tester","If necessary, a TD generated by an Intermediary MAY contain interfaces for other communication protocols."
21+
5,"arch-id-correlation","null","not testable with Assertion Tester","An identifier in the WoT Thing Description MUST allow for the correlation of multiple TDs representing the same original Thing or ultimately unique physical entity."
22+
25,"arch-hypermedia-protocol-binding","null","not testable with Assertion Tester","Protocol Bindings MUST be serialized as hypermedia controls to be self-descriptive on how to activate the Interaction Affordance."
23+
26,"arch-hypermedia-caching","null","not testable with Assertion Tester","The hypermedia controls MAY be cached outside the Thing and used for offline processing if caching metadata is available to determine the freshness."
24+
24,"arch-hypermedia","null","not testable with Assertion Tester","Interaction Affordances MUST include one or more Protocol Bindings."
25+
16,"arch-form-iris2","null","not testable with Assertion Tester","Form context and submission target MAY point to the same resource or different resources, where the submission target resource implements the operation for the context."
26+
15,"arch-form-iris","null","not testable with Assertion Tester","Form contexts and submission targets MUST both be Internationalized Resource Identifiers (IRIs) [[!RFC3987]]."
27+
11,"arch-event-trigger","null","not testable with Assertion Tester","Events MAY be triggered through conditions that are not exposed as Properties."
28+
12,"arch-event-dataschema","null","not testable with Assertion Tester","If the data is not fully specified by the Protocol Binding used (e.g., through a media type), Events MAY contain data schemas for the event data and possible subscription control messages (e.g., to subscribe with a Webhook callback URI)."
29+
34,"arch-discovery-should-use-standard","null","not testable with Assertion Tester","Whenever possible, the Discovery mechanisms defined in [[!WOT-DISCOVERY]] SHOULD be used to distribute TDs."
30+
32,"arch-discovery-no-metadata-in-introduction-urls","null","not testable with Assertion Tester","Introduction URLs MUST NOT themselves include any metadata, e.g. a human-readable device type or name."
31+
31,"arch-discovery-no-metadata-in-introduction","null","not testable with Assertion Tester","Any introduction mechanism used for WoT Discovery MUST NOT provide metadata but instead should simply result in one or more opaque URLs at which metadata may be accessed, if and only if the user can authenticate and has the appropriate authorization (access rights)."
32+
33,"arch-discovery-metadata-after-authorization","null","not testable with Assertion Tester","Any WoT Discovery ""exploration"" implementation MUST only provide metadata and TDs after appropriate best-practice authentication and authorization."
33+
6,"arch-affordances","null","not testable with Assertion Tester","In addition to navigation affordances (i.e., Web links), Things MAY offer three other types of Interaction Affordances defined by this specification: Properties, Actions, and Events."
34+
9,"arch-action-process","null","not testable with Assertion Tester","Invoking an Action MAY also trigger a process on the Thing that manipulates state (including physical state through actuators) over time."
35+
8,"arch-action-functions","null","not testable with Assertion Tester","An Action MAY manipulate state that is not directly exposed (cf. Properties), manipulate multiple Properties at a time, or manipulate Properties based on internal logic (e.g., toggle)."
36+
10,"arch-action-dataschema","null","not testable with Assertion Tester","If the data is not fully specified by the Protocol Binding used (e.g., through a media type), Actions MAY contain data schemas for optional input parameters and output results."

testing/extractFile.js

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// Assertion extractor, from file in current repo.
2+
// Also sorts by ID (optional) and (optional) pulls in assertion text.
3+
// First column is index of where it returns in results from Cheerio.
4+
// Usage:
5+
// % npm i cheerio
6+
// % cd testing
7+
// % node extractFile.js > assertions.csv
8+
9+
const fs = require('fs');
10+
const cheerio = require('cheerio');
11+
12+
const docFilename = '../index.html'
13+
const addAssertionTxt = true; // set true to add assertion text on last column
14+
const sortData = true; // set to true to sort output data
15+
16+
fs.readFile(docFilename, 'utf8', (err,data) => {
17+
if (err) {
18+
console.error(err);
19+
return;
20+
}
21+
// Load and parse HTML
22+
const $ = cheerio.load(data);
23+
24+
// Extract assertion and put them into an array of objects
25+
var arr_data = [];
26+
$('.rfc2119-assertion').each(function (i) {
27+
arr_data.push({
28+
"html": $(this),
29+
"index": i
30+
});
31+
});
32+
33+
// Optionally sort assertions by ID
34+
if (sortData) {
35+
// this is an in-place sort
36+
arr_data.sort((a,b) => {
37+
let sa = a.html.attr("id");
38+
let sb = b.html.attr("id");
39+
return (sa < sb) - (sa > sb); // case-sensitive order
40+
});
41+
}
42+
43+
// Initialize headers in output CSV file
44+
console.log(`"Index","ID","Status","Comment"${addAssertionTxt?',"Assertion"':''}`);
45+
46+
// Output each row of array data into CSV, with optional assertion text
47+
for (j = 0; j < arr_data.length; j++) {
48+
let element = arr_data[j];
49+
let i = element.index;
50+
let id = element.html.attr('id');
51+
let text = element.html.text();
52+
let assertionTxt = "";
53+
if (addAssertionTxt) {
54+
assertionTxt = ',"'+text.trim().replace(/\r?\n/g,'').replace(/\s+/g,' ').replace(/"/g, '""')+'"';
55+
}
56+
console.log(`${i},"${id}","null","not testable with Assertion Tester"${assertionTxt}`);
57+
}
58+
});

testing/manual.csv

-1
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
"ID","Status","Comment"

testing/report11.html

+47-6
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ <h1 id="h_ir">
119119
Implementation Report
120120
</h1>
121121
<p>
122-
<b>Version</b>: 10 Feb 2022
122+
<b>Version</b>: 25 Mar 2022
123123
</p>
124124
<p>
125125
<b>Editors (Tentative)</b>:<br>
@@ -158,7 +158,9 @@ <h2 id="h_toc"><a id="toc" name="toc">Table of Contents</a></h2>
158158
<!--
159159
<li class="tocline">6.x <a href="#impl-ORG">ORG</a></li>
160160
-->
161-
</ul>
161+
<li class="tocline">
162+
6.1 <a href="#impl-intel">Organization</a></li>
163+
</ul>
162164
<li class="tocline">7. <a href="#security">Security</a></li>
163165
<li class="tocline">8. <a href="#test_results">Test results</a>
164166
<ul>
@@ -358,7 +360,32 @@ <h2 id="h_systems"><a id="test-systems" name="test-systems">6. Systems</a></h2>
358360
</p>
359361
<div id="systems-impl">
360362
<!-- system implementation descriptions will be inserted here -->
361-
</div>
363+
<div class="impl" id="impl-intel">
364+
<h3>Organization</h3>
365+
<div class="testimonial">
366+
<p>
367+
Intel supports this specification as it {{reason}}.
368+
</p>
369+
<p>
370+
{{Introduction}}
371+
</p>
372+
</div>
373+
374+
<h4 id="impl-intel-nodejs">{{implementation_name}}: {{implementation_category}}</h4>
375+
<p>
376+
Two services based on a shared NodeJS codebase:
377+
</p><ul>
378+
<li>A simple camera service that interfaces
379+
with V4L (Video for Linux) to capture still images
380+
from a USB camera.
381+
</li>
382+
<li>A simple text-to-speech output service based on espeak.
383+
</li>
384+
</ul>
385+
Not based on node-wot.
386+
<p></p>
387+
388+
</div></div>
362389

363390
<h2 id="h_security"><a id="security" name="security">7. Security</a></h2>
364391
<p>
@@ -909,8 +936,21 @@ <h3 id="h_automated_validation_results"><a id="automated_validation_results" nam
909936
<td class="result missing">0</td>
910937
<td class="result missing">0</td>
911938
<td class="result missing">0</td></tr>
912-
<tr id="arch-rel-types" class="baseassertion">
913-
<td class="baseassertion"><a target="spec" href="https://www.w3.org/TR/wot-thing-description#arch-rel-types">arch-rel-types</a></td>
939+
<tr id="arch-rel-types-1" class="baseassertion">
940+
<td class="baseassertion"><a target="spec" href="https://www.w3.org/TR/wot-thing-description#arch-rel-types-1">arch-rel-types-1</a></td>
941+
<td class="baseassertion"></td>
942+
<td class="baseassertion">Y</td>
943+
<td class="baseassertion"></td>
944+
<td class="baseassertion">Things MUST be hosted on networked system components
945+
with a software stack to realize interaction through a
946+
network-facing interface, the WoT Interface of a Thing.</td>
947+
<td class="baseassertion"></td>
948+
<td class="result missing">0</td>
949+
<td class="result missing">0</td>
950+
<td class="result missing">0</td>
951+
<td class="result missing">0</td></tr>
952+
<tr id="arch-rel-types-2" class="baseassertion">
953+
<td class="baseassertion"><a target="spec" href="https://www.w3.org/TR/wot-thing-description#arch-rel-types-2">arch-rel-types-2</a></td>
914954
<td class="baseassertion"></td>
915955
<td class="baseassertion">Y</td>
916956
<td class="baseassertion"></td>
@@ -944,7 +984,8 @@ <h3 id="h_automated_validation_results"><a id="automated_validation_results" nam
944984
<td class="baseassertion">N</td>
945985
<td class="baseassertion"></td>
946986
<td class="baseassertion">WoT Thing Descriptions
947-
MAY link to other Things and other resources on the Web to form a Web of Things.
987+
and WoT Thing Models MAY link to other Things, WoT Thing Models,
988+
and other resources on the Web to form a Web of Things.
948989
</td>
949990
<td class="baseassertion"></td>
950991
<td class="result missing">0</td>

testing/template.csv

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
"ID","Status","Comment"
2+
"arch-action-dataschema","null",
3+
"arch-action-functions","null",
4+
"arch-action-process","null",
5+
"arch-affordances","null",
6+
"arch-discovery-metadata-after-authorization","null",
7+
"arch-discovery-no-metadata-in-introduction","null",
8+
"arch-discovery-no-metadata-in-introduction-urls","null",
9+
"arch-discovery-should-use-standard","null",
10+
"arch-event-dataschema","null",
11+
"arch-event-trigger","null",
12+
"arch-form-iris","null",
13+
"arch-form-iris2","null",
14+
"arch-hypermedia","null",
15+
"arch-hypermedia-caching","null",
16+
"arch-hypermedia-protocol-binding","null",
17+
"arch-id-correlation","null",
18+
"arch-intermediary-td-extra-protocols","null",
19+
"arch-media-type","null",
20+
"arch-media-type-extra","null",
21+
"arch-op-expected-request","null",
22+
"arch-op-extension-comparison","null",
23+
"arch-op-extension-lowercase","null",
24+
"arch-op-extension-uri","null",
25+
"arch-op-form-fields-protocol","null",
26+
"arch-op-request-method","null",
27+
"arch-op-wellknown","null",
28+
"arch-other-thing-representations","null",
29+
"arch-property-dataschema","null",
30+
"arch-rel-type-lowercase","null",
31+
"arch-rel-types-1","null",
32+
"arch-rel-types-2","null",
33+
"arch-schema","null",
34+
"arch-td-linking","null",
35+
"arch-td-mandatory","null",
36+
"arch-td-metadata","null",

0 commit comments

Comments
 (0)