module.exports = {
  geonames: {
    baseUrl: 'http://sws.geonames.org/',

    URLtoURN: function(url) {
      var match = /.*?(\d+).*/.exec(url);
      return 'urn:geonames:' + match[1];
    },

    URNtoURL: function(nid, nss) {
      return this.baseUrl + nss + '/';
    }
  },
  tgn: {
    baseUrl: 'http://vocab.getty.edu/tgn/',

    URLtoURN: function(url) {
      var match = /.*?(term)?\/?(\d+).*/.exec(url);
      var nss = [match[1], match[2]].filter(function(part) { return part; }).join(':');
      return 'urn:tgn:' + nss;
    },

    URNtoURL: function(nid, nss) {
      return this.baseUrl + nss.split(':').join('/');
    }
  }
};

@@ -1,8 +1,97 @@
+var u = require('util');%0A%0Afunction prefix(nid) %7B%0A  return u.format('urn:hg:%25s:', nid)%0A%7D%0A%0A
 module.e
@@ -246,21 +246,24 @@
 urn 
-'urn:
+prefix('
 geonames
 :' +
@@ -258,18 +258,18 @@
 geonames
-:
 '
+)
  + match
@@ -607,18 +607,21 @@
 urn 
-'urn:
+prefix('
 tgn
-:
 '
+)
  + n

use nss:hg:x