Mobile app version of vmapp.org
Login or Join
Fox8124981

: How to transform RDF to Microdata in a WordPress site? I have a breadcrumb with RDF data and I want to adapt it to Microdata. First of all, I'm not sure about the structure, because it will

@Fox8124981

Posted in: #Html #Microdata #Rdfa

I have a breadcrumb with RDF data and I want to adapt it to Microdata. First of all, I'm not sure about the structure, because it will work on a WordPress template.

But I found this code: www.seomix.fr/fil-dariane-chemin-navigation/ (I don't paste the code here to respect the author).

Let's see some attributes, I do have:


span typeof="v:Breadcrumb"
rel="v:url" property="v:title"
div class="path" xmlns:v="http://rdf.data-vocabulary.org/#"
span id="breadex"
id="breadh"


What does they mean and what should I put instead of them? I have that example of Microdata, but I'm not able to make relations:

<div itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
<a href="http://www.example.com/books" itemprop="url">
<span itemprop="title">Books</span>
</a> ›
<div itemprop="child" itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
<a href="http://www.example.com/books/authors" itemprop="url">
<span itemprop="title">Authors</span>
</a> ›
<div itemprop="child" itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
<a href="http://www.example.com/books/authors/stephenking" itemprop="url">
<span itemprop="title">Stephen King</span>
</a>
</div>
</div>
</div>


Update: At the end I'm gonna keep the RDFa format. My problem was that the HTML5 don't validate RDFa, it returns:

"Attribute xmlns:v not allowed here."

"Attribute with the local name xmlns:v is not serializable as XML 1.0."

Source: validator.w3.org/check?uri=http%3A%2F%2Fdemo.seozeta.com%2Fblog%2F&charset=%28detect+automatically%29&doctype=HTML5&group=0&user-agent=W3C_Validator%2F1.3+http%3A%2F%2Fvalidator.w3.org%2Fservices
But I noticed that there are themes of WordPress on Themeforest that also use RDFa without validation, so I think it's ok.

About the subject of that post, I was not sure how to relate RDFa with Microdata. For example, what is 'breadex', a child or a parent? Is the typeof='v:Breadcrumb' the itemscope equivalent? Which one is which one? Now I don't need it to know, but feel free to post a list with the equivalences/relations for others. I think this information will be usefull for sure.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Fox8124981

1 Comments

Sorted by latest first Latest Oldest Best

 

@Shanna517

It’s valid to use RDFa in HTML5.

While xmlns still works, it is deprecated in HTML+RDFa 1.1. You should use the prefix attribute instead. If only one vocabulary is used, you could also use the vocab attribute instead of prefix.

RDFa is much more powerful than Microdata. RDFa Lite (a subset of RDFa), however, is very similar to Microdata.



Here is a small example specifying a person and his name with the Schema.org vocabulary.



Microdata:

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


RDFa Lite 1.1:

<p vocab="http://schema.org/" typeof="Person">
<span property="name">John Doe</span>
</p>


(See my last example for a smaller variant.)

You could even define the vocabulary on the body (or any other parent) element and use it in the whole document:

<body vocab="http://schema.org/">

<p typeof="Person"> <!-- using schema.org/Person -->
<span property="name">John Doe</span>
</p>

<p typeof="LocalBusiness"> <!-- using schema.org/LocalBusiness -->
<span property="name">ACME Inc.</span>
</p>

</body>


By using prefix, you could even use several different vocabularies, for example Schema.org and FOAF:

<body vocab="http://schema.org/" prefix="foaf: xmlns.com/foaf/0.1/ >

<p typeof="Person"> <!-- using a class from schema.org -->
<span property="name">John Doe</span> <!-- using a property from schema.org -->
<span property="foaf:nick">JD</span> <!-- using a property from FOAF -->
</p>

</body>




In fact, because RDFa predefines some prefixes, you wouldn’t have to use vocab/prefix if you use, for example, Schema.org. Just prefix the terms with schema: and you are done:

<p typeof="schema:Person">
<span property="schema:name">John Doe</span>
</p>

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme