MINI MINI MANI MO

Path : /opt/oracle/product/18c/dbhomeXE/md/admin/
File Upload :
Current File : //opt/oracle/product/18c/dbhomeXE/md/admin/sdodcmixsd.sql

Rem
Rem $Header: sdo/admin/sdodcmixsd.sql /main/2 2015/08/27 20:27:45 czechar Exp $
Rem
Rem sdodcmixsd.sql
Rem
Rem Copyright (c) 2014, 2015, Oracle and/or its affiliates. 
Rem All rights reserved.
Rem
Rem    NAME
Rem      sdodcmixsd.sql - <one-line expansion of the name>
Rem
Rem    DESCRIPTION
Rem      This follows same way as sdogrxml.sql for CSW202+:
Rem      - Defines the system table MDSYS.SDO_XSD_TABLE (old name MDSYS.CSW_XSD_TABLE$) for CSW202+
Rem        by loading DCMI XSDS.
Rem
Rem    NOTES
Rem      <other useful comments, qualifications, etc.>
Rem
Rem    BEGIN SQL_FILE_METADATA 
Rem    SQL_SOURCE_FILE: sdo/admin/sdodcmixsd.sql
Rem    SQL_SHIPPED_FILE: md/admin/sdodcmixsd.sql
Rem    SQL_PHASE: SDODCMIXSD
Rem    SQL_STARTUP_MODE: NORMAL 
Rem    SQL_IGNORABLE_ERRORS: NONE 
Rem    SQL_CALLING_FILE: sdo/admin/sdowfscs.sql
Rem    END SQL_FILE_METADATA
Rem
Rem    MODIFIED   (MM/DD/YY)
Rem    czechar     08/14/15 - add SQL file metadata
Rem    bkazar      06/19/15 - Renamings: This file was sdocswdcmixml.sql and renamed as sdodcmixsd.sql. 
Rem    bkazar      06/18/15 - Created
Rem    bkazar      12/23/14 - Created
Rem

@@?/rdbms/admin/sqlsessstart.sql

----------------------------------------------------------------------------
-- Description:
-- Loads the DCMI XSDS into MDSYS.SDO_XSD_TABLE
----------------------------------------------------------------------------

declare

    schemaclob   CLOB;
    amt          NUMBER;
    buf          VARCHAR2(32767);
    pos          NUMBER;

BEGIN

    --------------------------
    -- Dublin Core (DCMI) XSD
    --------------------------
    -- Load dependent XSDs first:
    -- Use 101,102,...,199 for dependent XSDs for its XSD_ID.
    
    DELETE FROM MDSYS.SDO_XSD_TABLE WHERE XSD_ID = 101;
    INSERT INTO MDSYS.SDO_XSD_TABLE(XSD_ID, XSD_DOC, XSD_NAME, XSD_URL) 
        VALUES (101, empty_clob(), 'DCMI', 'dcmimes.xsd')
        RETURNING XSD_DOC into schemaclob;

    SELECT XSD_DOC into schemaclob from MDSYS.SDO_XSD_TABLE
        WHERE XSD_ID = 101 FOR UPDATE;

    DBMS_LOB.OPEN(schemaclob, DBMS_LOB.LOB_READWRITE);

    -- Same as recdcmes.xsd, dcmimes.xsd
    buf :=
'<?xml version="1.0" encoding="UTF-8"?>
<xs:schema id="dcmes"
  targetNamespace="http://www.purl.org/dc/elements/1.1/" 
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xmlns:dc="http://www.purl.org/dc/elements/1.1/"
  elementFormDefault="qualified"
  attributeFormDefault="unqualified"
  version="1.1">

  <xs:annotation>
    <xs:appinfo>
      <dc:identifier xmlns:dc="http://www.purl.org/dc/elements/1.1/">
      http://dublincore.org/schemas/xmls/qdc/2003/04/02/dc.xsd
      </dc:identifier>
    </xs:appinfo>
    <xs:documentation xml:lang="en">
    This schema declares XML elements for the 15 Dublin Core elements in the
    "http://www.purl.org/dc/elements/1.1/" namespace. All elements are declared 
    as substitutable for the abstract element DC-element.
    </xs:documentation>
  </xs:annotation>

  <xs:complexType name="SimpleLiteral">
    <xs:annotation>
      <xs:documentation xml:lang="en">
      This is the default type for all of the DC elements. It defines a 
      complexType SimpleLiteral which permits mixed content but disallows 
      child elements by use of minOcccurs/maxOccurs. However, this complexType 
      does permit the derivation of other types which would permit child 
      elements. The scheme attribute may be used as a qualifier to reference 
      an encoding scheme that describes the value domain for a given property.
      </xs:documentation>
    </xs:annotation>
    <xs:complexContent mixed="true">
      <xs:restriction base="xs:anyType">
        <xs:sequence>
          <xs:any processContents="lax" minOccurs="0" maxOccurs="0"/>
        </xs:sequence>
        <xs:attribute name="scheme" type="xs:anyURI" use="optional" />
      </xs:restriction>
    </xs:complexContent>
  </xs:complexType>

  <xs:element name="DC-element" type="dc:SimpleLiteral" abstract="true"/>

  <xs:element name="title" type="dc:SimpleLiteral" 
    substitutionGroup="dc:DC-element"/>
  <xs:element name="creator" type="dc:SimpleLiteral" 
    substitutionGroup="dc:DC-element"/>
  <xs:element name="subject" type="dc:SimpleLiteral" 
    substitutionGroup="dc:DC-element"/>
  <xs:element name="description" type="dc:SimpleLiteral" 
    substitutionGroup="dc:DC-element"/>
  <xs:element name="publisher" type="dc:SimpleLiteral" 
    substitutionGroup="dc:DC-element"/>
  <xs:element name="contributor" type="dc:SimpleLiteral" 
    substitutionGroup="dc:DC-element"/>
  <xs:element name="date" type="dc:SimpleLiteral" 
    substitutionGroup="dc:DC-element"/>
  <xs:element name="type" type="dc:SimpleLiteral" 
    substitutionGroup="dc:DC-element"/>
  <xs:element name="format" type="dc:SimpleLiteral" 
    substitutionGroup="dc:DC-element"/>
  <xs:element name="identifier" type="dc:SimpleLiteral" 
    substitutionGroup="dc:DC-element"/>
  <xs:element name="source" type="dc:SimpleLiteral" 
    substitutionGroup="dc:DC-element"/>
  <xs:element name="language" type="dc:SimpleLiteral" 
    substitutionGroup="dc:DC-element"/>
  <xs:element name="relation" type="dc:SimpleLiteral" 
    substitutionGroup="dc:DC-element"/>
  <xs:element name="coverage" type="dc:SimpleLiteral" 
    substitutionGroup="dc:DC-element"/>
  <xs:element name="rights" type="dc:SimpleLiteral" 
    substitutionGroup="dc:DC-element"/>

  <xs:group name="DC-element-set">
    <xs:annotation>
      <xs:documentation xml:lang="en">
      This group is included as a convenience for schema authors who need 
      to refer to all the elements in the http://www.purl.org/dc/elements/1.1/ 
      namespace.
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element ref="dc:DC-element"/>
      </xs:choice>
    </xs:sequence>
  </xs:group>
  
  <xs:complexType name="elementContainer">
    <xs:annotation>
      <xs:documentation xml:lang="en">
      This complexType is included as a convenience for schema authors who 
      need to define a root or container element for all of the DC elements.
      </xs:documentation>
    </xs:annotation>
    <xs:choice>
      <xs:group ref="dc:DC-element-set"/>
    </xs:choice>
  </xs:complexType>
</xs:schema>';

    amt := length(buf);
    pos := 1;

    DBMS_LOB.WRITE(schemaclob, amt, pos, buf);
    DBMS_LOB.CLOSE(schemaclob);
    
    
    
    
    DELETE FROM MDSYS.SDO_XSD_TABLE WHERE XSD_ID = 1;
    INSERT INTO MDSYS.SDO_XSD_TABLE(XSD_ID, XSD_DOC, XSD_NAME, XSD_URL) 
        VALUES (1, empty_clob(), 'DCMI', 'dcmi.xsd')
        RETURNING XSD_DOC into schemaclob;

    SELECT XSD_DOC into schemaclob from MDSYS.SDO_XSD_TABLE
        WHERE XSD_ID = 1 FOR UPDATE;

    DBMS_LOB.OPEN(schemaclob, DBMS_LOB.LOB_READWRITE);

    -- Same as recdcterms.xsd or dcmi.xsd
    buf :=
'<?xml version="1.0" encoding="UTF-8"?>
<xs:schema id="dcmi-terms" 
  targetNamespace="http://www.purl.org/dc/terms/" 
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xmlns:dct="http://www.purl.org/dc/terms/"
  xmlns:dc="http://www.purl.org/dc/elements/1.1/"
  elementFormDefault="qualified"
  attributeFormDefault="unqualified"
  version="2003.11.19">

  <xs:annotation>
    <xs:appinfo>
      <dc:identifier xmlns:dc="http://www.purl.org/dc/elements/1.1/">
      http://dublincore.org/schemas/xmls/qdc/2003/04/02/dcterms.xsd
      </dc:identifier>
    </xs:appinfo>
    <xs:documentation xml:lang="en">
    This schema declares XML elements for the DC elements and their refinements 
    in the http://www.purl.org/dc/terms/ namespace.
    </xs:documentation>
  </xs:annotation>

   <xs:import namespace="http://www.purl.org/dc/elements/1.1/"
     schemaLocation="dcmimes.xsd"/>

   <xs:element name="alternative" type="dc:SimpleLiteral" 
     substitutionGroup="dc:title" />
   <xs:element name="tableOfContents" type="dc:SimpleLiteral" 
     substitutionGroup="dc:description" />
   <xs:element name="abstract" type="dc:SimpleLiteral" 
     substitutionGroup="dc:description"/>

   <xs:element name="created" type="dc:SimpleLiteral" 
     substitutionGroup="dc:date"/>
   <xs:element name="valid" type="dc:SimpleLiteral" 
     substitutionGroup="dc:date"/>
   <xs:element name="available" type="dc:SimpleLiteral" 
     substitutionGroup="dc:date"/>
   <xs:element name="issued" type="dc:SimpleLiteral" 
     substitutionGroup="dc:date"/>
   <xs:element name="modified" type="dc:SimpleLiteral" 
     substitutionGroup="dc:date"/>
   <xs:element name="dateAccepted" type="dc:SimpleLiteral" 
     substitutionGroup="dc:date"/>
   <xs:element name="dateCopyrighted" type="dc:SimpleLiteral" 
     substitutionGroup="dc:date"/>
   <xs:element name="dateSubmitted" type="dc:SimpleLiteral" 
     substitutionGroup="dc:date"/>

   <xs:element name="extent" type="dc:SimpleLiteral" 
     substitutionGroup="dc:format"/>
   <xs:element name="medium" type="dc:SimpleLiteral" 
     substitutionGroup="dc:format"/>

   <xs:element name="isVersionOf" type="dc:SimpleLiteral" 
     substitutionGroup="dc:relation"/>
   <xs:element name="hasVersion" type="dc:SimpleLiteral" 
     substitutionGroup="dc:relation"/>
   <xs:element name="isReplacedBy" type="dc:SimpleLiteral" 
     substitutionGroup="dc:relation"/>
   <xs:element name="replaces" type="dc:SimpleLiteral" 
     substitutionGroup="dc:relation"/>
   <xs:element name="isRequiredBy" type="dc:SimpleLiteral" 
     substitutionGroup="dc:relation"/>
   <xs:element name="requires" type="dc:SimpleLiteral" 
     substitutionGroup="dc:relation"/>
   <xs:element name="isPartOf" type="dc:SimpleLiteral" 
     substitutionGroup="dc:relation"/>
   <xs:element name="hasPart" type="dc:SimpleLiteral" 
     substitutionGroup="dc:relation"/>
   <xs:element name="isReferencedBy" type="dc:SimpleLiteral" 
     substitutionGroup="dc:relation"/>
   <xs:element name="references" type="dc:SimpleLiteral" 
     substitutionGroup="dc:relation"/>
   <xs:element name="isFormatOf" type="dc:SimpleLiteral" 
     substitutionGroup="dc:relation"/>
   <xs:element name="hasFormat" type="dc:SimpleLiteral" 
     substitutionGroup="dc:relation"/>
   <xs:element name="conformsTo" type="dc:SimpleLiteral" 
     substitutionGroup="dc:relation"/>

   <xs:element name="spatial" type="dc:SimpleLiteral" 
     substitutionGroup="dc:coverage"/>
   <xs:element name="temporal" type="dc:SimpleLiteral" 
     substitutionGroup="dc:coverage"/>

   <xs:element name="audience" type="dc:SimpleLiteral" 
     substitutionGroup="dc:DC-element"/>

   <xs:element name="mediator" type="dc:SimpleLiteral" 
     substitutionGroup="dct:audience"/>
   <xs:element name="educationLevel" type="dc:SimpleLiteral" 
     substitutionGroup="dct:audience"/>

   <xs:element name="accessRights" type="dc:SimpleLiteral" 
     substitutionGroup="dc:rights"/>

   <xs:element name="bibliographicCitation" type="dc:SimpleLiteral" 
     substitutionGroup="dc:identifier"/>
     
   <xs:group name="DCMI-terms">
    <xs:annotation>
      <xs:documentation xml:lang="en">
      This group is included as a convenience for schema authors who need 
      to refer to all of the DCMI metadata terms.
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element ref="dc:DC-element"/>
      </xs:choice>
    </xs:sequence>
  </xs:group>
</xs:schema>';

    amt := length(buf);
    pos := 1;
    
    DBMS_LOB.WRITE(schemaclob, amt, pos, buf);    
    DBMS_LOB.CLOSE(schemaclob);


    COMMIT; 

END;
/
SHOW ERRORS;

    

@?/rdbms/admin/sqlsessend.sql

OHA YOOOO