Single heuristic mapping for property URIs

On Tue, 25 Oct 2011 16:49:45 +0100
Toby Inkster <tai@g5n.co.uk> wrote:

> This single (albeit complex) mapping seems to cover
> http://schema.org/, http://microformats.org/profile/hcard,
> http://n.whatwg.org/work, Google Rich Snippets, and most other common
> RDF vocabs including FOAF, SIOC, SKOS, OWL, etc.

I've now implemented this mapping in my Microdata parser. Without
requiring any special knowledge of different Microdata and RDF
vocabularies, or any registry, it "just works". It generates sensible
property URIs for all of the following examples:

	<div itemscope itemtype="http://schema.org/Person">
	  <span itemprop="name">Alice</span>
	  <!-- result: http://schema.org/name -->
	</div>

	<div itemscope
	  itemtype="http://schema.org/Person/Employee/AcmeEmployee"> 
	  <span itemprop="name">Alice</span>
	  <!-- result: http://schema.org/name -->
	</div>

	<div itemscope itemtype="http://xmlns.com/foaf/0.1/Person">
	  <span itemprop="name">Alice</span>
	  <!-- result: http://xmlns.com/foaf/0.1/name -->
	</div>

	<div itemscope itemtype="http://microformats.org/profile/hcard">
	  <span itemprop="fn">Alice</span>
	  <!-- result: http://microformats.org/profile/hcard#fn -->
	</div>

	<div itemscope itemtype="http://example.com/2011/vocab#Person">
	  <span itemprop="name">Alice</span>
	  <!-- result: http://example.com/2011/vocab#name -->
	</div>

Source code for a Perl module implementing this is here:

https://metacpan.org/source/TOBYINK/HTML-HTML5-Microdata-Parser-0.100/lib/HTML/HTML5/Microdata/Strategy/Heuristic.pm

-- 
Toby A Inkster
<mailto:mail@tobyinkster.co.uk>
<http://tobyinkster.co.uk>

Received on Wednesday, 26 October 2011 10:52:35 UTC