<commit_before>package org.basex.query.func.fn;

import org.basex.query.*;
import org.basex.query.value.item.*;
import org.basex.query.value.node.*;
import org.basex.util.*;

/**
 * Function implementation.
 *
 * @author BaseX Team 2005-18, BSD License
 * @author <NAME>
 */
public final class FnGenerateId extends ContextFn {
  @Override
  public Item item(final QueryContext qc, final InputInfo ii) throws QueryException {
    final ANode node = toEmptyNode(ctxArg(0, qc), qc);
    if(node == null) return Str.ZERO;

    final TokenBuilder tb = new TokenBuilder(Token.ID);
    if(node instanceof DBNode) {
      final DBNode dbnode = (DBNode) node;
      tb.addInt(dbnode.data().dbid).add('-').addInt(dbnode.pre());
    } else {
      tb.addInt(node.id);
    }
    return Str.get(tb.finish());
  }
}<commit_msg>[MOD] XQuery, fn:generate-id, id format fixed<commit_after>package org.basex.query.func.fn;

import org.basex.query.*;
import org.basex.query.value.item.*;
import org.basex.query.value.node.*;
import org.basex.util.*;

/**
 * Function implementation.
 *
 * @author BaseX Team 2005-18, BSD License
 * @author <NAME>
 */
public final class FnGenerateId extends ContextFn {
  @Override
  public Item item(final QueryContext qc, final InputInfo ii) throws QueryException {
    final ANode node = toEmptyNode(ctxArg(0, qc), qc);
    if(node == null) return Str.ZERO;

    final TokenBuilder tb = new TokenBuilder(Token.ID);
    if(node instanceof DBNode) {
      final DBNode dbnode = (DBNode) node;
      tb.addInt(dbnode.data().dbid).add('d').addInt(dbnode.pre());
    } else {
      tb.addInt(node.id);
    }
    return Str.get(tb.finish());
  }
}
{'fraction_non_alphanumeric': 0.14414957780458384, 'fraction_numerical': 0.008443908323281062, 'mean_word_length': 3.5576923076923075, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3872383', 'n_tokens_mistral': 567, 'n_tokens_neox': 554, 'n_words': 135}