-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
91 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
src/main/java/de/gwdg/metadataqa/marc/definition/tags/bltags/TagONS.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package de.gwdg.metadataqa.marc.definition.tags.bltags; | ||
|
||
import de.gwdg.metadataqa.marc.definition.Cardinality; | ||
import de.gwdg.metadataqa.marc.definition.DataFieldDefinition; | ||
import de.gwdg.metadataqa.marc.definition.Indicator; | ||
import de.gwdg.metadataqa.marc.definition.general.validator.RegexValidator; | ||
|
||
/** | ||
* ONIX Subjects | ||
*/ | ||
public class TagONS extends DataFieldDefinition { | ||
|
||
private static TagONS uniqueInstance; | ||
|
||
private TagONS() { | ||
initialize(); | ||
postCreation(); | ||
} | ||
|
||
public static TagONS getInstance() { | ||
if (uniqueInstance == null) | ||
uniqueInstance = new TagONS(); | ||
return uniqueInstance; | ||
} | ||
|
||
private void initialize() { | ||
|
||
tag = "ONS"; | ||
label = "ONIX Subjects"; | ||
mqTag = "OnixSubjects"; | ||
cardinality = Cardinality.Repeatable; | ||
// descriptionUrl = "https://www.loc.gov/marc/bibliographic/bd037.html"; | ||
// setCompilanceLevels("O"); | ||
|
||
ind1 = new Indicator(); | ||
|
||
ind2 = new Indicator("Provides information on the content of subfield $a") | ||
.setCodes( | ||
" ", "No information provided", | ||
"7", "Source specified in subfield $2" | ||
) | ||
.setMqTag("contentOfSubfield"); | ||
|
||
setSubfieldsWithCardinality( | ||
"a", "Subject code", "NR", | ||
"t", "Subject heading text", "NR", | ||
"x", "Remainder of BISAC subject code", "NR", | ||
"2", "Source of term", "NR" | ||
); | ||
|
||
getSubfield("a").setMqTag("code"); | ||
getSubfield("t").setMqTag("text"); | ||
getSubfield("x").setMqTag("bisac"); | ||
getSubfield("2") | ||
.setCodes( | ||
"bisacsh", "BISAC subject code", | ||
"bicssc", "BIC subject code or BIC geographical qualifier, or BIC language qualifier, or BIC time period qualifier", | ||
"Subject Keywords", "subject keywords" | ||
) | ||
.setMqTag("source"); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/test/java/de/gwdg/metadataqa/marc/definition/tags/bltags/TagONSTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package de.gwdg.metadataqa.marc.definition.tags.bltags; | ||
|
||
import de.gwdg.metadataqa.marc.DataField; | ||
import org.junit.Test; | ||
|
||
public class TagONSTest extends BLTagTest { | ||
|
||
public TagONSTest() { | ||
super(TagONS.getInstance()); | ||
} | ||
|
||
@Test | ||
public void testValidFields() { | ||
validField(new DataField(tag, " ", "7", "a", "STU", "x", "026000", "2", "bisacsh")); | ||
validField(new DataField(tag, " ", "7", "a", "YF", "2", "bicssc")); | ||
validField(new DataField(tag, " ", " ", | ||
"t", "Cold War; Espionage; USSR; Soviets; John le Carré; Len Deighton; Chernobyl; Nagasaki; Hiroshima; Nuclear Explosion; M.A.D.; Mutually Assured Destruction", | ||
"2", "Subject Keywords")); | ||
} | ||
|
||
@Test | ||
public void testInvalidFields() { | ||
invalidField("1", "a", "1"); | ||
invalidField("b", "1."); | ||
invalidField("b", "1"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters