protected void optimize(final AST2BOpContext ctx,final StaticAnalysis sa,final GraphPatternGroup<? extends IGroupMemberNode> group,final PropertyPathInfo ppInfo,final PathNegatedPropertySet pathNPS,final ArbitraryLengthPathNode alpNode,final PropertyPathNode ppNode){
  ArrayList<ConstantNode> forward=null;
  ArrayList<ConstantNode> back=null;
  for (  BOp child : pathNPS.args()) {
    final PathOneInPropertySet pathOIPS=(PathOneInPropertySet)child;
    final ConstantNode iri=(ConstantNode)pathOIPS.get(0);
    if (pathOIPS.inverse()) {
      if (back == null)       back=new ArrayList<ConstantNode>();
      back.add(iri);
    }
 else {
      if (forward == null)       forward=new ArrayList<ConstantNode>();
      forward.add(iri);
    }
  }
  if (forward != null && back != null) {
    final UnionNode union=new PropertyPathUnionNode();
    final JoinGroupNode forwardGroup=new JoinGroupNode();
    final JoinGroupNode backGroup=new JoinGroupNode();
    union.addArg(forwardGroup);
    union.addArg(backGroup);
    group.addArg(getPositionOfNodeInGroup(ppNode,group),union);
    addNegateds(forwardGroup,forward,ppInfo,alpNode,ppNode);
    addNegateds(backGroup,back,ppInfo.inverse(),alpNode,ppNode);
  }
 else   if (forward != null) {
    addNegateds(group,forward,ppInfo,alpNode,ppNode);
  }
 else {
    addNegateds(group,back,ppInfo.inverse(),alpNode,ppNode);
  }
}

protected void optimize ( final AST2BOpContext ctx , final StaticAnalysis sa , final GraphPatternGroup < ? extends IGroupMemberNode > group , final PropertyPathInfo ppInfo , final PathNegatedPropertySet pathNPS , final ArbitraryLengthPathNode alpNode , final PropertyPathNode ppNode ) { ArrayList < ConstantNode > forward = null ; ArrayList < ConstantNode > back = null ; for ( BOp child : pathNPS . args ( ) ) { final PathOneInPropertySet pathOIPS = ( PathOneInPropertySet ) child ; final ConstantNode iri = ( ConstantNode ) pathOIPS . get ( 0 ) ; if ( pathOIPS . inverse ( ) ) { if ( back == null ) back = new ArrayList < ConstantNode > ( ) ; back . add ( iri ) ; } else { if ( forward == null ) forward = new ArrayList < ConstantNode > ( ) ; forward . add ( iri ) ; } } if ( forward != null && back != null ) { final UnionNode union = new PropertyPathUnionNode ( ) ; final JoinGroupNode forwardGroup = new JoinGroupNode ( ) ; final JoinGroupNode backGroup = new JoinGroupNode ( ) ; union . addArg ( forwardGroup ) ; union . addArg ( backGroup ) ; group . addArg ( getPositionOfNodeInGroup ( ppNode , group ) , union ) ; addNegateds ( forwardGroup , forward , ppInfo , alpNode , ppNode ) ; addNegateds ( backGroup , back , ppInfo . inverse ( ) , alpNode , ppNode ) ; } else if ( forward != null ) { addNegateds ( group , forward , ppInfo , alpNode , ppNode ) ; } else { addNegateds ( group , back , ppInfo . inverse ( ) , alpNode , ppNode ) ; } }
optimize a pathnegatedpropertyset . this is done with a statement pattern and filter . for example , the path : ? s ! ( x | y | z ) ? o . can be re - written into the simpler form : ? s ? p ? o . filter ( ? p not in ( x , y , z ) ) . the more complicated case ( where there are inverses involved ) can be run as a union of two of the above .
