private LiftingStepResults liftChildBinding ( ImmutableList < IQTree > initialChildren , Optional < ImmutableExpression > initialJoiningCondition , VariableGenerator variableGenerator ) throws EmptyIQException { ImmutableList < IQTree > liftedChildren = initialChildren . stream ( ) . map ( c -> c . liftBinding ( variableGenerator ) ) . filter ( c -> ! ( c . getRootNode ( ) instanceof TrueNode ) ) . collect ( ImmutableCollectors . toList ( ) ) ; if ( liftedChildren . stream ( ) . anyMatch ( IQTree :: isDeclaredAsEmpty ) ) throw new EmptyIQException ( ) ; OptionalInt optionalSelectedLiftedChildPosition = IntStream . range ( 0 , liftedChildren . size ( ) ) . filter ( i -> liftedChildren . get ( i ) . getRootNode ( ) instanceof ConstructionNode ) . findFirst ( ) ; /* * No substitution to lift -> converged */ if ( ! optionalSelectedLiftedChildPosition . isPresent ( ) ) return new InnerJoinNodeImpl . LiftingStepResults ( substitutionFactory . getSubstitution ( ) , liftedChildren , initialJoiningCondition , true ) ; int selectedChildPosition = optionalSelectedLiftedChildPosition . getAsInt ( ) ; UnaryIQTree selectedLiftedChild = ( UnaryIQTree ) liftedChildren . get ( selectedChildPosition ) ; ConstructionNode selectedChildConstructionNode = ( ConstructionNode ) selectedLiftedChild . getRootNode ( ) ; IQTree selectedGrandChild = selectedLiftedChild . getChild ( ) ; try { return liftRegularChildBinding ( selectedChildConstructionNode , selectedChildPosition , selectedGrandChild , liftedChildren , ImmutableSet . of ( ) , initialJoiningCondition , variableGenerator , this :: convertIntoLiftingStepResults ) ; } catch ( UnsatisfiableConditionException e ) { throw new EmptyIQException ( ) ; } }
Lifts the binding OF AT MOST ONE child