Commit a4ee87d61ceaf20d0e0827b285a734c7f758e4ef

Authored by Barry Norton
1 parent d4f9bb9c0b
Exists in master

Refactored DBpedia mapping into separate file and added class, label to areas"

Showing 2 changed files with 54 additions and 21 deletions

mappings/area.ttl View file @ a4ee87d
... ... @@ -20,29 +20,14 @@
20 20 @prefix time: <http://www.w3.org/2006/time#> .
21 21 @prefix tl: <http://purl.org/NET/c4dm/timeline.owl#> .
22 22  
23   -# MB area => DBpedia link
  23 +# MB area => geo:SpatialThing
24 24  
25   -lb:sm_area rr:template "http://musicbrainz.org/area/{gid}#_" .
26   -
27 25 #pt.dbpedia.org wasn't resolving - to check
28 26 lb:area_dbpedia a rr:TriplesMap ;
29   - rr:logicalTable [rr:sqlQuery
30   - """SELECT area.gid,
31   - REPLACE(REPLACE(url, 'wikipedia.org/wiki',
32   - 'dbpedia.org/resource'),
33   - 'http://en.',
34   - 'http://')
35   - AS url
36   - FROM area
37   - INNER JOIN l_area_url ON area.id = l_area_url.entity0
38   - INNER JOIN link ON l_area_url.link = link.id
39   - INNER JOIN link_type ON link_type = link_type.id
40   - INNER JOIN url on l_area_url.entity1 = url.id
41   - WHERE link_type.gid='9228621d-9720-35c3-ad3f-327d789464ec'
42   - AND url SIMILAR TO
43   - 'http://(de|el|en|es|ko|pl|pt).wikipedia.org/wiki/%'"""] ;
44   - rr:subjectMap lb:sm_area ;
  27 + rr:logicalTable [rr:tableName "area"] ;
  28 + rr:subjectMap [rr:template "http://musicbrainz.org/area/{gid}#_" ;
  29 + rr:class geo:SpatialThing] ;
45 30 rr:predicateObjectMap
46   - [rr:predicate owl:sameAs ;
47   - rr:objectMap [rr:column "url"; rr:termType rr:IRI]] .
  31 + [rr:predicate rdfs:label ;
  32 + rr:objectMap [rr:column "name"]] .
mappings/dbpedia.ttl View file @ a4ee87d
  1 +@prefix rr: <http://www.w3.org/ns/r2rml#> .
  2 +
  3 +@prefix lb: <https://github.com/LinkedBrainz/r2rml/v0.1#> .
  4 +@prefix ngs: <http://musicbrainz.org/NGS> .
  5 +
  6 +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
  7 +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
  8 +@prefix owl: <http://www.w3.org/2002/07/owl#> .
  9 +@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
  10 +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
  11 +@prefix dc: <http://purl.org/dc/elements/1.1/> .
  12 +@prefix mo: <http://purl.org/ontology/mo/> .
  13 +@prefix foaf: <http://xmlns.com/foaf/0.1/> .
  14 +@prefix ov: <http://open.vocab.org/terms/> .
  15 +@prefix dct: <http://purl.org/dc/terms/> .
  16 +@prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> .
  17 +@prefix event: <http://purl.org/NET/c4dm/event.owl#> .
  18 +@prefix is: <http://purl.org/ontology/is/core#> .
  19 +@prefix isi: <http://purl.org/ontology/is/inst/> .
  20 +@prefix time: <http://www.w3.org/2006/time#> .
  21 +@prefix tl: <http://purl.org/NET/c4dm/timeline.owl#> .
  22 +
  23 +# MB area => DBpedia link
  24 +
  25 +lb:sm_area rr:template "http://musicbrainz.org/area/{gid}#_" .
  26 +
  27 +#pt.dbpedia.org wasn't resolving - to check
  28 +lb:area_dbpedia a rr:TriplesMap ;
  29 + rr:logicalTable [rr:sqlQuery
  30 + """SELECT area.gid,
  31 + REPLACE(REPLACE(url, 'wikipedia.org/wiki',
  32 + 'dbpedia.org/resource'),
  33 + 'http://en.',
  34 + 'http://')
  35 + AS url
  36 + FROM area
  37 + INNER JOIN l_area_url ON area.id = l_area_url.entity0
  38 + INNER JOIN link ON l_area_url.link = link.id
  39 + INNER JOIN link_type ON link_type = link_type.id
  40 + INNER JOIN url on l_area_url.entity1 = url.id
  41 + WHERE link_type.gid='9228621d-9720-35c3-ad3f-327d789464ec'
  42 + AND url SIMILAR TO
  43 + 'http://(de|el|en|es|ko|pl|pt).wikipedia.org/wiki/%'"""] ;
  44 + rr:subjectMap lb:sm_area ;
  45 + rr:predicateObjectMap
  46 + [rr:predicate owl:sameAs ;
  47 + rr:objectMap [rr:column "url"; rr:termType rr:IRI]] .