smurp / huviz

interactive, customizable semantic web visualization
GNU General Public License v3.0
14 stars 4 forks source link

break out the comma-delimited details in STANDARD NAME= #8

Open smurp opened 11 years ago

smurp commented 11 years ago

Here are some examples of where the_name has more than one comma:

        "Smith, Maria,, 1773 - 1829"
        "Abergavenny, Frances Neville,,, Baroness", 
        "Abergavenny, Frances Neville,,, Baroness", 
        "Rutland, Thomas Manners,,, third Earl of", 
        "Anne,, second queen of Henry VIII", 
        "Bergavenny, Joan,,, Lady"
        "Abergavenny, Frances Neville,,, Baroness", 
        "Rutland, Thomas Manners,,, third Earl of", 
        "Anne,, second queen of Henry VIII", 

Based on the above it looks like the format is:

Surname,GivenName,Comment,YearOfBirth - YearOfDeath,Title

Could someone confirm this? This stuff could be turned into knowledge as appropriate.

jefferya commented 11 years ago

The quick answer. The multiple commas indicate how to turn the standard name (i.e. authority list identifier and representation for sorting) into a display format. Years are only added if needed to differentiate 2 people with the same name. Titles such as royal titles are included in the standard name when applicable.

Here is a quick coded example for turning the standard name into a readable form. There is another way if for a sortable list.

<xsl:template name="name_standard_to_readible_with_param">
    <xsl:param name="standard_name" />
    <!--    <xsl:variable name="standard_name"><xsl:value-of select="@STANDARD" /></xsl:variable> -->
    <xsl:variable name="last_bit" select="substring-before($standard_name,',')" /> 
    <xsl:variable name="first"  select="substring-after ($standard_name,',')" />
    <xsl:variable name="tmp">
        <xsl:choose>
            <xsl:when test="contains($standard_name, ',,,')">
                <xsl:value-of select="substring-before($first,',,,')" />
                <xsl:text>, </xsl:text>
                <xsl:value-of select="substring-after($first,',,,')" />
                <xsl:text> </xsl:text>
                <xsl:value-of select="$last_bit" />  
            </xsl:when>
            <xsl:when test="contains($standard_name, ',,')">
                <xsl:value-of select="substring-before($first,',,')" />
                <xsl:text> </xsl:text>
                <xsl:value-of select="$last_bit" />
                <xsl:text>, </xsl:text>
                <xsl:value-of select="substring-after($first,',,')" />  
            </xsl:when>
            <xsl:when test="contains($standard_name, ',')">
                <xsl:value-of select="$first" />
                <xsl:text> </xsl:text>
                <xsl:value-of select="$last_bit" />  
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="$standard_name" />
            </xsl:otherwise>
        </xsl:choose> 
    </xsl:variable>
    <xsl:value-of select="normalize-space($tmp)" />
</xsl:template>