W3C home > Mailing lists > Public > whatwg@whatwg.org > June 2011

[whatwg] Recursion and loops of Microdata items

From: Tomasz Jamroszczak <toja@opera.com>
Date: Tue, 28 Jun 2011 16:51:25 +0200
Message-ID: <op.vxsjjzk8rkwrfs@herring.wroclaw.osa>
Dnia 08-06-2011 o 21:51:57 Ian Hickson <ian at hixie.ch> napisa?(a):

> The goal of itemref="" was just to have a way to handle cases where you
> have an item's properties scattered around a document.
>
> It's caused us more difficulties than helped anything, as far as I can
> tell. Has anyone implemented it or used it and liked it? I'd be fine with
> removing it if it's not a lot of trouble...
>
> I haven't fixed the algorithm to be written more simply, nor fixed the
> loops in the JSON stuff, because if we remove itemref="" then those
> problems just go away. If we want to keep itemref="", though, I will fix
> them. Any opinions one way or the other?

Summary:
1. itemRef attribute must stay.
2. Loops are allowed in our implementation.
3. Infinite recursion prevention should be simple.

	For sure itemRef attribute of Microdata have to stay, because it makes  
possible separation of data (the Microdata item properties, the semantics)  
and view (where contents of those properties should be laid out for  
browser user).  Without itemRef, Microdata becomes "Picodata".

	After some internal discussion we've came to conclusion that loop removal  
is possible to implement using DFS Gabow's algorithm of finding strongly  
connected components of a graph.  But it doesn't seems worth the  
implementation complexity.  So instead of Microdata item loop removal,  
we're more liberal and allow loops.

	But then, what to do when translating Microdata to other format, such as  
stringification to JSON in Drag'n'drop?  The JSON itself is quite  
primitive when it comes to stringification loops - it just throws an  
exception.  We thought we'll be more flexible.  We'll make stringification  
"as best as possible", and cutting only the last offending link of a  
cycle.  See  
http://people.opera.com/tjamroszczak/microdata/microdata-loops.png .   
Unfortunately it means that items which belong to Microdata item loops  
sometimes will lose properties, and it depends on from where the cycle was  
reached (see point A1 and A2 in the image).

-- 
Best Regards,
Tomasz Jamroszczak
Received on Tuesday, 28 June 2011 07:51:25 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:06 UTC