コード例 #1
0
ファイル: Thesaurus.java プロジェクト: phspaelti/basex
 static {
   RSHIPS.put("NT", "BT");
   RSHIPS.put("BT", "BT");
   RSHIPS.put("BTG", "NTG");
   RSHIPS.put("NTG", "BTG");
   RSHIPS.put("BTP", "NTP");
   RSHIPS.put("NTP", "BTP");
   RSHIPS.put("USE", "UF");
   RSHIPS.put("UF", "USE");
   RSHIPS.put("RT", "RT");
 }
コード例 #2
0
ファイル: Thesaurus.java プロジェクト: phspaelti/basex
  /**
   * Builds the thesaurus.
   *
   * @param value input nodes
   * @throws QueryException query exception
   */
  private void build(final Value value) throws QueryException {
    final Value synonyms = nodes("*:synonym", value);
    if (synonyms.isEmpty()) return;

    final ThesNode term = node(text("*:term", value));
    for (final Item synonym : synonyms) {
      final ThesNode sterm = node(text("*:term", synonym));
      final byte[] rs = text("*:relationship", synonym);
      term.add(sterm, rs);

      final byte[] srs = RSHIPS.get(rs);
      if (srs != null) sterm.add(term, srs);
      build(synonyms);
    }
  }