Exemplo n.º 1
0
  public void flush() {
    databaseMapping.lemmaMapping.insertObjects(
        connection, "lemmata", databaseMapping.lemmaMap.keySet());
    databaseMapping.wordformMapping.insertObjects(
        connection, "wordforms", databaseMapping.wordformMap.keySet());

    for (Object o : databaseMapping.awfMap.keySet()) {
      NEAnalyzedWordform awf = (NEAnalyzedWordform) o;
      awf.lemmaKey = awf.lemma.primaryKey;
      awf.wordformKey = awf.wordform.primaryKey;
    }

    databaseMapping.awfMapping.insertObjects(
        connection, "analyzed_wordforms", databaseMapping.awfMap.keySet());

    for (Object o : databaseMapping.containmentMap.keySet()) {
      NEContainment nec = (NEContainment) o;
      nec.parentKey = nec.parent.primaryKey;
      nec.childKey = nec.child.primaryKey;
    }

    if (databaseMapping.containmentMap.size() > 0)
      databaseMapping.containmentMapping.insertObjects(
          connection, "analyzed_wordform_groups", databaseMapping.containmentMap.keySet());

    for (Object o : databaseMapping.attestationMap.keySet()) {
      NEAttestation at = (NEAttestation) o;
      at.documentKey = at.document.primaryKey;
      at.analyzedWordformKey = at.awf.primaryKey;
    }
    databaseMapping.attestationMapping.insertObjectsInPortions(
        connection, "token_attestations", databaseMapping.attestationMap.keySet(), 10000);
  }
Exemplo n.º 2
0
 private NEAttestation createNEAttestation(
     NEDocument document, NEAnalyzedWordform awf, String id, String quotation) {
   NEAttestation at = new NEAttestation();
   at.awf = awf;
   at.document = document;
   at.tokenID = id;
   at.quotation = quotation;
   databaseMapping.attestationMap.put(at, at);
   return at;
 }