org.apache.sysds.runtime.privacy.propagation

## Class PrivacyPropagator

- java.lang.Object
- - org.apache.sysds.runtime.privacy.propagation.PrivacyPropagator

-     public class PrivacyPropagator
      extends Object

  Class with static methods merging privacy constraints of operands in expressions to generate the privacy constraints of the output.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `PrivacyPropagator()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static PrivacyConstraint.PrivacyLevel` | `corePropagation(PrivacyConstraint.PrivacyLevel[] inputLevels, OperatorType operatorType)` Returns the output privacy level based on the given input privacy levels and operator type.
    `static void` | `hopPropagation(Hop hop)` Propagate privacy constraints from input hops to given hop.
    `static PrivacyConstraint` | `mergeBinary(PrivacyConstraint privacyConstraint1, PrivacyConstraint privacyConstraint2)` Merges the input privacy constraints using the core propagation with NonAggregate operator type.
    `static PrivacyConstraint` | `parseAndReturnPrivacyConstraint(org.apache.wink.json4j.JSONObject mtd)` Parses the privacy constraint of the given metadata object or returns null if no privacy constraint is set in the metadata.
    `static Data` | `parseAndSetPrivacyConstraint(Data cd, org.apache.wink.json4j.JSONObject mtd)` Parses the privacy constraint of the given metadata object and sets the field of the given Data if the privacy constraint is not null.
    `static void` | `postProcessInstruction(Instruction inst, ExecutionContext ec)` Propagate privacy constraints to output variables based on privacy constraint of CPOperand output in instruction which has been set during privacy propagation preprocessing.
    `static Instruction` | `preprocessInstruction(Instruction inst, ExecutionContext ec)` Propagate privacy constraints from input to output CPOperands in case the privacy constraints of the input are activated.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### PrivacyPropagator

          public PrivacyPropagator()

  - ### Method Detail

    - #### parseAndSetPrivacyConstraint

          public static Data parseAndSetPrivacyConstraint(Data cd,
                                                          org.apache.wink.json4j.JSONObject mtd)
                                                   throws org.apache.wink.json4j.JSONException

      Parses the privacy constraint of the given metadata object and sets the field of the given Data if the privacy constraint is not null.
      Parameters:
        `cd` - data for which privacy constraint is set
        `mtd` - metadata object
      Returns:
        data object with privacy constraint set
      Throws:
        `org.apache.wink.json4j.JSONException` - during parsing of metadata

    - #### parseAndReturnPrivacyConstraint

          public static PrivacyConstraint parseAndReturnPrivacyConstraint(org.apache.wink.json4j.JSONObject mtd)
                                                                   throws org.apache.wink.json4j.JSONException

      Parses the privacy constraint of the given metadata object or returns null if no privacy constraint is set in the metadata.
      Parameters:
        `mtd` - metadata
      Returns:
        privacy constraint parsed from metadata object
      Throws:
        `org.apache.wink.json4j.JSONException` - during parsing of metadata

    - #### corePropagation

          public static PrivacyConstraint.PrivacyLevel corePropagation(PrivacyConstraint.PrivacyLevel[] inputLevels,
                                                                       OperatorType operatorType)

      Returns the output privacy level based on the given input privacy levels and operator type. It represents the basic logic of privacy propagation: Unary input: Input | NonAggregate | Aggregate ----------------------------------- priv | priv | priv privAgg | privAgg | none none | none | none Binary input: Input | NonAggregate | Aggregate -------------------------------------------- priv-priv | priv | priv priv-privAgg | priv | priv priv-none | priv | priv privAgg-priv | priv | priv none-priv | priv | priv privAgg-privAgg | privAgg | none none-none | none | none privAgg-none | privAgg | none none-privAgg | privAgg | none
      Parameters:
        `inputLevels` - privacy levels of the input
        `operatorType` - type of the operator which is either an aggregation (Aggregate) or not an aggregation (NonAggregate)
      Returns:
        output privacy level

    - #### mergeBinary

          public static PrivacyConstraint mergeBinary(PrivacyConstraint privacyConstraint1,
                                                      PrivacyConstraint privacyConstraint2)

      Merges the input privacy constraints using the core propagation with NonAggregate operator type.
      Parameters:
        `privacyConstraint1` - first privacy constraint
        `privacyConstraint2` - second privacy constraint
      Returns:
        merged privacy constraint

    - #### hopPropagation

          public static void hopPropagation(Hop hop)

      Propagate privacy constraints from input hops to given hop.
      Parameters:
        `hop` - which the privacy constraints are propagated to

    - #### postProcessInstruction

          public static void postProcessInstruction(Instruction inst,
                                                    ExecutionContext ec)

      Propagate privacy constraints to output variables based on privacy constraint of CPOperand output in instruction which has been set during privacy propagation preprocessing.
      Parameters:
        `inst` - instruction for which privacy constraints are propagated
        `ec` - execution context

    - #### preprocessInstruction

          public static Instruction preprocessInstruction(Instruction inst,
                                                          ExecutionContext ec)

      Propagate privacy constraints from input to output CPOperands in case the privacy constraints of the input are activated.
      Parameters:
        `inst` - instruction for which the privacy constraints are propagated
        `ec` - execution context
      Returns:
        instruction with propagated privacy constraints (usually the same instance as the input inst)

Copyright © 2021 The Apache Software Foundation. All rights reserved.