forked from w3c/ldp-testsuite
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathldp-template.html.haml
301 lines (296 loc) · 14.3 KB
/
ldp-template.html.haml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
-# This template is used for generating a rollup EARL report. It expects to be
-# called with a single _tests_ local with the following structure
-#
-# {
-# "@context": {...},
-# "@id": "",
-# "@type": "earl:Software",
-# "name": "...",
-# "bibRef": "[[...]]",
-# "assertions": ["./rdf.rb-earl.ttl"],
-# "testSubjects": [
-# {
-# "@id": "http://rubygems.org/gems/rdf-turtle",
-# "@type": "earl:TestSubject",
-# "name": "RDF::Turtle"
-# },
-# ...
-# ],
-# "tests": [{
-# "@id": "http://dvcs.w3.org/hg/rdf/raw-file/default/rdf-turtle/tests-ttl/manifest.ttl#turtle-syntax-file-01",
-# "@type": ["earl:TestCriterion", "earl:TestCase"],
-# "title": "subm-test-00",
-# "description": "Blank subject",
-# "testAction": "http://dvcs.w3.org/hg/rdf/raw-file/default/rdf-turtle/tests-ttl/turtle-syntax-file-01.ttl",
-# "testResult": "http://dvcs.w3.org/hg/rdf/raw-file/default/rdf-turtle/tests-ttl/turtle-syntax-file-01.out"
-# "mode": "earl:automatic",
-# "assertions": [
-# {
-# "@type": "earl:Assertion",
-# "assertedBy": "http://greggkellogg.net/foaf#me",
-# "test": "http://svn.apache.org/repos/asf/jena/Experimental/riot-reader/testing/RIOT/Lang/TurtleSubm/manifest.ttl#testeval00",
-# "subject": "http://rubygems.org/gems/rdf-turtle",
-# "result": {
-# "@type": "earl:TestResult",
-# "outcome": "earl:passed"
-# }
-# }
-# ]
-# }]
-# }
- require 'cgi'
- require 'digest'
!!! 5
%html{:prefix => "earl: http://www.w3.org/ns/earl# doap: http://usefulinc.com/ns/doap# mf: http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#"}
- subjects = tests['testSubjects']
%head
%meta{"http-equiv" => "Content-Type", :content => "text/html;charset=utf-8"}
%link{:rel => "alternate", :href => "ldp.ttl"}
%link{:rel => "alternate", :href => "ldp.jsonld"}
- tests['assertions'].each do |file|
%link{:rel => "related", :href => file}
%title
Linked Data Platform Implementation Conformance Report
%script.remove{:type => "text/javascript", :src => "https://www.w3.org/Tools/respec/respec-w3c-common"}
:javascript
var respecConfig = {
// extend the bibliography entries
localBiblio: {
TURTLE: "Eric Prud'hommeaux, Gavin Carothers. <cite><a href=\"http://www.w3.org/TR/2011/WD-turtle-20110809/\">Turtle: Terse RDF Triple Language.</a></cite> 09 August 2011. W3C Working Draft. URL: <a href=\"http://www.w3.org/TR/2011/WD-turtle-20110809/\">http://www.w3.org/TR/2011/WD-turtle-20110809/</a>",
DOAP: "Ed Dumbill. <cite><a href=\"https://github.com/edumbill/doap/wiki\">Turtle: Terse RDF Triple Language.</a></cite> Community Specification. URL: <a href=\"https://github.com/edumbill/doap/wiki\">https://github.com/edumbill/doap/wiki</a>",
},
// specification status (e.g. WD, LCWD, WG-NOTE, etc.). If in doubt use ED.
specStatus: "WG-NOTE",
copyrightStart: "2014",
doRDFa: "1.1",
publishDate: "#{Time.now.strftime("%Y/%m/%d")}",
// if you want to have extra CSS, append them to this list
// it is recommended that the respec.css stylesheet be kept
//extraCSS: [
// "http://dev.w3.org/2009/dap/ReSpec.js/css/respec.css"
//],
shortName: "ldp-implreport",
// subtitle: "Linked Data Platform Implementation Conformance Report",
edDraftURI: "http://www.w3.org/2012/ldp/hg/tests/reports/ldp.html",
testSuiteURI: "https://dvcs.w3.org/hg/ldpwg/raw-file/tip/tests/ldp-testsuite.html",
implementationReportURI: "https://dvcs.w3.org/hg/ldpwg/raw-file/tip/tests/reports/ldp.html",
maxTocLevel: 2,
editors: [
{ name: "Steve Speicher", url: "http://stevespeicher.blogspot.com/",
company: "IBM Corporation", companyURL: "http://ibm.com/" },
{ name: "Sergio Fernández", url: "http://www.wikier.org/",
company: "The Apache Software Foundation", companyURL: "http://www.apache.org/" },
],
wg: "Linked Data Platform Working Group",
wgURI: "http://www.w3.org/2012/ldp",
wgPublicList: "public-ldp-comments",
wgPatentURI: "http://www.w3.org/2004/01/pp-impl/55082/status",
alternateFormats: [
{uri: "earl.ttl", label: "Turtle"},
{uri: "earl.jsonld", label: "JSON-LD"}
],
};
:css
span[property='dc:description'] { display: none; }
td.PASS { color: green; }
td.FAIL { color: red; }
table.report {
border-width: 1px;
border-spacing: 2px;
border-style: outset;
border-color: gray;
border-collapse: separate;
background-color: white;
}
table.report th {
border-width: 1px;
padding: 1px;
border-style: inset;
border-color: gray;
background-color: white;
-moz-border-radius: ;
}
table.report td {
border-width: 1px;
padding: 1px;
border-style: inset;
border-color: gray;
background-color: white;
-moz-border-radius: ;
}
tr.summary {font-weight: bold;}
td.passed-all {color: green;}
td.passed-most {color: darkorange;}
td.passed-some {color: red;}
%body{:prefix => "earl: http://www.w3.org/ns/earl# doap: http://usefulinc.com/ns/doap# mf: http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#"}
%section#abstract{:about => tests['@id'], :typeof => Array(tests['@type']).join(" ")}
%p
This document reports test subject conformance for
Linked Data Platform 1.0 [[LINKED-DATA-PLATFORM]] specification using
the Evaluation and Report Language (EARL) 1.0 Schema [[EARL10-SCHEMA]].
%p
This report is also available in alternate formats:
%a{:rel => "xhv:alternate", :href => "ldp.ttl"}
Turtle
and
%a{:rel => "xhv:alternate", :href => "ldp.jsonld"}
JSON-LD
%section#sodt
%section
- test_info = {}
- test_refs = {}
- subject_refs = {}
%h2
Test Manifests
- tests['entries'].each do |manifest|
- test_cases = manifest['entries']
%section{:typeof => manifest['@type'].join(" "), :resource => manifest['@id']}
%h2{:property => "dc:title mf:name"}<=manifest['title'] || 'Test Manifest'
- Array(manifest['description']).each do |desc|
%p{:property => "rdfs:comment"}<
~ CGI.escapeHTML desc
%table.report
- skip_subject = {}
- passed_tests = []
%tr
%th
Test
- subjects.each_with_index do |subject, index|
- subject_refs[subject['@id']] = "subj_#{index}"
-# If subject is untested for every test in this manifest, skip it
- skip_subject[subject['@id']] = manifest['entries'].all? {|t| t['assertions'][index]['result']['outcome'] == 'earl:untested'}
- unless skip_subject[subject['@id']]
%th
%a{:href => '#' + subject_refs[subject['@id']]}<=subject['name']
- test_cases.each do |test|
- tid = "test-definitions"
- (test_info[tid] ||= []) << test
- test_refs[test['@id']] = tid
%tr{:rel => "mf:entries", :typeof => test['@type'].join(" "), :resource => test['@id'], :inlist => true}
%td
%a{:href => test['@id'] }
= test['title']
- test['assertions'].each_with_index do |assertion, ndx|
- next if skip_subject[assertion['subject']]
- pass_fail = assertion['result']['outcome'].split(':').last.upcase.sub(/(PASS|FAIL)ED$/, '\1')
- passed_tests[ndx] = (passed_tests[ndx] || 0) + (pass_fail == 'PASS' ? 1 : 0)
%td{:class => pass_fail, :property => "earl:assertions", :typeof => assertion['@type'], :inlist => true}
- if assertion['assertedBy']
%link{:property => "earl:assertedBy", :href => assertion['assertedBy']}
%link{:property => "earl:test", :href => assertion['test']}
%link{:property => "earl:subject", :href => assertion['subject']}
- if assertion['mode']
%link{:property => 'earl:mode', :href => assertion['mode']}
%span{:property => "earl:result", :typeof => assertion['result']['@type']}
%span{:property => 'earl:outcome', :resource => assertion['result']['outcome']}
= pass_fail
%tr.summary
%td
= "Percentage passed out of #{manifest['entries'].length} Tests"
- passed_tests.compact.each do |r|
- pct = (r * 100.0) / manifest['entries'].length
%td{:class => (pct == 100.0 ? 'passed-all' : (pct >= 95.0 ? 'passed-most' : 'passed-some'))}
= "#{'%.1f' % pct}%"
%section.appendix
%h2
Test Subjects
%p
This report was tested using the following test subjects:
%dl
- subjects.each_with_index do |subject, index|
%dt{:id => subject_refs[subject['@id']]}
%a{:href => subject['@id']}
%span{:about => subject['@id'], :property => "doap:name"}<= subject['name']
%dd{:property => "earl:testSubjects", :resource => subject['@id'], :typeof => Array(subject['@type']).join(" "), :inlist => true}
%dl
- if subject['doapDesc']
%dt= "Description"
%dd{:property => "doap:description", :lang => 'en'}<
~ CGI.escapeHTML subject['doapDesc']
- if subject['language']
%dt= "Programming Language"
%dd{:property => "doap:programming-language"}<
~ CGI.escapeHTML subject['language']
- if subject['homepage']
%dt= "Home Page"
%dd{:property => "doap:homepage"}
%a{:href=> subject['homepage']}
~ CGI.escapeHTML subject['homepage']
- if subject['developer']
%dt= "Developer"
%dd{:rel => "doap:developer"}
- subject['developer'].each do |dev|
%div{:resource => dev['@id'], :typeof => Array(dev['@type']).join(" ")}
- if dev.has_key?('@id')
%a{:href => dev['@id']}
%span{:property => "foaf:name"}<
~ CGI.escapeHTML dev['foaf:name']
- else
%span{:property => "foaf:name"}<
~ CGI.escapeHTML dev['foaf:name']
- if dev['foaf:homepage']
%a{:property => "foaf:homepage", :href=> dev['foaf:homepage']}
~ CGI.escapeHTML dev['foaf:homepage']
%dt
Test Suite Compliance
%dd
%table.report
%tbody
- tests['entries'].each do |manifest|
- passed = manifest['entries'].select {|t| t['assertions'][index]['result']['outcome'] == 'earl:passed' }.length
- next if passed == 0
- total = manifest['entries'].length
- pct = (passed * 100.0) / total
%tr
%td
~ manifest['title']
%td{:class => (pct == 100.0 ? 'passed-all' : (pct >= 85.0 ? 'passed-most' : 'passed-some'))}
= "#{passed}/#{total} (#{'%.1f' % pct}%)"
- unless tests['assertions'].empty?
%section.appendix{:rel => "xhv:related earl:assertions"}
%h2
Individual Test Results
%p
Individual test results used to construct this report are available here:
%ul
- tests['assertions'].each do |file|
%li
%a.source{:href => "http://w3c.github.io/ldp-testsuite/report/#{file}"}<= file
%section.appendix
%h2
Test Definitions
%p
Individual tests are defined in source code and hosted on GitHub at <a href="http://w3c.github.io/ldp-testsuite/">http://w3c.github.io/ldp-testsuite/</a>
%section#appendix{:property => "earl:generatedBy", :resource => tests['generatedBy']['@id'], :typeof => tests['generatedBy']['@type']}
%h2
Report Generation Software
%p
The test suite, mostly automated, is available at <a href="http://w3c.github.io/ldp-testsuite/">http://w3c.github.io/ldp-testsuite/</a>
%p
Software used to take EARL input files and generate a report is within the same GitHub repository.
- doap = tests['generatedBy']
- rel = doap['release']
%p
This report generated by
%span{:property => "doap:name"}<
%a{:href => tests['generatedBy']['@id']}<
= doap['name']
%meta{:property => "doap:shortdesc", :content => doap['shortdesc'], :lang => 'en'}
%meta{:property => "doap:description", :content => doap['doapDesc'], :lang => 'en'}
version
%span{:property => "doap:release", :resource => rel['@id'], :typeof => 'doap:Version'}
%span{:property => "doap:revision"}<=rel['revision']
%meta{:property => "doap:name", :content => rel['name']}
%meta{:property => "doap:created", :content => rel['created'], :datatype => "xsd:date"}
an
%a{:property => "doap:license", :href => doap['license']}<="Unlicensed"
%span{:property => "doap:programming-language"}<="Ruby"
application. More information is available at
%a{:property => "doap:homepage", :href => doap['homepage']}<=doap['homepage']
= "."
%p{:property => "doap:developer", :resource => "http://greggkellogg.net/foaf#me", :typeof => "foaf:Person"}
This software is provided by
%a{:property => "foaf:homepage", :href => "http://greggkellogg.net/"}<
%span{:aboue => "http://greggkellogg.net/foaf#me", :property => "foaf:name"}<
Gregg Kellogg
in hopes that it might make the lives of conformance testers easier.