Class MARCspecParser
- java.lang.Object
-
- de.gwdg.metadataqa.marc.utils.marcspec.MARCspecParser
-
public class MARCspecParser extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected static List<Pattern>allPatternsprotected static PatternCHARPOSRegex for charposprotected static PatternF_SUBSPECSRegex for field subspecsMap<String,Object>fieldThe parsed fieldspecprotected static PatternFIELDRegex for fieldprotected static PatternFIELDTAGRegex for field tagprotected static PatternINDEXRegex for indexprotected static PatternINDICATORSprotected static PatternLEFTSUBTERMRegex for leftSubTermprotected static PatternNAMED_POSITION_OR_RANGERegex for named position or rangeprotected static PatternNAMED_SUBFIELDTAGRANGERegex for subfield rangeprotected static PatternnamedGroupsPatternprotected static PatternOLD_INDICATORSRegex for indicatorsprotected static PatternOPERATORRegex for operatorMap<String,String>parsedThe parsed MARCspecprotected static Map<Pattern,List<String>>patternNamesprotected static PatternPOSITION_OR_RANGERegex for position or rangeprotected static PatternSF_SUBSPECSRegex for subfield subspecsprotected static PatternSUBFIELDRegex for subfieldList<Map<String,String>>subfieldsThe parsed subfieldspecsprotected static PatternSUBFIELDSRegex for subfieldsprotected static PatternSUBFIELDTAGRegex for subfield tagprotected static PatternSUBFIELDTAGRANGERegex for subfield rangeprotected static PatternSUBSPECRegex for subspecprotected static PatternSUBSPEC_DELIMITERprotected static PatternSUBSPECSRegex for subspecprotected static PatternSUBTERMSRegex for subterms
-
Constructor Summary
Constructors Constructor Description MARCspecParser()MARCspecParser(String spec)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,String>extractValues(Matcher matcher)voidfieldToArray(String fieldspec)parses fieldspecs into array.static List<String>getNamedGroupCandidates(String regex)static Map<Pattern,List<String>>getPatternNames()List<Map<String,String>>matchSubfields(String subfieldspec)Matches subfieldspecs.MARCspecparse(String spec)Map<String,String>subfieldToArray(String subfieldspec)calls matchSubfields but makes sure only one subfield is present.
-
-
-
Field Detail
-
namedGroupsPattern
protected static final Pattern namedGroupsPattern
-
FIELDTAG
protected static final Pattern FIELDTAG
Regex for field tag
-
POSITION_OR_RANGE
protected static final Pattern POSITION_OR_RANGE
Regex for position or range
-
NAMED_POSITION_OR_RANGE
protected static final Pattern NAMED_POSITION_OR_RANGE
Regex for named position or range
-
INDEX
protected static final Pattern INDEX
Regex for index
-
CHARPOS
protected static final Pattern CHARPOS
Regex for charpos
-
OLD_INDICATORS
protected static final Pattern OLD_INDICATORS
Regex for indicators
-
INDICATORS
protected static final Pattern INDICATORS
-
F_SUBSPECS
protected static Pattern F_SUBSPECS
Regex for field subspecs
-
SF_SUBSPECS
protected static Pattern SF_SUBSPECS
Regex for subfield subspecs
-
SUBSPECS
protected static final Pattern SUBSPECS
Regex for subspec
-
SUBFIELDS
protected static final Pattern SUBFIELDS
Regex for subfields
-
FIELD
protected static final Pattern FIELD
Regex for field
-
SUBFIELDTAGRANGE
protected static final Pattern SUBFIELDTAGRANGE
Regex for subfield range
-
NAMED_SUBFIELDTAGRANGE
protected static final Pattern NAMED_SUBFIELDTAGRANGE
Regex for subfield range
-
SUBFIELDTAG
protected static final Pattern SUBFIELDTAG
Regex for subfield tag
-
SUBFIELD
protected static final Pattern SUBFIELD
Regex for subfield
-
LEFTSUBTERM
protected static final Pattern LEFTSUBTERM
Regex for leftSubTerm
-
OPERATOR
protected static final Pattern OPERATOR
Regex for operator
-
SUBTERMS
protected static final Pattern SUBTERMS
Regex for subterms
-
SUBSPEC
protected static final Pattern SUBSPEC
Regex for subspec
-
SUBSPEC_DELIMITER
protected static final Pattern SUBSPEC_DELIMITER
-
-
Constructor Detail
-
MARCspecParser
public MARCspecParser()
-
MARCspecParser
public MARCspecParser(String spec)
-
-
Method Detail
-
fieldToArray
public void fieldToArray(String fieldspec)
parses fieldspecs into array.- Parameters:
fieldspec- The fieldspec
-
matchSubfields
public List<Map<String,String>> matchSubfields(String subfieldspec)
Matches subfieldspecs.- Parameters:
subfieldspec- A string of one or more subfieldspecs
-
subfieldToArray
public Map<String,String> subfieldToArray(String subfieldspec)
calls matchSubfields but makes sure only one subfield is present.- Parameters:
subfieldspec- A subfieldspec- Returns:
- array An Array of subfieldspec
-
-