Skip to content

Commit

Permalink
Finish 0.4.4
Browse files Browse the repository at this point in the history
  • Loading branch information
gkellogg committed Jan 4, 2017
2 parents 76ca470 + c1b46b1 commit 92a0782
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 11 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ rvm:
- rbx
cache: bundler
sudo: false
matrix:
allow_failures:
- rvm: rbx

2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.4.3
0.4.4
5 changes: 0 additions & 5 deletions bin/earl-report
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
#!/usr/bin/env ruby
require 'rubygems'
$:.unshift(File.expand_path("../../lib", __FILE__))
begin
require "bundler/setup"
rescue LoadError
#skip
end
require 'earl_report'
require 'getoptlong'
require 'yaml'
Expand Down
9 changes: 8 additions & 1 deletion lib/earl_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def initialize(*files)
man_opts[:base_uri] = RDF::URI(@options[:base]) if @options[:base]
@graph = RDF::Graph.new
Array(@options[:manifest]).each do |man|
g = RDF::Graph.load(man, man_opts)
g = RDF::Graph.load(man, unique_bnodes: true, **man_opts)
status " loaded #{g.count} triples from #{man}"
graph << g
end
Expand Down Expand Up @@ -305,17 +305,21 @@ def initialize(*files)
end

status "query assertions"
assertion_stats = {}
SPARQL.execute(ASSERTION_QUERY, assertion_graph).each do |solution|
subject = solution[:subject]
unless tests[solution[:test]]
assertion_stats["Skipped"] = assertion_stats["Skipped"].to_i + 1
$stderr.puts "Skipping result for #{solution[:test]} for #{subject}, which is not defined in manifests"
next
end
unless subjects[subject]
assertion_stats["Missing Subject"] = assertion_stats["Missing Subject"].to_i + 1
$stderr.puts "No test result subject found for #{subject}: in #{subjects.keys.join(', ')}"
next
end
found_solutions[subject] = true
assertion_stats["Found"] = assertion_stats["Found"].to_i + 1

# Add this solution at the appropriate index within that list
ndx = subjects.keys.find_index(subject)
Expand All @@ -338,6 +342,7 @@ def initialize(*files)
# Fill any missing entries with an untested outcome
ary.each_with_index do |a, ndx|
unless a
assertion_stats["Untested"] = assertion_stats["Untested"].to_i + 1
ary[ndx] = a = RDF::Node.new
graph << RDF::Statement(a, RDF.type, EARL.Assertion)
graph << RDF::Statement(a, EARL.subject, subjects.keys[ndx])
Expand All @@ -353,6 +358,8 @@ def initialize(*files)
end
end

assertion_stats.each {|stat, count| status("Assertions #{stat}: #{count}")}

# See if any subject did not report results, which may indicate a formatting error in the EARL source
subjects.reject {|s| found_solutions[s]}.each do |sub|
$stderr.puts "No results found for #{sub} using #{ASSERTION_QUERY}"
Expand Down
8 changes: 4 additions & 4 deletions spec/earl_report_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
context "with base" do
it "loads manifest relative to base" do
expect(RDF::Graph).to receive(:load)
.with(File.expand_path("../test-files/manifest.ttl", __FILE__), {:base_uri => "http://example.com/base/"})
.with(File.expand_path("../test-files/manifest.ttl", __FILE__), {unique_bnodes: true, base_uri: "http://example.com/base/"})
.and_return(manifest)
expect(RDF::Graph).to receive(:load)
.with(File.expand_path("../test-files/report-complete.ttl", __FILE__))
Expand All @@ -56,7 +56,7 @@
context "complete report" do
before(:each) do
expect(RDF::Graph).to receive(:load)
.with(File.expand_path("../test-files/manifest.ttl", __FILE__), {})
.with(File.expand_path("../test-files/manifest.ttl", __FILE__), {unique_bnodes: true, })
.and_return(manifest)
expect(RDF::Graph).to receive(:load)
.with(File.expand_path("../test-files/report-complete.ttl", __FILE__))
Expand Down Expand Up @@ -90,7 +90,7 @@
context "no doap report" do
before(:each) do
expect(RDF::Graph).to receive(:load)
.with(File.expand_path("../test-files/manifest.ttl", __FILE__), {})
.with(File.expand_path("../test-files/manifest.ttl", __FILE__), {unique_bnodes: true, })
.and_return(manifest)
expect(RDF::Graph).to receive(:load)
.with(File.expand_path("../test-files/report-no-doap.ttl", __FILE__))
Expand Down Expand Up @@ -127,7 +127,7 @@
context "no foaf report" do
before(:each) do
expect(RDF::Graph).to receive(:load)
.with(File.expand_path("../test-files/manifest.ttl", __FILE__), {})
.with(File.expand_path("../test-files/manifest.ttl", __FILE__), {unique_bnodes: true, })
.and_return(manifest)
expect(RDF::Graph).to receive(:load)
.with(File.expand_path("../test-files/report-no-foaf.ttl", __FILE__))
Expand Down

0 comments on commit 92a0782

Please sign in to comment.