Skip Headers
Oracle® Healthcare Master Person Index Relationship Management REST APIs Reference Guide
Release 4.0

E71322-01
Go to Table of Contents
Contents
Go to Feedback page
Contact Us

Go to previous page
Previous
PDF · Mobi · ePub

A References

A.1 Request Structure

A.1.1 Entity Type Resource

Use this request structure in the API body when one of the request parameters is set as entityTypeResource.

The following are the parameters:

  • name (mandatory): Name of the entity type to be created, updated, or searched (depending on the API).

  • description: Description of the entity type.

  • id: Describes the details that are stored for the entity resource in this field. For example, EUID. This is required while creating a new entity type, otherwise optional.

  • status: Status of the entity type: Active or Inactive. This value is provided to activate or deactivate an entity type. While creating a new entity type, the value is not considered and always an Active entity type is created. For updating an entity type, use the PUT /metadata/entities/{name} API must be used. For information, see Section 2.5, "PUT /metadata/entities/{name}". Status can be passed as request parameter (recommended) or in the body of the API.

  • attributes: An array of attribute types for the entity type.

    Each attribute type contains the following fields:

    • name (mandatory): Name of the attribute type. It must be unique for the entity type.

    • description: Description of the attribute type.

    • type: Defines the data type of the attribute type to be created. Valid options are String, Char, Integer, Float, Double, Date, Timestamp, Boolean, and Object.

      This is a mandatory field while creating new attributetype, otherwise optional. The data type of an attribute cannot be modified once set.

  • sizeValue: Size of the String data type attribute type. For attributes of other datatype, the size is determined by the system and you cannot pass the value.

  • defaultValue: Default value of the attribute type to be used while creating entities, if the attribute is not mandatory. Value for the attribute is not passed while creating an entity.

  • minValue: Minimum value that the attribute type can take. This is used for Integer, Float, Double, Date, and Timestamp datatypes.

  • maxValue: Maximum value that the attribute type can take. This is used for Integer, Float, Double, Date, and Timestamp datatypes.

  • mandatory: Set Y if the attribute type must have a value when an entity is created, otherwise set N. If you do not set a value, system sets the default value as N.

  • readOnly: Set Y if the attribute type can be set only when an entity is created, otherwise set N. If you do not set a value, system sets the default value as N.

  • indexed: Set Y if the attribute type is used to do a search for the entities, otherwise set N. If you do not set a value, system sets the default value as Y.

  • status: Status of attribute type: Active or Inactive. This value is used to update the status of the attribute. While creating an attribute type, its status is always active. You can later set the status as Inactive to deactivate the attribute type. Alternately, use the PUT /metadata/entities/{name}/{attribute} API to activate or deactivate the attribute type. For information, see Section 2.6, "PUT /metadata/entities/{name}/{attribute}".

A.1.2 Relationship Type Resource

Use this request structure in the API body when one of the request parameters is set as relationshipTypeResource.

The following are the parameters:

  • name (mandatory): Name of the relationship type to be created, updated, or searched (depending on the API).

  • description: Description of the relationship type.

  • start: Details of the source entity type. This is required while creating a new relationship type.

    • name: Name is a mandatory field for the start parameter.

  • end: Details of the target entity type. This is required while creating new relationship type.

    • name: Name is a mandatory field for the end parameter.

  • status: Status of relationship type: Active or Inactive. This value is provided to activate or deactivate a relationship type. While creating a new relationship type, the value is not considered and always an Active relationship type is created. For updating a relationship type, the PUT /metadata/relationships/{name} API is used. For information, see Section 2.10, "PUT /metadata/relationships/{name}". Status can be passed as a request parameter (recommended) or in the body of the API.

  • direction: Determines the direction in which the relationship type is created between the source and target. Possible values are UNIDIRECTIONAL and BIDIRECTIONAL. If you do not provide any value, BIDIRECTIONAL is set.

  • multiplicity: Determines the multiplicity of the relationships for the relationship type. Possible values are ONETOONE, ONETOMANY, and MANYTOMANY. Currently, this is not used. If you do not provide any value, MANYTOMANY is set.

  • createdBy: Determines who created the relationship type. System will set this value to the user's id who is logged on to the REST API, only when relationship type is created. The value provided by you will be ignored. You cannot update the value later.

  • modifiedBy: Determines who last modified the relationship type. System will set this value to the user's id who is logged on to the REST API, whenever a relationship type is created or modified. The value provided by you will be ignored.

  • createdDate: Determines when the relationship type was created. System will set this value to current system date, only when a relationship type is created. The value provided by you will be ignored. You cannot update the value later.

  • modifiedDate: Determines when the relationship type was last modified. System will set this value to current system date, when a relationship type is created or modified. The value provided by you will be ignored.

  • effectiveDate: You can provide a value for this and this value needs to be passed in the date format relationship.management.date.format defined in the ohmpi_rm.properties file. If you do not provide a value, it will be set to current system date when the relationship type is created.

  • expirationDate: Determines when the relationship type expires, so that no new relationships of that type can be created. You can provide a value for this and this value needs to be passed in the date format relationship.management.date.format defined in the ohmpi_rm.properties file. If you do not provide a value, it will be set to current system date plus 10 years from when the relationship type is created.

  • task: Determines the task script to be invoked when a create relationship API is invoked. If not provided, default relationship update policy is used. For information on the relationship update policy, see Oracle Healthcare Master Person Index Relationship Management User's Guide.

    • name: Indicates the task name, which must match the name from the rm_task table.

  • attributes: An array of attribute types for the relationship type.

    Each attribute type contains the following fields:

    • name (mandatory): Name of the attribute type. It must be unique for the relationship type.

    • description: Description of the attribute type.

    • type: Defines the data type of the attribute type to be created. Valid options are String, Char, Integer, Float, Double, Date, Timestamp, Boolean, and Object.

      This is a mandatory field while creating new attribute type, otherwise optional. The data type of an attribute cannot be modified once set.

    • sizeValue: Size of the String data type attribute type. For attributes of other datatype, the size is determined by the system and you cannot pass the value.

    • defaultValue: Default value of the attribute type to be used while creating relationships, if the attribute is not mandatory and the value for the attribute is not passed while creating an relationship.

    • minValue: Minimum value that the attribute type can take. It is used for Integer, Float, Double, Date, and Timestamp datatypes.

    • maxValue: Maximum value that the attribute type can take. It is used for Integer, Float, Double, Date, and Timestamp datatypes.

    • mandatory: Set Y if the attribute type must have a value when a relationship is created, otherwise set N. If you do not set a value, the system sets the default value as N.

    • readOnly: Set Y if the attribute type can be set only when a relationship is created, otherwise set N. If you do not set a value, the system sets the default value as N.

    • indexed: Set Y if the attribute type is used to do a search for the relationships, otherwise set N. If you do not set a value, the system sets the default value as Y.

    • status: Status of attribute type: Active or Inactive. This value is used to update the status of the attribute. While creating an attribute type, its status is always active. You can later set the status as Inactive to deactivate the attribute type. Alternately, use the PUT /metadata/relationships/{name}/{attribute} API to activate or deactivate the attribute type. For information, see Section 2.11, "PUT /metadata/relationships/{name}/{attribute}".

A.1.3 Domain Resource

Use this request structure in the API body when one of the request parameters is set as domainResource.

The following are the parameters:

  • name (mandatory): Name of the domain to be registered or updated. To register a domain, the entity type of the same name must exist in the RM database.

  • url: URL of the MPI application for the domain. It must be in the following format:

    (t3|iiop)(s)?://[a-zA-Z0-9][a-zA-Z0-9-.]*:([0-9]{4})
    

    For example, t3://localhost:7001.

  • jndiname: JNDI name of the MPI Application. It must be in the following format:

    (ejb)/[a-zA-Z0-9]+
    

    For example, ejb/PatientMasterController.

  • userid: Username of the user to which the MasterIndex.Admin group is assigned.

  • usercode: Password of the user in the base64 encoded format.

A.1.4 RmRuleset Resource

Use this request structure in the API body when one of the request parameters is set as rmRuleSetResource.

The following are the parameters:

  • name (mandatory): Name of the ruleset to be registered or updated.

  • description: Description of the ruleset.

  • source: Source entity type for which the ruleset will apply.

  • target: Target entity type for which the ruleset will apply.

  • status: Status of the ruleset: Active or Inactive.

  • createdBy: Determines who created the ruleset. System sets this value to the user ID who is logged on to the REST API, only when ruleset is created. The value provided by you will be ignored.

  • modifiedBy: Determines who created the ruleset. System sets this value to the user ID who is logged on to the REST API, when ruleset is created or modified. The value provided by you will be ignored.

  • createdDate: Determines when the ruleset was created. System sets this value to the current system date, when a ruleset is created. The value provided by you will be ignored.

  • modifiedDate: Determines when the ruleset was created. System sets this value to the current system date, when a ruleset is created or modified. The value provided by you will be ignored.

A.1.5 RmTask Resource

Use this request structure in the API body when one of the request parameters is set as rmTaskResource.

The following are the parameters:

  • name (mandatory): Name of the task to be registered or updated.

  • description: Description of the task.

  • status: Status of the task: Active or Inactive.

A.1.6 Entity Resource

Use this request structure in the API body when one of the request parameters is set as entityResource.

The following are the parameters:

  • id (mandatory): ID of the entity. Entity type and id will be a unique combination in the entities table.

  • status: Status of entity: Active or Inactive. This value is provided to activate or deactivate an entity. While creating a new entity, the value is not considered and always an Active entity is created. For updating an entity, use the PUT /resources/entities/{id} API. For information, see Section 4.6, "PUT /resources/entities/{id}". Status can be passed as request parameter (recommended) or in the body of the API.

  • type: Details of the entity type.

    • name: Name of the entity type. It is mandatory while creating a new entity.

  • attributes: An array of attributes for the entity.

    Each attribute contains the following fields:

    • name (mandatory): Attribute name of the attribute type.

    • value: Value for the attribute. This is mandatory for attribute type with mandatory flag as Y or indexed flag as Y. The format for the value depends on the data_type field of the attribute type. The following are the formats that can be used for the corresponding data types:

      • String: Any string value with the maximum length as specified in the size_value field of the attribute type.

      • Char: Any character value (string value with length of 1).

      • Boolean: Possible values are true and false.

      • Integer: Any integer value between max_value and min_value.

      • Float: Any float value between max_value and min_value.

      • Double: Any double value between max_value and min_value.

      • Date: Any value in the format relationship.management.date.format defined in the ohmpi_rm.properties file.

      • Timestamp: Any value in the format relationship.management.timestamp.format defined in the ohmpi_rm.properties file.

      • Object: Currently, not supported.

A.1.7 Entity Resources

Use this request structure in the API body when one of the request parameters is set as entityResources. This is mainly a collection of multiple entityResource.

The following are the parameters:

A.1.8 Relationship Resource

Use this request structure in the API body when one of the request parameters is set as relationshipResource.

The following are the parameters:

  • source: Details of the source entity. For information, see Section A.1.6, "Entity Resource". ID and name of the entity type are mandatory parameters.

  • target: Details of the target entity. For information, see Section A.1.6, "Entity Resource". ID and name of the entity type are mandatory parameters.

  • status: Status of relationship: Active or Inactive. This value is provided to activate or deactivate a relationship. While creating a new relationship, the value is not considered and always an Active relationship is created. For updating a relationship, use the PUT /resources/relationships/{id} API. For information, see Section 5.1, "GET /resources/relationships/{id}". Status can be passed as request parameter (recommended) or in the body of the API.

  • validity: Determines the validity of the relationship. Possible values are Potential and Resolved. If you do not provide any value, system sets the values as Resolved.

  • createdBy: Determines who created the relationship. System sets this value to the user ID who is logged on to the REST API, when relationship is created. The value provided by you will be ignored. You cannot update the value later.

  • modifiedBy: Determines who last modified the relationship. System sets this value to the user ID who is logged on to the REST API, whenever a relationship is created or modified. The value provided by you will be ignored.

  • createdDate: Determines when the relationship was created. System sets this value to the current system date, only when a relationship is created. The value provided by you will be ignored. You cannot update the value later.

  • modifiedDate: Determines when the relationship was last modified. System sets this value to the current system date, when a relationship is created or modified. The value provided by you will be ignored.

  • effectiveDate: You can provide value for this and it must be passed in the date format relationship.management.date.format defined in the ohmpi_rm.properties file. If you do not provide a value, it is set to the current system date, when the relationship is created.

  • expirationDate: Determines when the relationship expires. You can provide value for this and it must be passed in the date format relationship.management.date.format defined in the ohmpi_rm.properties file. If you do not provide a value, it is set to the current system date plus 10 years, from when the relationship is created.

  • attributes: An array of attributes for the relationship.

    Each attribute contains the following fields:

    • name (mandatory): Attribute name of the attribute type.

    • value: Value for the attribute. This is mandatory for an attribute type with mandatory flag as Y or indexed flag as Y. The format for value depends on the data_type field of the attribute type. The following are the formats that can be used for corresponding data types:

      • String: Any string value with maximum length as specified in the size_value field of the attribute type.

      • Char: Any character value (string value with length of 1).

      • Boolean: Possible values are true and false.

      • Integer: Any integer value between max_value and min_value.

      • Float: Any float value between max_value and min_value.

      • Double: Any double value between max_value and min_value.

      • Date: Any value in the format relationship.management.date.format defined in the ohmpi_rm.properties file.

      • Timestamp: Any value in the format relationship.management.timestamp.format defined in the ohmpi_rm.properties file.

      • Object: Currently, not supported.

A.1.9 Integration Relationship Resource

Use this request structure in the API body when using integration APIs and one of the request parameters is set as relationshipResource.

The structure of the request remains the same as relationshipResource mentioned in Section A.1.8, "Relationship Resource", except that while creating a new relationship, you must also pass the following attributes in the attributes array:

  • LocalId: Local ID of the entity that is created.

  • SystemCode: System code in the MPI application to which the record belongs.

A.2 Response Structure

A.2.1 Entity Type Response Structure

The following structure is displayed in the response of an entity type REST API.

Note:

If the API has an expand option and the expand is not set to any value, only some of the attributes are displayed. If the expand is set to all, then all the values are displayed. APIs like POST or PUT might not have an expand option. For such APIs, to view the complete details of the entity type, use the GET /metadata/entities/{name} API with expand=all.

The following are the parameters:

  • entityTypeId: System generated ID assigned to the entity type. It is always displayed.

  • name: Name of the entity type. It is always displayed.

  • status: Status of the entity type. It is always displayed.

  • description: Description of the entity type. It is displayed when expand=all.

  • id: Describes the details that are stored for the entity resource in this field. It is displayed when expand=all.

  • links: For information, see Section A.3, "Links".

  • attributes: Array of the attribute types for the entity type. It is displayed when expand=all.

    Each attribute type in the array contains the following details:

    • attributeTypeId: System generated ID assigned to the attribute type.

    • name: Name of the attribute type.

    • description: Description of the attribute type.

    • type: Data type of the attribute type.

    • status: Status of the attribute type.

    • sizeValue: Maximum size of data that can be stored for the attribute type.

    • defaultValue: Default value of the attribute type.

    • minValue: Minimum value of the attribute type.

    • maxValue: Maximum value of the attribute type.

    • mandatory: Mandatory flag of the attribute type.

    • readOnly: Read-only flag of the attribute type.

    • indexed: Indexed flag of the attribute type.

    • links: For information, see Section A.3, "Links".

A.2.2 Relationship Type Response Structure

The following structure is displayed in the response of a relationship type REST API.

Note:

If the API has an expand option and the expand is not set to any value, only some of the attributes are displayed. If the expand is set to all, then all the values are displayed. APIs like POST or PUT might not have an expand option. For such APIs, to view the complete details of the relationship type, use the GET /metadata/relationships/{name} API with expand=all.

The following are the parameters:

  • relationshipTypeId: System generated ID assigned to the relationship type. It is always displayed.

  • name: Name of the relationship type. It is always displayed.

  • status: Status of the relationship type. It is always displayed.

  • description: Description of the relationship type. It is displayed when expand=all.

  • start: Details of the source entity type.

    • name: Name of the source entity type. It is always displayed.

    • status: Status of the source entity type. It is always displayed.

    • links: For information, see Section A.3, "Links". It is always displayed.

  • end: Details of the target entity type.

    • name: Name of the target entity type. It is always displayed.

    • status: Status of the target entity type. It is always displayed.

    • links: For information, see Section A.3, "Links". It is always displayed.

  • direction: Direction of the relationship type. It is displayed when expand=all.

  • multiplicity: Multiplicity of the relationship type. It is displayed when expand=all.

  • createdBy: Username of the user who created the relationship type. It is displayed when expand=all.

  • modifiedBy: Username of the user who last modified the relationship type. It is displayed when expand=all.

  • createdDate: Date when the relationship type was created. It is displayed when expand=all.

  • modifiedDate: Date when the relationship type was last modified. It is displayed when expand=all.

  • effectiveDate: Date from when the relationship type is effective. It is displayed when expand=all.

  • expirationDate: Date when the relationship type expires. It is displayed when expand=all.

  • task: ID of the task that is invoked when a new relationship of the relationship type is created. It is displayed when expand=all.

  • links: For information, see Section A.3, "Links".

  • attributes: Array of the attribute types for the relationship type. It is displayed when expand=all.

    Each attribute type in the array contains the following details:

    • attributeTypeId: System generated ID assigned to the attribute type.

    • name: Name of the attribute type.

    • description: Description of the attribute type.

    • type: Data type of the attribute type.

    • status: Status of the attribute type.

    • sizeValue: Maximum size of data that can be stored for the attribute type.

    • defaultValue: Default value of the attribute type.

    • minValue: Minimum value of the attribute type.

    • maxValue: Maximum value of the attribute type.

    • mandatory: Mandatory flag of the attribute type.

    • readOnly: Read-only flag of the attribute type.

    • indexed: Indexed flag of the attribute type.

    • links: For information, see Section A.3, "Links".

A.2.3 Domain Response Structure

The following structure is displayed in the response of a domain REST API.

Note:

If the API has an expand option and the expand is not set to any value, only some of the attributes are displayed. If the expand is set to all, then all the values are displayed. APIs like POST or PUT might not have an expand option. For such APIs, to view the complete details of the domain, use the GET /management/domains/{domain} API with expand=all.

The following are the parameters:

  • domainId: System generated ID assigned to the domain. It is always displayed.

  • name: Name of the domain. It is always displayed.

  • url: URL of the MPI application for the domain. It is always displayed.

  • jndiname: JNDI name of the MPI Application. It is always displayed.

  • userid: Username of the user in WebLogic. It is always displayed.

  • usercode: Password of the user. It is always displayed as *******.

  • objectXml: Contents of the object.xml file. It is displayed when expand=all or expand=objectxml.

  • fields: Fields in the object.xml file. Field name, field type, and field size are displayed. It is displayed when expand=all or expand=fields.

  • links: For information, see Section A.3, "Links".

A.2.4 Ruleset Response Structure

The following structure is displayed in the response of a ruleset REST API.

Note:

If the API has an expand option and the expand is not set to any value, only some of the attributes are displayed. If the expand is set to all, then all the values are displayed. APIs like POST or PUT might not have an expand option. For such APIs, to view the complete details of the ruleset, use the GET /management/rulesets/{ruleset} API with expand=all.

The following are the parameters:

  • rulesetId: System generated ID assigned to the ruleset. It is always displayed.

  • name: Name of the ruleset. It is always displayed.

  • description: Description of the ruleset. It is always displayed.

  • source: Source entity type for which the ruleset will apply. It is always displayed.

  • target: Target entity type for which the ruleset will apply. It is always displayed.

  • status: Status of the ruleset. It is always displayed.

  • createdBy: Username of the user who created the ruleset. It is always displayed.

  • modifiedBy: Username of the user who created the ruleset. It is always displayed.

  • createdDate: Date when the ruleset was created. It is always displayed.

  • modifiedDate: Date when the ruleset was modified. It is always displayed.

  • ruleXml: Contents of the xml file associated with the ruleset. It is displayed when expand=all or expand=rulexml.

  • links: For information, see Section A.3, "Links".

A.2.5 Task Response Structure

The following structure is displayed in the response of a task REST API.

Note:

If the API has an expand option and the expand is not set to any value, only some of the attributes are displayed. If the expand is set to all, then all the values are displayed. APIs like POST or PUT might not have an expand option. For such APIs, to view the complete details of the task, use the GET /management/tasks/{task} API with expand=all.

The following are the parameters:

  • name: Name of the task to be registered or updated.

  • description: Description of the task.

  • status: Status of the task: Active or Inactive.

  • script: Contents of the groovy script file associated with the task. It is displayed when expand=all or expand=script.

  • links: For information, see Section A.3, "Links".

A.2.6 Entity Response Structure

The following structure is displayed in the response of an entity REST API.

Note:

If the API has an expand option and the expand is not set to any value, only some of the attributes are displayed. If the expand is set to all, then all the values are displayed.

The following are the parameters:

  • entityId: System generated ID assigned to the entity. It is always displayed.

  • id: Unique iD provided by the user or received through MPI integration. It is always displayed.

  • status: Status of the entity. It is always displayed.

  • links: For information, see Section A.3, "Links".

  • type: Details of the entity type associated with the entity. For information displayed in entity type, see Section A.2.1, "Entity Type Response Structure".

  • attributes: Array of the attributes for the entity. It is displayed when expand=all.

    Each attribute in the array contains the following details:

    • entityAttributeId: System generated ID assigned to the attribute.

    • name: Name of the attribute.

    • value: Value assigned to the attribute.

    • entity: Details of the entity linked to this attribute.

      • entityId: System generated ID assigned to the entity.

      • links: For information, see Section A.3, "Links".

A.2.7 Relationship Response Structure

The following structure is displayed in the response of a relationship REST API.

Note:

If the API has an expand option and the expand is not set to any value, only some of the attributes are displayed. If the expand is set to all, then all the values are displayed. APIs like POST or PUT might not have an expand option. For such APIs, to view the complete details of the relationship, use the GET /resources/relationships/{id} API with expand=all.

The following are the parameters:

  • relationshipId: System generated ID assigned to the relationship. It is always displayed.

  • start: Details of the source entity. For information on the details of entity that is displayed, see Section A.2.6, "Entity Response Structure".

  • end: Details of the target entity type. For information on the details of entity that is displayed, see Section A.2.6, "Entity Response Structure".

  • type: Details of the relationship type associated with the relationship. For information on the details displayed in relationship type, see Section A.2.7, "Relationship Response Structure".

  • status: Status of the relationship. It is always displayed.

  • validity: Validity of the relationship. It is always displayed.

  • createdBy: Username of the user who created the relationship. It is displayed when expand=all.

  • modifiedBy: Username of the user who last modified the relationship. It is displayed when expand=all.

  • createdDate: Date when the relationship was created. It is displayed when expand=all.

  • modifiedDate: Date when the relationship was last modified. It is displayed when expand=all.

  • effectiveDate: Date from when the relationship is effective. It is displayed when expand=all.

  • expirationDate: Date when the relationship expires. It is displayed when expand=all.

  • links: For information, see Section A.3, "Links".

  • attributes: Array of the attribute types for the relationship type. It is displayed when expand=all.

  • attributes: Array of the attributes for the relationship. It is displayed when expand=all.

    Each attribute in the array contains the following details:

    • relationshipAttributeId: System generated ID assigned to the attribute.

    • name: Name of the attribute.

    • value: Value assigned to the attribute.

    • relationship: Details of the relationship linked to this attribute.

      • relationshipId: System generated ID assigned to the relationship.

      • links: For information, see Section A.3, "Links".

A.3 Links

The links resource displays information of the REST API invoked.

  • links: Details of the API href, mediatype, and rel.

    • href: Link to access the resource which has the resource displayed.

    • mediaType: application/json

    • rel: canonical

A.4 Sample Files

The following sections provide the sample ruleset and task files used in some of the APIs.

A.4.1 Sample Ruleset File 1

<RmRules xmlns="http://www.w3.org"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.w3.org rules.xsd" >
        <RmRuleSet name="primary-care-physician-creation" source="IndProvider" target="Patient" description="create relationship between IndProvider and Patient">
    <rule name="primary-care-physician-creation" description="create relationship between IndProvider and Patient">
                                <if>
          <condition>
                                                <target name="Provider.ID" />
                                        </condition>
                                        <then>
                                                <task name="PrimaryCarePhysicianCreationTask" arg="primary-care-physician-of"/>
          </then>
        </if>
      </rule>
        </RmRuleSet>
</RmRules>

A.4.2 Sample Ruleset File 2

<?xml version="1.0" encoding="UTF-8"?>
<RmRules xmlns="http://www.w3.org"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.w3.org rules.xsd" >
        <RmRuleSet name="CreatePatientOfSampleRuleset" source="Patient" target="IndProvider" description="create relationship between the start to the end" >
  <rule name="CreatePatientOfSampleRule" description="create relationship between the start to the end">
                        <if>
                                <condition>
                                                <source name="FirstName" op="="  target="FirstName" />
                                </condition>
      <then>
                                                <task name="CreatePatientOfSampleTask" arg="patient-of" arg1="Rule"/>
                                </then>
    </if>
                </rule>
        </RmRuleSet>
</RmRules>

A.4.3 Sample Ruleset File 3

<?xml version="1.0" encoding="UTF-8"?>
<RmRules xmlns="http://www.w3.org"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.w3.org rules.xsd" >
          <RmRuleSet name="CreatePatientOfSampleRuleset"
source="Patient" target="IndProvider" description="create relationship between the start to the end" >
    <rule name="CreatePatientOfSampleRule" description="create relationship between the start to the end">
      <if>
                                        <condition>
                                                <source name="FirstName" op="="target="Names.FirstName" />
                                        </condition>
                                        <then>
                                                <task name="CreatePatientOfSampleTask" arg="patient-of" arg1="Rule"/>
                                        </then>
                        </if>
                </rule>
        </RmRuleSet>
</RmRules>

A.4.4 Sample Task File 1

/*----------------------------------------------------------------*
 * Copyright (c) 2010 Oracle Corporation, Redwood Shores, CA, USA *
 *                  All rights reserved.                          *
 *----------------------------------------------------------------*/package oracle.hsgbu.ohmpi.rm.rules.task;
import java.util.List;
import java.util.ArrayList;
import java.util.Date;
import oracle.hsgbu.ohmpi.rm.data.Entity;
import oracle.hsgbu.ohmpi.rm.data.EntityType;
import oracle.hsgbu.ohmpi.rm.data.KeyValue;
import oracle.hsgbu.ohmpi.rm.data.Relationship;
import oracle.hsgbu.ohmpi.rm.data.RelationshipType;
import oracle.hsgbu.ohmpi.rm.rules.service.RmTaskException;
import oracle.hsgbu.ohmpi.rm.rules.task.RmTaskContext;
import oracle.hsgbu.ohmpi.rm.rules.task.RmTaskInterface;
import oracle.hsgbu.ohmpi.rm.rules.service.data.DataObject;
import oracle.hsgbu.ohmpi.rm.rules.service.data.RmDataObject;
import oracle.hsgbu.ohmpi.rm.service.RelationshipManagementService;
import oracle.hsgbu.ohmpi.rm.service.RelationshipManagementMetaData;
import oracle.hsgbu.ohmpi.rm.data.AttributeType;
import oracle.hsgbu.ohmpi.rm.data.EntityType;
import oracle.hsgbu.ohmpi.rm.data.RelationshipType;
import oracle.hsgbu.ohmpi.rm.data.KeyValue;
import oracle.hsgbu.ohmpi.rm.data.EntityAttribute;
import oracle.hsgbu.ohmpi.rm.data.Entity;
import oracle.hsgbu.ohmpi.rm.data.RelationshipAttribute;
import oracle.hsgbu.ohmpi.rm.data.Relationship;
import oracle.hsgbu.ohmpi.rm.rules.task.RmTaskContext;
import oracle.hsgbu.ohmpi.rm.rules.task.RmTaskInterface;
import oracle.hsgbu.ohmpi.rm.rules.task.RmTaskMetaData;
import oracle.hsgbu.ohmpi.rm.rules.task.RmTaskService;
import oracle.hsgbu.ohmpi.rm.rules.service.data.DataObject;
import oracle.hsgbu.ohmpi.rm.rules.service.data.RmDataObject;
import oracle.hsgbu.ohmpi.rm.rules.service.data.EntityDataObject;
import oracle.hsgbu.ohmpi.rm.rules.service.data.LiteralDataObject;
import oracle.hsgbu.ohmpi.rm.rules.service.RmTaskException;
/**
 * PrimaryCarePhysicianCreationTask in Groovy
 * @author ohmpi-team
 */
public class PrimaryCarePhysicianCreationTask implements
RmTaskInterface {
public PrimaryCarePhysicianCreationTask() {
}
public void execute(RmTaskContext context)
      throws RmTaskException {
    try {
    RmTaskMetaData rmMetadata = context.getRmTaskMetaData();
    RmTaskService rmService = context.getRmTaskService();
    EntityDataObject sourceData = context.getSourceData();
    EntityDataObject targetData = context.getTargetData();
    RmDataObject rmData = context.getRmData();
      if (sourceData != null &&
        rmData != null) {
        String relTypeName = rmData.getValue("arg");
        if (relTypeName.equalsIgnoreCase("primary-care-physician-of")) {
          if (sourceData.getName().equals("Patient")) {
            EntityType startType = rmMetadata.getEntityType("IndProvider");
            Entity indProviderEntity = new Entity();
indProviderEntity.setEId(sourceData.getValue("Provider.ID"));
                                                        indProviderEntity.setType(startType);
          List<Entity> start = rmService.searchEntity(indProviderEntity);//getEntityByEId(sourceData.getValue("Provider.ID"), startType);
          if (start != null) {
            EntityType endType = rmMetadata.getEntityType("Patient");
            Entity end = new Entity();
        end.setEId(sourceData.getValue("Id"))
            end.setType(endType);
            RelationshipType relType = rmMetadata.getRelationshipType(relTypeName); 
            List<KeyValue> attributes = new ArrayList<>();
            attributes.add(new KeyValue("createdBy", "byRule"));
            Relationship relation = rmService.createRelationship(start.get(0), relType, end, attributes); 
            List<Object> results = new ArrayList<>();
            results.add(relation);
            context.setResults(results);
          }
        } else {
            throw new RmTaskException("unsupported inbound domain '" + sourceData.getName() + "'"); 
        }
      } else {
          throw new RmTaskException("unsupported relationship type '" + relTypeName + "'");
      }
    } else {                throw new RmTaskException("inbound message information insufficient");
    }
   } catch (Throwable t) {
      throw new
RmTaskException("PrimaryCarePhysicianCreationTask failed to create a relationship" + t);
    }
  }
}

A.4.5 Sample Task File 2

/*----------------------------------------------------------------*
 * Copyright (c) 2010 Oracle Corporation, Redwood Shores, CA, USA *
 *                  All rights reserved.                          *
 *----------------------------------------------------------------*/
package oracle.hsgbu.ohmpi.rm.rules.task;
import java.util.List;
import java.util.ArrayList;
import java.util.Date;
import oracle.hsgbu.ohmpi.rm.data.Entity;
import oracle.hsgbu.ohmpi.rm.data.EntityType;
import oracle.hsgbu.ohmpi.rm.data.KeyValue;
import oracle.hsgbu.ohmpi.rm.data.Relationship;
import oracle.hsgbu.ohmpi.rm.data.RelationshipType;
import oracle.hsgbu.ohmpi.rm.rules.service.RmTaskException;
import oracle.hsgbu.ohmpi.rm.rules.task.RmTaskContext;
import oracle.hsgbu.ohmpi.rm.rules.task.RmTaskInterface;
import oracle.hsgbu.ohmpi.rm.rules.service.data.DataObject;
import oracle.hsgbu.ohmpi.rm.rules.service.data.RmDataObject;
import oracle.hsgbu.ohmpi.rm.service.RelationshipManagementService;
import oracle.hsgbu.ohmpi.rm.rules.task.RmTaskService;
import oracle.hsgbu.ohmpi.rm.rules.service.data.EntityDataObject;
/**
 * CreatePatientOfSampleTask in Groovy
 * @author ohmpi-team
 */
public class CreatePatientOfSampleTask implements RmTaskInterface {
  public CreatePatientOfSampleTask() {
  }
  public void execute(RmTaskContext context) throws RmTaskException {
    try {
      RmTaskService rmService = context.getRmTaskService();
      RmTaskMetaData rmMetadata = context.getRmTaskMetaData();
      EntityDataObject sourceData = context.getSourceData();
      EntityDataObject targetData = context.getTargetData();
      RmDataObject rmData = context.getRmData();
      if (sourceData != null && targetData != null && rmData != null) {
        EntityType startType = rmMetadata.getEntityType("Patient");
        EntityType endType = rmMetadata.getEntityType("IndProvider");
        Entity start = new Entity();
        start.setEId(sourceData.getValue("Id"));
        start.setType(startType);
        Entity end = new Entity();
        end.setEId(targetData.getValue("Id"));
        end.setType(endType);
        RelationshipType relType = rmMetadata.getRelationshipType(rmData.getValue("arg"));
        String arg1 = rmData.getValue("arg1");
        List<KeyValue> attributes = new ArrayList<>();
        attributes.add(new KeyValue("createdBy", arg1));
        Relationship relation = rmService.createRelationship(start, relType, end, attributes);
        List<Object> results = new ArrayList<Object>();
        results.add(relation);
        context.setResults(results);
      }
    } catch (Throwable t) {
        throw new RmTaskException("CreatePatientOfSampleTask failed to create a relationship" + t);
    }
  }
}