0
Help us understand the problem. What are the problem?

More than 1 year has passed since last update.

posted at

dbpediaの研究 その21

概要

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'))


成果物

以上。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Sign upLogin
0
Help us understand the problem. What are the problem?