Class ProvUtil


  • public class ProvUtil
    extends Object
    • Field Detail

      • OPF

        public static String OPF
    • Constructor Detail

      • ProvUtil

        public ProvUtil()
    • Method Detail

      • defaultPrefix

        public static Map<String,​Object> defaultPrefix()
        Create a default namespace which includes the prefix and path for Ocean protocol schema
        Returns:
        a Map with prefixes respective IRIs used in this document
      • createThisInput

        public static Map<String,​Object> createThisInput()
        Returns a Entity referring to "this", the asset being registered
        Returns:
        Map
      • createAssetDependency

        public static Map<String,​Object> createAssetDependency​(Asset ast)
        Returns a Entity referring to asset in the argument
        Parameters:
        ast - dependent asset
        Returns:
        Map
      • createAgent

        public static Map<String,​Object> createAgent​(String agentId,
                                                           ProvUtil.AgentIdType agentType)
        Returns a Map representing an entity, given the id and type
        Parameters:
        agentId - the agent Id
        agentType - the type of account (e.g. ethereum account)
        Returns:
        Map
      • createAgents

        public static Map<String,​Object> createAgents​(Map<String,​Object>... age)
        Returns a Map representing a list of agents
        Parameters:
        age - age
        Returns:
        Map
      • associatedWith

        public static Map<String,​Object> associatedWith​(String agentId,
                                                              String activityId)
        Returns a Map representing an associatedWith Relationship, which connects the agentID with the activityId
        Parameters:
        agentId - the agent Id
        activityId - the activity Id
        Returns:
        Map
      • generatedBy

        public static Map<String,​Object> generatedBy​(String activityId)
        Returns a Map representing an generatedBy Relationship, which connects the entityid with the activityId
        Parameters:
        activityId - the activity Id
        Returns:
        Map
      • derivedFrom

        public static Map<String,​Object> derivedFrom​(Collection<Asset> entities)
        Returns a Map representing an derived by Relationship, which connects the dependent entities
        Parameters:
        entities - list of entities that the generated entity is derived from
        Returns:
        Map
      • createActivity

        public static Map<String,​Object> createActivity​(String actId,
                                                              ProvUtil.ActivityType activityType)
        Returns an Activity identified by activity id and type
        Parameters:
        actId - the activity Id
        activityType - The type of activity (e.g. publish or operation)
        Returns:
        Map
      • createActivity

        public static Map<String,​Object> createActivity​(String actId,
                                                              ProvUtil.ActivityType activityType,
                                                              Map<String,​Object> actEntries)
        Returns an Activity identified by activity id and type
        Parameters:
        actId - the activity Id
        activityType - The type of activity (e.g. publish or operation)
        actEntries - an array of activities
        Returns:
        Map
      • createActivities

        public static Map<String,​Object> createActivities​(Map<String,​Object>... acts)
        Returns a list of Activities
        Parameters:
        acts - array of activities
        Returns:
        Map
      • createPublishProvenance

        public static Map<String,​Object> createPublishProvenance​(String agentId)
        Create default provenance metadata for publishing an asset. This create a random activity ID for tracking the provenance
        Parameters:
        agentId - the agent identifier
        Returns:
        Map
      • createPublishProvenance

        public static Map<String,​Object> createPublishProvenance​(String actId,
                                                                       String agentId)
        Create default provenance metadata for publishing an asset
        Parameters:
        actId - the activity Id
        agentId - the agent identifier
        Returns:
        the prov metadata encoded in a Map
      • createDependencies

        public static Map<String,​Object> createDependencies​(String params,
                                                                  String resultParamName)
        Create dependencies. There are 2 sets of dependencies: one that are assets, and the second which is JSON payloads.
        Parameters:
        params - the param string sent to the invoke rest API
        resultParamName - the param name of the generated asset
        Returns:
        the input and output encoded as a Map
      • createInvokeProvenance

        public static Map<String,​Object> createInvokeProvenance​(String actId,
                                                                      String agentId,
                                                                      Collection<Asset> assetDependencies,
                                                                      String params,
                                                                      String resultParamName)
        Create default provenance metadata for publishing an asset created using invoke.
        Parameters:
        actId - the activity Id
        agentId - the agent identifier
        assetDependencies - the list of assets that consumed by the operation
        params - the argument string passed to the operation
        resultParamName - the name of the result argument for the generated asset
        Returns:
        Map