Microdataandschema.org
Basics
l Microdataisasimpleseman0cmarkupschemethat’sanalterna0vetoRDFa
l DevelopedbyWHATWG*andsupportedbymajorsearchcompanies(Google,MicrosoE,Yahoo,Yandex)
l LikeRDFa,itusesHTMLtagaJributestohostmetadata
l Vocabulariesarecontrolledandhostedatschema.org
* Web Hypertext Application Technology Working Group
WhatisWHATWG?
l WebHypertextApplica0onTechnologyWorkingGroup– CommunityinterestedinevolvingtheWebwithfocusonHTMLandWebAPIdevelopment
– IanHicksonisakeyperson,nowatGooglel Foundedin2004byindividualsfromApple,MozillaandOperaaEeraW3Cworkshop– ConcernaboutW3C'sembraceofXHTML
l WorkedonHTML5,developedMicrodataspec
HTML5
l StartedbyWHATWGasanalterna0vetoXHTML,joinedbyW3C– HTML5recommenda0on,October2014– HTML5.1recommenda0on,November2016– WHATWGwillevolveitasa“livingstandard”
l HTML5≈HTML+CSS+jsl Na0vesupportforgraphics,video,audio,speech,seman0cmarkup,…
l Currentsupportinmajorbrowsers
Microdata
l Themicrodataefforthastwoparts:– Amarkupscheme– Asetofvocabularies/ontologies
l ThemarkupissimilartoRDFainprovidingwaystoiden0fysubjects,types,proper0es&objectsAlsoastandardwaytoencodeMicrodataasRDFa
l Sanc0onedvocabulariesatschema.organdincludeasmallnumberofveryusefulones:people,movies,events,recipes,etc.
Anexample
<div><h1>Avatar</h1><span>Director:JamesCameron(born1954)</span><span>Sciencefic0on</span><ahref=”avatar-trailer.html">Trailer</a></div>
Anexample:itemscope
l AnitemscopeaJributeiden0fiesacontentsubtreethatisthesubjectaboutwhichwewanttosaysomething
<divitemscope><h1>Avatar</h1><span>Director:JamesCameron(born1954)</span><span>Sciencefic0on</span><ahref=”avatar-trailer.html">Trailer</a></div>
Anexample:itemtype
l AnitemscopeaJributeiden0fiesacontentsubtreethatisthesubjectaboutwhichwewanttosaysomething
l TheitemtypeaJributespecifiesthesubject’stype<divitemscopeitemtype="hAp://schema.org/Movie"><h1>Avatar</h1><span>Director:JamesCameron(born1954)</span><span>Sciencefic0on</span><ahref=”avatar-trailer.html">Trailer</a></div>
Microdata<->RDF
http://rdf-translator.appspot.com/
Microdata<->RDF
http://rdf-translator.appspot.com/
Anexample:itemtype
l AnitemscopeaJributeiden0fiescontentsubtreethatisthesubjectaboutwhichwewanttosaysomething
l TheitemtypeaJributespecifiesthesubject’stype<divitemscopeitemtype="hAp://schema.org/Movie"><h1>Avatar</h1><span>Director:JamesCameron(born1954)</span><span>Sciencefic0on</span><ahref=”avatar-trailer.html">Trailer</a></div>
[ ] a schema:Movie .
Anexample:itemprop
l AnitemscopeaJributeiden0fiesacontentsubtreethatisthesubjectaboutwhichwewanttosaysomething
l TheitemtypeaJributespecifiesthesubject’stypel AnitempropaJributegivesapropertyofthattype<divitemscopeitemtype="hAp://schema.org/Movie"><h1itemprop="name">Avatar</h1><span>Director:JamesCameron(born1954)</span><spanitemprop="genre">Sciencefic0on</span><ahref=”avatar-trailer.html”itemprop="trailer">Trailer</a></div>
Anexample:itemprop
l AnitemscopeaJributeiden0fiesacontentsubtreethatisthesubjectaboutwhichwewanttosaysomething
l TheitemtypeaJributespecifiesthesubject’stypel AnitempropaJributegivesapropertyofthattype<divitemscopeitemtype="hAp://schema.org/Movie"><h1itemprop="name">Avatar</h1><span>Director:JamesCameron(born1954)</span><spanitemprop="genre">Sciencefic0on</span><ahref=”avatar-trailer.html”itemprop="trailer">Trailer</a></div>
[ ] a schema:Movie ; schema:genre "Science fiction" ; schema:name "Avatar" ; schema:trailer <avatar-trailer.html> .
Anexample:embeddeditems
l Anitempropimmediatelyfollowedbyanotheritemcopemakesthevalueanobject
<divitemscopeitemtype="hJp://schema.org/Movie"><h1itemprop="name">Avatar</h1><divitemprop="director"itemscopeitemtype="hAp://schema.org/Person">Director:<spanitemprop="name">JamesCameron</span>(born<spanitemprop="birthDate">1954</span>)</div><spanitemprop="genre">Sciencefic0on</span><ahref="avatar-trailer.html"itemprop="trailer">Trailer</a></div>
Anexample:embeddeditems
l Anitempropimmediatelyfollowedbyanotheritemcopemakesthevalueanobject
<divitemscopeitemtype="hJp://schema.org/Movie"><h1itemprop="name">Avatar</h1><divitemprop="director"itemscopeitemtype="hAp://schema.org/Person">Director:<spanitemprop="name">JamesCameron</span>(born<spanitemprop="birthDate">1954</span>)</div><spanitemprop="genre">Sciencefic0on</span><ahref="avatar-trailer.html"itemprop="trailer">Trailer</a></div>
[ ] a schema:Movie ; schema:director [ a schema:Person ; schema:birthDate "1954" ; schema:name "James Cameron" ] ; schema:genre "Science fiction" ; schema:name "Avatar" ; schema:trailer <avatar-trailer.html> .
schema.orgvocabulary
l Fulltypehierarchyinonefilel 590classes,>700proper0es(Nov‘16)l Datatypes:Boolean,Date,DateTime,Number,Text,Time
l Objects:RootedatThingwithtwo‘metaclasses’(ClassandProperty)andeightsubclasses
l Seegithubrepoforexamplesandcode
hAp://www.schema.org/Recipe
TesPngStructuredDatainHTML
TesPngStructuredDatainHTML
TesPngStructuredDatainHTML
MicrodataasaKRlanguage
l MorethanRDF,lessthanRDFSl Proper0eshaveanexpectedtype(range)
– Canbealistoftypes,anyofwhichareOK– Mightbeastringformanyproper0es(“somedatabe2erthannone”)
l Proper0esaJached≥1types(domain)l Classescanhavemul0pleparentsandinherit(proper0es)fromallofthem
l Noaxioms(e.g.,disjointness,cardinality,etc.)l NosubPropertyOflikerela0on
Mixingvocabularies
l Microdataisintendedtoworkwithjustonevocabulary:theoneatschema.org
l Advantages– Simple,organized,welldesigned– Controlledbytheschema.orgpeople
l Disadvantages:toosimple,controlled– Toosimple,narrow,mono-lingual– Controlledbytheschema.orgpeople
Extendingschema.orgontology
l Extensions:hostedvs.external– Hosted:managed&publishedbyschema.orgproject
l Youcansubclassexis0ngclasses– Person/Engineer– Person/Engineer/ElectricalEngineer
l Subclassexisi0ngproper0es– musicGroupMember/leadVocalist– musicGroupMember/leadGuitar1– musicGroupMember/leadGuitar2
ExtensionProblems
l Hardtoestablishagreeduponmeaning– Throughaxiomssupportedbythelanguage(e.g.,equivalence,disjointness,etc.)
– Noplacefordocumenta0on(annota0ons,labels,comments)
l Withoutanamespacemechanism,yourPerson/Engineerandminecanbeconfusedandmightmeandifferentthings
SerializaPon
l Schema.orghasadatamodelandserializa0ons– Microdataistheoriginal,na0vesteriliza0on– RDFaismoreexpressiveandworkswiththeRDFstack– EveryoneagreesthatRDFaLiteisagoodencoding:assimpleasMicrodatabutmoreexpressive
– JSON-LDisanincreasinglypopularacceptedencoding
l SearchengineslookforMicrodata,RDFaandJSON-LD
l Schema.orgconsidersRDFatobethe“canonicalmachinerepresenta0onofschema.org”
l Microdataisaneffortbyagroupofsearchcompaniestouseasimpleseman0clanguage
l Theseman0csispragma0c– e.g.,expectedtypes:astringisacceptedwhereathingisexpected–“somedataisbeJerthannone”
l Therealvalueisin– thesupportedvocabulariesand– theirusebySearchcompanies
l =>Immediatemo0va0onforusingseman0cmarkup
Conclusions