Commit b2c6eca18d0907c21399b7dae5cffe4b54368035

Authored by Barry Norton
1 parent a4ee87d61c
Exists in master

Refactored DBpedia mappings into separate file

Showing 3 changed files with 44 additions and 47 deletions

mappings/artist.ttl View file @ b2c6eca
... ... @@ -162,29 +162,6 @@
162 162 rr:objectMap [rr:column "url" ;
163 163 rr:termType rr:IRI]] .
164 164  
165   -#BN: fixed this to Wikipedias per language and use SQL REPLACE
166   -#pt.dbpedia.org wasn't resolving - to check
167   -lb:artist_dbpedia a rr:TriplesMap ;
168   - rr:logicalTable [rr:sqlQuery
169   - """SELECT artist.gid,
170   - REPLACE(REPLACE(url, 'wikipedia.org/wiki',
171   - 'dbpedia.org/resource'),
172   - 'http://en.',
173   - 'http://')
174   - AS url
175   - FROM artist
176   - INNER JOIN l_artist_url ON artist.id = l_artist_url.entity0
177   - INNER JOIN link ON l_artist_url.link = link.id
178   - INNER JOIN link_type ON link_type = link_type.id
179   - INNER JOIN url on l_artist_url.entity1 = url.id
180   - WHERE link_type.gid='29651736-fa6d-48e4-aadc-a557c6add1cb'
181   - AND url SIMILAR TO
182   - 'http://(de|el|en|es|ko|pl|pt).wikipedia.org/wiki/%'"""] ;
183   - rr:subjectMap lb:sm_artist ;
184   - rr:predicateObjectMap
185   - [rr:predicate owl:sameAs ;
186   - rr:objectMap [rr:column "url"; rr:termType rr:IRI]] .
187   -
188 165 lb:artist_twitter a rr:TriplesMap ;
189 166 rr:logicalTable [rr:sqlQuery
190 167 """SELECT artist.gid, url
mappings/dbpedia.ttl View file @ b2c6eca
... ... @@ -25,6 +25,50 @@
25 25 lb:sm_area rr:template "http://musicbrainz.org/area/{gid}#_" .
26 26  
27 27 #pt.dbpedia.org wasn't resolving - to check
  28 +
  29 +lb:artist_dbpedia a rr:TriplesMap ;
  30 + rr:logicalTable [rr:sqlQuery
  31 + """SELECT artist.gid,
  32 + REPLACE(REPLACE(url, 'wikipedia.org/wiki',
  33 + 'dbpedia.org/resource'),
  34 + 'http://en.',
  35 + 'http://')
  36 + AS url
  37 + FROM artist
  38 + INNER JOIN l_artist_url ON artist.id = l_artist_url.entity0
  39 + INNER JOIN link ON l_artist_url.link = link.id
  40 + INNER JOIN link_type ON link_type = link_type.id
  41 + INNER JOIN url on l_artist_url.entity1 = url.id
  42 + WHERE link_type.gid='29651736-fa6d-48e4-aadc-a557c6add1cb'
  43 + AND url SIMILAR TO
  44 + 'http://(de|el|en|es|ko|pl|pt).wikipedia.org/wiki/%'"""] ;
  45 + rr:subjectMap lb:sm_artist ;
  46 + rr:predicateObjectMap
  47 + [rr:predicate owl:sameAs ;
  48 + rr:objectMap [rr:column "url"; rr:termType rr:IRI]] .
  49 +
  50 +lb:release_group_dbpedia a rr:TriplesMap ;
  51 + rr:logicalTable [rr:sqlQuery
  52 + """SELECT release_group.gid,
  53 + REPLACE(REPLACE(url, 'wikipedia.org/wiki',
  54 + 'dbpedia.org/resource'),
  55 + 'http://en.',
  56 + 'http://')
  57 + AS url
  58 + FROM release_group
  59 + INNER JOIN l_release_group_url ON release_group.id
  60 + = l_release_group_url.entity0
  61 + INNER JOIN link ON l_release_group_url.link = link.id
  62 + INNER JOIN link_type ON link_type = link_type.id
  63 + INNER JOIN url on l_release_group_url.entity1 = url.id
  64 + WHERE link_type.gid='6578f0e9-1ace-4095-9de8-6e517ddb1ceb'
  65 + AND url SIMILAR TO
  66 + 'http://(de|el|en|es|ko|pl|pt).wikipedia.org/wiki/%'"""] ;
  67 + rr:subjectMap lb:sm_release_group ;
  68 + rr:predicateObjectMap
  69 + [rr:predicate rdfs:seeAlso ;
  70 + rr:objectMap [rr:column "url"; rr:termType rr:IRI]] .
  71 +
28 72 lb:area_dbpedia a rr:TriplesMap ;
29 73 rr:logicalTable [rr:sqlQuery
30 74 """SELECT area.gid,
mappings/release_group.ttl View file @ b2c6eca
... ... @@ -62,30 +62,6 @@
62 62 rr:objectMap [rr:column "url" ;
63 63 rr:termType rr:IRI]] .
64 64  
65   -#BN: fixed this to Wikipedias per language and use SQL REPLACE
66   -#pt.dbpedia.org wasn't resolving - to check
67   -lb:release_group_dbpedia a rr:TriplesMap ;
68   - rr:logicalTable [rr:sqlQuery
69   - """SELECT release_group.gid,
70   - REPLACE(REPLACE(url, 'wikipedia.org/wiki',
71   - 'dbpedia.org/resource'),
72   - 'http://en.',
73   - 'http://')
74   - AS url
75   - FROM release_group
76   - INNER JOIN l_release_group_url ON release_group.id
77   - = l_release_group_url.entity0
78   - INNER JOIN link ON l_release_group_url.link = link.id
79   - INNER JOIN link_type ON link_type = link_type.id
80   - INNER JOIN url on l_release_group_url.entity1 = url.id
81   - WHERE link_type.gid='6578f0e9-1ace-4095-9de8-6e517ddb1ceb'
82   - AND url SIMILAR TO
83   - 'http://(de|el|en|es|ko|pl|pt).wikipedia.org/wiki/%'"""] ;
84   - rr:subjectMap lb:sm_release_group ;
85   - rr:predicateObjectMap
86   - [rr:predicate rdfs:seeAlso ;
87   - rr:objectMap [rr:column "url"; rr:termType rr:IRI]] .
88   -
89 65 #Covers IMDB, MusicMoz, IOBDB
90 66 # N.B. could also produce Linked IMDB sameAs?
91 67 lb:release_group_seeAlso a rr:TriplesMap ;