w3c / microdata

Moved to https://html.spec.whatwg.org/multipage/microdata.html
15 stars 19 forks source link

No description of how numeric property values are obtained. #62

Closed gkellogg closed 6 years ago

gkellogg commented 7 years ago

The Values section discusses getting a value from elements including data and meter, but this is returned as textContent. However, the JSON Serialization section specifically says to serialize JSON using "no unnecessary zero digits in numbers", implying that values may be numbers which could only come from these elements. Certainly the intention of the data and meter elements is that the content is machine readable and descriptive text in HTML 5.2 does suggest that this is numeric (at least for the meter element.

The Microdata to RDF spec treats this content as numeric if it is either valid xsd:integer or xsd:double, and as text otherwise.

danbri commented 7 years ago

Haven't thought about this much, but would declaring "meter" as allowing xsd:integer or xsd:double work?

chaals commented 7 years ago

I am inclined to suggest that processors may convert numerical values to a matching datatype, without obliging them to do so...

danbri commented 7 years ago

SGTM.

danbri commented 7 years ago

p.s. can you talk me through how we handle surface details like "." vs "," e.g.a value of "1,00" vs "1.00"?

gkellogg commented 7 years ago

I believe HTML 5 addresses valid number syntax: https://www.w3.org/TR/html52/infrastructure.html#numbers, and how they're interpreted.

chaals commented 7 years ago

Since we define the content as strings, we don't have to do any handling. Processors can use whatever information they like to decidce that something is a number - e.g. a page in spanish that has <meter itemprop="rating" value="3,5"><img src="estr.gif"><img src="estr.gif"><img src="estr.gif"><img src="mestr.gif"><img src="estrv.gif"></meter> provides a value according to the spec of "3,5" as a string. But it is possible for a processor to decide that this is actually the number three-and-a-half. Although it is not required - and incidentally is not valid HTML.

danbri commented 7 years ago

incidentally is not valid HTML.

... I had missed that, and am now reassured.

chaals commented 7 years ago

We explain in the introduction that values are strings or URLs, and again in the algorithm for determining values. I think we can close this without a change to the text...

gkellogg commented 7 years ago

So, the text in the JSON serialization section is unnecessary, then.

chaals commented 7 years ago

@gkellogg yep. I'll clean it up.

chaals commented 7 years ago

I trimmed some of the language about conversion in #76.

I will add some clarification in various places - while conversions may interpret content to add datatypes, microdata itself treats even dates taken from datetime as a string...

danbri commented 6 years ago

Closing as agreed/fixed above.