/upstream/templates/type/edition/rdf.tmpl
Type: /type/template
body: value: $def with (book)
<?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:ol="http://openlibrary.org/type/edition#"
  xmlns:owl='http://www.w3.org/2002/07/owl#'
  xmlns:bibo='http://purl.org/ontology/bibo/'
  xmlns:rdvocab='http://RDVocab.info/elements/'
  xmlns:dcterms='http://purl.org/dc/terms/'
  xmlns:dc='http://purl.org/dc/elements/1.1/'
  xmlns:dcam='http://purl.org/dc/dcam/'
>
    $if book.subtitle:
        $ title = book.title + " " + book.subtitle
    $else:
        $ title = book.title

    $ bookID = book.key
    $if book.pagination:
        $ pages = book.pagination
    $else:
        $ pages = book.number_of_pages

    $def display(tag, value):
        $if isinstance(value, list):
            $for x in value:
                <$tag>$x</$tag>
        $elif value:
            <$tag>$value</$tag>

    <rdf:Description rdf:about="http://openlibrary.org$bookID">
        <!-- authors -->
        <bibo:authorList rdf:parseType="Collection">
          $for a in book.authors:
              <rdf:Description rdf:about="http://openlibrary.org$a.key">
                 <rdf:value>$a.name</rdf:value>
              </rdf:Description>
        </bibo:authorList>
        $:display("dcterms:contributor", book.contributions)
        <!-- bibliographic description -->
        $:display("dcterms:title", title)
        $:display("dcterms:publisher", book.publishers)
        $:display("rdvocab:placeOfPublication", book.publish_places)
        $:display("dcterms:issued", book.publish_date)
        $:display("dcterms:extent", pages)
        $:display("rdvocab:dimensions", book.physical_dimensions)
        $:display("bibo:edition", book.edition_name)
        <!-- subjects -->
        $:display("dc:subject", book.subjects)
        $for DDC in book.dewey_decimal_class:   
            <dcterms:subject>
                <rdf:Description>
                    <dcam:memberOf rdf:resource="http://purl.org/dc/terms/DDC"/>
                    <rdf:value>$DDC</rdf:value>
                </rdf:Description>
            </dcterms:subject>
        $for LCC in book.lc_classifications:
             <dcterms:subject>
                <rdf:Description>
                    <dcam:memberOf rdf:resource="http://purl.org/dc/terms/LCC"/>
                    <rdf:value>$LCC</rdf:value>
                </rdf:Description>
            </dcterms:subject>
        <!-- description -->
        $:display("dcterms:description", book.description)
        $:display("rdvocab:note", book.notes)
        $for lang in book.languages:
            <dcterms:language>$lang.code</dcterms:language>
        <!-- identifiers -->
        $:display("dcterms:identifier", book.key)
        $:display("bibo:oclcnum", book.oclc_numbers)
        $:display("bibo:lccn", book.lccn)
        $:display("bibo:isbn10", book.isbn_10)
        $:display("bibo:isbn13", book.isbn_13)
        <!-- administrative -->
        $:display("dcterms:modified", book.last_modified)
    </rdf:Description>
</rdf:RDF>
title: RDF template for editions
plugin: openlibrary