XML スキーマへの地理空間タイプの追加

XML スキーマでエレメントに地理空間タイプを追加できます。地理空間タイプは形状オブジェクト (点、線、または多角形) であり、地理的位置または空間特徴のいずれかを表します。これには、静的または移動式があります。

このタスクについて

Decision Server Insights では、 XML スキーマのタイプに追加できる地理空間タイプを含むスキーマが提供されています。 地理空間タイプは、フォルダー InstallDir/CIS-runtime-target-platform/schema/ の下のスキーマに定義されています。

地理空間タイプを使用するには、まず、スキーマに geometry.xsd ファイルをインポートする必要があります。

移動式ジオメトリーを定義する場合は、スキーマに geolibst.xsd ファイルをインポートすることも必要です。

手順

  1. 次のジオメトリー・スキーマの XML 名前空間を指定します。 xmlns:geom="http://www.ibm.com/geolib/geom" および xmlns:crs="http://www.ibm.com/geolib/crs"
  2. 次のようにしてメイン・スキーマをインポートします。<import namespace="http://www.ibm.com/geolib/geom" schemaLocation="InstallDir/CIS-runtime-target-platform/schema/geometry.xsd"/> 移動式ジオメトリーを定義する必要がある場合には、次のようにして geolibst.xsd ファイルもインポートする必要があります。<import namespace="http://www.ibm.com/geolib/geom" schemaLocation="InstallDir/CIS-runtime-target-platform/schema/geolibst.xsd"/>
  3. エレメントの地理空間タイプを指定します。 例えば、<element name="country" type="geom:MultiPolygon"> などです。

例

以下の例は、bike station エンティティー、bike エンティティー、および search station イベントを定義する XML スキーマを示しています。 移動式ジオメトリーは、この例に含まれていません。bike と bike station は、地理空間タイプ point で定義されています。

<?xml version="1.0" encoding="UTF-8"?>
<schema elementFormDefault="qualified" 
targetNamespace="http://www.ibm.com/ia/bikestation"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:ns="http://www.ibm.com/ia/bikestation"
xmlns:geom="http://www.ibm.com/geolib/geom"
xmlns:crs="http://www.ibm.com/geolib/crs">

 <import namespace="http://www.ibm.com/geolib/geom" schemaLocation="C:/IBM/ODMInsights880/CIS-runtime-target-platform/schema/geometry.xsd"/>

 <element name="BikeStation" type="ns:BikeStation"/>
  <complexType name="BikeStation">
   <annotation>
    <appinfo source="http://www.ibm.com/ia/Annotation">
     <entity elementName="BikeStation"/>
    </appinfo>
   </annotation>
  <sequence>
     <element name="location" type="geom:Point">
     </element>
     <element name="name" type="string">
     </element>
     <element name="id" type="string">
       <annotation>
        <appinfo source="http://www.ibm.com/ia/Annotation">
         <entityId/>
        </appinfo>
       </annotation>
     </element>
   </sequence>
  </complexType>

 <element name="Bike" type="ns:Bike"/>
  <complexType name="Bike">
   <annotation>
     <appinfo source="http://www.ibm.com/ia/Annotation">
      <entity elementName="Bike"/>
     </appinfo>
   </annotation>
 <sequence>
   <element name="currentLocation" type="geom:Point">
   </element>
   <element name="id" type="string">
     <annotation>
       <appinfo source="http://www.ibm.com/ia/Annotation">
         <entityId/>
       </appinfo>
     </annotation>
   </element>
  </sequence>
 </complexType>
		
 <element name="SearchStation" type="ns:SearchStation"/>
 <complexType name="SearchStation">
   <annotation>
    <appinfo source="http://www.ibm.com/ia/Annotation">
     <event elementName="SearchStation"/>
    </appinfo>
   </annotation>		
  <sequence>
    <element name="bike" type="string">
     <annotation>
      <appinfo source="http://www.ibm.com/ia/Annotation">
        <businessName name="bike"/>
        <businessType type="com.ibm.ia.bikestation.Bike"/>
      </appinfo>
     </annotation>	
    </element>
    <element name="timestamp" type="dateTime">
     <annotation>
       <appinfo source="http://www.ibm.com/ia/Annotation">
         <timestamp/>
       </appinfo>
     </annotation>
    </element>
  </sequence>
  </complexType>
</schema>

以下の例は、car エンティティーを定義する XML スキーマを示しています。 この例には、移動式ジオメトリーが含まれています。 car の location は、MovingGeometry 地理空間タイプで定義されています。

<?xml version="1.0" encoding="UTF-8"?>
<schema elementFormDefault="qualified"
xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/car"
xmlns:car="http://www.example.org/car"
xmlns:geost="http://www.ibm.com/geolib/st"
xmlns:geom="http://www.ibm.com/geolib/geom"
xmlns:crs="http://www.ibm.com/geolib/crs">

 <import namespace="http://www.ibm.com/geolib/st" schemaLocation="C:/IBM/ODMInsights880/CIS-runtime-target-platform/schema/geolibst.xsd" />
 <import namespace="http://www.ibm.com/geolib/geom" schemaLocation="C:/IBM/ODMInsights880/CIS-runtime-target-platform/schema/geometry.xsd" />

  <element name="car" type="car:Car" />
   <complexType name="Car">
    <annotation>
     <appinfo source="http://www.ibm.com/ia/Annotation">
	<entity elementName="car" />
     </appinfo>
    </annotation>
    <sequence>
     <element name="licenseNumber" type="string" minOccurs="1" maxOccurs="1">
      <annotation>
       <appinfo source="http://www.ibm.com/ia/Annotation">
        <entityId />
       </appinfo>
      </annotation>
     </element>
     <element name="driverName" type="string" minOccurs="1" maxOccurs="1" />
     <element name="location" type="geost:MovingGeometry" minOccurs="1" maxOccurs="1" />
    </sequence>
   </complexType>

</schema>