/upstream/templates/type/author/rdf.tmpl
Type: /type/template
body: value: $def with (author)
<?xml version="1.0" encoding="utf-8"?>
<rdf:RDF
  xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
  xmlns:rdfs='http://www.w3.org/2000/01/rdf-schema#'
  xmlns:bio='http://purl.org/vocab/bio/0.1/'
  xmlns:rdg2='http://rdvocab.info/ElementsGr2/'
  xmlns:dcterms='http://purl.org/dc/terms/'
  xmlns:foaf='http://xmlns.com/foaf/0.1/'
  xmlns:ov='http://open.vocab.org/terms/'
>

    $if author.enumeration:
        $ name = author.name + ", " + author.enumeration
    $else:
        $ name = author.name

    $ auri = "http://openlibrary.org" + author.key + "/"
    $ auAbout = "http://openlibrary.org" + author.key + "/about/"


    $def display(tag, value):
        $if isinstance(value, list):
            $for x in value:
                <$tag>$x</$tag>
        $elif value:
            <$tag>$value</$tag>
            

    <foaf:Person rdf:about="http://openlibrary.org$author.key">
        $:display("foaf:name", name)
        $:display("rdg2:variantNameForThePerson", author.alternate_names)
        $:display("rdg2:biographicalInformation", author.bio)
        $:display("rdg2:titleOfThePerson", author.title)

      $if author.birth_date:
        <bio:event>
            <bio:Birth>
                 <dcterms:date>$author.birth_date</dcterms:date>
            </bio:Birth>
        </bio:event>

      $if author.death_date:
        <bio:event>
            <bio:Death>
                <dcterms:date>$author.death_date</dcterms:date>
            </bio:Death>
        </bio:event> 


        $if author.wikipedia:
            <foaf:isPrimaryTopicOf>
                <foaf:Document rdf:about="$author.wikipedia">
                    <rdfs:label>Wikipedia</rdfs:label>
                </foaf:Document>
            </foaf:isPrimaryTopicOf>

        $for link in author.links:
            <foaf:page>
                <foaf:Document rdf:about="$link.url">
                    <rdfs:label>$link.title</rdfs:label>
                </foaf:Document>
            </foaf:page>
        
        $for photo in author.photos:    
            $ auphoto = "http://covers.openlibrary.org/b/id/" + str(photo) + "-M.jpg"
            <foaf:depiction>
            <foaf:Image rdf:about="$auphoto" /></foaf:depiction>

    </foaf:Person>

    <!-- administrative -->
    <rdf:Description rdf:about="$auAbout">
        <dcterms:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">$author.last_modified</dcterms:modified>
        <dcterms:created rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">$author.created</dcterms:created>
        <ov:versionnumber>$author.revision</ov:versionnumber>
    </rdf:Description>
</rdf:RDF>
title: Author RDF
plugin: openlibrary