{"id":3353,"date":"2014-01-22T10:59:34","date_gmt":"2014-01-22T01:59:34","guid":{"rendered":"https:\/\/gunmagisgeek.com\/wordpress\/?p=3353"},"modified":"2017-02-03T01:20:05","modified_gmt":"2017-02-02T16:20:05","slug":"post-3353","status":"publish","type":"post","link":"https:\/\/gunmagisgeek.com\/blog\/d3-js\/3353","title":{"rendered":"\u65e5\u7c73\u306e\u30aa\u30fc\u30d7\u30f3\u30c7\u30fc\u30bf\u3092\u6bd4\u8f03\u3057\u3066\u307f\u305f"},"content":{"rendered":"<p>\u30102014\/04\/03 \u8ffd\u8a18\u3011<br \/>\ndata.go.jp\u304c\u6025\u6b7b(\u4f11\u6b62)\u3057\u3066\u3044\u308b\u306e\u3067\u3001data.go.jp\u306b\u95a2\u3057\u3066\u306f4\/02\u79fb\u884c\u66f4\u65b0\u3057\u3066\u3066\u3044\u307e\u305b\u3093\u3002<\/p>\n<p>\u30102014\/05\/16 \u8ffd\u8a18\u3011<br \/>\ndata.go.jp\u304c\u518d\u958b\u3057\u305f\u306e\u3067\u3001\u30b9\u30af\u30ec\u30a4\u30d4\u30f3\u30b0\u3082\u518d\u958b\u3057\u307e\u3057\u305f\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2014\/01\/datagovvsdatagojp140122.jpg\" alt=\"data.gov VS data.go.jp\" width=\"590\" height=\"382\" class=\"alignnone size-full wp-image-3355\" srcset=\"https:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2014\/01\/datagovvsdatagojp140122.jpg 590w, https:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2014\/01\/datagovvsdatagojp140122-232x150.jpg 232w\" sizes=\"auto, (max-width: 590px) 100vw, 590px\" \/><\/p>\n<p>\u30a2\u30e1\u30ea\u30ab\u306e\u30aa\u30fc\u30d7\u30f3\u30c7\u30fc\u30bf\u30ab\u30bf\u30ed\u30b0\u30b5\u30a4\u30c8\u300cdata.gov\u300d\u3068\u3001\u65e5\u672c\u306e\u30aa\u30fc\u30d7\u30f3\u30c7\u30fc\u30bf\u30ab\u30bf\u30ed\u30b0\u30b5\u30a4\u30c8\u300cdata.go.jp\u300d\u3067\u3001\u516c\u958b\u3055\u308c\u3066\u3044\u308b\u30aa\u30fc\u30d7\u30f3\u30c7\u30fc\u30bf\u306e\u6bd4\u8f03\u3092\u884c\u3063\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u516c\u958b\u3055\u308c\u3066\u3044\u308b\u30c7\u30fc\u30bf\u306e\u30d5\u30a9\u30fc\u30de\u30c3\u30c8(\u30d5\u30a1\u30a4\u30eb\u5f62\u5f0f)\u3067\u3001\u6570\u306e\u591a\u3044\u3082\u306e\u4e0a\u4f4d20\u3092\u30c4\u30ea\u30fc\u30de\u30c3\u30d7\u3068\u3057\u3066\u8868\u793a\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\n\u8d64\u3044\u65b9\u304cdata.go.jp\u306e\u30c7\u30fc\u30bf\u3067\u3001\u9752\u3044\u65b9\u304cdata.gov\u306e\u30c7\u30fc\u30bf\u3067\u3059\u3002<br \/>\n\u65e5\u672c\u306e\u5834\u5408\u3001\u516c\u958b\u3055\u308c\u3066\u3044\u308b\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u306e\uff18\u5272\u4ee5\u4e0a\u304c\u300cPDF\u300d\u300cHTML\u300d\u300cXML\u300d\u3001\u30a2\u30e1\u30ea\u30ab\u306e\u5834\u5408\u306f\u300cHTML\u300d\u300cZIP\u300d\u300cXML\u300d\u304c\u534a\u5206\u3050\u3089\u3044\u3068\u3044\u3063\u305f\u3068\u3053\u308d\u3067\u3059\u3002<\/p>\n<p>\u30a2\u30e1\u30ea\u30ab\u3082\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u306b\u95a2\u3057\u3066\u306f\u305d\u3093\u306a\u306b\u9032\u3093\u3067\u3044\u308b\u3068\u3044\u3046\u308f\u3051\u3067\u3082\u306a\u3055\u305d\u3046\u3067\u3059\u306d\u3002<\/p>\n<p>\u3061\u306a\u307f\u306b\u3001data.gov\u306b\u3066\u300c5 Star Open Data\u300d\u3067\u3044\u3046\u3068\u3053\u308d\u306e\uff14\u661f\u30fb\uff15\u661f\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u300cRDF\/Linked RDF\u300d\u3067\u516c\u958b\u3055\u308c\u3066\u3044\u308b\u30c7\u30fc\u30bf\u306f\u300188,421\u4ef6\u306e\u5185\u50c5\u304b144\u4ef6\u3067\u3059\u3002\u3000\u30db\u30f3\u30c8\u306b\u666e\u53ca\u3059\u308b\u3093\u3067\u3059\u304b\u306d\uff1f\u3000Linked Open Data<br \/>\n\u30bb\u30de\u30f3\u30c6\u30c3\u30af\u30a6\u30a7\u30d6\u306f\u30c6\u30a3\u30e0\u30fb\u30d0\u30fc\u30ca\u30fc\u30ba-\u30ea\u30fc\u306e\u60b2\u9858\u3067\u306f\u3042\u308b\u3093\u3067\u3057\u3087\u3046\u3051\u3069\u3001\u306a\u3093\u3068\u306a\u304fXHTML\u306e\u4e8c\u306e\u821e\u306b\u306a\u308a\u305d\u3046\u306a\u4e88\u611f\u304c\u7121\u304d\u306b\u3057\u3082\u975e\u305a\u3068\u3044\u3063\u305f\u3068\u3053\u308d\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n<p>\u3068\u308a\u3042\u3048\u305a\u3001\u65e5\u672c\u304c\u5927\u304d\u304f\u5dee\u3092\u4ed8\u3051\u3089\u308c\u3066\u3044\u308b\u306e\u306f\u516c\u958b\u3055\u308c\u3066\u3044\u308b\u30c7\u30fc\u30bf\u306e\u6570\u306a\u306e\u3067\u3001xls\u3067\u3082csv\u3067\u3082txt\u3067\u3082\u826f\u3044\u306e\u3067\u3001\u3068\u306b\u304b\u304f\u30d0\u30f3\u30d0\u30f3\u516c\u958b\u3057\u3066\u3044\u3063\u3066\u6b32\u3057\u3044\u3067\u3059\u3002<\/p>\n<h3>\u30c7\u30fc\u30bf\u306e\u53d6\u5f97\u306b\u3064\u3044\u3066<\/h3>\n<p>\u516c\u958b\u3055\u308c\u3066\u3044\u308b\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u306e\u6570\u306f\u3001\u4ee5\u524d\u7d39\u4ecb\u3057\u305f<a href=\"https:\/\/gunmagisgeek.com\/blog\/web\/3195\">ScraperWiki<\/a>\u3092\u4f7f\u3063\u3066\u4e21\u30b5\u30a4\u30c8\u304b\u3089\u524a\u308a\u53d6\u3063\u3066(\u30b9\u30af\u30ec\u30a4\u30d4\u30f3\u30b0)\u3044\u307e\u3059\u3002<br \/>\n\u30b9\u30af\u30ec\u30a4\u30d4\u30f3\u30b0\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u30b3\u30fc\u30c9\u3092\u8f09\u305b\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"lang:python decode:true \" title=\"data.gov scraper\" >#!\/usr\/bin\/env python\r\nimport scraperwiki\r\nimport lxml.html\r\nimport json\r\nimport string\r\n\r\n\r\nhtml = scraperwiki.scrape(\"http:\/\/catalog.data.gov\/dataset?_res_format_sortCnt=desc&amp;_res_format_limit=0\")\r\nroot = lxml.html.fromstring(html)\r\n\r\ndata = []\r\nfor el in root.cssselect(\"#res_format &gt; li &gt; a &gt; span\"):\r\n    type = el.text.split(\"(\")[0].strip() \r\n    count = el.text.split(\"(\")[1].translate(string.maketrans(\"\", \"\"), \"()\").strip() \r\n    data.append({'type':type, 'count':count })\r\n\r\nprint repr(data)\r\n\r\n\r\n# Saving data:\r\nunique_keys = [ 'type' ]\r\nscraperwiki.sql.save(unique_keys, data)<\/pre>\n<pre class=\"lang:python decode:true \" title=\"data.go.jp scraper\" >#!\/usr\/bin\/env python\r\nimport scraperwiki\r\nimport lxml.html\r\nimport json\r\nimport string\r\n\r\n\r\nhtml = scraperwiki.scrape(\"http:\/\/www.data.go.jp\/data\/dataset?_res_format_limit=0\")\r\nroot = lxml.html.fromstring(html)\r\n\r\ndata = []\r\nfor el in root.cssselect(\"aside.secondary &gt; section\")[3]:\r\n    for cel in el.cssselect(\"nav &gt; ul &gt; li &gt; a span\"):\r\n        type = cel.text.split(\"(\")[0].strip()\r\n        count = cel.text.split(\"(\")[1].strip(\")\"[0]).strip()\r\n        data.append({'type': type, 'count':count  })\r\n    \r\nprint repr(data)\r\n\r\n\r\n# Saving data:\r\nunique_keys = [ 'type' ]\r\nscraperwiki.sql.save(unique_keys, data)<\/pre>\n<p>\u4e00\u5fdc\u3001JSON API\u3082\u516c\u958b\u3057\u3066\u307e\u3059\u3002<br \/>\n\u305f\u3060\u3001\u30b9\u30af\u30ec\u30a4\u30d4\u30f3\u30b0\u3067\u53d6\u5f97\u3057\u3066\u3044\u308b\u306e\u3067\u3001\u3044\u3064\u4f55\u6642\u6b63\u3057\u3044\u30c7\u30fc\u30bf\u304c\u53d6\u308c\u306a\u304f\u306a\u308b\u304b\u308f\u304b\u308a\u307e\u305b\u3093\u3002\u305d\u306e\u70b9\u3001\u3054\u4e86\u627f\u304f\u3060\u3055\u3044\u3002<\/p>\n<li><span class=\"removed_link\" title=\"https:\/\/free-ec2.scraperwiki.com\/bm4vdra\/b2ba730fe8a54e9\/sql\/?q=select%20type%2C%20count%20%0Afrom%20swdata\">data.gov format<\/span><\/li>\n<li><span class=\"removed_link\" title=\"https:\/\/free-ec2.scraperwiki.com\/cfynwdy\/8355ec03dbc6492\/sql\/?q=select%20%0A%09count%2C%0A%09type%0Afrom%20swdata%0Alimit%2020%0A\">data.go.jp format<\/span><\/li>\n","protected":false},"excerpt":{"rendered":"<p>\u30102014\/04\/03 \u8ffd\u8a18\u3011 data.go.j&hellip;<\/p>\n","protected":false},"author":1,"featured_media":3355,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18,51],"tags":[],"class_list":["post-3353","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-d3-js","category-datavis","has-post-thumbnail-archive"],"_links":{"self":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/3353","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/comments?post=3353"}],"version-history":[{"count":1,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/3353\/revisions"}],"predecessor-version":[{"id":3468,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/3353\/revisions\/3468"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media\/3355"}],"wp:attachment":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media?parent=3353"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/categories?post=3353"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/tags?post=3353"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}