dbpedia提取JSON [英] dbpedia extract JSON
问题描述
http://dbpedia.org/resource/Los_Angeles
您可以通过在您的HTTP请求中使用适当的头部以多种格式以编程方式请求这些数据。
例如,Accept:application / json将以JSON形式获得结果。
1。我该如何去检索JSON
2.因为我只需要筛选
a class =urihref =http://www.w3.org/2000/ 01 / rdf-schema#label
用于我页面上的大约100个链接。什么是最好的解决方法
如果您只对 rdfs:label感兴趣
s,您可以通过使用模板请求URL来查询端点:
http://dbpedia.org/sparql?default-graph-uri=http%3A%2F%2Fdbpedia.org&query=select*%7Bdbpedia%3ALos_Angeles+rdfs%3Alabel+%3Flabel%7D&format= json
对应查询
select * {dbpedia:Los_Angeles rdfs:label?label}
生成JSON:<$ p
{head:{link :[],vars:[label]},
results:{distinct:false,ordered:true,bindings:[
{label {type:literal,xml:lang:uk,value:\\\Л\\\о\\\с-\\\А\\\н\\\д\\\ж\\\е\\ \\ u043B\\\е\\\с}},
{label:{type:literal,xml:lang:vi,value:Los Angeles}} ,
{label:{type:literal,xml:lang:zh,value:\\\洛\\\杉\\\矶}},
{label:{type:literal,xml:lang:ca,value:Los Angeles}},
{label:{type: literal,xml:lang:cs,value:洛杉矶}},
{label:{type:literal,xml:lang:德,价值:洛杉矶}},
{label:{type:literal,xml:lang:en,value:Los Angeles}}]}}
http://dbpedia.org/resource/Los_Angeles
You can request this data programmatically in many formats by using the appropriate header in your HTTP request.
For example "Accept: application/json" will get you the results in JSON.
1. How do I go about retrieving the JSON
2. Since I have to filter only
a class="uri" href="http://www.w3.org/2000/01/rdf-schema#label"
for around 100 links on my page. What is the best way around it
You can retrieve the JSON without having to create special headers by simpy requesting
If you're only interested in the rdfs:label
s of the entity, you might query the endpoint by using a template request URL:
http://dbpedia.org/sparql?default-graph-uri=http%3A%2F%2Fdbpedia.org&query=select*%7Bdbpedia%3ALos_Angeles+rdfs%3Alabel+%3Flabel%7D&format=json
which corresponds to the query
select*{dbpedia:Los_Angeles rdfs:label ?label}
which generates the JSON:
{ "head": { "link": [], "vars": ["label"] },
"results": { "distinct": false, "ordered": true, "bindings": [
{ "label": { "type": "literal", "xml:lang": "uk", "value": "\u041B\u043E\u0441-\u0410\u043D\u0434\u0436\u0435\u043B\u0435\u0441" }},
{ "label": { "type": "literal", "xml:lang": "vi", "value": "Los Angeles" }},
{ "label": { "type": "literal", "xml:lang": "zh", "value": "\u6D1B\u6749\u77F6" }},
{ "label": { "type": "literal", "xml:lang": "ca", "value": "Los Angeles" }},
{ "label": { "type": "literal", "xml:lang": "cs", "value": "Los Angeles" }},
{ "label": { "type": "literal", "xml:lang": "de", "value": "Los Angeles" }},
{ "label": { "type": "literal", "xml:lang": "en", "value": "Los Angeles" }} ] } }
这篇关于dbpedia提取JSON的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!