Adding an RSpec test.

This commit is contained in:
Daniel Hernandez 2026-02-22 20:26:08 +01:00
parent abe70062a8
commit 37aa504767
4 changed files with 51 additions and 1 deletions

View file

@ -6,3 +6,5 @@ gem 'sparql'
gem 'rdf-turtle'
gem 'nokogiri'
gem 'pry'
gem 'rspec'
gem 'ostruct'

View file

@ -7,6 +7,7 @@ GEM
builder (3.3.0)
coderay (1.1.3)
connection_pool (3.0.2)
diff-lcs (1.6.2)
ebnf (2.6.0)
base64 (~> 0.2)
htmlentities (~> 4.3)
@ -26,6 +27,7 @@ GEM
connection_pool (>= 2.2.4, < 4)
nokogiri (1.19.0-x86_64-linux-gnu)
racc (~> 1.4)
ostruct (0.6.3)
pry (0.16.0)
coderay (~> 1.1)
method_source (~> 1.0)
@ -47,6 +49,19 @@ GEM
reline (0.6.3)
io-console (~> 0.5)
rexml (3.4.4)
rspec (3.13.2)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.6)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.5)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.7)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.7)
scanf (1.0.0)
sequel (5.101.0)
bigdecimal
@ -74,8 +89,10 @@ PLATFORMS
DEPENDENCIES
mysql2
nokogiri
ostruct
pry
rdf-turtle
rspec
sequel
sparql
@ -86,6 +103,7 @@ CHECKSUMS
builder (3.3.0) sha256=497918d2f9dca528fdca4b88d84e4ef4387256d984b8154e9d5d3fe5a9c8835f
coderay (1.1.3) sha256=dc530018a4684512f8f38143cd2a096c9f02a1fc2459edcfe534787a7fc77d4b
connection_pool (3.0.2) sha256=33fff5ba71a12d2aa26cb72b1db8bba2a1a01823559fb01d29eb74c286e62e0a
diff-lcs (1.6.2) sha256=9ae0d2cba7d4df3075fe8cd8602a8604993efc0dfa934cff568969efb1909962
ebnf (2.6.0) sha256=e746a316caa885cc45e243dc33efc194943956760bc9bc13948de1732fbcf63e
htmlentities (4.4.2) sha256=bbafbdf69f2eca9262be4efef7e43e6a1de54c95eb600f26984f71d2fe96c5c3
io-console (0.8.2) sha256=d6e3ae7a7cc7574f4b8893b4fca2162e57a825b223a177b7afa236c5ef9814cc
@ -96,6 +114,7 @@ CHECKSUMS
mysql2 (0.5.7) sha256=ba09ede515a0ae8a7192040a1b778c0fb0f025fa5877e9be895cd325fa5e9d7b
net-http-persistent (4.0.8) sha256=ef3de8319d691537b329053fae3a33195f8b070bbbfae8bf1a58c796081960e6
nokogiri (1.19.0-x86_64-linux-gnu) sha256=f482b95c713d60031d48c44ce14562f8d2ce31e3a9e8dd0ccb131e9e5a68b58c
ostruct (0.6.3) sha256=95a2ed4a4bd1d190784e666b47b2d3f078e4a9efda2fccf18f84ddc6538ed912
pry (0.16.0) sha256=d76c69065698ed1f85e717bd33d7942c38a50868f6b0673c636192b3d1b6054e
racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f
rdf (3.3.1) sha256=dda6a2c95198915fc63d66ee270e35d4a76d431720747a2cf97ecd92062fa150
@ -105,6 +124,11 @@ CHECKSUMS
readline (0.0.4) sha256=6138eef17be2b98298b672c3ea63bf9cb5158d401324f26e1e84f235879c1d6a
reline (0.6.3) sha256=1198b04973565b36ec0f11542ab3f5cfeeec34823f4e54cebde90968092b1835
rexml (3.4.4) sha256=19e0a2c3425dfbf2d4fc1189747bdb2f849b6c5e74180401b15734bc97b5d142
rspec (3.13.2) sha256=206284a08ad798e61f86d7ca3e376718d52c0bc944626b2349266f239f820587
rspec-core (3.13.6) sha256=a8823c6411667b60a8bca135364351dda34cd55e44ff94c4be4633b37d828b2d
rspec-expectations (3.13.5) sha256=33a4d3a1d95060aea4c94e9f237030a8f9eae5615e9bd85718fe3a09e4b58836
rspec-mocks (3.13.7) sha256=0979034e64b1d7a838aaaddf12bf065ea4dc40ef3d4c39f01f93ae2c66c62b1c
rspec-support (3.13.7) sha256=0640e5570872aafefd79867901deeeeb40b0c9875a36b983d85f54fb7381c47c
scanf (1.0.0) sha256=533db7f7e5acafea1a145d6c5329cef667a58fbcb7d64379a808ff1199ee1b00
sequel (5.101.0) sha256=d2ae3fd997a7c4572e8357918e777869faf90dc19310fcd6332747122aed2b29
sparql (3.3.2) sha256=20d73a62801fd6d03c834ca5012c11aaf6594ef536f554e92fd94bf9b3ed64dc

View file

@ -3767,7 +3767,7 @@ person:BorHei-00 a schema:Person ;
tm:religion "Christian" ;
schema:gender schema:Male ;
schema:image <https://www.t-migrants.gwi.uni-muenchen.de/wp-content/uploads/images/1-Henry-Boernstein.jpg> ;
tm:imageSource "Heinrich Börnstein, Visitenkarte, ca. 1873, Jean-Baptiste Feilner.&nbsp;Missouri Historical Society, St. Louis, Photographs and Prints Collection" ;
tm:imageSource "Heinrich Börnstein, Visitenkarte, ca. 1873, Jean-Baptiste Feilner.&nbsp;Missouri Historical Society, St. Louis, Photographs and Prints Collection" ;
schema:birthDate "1805-11-04"^^<http://www.w3.org/2001/XMLSchema#date> ;
tm:birthDateMax "1805-11-04"^^<http://www.w3.org/2001/XMLSchema#date> ;
schema:birthPlace location:GER-HH-00 ;

24
spec/example_01_spec.rb Normal file
View file

@ -0,0 +1,24 @@
require 'rdf'
require 'rdf/turtle'
RSpec.describe 'data_examples/example_01.ttl' do
let(:data_dir) { File.expand_path('../data', __dir__) }
let(:example_file) { File.expand_path('../data_examples/example_01.ttl', __dir__) }
let(:full_graph) do
graph = RDF::Graph.new
Dir.glob(File.join(data_dir, '*.ttl')).each do |path|
graph.load(path)
end
graph
end
let(:example_graph) { RDF::Graph.load(example_file) }
it 'every triple in the example is present in the combined data graph' do
missing = example_graph.each_statement.reject { |stmt| full_graph.include?(stmt) }
expect(missing).to be_empty, \
"#{missing.size} triple(s) from the example are not in the data graph:\n" +
missing.map { |s| " #{s.to_ntriples}" }.join("\n")
end
end