Skip to content

Instantly share code, notes, and snippets.

View danbri's full-sized avatar

Dan Brickley danbri

View GitHub Profile
Hi folks. I'm relaying this from the schema.org collaboration, probably the main user of HTML's Microdata mechanism.
We'd (schema.org 'we') like to make a public proposal to update Microdata with a syntax for expressing inverse properties/relationships. FWIW other notations that schema.org supports (JSON-LD and RDFa) have such mechanisms ([1],[2]).
At schema.org we are repeatedly running into situations where we have a need for properties to be used in reverse direction. There are 630 or so properties defined currently (and a similar number of types); see listing at http://schema.org/docs/full.html. Inverse properties are relatively a cornercase, but a persistent one.
By inverse, I refer to scenarios where there are any pair of properties (relationship types) e.g. "foo" and "bar", such that whenever some entity-1 has a foo relationship to an entity-2, then by definition, entity-2 will have a "bar" relationship to entity-1. We'd like to avoid the need to give "bar" a specific name, and instead be able to
<html prefix="og: http://ogp.me/ns#">
<head>
<title>The Rock (1996)</title>
<meta property="og:title" content="The Rock" />
<meta property="og:type" content="video.movie" />
<meta property="og:url" content="http://www.imdb.com/title/tt0117500/" />
<meta property="og:image" content="http://ia.media-imdb.com/images/rock.jpg" />
<meta property="schema:image" content="http://ia.media-imdb.com/images/rock.jpg" />
...
<html prefix="og: http://ogp.me/ns#">
<head>
<title>The Rock (1996)</title>
<meta property="og:title" content="The Rock" />
<meta property="og:type" content="video.movie" />
<meta property="og:url" content="http://www.imdb.com/title/tt0117500/" />
<meta property="og:image schema:image" content="http://ia.media-imdb.com/images/rock.jpg" />
...
</head>
...
<html prefix="og: http://ogp.me/ns#">
<head>
<meta property="og:title" content="The Rock" />
<meta property="og:url" content="http://www.imdb.com/title/tt0117500/" />
<meta property="og:image schema:image" content="http:/helloworld.jpg" />
...
</head>
...
</html>
<html prefix="og: http://ogp.me/ns#">
<head>
<meta property="og:title" content="The Rock" />
<meta property="og:url" content="http://www.imdb.com/title/ttxxx0117500/" />
<meta property="og:image schema:image" content="http:/helloworld.jpg" />
...
</head>
...
</html>
{
"@context": {
"@vocab": "http://schema.org/",
"url": {
"@type": "@id"
},
"@base": "http://aaa.com"
},
"@type": "Movie",
"@id": "http://code.sgo.to/movies/123",
<div vocab="http://schema.org/" typeof="PlaceOfWorship https://www.wikidata.org/wiki/Q199451">
<span property="name">Pagoda Songyue</span>
<span property="description">Here we might describe this place of worship, and note that it is considered a
pagoda, which Wikidata represents as a subtype of 'place of workship'. </span>
</span>
<div itemprop="geo" itemscope itemtype="http://schema.org/GeoCoordinates">
<meta itemprop="latitude" content="34.501611" />
<meta itemprop="longitude" content="113.015917" />
</div>
<link property="url" href="http://www.wikidata.org/wiki/Q488758" />
<div vocab="http://schema.org/" typeof="PlaceOfWorship https://www.wikidata.org/wiki/Q199451">
<span property="name">Pagoda Songyue</span>
<span property="description">Here we might describe this place of worship, and note that it is considered a
pagoda, which Wikidata represents as a subtype of 'place of workship'. This allows more detailed types to
be agreed at Wikidata, while also mentioning a common well known type from schema.org.
</span>
<div itemprop="geo" itemscope itemtype="http://schema.org/GeoCoordinates">
<meta itemprop="latitude" content="34.501611" />
<meta itemprop="longitude" content="113.015917" />
</div>
div vocab="http://schema.org/" typeof="PlaceOfWorship https://www.wikidata.org/entity/Q199451">
<span property="name">Pagoda Songyue</span>
<span property="description">One of the few intact sixth-century pagodas in China, located at the Songyue Monastery on Mount Song.</span>
<div itemprop="geo" itemscope itemtype="http://schema.org/GeoCoordinates">
<meta itemprop="latitude" content="34.501611" />
<meta itemprop="longitude" content="113.015917" />
</div>
<link property="url" href="http://www.wikidata.org/wiki/Q488758" />
<link property="sameAs" href="https://en.wikipedia.org/wiki/Songyue_Pagoda" />
<link property="sameAs" href="http://www.freebase.com/m/03bz2xf" />
<div vocab="http://schema.org/" typeof="PlaceOfWorship https://www.wikidata.org/entity/Q199451">
<span property="name">Pagoda Songyue</span>
<span property="description">One of the few intact sixth-century pagodas in China, located at the Songyue Monastery on Mount Song.</span>
<link property="url" href="http://www.wikidata.org/wiki/Q488758" />
<link property="sameAs" href="https://en.wikipedia.org/wiki/Songyue_Pagoda" />
<link property="sameAs" href="http://www.freebase.com/m/03bz2xf" />
<div itemprop="geo" itemscope itemtype="http://schema.org/GeoCoordinates">
<meta itemprop="latitude" content="34.501611" />
<meta itemprop="longitude" content="113.015917" />