<?xml version="1.0" encoding="UTF-8"?>

<!-- Copyright (c) 2003, Luna Imaging, Inc.  All Rights Reserved -->
<!-- Version 2.0.0 -->

<!--

    Insight Response DTD

-->

<!ENTITY % insightRequest SYSTEM "http://www.lunaimaging.com/support/dtd/insightXMLGateway/v4.1/insightrequest.dtd">

<!-- main elements -->
    <!ELEMENT insightResponse (insightRequest?, (collectionResponse | fieldResponse | searchResponse | dataResponse)?, status)>


%insightRequest;

<!--
    Collection Response
-->

    <!ELEMENT collectionResponse (collectionInformation*, status)>

    <!ELEMENT collectionInformation (collectionName?, collectionID?, institutionID?, vcID?, description?, copyright?, remoteLaunch*, mapping*, status)>
        <!ATTLIST collectionInformation
            cid CDATA #REQUIRED
            collectionRecordCount CDATA #REQUIRED
        >

    <!ELEMENT collectionName (#PCDATA)>
    <!ELEMENT collectionID (#PCDATA)>
    <!ELEMENT institutionID (#PCDATA)>
    <!ELEMENT vcID (#PCDATA)>
    <!ELEMENT description (#PCDATA)>
    <!ELEMENT copyright (#PCDATA)>

    <!ELEMENT mapping EMPTY>
        <!ATTLIST mapping
            type    (native | standard) "native"
            name    CDATA    #REQUIRED
        >


<!--
    Field Response
-->

    <!ELEMENT fieldResponse (collectionFieldList*, status)>

    <!ELEMENT collectionFieldList (collectionName?, collectionID?, institutionID?, vcID?, fieldList*, status)>
        <!ATTLIST collectionFieldList
            cid CDATA #REQUIRED
            supportsCustomSortAndThumbnails (true | false) #REQUIRED
        >

    <!ELEMENT fieldList (dataField*)>
        <!ATTLIST fieldList
            mappingType (standard | native) "native"
            mappingName CDATA #REQUIRED
            supportsThumbnails (true | false) #REQUIRED
            supportsSort (true | false) #REQUIRED
        >

    <!ELEMENT dataField (fieldMapping*)>
        <!ATTLIST dataField
            name CDATA #REQUIRED
            type (text | numeric) "text"
            isSearchField (true | false) "true"
            isThumbnailField (true | false) "false"
            isSortField (true | false) "false"
            isDefaultThumbnailField (true | false) "false"
            isDefaultSortField (true | false) "false"
        >

    <!ELEMENT fieldMapping EMPTY>
        <!ATTLIST fieldMapping
            standard CDATA #REQUIRED
            fieldname CDATA #REQUIRED
            type (text | numeric) "text"
        >


<!--
    Search Response
-->

    <!ELEMENT searchResponse (collectionResultSet*, status)>

    <!ELEMENT collectionResultSet (collectionName?, collectionID?, institutionID?, vcID?, remoteLaunch*, object*, status)>
        <!ATTLIST collectionResultSet
            cid CDATA #REQUIRED
            resultSetSize CDATA #REQUIRED
            matchingRecordCount CDATA #REQUIRED
            requestedRecordCount CDATA #REQUIRED
            firstRecordIndex CDATA #REQUIRED
            collectionRecordCount CDATA #REQUIRED
            includesFirstRecord (true | false) #REQUIRED
            includesLastRecord (true | false) #REQUIRED
        >
        <!--DISPLAY NOTE: the remoteLaunch will return the entire result set
            inside Insight.  Size is the size of the result set
            totalRecordCount is the total number of matches found
        -->

    <!ELEMENT object (collectionName?, collectionID?, institutionID?, vcID?, collectionCopyrightStatement?, remoteLaunch*, thumbnail*, image*, fullData?)>
        <!ATTLIST object
            cid CDATA #REQUIRED
            objectID CDATA #REQUIRED
            imageID CDATA #REQUIRED
            type (media | multi-page-document | multi-view-document) #REQUIRED
        >
        <!--DISPLAY NOTE: All of the attributes are not display items-->
        <!--DISPLAY NOTE: The collection copyright statement should be displayed
            with all data, the remote launch will open the object in Insight.
            The thumbnail info is good for display of a short record while the
            full data is good for an extended record.  The data is displayed in
            a shorthand which means that all data standards conform to the DTD
        -->
        
    <!ELEMENT image (mediaInfo?)>
        <!ATTLIST image
            URL CDATA #IMPLIED
            mediaType (audio | video | image | QTVR) #REQUIRED
            height CDATA #REQUIRED
            width CDATA #REQUIRED
            size CDATA #REQUIRED
        >
        <!-- DISPLAY NOTE:  mediaType will have one of the values Image, Audio,
             Video, or QTVR.
             The presence of <image> elements in the response is controlled by the
             'maxImageSize' attribute of the searchRequest.  In version 4.1 of
             the gateway, the largest support image size is 2.
        -->


    <!ELEMENT collectionCopyrightStatement (#PCDATA)>
        <!--DISPLAY NOTE: this should be displayed with each record-->

    <!ELEMENT thumbnail (label*)>
        <!ATTLIST thumbnail
            URL CDATA #IMPLIED
            mappingType (standard | native) "native"
            mappingName CDATA #REQUIRED
        >
        <!--DISPLAY NOTE: neither Name nor Type should be displayed -->
        <!--DISPLAY NOTE: An object may have up to 4 thumbnail labels, and the
            labels may be in a data standard or native fields.  The Thumbnail
            may have a URL included to the thumbnail
            (max of 96x96 pixels)
        -->

    <!ELEMENT label (#PCDATA)>
        <!ATTLIST label
            name CDATA #REQUIRED
            order CDATA #REQUIRED
        >
        <!--DISPLAY NOTE: These should be used in the Browse View -->
        <!--DISPLAY NOTE: Different collections may have different labels so
            name may or may not be useful, order is display order.  The PCDATA
            contents of a label may be empty.
        -->

    <!ELEMENT fullData (objectInfo+)>
        <!--DISPLAY NOTE: An object may have multiple objectInfos which pertain
            to the different standards of data requested
        -->

    <!ELEMENT objectInfo (field*, fieldGroup*)>
        <!ATTLIST objectInfo
            mappingType (standard | native) "native"
            mappingName CDATA #REQUIRED
        >
        <!--DISPLAY NOTE: neither Name nor Type should be displayed -->
        <!--DISPLAY NOTE: An Object may have more than on object Info -->

    <!ELEMENT mediaInfo (field*)>
        <!--DISPLAY NOTE: There is only one mediaInfo, it is the technical
            metadata about a given image being returned.  Display is optional
        -->

    <!ELEMENT fieldGroup (field*)>
        <!ATTLIST fieldGroup
            name CDATA #IMPLIED
            order CDATA #REQUIRED
        >
        <!--DISPLAY NOTE: The same field may repeat multiple times, the order
            should be unique to the field group
        -->

    <!ELEMENT field (value*)>
        <!ATTLIST field
            name CDATA #REQUIRED
            order CDATA #REQUIRED
        >
        <!--DISPLAY NOTE: Should display these in the full Data View -->

    <!ELEMENT value (#PCDATA)>
        <!ATTLIST value
            order CDATA #REQUIRED
        >

<!--
    Data Response
-->

    <!ELEMENT dataResponse (collectionResultSet?, status)>

<!--
    basic elements
-->

    <!ELEMENT status (#PCDATA)>
        <!ATTLIST status code CDATA #REQUIRED>
        <!--DISPLAY NOTE: not displayed, for admin use only-->

    <!ELEMENT remoteLaunch (#PCDATA)>
        <!ATTLIST remoteLaunch
            type (imageWorkspace | groupWorkspace) "groupWorkspace"
            target (insight | browserinsight) "browserinsight"
        >
        <!--DISPLAY NOTE: This is always a URL -->

