I am trying to write a SPARQL query where I want to filter on the square of something, but I am simply unable to figure out how to square a number (x2) (except by multiplying it with itself, of course). I guessed a square root function called math:sqrt()
which works, yet nothing like math:pow
seems to exist.
如何在 SPARQL 中获取某个值的平方,更重要的是,我在哪里可以阅读有关它和其他数学函数的信息,例如math:sqrt
在 SPARQL 中?
注意:这与我之前的问题有关:反向维基百科地理标记查找 .
现在已经是几年后的事了SPARQL 1.1 查询语言已发布。它包含比原始 SPARQL 查询语言更多的内置函数。除了许多关于字符串、RDF 术语等的函数之外,还有许多数字函数(章节号表示链接标准中的章节):
- 17.4.4 Functions on Numerics
- 17.4.4.1abs
- 17.4.4.2round
- 17.4.4.3ceil
- 17.4.4.4floor
- 17.4.4.5RAND
还是没有square
函数在这里,以及最快的实现方法将使用*
, so 拉阿尔托的回答仍然矗立。 SPARQL 支持的运算符在17.3 操作符映射,对于 XPath 算术来说仍然只是一组+
, -
, *
, and /
.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)