XMLからSDOへの変換方法
Oracle BPEL Process Managerでは、DOMとSDOの2つのデータ形式をサポートしています。同じビジネス・プロセス内で、さらに同じ式の中で、DOMベースの変数とSDOベースの変数の使用を切り替えることができます。Oracle BPEL Process Managerのデータ・フレームワークは、DOM形式とSDO形式を自動的に変換します。
Oracle BPEL Process Managerでは、エンティティ変数のXPathリライト機能を使用することで、基本的なSDO仕様ではサポートされない複数のXPath機能(変数の参照、関数コールなど)を使用できます。一方で、SDOベースの変数を使用するXPathには、別の制限があります(and、orおよびnotがサポートされないなど)。
次に、XMLからSDOに変換する例を示します。
<assign>
<copy>
<from>
<ns0:dept xmlns:ns0="http://sdo.sample.service/types/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ns0:Deptno>10</ns0:Deptno>
<ns0:Dname>ACCOUNTING</ns0:Dname>
<ns0:Loc>NEW YORK</ns0:Loc>
<ns0:Emp>
<ns0:Empno>7782</ns0:Empno>
<ns0:Ename>CLARK</ns0:Ename>
<ns0:Job>MANAGER</ns0:Job>
<ns0:Mgr>7839</ns0:Mgr>
<ns0:Hiredate>1981-06-09</ns0:Hiredate>
<ns0:Sal>2450</ns0:Sal>
<ns0:Deptno>10</ns0:Deptno>
</ns0:Emp>
<ns0:Emp>
<ns0:Empno>7839</ns0:Empno>
<ns0:Ename>KING</ns0:Ename>
<ns0:Job>PRESIDENT</ns0:Job>
<ns0:Hiredate>1981-11-17</ns0:Hiredate>
<ns0:Sal>5000</ns0:Sal>
<ns0:Deptno>10</ns0:Deptno>
</ns0:Emp>
<ns0:Emp>
<ns0:Empno>7934</ns0:Empno>
<ns0:Ename>MILLER</ns0:Ename>
<ns0:Job>CLERK</ns0:Job>
<ns0:Mgr>7782</ns0:Mgr>
<ns0:Hiredate>1982-01-23</ns0:Hiredate>
<ns0:Sal>1300</ns0:Sal>
<ns0:Deptno>10</ns0:Deptno>
</ns0:Emp>
</ns0:dept>
</from>
<to variable="deptVar_s" />
</copy>
</assign>
次に、SDO変数のXPath式からDOM変数にコピーする例を示します。
<assign>
<!-- copy from an XPath expression of an SDO variable to DOM variable -->
<copy>
<from expression="$deptVar_s/hrtypes:Emp[2]" />
<to variable="empVar_v" />
</copy>
<!-- copy from an XPath expression of an DOM variable to SDO variable -->
<copy>
<from expression="$deptVar_v/hrtypes:Emp[2]" />
<to variable="empVar_s" />
</copy>
<!-- insert a DOM based data into an SDO variable -->
<bpelx:insertAfter>
<bpelx:from variable="empVar_v" />
<bpelx:to variable="deptVar_s" query="hrtypes:Emp" />
</bpelx:insertAfter>
<!-- insert a SDO based data into an SDO variable at particular location,
no XML conversion is needed -->
<bpelx:insertBefore>
<bpelx:from expression="$deptVar_s/hrtypes:Emp[hrtypes:Sal = 1300]" />
<bpelx:to variable="deptVar_s" query="hrtypes:Emp[6]" />
</bpelx:insertBefore>
</assign>
次に、SDOデータを削除する例を示します。
<assign>
<bpelx:remove>
<bpelx:target variable="deptVar_s" query="hrtypes:Emp[2]" />
</bpelx:remove>
</assign>ノート:
SDOベースの変数に対するbpelx:append操作は、次の理由によりサポートされていません。
-
SDOベースの変数に対する
<copy>操作には、高性能な更新機能があります(<copy>操作の前に<bpelx:append>操作を実行する必要がないなど)。 -
SDOデータ・オブジェクトはメタデータ駆動で、一般的に新しいプロパティを任意に追加することがサポートされていません。