earl-report 0.2.1 → 0.2.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.
- data/VERSION +1 -1
- data/lib/earl_report.rb +30 -11
- metadata +2 -2
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.2.
|
|
1
|
+
0.2.2
|
data/lib/earl_report.rb
CHANGED
|
@@ -69,12 +69,14 @@ class EarlReport
|
|
|
69
69
|
|
|
70
70
|
SELECT ?by ?mode ?outcome ?subject ?test
|
|
71
71
|
WHERE {
|
|
72
|
-
|
|
72
|
+
?a a earl:Assertion;
|
|
73
73
|
earl:assertedBy ?by;
|
|
74
|
-
earl:mode ?mode;
|
|
75
74
|
earl:result [earl:outcome ?outcome];
|
|
76
75
|
earl:subject ?subject;
|
|
77
|
-
earl:test ?test
|
|
76
|
+
earl:test ?test .
|
|
77
|
+
OPTIONAL {
|
|
78
|
+
?a earl:mode ?mode .
|
|
79
|
+
}
|
|
78
80
|
}
|
|
79
81
|
ORDER BY ?subject
|
|
80
82
|
).freeze
|
|
@@ -159,8 +161,12 @@ class EarlReport
|
|
|
159
161
|
files.flatten.each do |file|
|
|
160
162
|
status "read #{file}"
|
|
161
163
|
file_graph = RDF::Graph.load(file)
|
|
162
|
-
|
|
163
|
-
|
|
164
|
+
if file_graph.first_object(:predicate => RDF::URI('http://www.w3.org/ns/earl#testSubjects'))
|
|
165
|
+
status " skip #{file}, which seems to be a previous rollup earl report"
|
|
166
|
+
else
|
|
167
|
+
status " loaded #{file_graph.count} triples"
|
|
168
|
+
@graph << file_graph
|
|
169
|
+
end
|
|
164
170
|
end
|
|
165
171
|
|
|
166
172
|
# Find or load DOAP descriptions for all subjects
|
|
@@ -184,7 +190,7 @@ class EarlReport
|
|
|
184
190
|
SPARQL.execute(TEST_SUBJECT_QUERY, @graph).each do |solution|
|
|
185
191
|
# Load DOAP definitions
|
|
186
192
|
if solution[:developer] && !solution[:devName] # not loaded
|
|
187
|
-
status "read description for #{solution[:developer].inspect}"
|
|
193
|
+
status "read description for developer #{solution[:developer].inspect}"
|
|
188
194
|
begin
|
|
189
195
|
foaf_graph = RDF::Graph.load(solution[:developer])
|
|
190
196
|
status " loaded #{foaf_graph.count} triples"
|
|
@@ -192,6 +198,8 @@ class EarlReport
|
|
|
192
198
|
rescue
|
|
193
199
|
status " failed"
|
|
194
200
|
end
|
|
201
|
+
elsif !solution[:developer]
|
|
202
|
+
STDERR.puts "No developer identified for #{uri}"
|
|
195
203
|
end
|
|
196
204
|
end
|
|
197
205
|
end
|
|
@@ -297,7 +305,7 @@ class EarlReport
|
|
|
297
305
|
@subject_info ||= begin
|
|
298
306
|
ts_info = {}
|
|
299
307
|
SPARQL.execute(TEST_SUBJECT_QUERY, @graph).each do |solution|
|
|
300
|
-
status "solution #{solution.to_hash.inspect}"
|
|
308
|
+
#status "solution #{solution.to_hash.inspect}"
|
|
301
309
|
info = ts_info[solution[:uri].to_s] ||= {}
|
|
302
310
|
%w(name doapDesc homepage language).each do |prop|
|
|
303
311
|
info[prop] = solution[prop.to_sym].to_s if solution[prop.to_sym]
|
|
@@ -384,7 +392,7 @@ class EarlReport
|
|
|
384
392
|
'@type' => 'earl:Assertion',
|
|
385
393
|
'test' => uri.to_s,
|
|
386
394
|
'subject' => siri,
|
|
387
|
-
'mode' => 'earl:
|
|
395
|
+
'mode' => 'earl:notAvailable',
|
|
388
396
|
'result' => {
|
|
389
397
|
'@type' => 'earl:TestResult',
|
|
390
398
|
'outcome' => 'earl:untested'
|
|
@@ -407,12 +415,23 @@ class EarlReport
|
|
|
407
415
|
# Iterate through assertions and add to appropriate test case
|
|
408
416
|
SPARQL.execute(ASSERTION_QUERY, @graph).each do |solution|
|
|
409
417
|
tc = test_cases[solution[:test].to_s]
|
|
410
|
-
|
|
418
|
+
unless tc
|
|
419
|
+
STDERR.puts "Skipping result for #{solution[:test]}, which is not defined in manifests"
|
|
420
|
+
next
|
|
421
|
+
end
|
|
422
|
+
unless solution[:outcome]
|
|
423
|
+
STDERR.puts "No result found for #{solution[:test]}: #{solution.inspect}"
|
|
424
|
+
next
|
|
425
|
+
end
|
|
411
426
|
subject = solution[:subject].to_s
|
|
412
427
|
result_index = subjects.index(subject)
|
|
428
|
+
unless solution[:outcome]
|
|
429
|
+
STDERR.puts "No test subject found for #{solution[:test]}: #{solution.inspect}"
|
|
430
|
+
next
|
|
431
|
+
end
|
|
413
432
|
ta_hash = tc['assertions'][result_index]
|
|
414
433
|
ta_hash['assertedBy'] = solution[:by].to_s
|
|
415
|
-
ta_hash['mode'] = "earl:#{solution[:mode].to_s.split('#').last || '
|
|
434
|
+
ta_hash['mode'] = "earl:#{solution[:mode].to_s.split('#').last || 'notAvailable'}"
|
|
416
435
|
ta_hash['result']['outcome'] = "earl:#{solution[:outcome].to_s.split('#').last}"
|
|
417
436
|
end
|
|
418
437
|
|
|
@@ -512,7 +531,7 @@ class EarlReport
|
|
|
512
531
|
res += %( doap:programming-language "#{desc['language']}";\n) if desc['language']
|
|
513
532
|
res += %( .\n\n)
|
|
514
533
|
|
|
515
|
-
[desc['developer']].flatten.each do |developer|
|
|
534
|
+
[desc['developer']].flatten.compact.each do |developer|
|
|
516
535
|
if developer['@id']
|
|
517
536
|
res += %(<#{desc['@id']}> doap:developer <#{developer['@id']}> .\n\n)
|
|
518
537
|
res += %(<#{developer['@id']}> a #{[developer['@type']].flatten.join(', ')};\n)
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: earl-report
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.2
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2013-02-
|
|
12
|
+
date: 2013-02-25 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: linkeddata
|