knpps.addBatch();
if (seenGlobalIds.contains(gid)) {
continue;
}
SkinnyUUID uuid = guu.get(gid);
if (uuid != null) {
// XXX offset
knups.setInt(1, gid + 1);
knups.setLong(2, uuid.getMostSignificantBits());
knups.setLong(3, uuid.getLeastSignificantBits());
knups.addBatch();
}
seenGlobalIds.add(gid);
}
}
// track equivalent kam node
seenKamNodes.add(eqId);
}
knpps.executeBatch();
PreparedStatement pps = getPreparedStatement(TERM_PARAMETER_SQL);
PreparedStatement tps = getPreparedStatement(TERM_SQL);
final Map<Integer, Integer> termNodes = pnt.getTermNodeIndex();
// load term parameters and terms
int tpindex = 0;
for (int ti = 0; ti < terms.size(); ti++) {
String t = terms.get(ti);
// find node equivalence
Integer nodeId = termNodes.get(ti);
// XXX offset
final Integer eqId = eqn.get(nodeId) + 1;
Integer ctl = valueIndexMap.get(t);
if (ctl == null) {
ctl = saveObject(1, t);
valueIndexMap.put(t, ctl);
}
// XXX offset
tps.setInt(1, ti + 1);
// XXX offset
tps.setInt(2, eqId);
tps.setInt(3, ctl);
tps.addBatch();
int ord = 0;
List<Integer> pl = tpmtidx.get(ti);
if (hasItems(pl)) {
for (Integer pi : pl) {
TableParameter p = pt.getIndexTableParameter().get(pi);
Integer cpv = valueIndexMap.get(p.getValue());
if (cpv == null) {
cpv = saveObject(1, p.getValue());
valueIndexMap.put(p.getValue(), cpv);
}
final Integer gid = gpi.get(pi);
// XXX offset
pps.setInt(1, tpindex + 1);
// XXX offset
pps.setInt(2, gid + 1);
// XXX offset
pps.setInt(3, ti + 1);
// find index for the parameter's namespace
TableNamespace tn = p.getNamespace();
Integer ni = null;
if (tn != null) {
ni = nt.getNamespaceIndex().get(tn);
}
if (ni == null) {
pps.setNull(4, Types.INTEGER);
} else {
// XXX offset
pps.setInt(4, ni + 1);
}
pps.setInt(5, cpv);
pps.setInt(6, ord);
pps.addBatch();
ord++;
tpindex++;
if (seenGlobalIds.contains(gid)) {
continue;
}
SkinnyUUID uuid = guu.get(gid);
if (uuid != null) {
// XXX offset
knups.setInt(1, gid + 1);
knups.setLong(2, uuid.getMostSignificantBits());
knups.setLong(3, uuid.getLeastSignificantBits());
knups.addBatch();
}
seenGlobalIds.add(gid);
}
}