Commit 0ea3ef65fd6081931edf9072899315befc0785fe

Authored by Barry Norton
1 parent e677ccac54
Exists in master

Added tag and place (which is tagged but not yet used)

Showing 2 changed files with 169 additions and 0 deletions

mappings/place.ttl View file @ 0ea3ef6
  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 place => geo:SpatialThing
  24 +
  25 +lb:sm_place rr:template "http://musicbrainz.org/place/{gid}#_" .
  26 +
  27 +lb:place a rr:TriplesMap ;
  28 + rr:logicalTable [rr:tableName "place"] ;
  29 + rr:subjectMap [rr:template "http://musicbrainz.org/place/{gid}#_" ;
  30 + rr:class geo:SpatialThing] ;
  31 + rr:predicateObjectMap
  32 + [rr:predicate rdfs:label ;
  33 + rr:objectMap [rr:column "name"]] .
  34 +
  35 +lb:place_annotation a rr:TriplesMap ;
  36 + rr:logicalTable [rr:sqlQuery
  37 + """SELECT gid, text
  38 + FROM annotation
  39 + INNER JOIN place_annotation
  40 + ON annotation.id = place_annotation.annotation
  41 + INNER JOIN place ON place_annotation.place = place.id"""] ;
  42 + rr:subjectMap lb:sm_place ;
  43 + rr:predicateObjectMap
  44 + [rr:predicate rdfs:comment ;
  45 + rr:objectMap [rr:column "text"]] .
mappings/tag.ttl View file @ 0ea3ef6
  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 +@prefix muto: <http://purl.org/muto/core#> .
  23 +
  24 +# MB tag => muto:Tag
  25 +
  26 +lb:sm_tag rr:template "http://musicbrainz.org/tag/{name}#_" .
  27 +lb:sm_artist rr:template "http://musicbrainz.org/artist/{gid}#_" .
  28 +lb:sm_label rr:template "http://musicbrainz.org/label/{gid}#_" .
  29 +lb:sm_place rr:template "http://musicbrainz.org/place/{gid}#_" .
  30 +lb:sm_recording rr:template "http://musicbrainz.org/recording/{gid}#_" .
  31 +lb:sm_release rr:template "http://musicbrainz.org/release/{gid}#_" .
  32 +lb:sm_work rr:template "http://musicbrainz.org/work/{gid}#_" .
  33 +
  34 +lb:tag a rr:TriplesMap ;
  35 + rr:logicalTable [rr:tableName "tag"] ;
  36 + rr:subjectMap [rr:template "http://musicbrainz.org/tag/{name}#_" ;
  37 + rr:class muto:Tag] ;
  38 + rr:predicateObjectMap
  39 + [rr:predicate muto:tagLabel ;
  40 + rr:objectMap [rr:column "name"]] .
  41 +
  42 +lb:artist_tag a rr:TriplesMap ;
  43 + rr:logicalTable [rr:sqlQuery
  44 + """SELECT artist.gid, tag.name
  45 + FROM artist_tag
  46 + INNER JOIN artist ON artist_tag.artist = artist.id
  47 + INNER JOIN tag ON artist_tag.tag = tag.id"""] ;
  48 + rr:subjectMap [rr:template "http://musicbrainz.org/artist/{gid}#tag/{name}";
  49 + rr:class muto:Tagging] ;
  50 + rr:predicateObjectMap
  51 + [rr:predicate muto:taggedResource ;
  52 + rr:objectMap lb:sm_artist] ,
  53 + [rr:predicate muto:hasTag ;
  54 + rr:objectMap lb:sm_tag] .
  55 +
  56 +lb:label_tag a rr:TriplesMap ;
  57 + rr:logicalTable [rr:sqlQuery
  58 + """SELECT label.gid, tag.name
  59 + FROM label_tag
  60 + INNER JOIN label ON label_tag.label = label.id
  61 + INNER JOIN tag ON label_tag.tag = tag.id"""] ;
  62 + rr:subjectMap [rr:template "http://musicbrainz.org/label/{gid}#tag/{name}";
  63 + rr:class muto:Tagging] ;
  64 + rr:predicateObjectMap
  65 + [rr:predicate muto:taggedResource ;
  66 + rr:objectMap lb:sm_label] ,
  67 + [rr:predicate muto:hasTag ;
  68 + rr:objectMap lb:sm_tag] .
  69 +
  70 +lb:place_tag a rr:TriplesMap ;
  71 + rr:logicalTable [rr:sqlQuery
  72 + """SELECT place.gid, tag.name
  73 + FROM place_tag
  74 + INNER JOIN place ON place_tag.place = place.id
  75 + INNER JOIN tag ON place_tag.tag = tag.id"""] ;
  76 + rr:subjectMap [rr:template "http://musicbrainz.org/place/{gid}#tag/{name}";
  77 + rr:class muto:Tagging] ;
  78 + rr:predicateObjectMap
  79 + [rr:predicate muto:taggedResource ;
  80 + rr:objectMap lb:sm_place] ,
  81 + [rr:predicate muto:hasTag ;
  82 + rr:objectMap lb:sm_tag] .
  83 +
  84 +lb:recording_tag a rr:TriplesMap ;
  85 + rr:logicalTable [rr:sqlQuery
  86 + """SELECT recording.gid, tag.name
  87 + FROM recording_tag
  88 + INNER JOIN recording ON recording_tag.recording = recording.id
  89 + INNER JOIN tag ON recording_tag.tag = tag.id"""] ;
  90 + rr:subjectMap [rr:template "http://musicbrainz.org/recording/{gid}#tag/{name}";
  91 + rr:class muto:Tagging] ;
  92 + rr:predicateObjectMap
  93 + [rr:predicate muto:taggedResource ;
  94 + rr:objectMap lb:sm_recording] ,
  95 + [rr:predicate muto:hasTag ;
  96 + rr:objectMap lb:sm_tag] .
  97 +
  98 +lb:release_tag a rr:TriplesMap ;
  99 + rr:logicalTable [rr:sqlQuery
  100 + """SELECT release.gid, tag.name
  101 + FROM release_tag
  102 + INNER JOIN release ON release_tag.release = release.id
  103 + INNER JOIN tag ON release_tag.tag = tag.id"""] ;
  104 + rr:subjectMap [rr:template "http://musicbrainz.org/release/{gid}#tag/{name}";
  105 + rr:class muto:Tagging] ;
  106 + rr:predicateObjectMap
  107 + [rr:predicate muto:taggedResource ;
  108 + rr:objectMap lb:sm_release] ,
  109 + [rr:predicate muto:hasTag ;
  110 + rr:objectMap lb:sm_tag] .
  111 +
  112 +lb:work_tag a rr:TriplesMap ;
  113 + rr:logicalTable [rr:sqlQuery
  114 + """SELECT work.gid, tag.name
  115 + FROM work_tag
  116 + INNER JOIN work ON work_tag.work = work.id
  117 + INNER JOIN tag ON work_tag.tag = tag.id"""] ;
  118 + rr:subjectMap [rr:template "http://musicbrainz.org/work/{gid}#tag/{name}";
  119 + rr:class muto:Tagging] ;
  120 + rr:predicateObjectMap
  121 + [rr:predicate muto:taggedResource ;
  122 + rr:objectMap lb:sm_work] ,
  123 + [rr:predicate muto:hasTag ;
  124 + rr:objectMap lb:sm_tag] .