LoginSignup
0
0

More than 3 years have passed since last update.

dbpediaの研究 その21

Posted at

概要

dbpediaが難解なので、手出してみる。
python3で、取得してみた。

サンプルコード

import json
import urllib.request

url = 'http://ja.dbpedia.org/sparql'
data = {
    "query": "SELECT DISTINCT * WHERE { dbpedia-ja:デ・トマソ dbpedia-owl:abstract ?abstract .}",
}
headers = {
    #'Accept': 'application/sparql-results+json',
    'Content-Type': 'application/x-www-form-urlencoded',
}
req = urllib.request.Request(url, urllib.parse.urlencode(data).encode('ascii'), headers, method='POST')
with urllib.request.urlopen(req) as res:
    body = res.read()
print (body.decode('UTF-8'))


成果物

以上。

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