// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

[[ugr.tools.annotation_viewer]]
= Annotation Viewer

The _Annotation Viewer_ is a tool for viewing analysis results that have been saved to your disk as __external XML representations of the CAS__.
These are saved in a particular format called XMI.
In the UIMA SDK, XML versions of CASes can be generated by:

* Running the xref:tools.adoc#ugr.tools.doc_analyzer[Document Analyzer], which saves an XML representations of the CAS to the specified output directory.
* Running a Collection Processing Engine that includes the __XMI Writer__ CAS Consumer (`examples/descriptors/cas_consumer/XmiWriterCasConsumer.xml)`. 
* Explicitly creating XML representations of the CAS from your own application using the org.apache.uima.cas.impl.XMISerializer class. The best way to learn how to do this is to look at the example code for the XMI Writer CAS Consumer, located in ``examples/src/org/apache/uima/examples/xmi/XmiWriterCasConsumer.java``.
footnote:[An older form of a different XML format for the CAS is also provided mainly for backwards compatibility. This form is called XCAS, and you can see examples of its use in `examples/src/org/apache/uima/examples/cpe/XCasWriterCasConsumer.java`.]

[NOTE]
====
The Annotation Viewer only shows CAS views where the Sofa data type is a String. 
====

You can run the Annotation Viewer by executing the `annotationViewer` shell script located in the bin directory of the UIMA SDK or the "UIMA Annotation Viewer" Eclipse run configuration in the `uimaj-examples` project.
This will open the following window: 

.Screenshot of the Annotation Viewer
image::images/tools/tools.annotation_viewer/image002.jpg[Screenshot of the Annotation Viewer]

Select an input directory (which must contain XMI files), and the descriptor for the AE that produced the Analysis (which is needed to get the type system for the analysis). Then press the "`View`" button.

This will bring up a xref:tools.adoc#ugr.tools.doc_analyzer.viewing_results[dialog] where you can select a viewing format and double-click on a document to view it.
