【发布时间】:2015-10-07 15:44:51
【问题描述】:
我正在尝试将来自 RDF 源的数据转换为 @note2 biomedical text mining application 期望的字典格式
具体来说,我正在尝试将一个概念的所有同义词合并到一行中
@note2 使用dictionaries in this format
+----------+-----------+---------------+-------------------------+
| class | term | synonyms | external IDs |
+----------+-----------+---------------+-------------------------+
| food | bread | pan|brot | source1;idA |
| nutrient | vitamin C | ascorbic acid | source1;idC|source2;idD |
+----------+-----------+---------------+-------------------------+
我可以在bioportal这样的查询中获得每行一个同义词
SELECT ?term ?syn ?extid
FROM <http://bioportal.bioontology.org/ontologies/BTO>
WHERE
{
?extid <http://bioportal.bioontology.org/metadata/def/prefLabel> ?term .
?extid <http://www.geneontology.org/formats/oboInOWL#hasRelatedSynonym> ?syn .
}
返回类似这样的内容:
+-------------------------+-------------------------+-----------------+
| term | syn | extid |
+-------------------------+-------------------------+-----------------+
| "stomach smooth muscle" | "gastric muscle" | bto:BTO_0001818 |
| "stomach smooth muscle" | "gastric smooth muscle" | bto:BTO_0001818 |
| "stomach smooth muscle" | "stomach muscle" | bto:BTO_0001818 |
+-------------------------+-------------------------+-----------------+
那么...是否有可能在 SPARQL 中连接同义词并最终得到类似的东西
+-----------------------+----------------------------------------------------------------------------+-----------------+
| term | syn | extid |
+-----------------------+----------------------------------------------------------------------------+-----------------+
| stomach smooth muscle | gastric muscle|gastric smooth muscle|stomach smooth muscle |stomach muscle | bto:BTO_0001818 |
+-----------------------+----------------------------------------------------------------------------+-----------------+
如果有什么不同,我将使用 virtuoso 开源。
【问题讨论】:
-
我还没有尝试过,但是“group_concat”看起来很有希望:stackoverflow.com/a/18214142/4154134
-
@jdussault 看起来很有希望。你想提交答案,还是我应该提交我对你的建议能做的事情?
-
去做吧!我有兴趣看看它长什么样。 :)
标签: rdf sparql bioinformatics