-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] update loc_full_config fixture to only use ldpath #290
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,7 @@ | |
"QA_CONFIG_VERSION": "2.2", | ||
"service_uri": "http://ld4l.org/ld4l_services/cache", | ||
"prefixes": { | ||
"schema": "http://www.w3.org/2000/01/rdf-schema#", | ||
"skos": "http://www.w3.org/2004/02/skos/core#" | ||
"dcterms": "http://purl.org/dc/terms/" | ||
}, | ||
"term": { | ||
"url": { | ||
|
@@ -56,12 +55,12 @@ | |
"term_id": "ID", | ||
"language": [ "es" ], | ||
"results": { | ||
"id_predicate": "http://purl.org/dc/terms/identifier", | ||
"label_predicate": "http://www.w3.org/2004/02/skos/core#prefLabel", | ||
"altlabel_predicate": "http://www.w3.org/2004/02/skos/core#altLabel", | ||
"broader_predicate": "http://www.w3.org/2004/02/skos/core#broader", | ||
"narrower_predicate": "http://www.w3.org/2004/02/skos/core#narrower", | ||
"sameas_predicate": "http://www.w3.org/2004/02/skos/core#exactMatch" | ||
"id_ldpath": "dcterms:identifier", | ||
"label_ldpath": "skos:prefLabel", | ||
"altlabel_ldpath": "skos:altLabel", | ||
"broader_ldpath": "skos:broader", | ||
"narrower_ldpath": "skos:narrower", | ||
"sameas_ldpath": "skos:exactMatch" | ||
}, | ||
"subauthorities": { | ||
"term_sub1_key": "term_sub1_name", | ||
|
@@ -122,10 +121,10 @@ | |
"language": [ "en", "fr", "de" ], | ||
"total_count_ldpath": "vivo:count", | ||
"results": { | ||
"id_predicate": "http://purl.org/dc/terms/identifier", | ||
"label_predicate": "http://www.w3.org/2004/02/skos/core#prefLabel", | ||
"altlabel_predicate": "http://www.w3.org/2004/02/skos/core#altLabel", | ||
"sort_predicate": "http://www.w3.org/2004/02/skos/core#prefLabel" | ||
"id_ldpath": "dcterms:identifier", | ||
"label_ldpath": "skos:prefLabel", | ||
"altlabel_ldpath": "skos:altLabel", | ||
"sort_ldpath": "skos:prefLabel" | ||
}, | ||
"context": { | ||
"groups": { | ||
|
@@ -150,7 +149,7 @@ | |
"group_id": "dates", | ||
"property_label_i18n": "qa.linked_data.authority.locnames_ld4l_cache.birth_date", | ||
"property_label_default": "Birth", | ||
"ldpath": "madsrdf:identifiesRWO/madsrdf:birthDate/schema:label", | ||
"ldpath": "madsrdf:identifiesRWO/madsrdf:birthDate/rdfs:label", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ldpath predefine RDF Schema using rdfs as the namespace. Updated the config to follow this precedence. |
||
"selectable": false, | ||
"drillable": false | ||
}, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,8 +28,7 @@ | |
QA_CONFIG_VERSION: "2.2", | ||
service_uri: "http://ld4l.org/ld4l_services/cache", | ||
prefixes: { | ||
schema: "http://www.w3.org/2000/01/rdf-schema#", | ||
skos: "http://www.w3.org/2004/02/skos/core#" | ||
dcterms: "http://purl.org/dc/terms/" | ||
}, | ||
term: { | ||
url: { | ||
|
@@ -82,12 +81,12 @@ | |
term_id: 'ID', | ||
language: ['es'], | ||
results: { | ||
id_predicate: 'http://purl.org/dc/terms/identifier', | ||
label_predicate: 'http://www.w3.org/2004/02/skos/core#prefLabel', | ||
altlabel_predicate: 'http://www.w3.org/2004/02/skos/core#altLabel', | ||
broader_predicate: 'http://www.w3.org/2004/02/skos/core#broader', | ||
narrower_predicate: 'http://www.w3.org/2004/02/skos/core#narrower', | ||
sameas_predicate: 'http://www.w3.org/2004/02/skos/core#exactMatch' | ||
id_ldpath: 'dcterms:identifier', | ||
label_ldpath: 'skos:prefLabel', | ||
altlabel_ldpath: 'skos:altLabel', | ||
broader_ldpath: 'skos:broader', | ||
narrower_ldpath: 'skos:narrower', | ||
sameas_ldpath: 'skos:exactMatch' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the primary change for the PR. The config specified results as ldpaths instead of predicates. |
||
}, | ||
subauthorities: { | ||
term_sub1_key: 'term_sub1_name', | ||
|
@@ -148,10 +147,10 @@ | |
language: ['en', 'fr', 'de'], | ||
total_count_ldpath: "vivo:count", | ||
results: { | ||
id_predicate: 'http://purl.org/dc/terms/identifier', | ||
label_predicate: 'http://www.w3.org/2004/02/skos/core#prefLabel', | ||
altlabel_predicate: 'http://www.w3.org/2004/02/skos/core#altLabel', | ||
sort_predicate: 'http://www.w3.org/2004/02/skos/core#prefLabel' | ||
id_ldpath: 'dcterms:identifier', | ||
label_ldpath: 'skos:prefLabel', | ||
altlabel_ldpath: 'skos:altLabel', | ||
sort_ldpath: 'skos:prefLabel' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the primary change for the PR. The config now specifies results as ldpaths instead of predicates. |
||
}, | ||
context: { | ||
groups: { | ||
|
@@ -176,7 +175,7 @@ | |
group_id: "dates", | ||
property_label_i18n: "qa.linked_data.authority.locnames_ld4l_cache.birth_date", | ||
property_label_default: "Birth", | ||
ldpath: "madsrdf:identifiesRWO/madsrdf:birthDate/schema:label", | ||
ldpath: "madsrdf:identifiesRWO/madsrdf:birthDate/rdfs:label", | ||
selectable: false, | ||
drillable: false | ||
}, | ||
|
@@ -405,8 +404,7 @@ | |
describe '#prefixes' do | ||
let(:expected_results) do | ||
{ | ||
schema: "http://www.w3.org/2000/01/rdf-schema#", | ||
skos: "http://www.w3.org/2004/02/skos/core#" | ||
dcterms: "http://purl.org/dc/terms/" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. rdfs (previously prefixed as schema) and skos are predefined in the ldpath gem and do not need to be defined here. dcterms is not predefined and needs to be defined here to be used in the config. |
||
} | ||
end | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,12 +11,12 @@ | |
let(:term_only_config) { Qa::Authorities::LinkedData::Config.new(:LOD_TERM_ONLY_CONFIG).search } | ||
let(:encoding_config) { Qa::Authorities::LinkedData::Config.new(:LOD_ENCODING_CONFIG).search } | ||
|
||
let(:ldpath_results_config) do | ||
let(:predicate_results_config) do | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ldpath_results_config is no longer needed because lod_full_config fixture now defines them. The predicate definitions were removed from the fixture, so they are defined here for the predicate tests to be able to continue to pass. They will eventually be removed when support for predicates is removed from the config processing classes. |
||
id_ldpath: 'schema:identifier ::xsd:string', | ||
label_ldpath: 'skos:prefLabel ::xsd:string', | ||
altlabel_ldpath: 'skos:altLabel ::xsd:string', | ||
sort_ldpath: 'skos:prefLabel ::xsd:string' | ||
id_predicate: 'http://purl.org/dc/terms/identifier', | ||
label_predicate: 'http://www.w3.org/2004/02/skos/core#prefLabel', | ||
altlabel_predicate: 'http://www.w3.org/2004/02/skos/core#altLabel', | ||
sort_predicate: 'http://www.w3.org/2004/02/skos/core#prefLabel' | ||
} | ||
end | ||
|
||
|
@@ -75,10 +75,10 @@ | |
language: ['en', 'fr', 'de'], | ||
total_count_ldpath: "vivo:count", | ||
results: { | ||
id_predicate: 'http://purl.org/dc/terms/identifier', | ||
label_predicate: 'http://www.w3.org/2004/02/skos/core#prefLabel', | ||
altlabel_predicate: 'http://www.w3.org/2004/02/skos/core#altLabel', | ||
sort_predicate: 'http://www.w3.org/2004/02/skos/core#prefLabel' | ||
id_ldpath: 'dcterms:identifier', | ||
label_ldpath: 'skos:prefLabel', | ||
altlabel_ldpath: 'skos:altLabel', | ||
sort_ldpath: 'skos:prefLabel' | ||
}, | ||
context: { | ||
groups: { | ||
|
@@ -103,7 +103,7 @@ | |
group_id: "dates", | ||
property_label_i18n: "qa.linked_data.authority.locnames_ld4l_cache.birth_date", | ||
property_label_default: "Birth", | ||
ldpath: "madsrdf:identifiesRWO/madsrdf:birthDate/schema:label", | ||
ldpath: "madsrdf:identifiesRWO/madsrdf:birthDate/rdfs:label", | ||
selectable: false, | ||
drillable: false | ||
}, | ||
|
@@ -178,22 +178,23 @@ | |
describe '#results' do | ||
let(:results_config) do | ||
{ | ||
id_predicate: 'http://purl.org/dc/terms/identifier', | ||
label_predicate: 'http://www.w3.org/2004/02/skos/core#prefLabel', | ||
altlabel_predicate: 'http://www.w3.org/2004/02/skos/core#altLabel', | ||
sort_predicate: 'http://www.w3.org/2004/02/skos/core#prefLabel' | ||
id_ldpath: 'dcterms:identifier', | ||
label_ldpath: 'skos:prefLabel', | ||
altlabel_ldpath: 'skos:altLabel', | ||
sort_ldpath: 'skos:prefLabel' | ||
} | ||
end | ||
|
||
it 'returns nil if only term configuration is defined' do | ||
expect(term_only_config.results).to eq nil | ||
end | ||
it 'returns hash of predicates' do | ||
it 'returns hash of ldpaths' do | ||
expect(full_config.results).to eq results_config | ||
end | ||
end | ||
|
||
describe '#results_id_predicate' do | ||
before { allow(full_config).to receive(:results).and_return(predicate_results_config) } | ||
it 'returns nil if only term configuration is defined' do | ||
expect(term_only_config.results_id_predicate).to eq nil | ||
end | ||
|
@@ -208,14 +209,14 @@ | |
end | ||
|
||
context 'when id specified as ldpath' do | ||
before { allow(full_config).to receive(:results).and_return(ldpath_results_config) } | ||
it 'returns the ldpath' do | ||
expect(full_config.results_id_ldpath).to eq 'schema:identifier ::xsd:string' | ||
expect(full_config.results_id_ldpath).to eq 'dcterms:identifier' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Matches the change to the lod_full_config fixture ldpaths. |
||
end | ||
end | ||
end | ||
|
||
describe '#results_label_predicate' do | ||
before { allow(full_config).to receive(:results).and_return(predicate_results_config) } | ||
it 'returns nil if only term configuration is defined' do | ||
expect(term_only_config.results_label_predicate).to eq nil | ||
end | ||
|
@@ -230,14 +231,14 @@ | |
end | ||
|
||
context 'when label specified as ldpath' do | ||
before { allow(full_config).to receive(:results).and_return(ldpath_results_config) } | ||
it 'returns the ldpath' do | ||
expect(full_config.results_label_ldpath).to eq 'skos:prefLabel ::xsd:string' | ||
expect(full_config.results_label_ldpath).to eq 'skos:prefLabel' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The ldpaths in loc_full_config fixture do not have ::xsd:string on the ldpaths. It is optional. The ldpath service already tests paths with and without the type (not in this PR). |
||
end | ||
end | ||
end | ||
|
||
describe '#results_altlabel_predicate' do | ||
before { allow(full_config).to receive(:results).and_return(predicate_results_config) } | ||
it 'returns nil if only term configuration is defined' do | ||
expect(term_only_config.results_altlabel_predicate).to eq nil | ||
end | ||
|
@@ -258,9 +259,8 @@ | |
end | ||
|
||
context 'when altlabel specified as ldpath' do | ||
before { allow(full_config).to receive(:results).and_return(ldpath_results_config) } | ||
it 'returns the ldpath' do | ||
expect(full_config.results_altlabel_ldpath).to eq 'skos:altLabel ::xsd:string' | ||
expect(full_config.results_altlabel_ldpath).to eq 'skos:altLabel' | ||
end | ||
end | ||
end | ||
|
@@ -269,15 +269,16 @@ | |
it 'returns false if only term configuration is defined' do | ||
expect(term_only_config.supports_sort?).to eq false | ||
end | ||
it 'returns false if sort predicate is NOT defined' do | ||
it 'returns false if sort ldpath is NOT defined' do | ||
expect(min_config.supports_sort?).to eq false | ||
end | ||
it 'returns true if sort predicate IS defined' do | ||
it 'returns true if sort ldpath IS defined' do | ||
expect(full_config.supports_sort?).to eq true | ||
end | ||
end | ||
|
||
describe '#results_sort_predicate' do | ||
before { allow(full_config).to receive(:results).and_return(predicate_results_config) } | ||
it 'returns nil if only term configuration is defined' do | ||
expect(term_only_config.results_sort_predicate).to eq nil | ||
end | ||
|
@@ -298,9 +299,8 @@ | |
end | ||
|
||
context 'when sort specified as ldpath' do | ||
before { allow(full_config).to receive(:results).and_return(ldpath_results_config) } | ||
it 'returns the ldpath' do | ||
expect(full_config.results_sort_ldpath).to eq 'skos:prefLabel ::xsd:string' | ||
expect(full_config.results_sort_ldpath).to eq 'skos:prefLabel' | ||
end | ||
end | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shifting lod_full_config fixture to specify ldpath for sort instead of a predicate revealed the logic on this was incorrect. The test now verifies that if sort ldpath is present, then sorting is supported.