w3c / microdata-rdf

Specification of the extraction/transformation of Microdata content to RDF
15 stars 9 forks source link

What is the scope of Item to URI mapping (memory) #23

Open sesuncedu opened 9 years ago

sesuncedu commented 9 years ago
  1. memory is defined to be part of the evaluation context.
  2. mappings are added to memory in step 2 of §6.3 Generate The Triples
  3. Step 9.1.1 of that algorithm states "Let context be a copy of evaluation context"
  4. Step 9.1.4 recursively invokes "generate the triples for value using context [the copy generated in 9.1.1]"

This seems to be the wrong scope for the mapping table (memory). It seems like there is supposed to be a single mapping table per document?

gkellogg commented 9 years ago

evaluation context is defined as containing memory, current type, and current vocabulary. The memory element is a mapping of items to subjects. When a copy of the evaluation context is made, it still contains memory, which is understood to be a mapping. The intent here is not that the copy operation is a deep-copy, and I think the intention is clear. However, the definition of memory could potentially be updated to call it a reference to a mapping of items to subjects, initially empty. I don't think this has caused confusion in the past, but would consider adding that wording to a future update.

sesuncedu commented 9 years ago

As it stands, the intent has to be guessed at; given that the use of explicit context objects is not clearly motivated, and that creating copies is done as an explicit first step for processing every property, regardless of whether or not it is item-valued, intuition is a poor guide.

If there is a single, global mapping, there does not seem to be a reason to make it part of a context object. A single document scoped element to IRI mapping is all that is needed.

The remaining two elements can be replaced by passing the current values as arguments into the various algorithmic descriptions.

gkellogg commented 9 years ago

There's a history to this document, as it was originally part of the Microdata spec, including most of the algorithmic language. When the HTML Data Task Force was created, the transformation was resurrected in this form, and has had minimal change up until this point. If I were to have done it by scratch, it would probably have read more like the RDFa algorithm.

The notion of an evaluation context is common to many RDF transformation algorithms, and it's a reasonable place to store such information, even the memory. At this point, there is little point in re-writing the algorithm. If there is some future Rec-track version of Microdata, incorporating the RDF transformation bits, it may be worth re-examining the processing steps.

sesuncedu commented 9 years ago

It might helpful to take a look at the recommendations for Turtle / TriG for examples of how to model state with explicit saving and restoration of variable bindings.