Skip to content

MODLD-529: Authority: Create Place resource from marc auth field 151 … #68

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

Merged
merged 1 commit into from
Mar 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
- Convert marc field 545 to Resource description [MODLD-337](https://folio-org.atlassian.net/browse/MODLD-337)
- Derive MARC 300 from Graph [MODLD-401](https://folio-org.atlassian.net/browse/MODLD-401)
- Convert marc field 586 (Awards Note) to Resource description [MODLD-366](https://folio-org.atlassian.net/browse/MODLD-366)
- Create Place resource from marc auth field 151 when $v, $x, $y, $z not present [MODLD-529](https://folio-org.atlassian.net/browse/MODLD-529)

## 1.0.2 (03-12-2025)
- Initial release
12 changes: 12 additions & 0 deletions src/main/resources/marc4ldAuthority.yml
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,18 @@ authorityFieldRules:
x: presented
y: presented
z: presented
- types: PLACE
subfields:
a: NAME
g: MISC_INFO
constants:
RESOURCE_PREFERRED: true
marc2ldCondition:
fieldsAllOf:
v: not_presented
x: not_presented
y: not_presented
z: not_presented
'155':
- types: CONCEPT, FORM
include: 15X_mappings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import static org.folio.marc4ld.test.helper.AuthorityValidationHelper.validateFocusResource;
import static org.folio.marc4ld.test.helper.AuthorityValidationHelper.validateIdentifier;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.folio.marc4ld.Marc2LdTestBase;
Expand All @@ -29,7 +30,7 @@ class MarcToLdAuthorityConceptPlace151IT extends Marc2LdTestBase {
private static final String EXPECTED_FOCUS_LABEL = "aValue";

@Test
void shouldMap151FieldCorrectly() {
void shouldMap151FieldToConceptPlaceResource_whenSubFocusFieldsArePresent() {
// given
var marc = loadResourceAsString("authority/151/marc_151_concept_place.jsonl");

Expand All @@ -41,25 +42,29 @@ void shouldMap151FieldCorrectly() {
.singleElement()
.satisfies(resource -> assertThat(resource.getOutgoingEdges()).hasSize(10))
.satisfies(
resource -> validateResource(resource, List.of(CONCEPT, PLACE), generalProperties(), EXPECTED_MAIN_LABEL))
resource -> validateResource(resource, List.of(CONCEPT, PLACE), conceptPlaceProperties(), EXPECTED_MAIN_LABEL))
.satisfies(resource -> validateFocusResource(resource, PLACE, focusProperties(), EXPECTED_FOCUS_LABEL))
.satisfies(AuthorityValidationHelper::validateSubFocusResources)
.satisfies(resource -> validateIdentifier(resource, "010fieldvalue"));
}

@Test
void shouldNotMap151FieldWhenSubFocusFieldsAreEmpty() {
void shouldMap151FieldToPlaceResource_whenSubFocusFieldsAreEmpty() {
// given
var marc = loadResourceAsString("authority/151/marc_151_place_empty_subfocus.jsonl");

// when
var resources = marcAuthorityToResources(marc);

//then
assertThat(resources).isEmpty();
assertThat(resources)
.singleElement()
.satisfies(resource -> assertThat(resource.getOutgoingEdges()).hasSize(1))
.satisfies(resource -> validateResource(resource, List.of(PLACE), placeProperties(), EXPECTED_FOCUS_LABEL))
.satisfies(resource -> validateIdentifier(resource, "010fieldvalue"));
}

private Map<String, List<String>> generalProperties() {
private Map<String, List<String>> conceptPlaceProperties() {
return Map.of(
NAME.getValue(), List.of("aValue"),
MISC_INFO.getValue(), List.of("gValue"),
Expand All @@ -80,4 +85,10 @@ private Map<String, List<String>> focusProperties() {
);
}

private Map<String, List<String>> placeProperties() {
var placeProperties = new HashMap<>(focusProperties());
placeProperties.put("http://library.link/vocab/resourcePreferred", List.of("true"));
return placeProperties;
}

}