rdf refactor
[ckanext-datagovau.git] / ckanext / datagovau / templates / package / read.rdf
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<?xml version="1.0" encoding="utf-8"?>
<rdf:RDF
        xmlns:py="http://genshi.edgewall.org/"
        xmlns:foaf="http://xmlns.com/foaf/0.1/"
        xmlns:owl="http://www.w3.org/2002/07/owl#"
        xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
        xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
        xmlns:dcat="http://www.w3.org/ns/dcat#"
        xmlns:dcam="http://purl.org/dc/dcam/"
        xmlns:aglsterms="http://www.agls.gov.au/agls/terms/"
        xmlns:agentterms="http://www.agls.gov.au/agls/agentterms/"
        xmlns:availterms="http://www.agls.gov.au/agls/availterms/"
        xmlns:adminterms="http://www.agls.gov.au/agls/adminterms/"
        xmlns:dct="http://purl.org/dc/terms/"
        >
    <dcat:Dataset rdf:about="${ h.url_for(controller='package',action='read',id=c.pkg_dict['name'], qualified=True)}">
        <dct:identifier>${c.pkg_dict['name']}</dct:identifier>
        <dct:title>${c.pkg_dict['title']}</dct:title>
        <dct:landingPage
                rdf:resource="${ h.url_for(controller='package',action='read',id=c.pkg_dict['name'], qualified=True) }"/>
        <owl:sameAs rdf:resource="urn:uuid:${c.pkg_dict['id']}"/>
        <dct:type>Dataset</dct:type>
        <dct:description>${c.pkg_dict['notes']}</dct:description>
        <dct:issued>${c.pkg_dict['metadata_created']}</dct:issued>
        <dct:modified>${c.pkg_dict['metadata_modified']}</dct:modified>
        <dct:language>en</dct:language>

<py:choose>
  <py:when test="c.pkg_dict.get('license_url',None)">
        <dct:license>${c.pkg_dict['license_url']}</dct:license>
        <dct:rights rdf:resource="${c.pkg_dict['license_url']}"/>
  </py:when>
  <py:otherwise>
        <dct:license>${c.pkg_dict['license_id']}</dct:license>
        <dct:rights rdf:resource="${c.pkg_dict['license_id']}"/>
  </py:otherwise>
</py:choose>
        <py:for each="tag_dict in c.pkg_dict.get('tags',[])">
            <dcat:keyword>${ tag_dict["name"] }</dcat:keyword>
        </py:for>
        <py:for each="group_dict in c.pkg_dict.get('groups',[])">
            <dcat:theme>${ group_dict["title"] }</dcat:theme>
        </py:for>

        <foaf:homepage
                rdf:resource="${ h.url_for(controller='package',action='read',id=c.pkg_dict['name'], qualified=True)}"/>
        <rdfs:label>${c.pkg_dict['name']}</rdfs:label>


        <py:for each="rsc_dict in c.pkg_dict['resources']">
            <dcat:distribution>
                <dcat:Distribution>
                    <dct:title>${rsc_dict.get('name')}</dct:title>
                    <owl:sameAs rdf:resource="urn:uuid:${rsc_dict.get('id')}"/>
                    <dct:description>${rsc_dict.get('description')}</dct:description>
                    <dcat:accessURL rdf:resource="${ rsc_dict.get('url') }"/>
                    <dct:created>${rsc_dict.get('created')}</dct:created>
                    <dct:modified>${rsc_dict.get('revision_timestamp')}</dct:modified>
                    <dcat:byteSize py:if="rsc_dict.get('size')">${rsc_dict.get('size')}</dcat:byteSize>
                    <dcat:mediaType py:if="rsc_dict.get('mimetype')">${rsc_dict.get('mimetype')}</dcat:mediaType>
                    <dct:extent py:if="rsc_dict.get('size')">${rsc_dict.get('size')} bytes</dct:extent>
                    <dct:format py:if="rsc_dict.get('format')">
                        <dct:IMT>
                            <rdf:value>${rsc_dict.get('format')}</rdf:value>
                            <rdfs:label>${rsc_dict.get('format')}</rdfs:label>
                        </dct:IMT>
                    </dct:format>
                    <dct:title py:if="rsc_dict.get('name')">${rsc_dict.get('name')}</dct:title>
                </dcat:Distribution>
            </dcat:distribution>
        </py:for>
        <dct:publisher py:if="c.pkg_dict.get('organization', None)">
            <rdf:Description>
                <foaf:name>${ c.pkg_dict['organization']['title'] }</foaf:name>
            </rdf:Description>
        </dct:publisher>
        <dct:creator py:if="c.pkg_dict.get('organization', None)">
            <rdf:Description>
                <foaf:name>${ c.pkg_dict['organization']['title'] }</foaf:name>
            </rdf:Description>
        </dct:creator>
        <dct:contributor>
            <rdf:Description>
                <foaf:name>${h.get_last_active_user(c.pkg_dict['id'])["display_name"]}</foaf:name>
                <foaf:mbox py:if="h.get_last_active_user(c.pkg_dict['id']).get('email', None)"
                           rdf:resource="mailto:${h.get_last_active_user(c.pkg_dict['id'])['email']}"/>
            </rdf:Description>
        </dct:contributor>


        <foaf:homepage py:if="c.pkg_dict.get('url')">${c.pkg_dict.get('url')}</foaf:homepage>
        <dcat:contactPoint py:if="c.pkg_dict.get('contact_point')">${c.pkg_dict.contact_point }</dcat:contactPoint>
        <dct:spatial py:if="c.pkg_dict.get('spatial_coverage')">${ c.pkg_dict.spatial_coverage }</dct:spatial>
        <aglsterms:AglsJuri py:if="c.pkg_dict.get('jurisdiction')">${ c.pkg_dict.jurisdiction }</aglsterms:AglsJuri>
        <dct:temporal py:if="c.pkg_dict.get('temporal_coverage')">${ c.pkg_dict.get('temporal_coverage') }</dct:temporal>
        <dct:relation py:if="c.pkg_dict.get('data_state')">
            <rdf:Description>
                <rdfs:label>Data State</rdfs:label>
                <rdf:value>${ c.pkg_dict.get('data_state') }</rdf:value>
            </rdf:Description>
        </dct:relation>
        <dct:relation py:if="c.pkg_dict.get('update_freq')">
            <rdf:Description>
                <rdfs:label>Update Frequency</rdfs:label>
                <rdf:value>${ c.pkg_dict.get('update_freq') }</rdf:value>
            </rdf:Description>
        </dct:relation>
        <dct:relation py:if="c.pkg_dict.get('agency_program')">
            <rdf:Description>
                <rdfs:label>Agency Program</rdfs:label>
                <rdf:value>${ c.pkg_dict.get('agency_program') }</rdf:value>
            </rdf:Description>
        </dct:relation>
        <dct:relation py:if="c.pkg_dict.get('granularity')">
            <rdf:Description>
                <rdfs:label>Data Granularity</rdfs:label>
                <rdf:value>${ c.pkg_dict.get('granularity') }</rdf:value>
            </rdf:Description>
        </dct:relation>
        <py:for each="extra_dict in c.pkg_dict.get('extras',[])">
            <dct:relation>
                <rdf:Description>
                    <rdfs:label>${extra_dict.get('key','')}</rdfs:label>
                    <rdf:value>${extra_dict.get('value','')}</rdf:value>
                </rdf:Description>
            </dct:relation>
        </py:for>
    </dcat:Dataset>
</rdf:RDF>