MINI MINI MANI MO
Rem
Rem $Header: sdo/admin/sdogmlsc.sql /main/18 2017/10/20 11:01:23 rjanders Exp $
Rem
Rem sdogmlsc.sql
Rem
Rem Copyright (c) 2005, 2017, Oracle and/or its affiliates.
Rem All rights reserved.
Rem
Rem NAME
Rem sdogmlsc.sql - <one-line expansion of the name>
Rem
Rem DESCRIPTION
Rem This file is used to register the 3 schemas required for GML 212
Rem
Rem NOTES
Rem <other useful comments, qualifications, etc.>
Rem
Rem BEGIN SQL_FILE_METADATA
Rem SQL_SOURCE_FILE: sdo/admin/sdogmlsc.sql
Rem SQL_SHIPPED_FILE: md/admin/sdogmlsc.sql
Rem SQL_PHASE: SDOGMLSC
Rem SQL_STARTUP_MODE: NORMAL
Rem SQL_IGNORABLE_ERRORS: NONE
Rem SQL_CALLING_FILE: sdo/admin/catmdlocp2.sql
Rem END SQL_FILE_METADATA
Rem
Rem MODIFIED (MM/DD/YY)
Rem rjanders 10/08/17 - Add MDSYS to spatial type
Rem rjanders 06/30/17 - Add SYS/MDSYS prefixes
Rem rjanders 05/10/17 - #26037683: Raise 'when other' exceptions
Rem rjanders 03/23/17 - #25437999: Remove 'when others then NULL'
Rem handlers
Rem rjanders 03/09/17 - Add missing SQL_FILE_METADATA information
Rem rjanders 02/01/15 - #20418139: Cannot grant SELECT to PUBLIC
Rem rjanders 01/02/15 - long identifier project phase 1
Rem rjanders 03/15/13 - #16473696: Start/End _ORACLE_SCRIPT
Rem initialization
Rem rjanders 02/07/12 - Remove DOC> C-style comments (security)
Rem sravada 11/19/11 - delete vis3d schema
Rem sravada 05/12/05 - sravada_sdo_text_object
Rem sravada 05/03/05 - Created
Rem
Rem ********************************************************************
Rem #16473696: Indicate Oracle-Supplied object
@@?/rdbms/admin/sqlsessstart.sql
Rem ********************************************************************
declare
already_exists exception;
pragma exception_init(already_exists, -00955);
begin
begin
execute immediate
'CREATE TABLE MDSYS.SDO_XML_SCHEMAS
(
id NUMBER PRIMARY KEY,
description VARCHAR2(300),
xmlSchema CLOB) ';
exception
when already_exists then NULL;
when others then
SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
'EXCEPTION[sdogmlsc.sql(' || $$PLSQL_LINE || ')1]: ' || SQLERRM); RAISE;
end;
end;
/
GRANT READ ON MDSYS.SDO_XML_SCHEMAS TO PUBLIC;
create or replace public synonym SDO_XML_SCHEMAS
for MDSYS.SDO_XML_SCHEMAS;
-- first delete all the GML related schemas
declare
usr varchar2(128);
url varchar2(200);
loc clob;
cnt number;
begin
usr := 'MDSYS';
url := 'http://www.opengis.net/cartographicText.xsd';
execute immediate
'SELECT count(*) FROM sys.dba_xml_schemas WHERE owner=:1 AND schema_url=:2'
into cnt using usr, url;
if cnt <> 0 then
dbms_xmlschema.deleteSchema(url, dbms_xmlschema.DELETE_CASCADE);
end if;
url := 'http://www.opengis.net/gml/feature.xsd';
execute immediate
'SELECT count(*) FROM sys.dba_xml_schemas WHERE owner=:1 AND schema_url=:2'
into cnt using usr, url; if cnt <> 0 then
dbms_xmlschema.deleteSchema(url, dbms_xmlschema.DELETE_CASCADE);
end if;
url := 'http://www.opengis.net/gml/geometry.xsd';
execute immediate
'SELECT count(*) FROM sys.dba_xml_schemas WHERE owner=:1 AND schema_url=:2'
into cnt using usr, url; if cnt <> 0 then
dbms_xmlschema.deleteSchema(url, dbms_xmlschema.DELETE_CASCADE);
end if;
url := 'http://www.w3.org/1999/xlink/xlinks.xsd';
execute immediate
'SELECT count(*) FROM sys.dba_xml_schemas WHERE owner=:1 AND schema_url=:2'
into cnt using usr, url; if cnt <> 0 then
dbms_xmlschema.deleteSchema(url, dbms_xmlschema.DELETE_CASCADE);
end if;
end;
/
-- register the schema
DECLARE
schemaclob CLOB;
amt NUMBER;
buf VARCHAR2(32767);
pos NUMBER;
BEGIN
DELETE FROM MDSYS.SDO_XML_SCHEMAS WHERE id=1;
INSERT INTO MDSYS.SDO_XML_SCHEMAS VALUES (1, 'GML:2.1.2 xlinks.xsd', empty_clob())
RETURNING xmlSchema into schemaclob;
SELECT xmlSchema into schemaclob from MDSYS.SDO_XML_SCHEMAS
WHERE id = 1 FOR UPDATE;
DBMS_LOB.OPEN(schemaclob, DBMS_LOB.LOB_READWRITE);
buf := '<?xml version="1.0" encoding="UTF-8"?>
<schema targetNamespace="http://www.w3.org/1999/xlink" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2001/XMLSchema" version="2.1.2">
<annotation>
<appinfo>xlinks.xsd v2.1.2 2002-07</appinfo>
<documentation xml:lang="en">
This schema provides the XLink attributes for general use.
</documentation>
</annotation>
<!-- ==============================================================
global declarations
=============================================================== -->
<!-- locator attribute -->
<attribute name="href" type="anyURI"/>
<!-- semantic attributes -->
<attribute name="role" type="anyURI"/>
<attribute name="arcrole" type="anyURI"/>
<attribute name="title" type="string"/>
<!-- behavior attributes -->
<attribute name="show">
<annotation>
<documentation>
The show attribute is used to communicate the desired presentation
of the ending resource on traversal from the starting resource; its
value should be treated as follows:
new - load ending resource in a new window, frame, pane, or other
presentation context
replace - load the resource in the same window, frame, pane, or
other presentation context
embed - load ending resource in place of the presentation of the
starting resource
other - behavior is unconstrained; examine other markup in the
link for hints
none - behavior is unconstrained
</documentation>
</annotation>
<simpleType>
<restriction base="string">
<enumeration value="new"/>
<enumeration value="replace"/>
<enumeration value="embed"/>
<enumeration value="other"/>
<enumeration value="none"/>
</restriction>
</simpleType>
</attribute>
<attribute name="actuate">
<annotation>
<documentation>
The actuate attribute is used to communicate the desired timing
of traversal from the starting resource to the ending resource;
its value should be treated as follows:
onLoad - traverse to the ending resource immediately on loading
the starting resource
onRequest - traverse from the starting resource to the ending
resource only on a post-loading event triggered for
this purpose
other - behavior is unconstrained; examine other markup in link
for hints
none - behavior is unconstrained
</documentation>
</annotation>
<simpleType>
<restriction base="string">
<enumeration value="onLoad"/>
<enumeration value="onRequest"/>
<enumeration value="other"/>
<enumeration value="none"/>
</restriction>
</simpleType>
</attribute>
<!-- traversal attributes -->
<attribute name="label" type="string"/>
<attribute name="from" type="string"/>
<attribute name="to" type="string"/>
<!-- ==============================================================
Attributes grouped by XLink type, as specified by the allowed usage patterns
in sec. 4.1 of the W3C Recommendation (dated 2001-06-27)
=================================================================== -->
<attributeGroup name="simpleLink">
<attribute name="type" type="string" use="optional" fixed="simple" form="qualified"/>
<attribute ref="xlink:href" use="optional"/>
<attribute ref="xlink:role" use="optional"/>
<attribute ref="xlink:arcrole" use="optional"/>
<attribute ref="xlink:title" use="optional"/>
<attribute ref="xlink:show" use="optional"/>
<attribute ref="xlink:actuate" use="optional"/>
</attributeGroup>
<attributeGroup name="extendedLink">
<attribute name="type" type="string" use="required" fixed="extended" form="qualified"/>
<attribute ref="xlink:role" use="optional"/>
<attribute ref="xlink:title" use="optional"/>
</attributeGroup>
<attributeGroup name="locatorLink">
<attribute name="type" type="string" use="required" fixed="locator" form="qualified"/>
<attribute ref="xlink:href" use="required"/>
<attribute ref="xlink:role" use="optional"/>
<attribute ref="xlink:title" use="optional"/>
<attribute ref="xlink:label" use="optional"/>
</attributeGroup>
<attributeGroup name="arcLink">
<attribute name="type" type="string" use="required" fixed="arc" form="qualified"/>
<attribute ref="xlink:arcrole" use="optional"/>
<attribute ref="xlink:title" use="optional"/>
<attribute ref="xlink:show" use="optional"/>
<attribute ref="xlink:actuate" use="optional"/>
<attribute ref="xlink:from" use="optional"/>
<attribute ref="xlink:to" use="optional"/>
</attributeGroup>
<attributeGroup name="resourceLink">
<attribute name="type" type="string" use="required" fixed="resource" form="qualified"/>
<attribute ref="xlink:role" use="optional"/>
<attribute ref="xlink:title" use="optional"/>
<attribute ref="xlink:label" use="optional"/>
</attributeGroup>
<attributeGroup name="titleLink">
<attribute name="type" type="string" use="required" fixed="title" form="qualified"/>
</attributeGroup>
<attributeGroup name="emptyLink">
<attribute name="type" type="string" use="required" fixed="empty" form="qualified"/>
</attributeGroup>
</schema> ';
amt := length(buf);
pos := 1;
DBMS_LOB.WRITE(schemaclob, amt, pos, buf);
DBMS_LOB.CLOSE(schemaclob);
COMMIT;
END;
/
SHOW ERRORS;
declare
usr varchar2(128);
url varchar2(200);
loc clob;
cnt number;
begin
usr := 'MDSYS';
url := 'http://www.w3.org/1999/xlink/xlinks.xsd';
-- First check whether the schema has been registered already.
-- If it has, de-register it. This might cause an error to be raised if
-- there are dependent tables or schemas. User then needs to manually
-- remove/evolve the depdendent objects and run this script again.
execute immediate
'SELECT count(*) FROM sys.dba_xml_schemas WHERE owner=:1 AND schema_url=:2'
into cnt using usr, url;
if cnt <> 0 then
dbms_xmlschema.deleteSchema(url, dbms_xmlschema.DELETE_CASCADE);
end if;
select xmlSchema into loc from MDSYS.SDO_XML_SCHEMAS
where id = 1;
-- register the schema
dbms_xmlschema.registerSchema(url,
loc, FALSE, FALSE, FALSE, FALSE, FALSE, usr);
end;
/
DECLARE
schemaclob CLOB;
amt NUMBER;
buf VARCHAR2(32767);
pos NUMBER;
BEGIN
DELETE FROM MDSYS.SDO_XML_SCHEMAS WHERE id=2;
INSERT INTO MDSYS.SDO_XML_SCHEMAS VALUES (2, 'GML:2.1.2 geometry.xsd', empty_clob())
RETURNING xmlSchema into schemaclob;
SELECT xmlSchema into schemaclob from MDSYS.SDO_XML_SCHEMAS
WHERE id = 2 FOR UPDATE;
DBMS_LOB.OPEN(schemaclob, DBMS_LOB.LOB_READWRITE);
buf := '<?xml version="1.0" encoding="UTF-8"?>
<schema targetNamespace="http://www.opengis.net/gml"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/1999/xlink
http://www.w3.org/1999/xlink/xlinks.xsd"
xmlns:gml="http://www.opengis.net/gml"
xmlns="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" version="2.1.2">
<annotation>
<appinfo>geometry.xsd v2.1.2 2002-07</appinfo>
<documentation xml:lang="en">
GML Geometry schema. Copyright (c) 2001,2002 OGC, All Rights Reserved.
</documentation>
</annotation>
<!-- bring in the XLink attributes -->
<import namespace="http://www.w3.org/1999/xlink" schemaLocation="http://www.w3.org/1999/xlink/xlinks.xsd"/>
<!-- ==============================================================
global declarations
=================================================================== -->
<element name="_Geometry" type="gml:AbstractGeometryType" abstract="true"/>
<element name="_GeometryCollection" type="gml:GeometryCollectionType" abstract="true" substitutionGroup="gml:_Geometry"/>
<element name="geometryMember" type="gml:GeometryAssociationType"/>
<element name="pointMember" type="gml:PointMemberType" substitutionGroup="gml:geometryMember"/>
<element name="lineStringMember" type="gml:LineStringMemberType" substitutionGroup="gml:geometryMember"/>
<element name="polygonMember" type="gml:PolygonMemberType" substitutionGroup="gml:geometryMember"/>
<element name="outerBoundaryIs" type="gml:LinearRingMemberType"/>
<element name="innerBoundaryIs" type="gml:LinearRingMemberType"/>
<!-- primitive geometry elements -->
<element name="Point" type="gml:PointType" substitutionGroup="gml:_Geometry"/>
<element name="LineString" type="gml:LineStringType" substitutionGroup="gml:_Geometry"/>
<element name="LinearRing" type="gml:LinearRingType" substitutionGroup="gml:_Geometry"/>
<element name="Polygon" type="gml:PolygonType" substitutionGroup="gml:_Geometry"/>
<element name="Box" type="gml:BoxType"/>
<!-- aggregate geometry elements -->
<element name="MultiGeometry" type="gml:GeometryCollectionType" substitutionGroup="gml:_Geometry"/>
<element name="MultiPoint" type="gml:MultiPointType" substitutionGroup="gml:_Geometry"/>
<element name="MultiLineString" type="gml:MultiLineStringType" substitutionGroup="gml:_Geometry"/>
<element name="MultiPolygon" type="gml:MultiPolygonType" substitutionGroup="gml:_Geometry"/>
<!-- coordinate elements -->
<element name="coord" type="gml:CoordType"/>
<element name="coordinates" type="gml:CoordinatesType"/>
<!-- this attribute gives the location where an element is defined -->
<attribute name="remoteSchema" type="anyURI"/>
<!-- ==============================================================
abstract supertypes
=================================================================== -->
<complexType name="AbstractGeometryType" abstract="true">
<annotation>
<documentation>
All geometry elements are derived from this abstract supertype;
a geometry element may have an identifying attribute (gid).
It may be associated with a spatial reference system.
</documentation>
</annotation>
<complexContent>
<restriction base="anyType">
<attribute name="gid" type="ID" use="optional"/>
<attribute name="srsName" type="anyURI" use="optional"/>
</restriction>
</complexContent>
</complexType>
<complexType name="AbstractGeometryCollectionBaseType" abstract="true">
<annotation>
<documentation>
This abstract base type for geometry collections just makes the
srsName attribute mandatory.
</documentation>
</annotation>
<complexContent>
<restriction base="gml:AbstractGeometryType">
<attribute name="gid" type="ID" use="optional"/>
<attribute name="srsName" type="anyURI" use="required"/>
</restriction>
</complexContent>
</complexType>
<attributeGroup name="AssociationAttributeGroup">
<annotation>
<documentation>
These attributes can be attached to any element, thus allowing it
to act as a pointer. The remoteSchema attribute allows an element
that carries link attributes to indicate that the element is declared
in a remote schema rather than by the schema that constrains the
current document instance.
</documentation>
</annotation>
<attributeGroup ref="xlink:simpleLink"/>
<attribute ref="gml:remoteSchema" use="optional"/>
</attributeGroup>
<complexType name="GeometryAssociationType">
<annotation>
<documentation>
An instance of this type (e.g. a geometryMember) can either
enclose or point to a primitive geometry element. When serving
as a simple link that references a remote geometry instance,
the value of the gml:remoteSchema attribute can be used to
locate a schema fragment that constrains the target instance.
</documentation>
</annotation>
<sequence minOccurs="0">
<element ref="gml:_Geometry"/>
</sequence>
<!-- <attributeGroup ref="gml:AssociationAttributeGroup"/> -->
<attributeGroup ref="xlink:simpleLink"/>
<attribute ref="gml:remoteSchema" use="optional"/>
</complexType>
<complexType name="PointMemberType">
<annotation>
<documentation>Restricts the geometry member to being a Point instance.</documentation>
</annotation>
<complexContent>
<restriction base="gml:GeometryAssociationType">
<sequence minOccurs="0">
<element ref="gml:Point"/>
</sequence>
<attributeGroup ref="gml:AssociationAttributeGroup"/>
</restriction>
</complexContent>
</complexType>
<complexType name="LineStringMemberType">
<annotation>
<documentation>Restricts the geometry member to being a LineString instance.</documentation>
</annotation>
<complexContent>
<restriction base="gml:GeometryAssociationType">
<sequence minOccurs="0">
<element ref="gml:LineString"/>
</sequence>
<attributeGroup ref="gml:AssociationAttributeGroup"/>
</restriction>
</complexContent>
</complexType>
<complexType name="PolygonMemberType">
<annotation>
<documentation>Restricts the geometry member to being a Polygon instance.</documentation>
</annotation>
<complexContent>
<restriction base="gml:GeometryAssociationType">
<sequence minOccurs="0">
<element ref="gml:Polygon"/>
</sequence>
<attributeGroup ref="gml:AssociationAttributeGroup"/>
</restriction>
</complexContent>
</complexType>
<complexType name="LinearRingMemberType">
<annotation>
<documentation>Restricts the outer or inner boundary of a polygon instance
to being a LinearRing.</documentation>
</annotation>
<complexContent>
<restriction base="gml:GeometryAssociationType">
<sequence minOccurs="0">
<element ref="gml:LinearRing"/>
</sequence>
<attributeGroup ref="gml:AssociationAttributeGroup"/>
</restriction>
</complexContent>
</complexType>
<!-- ==============================================================
primitive geometry types
=================================================================== -->
<complexType name="PointType">
<annotation>
<documentation>
A Point is defined by a single coordinate tuple.
</documentation>
</annotation>
<complexContent>
<extension base="gml:AbstractGeometryType">
<sequence>
<choice>
<element ref="gml:coord"/>
<element ref="gml:coordinates"/>
</choice>
</sequence>
</extension>
</complexContent>
</complexType>
<complexType name="LineStringType">
<annotation>
<documentation>
A LineString is defined by two or more coordinate tuples, with
linear interpolation between them.
</documentation>
</annotation>
<complexContent>
<extension base="gml:AbstractGeometryType">
<sequence>
<choice>
<element ref="gml:coord" minOccurs="2" maxOccurs="unbounded"/>
<element ref="gml:coordinates"/>
</choice>
</sequence>
</extension>
</complexContent>
</complexType>
<complexType name="LinearRingType">
<annotation>
<documentation>
A LinearRing is defined by four or more coordinate tuples, with
linear interpolation between them; the first and last coordinates
must be coincident.
</documentation>
</annotation>
<complexContent>
<extension base="gml:AbstractGeometryType">
<sequence>
<choice>
<element ref="gml:coord" minOccurs="4" maxOccurs="unbounded"/>
<element ref="gml:coordinates"/>
</choice>
</sequence>
</extension>
</complexContent>
</complexType>
<complexType name="BoxType">
<annotation>
<documentation>
The Box structure defines an extent using a pair of coordinate tuples.
</documentation>
</annotation>
<complexContent>
<extension base="gml:AbstractGeometryType">
<sequence>
<choice>
<element ref="gml:coord" minOccurs="2" maxOccurs="2"/>
<element ref="gml:coordinates"/>
</choice>
</sequence>
</extension>
</complexContent>
</complexType>
<complexType name="PolygonType">
<annotation>
<documentation>
A Polygon is defined by an outer boundary and zero or more inner
boundaries which are in turn defined by LinearRings.
</documentation>
</annotation>
<complexContent>
<extension base="gml:AbstractGeometryType">
<sequence>
<element ref="gml:outerBoundaryIs"/>
<element ref="gml:innerBoundaryIs" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</extension>
</complexContent>
</complexType>
<!-- ==============================================================
aggregate geometry types
=================================================================== -->
<complexType name="GeometryCollectionType">
<annotation>
<documentation>
A geometry collection must include one or more geometries, referenced
through geometryMember elements. User-defined geometry collections
that accept GML geometry classes as members must instantiate--or
derive from--this type.
</documentation>
</annotation>
<complexContent>
<extension base="gml:AbstractGeometryCollectionBaseType">
<sequence>
<element ref="gml:geometryMember" maxOccurs="unbounded"/>
</sequence>
</extension>
</complexContent>
</complexType>
<complexType name="MultiPointType">
<annotation>
<documentation>
A MultiPoint is defined by one or more Points, referenced through
pointMember elements.
</documentation>
</annotation>
<complexContent>
<restriction base="gml:GeometryCollectionType">
<sequence>
<element ref="gml:pointMember" maxOccurs="unbounded"/>
</sequence>
<attribute name="gid" type="ID" use="optional"/>
<attribute name="srsName" type="anyURI" use="required"/>
</restriction>
</complexContent>
</complexType>
<complexType name="MultiLineStringType">
<annotation>
<documentation>
A MultiLineString is defined by one or more LineStrings, referenced
through lineStringMember elements.
</documentation>
</annotation>
<complexContent>
<restriction base="gml:GeometryCollectionType">
<sequence>
<element ref="gml:lineStringMember" maxOccurs="unbounded"/>
</sequence>
<attribute name="gid" type="ID" use="optional"/>
<attribute name="srsName" type="anyURI" use="required"/>
</restriction>
</complexContent>
</complexType>
<complexType name="MultiPolygonType">
<annotation>
<documentation>
A MultiPolygon is defined by one or more Polygons, referenced through
polygonMember elements.
</documentation>
</annotation>
<complexContent>
<restriction base="gml:GeometryCollectionType">
<sequence>
<element ref="gml:polygonMember" maxOccurs="unbounded"/>
</sequence>
<attribute name="gid" type="ID" use="optional"/>
<attribute name="srsName" type="anyURI" use="required"/>
</restriction>
</complexContent>
</complexType>
<!-- ==============================================================
There are two ways to represent coordinates: (1) as a sequence
of <coord> elements that encapsulate tuples, or (2) using a
single <coordinates> string.
=================================================================== -->
<complexType name="CoordType">
<annotation>
<documentation>
Represents a coordinate tuple in one, two, or three dimensions.
</documentation>
</annotation>
<sequence>
<element name="X" type="decimal"/>
<element name="Y" type="decimal" minOccurs="0"/>
<element name="Z" type="decimal" minOccurs="0"/>
</sequence>
</complexType>
<complexType name="CoordinatesType">
<annotation>
<documentation>
Coordinates can be included in a single string, but there is no
facility for validating string content. The value of the cs attribute
is the separator for coordinate values, and the value of the ts
attribute gives the tuple separator (a single space by default); the
default values may be changed to reflect local usage.
</documentation>
</annotation>
<simpleContent>
<extension base="string">
<attribute name="decimal" type="string" use="optional" default="."/>
<attribute name="cs" type="string" use="optional" default=","/>
<attribute name="ts" type="string" use="optional" default=" "/>
</extension>
</simpleContent>
</complexType>
</schema> ';
amt := length(buf);
pos := 1;
DBMS_LOB.WRITE(schemaclob, amt, pos, buf);
DBMS_LOB.CLOSE(schemaclob);
COMMIT;
END;
/
SHOW ERRORS;
declare
usr varchar2(128);
url varchar2(200);
loc clob;
cnt number;
begin
usr := 'MDSYS';
url := 'http://www.opengis.net/gml/geometry.xsd';
-- First check whether the schema has been registered already.
-- If it has, de-register it. This might cause an error to be raised if
-- there are dependent tables or schemas. User then needs to manually
-- remove/evolve the depdendent objects and run this script again.
execute immediate
'SELECT count(*) FROM sys.dba_xml_schemas WHERE owner=:1 AND schema_url=:2'
into cnt using usr, url;
if cnt <> 0 then
dbms_xmlschema.deleteSchema(url, dbms_xmlschema.DELETE_CASCADE);
end if;
select xmlSchema into loc from MDSYS.SDO_XML_SCHEMAS
where id = 2;
-- register the schema
dbms_xmlschema.registerSchema(url,
loc, FALSE, FALSE, FALSE, FALSE, FALSE, usr);
end;
/
DECLARE
schemaclob CLOB;
amt NUMBER;
buf VARCHAR2(32767);
pos NUMBER;
BEGIN
DELETE FROM MDSYS.SDO_XML_SCHEMAS WHERE id=3;
INSERT INTO MDSYS.SDO_XML_SCHEMAS VALUES (3, 'GML:2.1.2 feature.xsd', empty_clob())
RETURNING xmlSchema into schemaclob;
SELECT xmlSchema into schemaclob from MDSYS.SDO_XML_SCHEMAS
WHERE id = 3 FOR UPDATE;
DBMS_LOB.OPEN(schemaclob, DBMS_LOB.LOB_READWRITE);
buf := '<?xml version="1.0" encoding="UTF-8"?>
<schema targetNamespace="http://www.opengis.net/gml"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:gml="http://www.opengis.net/gml"
xmlns:xlink="http://www.w3.org/1999/xlink"
elementFormDefault="qualified" version="2.1.2">
<annotation>
<appinfo>feature.xsd v2.1.2 2002-07</appinfo>
<documentation xml:lang="en">
GML Feature schema. Copyright (c) 2002 OGC, All Rights Reserved.
</documentation>
</annotation>
<!-- include constructs from the GML Geometry schema -->
<include schemaLocation="http://www.opengis.net/gml/geometry.xsd"/>
<!-- bring in the XLink namespace -->
<import namespace="http://www.w3.org/1999/xlink" schemaLocation="http://www.w3.org/1999/xlink/xlinks.xsd"/>
<!-- ==============================================================
global declarations
=================================================================== -->
<element name="_Feature" type="gml:AbstractFeatureType" abstract="true"/>
<element name="_FeatureCollection" type="gml:AbstractFeatureCollectionType" abstract="true" substitutionGroup="gml:_Feature"/>
<element name="featureMember" type="gml:FeatureAssociationType"/>
<!-- some basic geometric properties of features -->
<element name="_geometryProperty" type="gml:GeometryAssociationType" abstract="true"/>
<element name="geometryProperty" type="gml:GeometryAssociationType"/>
<element name="boundedBy" type="gml:BoundingShapeType"/>
<element name="pointProperty" type="gml:PointPropertyType" substitutionGroup="gml:_geometryProperty"/>
<element name="polygonProperty" type="gml:PolygonPropertyType" substitutionGroup="gml:_geometryProperty"/>
<element name="lineStringProperty" type="gml:LineStringPropertyType" substitutionGroup="gml:_geometryProperty"/>
<element name="multiPointProperty" type="gml:MultiPointPropertyType" substitutionGroup="gml:_geometryProperty"/>
<element name="multiLineStringProperty" type="gml:MultiLineStringPropertyType" substitutionGroup="gml:_geometryProperty"/>
<element name="multiPolygonProperty" type="gml:MultiPolygonPropertyType" substitutionGroup="gml:_geometryProperty"/>
<element name="multiGeometryProperty" type="gml:MultiGeometryPropertyType" substitutionGroup="gml:_geometryProperty"/>
<!-- common aliases for geometry properties -->
<element name="location" type="gml:PointPropertyType" substitutionGroup="gml:pointProperty"/>
<element name="centerOf" type="gml:PointPropertyType" substitutionGroup="gml:pointProperty"/>
<element name="position" type="gml:PointPropertyType" substitutionGroup="gml:pointProperty"/>
<element name="extentOf" type="gml:PolygonPropertyType" substitutionGroup="gml:polygonProperty"/>
<element name="coverage" type="gml:PolygonPropertyType" substitutionGroup="gml:polygonProperty"/>
<element name="edgeOf" type="gml:LineStringPropertyType" substitutionGroup="gml:lineStringProperty"/>
<element name="centerLineOf" type="gml:LineStringPropertyType" substitutionGroup="gml:lineStringProperty"/>
<element name="multiLocation" type="gml:MultiPointPropertyType" substitutionGroup="gml:multiPointProperty"/>
<element name="multiCenterOf" type="gml:MultiPointPropertyType" substitutionGroup="gml:multiPointProperty"/>
<element name="multiPosition" type="gml:MultiPointPropertyType" substitutionGroup="gml:multiPointProperty"/>
<element name="multiCenterLineOf" type="gml:MultiLineStringPropertyType" substitutionGroup="gml:multiLineStringProperty"/>
<element name="multiEdgeOf" type="gml:MultiLineStringPropertyType" substitutionGroup="gml:multiLineStringProperty"/>
<element name="multiCoverage" type="gml:MultiPolygonPropertyType" substitutionGroup="gml:multiPolygonProperty"/>
<element name="multiExtentOf" type="gml:MultiPolygonPropertyType" substitutionGroup="gml:multiPolygonProperty"/>
<!-- common feature descriptors -->
<element name="description" type="string"/>
<element name="name" type="string"/>
<!-- ==============================================================
abstract supertypes
=================================================================== -->
<complexType name="AbstractFeatureType" abstract="true">
<annotation>
<documentation>
An abstract feature provides a set of common properties. A concrete
feature type must derive from this type and specify additional
properties in an application schema. A feature may optionally
possess an identifying attribute (fid).
</documentation>
</annotation>
<sequence>
<element ref="gml:description" minOccurs="0"/>
<element ref="gml:name" minOccurs="0"/>
<element ref="gml:boundedBy" minOccurs="0"/>
<!-- additional properties must be specified in an application schema -->
</sequence>
<attribute name="fid" type="ID" use="optional"/>
</complexType>
<complexType name="AbstractFeatureCollectionBaseType" abstract="true">
<annotation>
<documentation>
This abstract base type just makes the boundedBy element mandatory
for a feature collection.
</documentation>
</annotation>
<complexContent>
<restriction base="gml:AbstractFeatureType">
<sequence>
<element ref="gml:description" minOccurs="0"/>
<element ref="gml:name" minOccurs="0"/>
<element ref="gml:boundedBy"/>
</sequence>
<attribute name="fid" type="ID" use="optional"/>
</restriction>
</complexContent>
</complexType>
<complexType name="AbstractFeatureCollectionType" abstract="true">
<annotation>
<documentation>
A feature collection contains zero or more featureMember elements.
</documentation>
</annotation>
<complexContent>
<extension base="gml:AbstractFeatureCollectionBaseType">
<sequence>
<element ref="gml:featureMember" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</extension>
</complexContent>
</complexType>
<complexType name="GeometryPropertyType">
<annotation>
<documentation>
A simple geometry property encapsulates a geometry element.
Alternatively, it can function as a pointer (simple-type link)
that refers to a remote geometry element.
</documentation>
</annotation>
<sequence minOccurs="0">
<element ref="gml:_Geometry"/>
</sequence>
<attributeGroup ref="xlink:simpleLink"/>
<attribute ref="gml:remoteSchema" use="optional"/>
</complexType>
<complexType name="FeatureAssociationType">
<annotation>
<documentation>
An instance of this type (e.g. a featureMember) can either
enclose or point to a feature (or feature collection); this
type can be restricted in an application schema to allow only
specified features as valid participants in the association.
When serving as a simple link that references a remote feature
instance, the value of the gml:remoteSchema attribute can be
used to locate a schema fragment that constrains the target
instance.
</documentation>
</annotation>
<sequence minOccurs="0">
<element ref="gml:_Feature"/>
</sequence>
<attributeGroup ref="xlink:simpleLink"/>
<attribute ref="gml:remoteSchema" use="optional"/>
</complexType>
<complexType name="BoundingShapeType">
<annotation>
<documentation>
Bounding shapes--a Box or a null element are currently allowed.
</documentation>
</annotation>
<sequence>
<choice>
<element ref="gml:Box"/>
<element name="null" type="gml:NullType"/>
</choice>
</sequence>
</complexType>
<!-- ==============================================================
geometry properties
=================================================================== -->
<complexType name="PointPropertyType">
<annotation>
<documentation>
Encapsulates a single point to represent position, location, or
centerOf properties.
</documentation>
</annotation>
<complexContent>
<restriction base="gml:GeometryAssociationType">
<sequence minOccurs="0">
<element ref="gml:Point"/>
</sequence>
<attributeGroup ref="xlink:simpleLink"/>
<attribute ref="gml:remoteSchema" use="optional"/>
</restriction>
</complexContent>
</complexType>
<complexType name="PolygonPropertyType">
<annotation>
<documentation>
Encapsulates a single polygon to represent coverage or extentOf
properties.
</documentation>
</annotation>
<complexContent>
<restriction base="gml:GeometryAssociationType">
<sequence minOccurs="0">
<element ref="gml:Polygon"/>
</sequence>
<attributeGroup ref="xlink:simpleLink"/>
<attribute ref="gml:remoteSchema" use="optional"/>
</restriction>
</complexContent>
</complexType>
<complexType name="LineStringPropertyType">
<annotation>
<documentation>
Encapsulates a single LineString to represent centerLineOf or
edgeOf properties.
</documentation>
</annotation>
<complexContent>
<restriction base="gml:GeometryAssociationType">
<sequence minOccurs="0">
<element ref="gml:LineString"/>
</sequence>
<attributeGroup ref="xlink:simpleLink"/>
<attribute ref="gml:remoteSchema" use="optional"/>
</restriction>
</complexContent>
</complexType>
<complexType name="MultiPointPropertyType">
<annotation>
<documentation>
Encapsulates a MultiPoint element to represent the following
discontiguous geometric properties: multiLocation, multiPosition,
multiCenterOf.
</documentation>
</annotation>
<complexContent>
<restriction base="gml:GeometryAssociationType">
<sequence minOccurs="0">
<element ref="gml:MultiPoint"/>
</sequence>
<attributeGroup ref="xlink:simpleLink"/>
<attribute ref="gml:remoteSchema" use="optional"/>
</restriction>
</complexContent>
</complexType>
<complexType name="MultiLineStringPropertyType">
<annotation>
<documentation>
Encapsulates a MultiLineString element to represent the following
discontiguous geometric properties: multiEdgeOf, multiCenterLineOf.
</documentation>
</annotation>
<complexContent>
<restriction base="gml:GeometryAssociationType">
<sequence minOccurs="0">
<element ref="gml:MultiLineString"/>
</sequence>
<attributeGroup ref="xlink:simpleLink"/>
<attribute ref="gml:remoteSchema" use="optional"/>
</restriction>
</complexContent>
</complexType>
<complexType name="MultiPolygonPropertyType">
<annotation>
<documentation>
Encapsulates a MultiPolygon to represent the following discontiguous
geometric properties: multiCoverage, multiExtentOf.
</documentation>
</annotation>
<complexContent>
<restriction base="gml:GeometryAssociationType">
<sequence minOccurs="0">
<element ref="gml:MultiPolygon"/>
</sequence>
<attributeGroup ref="xlink:simpleLink"/>
<attribute ref="gml:remoteSchema" use="optional"/>
</restriction>
</complexContent>
</complexType>
<complexType name="MultiGeometryPropertyType">
<annotation>
<documentation>Encapsulates a MultiGeometry element.</documentation>
</annotation>
<complexContent>
<restriction base="gml:GeometryAssociationType">
<sequence minOccurs="0">
<element ref="gml:MultiGeometry"/>
</sequence>
<attributeGroup ref="xlink:simpleLink"/>
<attribute ref="gml:remoteSchema" use="optional"/>
</restriction>
</complexContent>
</complexType>
<simpleType name="NullType">
<annotation>
<documentation>
If a bounding shape is not provided for a feature collection,
explain why. Allowable values are:
innapplicable - the features do not have geometry
unknown - the boundingBox cannot be computed
unavailable - there may be a boundingBox but it is not divulged
missing - there are no features
</documentation>
</annotation>
<restriction base="string">
<enumeration value="inapplicable"/>
<enumeration value="unknown"/>
<enumeration value="unavailable"/>
<enumeration value="missing"/>
</restriction>
</simpleType>
</schema> ';
amt := length(buf);
pos := 1;
DBMS_LOB.WRITE(schemaclob, amt, pos, buf);
DBMS_LOB.CLOSE(schemaclob);
COMMIT;
END;
/
SHOW ERRORS;
declare
usr varchar2(128);
url varchar2(200);
loc clob;
cnt number;
begin
usr := 'MDSYS';
url := 'http://www.opengis.net/gml/feature.xsd';
-- First check whether the schema has been registered already.
-- If it has, de-register it. This might cause an error to be raised if
-- there are dependent tables or schemas. User then needs to manually
-- remove/evolve the depdendent objects and run this script again.
execute immediate
'SELECT count(*) FROM sys.dba_xml_schemas WHERE owner=:1 AND schema_url=:2'
into cnt using usr, url;
if cnt <> 0 then
dbms_xmlschema.deleteSchema(url, dbms_xmlschema.DELETE_CASCADE);
end if;
select xmlSchema into loc from MDSYS.SDO_XML_SCHEMAS
where id = 3;
-- register the schema
dbms_xmlschema.registerSchema(url,
loc, FALSE, FALSE, FALSE, FALSE, FALSE, usr);
end;
/
commit;
-- register the schema
DECLARE
schemaclob CLOB;
amt NUMBER;
buf VARCHAR2(32767);
pos NUMBER;
BEGIN
DELETE FROM MDSYS.SDO_XML_SCHEMAS WHERE id=4;
INSERT INTO MDSYS.SDO_XML_SCHEMAS VALUES (4, 'EPSG sdoepsggrid.xsd', empty_clob())
RETURNING xmlSchema into schemaclob;
SELECT xmlSchema into schemaclob from MDSYS.SDO_XML_SCHEMAS
WHERE id = 4 FOR UPDATE;
DBMS_LOB.OPEN(schemaclob, DBMS_LOB.LOB_READWRITE);
buf := '<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSPY v2004 rel. 4 U (http://www.xmlspy.com) by MIKE HORHAMMER (ORACLE CORPORATION) -->
<xs:schema targetNamespace="http://www.oracle.com/2004/spatial/epsg/gridfile/schema" elementFormDefault="qualified" attributeFormDefault="unqualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.oracle.com/2004/spatial/epsg/gridfile/schema">
<xs:element name="GridFile">
<xs:annotation>
<xs:documentation>Root element describing the grid or set of grids used for a particular transformation</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:complexContent>
<xs:extension base="GridFileType">
<xs:attributeGroup ref="DateAttributeGroup"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:complexType name="GridFileType">
<xs:annotation>
<xs:documentation>Root element describing the grid or set of grids used for a particular transformation</xs:documentation>
</xs:annotation>
<xs:all>
<xs:element name="Grids">
<xs:annotation>
<xs:documentation>This represents a flat list of grids. Hierarchies can be imposed on the grids in a separate structure within each Grid.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="Grid" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation>Represents a single grid, of which a grid file might have several</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:complexContent>
<xs:extension base="GridType">
<xs:attribute name="gridName" type="xs:string" use="optional"/>
<xs:attribute name="id" type="xs:ID" use="optional"/>
<xs:attributeGroup ref="DateAttributeGroup"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:all>
</xs:complexType>
<xs:complexType name="CoordinatesType">
<xs:annotation>
<xs:documentation>Combines several coordinates (usually 2) to one vector</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="Coordinate" type="SingleCoordinateType" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation>Coordinate (based on source coordinate reference system)</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="GridType">
<xs:annotation>
<xs:documentation>Represents a single grid, of which a grid file might have several</xs:documentation>
</xs:annotation>
<xs:all>
<xs:element name="GridProperties" type="GridPropertiesType">
<xs:annotation>
<xs:documentation>Grid position, size, and resolution/density</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="GridData" type="GridDataType">
<xs:annotation>
<xs:documentation>The grid offset data</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="HierarchyParticipation">
<xs:complexType>
<xs:sequence>
<xs:element name="Parent" type="ParentType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:all>
</xs:complexType>
<xs:complexType name="GridNodeType">
<xs:annotation>
<xs:documentation>One single node in the grid, describing the offset at on point</xs:documentation>
</xs:annotation>
<xs:all>
<xs:element name="Offset" type="CoordinatesType">
<xs:annotation>
<xs:documentation>Coordinate offset</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="OffsetPrecision" type="CoordinatesType">
<xs:annotation>
<xs:documentation>This represents the precision of the offset. The precision is represented as the maximum absolute error, given in the same unit of measure as the offset itself. If the local precision within the grid is unknown, the global maximum possible error shall be quoted. Data with unbounded (unknown) possible error would be worthless, thus some quote of precision is mandatory. If the original data source does not explicitly specify precision, but is reputed to be of high quality, an absolute error of 0 (perfect precision) shall be quoted.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:all>
</xs:complexType>
<xs:complexType name="GridPropertiesType">
<xs:annotation>
<xs:documentation>Grid position, size, and resolution/density</xs:documentation>
</xs:annotation>
<xs:all>
<xs:element name="MinCoords" type="CoordinatesType">
<xs:annotation>
<xs:documentation>Lower left corner of the grid (coordinates based on source coordinate reference system)</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="MaxCoords" type="CoordinatesType">
<xs:annotation>
<xs:documentation>Upper right corner of the grid (coordinates based on source coordinate reference system)</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="CoordSpacing" type="CoordinatesType">
<xs:annotation>
<xs:documentation>Grid resolution/density (unit of measure based on source coordinate reference system)</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="CoordinateUnitOfMeasure" type="UnitOfMeasureType"/>
</xs:all>
</xs:complexType>
<xs:complexType name="GridLineType">
<xs:annotation>
<xs:documentation>One single horizontal line within the grid</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="GridNode" type="GridNodeType" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation>One single node in the grid, describing the offset at one point</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:simpleType name="SingleCoordinateType">
<xs:annotation>
<xs:documentation>Represents a single coordinate; the unit depends on the elsewhere specified source coordinate reference system</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string"/>
</xs:simpleType>
<xs:simpleType name="crsType">
<xs:annotation>
<xs:documentation>Represents a coordinate reference system (identified by EPSG id)</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:long"/>
</xs:simpleType>
<xs:simpleType name="tfmType">
<xs:annotation>
<xs:documentation>Represents a transformation (identified by EPSG id)</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:long"/>
</xs:simpleType>
<xs:complexType name="GridApplicationType">
<xs:annotation>
<xs:documentation>Defines a single transformation, with source and target CRS, using this grid file</xs:documentation>
</xs:annotation>
<xs:all>
<xs:element name="sourceCrs" type="crsType">
<xs:annotation>
<xs:documentation>The source coordinate reference system</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="Transformation" type="tfmType">
<xs:annotation>
<xs:documentation>The transformation using this grid file</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="targetCrs" type="crsType">
<xs:annotation>
<xs:documentation>The target coordinate reference system</xs:documentation>
</xs:annotation>
</xs:element>
</xs:all>
</xs:complexType>
<xs:complexType name="GridApplicationsType">
<xs:annotation>
<xs:documentation>Defines the set of transformations using this grid file</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="GridApplication" type="GridApplicationType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ParentType">
<xs:annotation>
<xs:documentation>Specifies a hierarchy that the grid is member of, and its parent within that hierarchy</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="HierarchyType" type="xs:anyURI">
<xs:annotation>
<xs:documentation>Specifies the hierarchy URI</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="ParentNode" type="xs:IDREF" nillable="true">
<xs:annotation>
<xs:documentation>Specifies the parent node IDREF</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:attributeGroup name="DateAttributeGroup">
<xs:annotation>
<xs:documentation>Defines creation and update date and time</xs:documentation>
</xs:annotation>
<xs:attribute name="creation" type="xs:dateTime" use="required"/>
<xs:attribute name="update" type="xs:dateTime" use="required"/>
</xs:attributeGroup>
<xs:complexType name="GridDataType">
<xs:sequence>
<xs:element name="GridRow" type="GridLineType" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation>One single (horizontal) row within the grid (all rows have the same number of nodes)</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="UnitOfMeasureType">
<xs:sequence>
<xs:element name="UnitOfMeasureType" nillable="false">
<xs:annotation>
<xs:documentation>The unit type (length or angle)</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="length"/>
<xs:enumeration value="angle"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="UnitOfMeasureId" type="xs:long" nillable="false">
<xs:annotation>
<xs:documentation>The EPSG unit ID</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="UnitOfMeasureFactor" type="xs:double" nillable="false">
<xs:annotation>
<xs:documentation>How many base units are equal to one of these units? The base unit of length is meter, the base unit of angle is radians.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:schema>';
amt := length(buf);
pos := 1;
DBMS_LOB.WRITE(schemaclob, amt, pos, buf);
DBMS_LOB.CLOSE(schemaclob);
COMMIT;
END;
/
SHOW ERRORS;
declare
usr varchar2(128);
url varchar2(200);
loc clob;
cnt number;
begin
usr := 'MDSYS';
url := 'http://www.oracle.com/2004/spatial/epsg/gridfile/schema/sdoepsggrid.xsd';
execute immediate
'SELECT count(*) FROM sys.dba_xml_schemas WHERE owner=:1 AND schema_url=:2'
into cnt using usr, url;
if(cnt <> 0) then
dbms_xmlschema.deleteSchema(url, dbms_xmlschema.DELETE_CASCADE);
end if;
select xmlSchema into loc from MDSYS.SDO_XML_SCHEMAS where id = 4;
-- DBMS_XMLSCHEMA.registerSchema(
-- SCHEMAURL => url,
-- SCHEMADOC => loc,
-- LOCAL => FALSE,
-- GENTYPES => FALSE,
-- GENBEAN => FALSE,
-- GENTABLES => FALSE,
-- FORCE => FALSE,
-- OWNER => 'MDSYS');
end;
/
commit;
-- register the schema
DECLARE
schemaclob CLOB;
amt NUMBER;
buf VARCHAR2(32767);
pos NUMBER;
BEGIN
DELETE FROM MDSYS.SDO_XML_SCHEMAS WHERE id=6;
INSERT INTO MDSYS.SDO_XML_SCHEMAS VALUES (6, 'libLAS liblas.xsd', empty_clob())
RETURNING xmlSchema into schemaclob;
SELECT xmlSchema into schemaclob from MDSYS.SDO_XML_SCHEMAS
WHERE id = 6 FOR UPDATE;
DBMS_LOB.OPEN(schemaclob, DBMS_LOB.LOB_READWRITE);
buf := '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xs:schema xmlns:las="http://liblas.org/schemas/LAS/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://liblas.org/schemas/LAS/1.0" version="1.0">
<xs:simpleType name="sizeType">
<xs:annotation>
<xs:documentation>
The storage size type of the dimension.
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:enumeration value="byte"/>
<xs:enumeration value="bit"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="interpretationType">
<xs:annotation>
<xs:documentation>
Common interpretations of the data that may be used. This
type may be extended under the expectation that clients
know how to consume the data. In the case of string-like
data, use uint8_t (common byte) as the interpretation
and transform accordingly. Because nulls (or even
multi-byte strings) might be allowed, there are
no common string interpretations provided by defaut.
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:enumeration value="int8_t"/>
<xs:enumeration value="uint8_t"/>
<xs:enumeration value="int16_t"/>
<xs:enumeration value="uint16_t"/>
<xs:enumeration value="int32_t"/>
<xs:enumeration value="uint32_t"/>
<xs:enumeration value="int64_t"/>
<xs:enumeration value="uint64_t"/>
<xs:enumeration value="double"/>
<xs:enumeration value="float"/>
<xs:enumeration value="unknown"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="rangeType">
<xs:attribute name="units" type="las:interpretationType"/>
<xs:attribute name="value" type="xs:decimal"/>
</xs:complexType>
<xs:complexType name="dimensionType">
<xs:all>
<xs:element name="position" type="xs:nonNegativeInteger">
<xs:annotation>
<xs:documentation>
The dimension''s position in the block of point data
(counting from 0)
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="size" type="xs:nonNegativeInteger">
<xs:annotation>
<xs:documentation>
The size of this dimension (assumed to be in bytes if
no units element is available).
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="required" type="xs:boolean">
<xs:annotation>
<xs:documentation>
Is this dimension required by the LAS Point Format?
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" name="name" type="xs:string"/>
<xs:element minOccurs="0" name="description" type="xs:string"/>
<xs:element minOccurs="0" name="active" type="xs:boolean">
<xs:annotation>
<xs:documentation>
A dimension may have be holding its place in bytes but
might not have actual values that mean anything. This flag
can be used to skip the dimension in that case.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" name="units" type="las:sizeType">
<xs:annotation>
<xs:documentation>
The units to use for size measurements for this
dimension. If no units element is specified, "bytes"
is the assumed unit.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" name="interpretation" type="las:interpretationType">
<xs:annotation>
<xs:documentation>
This element describes how the data should be
interpreted. In the case of conflicting data, for
example when then size is 2, the units "byte", but the
interpretation is "uint32_t", the size determines how
much precision is available.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" name="minimum" type="las:rangeType">
<xs:annotation>
<xs:documentation>
The minimum value of this dimension.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" name="maximum" type="las:rangeType">
<xs:annotation>
<xs:documentation>
The maximum value of this dimension.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" name="offset" type="xs:double">
<xs:annotation>
<xs:documentation>
The double offset to use when applying a scaling
factor to an integer dimension
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" name="scale" type="xs:double">
<xs:annotation>
<xs:documentation>
The scale (usually a negative log10 exponent) of this
dimension. Used to support scaled integer types
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" name="byteOffset" type="xs:nonNegativeInteger">
<xs:annotation>
<xs:documentation>
The byte offset to start reading this dimension from
the front of the point record.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" name="bitOffset" type="xs:nonNegativeInteger">
<xs:annotation>
<xs:documentation>
The bit offset to start reading this dimension from the
calculated (or specified, using byteOffset) byte offset
of the dimension.
</xs:documentation>
</xs:annotation>
</xs:element>
</xs:all>
</xs:complexType>
<xs:element name="LASSchema">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="1" name="dimension" type="las:dimensionType"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>';
amt := length(buf);
pos := 1;
DBMS_LOB.WRITE(schemaclob, amt, pos, buf);
DBMS_LOB.CLOSE(schemaclob);
COMMIT;
END;
/
SHOW ERRORS;
-- /*
-- declare
-- usr varchar2(128);
-- url varchar2(200);
-- loc clob;
-- cnt number;
-- begin
-- usr := 'MDSYS';
-- url := 'http://hg.liblas.org/main/raw-file/6999ba4b7238/schemas/LAS.xsd';
--
-- execute immediate
-- 'SELECT count(*) FROM sys.dba_xml_schemas WHERE owner=:1 AND schema_url=:2'
-- into cnt using usr, url;
-- if(cnt <> 0) then
-- dbms_xmlschema.deleteSchema(url, dbms_xmlschema.DELETE_INVALIDATE);
-- end if;
--
-- select xmlSchema into loc from SDO_XML_SCHEMAS where id = 6;
--
-- DBMS_XMLSCHEMA.registerSchema(
-- SCHEMAURL => url,
-- SCHEMADOC => loc,
-- LOCAL => FALSE,
-- OWNER => 'MDSYS');
-- end;
-- /
--
-- SHOW ERRORS;
-- */
commit;
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
declare
usr varchar2(128);
url varchar2(200);
loc clob;
cnt number;
begin
usr := 'MDSYS';
url := 'http://www.oracle.com/2009/spatial/vis3d/schema/sdo3d.xsd';
execute immediate
'SELECT count(*) FROM sys.dba_xml_schemas WHERE owner=:1 AND schema_url=:2'
into cnt using usr, url;
if(cnt <> 0) then
dbms_xmlschema.deleteSchema(url, dbms_xmlschema.DELETE_CASCADE);
end if;
end;
/
-- register the schema
DECLARE
schemaclob CLOB;
amt NUMBER;
buf VARCHAR2(32767);
pos NUMBER;
BEGIN
DELETE FROM MDSYS.SDO_XML_SCHEMAS WHERE id=5;
INSERT INTO MDSYS.SDO_XML_SCHEMAS VALUES (5, 'EPSG sdo3d.xsd', empty_clob())
RETURNING xmlSchema into schemaclob;
SELECT xmlSchema into schemaclob from MDSYS.SDO_XML_SCHEMAS
WHERE id = 5 FOR UPDATE;
DBMS_LOB.OPEN(schemaclob, DBMS_LOB.LOB_READWRITE);
buf := '<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSPY v2004 rel. 4 U (http://www.xmlspy.com) by MIKE HORHAMMER (ORACLE CORPORATION) -->
<!-- 2011-02-11 11:44 -->
<xs:schema targetNamespace="http://xmlns.oracle.com/spatial/vis3d/2011/sdovis3d.xsd" elementFormDefault="qualified" attributeFormDefault="unqualified" xmlns:vis3d="http://xmlns.oracle.com/spatial/vis3d/2011/sdovis3d.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:las="http://liblas.org/schemas/LAS/1.0">
<xs:import namespace="http://liblas.org/schemas/LAS/1.0" schemaLocation="http://hg.liblas.org/main/raw-file/6999ba4b7238/schemas/LAS.xsd"/>
<xs:element name="sdoPcObjectMetadata">
<xs:annotation>
<xs:documentation>Oracle Point Cloud Object Metadata</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element ref="las:LASSchema"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="style3d" type="vis3d:style3dType">
<xs:annotation>
<xs:documentation>Declares a 3D style, with color, texture, and model style</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="theme3d">
<xs:annotation>
<xs:documentation>Declares a theme, with default style(s) and a reference to the theme with the next (lower) LOD level</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:complexContent>
<xs:extension base="vis3d:theme3dType">
<xs:attribute name="themeType" use="required">
<xs:simpleType name="sdoThemeType">
<xs:restriction base="xs:string">
<xs:enumeration value="SDO_GEOMETRY"/>
<xs:enumeration value="SDO_PC"/>
<xs:enumeration value="SDO_TIN"/>
<xs:enumeration value="SDO_GEORASTER"/>
<xs:enumeration value="EXTERNAL_MAP_TILES"/>
<xs:enumeration value="EXTERNAL_WMS"/>
<xs:enumeration value="EXTERNAL_WFS"/>
<xs:enumeration value="EXTERNAL_WCS"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:element name="scene3d" type="vis3d:scene3dType">
<xs:annotation>
<xs:documentation>Declares a scene, with multiple themes</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="viewFrame3d" type="vis3d:viewFrame3dType">
<xs:annotation>
<xs:documentation>Declares a view frame, specifying a scene and a view point</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="viewPoint3d" type="vis3d:viewPoint3dType">
<xs:annotation>
<xs:documentation>Declares a view point</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="animation3d" type="vis3d:animation3dType"/>
<xs:element name="lightSource3d">
<xs:complexType>
<xs:attribute name="lightSourceType" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="AMBIENT"/>
<xs:enumeration value="DIRECTIONAL"/>
<xs:enumeration value="POINT"/>
<xs:enumeration value="SPOT"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="foreignKey" type="xs:string">
<xs:annotation>
<xs:documentation>Foreign key for joining consumer table with target table</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="defaultStyle" type="vis3d:style3dType">
<xs:annotation>
<xs:documentation>This refers to style descriptions, such as color, texture, model style, etc.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="vis3DConfig" type="vis3d:vis3DConfigType"/>
<xs:element name="pointCloudObjectMD" type="vis3d:pointCloudObjectMDType">
<xs:annotation>
<xs:documentation>Object-level point cloud metadata</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="tinObjectMD" type="vis3d:tinObjectMDType">
<xs:annotation>
<xs:documentation>Object-level TIN metadata</xs:documentation>
</xs:annotation>
</xs:element>
<xs:complexType name="animation3dType">
<xs:sequence>
<xs:element name="sceneName" type="xs:string"/>
<xs:element ref="vis3d:viewPoint3d" maxOccurs="unbounded"/>
<xs:element ref="vis3d:defaultStyle" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="closedLoop" type="xs:boolean" use="optional" default="false"/>
</xs:complexType>
<xs:complexType name="style3dType">
<xs:annotation>
<xs:documentation>Version 08-07-15</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="color" type="vis3d:sharedValueType" minOccurs="0">
<xs:annotation>
<xs:documentation>Stored in DB as VARCHAR2 or SDO_ORDINATE_ARRAY</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="elevationColor" minOccurs="0">
<xs:annotation>
<xs:documentation>Features can be colored, based on elevation. This may be applicable to PCs, TINs, and SDO_GEOMETRY features.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="colorAtElevation" minOccurs="2" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="elevation" type="xs:double" use="required">
<xs:annotation>
<xs:documentation>Elevation in the vertical unit of measure of the Theme SRID</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="color" type="xs:hexBinary" use="required">
<xs:annotation>
<xs:documentation>Color in 6 digit hex (RGB), or 8-digit for RGBalpha</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="interpolateColors" type="xs:boolean" use="required">
<xs:annotation>
<xs:documentation>If colors are interpolated, each "ColorAtElevation" node defines the color exactly at its given "height". Any colors in between are interpolated.
If colors are not interpolated, each "ColorAtElevation" node defines the color from (including) its given "height", up to (excluding) the "height" of the next node.
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="texture" type="vis3d:textureType" minOccurs="0">
<xs:annotation>
<xs:documentation>This describes a texture for a geometry. For now, it only represents a single texture, as opposed to multiple textures being superimposed. Also, alpha maps and bump maps are not yet mentioned. They will be added, subsequently. Another aspect is that this schema currently only maps a single texture image per geometry. To map a separate facade to each wall of a building, the facades simply get aggregated into a single bitmap file. The texture coordinates link facades to walls.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="modelStyle" type="vis3d:featureReferenceType" minOccurs="0">
<xs:annotation>
<xs:documentation>Model object is applied to an oriented point. The model object has SRID null (euclidean). It is applied to the oriented point, such that the euclidean origin coincides with the point, its z-axis coincides with the orientation vector of the point, and scaling is performed, such that the orientation vector represents one unit in the model object euclidean CRS.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="normals" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="generateNormals" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="textureType">
<xs:annotation>
<xs:documentation>Version 08-07-15</xs:documentation>
</xs:annotation>
<xs:choice>
<xs:sequence>
<xs:element name="textureBLOB" type="vis3d:sharedValueType">
<xs:annotation>
<xs:documentation>Stored in DB as BLOB</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="textureCoordinates" type="vis3d:sharedValueType" minOccurs="0">
<xs:annotation>
<xs:documentation>Stored in DB as SDO_ORDINATE_ARRAY. Label Strings are not required, in this xsd, since we assume a texture coordinate array for the entire geometry. The database can supply tools to update texture coordinate arrays, using label strings.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
<xs:element name="textureMapTiles" type="vis3d:mapTileThemeMDType"/>
<xs:element name="textureGeoRaster" type="vis3d:georasterThemeMDType"/>
</xs:choice>
</xs:complexType>
<xs:complexType name="theme3dType">
<xs:sequence>
<xs:element name="lod" type="vis3d:lodType">
<xs:annotation>
<xs:documentation>This declares Level Of Detail information, as well as a reference to the next less detailed LOD theme within a chain.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element ref="vis3d:defaultStyle"/>
<xs:element name="hidden_info" type="vis3d:hidden_infoType" minOccurs="0">
<xs:annotation>
<xs:documentation>This refers to optional attribute columns</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="alternativeRepresentations" type="vis3d:alternativeRepresentationsType" minOccurs="0">
<xs:annotation>
<xs:documentation>This describes optional external representations, such as CityGML</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="typeSpecificMD" type="vis3d:typeSpecificMDType"/>
</xs:sequence>
<xs:attribute name="srid" type="xs:integer" use="optional"/>
</xs:complexType>
<xs:complexType name="sharedValueType">
<xs:sequence>
<xs:element ref="vis3d:foreignKey" minOccurs="0"/>
<xs:element name="valueColumn" type="xs:string">
<xs:annotation>
<xs:documentation>Name of value column in target table</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="vector3dType">
<xs:attribute name="x" type="xs:double" use="required"/>
<xs:attribute name="y" type="xs:double" use="required"/>
<xs:attribute name="z" type="xs:double" use="required"/>
</xs:complexType>
<xs:complexType name="viewPoint3dType">
<xs:sequence>
<xs:element name="eye" type="vis3d:vector3dType">
<xs:annotation>
<xs:documentation>The location of the eye</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="center" type="vis3d:vector3dType">
<xs:annotation>
<xs:documentation>The point where the eye is looking</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="up" type="vis3d:vector3dType">
<xs:annotation>
<xs:documentation>The up vector specifying the frustum up direction</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="frustum3d" type="vis3d:frustum3dType" minOccurs="0">
<xs:annotation>
<xs:documentation>The frustum establishes a view model with the eye at the apex of a symmetric view frustum</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
<xs:attribute name="srid" type="xs:integer" use="optional"/>
<xs:attribute name="fadeIn" type="xs:integer" use="optional" default="1">
<xs:annotation>
<xs:documentation>Fade in in ms</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="pause" type="xs:integer" use="optional" default="1">
<xs:annotation>
<xs:documentation>Pause in ms</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="fadeOut" type="xs:integer" use="optional" default="1">
<xs:annotation>
<xs:documentation>Fade out in ms</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<xs:complexType name="viewFrame3dType">
<xs:sequence>
<xs:element name="sceneName" type="xs:string"/>
<xs:element ref="vis3d:viewPoint3d"/>
<xs:element ref="vis3d:defaultStyle" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="frustum3dType">
<xs:annotation>
<xs:documentation>The frustum establishes a view model with the eye at the apex of a symmetric view frustum</xs:documentation>
</xs:annotation>
<xs:attribute name="left" type="xs:double" use="required">
<xs:annotation>
<xs:documentation>The vertical line on the left edge of the near clipping plane mapped to the left edge of the graphics window</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="right" type="xs:double" use="required">
<xs:annotation>
<xs:documentation>The vertical line on the right edge of the near clipping plane mapped to the right edge of the graphics window</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="bottom" type="xs:double" use="required">
<xs:annotation>
<xs:documentation>The horizontal line on the bottom edge of the near clipping plane mapped to the bottom edge of the graphics window</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="top" type="xs:double" use="required">
<xs:annotation>
<xs:documentation>The horizontal line on the top edge of the near</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="near" type="xs:double" use="required">
<xs:annotation>
<xs:documentation>The distance to the frustum near clipping plane. This value must be positive, (the value -near is the location of the near clip plane).</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="far" type="xs:double" use="required">
<xs:annotation>
<xs:documentation>The distance to the frustum far clipping plane. This value must be positive, and must be greater than near.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<xs:complexType name="scene3dType">
<xs:sequence>
<xs:element name="theme" minOccurs="0" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation>A scene may have several themes. There may be a chain of increasingly detailed themes, representing the same concept. Only the most detailed admissable theme has to be referenced, here. Any less-detailed themes will automatically be rendered, as appropriate. Any more detailed themes are inadmissable for rendering in this scene.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="display" type="xs:boolean" use="required"/>
<xs:attribute name="pickable" type="xs:boolean" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="tileServer" minOccurs="0">
<xs:annotation>
<xs:documentation>This links to a map tile server, such as MapViewer or DigitalGlobe. Textures are explicitly served by the MapTile server, while geometries are implied by the metadata and the regular tile shape.
A tile server reference could alternatively be represented as a list of standard themes (one for each LOD), which store the tile geometries and texture BLOBs/URLs in the DB. If available, a Tile Server reference tends to be more convenient and preferable.
For now, there can only be one tile server reference. Any additional references would result in coplanar tiles. To justify this, we would require an alpha map to make some tiles partially transparent (future).</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="display" type="xs:boolean" use="required"/>
<xs:attribute name="pickable" type="xs:boolean" use="required"/>
<xs:attribute name="tileServerType" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="MAP VIEWER"/>
<xs:enumeration value="DIGITAL GLOBE"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="tileServerUrl" type="xs:anyURI" use="required">
<xs:annotation>
<xs:documentation>URL of tile servlet</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="srid" use="required">
<xs:annotation>
<xs:documentation>SRID of tiles (must be identical to scene SRID)</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:enumeration value="54004"/>
<xs:enumeration value="3785"/>
<xs:enumeration value="8307"/>
<xs:enumeration value="4326"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="minX" type="xs:double" use="required">
<xs:annotation>
<xs:documentation>Minimum x coordinate of tile grid</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="maxX" type="xs:double" use="required">
<xs:annotation>
<xs:documentation>Maximum x coordinate of tile grid</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="minY" type="xs:double" use="required">
<xs:annotation>
<xs:documentation>Minimum y coordinate of tile grid</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="maxY" type="xs:double" use="required">
<xs:annotation>
<xs:documentation>Maximum y coordinate of tile grid</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="minGridSize" use="required">
<xs:annotation>
<xs:documentation>Defines the minimum tile grid size (for instance 2x2)</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="1x1"/>
<xs:enumeration value="2x2"/>
<xs:enumeration value="4x4"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="numLevels" type="xs:positiveInteger" use="required">
<xs:annotation>
<xs:documentation>Defines the number of tiling levels</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="initialActivationDistance" type="xs:double" use="required">
<xs:annotation>
<xs:documentation>Activation distance d from 1st to 2nd LOD (in UOM of SRID; meters if geodetic); subsequent LODs get activated at d/2, d/4, d/8, d/16...</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element ref="vis3d:defaultStyle" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="srid" type="xs:integer" use="optional"/>
</xs:complexType>
<xs:complexType name="featureReferenceType">
<xs:sequence>
<xs:element ref="vis3d:foreignKey" minOccurs="0"/>
<xs:element name="targetTheme" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="vis3DConfigType">
<xs:sequence>
<xs:element name="defaultTexture" type="xs:string"/>
<xs:element name="logos" type="vis3d:logosType"/>
<xs:element name="icons" type="vis3d:iconsType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="iconsType">
<xs:sequence>
<xs:element name="turnIcon" type="xs:string"/>
<xs:element name="rotateIcon" type="xs:string"/>
<xs:element name="zoomIcon" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="logosType">
<xs:sequence>
<xs:element name="logo" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="pointCloudObjectMDType">
<xs:sequence>
<xs:element name="pcUniformColoring" type="xs:string"/>
<xs:element name="pcUniformPointSize" type="xs:integer"/>
<xs:element name="pcPyramiding" type="vis3d:pcPyramidingType"/>
<xs:element name="pointDimensions" type="vis3d:pointDimensionsType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="tinObjectMDType">
<xs:sequence>
<xs:element name="pcUniformColoring" type="xs:string"/>
<xs:element name="tinTexture" type="vis3d:tinTextureType"/>
<xs:element name="tinBumpMap" type="vis3d:tinBumpMapType"/>
<xs:element name="tinPyramiding" type="vis3d:pcPyramidingType"/>
<xs:element name="pointDimensions" type="vis3d:pointDimensionsType"/>
</xs:sequence>
</xs:complexType>
<xs:simpleType name="geoRasterPyramidType">
<xs:restriction base="xs:string">
<xs:enumeration value="NONE"/>
<xs:enumeration value="DECREASE"/>
<xs:enumeration value="INCREASE"/>
<xs:enumeration value="BIDIRECTION"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="pcPyramidingType">
<xs:annotation>
<xs:documentation>Type of pyramiding used</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="type" type="vis3d:geoRasterPyramidType" default="NONE"/>
<xs:element name="maxLevel" type="xs:nonNegativeInteger" default="0" minOccurs="0"/>
<xs:element name="pyramidAlgorithm" type="xs:string"/>
<xs:any minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="tinBitmapType">
<xs:sequence>
<xs:element name="sourceType">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="GEO RASTER"/>
<xs:enumeration value="MAP VIEWER TILE SERVER"/>
<xs:enumeration value="DIGITAL GLOBE TILE SERVER"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="sourceLocation"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="tinTextureType">
<xs:annotation>
<xs:documentation>TIN texture</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="tinBitmap" type="vis3d:tinBitmapType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="tinBumpMapType">
<xs:annotation>
<xs:documentation>TIN bump map</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="tinBitmap" type="vis3d:tinBitmapType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="pointDimensionsType">
<xs:sequence>
<xs:element name="blockPointDimension" minOccurs="2" maxOccurs="12">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="INDEXED_X"/>
<xs:enumeration value="INDEXED_Y"/>
<xs:enumeration value="INDEXED_Z"/>
<xs:enumeration value="COLOR_R"/>
<xs:enumeration value="COLOR_G"/>
<xs:enumeration value="COLOR_B"/>
<xs:enumeration value="POINT_SIZE"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="externalPointAttribute" minOccurs="0" maxOccurs="unbounded">
<xs:complexType mixed="true">
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="TABLE_NAME" type="xs:string" use="required"/>
<xs:attribute name="OBJ_ID_COLUMN_NAME" type="xs:string" use="required"/>
<xs:attribute name="BLOCK_ID_COLUMN_NAME" type="xs:string" use="required"/>
<xs:attribute name="POINT_ID_COLUMN_NAME" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="lodType">
<xs:sequence>
<xs:element name="themeLOD" type="xs:double"/>
<xs:element name="generalization" minOccurs="0">
<xs:annotation>
<xs:documentation>There may be a chain of themes with an increasingly detailed representation of the same concept. In a more detailed theme, there is at least one feature for each feature in the less detailed theme. A simple city block in theme 1 may split into several low-detail buildings in theme 2 (separate features). Each of these may map to a single high-detail representation in theme 3. The link is provided by a foreign key from the more detailed theme to the less detailed one. The least detailed theme has no such foreign key.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:complexContent>
<xs:extension base="vis3d:featureReferenceType">
<xs:attribute name="activationDistance" type="xs:double" use="required">
<xs:annotation>
<xs:documentation>Activation distance of this LOD in UOM of SRID (meters if geodetic)</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:element name="kmlTiling" type="vis3d:kmlTilingType" minOccurs="0">
<xs:annotation>
<xs:documentation>For the purpose of serving KML, we organize the domain into regular multi-level tiles. It is efficient, but optional, to precompute these tiles, and store tile IDs of features in the theme table.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="kmlTilingType">
<xs:annotation>
<xs:documentation>For the purpose of serving KML, we organize the domain into regular multi-level tiles. It is efficient to precompute these tiles, and store tile IDs of features in the theme table.</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="tileIdColumn" type="xs:string">
<xs:annotation>
<xs:documentation>This declares the theme column storing the pre-computed tile ID.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="tileWidth" type="xs:double">
<xs:annotation>
<xs:documentation>This declares the width of a tile (both x and y) in the horizontal unit of measure of the scene SRID.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="pointCloudThemeMDType">
<xs:sequence>
<xs:element name="blockTable" type="xs:string"/>
<xs:element name="uniformColorColumn" type="xs:string" minOccurs="0"/>
<xs:element name="uniformPointSizeColumn" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="tinThemeMDType">
<xs:sequence>
<xs:element name="blockTable" type="xs:string"/>
<xs:element name="uniformColorColumn" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="georasterThemeMDType">
<xs:sequence>
<xs:element name="blockTable" type="xs:string"/>
<xs:element name="uniformColorColumn" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="hidden_infoType">
<xs:sequence>
<xs:element name="field" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="column" type="xs:string" use="required"/>
<xs:attribute name="name" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="alternativeRepresentationsType">
<xs:sequence>
<xs:element name="gml" type="vis3d:sharedValueType" minOccurs="0">
<xs:annotation>
<xs:documentation>This refers to an optional GML column / foreign key</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="cityGML" type="vis3d:sharedValueType" minOccurs="0">
<xs:annotation>
<xs:documentation>This refers to an optional CityGML column / foreign key</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="kml" type="vis3d:sharedValueType" minOccurs="0">
<xs:annotation>
<xs:documentation>This refers to an optional KML column / foreign key</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="x3d" type="vis3d:sharedValueType" minOccurs="0">
<xs:annotation>
<xs:documentation>This refers to an optional X3D column / foreign key</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="bim" type="vis3d:sharedValueType" minOccurs="0">
<xs:annotation>
<xs:documentation>This refers to an optional BIM column / foreign key</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="typeSpecificMDType">
<xs:choice>
<xs:element name="SDO">
<xs:complexType>
<xs:choice>
<xs:element name="SDO_GEOMETRY">
<xs:complexType/>
</xs:element>
<xs:element name="SDO_PC" type="vis3d:pointCloudThemeMDType"/>
<xs:element name="SDO_TIN" type="vis3d:tinThemeMDType"/>
<xs:element name="SDO_GEORASTER" type="vis3d:georasterThemeMDType"/>
</xs:choice>
<xs:attribute name="themeTable" type="xs:string" use="required"/>
<xs:attribute name="geometryColumn" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="external">
<xs:complexType>
<xs:choice>
<xs:element name="mapTiles" type="vis3d:mapTileThemeMDType"/>
<xs:element name="WFS">
<xs:complexType>
<xs:attribute name="serviceUrl" type="xs:anyURI" use="required"/>
<xs:attribute name="featureTypeName" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="WCS">
<xs:complexType>
<xs:attribute name="serviceUrl" type="xs:anyURI" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="WMS">
<xs:complexType>
<xs:attribute name="serviceUrl" type="xs:anyURI" use="required"/>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:complexType name="mapTileThemeMDType">
<xs:choice>
<xs:element name="MAPVIEWER_MAP_TILES">
<xs:complexType>
<xs:attribute name="tileServletUrl" type="xs:anyURI" use="required"/>
<xs:attribute name="dataSource" type="xs:string" use="required"/>
<xs:attribute name="tileLayerName" type="xs:string" use="required"/>
<xs:attribute name="zoomLevel" type="xs:integer" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="DIGITALGLOBE_MAP_TILES">
<xs:complexType>
<xs:attribute name="tileServletUrl" type="xs:anyURI" use="required"/>
<xs:attribute name="dataSource" type="xs:string" use="required"/>
<xs:attribute name="tileLayerName" type="xs:string" use="required"/>
<xs:attribute name="zoomLevel" type="xs:integer" use="required"/>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:schema>';
amt := length(buf);
pos := 1;
DBMS_LOB.WRITE(schemaclob, amt, pos, buf);
DBMS_LOB.CLOSE(schemaclob);
COMMIT;
END;
/
SHOW ERRORS;
-- /*
-- declare
-- usr varchar2(128);
-- url varchar2(200);
-- loc clob;
-- cnt number;
-- begin
-- usr := 'MDSYS';
-- url := 'http://www.oracle.com/2009/spatial/vis3d/schema/sdo3d.xsd';
--
-- execute immediate
-- 'SELECT count(*) FROM sys.dba_xml_schemas WHERE owner=:1 AND schema_url=:2'
-- into cnt using usr, url;
-- if(cnt <> 0) then
-- dbms_xmlschema.deleteSchema(url, dbms_xmlschema.DELETE_CASCADE);
-- end if;
--
-- select xmlSchema into loc from SDO_XML_SCHEMAS where id = 5;
--
-- DBMS_XMLSCHEMA.registerSchema(
-- SCHEMAURL => url,
-- SCHEMADOC => loc,
-- LOCAL => FALSE,
-- OWNER => 'MDSYS');
-- end;
-- /
-- */
commit;
Rem ********************************************************************
Rem #16473696: Indicate Oracle-Supplied object
@?/rdbms/admin/sqlsessend.sql
Rem ********************************************************************
OHA YOOOO