code: public DynamicType<RelationTypeMetadata<RelationMetadata>> getRelationTypes(Set<EntityDiscriminator> sourceDiscriminators,
              RelationDiscriminator discriminator, Set<EntityDiscriminator> targetDiscriminators) {
          DynamicType<RelationTypeMetadata<RelationMetadata>> dynamicType = new DynamicType<>();
          Set<RelationMapping<EntityDiscriminator, RelationMetadata, RelationDiscriminator>> relations = relationMappings.get(discriminator);
          if (relations != null) {
              Set<RelationTypeMetadata<RelationMetadata>> relationTypes = new HashSet<>();
              for (RelationMapping<EntityDiscriminator, RelationMetadata, RelationDiscriminator> relation : relations) {
                  Set<EntityDiscriminator> source = relation.getSource();
                  Set<EntityDiscriminator> target = relation.getTarget();
                  if (sourceDiscriminators.containsAll(source) && targetDiscriminators.containsAll(target)) {
                      RelationTypeMetadata<RelationMetadata> relationType = relation.getRelationType();
                      relationTypes.add(relationType);
                  }
              }
              dynamicType = new DynamicType<>(relationTypes);
          }
          return dynamicType;
      }
docs: Determine the relation type for the given source discriminators, relation
  descriminator and target discriminators.
  
  @param sourceDiscriminators
  The source discriminators.
  @param discriminator
  The relation discriminator.
  @param targetDiscriminators
  The target discriminators.
  @return A set of matching relation types.