public static Query createQueueQueryByClassId(Long classId) {

    QInstanceSpecification query = QInstanceSpecification.newQuery();
    createQueueSelect(query);
    query.where(query.clazz().seqId().eq(classId));
    return query;
  }
  public static Query createQueueQueryByInstanceId(String classifierName, Long id) {

    QInstanceSpecification query = QInstanceSpecification.newQuery();
    createQueueSelect(query);
    query.where(query.seqId().eq(id).and(query.clazz().classifier().name().eq(classifierName)));
    return query;
  }
  public static Query createEditQueryById(Long id) {

    QInstanceSpecification query = QInstanceSpecification.newQuery();
    query
        .select(query.wildcard())
        .select(query.clazz().wildcard())
        .select(query.clazz().classifier().wildcard())
        .select(query.instanceCategorization().wildcard())
        .select(query.instanceCategorization().categorization().wildcard())
        .select(query.instanceCategorization().categorization().category().wildcard())
        .select(query.slot().wildcard())
        .select(query.slot().definingFeature().wildcard())
        .select(query.slot().value().wildcard())
        .select(query.slot().value().instanceValue().wildcard())
        .select(
            query.slot().value().instanceValue().instance().seqId()) // links to another instance
        .select(query.slot().value().literalString().wildcard())
        .select(query.slot().value().literalClob().wildcard())
        .select(query.slot().value().literalShort().wildcard())
        .select(query.slot().value().literalInteger().wildcard())
        .select(query.slot().value().literalLong().wildcard())
        .select(query.slot().value().literalFloat().wildcard())
        .select(query.slot().value().literalDouble().wildcard())
        .select(query.slot().value().literalDate().wildcard())
        .select(query.slot().value().literalBoolean().wildcard());
    query.where(query.seqId().eq(id));
    return query;
  }
  public static Query createQueueQueryByClassifierName(String name) {

    QInstanceSpecification query = QInstanceSpecification.newQuery();
    createQueueSelect(query);
    query.where(query.clazz().classifier().name().eq(name));
    return query;
  }
  public static Query createDeleteQueryById(Long id) {

    QInstanceSpecification query = QInstanceSpecification.newQuery();
    query
        .select(query.seqId())
        .select(query.instanceCategorization().seqId())
        .select(query.instanceCategorization().categorization().seqId())
        // delete slots that point to us
        .select(query.instanceValue().seqId())
        .select(query.instanceValue().valueSpecification().seqId())
        .select(query.instanceValue().valueSpecification().slot().seqId())
        // delete our slots
        .select(query.slot().seqId())
        .select(query.slot().value().seqId())
        .select(query.slot().value().instanceValue().seqId())
        .select(query.slot().value().literalString().seqId())
        .select(query.slot().value().literalClob().seqId())
        .select(query.slot().value().literalShort().seqId())
        .select(query.slot().value().literalInteger().seqId())
        .select(query.slot().value().literalLong().seqId())
        .select(query.slot().value().literalFloat().seqId())
        .select(query.slot().value().literalDouble().seqId())
        .select(query.slot().value().literalDate().seqId())
        .select(query.slot().value().literalBoolean().seqId());
    query.where(query.seqId().eq(id));
    return query;
  }
  public static Query createExportQuery() {

    QInstanceSpecification query = QInstanceSpecification.newQuery();
    query
        .select(query.wildcard())
        .select(query.clazz().wildcard())
        .select(query.packageableType().wildcard())
        .select(query.packageableType()._package().wildcard())
        .select(query.instanceCategorization().wildcard())
        .select(query.instanceCategorization().categorization().wildcard())
        .select(query.instanceCategorization().categorization().category().wildcard());
    return query;
  }