private LeftJoinNode liftSubstitution ( LeftJoinNode normalizedLeftJoin , ImmutableSubstitution < ImmutableTerm > remainingRightSubstitution , IntermediateQuery query ) { SubstitutionPropagationProposal < LeftJoinNode > proposal = new SubstitutionPropagationProposalImpl <> ( normalizedLeftJoin , remainingRightSubstitution ) ; try { NodeCentricOptimizationResults < LeftJoinNode > results = query . applyProposal ( proposal , true ) ; return results . getNewNodeOrReplacingChild ( ) // The LJ is expected to be the child of a construction node . flatMap ( query :: getFirstChild ) . filter ( n -> n instanceof LeftJoinNode ) . map ( n -> ( LeftJoinNode ) n ) . orElseThrow ( ( ) -> new MinorOntopInternalBugException ( "Was expected to insert a construction node " + "followed by a LJ" ) ) ; } catch ( EmptyQueryException e ) { throw new MinorOntopInternalBugException ( "This substitution propagation was not expected " + "to make the query be empty" ) ; } }
Lifts the substitution in the absence of a LJ condition