<Realm>
    "Archivo Juan Pérez"@es
    "Juan Pérez Archive"@en

    abbreviation ajp
    thisOntology "http://archive.specific.uri/archivo-juan-perez#"

    dependsRealm sys
    dependsRealm swv

    <RepositoryArea>
        "Archivos de fotografías Juan Pérez"@es
        "Juan Pérez Photo Archive"@en
        generalArchivalThings
    </RepositoryArea>
</Realm>

<DefinitionSet photo_collection>
    <RuleSet photographic_print>
        <Structure>
            <Descriptor has_unique_id>
                property swv:hasUniqueIdentifier
                minCardinality 1
                maxCardinality 1
                outRequirement fromPropRange
            </Descriptor>
            <Descriptor has_media_type>
                property swv:hasMediaType
                minCardinality 1
                maxCardinality 1
                outClass swv:ImageMediaType
            </Descriptor>
            <Descriptor has_conservation_status>
                property swv:hasConservationStatus
                minCardinality 1
                maxCardinality 1
                outRequirement fromPropRange
            </Descriptor>
            <Descriptor has_main_content_link>
                useDefinition swv.manifestation.has_main_content_link
            </Descriptor>
        </Structure>

        <KRRelationRules>
            <KRRelationRule has_main_content>
                swv.manifestation.has_main_content
                <StructRules>
                    outFromGroup sys.individuals.belongs_to_soc->photographic_prints_soc.has_main_content_group
                </StructRules>
            </KRRelationRule>

            <KRRelationRule has_title>
                has_main_content->image_as_content.has_title
            </KRRelationRule>

            <KRRelationRule has_description>
                has_main_content->image_as_content.has_description
            </KRRelationRule>

            <KRRelationRule has_initial_photo_location>
                has_main_content->image_as_content.has_initial_photo_location
            </KRRelationRule>

            <KRRelationRule has_initial_photo_date>
                has_main_content->image_as_content.has_initial_photo_date
            </KRRelationRule>

            <KRRelationRule has_topic>
                has_main_content->image_as_content.has_topic
            </KRRelationRule>

            <KRRelationRule has_system_accessible_digital_copy>
                has_main_content->image_as_content.has_system_accessible_digital_copy
            </KRRelationRule>

            <KRRelationRule has_notes>
                has_main_content->image_as_content.has_notes
            </KRRelationRule>
        </KRRelationRules>

        <BPVFunctions>
            <TextBPVFunction text_ref>
                defaultTextBPVFunction
                |{ (ROOT->has_unique_id).textBPV }|
            </TextBPVFunction>

            <ImageBPVFunciton image_ref>
                defaultImageBPVFunciton
                |{ (ROOT->has_system_accessible_digital_copy).imageBPV }|
            </ImageBPVFunciton>
        </BPVFunctions>

        <Descriptions>
            <VariableDesc>
                df has_unique_id
                df has_title
                df has_description
                df has_initial_photo_location
                df has_initial_photo_date
                df has_topic
                df has_notes
                df has_image_media_type
                df has_conservation_status
            </VariableDesc>

            <ShortDesc>
                df has_unique_id
                df has_title
                df has_description
                df has_initial_photo_date
            </ShortDesc>

            <FullDesc>
                <Area main>
                    <Title>
                        "Full record"@en
                        "Ficha completa"@es
                    </Title>
                    <Block>
                        df has_unique_id
                        df has_title
                        df has_description
                        df has_initial_photo_location
                        df has_initial_photo_date
                        df has_topic
                        df has_notes
                        df has_image_media_type
                        df has_conservation_status
                        <% if ((ROOT->has_system_accessible_digital_copy).hasObj) %>
                            <UniqueDF>
                                "Digital copy"@en
                                "Copia digital"@es
                                uniqueImageBPV |{ (ROOT->has_system_accessible_digital_copy).imageBPV.thumb }|
                                <LinkTo image>
                                    "View in higher resolution..."@en
                                    "Versión con mayor resolución..."@es
                                </LinkTo>
                            </UniqueDF>
                        <% end %>
                    </Block>
                </Area>
                <% if ((ROOT->has_system_accessible_digital_copy).hasObj) %>
                    <Area image>
                        <Title>
                            "Image"@en
                            "Imagen"@es
                        </Title>
                        uniqueImageBPV |{ (ROOT->has_system_accessible_digital_copy).imageBPV.fitViewPort }|
                        df has_unique_id
                        df has_title
                    </Area>
                <% end %>
            </FullDesc>
        <Descriptions>
    </RuleSet>

    <RuleSet photographic_print_soc>
        <Structure>
            <Descriptor has_unique_id>
                property swv:hasUniqueIdentifier
                minCardinality 1
                maxCardinality 1
                outRequirement fromPropRange
            </Descriptor>
            <Descriptor has_title>
                property swv:hasTitle
                minCardinality 1
                maxCardinality 1
                outDataType swv:StringTitle
                multilingual
            </Descriptor>
            <Descriptor has_archival_history>
                property swv:hasArchivalHistory
                minCardinality 1
                maxCardinality 1
                outRequirement fromPropRange
            </Descriptor>
            <Descriptor has_main_content_group_link>
                useDefinition manifestation_group.has_main_content_group_link
            </Descriptor>
        </Structure>

        <KRRelationRules>
            <KRRelationRule has_main_content_group>
                manifestation_group.has_main_content_group
                <StructRules>
                    outValue images_as_content
                </StructRules>
            </KRRelationRule>

            <KRRelationRule has_photographer>
                has_main_content_group->image_as_content_soc.has_photographer
            <KRRelationRule>
        </KRRelationRules>

        <BPVFunctions>
            <TextBPVFunction text_ref>
                defaultTextBPVFunction
                |{ (ROOT->has_unique_id).textBPV }|
            </TextBPVFunction>
        </BPVFunctions>

        <Descriptions>
            <VariableDesc>
                df has_unique_id
                df has_title
                df has_archival_history
                df has_photographer
            </VariableDesc>

            <ShortDesc>
                df has_unique_id
                df has_title
            </ShortDesc>

            <FullDesc>
                <Block>
                    df has_unique_id
                    df has_title
                    df has_archival_history
                    df has_photographer
                </Block>
            </FullDesc>
        </Descriptions>
    </RuleSet>

    <RepositorySetup>
        <SOC photographic_prints>
            "Juan Pérez photographic positives fond"@en
            "Fondo de positivos fotográficos Juan Pérez"@es
            hasGroupDomain swv:PhotographicPrint
            bindToRuleSet photographic_print
            mainLevel
            bindSOCToRuleSet photographic_print_soc
        </SOC>
    </RepositorySetup>

    <RuleSet image_as_content>
        <Structure>
            <Descriptor has_title>
                property swv:hasTitle
                minCardinality 1
                maxCardinality 1
                outRequirement fromPropRange
            </Descriptor>
            <Descriptor has_description>
                property swv:hasDescription
                minCardinality 1
                maxCardinality 1
                outRequirement fromPropRange
            </Descriptor>
            <Descriptor has_notes>
                property swv:hasNotes
                minCardinality 0
                maxCardinality 1
                outRequirement fromPropRange
            </Descriptor>
            <Descriptor has_initial_photo_location>
                property swv:hasInitialPhotoLocation
                minCardinality 1
                maxCardinality 1
                outRequirement fromPropRange
            </Descriptor>
            <Descriptor has_initial_photo_date>
                property swv:hasInitialPhotoDate
                minCardinality 1
                maxCardinality 1
                outRequirement fromPropRange
            </Descriptor>
            <Descriptor has_topic>
                property swv:hasTopic
                minCardinality 1
                maxCardinality 1
                outRequirement fromPropRange
                multipleOrdered
            </Descriptor>
        </Structure>

        <KRRelationRules>
            <KRRelationRule has_accessible_digital_copy>
                swv.content.has_system_accessible_digital_copy
            </KRRelationRule>
        </KRRelationRules>

        <BPVFunctions>
            <TextBPVFunction text_ref>
                defaultTextBPVFunction
                |{ (ROOT->has_title).textBPV }|
            </TextBPVFunction>

            <ImageBPVFunction image_ref>
                defaultImageBPVFunction
                |{ (ROOT->has_system_accessible_digital_copy).imageBPV }|
            </ImageBPVFunction>
        </BPVFunctions>

        <Descriptions>
            <NonDefaultDescFragments>
                <ModifyTemplate has_system_accessible_digital_copy>
                    "Digital copy"@en
                    "Copia digital"@es
                </ModifyTemplate>
            </NonDefaultDescFragments>

            VariableDesc default

            <ShortDesc>
                df has_title
                df has_description
            </ShortDesc>

            FullDesc default
        </Descriptions>
    </RuleSet>

    <RuleSet image_as_content_soc>
        <Structure>
            <Descriptor has_photographer>
                property swv:hasPhotographer
                minCardinality 1
                maxCardinality 1
                outRequirement fromPropRange
            </Descriptor>
            <Descriptor has_title>
                property swv:hasTitle
                minCardinality 1
                maxCardinality 1
                outDataType swv:StringTitle
                multilingual
            </Descriptor>
        </Structure>

        <BPVFunctions>
            <TextBPVFunction text_ref>
                defaultTextBPVFunction
                |{ (ROOT->has_title).textBPV }|
            </TextBPVFunction>
        </BPVFunctions>

        <Descriptions>
            VariableDesc default
            ShortDesc default
            FullDesc default
        </Descriptions>
    </RuleSet>

    <RepositorySetup>
        <SOC images_as_content>
            "Images (as content) in the Juan Pérez Photo Archive"@en
            "Imágenes (como contenido) del archivo de fotografías Juan Pérez"@es
            hasGroupDomain swv:Image
            bindToRuleSet image_as_content
            secondaryLevel
            bindSOCToRuleSet image_as_content_soc
        </SOC>
    </RepositorySetup>

    <RuleSet digital_image_file>
        <Structure>
            <Descriptor has_system_accessible_uri>
                useDefinition sys.digital_file.has_system_accessible_uri
            </Descriptor>
            <Descriptor has_main_content_link>
                useDefinition swv.manifestation.has_main_content_link
            </Descriptor>
        </Structure>

        <BPVFunctions>
            <TextBPVFunction text_ref>
                defaultTextBPVFunction
                |{ (ROOT->has_system_accessible_uri).textBPV }|
            </TextBPVFunction>
        </BPVFunctions>

        <Descriptions>
            VariableDesc default

            <ShortDesc>
                df has_system_accessible_uri
            </ShortDesc>

            FullDesc default
        </Descriptions>
    </RuleSet>

    <RepositorySetup>
        <SOC digital_image_files>
            "Digital copies of the photographs in the Juan Pérez Photo Archive"@en
            "Copias digitales de las fotos del archivo Juan Pérez"@es
            hasGroupDomain sys:DigitalImageFile
            bindToRuleSet digital_image_file
            secondaryLevel
        </SOC>
    </RepositorySetup>
</DefinitionSet>
