It looks like you're offline.
Open Library logo
additional options menu

type/work/rdf

This doc was last edited by Anand Chitipothu June 21, 2011.

plugin openlibrary
Templates in the website are disabled now. Editing them will not have any effect on the live website.
   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
$def with (work)
<?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:rdrel='http://RDVocab.info/RDARelationshipsWEMI/'
  xmlns:dcterms='http://purl.org/dc/terms/'
  xmlns:dcam='http://purl.org/dc/dcam/'
  xmlns:ov='http://open.vocab.org/terms/'
  xmlns:frbr='http://purl.org/vocab/frbr/core#'
>

    $ wuri = "http://openlibrary.org" + work.key + "/"
    $ wAbout = "http://openlibrary.org" + work.key + "/about/"

    $if work.subtitle:
           $ title = work.title + ": " + work.subtitle
    $else:
           $ title = work.title

    $def display(tag, value):
        $if isinstance(value, list):
            $for x in value:
                <$tag>$x</$tag>
        $elif value:
            <$tag>$value</$tag>

    <frbr:Work rdf:about="$wuri">
        $:display("dcterms:title", title)

        $for a in work.authors:
            <dcterms:creator>
              <rdf:Description rdf:about="http://openlibrary.org$a.author.key">
              <rdf:value>$a.author.name</rdf:value> 
              </rdf:Description>
            </dcterms:creator> 
       
       
        $:display("dcterms:subject", work.subjects)
        $:display("dcterms:coverage", work.subject_places)
        $:display("dcterms:coverage", work.subject_times)
        $:display("dcterms:description", work.description)

        $for DDC in work.dewey_number:   
            <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 work.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>

        $:display("dcterms:date", work.first_publish_date)

        $:display("dcterms:alternative", work.other_titles) 

        $for link in work.links:
            <foaf:page>
                <foaf:Document rdf:about="$link.url">
                    <rdfs:label>$link.title</rdfs:label>
                </foaf:Document>
            </foaf:page>
        </frbr:Work> 

        $for edition in work.editions:
            $ eduri = "http://openlibrary.org" + edition.key + "/"
            $if edition.subtitle:
               $ etitle = edition.title + ": " + edition.subtitle
            $else:
              $ etitle = edition.title

            <rdf:Description rdf:about="$eduri">
               <rdrel:workManifested>
                  "$wuri"
                 </rdrel:workManifested>
                <dcterms:title>$etitle</dcterms:title>
                <dcterms:date>$edition.publish_date</dcterms:date>
            </rdf:Description>    

    
    <!-- administrative -->
    <rdf:Description rdf:about="$wAbout">
        <dcterms:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">$work.last_modified</dcterms:modified>
        <dcterms:created rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">$work.created</dcterms:created>
        <ov:versionnumber>$work.revision</ov:versionnumber>
    </rdf:Description>

</rdf:RDF>