code: static void validateOwnLookupAttributes(
        EntityType entityType, Map<String, Attribute> ownAllAttrMap) {
      // Validate lookup attributes
      entityType
          .getOwnLookupAttributes()
          .forEach(
              ownLookupAttr -> {
                // Validate that lookup attribute is in the attributes list
                Attribute ownAttr = ownAllAttrMap.get(ownLookupAttr.getIdentifier());
                if (ownAttr == null) {
                  throw new MolgenisValidationException(
                      new ConstraintViolation(
                          format(
                              "Lookup attribute [%s] is not one of the attributes of entity [%s]",
                              ownLookupAttr.getName(), entityType.getId())));
                }
  
                // Validate that the lookup attribute is visible
                if (!ownLookupAttr.isVisible()) {
                  throw new MolgenisValidationException(
                      new ConstraintViolation(
                          format(
                              "Lookup attribute [%s] of entity type [%s] must be visible",
                              ownLookupAttr.getName(), entityType.getId())));
                }
              });
    }
docs: Validate that the lookup attributes owned by this entity are part of the owned attributes.
  
  @param entityType entity meta data
  @param ownAllAttrMap attribute identifier to attribute map
  @throws MolgenisValidationException if one or more lookup attributes are not entity attributes