private void processLocalTransformations(LocalTransformations localTransformations){ if(localTransformations.hasDerivedFields()){ List<DerivedField> derivedFields = localTransformations.getDerivedFields(); Set<DerivedField> activeDerivedFields = getActiveDerivedFields(new HashSet<>(derivedFields)); derivedFields.retainAll(activeDerivedFields); } }
private void processLocalTransformations(LocalTransformations localTransformations){ if(localTransformations.hasDerivedFields()){ List<DerivedField> derivedFields = localTransformations.getDerivedFields(); Set<DerivedField> activeDerivedFields = getActiveDerivedFields(new HashSet<>(derivedFields)); derivedFields.retainAll(activeDerivedFields); } }
@Override public VisitorAction visit(LocalTransformations localTransformations){ if(localTransformations.hasDerivedFields()){ this.localDerivedFields.addAll(localTransformations.getDerivedFields()); } return super.visit(localTransformations); }
@Override public VisitorAction visit(LocalTransformations localTransformations){ if(localTransformations.hasDerivedFields()){ this.localDerivedFields.addAll(localTransformations.getDerivedFields()); } return super.visit(localTransformations); }
@Override public VisitorAction visit(LocalTransformations localTransformations){ if(localTransformations.hasDerivedFields()){ suppress(localTransformations.getDerivedFields()); } return super.visit(localTransformations); }
@Override public VisitorAction visit(LocalTransformations localTransformations){ if(localTransformations.hasDerivedFields()){ suppress(localTransformations.getDerivedFields()); } return super.visit(localTransformations); }
@Override public VisitorAction visit(Model model){ LocalTransformations localTransformations = model.getLocalTransformations(); if(localTransformations != null && localTransformations.hasDerivedFields()){ declare(model, localTransformations.getDerivedFields()); } return super.visit(model); }
@Override public VisitorAction visit(Model model){ LocalTransformations localTransformations = model.getLocalTransformations(); if(localTransformations != null && localTransformations.hasDerivedFields()){ declare(model, localTransformations.getDerivedFields()); } return super.visit(model); }
private void expandDerivedFields(Model model, Set<Field<?>> fields){ FieldDependencyResolver fieldDependencyResolver = getFieldDependencyResolver(); fieldDependencyResolver.expand(fields, fieldDependencyResolver.getGlobalDerivedFields()); LocalTransformations localTransformations = model.getLocalTransformations(); if(localTransformations != null && localTransformations.hasDerivedFields()){ fieldDependencyResolver.expand(fields, new HashSet<>(localTransformations.getDerivedFields())); } }
private void expandDerivedFields(Model model, Set<Field<?>> fields){ FieldDependencyResolver fieldDependencyResolver = getFieldDependencyResolver(); fieldDependencyResolver.expand(fields, fieldDependencyResolver.getGlobalDerivedFields()); LocalTransformations localTransformations = model.getLocalTransformations(); if(localTransformations != null && localTransformations.hasDerivedFields()){ fieldDependencyResolver.expand(fields, new HashSet<>(localTransformations.getDerivedFields())); } }
@Override public VisitorAction accept(Visitor visitor) { VisitorAction status = visitor.visit(this); if (status == VisitorAction.CONTINUE) { visitor.pushParent(this); if ((status == VisitorAction.CONTINUE)&&hasExtensions()) { status = org.dmg.pmml.PMMLObject.traverse(visitor, getExtensions()); } if ((status == VisitorAction.CONTINUE)&&hasDerivedFields()) { status = org.dmg.pmml.PMMLObject.traverse(visitor, getDerivedFields()); } visitor.popParent(); } if (status == VisitorAction.TERMINATE) { return VisitorAction.TERMINATE; } return VisitorAction.CONTINUE; }
@Override public VisitorAction accept(Visitor visitor) { VisitorAction status = visitor.visit(this); if (status == VisitorAction.CONTINUE) { visitor.pushParent(this); if ((status == VisitorAction.CONTINUE)&&hasExtensions()) { status = org.dmg.pmml.PMMLObject.traverse(visitor, getExtensions()); } if ((status == VisitorAction.CONTINUE)&&hasDerivedFields()) { status = org.dmg.pmml.PMMLObject.traverse(visitor, getDerivedFields()); } visitor.popParent(); } if (status == VisitorAction.TERMINATE) { return VisitorAction.TERMINATE; } return VisitorAction.CONTINUE; }
@Override public PMMLObject popParent(){ PMMLObject parent = super.popParent(); if(parent instanceof Model){ Model model = (Model)parent; LocalTransformations localTransformations = model.getLocalTransformations(); if(localTransformations != null){ processLocalTransformations(localTransformations); if(!localTransformations.hasDerivedFields()){ model.setLocalTransformations(null); } } } else if(parent instanceof PMML){ PMML pmml = (PMML)parent; TransformationDictionary transformationDictionary = pmml.getTransformationDictionary(); if(transformationDictionary != null){ processTransformationDictionary(transformationDictionary); if(!transformationDictionary.hasDefineFunctions() && !transformationDictionary.hasDerivedFields()){ pmml.setTransformationDictionary(null); } } } return parent; }
@Override public PMMLObject popParent(){ PMMLObject parent = super.popParent(); if(parent instanceof Model){ Model model = (Model)parent; LocalTransformations localTransformations = model.getLocalTransformations(); if(localTransformations != null){ processLocalTransformations(localTransformations); if(!localTransformations.hasDerivedFields()){ model.setLocalTransformations(null); } } } else if(parent instanceof PMML){ PMML pmml = (PMML)parent; TransformationDictionary transformationDictionary = pmml.getTransformationDictionary(); if(transformationDictionary != null){ processTransformationDictionary(transformationDictionary); if(!transformationDictionary.hasDefineFunctions() && !transformationDictionary.hasDerivedFields()){ pmml.setTransformationDictionary(null); } } } return parent; }
if(localTransformations != null && localTransformations.hasDerivedFields()){ this.localDerivedFields = CacheUtil.getValue(localTransformations, ModelEvaluator.localDerivedFieldCache);