[英]How to write Sparql query for the following result?
[![SPARQL Query Details][2]][2] [![SPARQL 查询详情][2]][2]
How should I write SPARQL query to get the details from node2 : URI for node2 is same in both the graphs and URI for node 1 is different.我应该如何编写 SPARQL 查询以从 node2 获取详细信息:图中 node2 的 URI 相同,节点 1 的 URI 不同。 Thank you in advance.先感谢您。
as such, I need below details.因此,我需要以下详细信息。
node2 def
hasID ghi
hasvertex jkl
hasLastname mno
To get all triples write SELECT ?node2 ?p ?o WHERE {?node2 ?p ?o}
.要获得所有三元组,请写SELECT ?node2 ?p ?o WHERE {?node2 ?p ?o}
。
Now to restrict the results to graph 1 (defined by the URI of node1) you need to add <http://ex/abc> hasName ?node2
.现在要将结果限制为图 1(由 node1 的 URI 定义),您需要添加<http://ex/abc> hasName ?node2
。
Together:一起:
SELECT ?node2 ?p ?o WHERE{
<http://ex/abc> hasName ?node2 .
?node2 ?p ?o
}
Just alter that SPARQL slightly to use real URIs for properties:只需稍微更改该 SPARQL 即可为属性使用真实的 URI:
SELECT ?node2 ?p ?o
WHERE {
<http://ex/node1> <http://ex/hasName> ?node2 .
?node2 ?p ?o .
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.