Oracle® Multimedia DICOM Developer's Guide 11g Release 1 (11.1) Part Number B28416-01 |
|
|
View PDF |
This chapter uses code examples to show how to manage configuration documents in the DICOM data model repository. The code examples are written in PL/SQL to match the ORD_DICOM_ADMIN package, which is provided in PL/SQL only.
Oracle Multimedia DICOM provides capabilities for a number of administrative operations related to the data model repository. For example, administrators can review the Oracle-defined configuration documents in the DICOM data model repository before determining whether to add custom configuration documents for a particular organization. Using information views or invoking data model utility functions, administrators can obtain attributes and other detailed information about these configuration documents. Working with the procedures and functions in the ORD_DICOM_ADMIN package, administrators can insert, update, export, or delete configuration documents from the repository. Administrators of the DICOM data model repository are assigned the ORDADMIN role.
This chapter includes the following sections:
See Chapter 9 for detailed reference information about the ORD_DICOM_ADMIN package.
For additional examples, articles, and other information about Oracle Multimedia DICOM and Oracle Multimedia, see the Oracle Multimedia Software section of the Oracle Technology Network Web site at
http://www.oracle.com/technology/products/multimedia/
The following sample session shows the steps for inserting a mapping document and a constraint document into the repository. This sample assumes that the following prerequisite tasks have been completed:
The directory object (DICOMDIR
) has been created, and the administrator has been granted read access.
The metadata schema associated with the mapping document has been registered with Oracle XML DB as a global XML schema.
Example 10-1 shows a sample of how to register a schema as global with Oracle XML DB.
Example 10-1 Registering a Global XML Schema
GRANT XDBADMIN TO QUINE; Grant succeeded. CONNECT quine/curry Connected. BEGIN DBMS_XMLSCHEMA.registerSchema( SCHEMAURL => 'http://xmlns.example.com/example.xsd', SCHEMADOC => bfilename('XMLDIR','example.xsd'), LOCAL => FALSE, GENTYPES => TRUE, GENTABLES => FALSE, CSID => nls_charset_id('AL32UTF8')); END; /
See Oracle XML DB Developer's Guide for more information about registering XML schemas.
Perform the following steps:
Step 1 Edit the Data Model
Prepare the data model for editing and lock it to prevent other administrators from making changes at the same time. For example:
exec ord_dicom_admin.editDataModel();
The data model remains locked until you publish the changes, perform a rollback operation, or exit the session.
Optionally, you can enter the following command to query the orddcm_documents view:
select * from orddcm_documents;
Review the list of documents.
Step 2 Insert the New Documents
First, insert the sample mapping document (sample_map.xml
), as follows:
exec ord_dicom_admin.insertDocument('sample_map.xml', 'MAPPING', xmltype(bfilename('DICOMDIR', 'sample_map.xml'), nls_charset_id('AL32UTF8')));
See Example 2-1 for the sample mapping document (sample_map.xml
).
Then, insert the sample constraint document (sample_ct.xml
), as follows:
exec ord_dicom_admin.insertDocument('sample_ct.xml', 'CONSTRAINT', xmltype(bfilename('DICOMDIR', 'sample_ct.xml'), nls_charset_id('AL32UTF8')));
See Example 2-3 for the sample constraint document (sample_ct.xml
).
Optionally, you can enter the following command to query the orddcm_documents view:
select * from orddcm_documents;
Review the list of documents to ensure that the inserted documents appear.
As another option, you can enter the following command to query the orddcm_document_types view:
select * from orddcm_document_types;
At this point, you can run administrative tests as needed. In addition, you can call the rollbackDataModel( ) procedure to terminate the operation without publishing the changes. Or, you can continue with the next step.
Step 3 Publish the Changes
Publish the changes and unlock the data model, as follows:
exec ord_dicom_admin.publishDataModel();
The data model includes the inserted configuration documents.
The following sample session shows the steps for updating a mapping document in the repository. This sample assumes that the following prerequisite tasks have been completed:
The directory object (DICOMDIR
) has been created, and the administrator has been granted read and write access.
The referenced metadata schema associated with the mapping document has been registered with Oracle XML DB as a global XML schema. (See Example 10-1.)
See Oracle XML DB Developer's Guide for information about registering XML schemas.
Perform the following steps:
Step 1 Edit the Data Model
As in Section 10.1, prepare the data model for editing and lock it to prevent other administrators from making changes at the same time. For example:
exec ord_dicom_admin.editDataModel();
The data model remains locked until you publish the changes, perform a rollback operation, or exit the session.
Optionally, you can enter the following command to query the orddcm_documents view:
select * from orddcm_documents;
Review the list of documents.
Step 2 Export the Existing Document
Export the sample mapping document (sample_map.xml
) from the repository into a specified file (sample_map_export.xml
) for editing. For example:
exec ord_dicom_admin.exportDocument('sample_map.xml', 'DICOMDIR', 'sample_map_export.xml');
The file is available for editing with an XML editor.
Step 3 Delete the Existing Document
Delete the existing mapping document (sample_map.xml
) from the repository, as follows:
exec ord_dicom_admin.deleteDocument('sample_map.xml');
The repository no longer includes the sample mapping document.
Optionally, you can enter the following command to query the orddcm_documents view:
select * from orddcm_documents;
Review the list of documents to ensure that the deleted document no longer appears.
Step 4 Edit the Exported Document
Use an XML editor to edit the file that was exported in Step 2. Then, save the changes and check the permissions on the file before inserting it into the repository.
Step 5 Insert the Edited Document
Insert the edited document (sample_map_edited.xml
) into the repository, as follows:
exec ord_dicom_admin.insertDocument('sample_map_edited.xml', 'MAPPING', xmltype(bfilename('DICOMDIR', 'sample_map_edited.xml'), nls_charset_id('AL32UTF8')));
Optionally, you can enter the following command to query the orddcm_documents view:
select * from orddcm_documents;
Review the list of documents to ensure that the updated document appears.
At this point, you can test your changes, run the extractMetadata( ) method on the edited mapping document to retrieve metadata from the embedded DICOM content as XML code, and then store it in a database table for searching or viewing. In addition, you can call the rollbackDataModel( ) procedure to terminate the operation without publishing the changes. Or, you can continue with the next step.
Step 6 Publish the Changes
As in Section 10.1, publish the changes and unlock the data model, as follows:
exec ord_dicom_admin.publishDataModel();
The data model includes the updated configuration document.
The following sample session shows the steps for deleting a constraint document from the repository. This sample assumes that the following prerequisite task has been completed:
The directory object (DICOMDIR
) has been created, and the administrator has been granted write access.
Perform the following steps:
Step 1 Edit the Data Model
As in Section 10.1, prepare the data model for editing and lock it to prevent other administrators from making changes at the same time. For example:
exec ord_dicom_admin.editDataModel();
The data model remains locked until you publish the changes, perform a rollback operation, or exit the session.
Step 2 Export the Existing Document (Optional and Recommended)
Export the sample constraint document (sample_ct.xml
) from the repository into a specified file (sample_ct_export.xml
) for editing. For example:
exec ord_dicom_admin.exportDocument('sample_ct.xml', 'DICOMDIR', 'sample_ct_export.xml');
Optionally, you can enter the following command to query the orddcm_document_refs view, which shows the list of documents that are referenced by other documents in the repository:
select * from orddcm_document_refs;
Review the list of documents to check the references for the constraint document that you intend to delete.
Step 3 Delete the Document
Delete the sample constraint document (sample_ct.xml
), as follows:
exec ord_dicom_admin.deleteDocument('sample_ct.xml');
The repository no longer includes the sample constraint document.
Optionally, you can enter the following command to query the orddcm_documents view:
select * from orddcm_documents;
Review the list of documents to ensure that the deleted document no longer appears.
At this point, you can call the rollbackDataModel( ) procedure to terminate the operation without publishing the changes. Or, you can continue with the next step.
Step 4 Publish the Changes
Publish the changes and unlock the data model, as follows:
exec ord_dicom_admin.publishDataModel();
The data model does not include the deleted configuration document.