Making test pass.
This commit is contained in:
parent
16eb0f9e69
commit
0f6a7d4a94
6 changed files with 305 additions and 916 deletions
1199
data/persons.ttl
1199
data/persons.ttl
File diff suppressed because it is too large
Load diff
|
|
@ -1,6 +1,6 @@
|
||||||
@prefix occupation: <https://daniel.degu.cl/data/theater-migrants/occupations.ttl#> .
|
@prefix occupation: <https://daniel.degu.cl/data/theater-migrants/occupations.ttl#> .
|
||||||
@prefix person: <https://daniel.degu.cl/data/theater-migrants/persons.ttl#> .
|
@prefix person: <https://daniel.degu.cl/data/theater-migrants/persons.ttl#> .
|
||||||
@prefix profession: <> .
|
@prefix personOccupation: <https://daniel.degu.cl/data/theater-migrants/person_occupations.ttl#> .
|
||||||
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
|
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
|
||||||
@prefix schema: <https://schema.org/> .
|
@prefix schema: <https://schema.org/> .
|
||||||
@prefix tm: <https://daniel.degu.cl/data/theather-migrants/ontology.ttl#> .
|
@prefix tm: <https://daniel.degu.cl/data/theather-migrants/ontology.ttl#> .
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ person:AbeIre-00 a schema:Person ;
|
||||||
tm:viaf "https://viaf.org/viaf/39572476" ;
|
tm:viaf "https://viaf.org/viaf/39572476" ;
|
||||||
tm:isni "https://isni.org/isni/0000000035722792" ;
|
tm:isni "https://isni.org/isni/0000000035722792" ;
|
||||||
tm:snac "https://snaccooperative.org/ark:/99166/w6bt189x#resources" ;
|
tm:snac "https://snaccooperative.org/ark:/99166/w6bt189x#resources" ;
|
||||||
tm:source "Karl-Josef Kutsch, Leo Riemens: Großes Sängerlexikon, Bern: Saur 2003, pp. 3-4." ;
|
tm:source "Karl-Josef Kutsch, Leo Riemens: Großes Sängerlexikon, Bern: Saur 2003, pp. 3-4. \nWiener Staatsoper: Aufführungsarchiv, https://archiv.wiener-staatsoper.at/search/person/7243\nFremdenblatt - Organ für die böhmischen Kurorte, 8th July 1888, p. 2: https://anno.onb.ac.at/cgi-content/anno?aid=fbl&datum=18880708&query=%22Abendroth+Karlsbad%22~25&ref=anno-search&seite=2\n\n" ;
|
||||||
tm:importSource "Own" .
|
tm:importSource "Own" .
|
||||||
|
|
||||||
# ── Occupation ───────────────────────────────────────────────────────────────
|
# ── Occupation ───────────────────────────────────────────────────────────────
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,17 @@
|
||||||
require 'rdf'
|
require 'rdf'
|
||||||
require 'rdf/turtle'
|
require 'rdf/turtle'
|
||||||
|
require 'rdf/ntriples'
|
||||||
|
require 'logger'
|
||||||
|
|
||||||
RSpec.describe 'data_examples/example_01.ttl' do
|
RSpec.describe 'data_examples/example_01.ttl' do
|
||||||
let(:data_dir) { File.expand_path('../data', __dir__) }
|
let(:data_dir) { File.expand_path('../data', __dir__) }
|
||||||
let(:example_file) { File.expand_path('../data_examples/example_01.ttl', __dir__) }
|
let(:example_file) { File.expand_path('../data_examples/example_01.ttl', __dir__) }
|
||||||
|
let(:null_logger) { Logger.new(File::NULL) }
|
||||||
|
|
||||||
let(:full_graph) do
|
let(:full_graph) do
|
||||||
graph = RDF::Graph.new
|
graph = RDF::Graph.new
|
||||||
Dir.glob(File.join(data_dir, '*.ttl')).each do |path|
|
Dir.glob(File.join(data_dir, '*.ttl')).sort.each do |path|
|
||||||
graph.load(path)
|
graph.load(path, logger: null_logger)
|
||||||
end
|
end
|
||||||
graph
|
graph
|
||||||
end
|
end
|
||||||
|
|
@ -17,8 +20,8 @@ RSpec.describe 'data_examples/example_01.ttl' do
|
||||||
|
|
||||||
it 'every triple in the example is present in the combined data graph' do
|
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) }
|
missing = example_graph.each_statement.reject { |stmt| full_graph.include?(stmt) }
|
||||||
expect(missing).to be_empty, \
|
expect(missing).to be_empty,
|
||||||
"#{missing.size} triple(s) from the example are not in the data graph:\n" +
|
"#{missing.size} triple(s) from the example are not in the data graph:\n" +
|
||||||
missing.map { |s| " #{s.to_ntriples}" }.join("\n")
|
missing.map { |s| " " + RDF::NTriples::Writer.serialize(s) }.join
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@ DB[:person].each do |row|
|
||||||
|
|
||||||
props << "schema:givenName #{ttl_literal(row[:first_name])}" unless row[:first_name].to_s.empty?
|
props << "schema:givenName #{ttl_literal(row[:first_name])}" unless row[:first_name].to_s.empty?
|
||||||
props << "schema:familyName #{ttl_literal(row[:family_name])}" unless row[:family_name].to_s.empty?
|
props << "schema:familyName #{ttl_literal(row[:family_name])}" unless row[:family_name].to_s.empty?
|
||||||
props << "tm:religion #{ttl_literal(row[:religion])}" unless row[:religion].to_s.empty?
|
|
||||||
props << "tm:nameType #{ttl_literal(row[:Nametype])}" unless row[:Nametype].to_s.empty?
|
props << "tm:nameType #{ttl_literal(row[:Nametype])}" unless row[:Nametype].to_s.empty?
|
||||||
|
|
||||||
case row[:gender]
|
case row[:gender]
|
||||||
|
|
@ -43,7 +42,7 @@ DB[:person].each do |row|
|
||||||
props << "schema:deathPlace location:#{row[:IDDeathPlace]}" unless row[:IDDeathPlace].to_s.empty?
|
props << "schema:deathPlace location:#{row[:IDDeathPlace]}" unless row[:IDDeathPlace].to_s.empty?
|
||||||
|
|
||||||
props << "schema:sameAs <#{row[:Wikipedia]}>" unless row[:Wikipedia].to_s.empty?
|
props << "schema:sameAs <#{row[:Wikipedia]}>" unless row[:Wikipedia].to_s.empty?
|
||||||
props << "schema:sameAs wd:#{row[:Wikidata]}" unless row[:Wikidata].to_s.empty?
|
props << "schema:sameAs wd:#{row[:Wikidata].to_s.sub(/.*(?=Q)/, '')}" unless row[:Wikidata].to_s.empty?
|
||||||
props << "tm:gnd #{ttl_literal(row[:GND])}" unless row[:GND].to_s.empty?
|
props << "tm:gnd #{ttl_literal(row[:GND])}" unless row[:GND].to_s.empty?
|
||||||
props << "tm:lccn #{ttl_literal(row[:LCCN])}" unless row[:LCCN].to_s.empty?
|
props << "tm:lccn #{ttl_literal(row[:LCCN])}" unless row[:LCCN].to_s.empty?
|
||||||
props << "tm:viaf #{ttl_literal(row[:VIAF])}" unless row[:VIAF].to_s.empty?
|
props << "tm:viaf #{ttl_literal(row[:VIAF])}" unless row[:VIAF].to_s.empty?
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ require_relative 'migrants'
|
||||||
|
|
||||||
output = File.open(File.join('data', 'persons_occupations.ttl'), 'w')
|
output = File.open(File.join('data', 'persons_occupations.ttl'), 'w')
|
||||||
|
|
||||||
output.puts prefixes(:rdfs, :tm, :schema, :person, :profession, :occupation)
|
output.puts prefixes(:rdfs, :tm, :schema, :person, :personOccupation, :occupation)
|
||||||
output.puts
|
output.puts
|
||||||
|
|
||||||
DB[:person_profession].each do |row|
|
DB[:person_profession].each do |row|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue