Commit 29f3e1e394812d769a8469a6d16affd0750a2d6e

Authored by Barry Norton
1 parent 4fcdaba73c
Exists in master

Added place to release event, according to new area entity

Showing 1 changed file with 24 additions and 10 deletions

mappings/release.ttl View file @ 29f3e1e
... ... @@ -24,6 +24,7 @@
24 24  
25 25 lb:sm_artist rr:template "http://musicbrainz.org/artist/{gid}#_" .
26 26 lb:sm_release rr:template "http://musicbrainz.org/release/{gid}#_" .
  27 +lb:sm_release_event rr:template "http://musicbrainz.org/release/{gid}#{country}" .
27 28  
28 29 lb:Release a rr:TriplesMap ;
29 30 rr:logicalTable [rr:tableName "release"] ;
... ... @@ -86,7 +87,8 @@
86 87 lb:ReleaseEvent a rr:TriplesMap ;
87 88 rr:logicalTable [rr:sqlQuery
88 89 """SELECT release.gid, area.gid AS country
89   - FROM release INNER JOIN release_country ON release_country.release = release.id
  90 + FROM release
  91 + INNER JOIN release_country ON release_country.release = release.id
90 92 INNER JOIN area ON area.id = release_country.country
91 93 WHERE date_year IS NOT NULL
92 94 AND date_month IS NOT NULL
93 95  
... ... @@ -104,13 +106,13 @@
104 106 BTRIM(TO_CHAR(date_month, '00')) || '-' ||
105 107 BTRIM(TO_CHAR(date_day, '00')) AS date,
106 108 area.gid AS country
107   - FROM release INNER JOIN release_country ON release_country.release = release.id
  109 + FROM release
  110 + INNER JOIN release_country ON release_country.release = release.id
108 111 INNER JOIN area ON area.id = release_country.country
109 112 WHERE date_year IS NOT NULL
110 113 AND date_month IS NOT NULL
111 114 AND date_day IS NOT NULL"""] ;
112   - rr:subjectMap [rr:class mo:ReleaseEvent ;
113   - rr:template "http://musicbrainz.org/release/{gid}#{country}"] ;
  115 + rr:subjectMap lb:sm_release_event ;
114 116 rr:predicateObjectMap
115 117 [rr:predicate dc:date ;
116 118 rr:objectMap [rr:column "date"; rr:datatype xsd:date]] .
117 119  
... ... @@ -121,13 +123,13 @@
121 123 BTRIM(TO_CHAR(date_year, '0000')) || '-' ||
122 124 BTRIM(TO_CHAR(date_month, '00')) AS year_month,
123 125 area.gid AS country
124   - FROM release INNER JOIN release_country ON release_country.release = release.id
  126 + FROM release
  127 + INNER JOIN release_country ON release_country.release = release.id
125 128 INNER JOIN area ON area.id = release_country.country
126 129 WHERE date_year IS NOT NULL
127 130 AND date_month IS NOT NULL
128 131 AND date_day IS NULL"""] ;
129   - rr:subjectMap [rr:class mo:ReleaseEvent ;
130   - rr:template "http://musicbrainz.org/release/{gid}#{country}"] ;
  132 + rr:subjectMap lb:sm_release_event ;
131 133 rr:predicateObjectMap
132 134 [rr:predicate dc:date ;
133 135 rr:objectMap [rr:column "year_month"; rr:datatype xsd:gYearMonth]] .
134 136  
135 137  
... ... @@ -137,14 +139,26 @@
137 139 """SELECT release.gid,
138 140 BTRIM(TO_CHAR(date_year, '0000')) AS year,
139 141 area.gid AS country
140   - FROM release INNER JOIN release_country ON release_country.release = release.id
  142 + FROM release
  143 + INNER JOIN release_country ON release_country.release = release.id
141 144 INNER JOIN area ON area.id = release_country.country
142 145 WHERE date_year IS NOT NULL
143 146 AND date_month IS NULL
144 147 AND date_day IS NULL"""] ;
145   - rr:subjectMap [rr:class mo:ReleaseEvent ;
146   - rr:template "http://musicbrainz.org/release/{gid}#{country}"] ;
  148 + rr:subjectMap lb:sm_release_event ;
147 149 rr:predicateObjectMap
148 150 [rr:predicate dc:date ;
149 151 rr:objectMap [rr:column "year"; rr:datatype xsd:gYear]] .
  152 +
  153 +lb:release_event_place a rr:TriplesMap ;
  154 + rr:logicalTable [rr:sqlQuery
  155 + """SELECT release.gid, area.gid AS country
  156 + FROM release
  157 + INNER JOIN release_country ON release_country.release = release.id
  158 + INNER JOIN area ON area.id = release_country.country"""] ;
  159 + rr:subjectMap lb:sm_release_event ;
  160 + rr:predicateObjectMap
  161 + [rr:predicate event:place ;
  162 + rr:objectMap [rr:template "http://musicbrainz.org/area/{country}#_" ;
  163 + rr:termType rr:IRI]] .