如何仅对数据类型名称进行 sparql 查询?
如何显示数据的属性标签? 我在 dbpedia 本体工作,
我想做一个 sparql 查询,下面是我的示例查询。这个结果混合了数据类型或对象类型,我想要数据类型属性名称。
SELECT ?p ?pLabel ?domain ?range { ?p rdfs:domain http://dbpedia.org/ontology/Person> . }
例如:以下是数据类型示例,但我不能仅选择数据类型,我想显示 键入名称。
"chat"
'chat'@fr with language tag "fr"
"xyz"^^<http://example.org/ns/userDatatype>
"abc"^^appNS:appDataType
'''The librarian said, "Perhaps you would enjoy 'War and Peace'."'''
1, which is the same as "1"^^xsd:integer
1.3, which is the same as "1.3"^^xsd:decimal
1.300, which is the same as "1.300"^^xsd:decimal
1.0e6, which is the same as "1.0e6"^^xsd:double
true, which is the same as "true"^^xsd:boolean
false, which is the same as "false"^^xsd:boolean
expect to result
预期结果(仅限数据类型)
typename <- field name
string <- type name
int
boolean
int
double
boolean
如何进行 sparql 查询?
How to display data's property label?
I working for dbpedia ontology,
I want to make a sparql query, below is my sample query. This result is mix up either datatype or object type, I want to datatype property name.
SELECT ?p ?pLabel ?domain ?range { ?p rdfs:domain http://dbpedia.org/ontology/Person> . }
ex: Following is data type example, but I cannot select only datatype, I want to display
type name.
"chat"
'chat'@fr with language tag "fr"
"xyz"^^<http://example.org/ns/userDatatype>
"abc"^^appNS:appDataType
'''The librarian said, "Perhaps you would enjoy 'War and Peace'."'''
1, which is the same as "1"^^xsd:integer
1.3, which is the same as "1.3"^^xsd:decimal
1.300, which is the same as "1.300"^^xsd:decimal
1.0e6, which is the same as "1.0e6"^^xsd:double
true, which is the same as "true"^^xsd:boolean
false, which is the same as "false"^^xsd:boolean
expect to result
Expect to result (only data type)
typename <- field name
string <- type name
int
boolean
int
double
boolean
How to make a sparql query?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为此目的,请使用函数 datatype()。例如:
Use function datatype() for that purpose. For example:
前缀 xsd:http://www.w3.org/2001/XMLSchema#
询问哪里
{
?项目 dm:金额 ?金额 。
FILTER ((数据类型(?金额)) != xsd:整数)
查询
引擎仍然知道哪些 ?amount 值是整数,哪些不是,
因为任何不带引号且没有句点的数字系列都被视为整数。
您在 SPARQL 中处理数据类型的大部分工作将涉及使用以下函数:
下一节将详细介绍。在我们查看其中任何一个之前,这是一个很好的
了解查询中类型文字的表示如何与不同的交互的想法
数据集中的文字种类。
PREFIX xsd: http://www.w3.org/2001/XMLSchema#
ASK WHERE
{
?item dm:amount ?amount .
FILTER ((datatype(?amount)) != xsd:integer)
}
The query engine still knew which ?amount values were integers and which were not,
because any unquoted series of digits with no period is treated as an integer.
Most of your work with datatypes in SPARQL will involve the use of functions that are
covered in more detail in the next section. Before we look at any of those, it’s a good
idea to know how representations of typed literals in your queries interact with different
kinds of literals in your dataset.