方括号"[]"的含义用SPARQL查询RDF时? [英] Meaning of square brackets "[]" when querying RDF with SPARQL?

查看:106
本文介绍了方括号"[]"的含义用SPARQL查询RDF时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对SPARQL和RDF相当陌生,我想知道以下内容在SPARQL中到底意味着什么?

I am pretty new to SPARQL and RDF and I was wondering what exactly does the below mean in SPARQL?

[] vc:n ?vcard .

完整的查询是

PREFIX vc: <http://www.w3.org/2006/vcard/ns#>

SELECT ?given ?family

WHERE{

    [] vc:n ?vcard .

    OPTIONAL {?vcard vc:given-name ?given .}

    OPTIONAL {?vcard vc:family-name ?family .}

}

推荐答案

这在我对 SPARQL中的括号中的回答中是无效的,为什么链接的电影数据库限制为2500条记录? ,其中这个问题 可能是重复的,尽管范围更广. (它问两个 问题,而仅问一个问题.)答案主要是SPARQL规范的链接和引用.

This is cannibalized from my answer to What are brackets in SPARQL and why is the linked movie database limited to 2500 records?, of which this question may be a duplicate, although it's a bit more broad. (It asks two questions, whereas this asks just one.) The answer is mostly links and citations of the SPARQL specification.

[…]是一个空白节点

SPARQL 1.1查询语言中描述了方括号.特别是,请参见 4.1.4空白节点的语法

[ … ] is a blank node

The square brackets are described in the SPARQL 1.1 Query Language. In particular, see 4.1.4 Syntax for Blank Nodes

4.1.4空白节点的语法

图形模式中的空白节点充当变量,而不是对 要查询的数据中的特定空白节点.

4.1.4 Syntax for Blank Nodes

Blank nodes in graph patterns act as variables, not as references to specific blank nodes in the data being queried.

空白节点由任一标签形式表示,例如"\_:abc", 或缩写形式"[]".仅在一个节点中使用的空白节点 查询语法中的位置可以用[]表示.独特的空白 节点将用于形成三重模式.空白节点标签为 对于带有标签"abc"的空白节点,写为"_:abc".一样的空白 节点标签不能在以下两个不同的基本图形模式中使用 相同的查询.

Blank nodes are indicated by either the label form, such as "\_:abc", or the abbreviated form "[]". A blank node that is used in only one place in the query syntax can be indicated with []. A unique blank node will be used to form the triple pattern. Blank node labels are written as "_:abc" for a blank node with label "abc". The same blank node label cannot be used in two different basic graph patterns in the same query.

[:p :v]构造可用于三重模式.它创建了一个 空白节点标签,用作所有包含的主题 谓词-宾语对.创建的空白节点也可以用于 在主体和客体的位置上还有其他三重模式.

The [:p :v] construct can be used in triple patterns. It creates a blank node label which is used as the subject of all contained predicate-object pairs. The created blank node can also be used in further triple patterns in the subject and object positions.

以下两种形式

[ :p "v" ] .
[] :p "v" .

分配唯一的空白节点标签(此处为"b57"),等效于 写作:

allocate a unique blank node label (here "b57") and are equivalent to writing:

_:b57 :p "v" .

此分配的空白节点标签可用作主题或对象 进一步的三重模式.例如,作为主题:

This allocated blank node label can be used as the subject or object of further triple patterns. For example, as a subject:

[ :p "v" ] :q "w" .

等同于两个三元组:

_:b57 :p "v" .
_:b57 :q "w" .

并作为对象:

:x :q [ :p "v" ] .

等同于两个三元组:

:x  :q _:b57 .
_:b57 :p "v" .

这篇关于方括号"[]"的含义用SPARQL查询RDF时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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