[html5] microdata itemref

Brian Tremblay webmaster at tsmchughs.com
Mon Dec 10 15:37:49 PST 2012


On 12/10/12 12:57 PM, Ian Hickson wrote:
> On Mon, 10 Dec 2012, Brian Tremblay wrote:
>> On 12/10/12 11:07 AM, Ian Hickson wrote:
>>> On Mon, 10 Dec 2012, Brian Tremblay wrote:
>>>>
>>>> What I'm trying to do is associate "Napa Valley" in the <p>
>>>> element with the winery in the header, as that winery's
>>>> addressRegion.
 >
> Fundamentally the issue there is that you have data from different
> items overlapping; there's not much you can do about that.
>
> I don't think there's a good solution that doesn't involve duplication
> when a single element is a property for one item and contains a property
> for another; as it stands today there's no way to exclude a subtree from
> an item other than making it an item itself. If you wanted to do that, you
> could do something like this:
>
>      <article itemscope itemtype="http://schema.org/FoodEvent">
>       <header>
>         <h1 itemprop="name">Franciscan Estate tasting</h1>
>         hosted by
>         <div itemprop="performer" itemscope itemtype="http://schema.org/Person">
>           <span itemprop="name">J. Kounellas</span>,
>           <span itemprop="worksFor" itemscope itemtype="http://schema.org/Winery"
>                 itemref="napa">
>             <span itemprop="name">Franciscan Estate Winery</span>
>           </span>
>         </div>
>       </header>
>       <p itemprop="description">Join us for a special wine event featuring
>       <a itemscope href="http://en.wikipedia.org/wiki/Napa_Valley_AVA"><span
>          itemprop="addressRegion" id="napa">Napa Valley</span></a>'s
>       Franciscan Estate Winery.</p>
>      </article>
>
> What this does is introduce an anonyous item which blocks out the
> addressRegion property from the outer FoodEvent item.

That indeed does the trick. And I would not have thought of that, so thanks.

> In the future we might introduce a way to explicitly exclude a subtree
> from an ancestor, if this is a common issue.

It seems like it would be, even in less complicated cases than mine.

> By the way, as far as I can tell addressRegion isn't a valid schema.org
> value for a Winery item. Looks like you need another item just for the
> addressRegion or something.

Yes, but I wanted to keep the example as simple as possible. In the live 
version, the item included via itemref has itemprop="location", and an 
itemtype which is set to PostalAddress.

> This is quite the elaborate vocabulary. :-/

Yes, a bit more complicated than needed, I suppose. In the end, 
including the addressRegion of the winery was hardly crucial, but I 
wanted to know if it was possible.

By contrast, everything else is necessary: a restaurant, with an event, 
hosted by a person, employed by a winery. I don't know if anyone does 
anything with events microdata right now. But if they did, they might 
search for wine events at Seattle restaurants, or search for events 
featuring a winery they like, or wines from a region they like.

I dunno. Maybe this whole thing is a waste of effort on my part.  :-/

-- 
Brian Tremblay



More information about the Help mailing list