All Downloads are FREE. Search and download functionalities are using the official Maven repository.

home.templates.rif.vm Maven / Gradle / Ivy

There is a newer version: 1.10.2
Show newest version
#macro(showElementRifCS $tag $field $attr $label $anzsrc)
    #set($valueMap = $util.getList($item, $field))
    #foreach($key in $valueMap.keySet())
        #set($value = $valueMap.get($key))     
            #if ($label != "" && $value.get($label)!= "")				
                #set($labelVal = $value.get($label))				
                #if ($anzsrc == "anzsrc")
                    #set($lastIndex = $labelVal.lastIndexOf('/') + 1 )
                    #set($labelVal = $labelVal.substring($lastIndex) )
                #end
    			<$tag$attr>$util.encodeXml($labelVal) 
        	#end
    #end
#end

#macro(showRelatedInfo $field $relatedInfoType $identifierType)
    
    #set($valueMap = $util.getList($item, $field))
    #foreach($key in $valueMap.keySet())
        #set ($row = $valueMap.get($key))
        #set ($value = $row.get("dc:identifier"))
        #if ("$!value" != "")
        
            $util.encodeXml($value)
            #set ($title = $row.get("dc:title"))
            #if ("$!title" != "")
            $util.encodeXml($title)
            #end
## Uncomment to map Notes as well
##            #set ($notes = $row.get("skos:note"))
##            #if ("$!notes" != "")
##            $util.encodeXml($notes)
##            #end
        
        #end
    #end
#end

#macro(showRelatedObject $field $relatedInfoType $identifierType)
    
    #set($valueMap = $util.getList($item, $field))
    #foreach($key in $valueMap.keySet())
        #set ($row = $valueMap.get($key))
        #set ($value = $row.get("dc:identifier"))
        #if ("$!value" != "")
        
            $util.encodeXml($value)
            #set ($relationship = $row.get("vivo:Relationship.rdf:PlainLiteral"))
            #if ("$relationship" != "")
            
            #end
        
        #end
    #end
#end


#macro(geoSpatialMacro $field)
    #set($valueMap = $util.getList($item, $field))
    #foreach($key in $valueMap.keySet())
        #set($geoMap = $valueMap.get($key))
        #set($wkt = $geoMap.get("redbox:wktRaw"))
        #set($literal = $geoMap.get("rdf:PlainLiteral"))
        #set($type = $geoMap.get("dc:type"))

        #if($literal != "")
            #### Non - OpenLayers data
            #if($wkt == "")
                
                    $util.encodeXml($literal)
                #if($type == "text")
                    #set($east = $geoMap.get("geo:long"))
                    #set($north = $geoMap.get("geo:lat"))
                    #if ("$!east" != "" &&"$!north" != "")
                    name=$util.encodeXml($literal); east=$east; north=$north; projection=WGS84
                    #end
                #end
                


            #### OpenLayers data
            #else
                #if($type != "")
                    
                        $util.encodeXml($literal)
                    
                #end
            #end
        #end
    #end
#end

#set($quote='"')
#set($dateFormat = "yyyy-MM-dd'T'HH:mm:ss")

#set($defaultOnError = "&Invalid XML placeholder... prevents ANDS Harvesting records in error&")
#set($group = $systemConfig.getString($defaultOnError, "redbox.identity", "RIF-CS Group"))

### Resolve the identifier
#set ($formId = $util.get($item, 'dc:identifier.rdf:PlainLiteral'))
#set ($formOrigin = $util.get($item, 'dc:identifier.redbox:origin'))
#set ($formType = $util.get($item, 'dc:identifier.dc:type.rdf:PlainLiteral'))

#set($pidType = $systemConfig.getString($defaultOnError, "curation", "pidType"))
#set($pidProperty = $systemConfig.getString($defaultOnError, "curation", "pidProperty"))
#set ($pid = $util.getMetadata($object, $pidProperty))
#if ("$!pid" == "")
    #set ($pid = $util.get($item, "metadata", "rdf:resource"))
    #if ("$!pid" == "")
        #set ($pid = $util.get($item, "metadata", "dc.identifier"))
    #end
#end

#set ($identifier = "")
#set ($identifierType = "")
#if ($formOrigin == "internal")
    #if ($pid != "")
        #set ($identifier = $util.encodeXml($pid))
        #set ($identifierType = $util.encodeXml($pidType))
    #else
        #set ($identifier = $util.encodeXml("$urlBase/detail/$oid"))
        #set ($identifierType = "uri")
    #end
#else
    #set ($identifier = $util.encodeXml($formId))
    #set ($identifierType = $util.encodeXml($formType))
#end
#if ("$!identifier" == "")
    ## We want invalid XML here so the record is never harvested without the correct ID
    #set($identifier = "&Invalid ID: Not curated yet&")
    #set ($identifierType = "invalid")
#end

### Relationships
#set($relationships = $item.getJsonSimpleList("relationships"))

####set($lang = "xml:lang=${quote}$util.get($item, 'dc:language.dc:identifier')${quote}")
#set($lang = "xml:lang=${quote}en${quote}")

    

        $identifier
        $urlBase

        #set($dateModified = "")
        #if ($util.get($item, 'dc:modified') != "")
            #set($rawModified = "$util.getDateTime($util.get($item, 'dc:modified'), $dateFormat)")
            #set($dateModified = "dateModified=${quote}${rawModified}${quote}")
        #end

        #set($dateAccessioned = "")
        #if ($util.get($item, "dc:created") != "")
            #set($rawAccessioned = "$util.getDateTime($util.get($item, 'dc:created'), $dateFormat)")
            #set($dateAccessioned = "dateAccessioned=${quote}${rawAccessioned}${quote}")
        #end

        #################
        ## The order of child codes under  is important, don't
        ## change the order or the XML will not validate:
        ##  1)  
        ##  2)  
        ##  3)  
        ##  4)  
        ##  5)  
        ##  6)  
        ##  7)  
        ##  8)  
        ##  9)  
        ##  10) 
        ##
        ##  http://services.ands.org.au/documentation/rifcs/1.3/schemadocs/registryObjects.html
        #################
        
            $identifier

            
                $util.encodeXml($util.get($item, "dc:title"))
            

        ## Location
        #set($valueMap = $util.getList($item, "bibo:Website"))
        #set($firstValue = "")
        #if ($valueMap.size() > 0)
            #set($firstValue = $valueMap.get("1").get("dc:identifier"))
        #end
        #set ($physicalLocation = $util.get($item, "vivo:Location.vivo:GeographicLocation.gn:name"))
        #if ("$!physicalLocation" != "" || "$!firstValue" != "")
            
            #foreach($key in $valueMap.keySet())
                #set ($value = $valueMap.get($key).get("dc:identifier"))
                #if ("$!value" != "")
                
                    
                        $util.encodeXml($value)
                    
                
                #end
            #end

            #### Physical location
            #if ("$!physicalLocation" != "")
                
                    
                        $util.encodeXml($physicalLocation)
                    
                
            #end
            
        #end

        #set ($covFrom = $util.get($item, "dc:coverage.vivo:DateTimeInterval.vivo:start"))
        #set ($covTo = $util.get($item, "dc:coverage.vivo:DateTimeInterval.vivo:end"))
        #set ($covPeriod = $util.get($item, "dc:coverage.redbox:timePeriod"))
        #if ("$!covFrom" != "" || "$!covTo" != "" || "$!covPeriod" != "")
            
                
                    #if ("$!covFrom" != "")
                    $util.getDateTime($covFrom, $dateFormat)Z
                    #end
                    #if ("$!covTo" != "")
                    $util.getDateTime($covTo, $dateFormat)Z
                    #end
                    #if ("$!covPeriod" != "")
                    $util.encodeXml($covPeriod)
                    #end
                
            
        #end

            #geoSpatialMacro("dc:coverage.vivo:GeographicLocation")

            ### Relations
            #set($valueList = $item.getJsonSimpleList("relationships"))
            #if($valueList)
                #foreach($value in $valueList)
                    #if ($value.getBoolean(false, "isCurated"))
                        #set($key = $value.getString("empty", "curatedPid"))
                        #set($rel = $value.getString("hasAssociationWith", "relationship"))
                        #set($desc = $value.getString("empty", "description"))
                        #if ($key != "empty")
            
                $util.encodeXml($key)
                            #if ($desc != "empty")
                
                    $util.encodeXml($desc)
                
                            #else
                
                            #end
            
                        #end
                    #end
                #end
            #end

            ### National Library Creators - Non-curated
            #set($valueMap = $util.getList($item, "dc:creator.foaf:Person"))
            #foreach($key in $valueMap.keySet())
                #set ($value = $valueMap.get($key).get("dc:identifier"))
                #if ("$!value" != "" && $value.startsWith("http://nla.gov.au/nla.party-"))
            
                $util.encodeXml($value)
                
            
                #end
            #end
			
			
			
           	#showElementRifCS ("rif:subject"  "dc:subject.vivo:keyword"  " type=${quote}local${quote} $lang"  "rdf:PlainLiteral"  "")
            #showElementRifCS ("rif:subject"  "dc:subject.anzsrc:for"  " type=${quote}anzsrc-for${quote} $lang"  "rdf:resource"  "anzsrc")
            #showElementRifCS ("rif:subject"  "dc:subject.anzsrc:seo"  " type=${quote}anzsrc-seo${quote} $lang"  "rdf:resource"  "anzsrc")
            

			
            
        #set ($value = $util.get($item, "dc:subject.anzsrc:toa.skos:prefLabel"))
        #if ("$!value" != "")
            $util.encodeXml($value)
        #end

        #set ($value = $util.get($item, "dc:description"))
        #if ("$!value" != "")
            $util.encodeXml($value)
        #end

        #################
        ## Rights
        #set ($accessRights = $util.get($item, "dc:accessRights.skos:prefLabel"))
        #set ($accessRightsUri = $util.get($item, "dc:accessRights.dc:identifier"))
        #set ($accessRightsUriStr = "")
        #if ("$!accessRightsUri" != "")
            #set ($accessRightsUriStr = " rightsUri=${quote}${accessRightsUri}${quote}")
        #end
        #set ($rights = $util.get($item, "dc:accessRights.dc:RightsStatement.skos:prefLabel"))
        #set ($rightsUri = $util.get($item, "dc:accessRights.dc:RightsStatement.dc:identifier"))
        #set ($rightsUriStr = "")
        #if ("$!rightsUri" != "")
            #set ($rightsUriStr = " rightsUri=${quote}${rightsUri}${quote}")
        #end
        #set ($licence = $util.get($item, "dc:license.skos:prefLabel"))
        #set ($licenceUri = $util.get($item, "dc:license.dc:identifier"))
        #set ($licenceUriStr = "")
        #if ("$!licenceUri" != "")
            #set ($licenceUriStr = " rightsUri=${quote}${licenceUri}${quote}")
        #else
            #set ($licence = $util.get($item, "dc:license.rdf:Alt.skos:prefLabel"))
            #set ($licenceUri = $util.get($item, "dc:license.rdf:Alt.dc:identifier"))
            #if ("$!licenceUri" != "")
                #set ($licenceUriStr = " rightsUri=${quote}${licenceUri}${quote}")
            #end
        #end

        #if ("$!accessRights" != "" || "$!rights" != "" || "$!licence" != "")
            
            #if ("$!rights" != "")
                $util.encodeXml($rights)
            #end
            #if ("$!accessRights" != "")
                $util.encodeXml($accessRights)
            #end
            #if ("$!licence" != "")
                $util.encodeXml($licence)
            #end
            
        #end
        #################
		
        #showRelatedInfo("dc:relation.swrc:Publication", "publication", "uri")
        #showRelatedInfo("dc:relation.bibo:Website", "website", "uri")
        #showRelatedInfo("dc:relation.vivo:Service", "service", "uri")
		#showRelatedObject("dc:relation.vivo:Service", "service", "local")
        #set($showCitation = $util.get($item, "dc:biblioGraphicCitation.redbox:sendCitation"))
        #if ("$!showCitation" != "" && $showCitation == "on")
            #set($doiProperty = $systemConfig.getString($defaultOnError, "andsDoi", "doiProperty"))
            #set ($doi = $util.getMetadata($object, $doiProperty))
            ## Use the DOI by preference for a citation
            #if ("$!doi" == "")
                #set ($citeId = $identifier)
                #set ($citeIdType = $identifierType)
            #else
                #set ($citeId = "http://dx.doi.org/${doi}")
                #set ($citeIdType = "doi")
            #end
            
            #set($citationString = $util.get($item, "dc:biblioGraphicCitation.skos:prefLabel"))
            #if ("$!citationString" != "")
                $util.encodeXml($citationString.replaceAll("\{ID_WILL_BE_HERE\}", $citeId))
            #end
            ##  has now been removed.
            ## See http://code.google.com/p/redbox-mint/issues/detail?id=77
            
        #end
        
    




© 2015 - 2024 Weber Informatics LLC | Privacy Policy