0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

e-statの研究 その3

Last updated at Posted at 2021-10-01

概要

官製lodのe-statを研究してみる。
sparql query editorを書いてみた。
我侭なsparqlを問い合わせて、テーブルで表示するやつ。

sparql

山形県の総人口

PREFIX sdmx-measure: <http://purl.org/linked-data/sdmx/2009/measure#>
PREFIX sdmx-dimension: <http://purl.org/linked-data/sdmx/2009/dimension#>
PREFIX cd-dimension: <http://data.e-stat.go.jp/lod/ontology/crossDomain/dimension/>
PREFIX cd-code: <http://data.e-stat.go.jp/lod/ontology/crossDomain/code/>
PREFIX g00200502-dimension: <http://data.e-stat.go.jp/lod/ontology/g00200502/dimension/>
PREFIX g00200502-code: <http://data.e-stat.go.jp/lod/ontology/g00200502/code/>
PREFIX estat-attribute: <http://data.e-stat.go.jp/lod/ontology/attribute/>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

select *
where {
	?s sdmx-measure:obsValue ?o;
		sdmx-dimension:refArea / dcterms:identifier '06000';
		g00200502-dimension:indicator g00200502-code:indicator-A1101;
		cd-dimension:timePeriod ?time;
		estat-attribute:unitMult / rdfs:label ?unitMult;
		estat-attribute:unitMult / dcterms:identifier ?unitIdent;
		FILTER (lang(?unitMult) = 'ja').
}

サンプルコード


function render(json) {
  var config = {
    "selector": "#result"
  }
  d3sparql.htmltable(json, config)
}

function exec() {
  var endpoint = d3.select("#endpoint").property("value")
  var sparql = d3.select("#sparql").property("value")
  d3sparql.query(endpoint, sparql, render)
}



成果物

以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?