如何仅对数据类型名称进行 sparql 查询?

发布于 2024-11-28 00:38:28 字数 948 浏览 1 评论 0原文

如何显示数据的属性标签? 我在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

时光倒影 2024-12-05 00:38:28

为此目的,请使用函数 datatype()。例如:

select distinct ?y datatype(?z)
{
  ?x a <http://dbpedia.org/class/yago/JeskolaBuzzUsers>.
  ?x ?y ?z.
  filter (datatype(?z) != '')
}

Use function datatype() for that purpose. For example:

select distinct ?y datatype(?z)
{
  ?x a <http://dbpedia.org/class/yago/JeskolaBuzzUsers>.
  ?x ?y ?z.
  filter (datatype(?z) != '')
}
能否归途做我良人 2024-12-05 00:38:28

前缀 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文