rdf refactor
rdf refactor

<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<rdf:RDF <rdf:RDF
xmlns:py="http://genshi.edgewall.org/" xmlns:py="http://genshi.edgewall.org/"
xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:owl="http://www.w3.org/2002/07/owl#" xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dcat="http://www.w3.org/ns/dcat#" xmlns:dcat="http://www.w3.org/ns/dcat#"
xmlns:dcam="http://purl.org/dc/dcam/" xmlns:dcam="http://purl.org/dc/dcam/"
xmlns:aglsterms="http://www.agls.gov.au/agls/terms/" xmlns:aglsterms="http://www.agls.gov.au/agls/terms/"
xmlns:agentterms="http://www.agls.gov.au/agls/agentterms/" xmlns:agentterms="http://www.agls.gov.au/agls/agentterms/"
xmlns:availterms="http://www.agls.gov.au/agls/availterms/" xmlns:availterms="http://www.agls.gov.au/agls/availterms/"
xmlns:adminterms="http://www.agls.gov.au/agls/adminterms/" xmlns:adminterms="http://www.agls.gov.au/agls/adminterms/"
xmlns:dct="http://purl.org/dc/terms/" 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)}"> <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:identifier>${c.pkg_dict['name']}</dct:identifier>
<dct:title>${c.pkg_dict['title']}</dct:title> <dct:title>${c.pkg_dict['title']}</dct:title>
<dct:landingPage <dct:landingPage
rdf:resource="${ h.url_for(controller='package',action='read',id=c.pkg_dict['name'], qualified=True) }"/> 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']}"/> <owl:sameAs rdf:resource="urn:uuid:${c.pkg_dict['id']}"/>
<dct:type>Dataset</dct:type> <dct:type>Dataset</dct:type>
<dct:description>${c.pkg_dict['notes']}</dct:description> <dct:description>${c.pkg_dict['notes']}</dct:description>
<dct:issued>${c.pkg_dict['metadata_created']}</dct:issued> <dct:issued>${c.pkg_dict['metadata_created']}</dct:issued>
<dct:modified>${c.pkg_dict['metadata_modified']}</dct:modified> <dct:modified>${c.pkg_dict['metadata_modified']}</dct:modified>
<dct:language>en</dct:language>  
   
<py:choose> <py:choose>
<py:when test="c.pkg_dict.get('license_url',None)"> <py:when test="c.pkg_dict.get('license_url',None)">
<dct:license>${c.pkg_dict['license_url']}</dct:license> <dct:license rdf:resource="${c.pkg_dict['license_url']}"/>
<dct:rights rdf:resource="${c.pkg_dict['license_url']}"/> <dct:rights rdf:resource="${c.pkg_dict['license_url']}"/>
</py:when> </py:when>
<py:otherwise> <py:otherwise>
<dct:license>${c.pkg_dict['license_id']}</dct:license> <dct:license>${c.pkg_dict['license_id']}</dct:license>
<dct:rights rdf:resource="${c.pkg_dict['license_id']}"/> <dct:rights>"${c.pkg_dict['license_id']}"</dct:rights>
</py:otherwise> </py:otherwise>
</py:choose> </py:choose>
<py:for each="tag_dict in c.pkg_dict.get('tags',[])"> <py:for each="tag_dict in c.pkg_dict.get('tags',[])">
<dcat:keyword>${ tag_dict["name"] }</dcat:keyword> <dcat:keyword>${ tag_dict["name"] }</dcat:keyword>
</py:for> </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']"> <py:for each="rsc_dict in c.pkg_dict['resources']">
<dcat:distribution> <dcat:distribution>
<dcat:Distribution> <dcat:Distribution>
<dct:title>${rsc_dict.get('name')}</dct:title> <dct:title>${rsc_dict.get('name')}</dct:title>
<owl:sameAs rdf:resource="urn:uuid:${rsc_dict.get('id')}"/> <owl:sameAs rdf:resource="urn:uuid:${rsc_dict.get('id')}"/>
<dct:description>${rsc_dict.get('description')}</dct:description> <dct:description>${rsc_dict.get('description')}</dct:description>
<dcat:accessURL rdf:resource="${ rsc_dict.get('url') }"/> <dcat:accessURL rdf:resource="${ rsc_dict.get('url') }"/>
<dct:created>${rsc_dict.get('created')}</dct:created> <dct:created>${rsc_dict.get('created')}</dct:created>
<dct:modified>${rsc_dict.get('revision_timestamp')}</dct:modified> <dct:modified>${rsc_dict.get('revision_timestamp')}</dct:modified>
<dcat:byteSize py:if="rsc_dict.get('size')">${rsc_dict.get('size')}</dcat:byteSize> <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> <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:extent py:if="rsc_dict.get('size')">${rsc_dict.get('size')} bytes</dct:extent>
<dct:format py:if="rsc_dict.get('format')"> <dct:format py:if="rsc_dict.get('format')">
<dct:IMT> <dct:IMT>
<rdf:value>${rsc_dict.get('format')}</rdf:value> <rdf:value>${rsc_dict.get('format')}</rdf:value>
<rdfs:label>${rsc_dict.get('format')}</rdfs:label> <rdfs:label>${rsc_dict.get('format')}</rdfs:label>
</dct:IMT> </dct:IMT>
</dct:format> </dct:format>
<dct:title py:if="rsc_dict.get('name')">${rsc_dict.get('name')}</dct:title> <dct:title py:if="rsc_dict.get('name')">${rsc_dict.get('name')}</dct:title>
</dcat:Distribution> </dcat:Distribution>
</dcat:distribution> </dcat:distribution>
</py:for> </py:for>
   
   
  <!-- data.gov.au specific stuff below this line -->
<dct:publisher py:if="c.pkg_dict.get('organization', None)"> <dct:publisher py:if="c.pkg_dict.get('organization', None)">
<rdf:Description> <rdf:Description>
<foaf:name>${ c.pkg_dict['organization']['title'] }</foaf:name> <foaf:name>${ c.pkg_dict['organization']['title'] }</foaf:name>
</rdf:Description> </rdf:Description>
</dct:publisher> </dct:publisher>
<dct:creator py:if="c.pkg_dict.get('organization', None)"> <dct:creator py:if="c.pkg_dict.get('organization', None)">
<rdf:Description> <rdf:Description>
<foaf:name>${ c.pkg_dict['organization']['title'] }</foaf:name> <foaf:name>${ c.pkg_dict['organization']['title'] }</foaf:name>
</rdf:Description> </rdf:Description>
</dct:creator> </dct:creator>
<dct:contributor> <dct:contributor>
<rdf:Description> <rdf:Description>
<foaf:name>${h.get_last_active_user(c.pkg_dict['id'])["display_name"]}</foaf:name> <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)" <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:resource="mailto:${h.get_last_active_user(c.pkg_dict['id'])['email']}"/>
</rdf:Description> </rdf:Description>
</dct:contributor> </dct:contributor>
   
  <py:for each="extra_dict in c.pkg_dict.get('extras',[])">
<foaf:homepage py:if="c.pkg_dict.get('url')">${c.pkg_dict.get('url')}</foaf:homepage> <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>
  <dct:language>en</dct:language>
  <foaf:homepage
  rdf:resource="${ h.url_for(controller='package',action='read',id=c.pkg_dict['name'], qualified=True)}"/>
<dcat:contactPoint py:if="c.pkg_dict.get('contact_point')">${c.pkg_dict.contact_point }</dcat:contactPoint> <dcat:contactPoint py:if="c.pkg_dict.get('contact_point')">${c.pkg_dict.contact_point }</dcat:contactPoint>
  <py:choose>
  <py:when test="c.pkg_dict.get('spatial',None)">
  <dct:spatial py:if="c.pkg_dict.get('spatial')">${ c.pkg_dict.spatial }</dct:spatial>
  </py:when>
  <py:otherwise>
<dct:spatial py:if="c.pkg_dict.get('spatial_coverage')">${ c.pkg_dict.spatial_coverage }</dct:spatial> <dct:spatial py:if="c.pkg_dict.get('spatial_coverage')">${ c.pkg_dict.spatial_coverage }</dct:spatial>
  </py:otherwise>
  </py:choose>
<aglsterms:AglsJuri py:if="c.pkg_dict.get('jurisdiction')">${ c.pkg_dict.jurisdiction }</aglsterms:AglsJuri> <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: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')"> <dct:relation py:if="c.pkg_dict.get('data_state')">
<rdf:Description> <rdf:Description>
<rdfs:label>Data State</rdfs:label> <rdfs:label>Data State</rdfs:label>
<rdf:value>${ c.pkg_dict.get('data_state') }</rdf:value> <rdf:value>${ c.pkg_dict.get('data_state') }</rdf:value>
</rdf:Description> </rdf:Description>
</dct:relation> </dct:relation>
<dct:relation py:if="c.pkg_dict.get('update_freq')"> <dct:relation py:if="c.pkg_dict.get('update_freq')">
<rdf:Description> <rdf:Description>
<rdfs:label>Update Frequency</rdfs:label> <rdfs:label>Update Frequency</rdfs:label>
<rdf:value>${ c.pkg_dict.get('update_freq') }</rdf:value> <rdf:value>${ c.pkg_dict.get('update_freq') }</rdf:value>
</rdf:Description> </rdf:Description>
</dct:relation> </dct:relation>
<dct:relation py:if="c.pkg_dict.get('agency_program')"> <dct:relation py:if="c.pkg_dict.get('agency_program')">
<rdf:Description> <rdf:Description>
<rdfs:label>Agency Program</rdfs:label> <rdfs:label>Agency Program</rdfs:label>
<rdf:value>${ c.pkg_dict.get('agency_program') }</rdf:value> <rdf:value>${ c.pkg_dict.get('agency_program') }</rdf:value>
</rdf:Description> </rdf:Description>
</dct:relation> </dct:relation>
<dct:relation py:if="c.pkg_dict.get('granularity')"> <dct:relation py:if="c.pkg_dict.get('granularity')">
<rdf:Description> <rdf:Description>
<rdfs:label>Data Granularity</rdfs:label> <rdfs:label>Data Granularity</rdfs:label>
<rdf:value>${ c.pkg_dict.get('granularity') }</rdf:value> <rdf:value>${ c.pkg_dict.get('granularity') }</rdf:value>
</rdf:Description> </rdf:Description>
</dct:relation> </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> </dcat:Dataset>
</rdf:RDF> </rdf:RDF>