Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Microdata on tables

I’m new to Microdata and have a problem with itemscope within a table.

For example assume I‘ve got a person object and in the table I’m showing Name, Street and City columns.

<table>
  <tr itemscope itemtype="http://schema.org/Person">
    <td itemprop="name">Name</td>
    <td itemprop="streetAddress">123 main</td>
    <td itemprop="addressCountry">USA</td>
  </tr>
</table>

Note that the streetAddress and addressCountry are supposed to be children of an address property. Yet you can not add a parent div to group those within the table.

Further it doesn't appear that dot notation works, e.g. address.streetAddress.

How would one support this?

like image 849
frigon Avatar asked Apr 16 '15 20:04

frigon


People also ask

How do I access my microdata?

Unrestricted access to microdata These can be accessed directly through the Data Liberation Initiative (DLI) or the PUMF Collection for a subscription fee. Individual files can also be downloaded from the website at no cost.

What is a microdata set?

Microdata are unit-level data obtained from sample surveys, censuses, and administrative systems. They provide information about characteristics of individual people or entities such as households, business enterprises, facilities, farms or even geographical areas such as villages or towns.

What is microdata in research?

Microdata is data on the characteristics of units of a population, such as individuals, households, or establishments, collected by a census, survey, or experiment.

How do I access my ABS data?

Applying for access and costs The first step is to contact ABS Data Services via [email protected]. We will discuss your project requirements and data options, and provide you with an Integrated data project proposal template.


1 Answers

There are only rather ugly solutions for this.

You could use the itemref attribute for the country, but you’d have to add a dummy untyped itemscope so that the addressCountry property doesn’t get added to the Person item:

<table>
  <tr itemscope itemtype="http://schema.org/Person">
    <td itemprop="name">
      Name
    </td>
    <td itemprop="address" itemscope itemtype="http://schema.org/PostalAddress" itemref="country">
      <span itemprop="streetAddress">123 main</span>
    </td>
    <td itemscope>
      <span itemprop="addressCountry" id="country">USA</span>
    </td>
  </tr>
</table>

You could use itemref for almost anything, so that you don’t have to add a dummy itemscope, but the markup gets more complex, and you have to "outsource" the Person item:

<meta itemscope itemtype="http://schema.org/Person" itemref="person-name person-address" />

<!-- can’t have this as descendant of another Microdata item -->

<table>
  <tr>
    <td itemprop="name" id="person-name">
      Name
    </td>
    <td itemprop="address" itemscope itemtype="http://schema.org/PostalAddress" id="person-address" itemref="address-country">
      <span itemprop="streetAddress">123 main</span>
    </td>
    <td itemprop="addressCountry" id="address-country">
      USA
    </td>
  </tr>
</table>

Or still have Person in the table by adding it to the first td:

<!-- can’t have this as descendant of another Microdata item -->

<table>
  <tr>
    <td itemscope itemtype="http://schema.org/Person" itemref="person-address">
      <span itemprop="name">Name</span>
    </td>
    <td itemprop="address" itemscope itemtype="http://schema.org/PostalAddress" id="person-address" itemref="address-country">
      <span itemprop="streetAddress">123 main</span>
    </td>
    <td itemprop="addressCountry" id="address-country">
      USA
    </td>
  </tr>
</table>
like image 179
unor Avatar answered Sep 28 '22 03:09

unor