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">.

예

다음의 예는 자전거 대여소 항목, 자전거 엔티티 및 대여소 검색 이벤트를 정의하는 XML 스키마를 보여줍니다. 이 예제는 이동 도형을 포함하지 않습니다. 자전거 및 자전거 대여소는 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>

다음 예제는 자동차 엔티티를 정의하는 XML 스키마를 표시합니다. 이 예제는 이동 도형을 포함합니다. 자동차 위치는 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>