<Realm>
  "Test"@en
  "Prueba"@es
  comment "Test definitions"@en
  comment "Definiciones de prueba"@es

  abbreviation prueba
  thisOntology "http://purl.org/NET/durito/ontologies/2005/09/prueba#"
  dependsRealm swv
  dependsRealm sys

  <RepositoryArea>
    "Test repository area"@en
    "Área de repositorio de prueba"@es
    sharedArchivalThings
  </RepositoryArea>
</Realm>

<DefinitionSet prueba>
  <Vocabulary>
    <Class prueba:Book>
      "Books"@en
      "Libros"@es
    </Class>

    <Class prueba:Person>
      "Person"@en
      "Persona"@es
    </Class>

    <Class prueba:Photo>
      "Photos"@en
      "Fotografías"@es
    </Class>

    <Property prueba:hasTitle>
      "Title"@en
      "Título"@es
    </Property>

    <Property prueba:hasGivenNames>
      "Given Names"@en
      "Nombres"@es
    </Property>
    
    <Property prueba:hasLastNames>
      "Last Names"@en
      "Apellidos"@es
    </Property>

    <Property prueba:hasAuthor>
      "Author"@en
      "Autor"@es
    </Property>

    <Property prueba:publishedIn>
      "Published in"@en
      "Se publica en"@es
      range prueba:Book
    </Property>
  
    <Property prueba:hasCountryTakenIn>
      "País"@es
    </Property>
  
    <Property prueba:hasStateTakenIn>
      "Entidad federativa"@es
    </Property>

    <Property prueba:hasMunicipalityTakenIn>
      "Municipio o delegación"@es
    </Property>
  
    <Property prueba:hasPrimaryDimensions>
      "Dimensions"@en
      "Medidas"@es
    </Property>
      
    <Property prueba:hasSecondaryDimensions>
      "Dimensions"@en
      "Medidas"@es
    </Property>

    <ComplexDataType prueba:DimensionsInfo>
      "Dimensions"@en
      "Medidas"@es
      comment "Los valores que se asignen a este tipo de datos son medidas"@es
      comment "The values assigned this data type are dimensions"@en
      bindToRuleSet dimensions
      comparisonVector Float volume
    </ComplexDataType>    
    
    <Property prueba:hasHeight>
      "Height"@en
      "Altura"@es
      comment "Indica la altura"@es
      domain  prueba:DimensionsInfo
      range xsd:float
    </Property>
    
     <Property prueba:hasWidth>
       "Width"@en
       "Ancho"@es
       comment "Indica el ancho"@es
       domain  prueba:DimensionsInfo
       range xsd:float
     </Property>
    
     <Property prueba:hasLength>
       "Length"@en
       "Largo"@es
       comment "Indica  el largo"@es
       domain prueba:DimensionsInfo
       range xsd:float
     </Property>      

     <Property prueba:hasMeasurementUnit>
       "Measurement Unit"@en
       "Unidad de medición"@es
     </Property>
            
     <Class prueba:MeasurementUnit>
       "Measurement Unit"@en
       "Unidad de medición"@es
       comment "Las instancias de esta clase son unidades de medición"@es
       comment "The instances of this class are measurement units"@en
     </Class>

    <Property prueba:hasPrimaryMaterials>
       "Materiales"@es
    </Property>
    
    <Property prueba:hasSecondaryMaterials>
       "Materiales"@es
    </Property>
    
    <Property prueba:hasInscription>
            "Inscripcion"@es
            "Inscription"@en
    </Property>
    
    <Property prueba:hasSeal>
            "Sello"@es
            "Seal"@en
    </Property>
       
     <Property prueba:hasName>
       "Name"@en
       "Nombre"@es
       comment "Indica el nombre de algo"@es
       range xsd:string
     </Property>
     
     <Property prueba:hasAbbreviation>
       "Abrreviation"@en
       "Abreviación"@es
       comment "Indica la abreviación de algo"@es
       range xsd:string
     </Property>
     
     <FundamentalDataType prueba:float>
       "Floating Point"@en
       "Coma flotante"@es
       bindToRuleSet floating_point
     </FundamentalDataType>
  </Vocabulary>

  <RuleSet photo>
    <Structure>
      <Descriptor has_unique_id>
        property swv:hasUniqueIdentifier
      </Descriptor>
    
      <Descriptor has_title>
        property prueba:hasTitle
      </Descriptor>
      
      <Descriptor has_date>
        property swv:hasInitialPhotoDate
      </Descriptor>
      
      <Descriptor has_photographer>
        property swv:hasPhotographer
      </Descriptor>
      
      <Descriptor has_editor>
        property swv:hasEditor
      </Descriptor>
      
      <Descriptor formal_structure>
        property swv:hasFormalStructure
      </Descriptor>

      <Descriptor orientation>
        property swv:hasOrientation
      </Descriptor>
      
      <Descriptor plane>
        property swv:hasPlane
      </Descriptor>      

      <Descriptor has_description>
        property swv:hasDescription
      </Descriptor>      

      <Descriptor taken_from>
        property swv:takenFrom
      </Descriptor>      

      <Descriptor taken_facing>
        property swv:takenFacing
      </Descriptor>      

      <Descriptor has_country_taken_in>
        property prueba:hasCountryTakenIn
      </Descriptor>      

      <Descriptor has_state_taken_in>
        property prueba:hasStateTakenIn
      </Descriptor>      

      <Descriptor has_municipality_taken_in>
        property prueba:hasMunicipalityTakenIn
      </Descriptor>      

      <Descriptor has_role_in_photographic_process>
        property swv:hasRoleInPhotographicProcess
      </Descriptor>

      <Descriptor has_primary_dimensions>
        property prueba:hasPrimaryDimensions
      </Descriptor>

      <Descriptor has_primary_materials>
        property prueba:hasPrimaryMaterials
      </Descriptor>

      <Descriptor has_secondary_dimensions>
        property prueba:hasSecondaryDimensions
      </Descriptor>
      
      <Descriptor has_secondary_materials>
        property prueba:hasSecondaryMaterials
      </Descriptor>

      <Descriptor has_inscription>
        property prueba:hasInscription
      </Descriptor>

      <Descriptor has_seal>
        property prueba:hasSeal
      </Descriptor>

    </Structure>

#    <BPVFunctions>
#      <TextBPVFunction title_and_author>
#         |{ 
#           title = (@root->has_title).text_bpv
#           author = (@root->has_author).text_bpv
#           "#{title} (#{author})"
#         }|
#      </TextBPVFunction>
#    </BPVFunctions>
#
#    <KRRelationRules>
#      <KRRelationRule published_in_title>
#         published_in->book.has_title
#      </KRRelationRule>
#
#      <KRRelationRule author_has_given_names>
#        has_author->person.has_given_names
#      </KRRelationRule>
#
#      <KRRelationRule all_books_with_author_of_book_published_in>
#        published_in->book.has_author->book.has_author[inv]
#      </KRRelationRule>
#    </KRRelationRules>
    
    <Descriptions>
#    	defaultOrderBy has_author

    
    	<ShortDesc>
        	df has_unique_id
            df has_title
           	df has_date
           	df has_editor
           	df has_photographer
    	</ShortDesc>

        <FullDesc>
          <Area full_record>
          <Title>
             "Full record"@en
             "Ficha completa"@es
          </Title>
          <Block>
             <Title>
                "Identification area"@en
                "Área de identificación"@es
             </Title>          
             <UniqueDF>
                <Label>
             		"Código de referencia"@es
             		"Reference code"@en
                </Label>
             	<Value>
             	   textBPV has_unique_id
                 </Value>
             </UniqueDF>
             df has_title
             <UniqueDF>
                <Label>
             		"Fecha"@es
             		"Date"@en
                </Label>
             	<Value>
             	   textBPV has_date
                </Value>
             </UniqueDF>
            <BlockSection>
           	   <Label>
                   "Productores"@es
                   "Producers"@en
               </Label>
               df has_editor
               df has_photographer
            </BlockSection>
          </Block>
          <Block>
             <Title>
                "Estructura y contenido"@es
             </Title>
             df formal_structure
             df orientation
             df plane
             <BlockSection>
           	   <Label>
                   "Descripción"@es
               </Label>
               textBPV has_description
               df taken_from
               df taken_facing
             </BlockSection>
             <BlockSection>
           	   <Label>
                   "Lugar de registro"@es
               </Label>
               df has_country_taken_in
               df has_state_taken_in
               df has_municipality_taken_in
             </BlockSection>
           </Block>
           <Block>
             <Title>
                "Características físicas"@es
             </Title>
             <BlockSection>
           	   <Label>
                   "Soporte primario"@es
               </Label>             
               df has_primary_dimensions
               df has_primary_materials
             </BlockSection>
             <BlockSection>
           	   <Label>
                   "Soporte secundario"@es
               </Label>
               df has_secondary_dimensions
               df has_secondary_materials
               df has_inscription
              </BlockSection>
             </Block>
          </Area>
        </FullDesc>
    </Descriptions>
  </RuleSet>

  <RuleSet person>
    <Structure>
      <Descriptor has_given_names>
        property prueba:hasGivenNames
        minCardinality 1
        maxCardinality 1
      </Descriptor>
      
      <Descriptor has_last_names>
        property prueba:hasLastNames
        minCardinality 1
        maxCardinality 1
      </Descriptor>
    </Structure>
    
    <BPVFunctions>
      <TextBPVFunction full_name_lf>
         defaultTextBPVFunction
         |{ 
           given = (@root->has_given_names).text_bpv
           last = (@root->has_last_names).text_bpv
           "#{last}, #{given}"
         }|
      </TextBPVFunction>
    </BPVFunctions>    
  </RuleSet>

  <RuleSet book>
    <Structure>
      <Descriptor has_title>
        property prueba:hasTitle
        minCardinality 1
        maxCardinality 1
        multilingual
      </Descriptor>
      
      <Descriptor has_author>
        property prueba:hasAuthor
        minCardinality 1
      </Descriptor>
    </Structure>
    
    <Descriptions>
    	<ShortDesc>
        	df has_author
            df has_title
    	</ShortDesc>

        <FullDesc>
        	<Area main>
            	<Title>
                	"Full record"@en
                	"Ficha completa"@es
            	</Title>
           		<Block>
                	df has_author
                	df has_title
                </Block>
        	</Area>
        </FullDesc>
    </Descriptions>
  </RuleSet>
  
  <RuleSet dimensions>
    <Structure>
      <Descriptor has_height>
        property prueba:hasHeight
        minCardinality 1
        maxCardinality 1
      </Descriptor>
      
      <Descriptor has_width>
        property prueba:hasWidth
        minCardinality 1
        maxCardinality 1
      </Descriptor>
      
      <Descriptor has_length>
        property prueba:hasLength
        minCardinality 1
        maxCardinality 1
      </Descriptor>
      
      <Descriptor has_measurement_unit>
        property prueba:hasMeasurementUnit
        minCardinality 1
        maxCardinality 1
      </Descriptor>
    </Structure>
    
    <KRRelationRules>
      <KRRelationRule measurement_unit_abbrev>
         has_measurement_unit->measurement_unit.has_abbreviation
      </KRRelationRule>
      
      <KRRelationRule measurement_unit_name>
         has_measurement_unit->measurement_unit.has_name
      </KRRelationRule>
    </KRRelationRules>
    
    <CompVectorFunctions>
      <CompVectorFunction volume>
        |{ 
          x = (@root->has_width).val
          y = (@root->has_height).val
          z = (@root->has_length).val
          x * y * z
        }|
      </CompVectorFunction>
    </CompVectorFunctions>
    
    <BPVFunctions>
      <TextBPVFunction default_text>
         defaultTextBPVFunction
         |{ 
           x = (@root->has_width).text_bpv
           y = (@root->has_height).text_bpv
           z = (@root->has_length).text_bpv
           abbrev = (@root->measurement_unit_abbrev).text_bpv
           "#{x} x #{y} x #{z} #{abbrev}"
         }|
      </TextBPVFunction>
    </BPVFunctions>      
  </RuleSet>
  
  <RuleSet measurement_unit>
    <Structure>
      <Descriptor has_name>
        property prueba:hasName
        minCardinality 1
        maxCardinality 1
        multilingual
      </Descriptor>
      
      <Descriptor has_abbreviation>
        property prueba:hasAbbreviation
        minCardinality 1
        maxCardinality 1
        multilingual
      </Descriptor>
    </Structure>
  </RuleSet>
  
  <RuleSet floating_point>    
    typeInCode Float
  </RuleSet>
  
  <RepositorySetup>
    <SOC photos>
      "Photos"@en
      "Fotografías"@es
      hasGroupDomain prueba:Photo
      bindToRuleSet photo
      mainLevel
    </SOC>
    
    <SOC authors>
      "Authors"@en
      "Autores"@es
      hasGroupDomain prueba:Person
      bindToRuleSet person
      secondaryLevel
    </SOC>
    
    <SOC books>
      "Books"@en
      "Libros"@es
      hasGroupDomain prueba:Book
      bindToRuleSet book
      secondaryLevel
    </SOC>
    
    <SOC measurement_unit>    
      "Measurement Units"@en
      "Unidades de medición"@es
      hasGroupDomain prueba:MeasurementUnit
      bindToRuleSet measurement_unit
      secondaryLevel
    </SOC>  
  </RepositorySetup>
</DefinitionSet>