Microdata vs RDFa

I have a quick question about RDFa and Microdata.

My real understanding is that RDFa is an RDF embedded in HTML, but difficult for new developers like me, Microdata seems very simple and quick to implement.

What are the other advantages and disadvantages of these two semantic formats?

+47
html5 semantics web microdata rdfa
Jan 22 2018-12-12T00:
source share
4 answers

The main advantage that you get in any semantic format is the ability of consumers to reuse your data.

For example, search engines such as Google are consumers who reuse your data to display Rich Snippets, like this one:

Recipe Rich Snippet

To determine which format is better, you need to know which consumers you want to target. For example, Google says in its frequently asked questions that they will only process microdata (although the testing tool now works with RDFa, so itโ€™s possible that they accept RDFa).

If you donโ€™t know that your target customer accepts only RDFa, you are probably best off with microdata. While many RDFa consumption services (such as the Sindice semantic search engine) also accept microdata, services consuming microdata are less likely to accept RDFa.

+29
Jan 30 '12 at 15:56
source share

Differences Between Microdata and RDFa

While there are many (technical, smaller) differences, there is a choice of those that I consider important (as a base, my answer is to webmasters ).

Specifications

Applicability

  • Microdata can only be used in (X) HTML5 (respectively HTML, as defined by WHATWG).

  • RDFa can be used in different host languages, that is, in several (X) versions of HTML and XML (thus also in SVG, MathML, Atom, etc.).

    And new host languages โ€‹โ€‹can be supported, since RDFa Core is an attribute specification for expressing structured data in any markup language. "

Using multiple dictionaries

  • In Microdata it is more difficult, and sometimes impossible, to use multiple dictionaries for the same content.

  • Thanks to the use of prefixes RDFa allows you to mix dictionaries.

Using Inverse Properties

  • Microdata does not provide a way to use inverse properties. This is necessary for dictionaries that do not define inverse properties (for example, they only define parent instead of parent and child ). The popular Schema.org is such a dictionary (with only a few older exceptions).

    While W3C Note Microdata to RDF defines an experimental itemprop-reverse , this attribute is not part of W3Cs or WHATWGs Microdata.

  • RDFa supports the use of inverse properties (with the rev attribute).

Semantic Web

  • Using Microdata, you do not play a role in the semantic network (and AFDIK Microdata does not intend to), mainly because it is not defined as serializing RDF (although there are ways to extract RDF from Microdata ).

  • RDFa is a serialization of RDF , and RDF is the foundation of the W3Cs Semantic Web .




The specifications of RDFa Core and HTML + RDFa may be more complex than HTML Microdata , but this is not a fair comparison because they offer more features.

Like Microdata there will be RDFa Lite (which "works for most everyday needs"), and this specification, at least in my opinion, is less complicated than Microdata.

What to do?

If you want to support specific consumers (e.g. search engine and browser add-on), you should check their documentation for supported syntaxes.

If you want to learn only one syntax and not have specific consumers in mind, (attention, subjective opinion!) Come with RDFa. Why?

  • RDFa has matured over the years and is a W3C Rec, while Microdata is a relatively new invention and not a standardized W3C.
  • RDFa can be used in many languages, not just HTML5.
  • RDFa allows mixed use of dictionaries for the same content, and it natively supports the use of inverse properties.

Can not decide? Use both options.

Please note that you can also use multiple syntaxes for the same content so that you can have Microdata and RDFa (and Microformats, JSON-LD and ...) for maximum compatibility.

  • Here is a simple Microdata snippet:

     <p itemscope itemtype="http://schema.org/Person"> <span itemprop="name">John Doe</span> is his name. </p> 
  • Has the same snippet using RDFa (Lite):

     <p typeof="schema:Person"> <span property="schema:name">John Doe</span> is his name. </p> 
  • And here both syntaxes are used together:

     <p itemscope itemtype="http://schema.org/Person" typeof="schema:Person"> <span itemprop="name" property="schema:name">John Doe</span> is his name. </p> 

But it is usually not required / recommended to go down this route.

+63
Sep 17 '14 at 10:41
source share

This is a long but one of the most complete answers to this question you will find in this Jeni Tennison blog: Microdata and RDFa living together in harmony

+6
Jan 27 '12 at 9:07
source share

I'm not sure Unor's suggestion to use both Microdata and RDFa is a good idea. If you use the Google Structured Data Testing Tool (or other similar tools) in your example, it shows duplicate data, which, apparently, implies that the Google bot will pick up two people named John Doe on the web page instead of the one was the original intention.

I assume that using one syntax for a given element is a better idea (you should still be able to mix syntaxes while they describe individual entities).

Although I would be happy to be mistaken in this.

0
Sep 17 '15 at 13:53 on
source share



All Articles