Parsing dbpedia JSON in Python
Posted
by givp
on Stack Overflow
See other posts from Stack Overflow
or by givp
Published on 2010-05-12T22:28:58Z
Indexed on
2010/05/12
22:34 UTC
Read the original article
Hit count: 276
Hello,
I'm trying to get my head around the dbpedia JSON schema and can't figure out an efficient way of extracting a specific node:
This is what dbpedia gives me:
http://dbpedia.org/data/Ceramic_art.json
I've got the whole thing as a JSON object in Python but don't really understand how to get the english abstract from this data. I've gotten this far:
u = "http://dbpedia.org/data/Ceramic_art.json"
data = urlfetch.fetch(url=u)
json_data = json.loads(data.content)
for j in json_data["http://dbpedia.org/resource/Ceramic_art"]:
if(j == "http://dbpedia.org/ontology/abstract"):
print "it's here"
Not sure how to proceed from here. As you can see there are multiple languages. I need to get the english abstract.
Thanks for your help,
g
© Stack Overflow or respective owner