Skip to content

Commit 376e62e

Browse files
MODLD-529: Authority: Create Place resource from marc auth field 151 when $v, $x, $y, $z not present (#68)
1 parent 0180b79 commit 376e62e

File tree

3 files changed

+29
-5
lines changed

3 files changed

+29
-5
lines changed

NEWS.md

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
- Convert marc field 545 to Resource description [MODLD-337](https://folio-org.atlassian.net/browse/MODLD-337)
44
- Derive MARC 300 from Graph [MODLD-401](https://folio-org.atlassian.net/browse/MODLD-401)
55
- Convert marc field 586 (Awards Note) to Resource description [MODLD-366](https://folio-org.atlassian.net/browse/MODLD-366)
6+
- 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)
67

78
## 1.0.2 (03-12-2025)
89
- Initial release

src/main/resources/marc4ldAuthority.yml

+12
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,18 @@ authorityFieldRules:
198198
x: presented
199199
y: presented
200200
z: presented
201+
- types: PLACE
202+
subfields:
203+
a: NAME
204+
g: MISC_INFO
205+
constants:
206+
RESOURCE_PREFERRED: true
207+
marc2ldCondition:
208+
fieldsAllOf:
209+
v: not_presented
210+
x: not_presented
211+
y: not_presented
212+
z: not_presented
201213
'155':
202214
- types: CONCEPT, FORM
203215
include: 15X_mappings

src/test/java/org/folio/marc4ld/authority/field151/MarcToLdAuthorityConceptPlace151IT.java

+16-5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import static org.folio.marc4ld.test.helper.AuthorityValidationHelper.validateFocusResource;
1717
import static org.folio.marc4ld.test.helper.AuthorityValidationHelper.validateIdentifier;
1818

19+
import java.util.HashMap;
1920
import java.util.List;
2021
import java.util.Map;
2122
import org.folio.marc4ld.Marc2LdTestBase;
@@ -29,7 +30,7 @@ class MarcToLdAuthorityConceptPlace151IT extends Marc2LdTestBase {
2930
private static final String EXPECTED_FOCUS_LABEL = "aValue";
3031

3132
@Test
32-
void shouldMap151FieldCorrectly() {
33+
void shouldMap151FieldToConceptPlaceResource_whenSubFocusFieldsArePresent() {
3334
// given
3435
var marc = loadResourceAsString("authority/151/marc_151_concept_place.jsonl");
3536

@@ -41,25 +42,29 @@ void shouldMap151FieldCorrectly() {
4142
.singleElement()
4243
.satisfies(resource -> assertThat(resource.getOutgoingEdges()).hasSize(10))
4344
.satisfies(
44-
resource -> validateResource(resource, List.of(CONCEPT, PLACE), generalProperties(), EXPECTED_MAIN_LABEL))
45+
resource -> validateResource(resource, List.of(CONCEPT, PLACE), conceptPlaceProperties(), EXPECTED_MAIN_LABEL))
4546
.satisfies(resource -> validateFocusResource(resource, PLACE, focusProperties(), EXPECTED_FOCUS_LABEL))
4647
.satisfies(AuthorityValidationHelper::validateSubFocusResources)
4748
.satisfies(resource -> validateIdentifier(resource, "010fieldvalue"));
4849
}
4950

5051
@Test
51-
void shouldNotMap151FieldWhenSubFocusFieldsAreEmpty() {
52+
void shouldMap151FieldToPlaceResource_whenSubFocusFieldsAreEmpty() {
5253
// given
5354
var marc = loadResourceAsString("authority/151/marc_151_place_empty_subfocus.jsonl");
5455

5556
// when
5657
var resources = marcAuthorityToResources(marc);
5758

5859
//then
59-
assertThat(resources).isEmpty();
60+
assertThat(resources)
61+
.singleElement()
62+
.satisfies(resource -> assertThat(resource.getOutgoingEdges()).hasSize(1))
63+
.satisfies(resource -> validateResource(resource, List.of(PLACE), placeProperties(), EXPECTED_FOCUS_LABEL))
64+
.satisfies(resource -> validateIdentifier(resource, "010fieldvalue"));
6065
}
6166

62-
private Map<String, List<String>> generalProperties() {
67+
private Map<String, List<String>> conceptPlaceProperties() {
6368
return Map.of(
6469
NAME.getValue(), List.of("aValue"),
6570
MISC_INFO.getValue(), List.of("gValue"),
@@ -80,4 +85,10 @@ private Map<String, List<String>> focusProperties() {
8085
);
8186
}
8287

88+
private Map<String, List<String>> placeProperties() {
89+
var placeProperties = new HashMap<>(focusProperties());
90+
placeProperties.put("http://library.link/vocab/resourcePreferred", List.of("true"));
91+
return placeProperties;
92+
}
93+
8394
}

0 commit comments

Comments
 (0)