• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package org.unicode.cldr.rdf;
2 
3 import java.util.LinkedList;
4 import java.util.List;
5 
6 import org.apache.jena.sparql.lang.sparql_11.ParseException;
7 
8 public class MapAll implements XPathMapper {
9 
10 	final List<XPathMapper> mappers = new LinkedList<>();
11 
MapAll()12 	public MapAll() {
13 		// add all mappers here
14 		mappers.add(new LanguageMapper());
15 		mappers.add(new ScriptMapper());
16 		mappers.add(new CurrencyMapper());
17 	}
18 
19 	@Override
addEntries(AbstractCache cache)20 	public int addEntries(AbstractCache cache) throws ParseException {
21 		int total = 0;
22 		System.out.println("Begin mapping");
23 		for(final XPathMapper m : mappers) {
24 			String mapName = m.getClass().getSimpleName();
25 			System.out.println(mapName + " - ");
26 			try {
27 				int thisAdded = m.addEntries(cache);
28 				System.out.println(mapName + " + " + thisAdded);
29 				total += thisAdded;
30 			} catch(Throwable t) {
31 				t.printStackTrace();
32 				System.err.println("Problem running mapper " + mapName + " - " + t);
33 			}
34 		}
35 		return total;
36 	}
37 }
38