Project

General

Profile

« Previous | Next » 

Revision 9dc896c9

Added by Andreas Müller almost 7 years ago

fix #6368 rename table and class TaxonNameBase

View differences:

cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/tcsrdf/TcsRdfTaxonNameRelationsImport.java
1 1
/**
2 2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy 
3
* European Distributed Institute of Taxonomy
4 4
* http://www.e-taxonomy.eu
5
* 
5
*
6 6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7 7
* See LICENSE.TXT at the top of this package for the full license terms.
8 8
*/
......
21 21
import eu.etaxonomy.cdm.api.service.INameService;
22 22
import eu.etaxonomy.cdm.io.common.ICdmIO;
23 23
import eu.etaxonomy.cdm.io.common.MapWrapper;
24
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
24
import eu.etaxonomy.cdm.model.name.TaxonName;
25 25
import eu.etaxonomy.cdm.model.reference.Reference;
26 26

  
27 27
/**
......
34 34
	private static final Logger logger = Logger.getLogger(TcsRdfTaxonNameRelationsImport.class);
35 35

  
36 36
	private static int modCount = 5000;
37
	
37

  
38 38
	public TcsRdfTaxonNameRelationsImport(){
39 39
		super();
40 40
	}
41
	
41

  
42 42
	@Override
43 43
	public boolean doCheck(TcsRdfImportState state){
44 44
		boolean result = true;
45 45
		logger.warn("Checking for TaxonNameRelations not yet implemented");
46 46
		//result &= checkArticlesWithoutJournal(tcsConfig);
47 47
		//result &= checkPartOfJournal(tcsConfig);
48
		
48

  
49 49
		return result;
50 50
	}
51
	
51

  
52 52
	@Override
53 53
	public void doInvoke(TcsRdfImportState state){
54
		
55
		MapWrapper<TaxonNameBase> taxonNameMap = (MapWrapper<TaxonNameBase>)state.getStore(ICdmIO.TAXONNAME_STORE);
54

  
55
		MapWrapper<TaxonName> taxonNameMap = (MapWrapper<TaxonName>)state.getStore(ICdmIO.TAXONNAME_STORE);
56 56
		MapWrapper<Reference> referenceMap = (MapWrapper<Reference>)state.getStore(ICdmIO.REFERENCE_STORE);
57
		
57

  
58 58
		String tcsElementName;
59 59
		Namespace tcsNamespace;
60 60
		String cdmAttrName;
61 61
		String value;
62 62

  
63
		Set<TaxonNameBase> nameStore = new HashSet<TaxonNameBase>();
63
		Set<TaxonName> nameStore = new HashSet<TaxonName>();
64 64
		TcsRdfImportConfigurator config = state.getConfig();
65 65
		//Model source = config.getSourceRoot();
66
		
66

  
67 67
		logger.info("start makeNameRelationships ...");
68 68
		INameService nameService = getNameService();
69 69

  
70 70
//		<tn:hasBasionym rdf:resource="palm_tn_14530"/>
71
		
71

  
72 72
		Model root = config.getSourceRoot();
73
		
73

  
74 74
		String rdfNamespace = config.getRdfNamespaceURIString();
75 75
		String taxonNameNamespace = config.getTnNamespaceURIString();
76 76
		/*
77 77
		List<Element> elTaxonNames = root.getChildren("TaxonName", taxonNameNamespace);
78
		
78

  
79 79
		int i = 0;
80 80
		int nameRelCount = 0;
81 81
		//for each taxonName
82 82
		for (Element elTaxonName : elTaxonNames){
83
			
84
			TaxonNameBase fromName = null;
83

  
84
			TaxonName fromName = null;
85 85
			if ((++i % modCount) == 0){ logger.info("Names handled: " + (i-1));}
86
			
86

  
87 87
			//Basionyms
88 88
			tcsElementName = "hasBasionym";
89 89
			tcsNamespace = taxonNameNamespace;
90 90
			List<Element> elBasionymList = elTaxonName.getChildren(tcsElementName, tcsNamespace);
91
			
91

  
92 92
			for (Element elBasionym: elBasionymList){
93 93
				nameRelCount++;
94 94
				logger.debug("BASIONYM "+  nameRelCount);
......
100 100
					continue;
101 101
				}
102 102
				String basionymId = attrResource.getValue();
103
				TaxonNameBase basionym = taxonNameMap.get(basionymId);
103
				TaxonName basionym = taxonNameMap.get(basionymId);
104 104
				if (basionym == null){
105 105
					logger.warn("Basionym name ("+basionymId+") not found in Map! Basionym not set!");
106 106
					continue;
......
123 123

  
124 124
			}
125 125
		}// end Basionyms
126
		
126

  
127 127
		//Other Relations
128 128
		//TODO
129
		
129

  
130 130
		logger.info(nameRelCount + " nameRelations handled");
131 131
		nameService.save(nameStore);
132 132
		logger.info("end makeNameRelationships ...");
133 133
		*/
134 134
		return;
135 135
	}
136
	
136

  
137 137
	/* (non-Javadoc)
138 138
	 * @see eu.etaxonomy.cdm.io.common.CdmIoBase#isIgnore(eu.etaxonomy.cdm.io.common.IImportConfigurator)
139 139
	 */
140
	protected boolean isIgnore(TcsRdfImportState state){
140
	@Override
141
    protected boolean isIgnore(TcsRdfImportState state){
141 142
		return ! state.getConfig().isDoRelNames();
142 143
	}
143 144

  

Also available in: Unified diff