26
Microdata and schema.org

Microdata and schema - csee.umbc.eduHTML5 lStarted by WHATWG as an alternative to XHTML, joined by W3C –HTML5recommendation,October 2014 –HTML5.1recommendation, November 2016 –WHATWG

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Microdata and schema - csee.umbc.eduHTML5 lStarted by WHATWG as an alternative to XHTML, joined by W3C –HTML5recommendation,October 2014 –HTML5.1recommendation, November 2016 –WHATWG

Microdataandschema.org

Page 2: Microdata and schema - csee.umbc.eduHTML5 lStarted by WHATWG as an alternative to XHTML, joined by W3C –HTML5recommendation,October 2014 –HTML5.1recommendation, November 2016 –WHATWG

Basics

lMicrodata isasimplesemanticmarkupschemethat’sanalternativetoRDFa

lDevelopedbyWHATWG* andsupportedbymajorsearchcompanies(Google,Microsoft,Yahoo,Yandex)

l LikeRDFa,itusesHTMLtagattributestohostmetadata

lVocabulariesarecontrolledandhostedatschema.org

* Web Hypertext Application Technology Working Group

Page 3: Microdata and schema - csee.umbc.eduHTML5 lStarted by WHATWG as an alternative to XHTML, joined by W3C –HTML5recommendation,October 2014 –HTML5.1recommendation, November 2016 –WHATWG

WhatisWHATWG?

lWebHypertextApplicationTechnologyWorkingGroup– CommunityinterestedinevolvingtheWebwithfocusonHTMLandWebAPIdevelopment

– IanHickson isakeyperson,nowatGoogle

lFoundedin2004byindividualsfromApple,MozillaandOperaafteraW3Cworkshop– ConcernaboutW3C'sembraceofXHTML

lWorkedonHTML5,developedMicrodata spec

Page 4: Microdata and schema - csee.umbc.eduHTML5 lStarted by WHATWG as an alternative to XHTML, joined by W3C –HTML5recommendation,October 2014 –HTML5.1recommendation, November 2016 –WHATWG

HTML5

lStartedbyWHATWGasanalternativetoXHTML,joinedbyW3C– HTML5 recommendation, October2014– HTML5.1 recommendation,November2016– WHATWGwillevolveitasa“livingstandard”

lHTML5≈HTML+CSS+jslNativesupportforgraphics,video,audio,speech,semanticmarkup,…

lCurrentsupportinmajorbrowsers

Page 5: Microdata and schema - csee.umbc.eduHTML5 lStarted by WHATWG as an alternative to XHTML, joined by W3C –HTML5recommendation,October 2014 –HTML5.1recommendation, November 2016 –WHATWG

Microdata

lThemicrodata efforthastwoparts:– Amarkupscheme– A setofvocabularies/ontologies

lThemarkupissimilartoRDFainprovidingwaystoidentifysubjects,types,properties&objectsAlsoastandardwaytoencodeMicrodataasRDFa

lSanctionedvocabulariesatschema.org andincludeasmallnumberofveryusefulones:people,movies,events,recipes,etc.

Page 6: Microdata and schema - csee.umbc.eduHTML5 lStarted by WHATWG as an alternative to XHTML, joined by W3C –HTML5recommendation,October 2014 –HTML5.1recommendation, November 2016 –WHATWG

Anexample

<div><h1>Avatar</h1><span>Director:JamesCameron(born1954)</span><span>Sciencefiction</span><ahref=”avatar-trailer.html">Trailer</a></div>

Page 7: Microdata and schema - csee.umbc.eduHTML5 lStarted by WHATWG as an alternative to XHTML, joined by W3C –HTML5recommendation,October 2014 –HTML5.1recommendation, November 2016 –WHATWG

Anexample:itemscope

l Anitemscope attributeidentifiesacontentsubtree thatisthesubjectaboutwhichwewanttosaysomething

<divitemscope ><h1>Avatar</h1><span>Director:JamesCameron(born1954)</span><span>Sciencefiction</span><ahref=”avatar-trailer.html">Trailer</a></div>

Page 8: Microdata and schema - csee.umbc.eduHTML5 lStarted by WHATWG as an alternative to XHTML, joined by W3C –HTML5recommendation,October 2014 –HTML5.1recommendation, November 2016 –WHATWG

Anexample:itemtype

l Anitemscope attributeidentifiesacontentsubtree thatisthesubjectaboutwhichwewanttosaysomething

l Theitemtype attributespecifiesthesubject’stype

<divitemscope itemtype="http://schema.org/Movie"><h1>Avatar</h1><span>Director:JamesCameron(born1954)</span><span>Sciencefiction</span><ahref=”avatar-trailer.html">Trailer</a></div>

Page 9: Microdata and schema - csee.umbc.eduHTML5 lStarted by WHATWG as an alternative to XHTML, joined by W3C –HTML5recommendation,October 2014 –HTML5.1recommendation, November 2016 –WHATWG

Microdata<->RDF

http://rdf-translator.appspot.com/

Page 10: Microdata and schema - csee.umbc.eduHTML5 lStarted by WHATWG as an alternative to XHTML, joined by W3C –HTML5recommendation,October 2014 –HTML5.1recommendation, November 2016 –WHATWG

Microdata<->RDF

http://rdf-translator.appspot.com/

Page 11: Microdata and schema - csee.umbc.eduHTML5 lStarted by WHATWG as an alternative to XHTML, joined by W3C –HTML5recommendation,October 2014 –HTML5.1recommendation, November 2016 –WHATWG

Anexample:itemtype

l Anitemscope attributeidentifiescontentsubtree thatisthesubjectaboutwhichwewanttosaysomething

l Theitemtype attributespecifiesthesubject’stype

<divitemscope itemtype="http://schema.org/Movie"><h1>Avatar</h1><span>Director:JamesCameron(born1954)</span><span>Sciencefiction</span><ahref=”avatar-trailer.html">Trailer</a></div>

[ ] a schema:Movie .

Page 12: Microdata and schema - csee.umbc.eduHTML5 lStarted by WHATWG as an alternative to XHTML, joined by W3C –HTML5recommendation,October 2014 –HTML5.1recommendation, November 2016 –WHATWG

Anexample:itemprop

l Anitemscope attributeidentifiesacontentsubtree thatisthesubjectaboutwhichwewanttosaysomething

l Theitemtype attributespecifiesthesubject’stypel Anitemprop attributegivesapropertyofthattype

<divitemscope itemtype="http://schema.org/Movie"><h1itemprop="name">Avatar</h1><span>Director:JamesCameron(born1954)</span><spanitemprop="genre">Sciencefiction</span><ahref=”avatar-trailer.html”itemprop="trailer">Trailer</a></div>

Page 13: Microdata and schema - csee.umbc.eduHTML5 lStarted by WHATWG as an alternative to XHTML, joined by W3C –HTML5recommendation,October 2014 –HTML5.1recommendation, November 2016 –WHATWG

Anexample:itemprop

l Anitemscope attributeidentifiesacontentsubtree thatisthesubjectaboutwhichwewanttosaysomething

l Theitemtype attributespecifiesthesubject’stypel Anitemprop attributegivesapropertyofthattype

<divitemscope itemtype="http://schema.org/Movie"><h1itemprop="name">Avatar</h1><span>Director:JamesCameron(born1954)</span><spanitemprop="genre">Sciencefiction</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> .

Page 14: Microdata and schema - csee.umbc.eduHTML5 lStarted by WHATWG as an alternative to XHTML, joined by W3C –HTML5recommendation,October 2014 –HTML5.1recommendation, November 2016 –WHATWG

Anexample:embeddeditems

l Anitemprop immediatelyfollowedbyanotheritemscopemakesthevalueanobject

<divitemscope itemtype="http://schema.org/Movie"><h1itemprop="name">Avatar</h1><divitemprop="director"

itemscope itemtype="http://schema.org/Person">Director:<spanitemprop="name">JamesCameron</span>(born<spanitemprop="birthDate">1954</span>)

</div><spanitemprop="genre">Sciencefiction</span><ahref="avatar-trailer.html"itemprop="trailer">Trailer</a></div>

Page 15: Microdata and schema - csee.umbc.eduHTML5 lStarted by WHATWG as an alternative to XHTML, joined by W3C –HTML5recommendation,October 2014 –HTML5.1recommendation, November 2016 –WHATWG

Anexample:embeddeditems

l Anitemprop immediatelyfollowedbyanotheritemcope makesthevalueanobject

<divitemscope itemtype="http://schema.org/Movie"><h1itemprop="name">Avatar</h1><divitemprop="director"

itemscope itemtype="http://schema.org/Person">Director:<spanitemprop="name">JamesCameron</span>(born<spanitemprop="birthDate">1954</span>)

</div><spanitemprop="genre">Sciencefiction</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> .

Page 16: Microdata and schema - csee.umbc.eduHTML5 lStarted by WHATWG as an alternative to XHTML, joined by W3C –HTML5recommendation,October 2014 –HTML5.1recommendation, November 2016 –WHATWG

schema.org vocabulary

lFulltypehierarchyinonefilel619classes,876properties(Nov‘17)lDatatypes:Boolean,Date,DateTime,Number,Text,Time

lObjects:RootedatThingwithtwo‘metaclasses’(ClassandProperty)andeightsubclasses

lSeegithubrepo forexamplesandcode

Page 17: Microdata and schema - csee.umbc.eduHTML5 lStarted by WHATWG as an alternative to XHTML, joined by W3C –HTML5recommendation,October 2014 –HTML5.1recommendation, November 2016 –WHATWG

http://www.schema.org/Recipe

Page 18: Microdata and schema - csee.umbc.eduHTML5 lStarted by WHATWG as an alternative to XHTML, joined by W3C –HTML5recommendation,October 2014 –HTML5.1recommendation, November 2016 –WHATWG

TestingStructuredDatainHTML

Page 19: Microdata and schema - csee.umbc.eduHTML5 lStarted by WHATWG as an alternative to XHTML, joined by W3C –HTML5recommendation,October 2014 –HTML5.1recommendation, November 2016 –WHATWG

TestingStructuredDatainHTML

Page 20: Microdata and schema - csee.umbc.eduHTML5 lStarted by WHATWG as an alternative to XHTML, joined by W3C –HTML5recommendation,October 2014 –HTML5.1recommendation, November 2016 –WHATWG

TestingStructuredDatainHTML

Page 21: Microdata and schema - csee.umbc.eduHTML5 lStarted by WHATWG as an alternative to XHTML, joined by W3C –HTML5recommendation,October 2014 –HTML5.1recommendation, November 2016 –WHATWG

MicrodataasaKRlanguage

lMorethanRDF,lessthanRDFSlPropertieshaveanexpected type(range)

– Canbealistoftypes,any ofwhichareOK– Mightbeastringformanyproperties(“somedatabetterthannone”)

lPropertiesattached≥1types(domain)lClassescanhavemultipleparentsandinherit(properties)fromallofthem

lNoaxioms(e.g.,disjointness,cardinality,etc.)lNorelationlikesubPropertyOf

Page 22: Microdata and schema - csee.umbc.eduHTML5 lStarted by WHATWG as an alternative to XHTML, joined by W3C –HTML5recommendation,October 2014 –HTML5.1recommendation, November 2016 –WHATWG

Mixingvocabularies

lMicrodataisintendedtoworkwithjustonevocabulary:theoneatschema.org

lAdvantages:simpleandcontrolled– Simple,organized,welldesigned– Controlledbytheschema.org people

lDisadvantages:toosimple,toocontrolled– Toosimple,narrow,mono-lingual– Controlledbytheschema.orgpeople

Page 23: Microdata and schema - csee.umbc.eduHTML5 lStarted by WHATWG as an alternative to XHTML, joined by W3C –HTML5recommendation,October 2014 –HTML5.1recommendation, November 2016 –WHATWG

Extendingschema.orgontology

lExtensions:hostedvs.external– Hosted:managed& publishedbyschema.orgproject

lYoucansubclassexistingclasses– Person/Engineer– Person/Engineer/ElectricalEngineer

lSubclassexistingproperties– musicGroupMember/leadVocalist– musicGroupMember/leadGuitar1– musicGroupMember/leadGuitar2

Hosted Extensions 11/17• auto.schema.org• bib.schema.org• health-lifesci.schema.org• iot.schema.org• meta.schema.org• pending.schema.org

Page 24: Microdata and schema - csee.umbc.eduHTML5 lStarted by WHATWG as an alternative to XHTML, joined by W3C –HTML5recommendation,October 2014 –HTML5.1recommendation, November 2016 –WHATWG

ExtensionProblems

lHardtoestablishagreeduponmeaning– Throughaxiomssupportedbythelanguage(e.g.,equivalence,disjointness,etc.)

– Noplacefordocumentation(annotations,labels,comments)

lWithoutanamespacemechanism,yourPerson/Engineerandminecanbeconfusedandmightmeandifferentthings– IsaComputerScientistanengineer?

Page 25: Microdata and schema - csee.umbc.eduHTML5 lStarted by WHATWG as an alternative to XHTML, joined by W3C –HTML5recommendation,October 2014 –HTML5.1recommendation, November 2016 –WHATWG

Serialization

lSchema.orghasadatamodel andserializations– Microdataistheoriginal,nativeserialization– RDFaismoreexpressiveandworkswiththeRDFstack– EveryoneagreesthatRDFaLiteisagoodencoding:assimpleasMicrodatabutmoreexpressive

– JSON-LDisanincreasinglypopularacceptedencoding

lSearchengineslookforMicrodata,RDFaandJSON-LD

lSchema.orgconsidersRDFatobethe“canonicalmachinerepresentationofschema.org”

Page 26: Microdata and schema - csee.umbc.eduHTML5 lStarted by WHATWG as an alternative to XHTML, joined by W3C –HTML5recommendation,October 2014 –HTML5.1recommendation, November 2016 –WHATWG

lMicrodataisaneffortbyagroupofsearchcompaniestouseasimplesemanticlanguage

lThesemanticsispragmatic– e.g.,expectedtypes:astringisacceptedwhereathingisexpected– “somedataisbetterthannone”

lTherealvalueisin– thesupportedvocabulariesand– theirusebySearchcompanies

=> Immediatemotivationforusingsemanticmarkup

Conclusions