Samples Tutorial

     Previous  Next    Open TOC in new window    View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

Implementing Relationship Functions and Logical Modeling

Relationship functions return data combined from two or more data services. For example, by creating a relationship between the Address and Customer data services, you can obtain the address for a given customer. Or by creating a relationship between the Customer and Order Management data services, you can receive data that identifies all orders returned by a particular customer.

Model diagrams are used to view a selected set of data services and the relationships between them. The model shows the basic structure of the data returned by the data service. The main purpose of the diagram is to help you envision meaningful subsets of your enterprise data relationships, but it can also be used to define new artifacts or edit existing artifacts.

Logical modeling is an extension of the physical modeling that you learned about in Tutorial 5: Modeling Data Services. There are three exercises in this lesson, which are to be completed in sequential order. The exercises in this tutorial are dependent on the work completed in the previous tutorials.

 


Objectives

After completing this lesson, you will be able to:

 


Overview

To help you get from a complex, distributed physical data landscape to a more holistic view of enterprise information, ALDSP supports a visual, model-driven approach to developing data services. Modeling provides a graphical representation of the data resources in your environment, providing a bird's-eye view of a large system or giving you a way to create "zoomed" views of enterprise areas. In a model diagram data services appear as boxes, while relationships appear as annotated lines connection the data service representations. A relationship is only visible if both end points are also on the diagram.

The result is real-time access to externally persisted data through a logical data model.

 


20.1 Implementing and Testing a Relationship Function

The getCustomer_Order() function is intended to return customer order information for a specific customer. However, to accomplish that you need to add the ApparelDB data service's CUSTOMER_ORDER as a source schema, and then create a relationship with the target schema.

Objectives

In this exercise you will:

Instructions

  1. Open CUSTOMER.ds in XQuery Editor View. The file is located in DataServices\CustomerDB.
  2. Select getCustomer_Order(arg) from the Function drop-down list.
  3. Figure 20-1 XQuery Editor View of getCustomer_Order Function


    XQuery Editor View of getCustomer_Order Function

  4. In Data Services Palette, expand the ApparelDB and CUSTOMER_ORDER.ds folders.
  5. Drag and drop CUSTOMER_ORDER() into XQuery Editor View.
  6. In XQuery Editor View, create an overwrite mapping between the CUSTOMER_ORDER source and Return elements by completing the following steps:
    1. Press Ctrl.
    2. Drag and drop the source node's CUSTOMER_ORDER* element onto the Return type's CUSTOMER_ORDER element.
  7. Drag and drop the parameter's CUSTOMER_ID element onto the source node's C_ID element. Confirm that the getCustomer_Order() function is as displayed in Figure 20-2.
  8. Figure 20-2 Joined and Mapped Function


    Joined and Mapped Function

  9. Save your work and then build the DataServices project.
  10. Open CUSTOMER.ds in Test View and run a test by completing the following steps:
  1. Click Select. The contents of the file are inserted into the Parameters field.
  2. Figure 20-4 Select XML File


    Select XML File

  3. Click Execute. The order information for CUSTOMER3 should appear.
  4. Figure 20-5 Relationship Test Results


    Relationship Test Results

 


20.2 Creating a Model Diagram for Logical Data Services

Model diagrams display the basic structure of the data returned by a data service. A model diagram lets you view a selected set of data services and the relationships between them. The main purpose of the diagram is to help you envision meaningful subsets of the model, but it can also be used to define new artifacts or edit existing artifacts.

Objectives

In this exercise, you will:

Instructions

  1. Import the OrderManagement schema into the DataServices project folder by completing the following steps:
    1. Right-click the DataServices project folder.
    2. Choose Import.
    3. Navigate to and open the <beahome>\weblogic81\samples\LiquidData\EvalGuide directory.
    4. Select the OrderManagement folder.
    5. Click Import. A new folder, OrderManagement, is created in the DataServices project. The imported schema contains logical representations of the two Order Management Systems (Apparel and Electronics), which make the two systems appear as if they are a single Order Management System.
  2. Create a sub-folder within the Models folder by completing the following steps:
    1. Right-click the MODELS folder, located in the DataServices folder.
    2. Choose New Arrow symbol Folder.
    3. Enter Logical in the Name field.
    4. Click OK.
  3. Create a new logical model diagram by completing the following steps:
    1. Right-click the Logical folder.
    2. Choose New Arrow symbol Model Diagram.
    3. Enter OrderManagement_Logical_Model.md in the Name field.
    4. Click Create.
  4. Create a model for the OrderManagement data services by completing the following steps:
    1. Expand the CustomerManagement, OrderManagement, and ServiceDB folders.
    2. Drag and drop the following .ds files into the model:
      Table 20-6 Model data services
      Data Service File
      Located in:
      customerProfile.ds

      CustomerManagement

      address.ds

      OrderManagement

      Customer.ds

      OrderManagement

      customerOrder.ds

      OrderManagement

      customerOrderLineItem.ds

      OrderManagement

      orders.ds

      OrderManagement

      product.ds

      OrderManagement

      service_case.ds

      ServiceDB

Your model diagram should be similar to that displayed in Figure 20-7. Notice that relationships between data services already exist. These relationships were generated during the Import Source Metadata process, and are based on the foreign key relationship defined in the underlying relational data.

Figure 20-7 Model Diagram for Logical Data Services
  1. Create a relationship between the CustomerProfile and ADDRESS data services by completing the following steps:
    1. Drag and drop the customer_id element (CustomerProfile) onto the CustomerID element (Address).
    2. Click Finish in the Relationship Properties window.
  2. Create a relationship between CustomerProfile and SERVICE_CASE data services by completing the following steps:
    1. Drag and drop the customer_id (CustomerProfile) onto the CUSTOMER_ID element (SERVICE_CASE).
    2. Click Finish in the Relationship Properties window.
    3. Figure 20-8 New Relationships Defined


      New Relationships Defined

  3. Open CustomerProfile.ds in Design View. You should see two new relationship functions, getAddress() (which navigates to the Address logical data service, located in OrderManagement) and getSERVICE_CASE() (which navigates to the SERVICE_CASE physical data service, located in ServiceDB).
  4. Figure 20-9 New Functions


    New Functions

  5. Save your work.

 


Lesson Summary

In this exercise, you learned to:


  Back to Top       Previous  Next