如何使用SPARQL查询生成适合特定节点类型或/和边缘类型的所有三元组? [英] How to generate all triples that fit a particular node type or/and edge type using SPARQL query?

查看:217
本文介绍了如何使用SPARQL查询生成适合特定节点类型或/和边缘类型的所有三元组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个后续问题:



我在找什么现在要做的是生成如下模式:
$ b $ 1纸(节点)-bywriteby(边)-author(节点)
2)纸(节点) - iscitedby(edge)-paper(node)
等等...
,然后从数据集中生成所有满足这些模式的三元组。

我想你要找的是

 构造{
?论文:isWrittenBy?作者。
?paper:isCitedBy?paper2
}
其中{
?paper:isWrittenBy?author。
?paper:isCitedBy?paper2
}

关于构造查询的spec部分可能是一个有用的参考。


It is a follow up question to :

How to list and count the different types of node and edge entities in the graph data using SPARQL query?

So assuming I have the different node entities and edge entities of a given graph, how do I go about listing all triples, given a node-edge-node pattern? And how do I generate ALL node-edge-node patterns given the node and edge entities?

Example: If there is a network consisting of papers(nodes), authors(nodes), conferences(nodes), iswrittenby(edge), ispublishedin(edge), presentsin(edge) and so on , I'd have node entity type : papers authors conferences and for edge entity type: iswrittenby, ispublishedin , presentsin etc

What I'm looking to do now is generate patterns like:

1) paper(node)-iswrittenby(edge)-author(node) 2) paper(node)-iscitedby(edge)-paper(node) and so on... and then generate all triples from the dataset which satisfy these patterns.

解决方案

I think what you're looking for is

construct {   
  ?paper :isWrittenBy ?author .
  ?paper :isCitedBy ?paper2
}
where {
  ?paper :isWrittenBy ?author .
  ?paper :isCitedBy ?paper2
}

The spec section on construct queries might be a helpful reference.

这篇关于如何使用SPARQL查询生成适合特定节点类型或/和边缘类型的所有三元组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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