In RDF it's quite common to use subclasses, and somewhat common to use union types (eg schema:rangeIncludes states a field can take values from several different classes; owl:unionOf does a similar thing).
RDF is based on formal logic, so it considers classes (types) as sets. In this interpretation, it's clear how to determine subtypes (especially useful for field covariance). Eg
interface A {}
interface B {}
interface C {}
type A1 implements A {}
type B1 implements B {}
type C1 implements C {}
union U1=A|B|C
union U2=A1|B1|C1 # subtype of U1 because it uses subclasses
union U3=A|B # subtype of U1 because it uses fewer union members
union U4=A|A1|B|C # equivalent to U1 because A subsumes A1
union U5=A1|B1 # subtype of U1, U2 and U3
But the spec says:
This means that U1, U3, U4 are not allowed, and neither of them can be used in an object type field.
This creates severe limitations on what polymorphic constructs (in particular RDF constructs) can be mapped to GraphQL.
(I searched here for "union but not 'input union'" and came up only with #518 as a possibly related issue. cc @derek-miller @mavilein)
In RDF it's quite common to use subclasses, and somewhat common to use union types (eg
schema:rangeIncludesstates a field can take values from several different classes;owl:unionOfdoes a similar thing).RDF is based on formal logic, so it considers classes (types) as sets. In this interpretation, it's clear how to determine subtypes (especially useful for field covariance). Eg
But the spec says:
This means that
U1, U3, U4are not allowed, and neither of them can be used in an object type field.This creates severe limitations on what polymorphic constructs (in particular RDF constructs) can be mapped to GraphQL.
(I searched here for "union but not 'input union'" and came up only with #518 as a possibly related issue. cc @derek-miller @mavilein)