|
| 1 | +package edu.virginia.ged5to7.pipeline; |
| 2 | +import edu.virginia.ged5to7.GedStruct; |
| 3 | +import edu.virginia.ged5to7.GedcomDefinitions; |
| 4 | + |
| 5 | +public class ExidFilter implements Filter { |
| 6 | + public java.util.Collection<GedStruct> update(GedStruct s) { |
| 7 | + boolean changed = true; |
| 8 | + switch(s.tag) { |
| 9 | + case "AFN": |
| 10 | + s.uri = "https://gedcom.io/terms/v7/EXID"; |
| 11 | + new GedStruct(s, "https://gedcom.io/terms/v7/TYPE", "https://www.familysearch.org/wiki/en/Ancestral_File"); |
| 12 | + break; |
| 13 | + case "RFN": |
| 14 | + s.uri = "https://gedcom.io/terms/v7/EXID"; |
| 15 | + int colon = s.payload.indexOf(':'); |
| 16 | + if (colon < 0) { |
| 17 | + new GedStruct(s, "https://gedcom.io/terms/v7/TYPE", "https://gedcom.io/terms/v7/RFN"); |
| 18 | + } else { |
| 19 | + new GedStruct(s, "https://gedcom.io/terms/v7/TYPE", "https://gedcom.io/terms/v7/RFN#"+s.payload.substring(0,colon)); |
| 20 | + s.payload = s.payload.substring(colon+1); |
| 21 | + } |
| 22 | + break; |
| 23 | + case "RIN": |
| 24 | + s.uri = "https://gedcom.io/terms/v7/REFN"; |
| 25 | + new GedStruct(s, "https://gedcom.io/terms/v7/TYPE", "RIN"); |
| 26 | + break; |
| 27 | + case "_FSFTID": case "_FID": case "FSFTID": |
| 28 | + s.uri = "https://gedcom.io/terms/v7/EXID"; |
| 29 | + new GedStruct(s, "https://gedcom.io/terms/v7/TYPE", "https://www.familysearch.org/tree/person/"); |
| 30 | + break; |
| 31 | + case "_APID": |
| 32 | + s.uri = "https://gedcom.io/terms/v7/EXID"; |
| 33 | + new GedStruct(s, "https://gedcom.io/terms/v7/TYPE", "https://www.ancestry.com/family-tree/"); |
| 34 | + break; |
| 35 | + // case "HISTID": // unclear what TYPE to give it |
| 36 | + default: changed = false; |
| 37 | + } |
| 38 | + if (changed) s.tag2uri(false); |
| 39 | + for(GedStruct s2 : s.sub) update(s2); |
| 40 | + return null; |
| 41 | + } |
| 42 | +} |
0 commit comments