WebSphere Enterprise Service Bus, 버전 6.2.0 운영 체제: AIX, HP-UX, i5/OS, Linux, Solaris, Windows


모델 그룹 지원(모두, 선택사항, 순서 및 그룹 참조)

SDO 스펙을 적소에 펼치고 유형 또는 특성에 대해 설명하지 않으려면 모델 그룹(모두, 선택사항, 순서 및 그룹 참조)이 필요합니다.

기본적으로 이는 동일한 포함 구조에 있는 모든 해당 구조가 "단일화"됨을 의미합니다. 이러한 "단일화"는 모든 하위 구조를 동일한 레벨에 놓습니다. 이로 인해 단일화된 데이터에서 구조를 추출한 SDO에 중복 네이밍 문제가 발생할 수 있습니다. XSD에서 그룹을 단일화하지 않는 경우 여전히 서로 다른 상위 구조에 중복되는 항목이 각각 들어 있습니다.

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
 targetNamespace="http://MultipleGroup">
  <xsd:complexType name="MultipleGroup">
    <xsd:sequence>
      <xsd:choice>
        <xsd:element name="option1" type="xsd:string"/>
        <xsd:element name="option2" type="xsd:string"/>
      </xsd:choice>
      <xsd:element name="separator" type="xsd:string"/>
      <xsd:choice>
        <xsd:element name="option1" type="xsd:string"/>
        <xsd:element name="option2" type="xsd:string"/>
      </xsd:choice>
    </xsd:sequence>
  </xsd:complexType>
</xsd:schema>

option1 및 option2의 다중 어커런스가 서로 다른 선택사항 블록에 들어 있고 이들 사이에 독립적인 요소도 있으므로 XSD 및 XML에서 이를 구별하는 데 문제가 없습니다. 그러나 SDO에서 이 그룹을 단일화하면 모든 옵션 특성이 동일한 MultipleGroup 컨테이너에 있게 됩니다.

중복 이름이 없어도 이들 그룹의 flattening이 야기하는 시멘틱 문제가 있습니다. 다음과 같은 XSD 예제가 있습니다.

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
 targetNamespace="http://SimpleChoice">
  <xsd:complexType name="SimpleChoice">
    <xsd:sequence>
      <xsd:choice>
        <xsd:element name="option1" type="xsd:string"/>
        <xsd:element name="option2" type="xsd:string"/>
      </xsd:choice>
    </xsd:sequence>
  </xsd:complexType>
</xsd:schema>

표준 및 산업 스키마와 같은 여러 경우에 사용자가 작업 중인 XSD를 제어하지는 않으므로 사용자에게 중복된 이름을 바꾸거나 XSD에 특수한 어노테이션을 추가하도록 요청하는 것은 바람직하지 않습니다.

모든 특성에 일관성이 있도록 하기 위해 비즈니스 오브젝트에는 XPath를 통해 중복된 이름을 가진 특성의 개별 어커런스에 액세스할 수 있는 메소드가 포함되어 있습니다. 발견된 모든 중복 특성 이름에는 EMF 이름 지정 규칙에 따라 사용되지 않은 다음 번 숫자가 추가됩니다(예: XSD).

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
 targetNamespace="http://TieredGroup">
  <xsd:complexType name="TieredGroup">
    <xsd:sequence>
      <xsd:choice minOccurs="0">
        <xsd:sequence>
          <xsd:element name="low" minOccurs="1" 
					maxOccurs="1" type="xsd:string"/>
          <xsd:choice minOccurs="0">
            <xsd:element name="width" minOccurs="0" 
						maxOccurs="1" type="xsd:string"/>
            <xsd:element name="high" minOccurs="0" 
						maxOccurs="1" type="xsd:string"/>
          </xsd:choice>
        </xsd:sequence>
        <xsd:element name="high" minOccurs="1" 
				maxOccurs="1" type="xsd:string"/>
        <xsd:sequence>
          <xsd:element name="width" minOccurs="1" 
					maxOccurs="1" type="xsd:string"/>
          <xsd:element name="high" minOccurs="0" 
					maxOccurs="1" type="xsd:string"/>
        </xsd:sequence>
        <xsd:sequence>
          <xsd:element name="center" minOccurs="1" 
					maxOccurs="1" type="xsd:string"/>
          <xsd:element name="width" minOccurs="0" 
					maxOccurs="1" type="xsd:string"/>
        </xsd:sequence>
      </xsd:choice>
    </xsd:sequence>
  </xsd:complexType>
</xsd:schema>

위 XSD는 다음 DataObject 모델을 생성합니다.

DataObject - TieredGroup
	Property[0] - low - string
	Property[1] - width - string
	Property[2] - high - string
	Property[3] - high1 - string
	Property[4] - width1 - string
	Property[5] - high2 - string
	Property[6] - center - string
	Property[7] - width2 - string

여기서, width, width1width2는 특성 이름으로 high, high1, high2와 마찬가지로 첫 번째 width에서 시작하여 XSD에서 아래 방향으로 순서대로 이름이 지정됩니다.

이러한 새 특성 이름은 참조 및 XPath로만 사용되는 이름이며 직렬화된 컨텐츠에는 영향을 주지 않습니다. 직렬화된 XML에 표시되는 이들 각 특성의 "참" 이름은 XSD에 주어진 값입니다. XML 인스턴스는 다음과 같습니다.

<?xml version="1.0" encoding="UTF-8"?>
<p:TieredGroup xsi:type="p:TieredGroup"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:p="http://TieredGroup">
  <width>foo</width>
  <high>bar</high>
</p:TieredGroup>

이러한 특성에 액세스하기 위해 다음 코드를 사용할 수 있습니다.

	DataObject tieredGroup = ...

	// Displays "foo"
	System.out.println(tieredGroup.get("width1"));

	// Displays "bar"
	System.out.println(tieredGroup.get("high2"));

concept 개념 주제

이용약관 | 피드백


시간소인 아이콘 마지막 갱신 날짜: 2010년 7월 7일 수요일


http://publib.boulder.ibm.com/infocenter/dmndhelp/v6r2mx/topic//com.ibm.websphere.wesb620.doc/doc/cbo_modelgroupsupport.html
Copyright IBM Corporation 2005, 2010. All Rights Reserved.
이 Information Center는 Eclipse 기술을 기반으로 합니다(http://www.eclipse.org 웹 사이트 참조).