通过SPARQL从DBpedia中提取化学数据 [英] Extract Chemical Data from DBpedia via SPARQL

查看:142
本文介绍了通过SPARQL从DBpedia中提取化学数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何向DDBpedia提交SPARQL查询,并返回一个表,该表包含在Wikipedia化学箱信息框模板中找到的信息,例如分子量或分子式。



因此,第一步只是要进行查询,其结果应为包含分子式和分子重量属性的化学物质的列表。但是以下内容没有返回结果:

  SELECT *在哪里{
?y rdf:type dbpedia-owl:ChemicalSubstance。
?y rdfs:label?Name。
?y dbpedia:molecularWeight?molecularWeight。
?y dbpedia:formula?formula。
可选{?y dbpedia-owl:iupacName?iupacname}。
FILTER(langMatches(lang(?Name), en))
}
限制50

SPARQL资源管理器



所以我陷入了困境。此查询出问题了吗,还是DBPedia确实没有从Wikipedia的化学盒中收集该信息?

解决方案

dbpedia:molecularWeight dbpedia:formula 。正确的命名空间应为 dbpedia2



此外,似乎很少有条目具有 dbpedia-owl:iupacName dbpedia2:molecularWeight dbpedia2:formula

 选择*位置{
?y rdf:type dbpedia-owl:ChemicalSubstance。
?y rdfs:label?Name。
可选{?y dbpedia2:formula?formula}。
可选{?y dbpedia2:molecularWeight?molecularWeight}。
可选{?y dbpedia-owl:iupacName?iupacname}。
FILTER(langMatches(lang(?Name), en))
}
限制50

SPARQL Explorer @ dbpedia.org






到要获取正确的名称空间,您可以查看一个示例,例如 或使用



<$ p $获取类型 dbpedia-owl:ChemicalSubstance 的所有已使用属性的列表p> 在不同位置选择SELECT {
?y rdf:type dbpedia-owl:ChemicalSubstance。
?y?rel?x
}

SPARQL Explorer @ dbpedia.org


I'd like to know how to submit a SPARQL query to DDBpedia and be given back a table that includes the information found in the Wikipedia "chembox" info box template, such as molecular weight or formula.

So, the first step was just to make a query whose results should be a list of chemical substances that had the formula and molecularWeight properties included. But the following returns no results:

SELECT * WHERE {
  ?y rdf:type dbpedia-owl:ChemicalSubstance.
  ?y rdfs:label ?Name .
  ?y dbpedia:molecularWeight ?molecularWeight .
  ?y dbpedia:formula ?formula .
  OPTIONAL {?y dbpedia-owl:iupacName ?iupacname} .
  FILTER (langMatches(lang(?Name),"en"))
}
LIMIT 50

SPARQL Explorer at dbpedia.org

And so I'm stuck. Is something wrong with this query or does DBPedia really not collect that information from the Wikipedia chemboxes?

解决方案

You caught the wrong namespace for both dbpedia:molecularWeight and dbpedia:formula. The correct namespace here would be dbpedia2.

Furthermore, there seem rarely any entries having a dbpedia-owl:iupacName, dbpedia2:molecularWeight and dbpedia2:formula.

SELECT * WHERE {
  ?y rdf:type dbpedia-owl:ChemicalSubstance.
  ?y rdfs:label ?Name .
  OPTIONAL {?y dbpedia2:formula ?formula }.
  OPTIONAL {?y dbpedia2:molecularWeight ?molecularWeight}.
  OPTIONAL {?y dbpedia-owl:iupacName ?iupacname} .
  FILTER (langMatches(lang(?Name),"en"))
}
LIMIT 50

SPARQL Explorer @dbpedia.org


To get the correct namespaces, you could either look at one example like this or get a list of all used properties for type dbpedia-owl:ChemicalSubstance using

SELECT DISTINCT ?rel WHERE {
  ?y rdf:type dbpedia-owl:ChemicalSubstance.
  ?y ?rel ?x
}

SPARQL Explorer @dbpedia.org

这篇关于通过SPARQL从DBpedia中提取化学数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆