Skip to content
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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

elrayle
Copy link
Contributor

@elrayle elrayle commented Nov 21, 2019

[WIP] Part of the process to remove deprecated predicate support

No prerequisites for this PR. It will be a prerequisite for other PRs related to removal of deprecated code.


Partially addresses #289

  • changes loc_full_config fixture to only use ldpath
  • updates config specs to check for ldpath
  • temporarily update predicate tests in config specs to test against hardcoded predicate hash (This will be removed when the config processing code no longer supports predicates.)

@@ -105,7 +105,7 @@ def results_altlabel_predicate
# Does this authority configuration support sorting of search results?
# @return [True|False] true if sorting of search results is supported; otherwise, false
def supports_sort?
return true unless results_sort_ldpath.present? || !results_sort_predicate.present?
return true if results_sort_ldpath.present? || results_sort_predicate.present?
Copy link
Contributor Author

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.

@@ -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",
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.

altlabel_ldpath: 'skos:altLabel',
broader_ldpath: 'skos:broader',
narrower_ldpath: 'skos:narrower',
sameas_ldpath: 'skos:exactMatch'
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.

id_ldpath: 'dcterms:identifier',
label_ldpath: 'skos:prefLabel',
altlabel_ldpath: 'skos:altLabel',
sort_ldpath: 'skos:prefLabel'
Copy link
Contributor Author

@elrayle elrayle Nov 21, 2019

Choose a reason for hiding this comment

The 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.

@@ -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/"
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.

@@ -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
{
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.

@elrayle elrayle changed the title update loc_full_config fixture to only use ldpath [WIP] update loc_full_config fixture to only use ldpath Nov 21, 2019
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'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Matches the change to the lod_full_config fixture ldpaths.

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'
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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).

@@ -8,14 +8,14 @@
let(:encoding_config) { Qa::Authorities::LinkedData::Config.new(:LOD_ENCODING_CONFIG).term }
let(:loc_config) { Qa::Authorities::LinkedData::Config.new(:LOC).term }

let(:ldpath_results_config) do
let(:predicate_results_config) do
{
Copy link
Contributor Author

@elrayle elrayle Nov 21, 2019

Choose a reason for hiding this comment

The 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.

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',
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.

@elrayle elrayle mentioned this pull request Nov 21, 2019
5 tasks
**[WIP] Step 1 in removing deprecated predicate support**

----

Partially addresses #289

* changes loc_full_config fixture to only use ldpath
* updates config specs to check for ldpath
* temporarily update predicate tests in config specs to test against hardcoded predicate hash (This will be removed when the config processing code no longer supports predicates.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog
Development

Successfully merging this pull request may close these issues.

1 participant