Re: Microdata itemid and src / href

On Mon, 24 Oct 2011 11:26:47 +0200, Philip Jägenstedt <philipj@opera.com>  
wrote:

> On Sat, 22 Oct 2011 23:04:28 +0200, Jayson Lorenzen  
> <Jayson.Lorenzen@businesswire.com> wrote:
>
>> Sorry to go on and on about this but I just thought (while driving,  
>> dangerous) that this situation is an interesting example of of a  
>> Vocabulary specific parser behaving differently than a generic parser  
>> (that does not know about the Vocabulary). Here is what I mean. Using a  
>> generic parser (like Mr. Kellog's)
>
> Both of the following examples are invalid microdata and they don't  
> represent the same things. Details inline.
>
>>   <div itemscope="itemscope"  itemtype="http://schema.org/Organization"  
>> itemid="http://example.com">
>>     <meta itemprop="name" content="Example"/>
>>   </div>
>>
>>    <a itemprop="myCompany" href="http://example.com">
>
> Validator.nu [1] will complain about the <a> element that "The itemprop  
> attribute was specified, but the element is not a property of any item."  
> The problem is that the <a> element is not a child of the <div>, so it's  
> just ignored. Live Microdata [2] gives this JSON output:
>
> {
>    "items":[
>      {
>        "type":"http://schema.org/Organization",
>        "id":"http://example.com/",
>        "properties":{
>          "name":[
>            "Example"
>          ]
>        }
>      }
>    ]
> }
>
> (Note that there is no myCompany property.)
>
>>   <div itemprop="myCompany" itemscope="itemscope"   
>> itemtype="http://schema.org/Organization"
>>        itemid="http://example.com">
>>       <meta itemprop="name" content="Example"/>
>>    </div>
>
> Validator.nu will complain that "The itemprop attribute was specified,  
> but the element is not a property of any item." The issue here is that  
> there is no top-level item, since the outer item has an itemprop  
> attribute. Consequently, Live Microdata gives no output, simply noting  
> that "No top-level items found."
>
>> Produce the exact same RDF in a generic parser, but completely  
>> different results in the Google Rich Snippets Test tool.
>
> It sounds like there are bugs in the microdata parser used. Gregg, can  
> you take a look at this?
>
> [1] http://validator.nu/
> [2] http://foolip.org/microdatajs/live/
> [3]  
> http://www.whatwg.org/specs/web-apps/current-work/multipage/microdata.html#top-level-microdata-items

Oops, the examples were expanded further down in the original mail:

The JSON representation of those are:

Version One:

{
   "items":[
     {
       "type":"http://schema.org/NewsArticle",
       "id":"http://www.example.com/news/20110415123/",
       "properties":{
         "articleBody":[
           "\n        NEW YORK, NY--(Test News)--Stocks were mixed and bond  
yields were at their lowest level\n        in a year Thursday.... "
         ],
         "copyrightHolder":[
           "http://www.businesswire.com/"
         ]
       }
     },
     {
       "type":"http://schema.org/Organization",
       "id":"http://businesswire.com/",
       "properties":{
         "name":[
           "Business Wire"
         ]
       }
     }

Version Two:

{
   "items":[
     {
       "type":"http://schema.org/NewsArticle",
       "id":"http://www.example.com/news/20110415123/",
       "properties":{
         "articleBody":[
           "\n        NEW YORK, NY--(Test News)--Stocks were mixed and bond  
yields were at their lowest level\n        in a year Thursday.... "
         ],
         "copyrightHolder":[
           {
             "type":"http://schema.org/Organization",
             "id":"http://businesswire.com/",
             "properties":{
               "name":[
                 "Business Wire"
               ]
             }
           }
         ]
       }
     }
   ]
}

Given this, it's pretty plain to see why the RDF representation is the  
same: the use of itemid. I would suggest using Version Two.

I'll also take the opportunity to complain (again) that the meaning of  
itemid is still not defined for schema.org, so strictly speaking using it  
is invalid.

-- 
Philip Jägenstedt
Core Developer
Opera Software

Received on Monday, 24 October 2011 09:41:31 UTC