RDF FLOAT 类型的点前需要加 0 吗?

is it necessary to put 0 before the dot in RDF FLOAT type?

我正在使用尝试生成三元组的工具。

我生成这个三元组:

<http://rs#Rating29728> <rs#ratesBy> ".2"^^<http://www.w3.org/2001/XMLSchema#float> .

.2 是一个正确的浮点值,还是应该 0.2

为了尝试,我在 Protege 中创建了一个文字值,将值设为 0.2。然后我关闭 Protege,手动编辑 ontology,并将 0.2 更改为 .2。我又在Protege中打开了,但是Protege把它变成了0.2,所以我认为0.2是正确的,而不是.2,而Protege已经为这样的值做好了准备。

请问您怎么看?

什么是合法的 xsd 浮动不是见仁见智的问题;我们所要做的就是检查规格。

3.2.4 float

float values have a lexical representation consisting of a mantissa followed, optionally, by the character "E" or "e", followed by an exponent. The exponent ·must· be an integer. The mantissa must be a decimal number. The representations for exponent and mantissa must follow the lexical rules for integer and decimal. If the "E" or "e" and the following exponent are omitted, an exponent value of 0 is assumed.

所以问题就变成了十进制是否需要前导零。

3.2.3 decimal

decimal has a lexical representation consisting of a finite-length sequence of decimal digits (#x30-#x39) separated by a period as a decimal indicator.

现在,我会说没有前导数字是一个零长度的数字序列,这绝对是一个有限长度的数字序列,所以 .2 就可以了。该规范还定义了一个 规范表示法 ,听起来 protégé 可能会规范化它:

The canonical representation for decimal is defined by prohibiting certain options from the Lexical representation (§3.2.3.1). Specifically, the preceding optional "+" sign is prohibited. The decimal point is required. Leading and trailing zeroes are prohibited subject to the following: there must be at least one digit to the right and to the left of the decimal point which may be a zero.

所以 .20.2 都很好,它们 等价 ,所以 protégé 将第一个标准化为第二个是可以的。