47
RDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies Conference.

rdfa - csee.umbc.eduRDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies

  • Upload
    others

  • View
    10

  • Download
    0

Embed Size (px)

Citation preview

Page 1: rdfa - csee.umbc.eduRDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies

RDFa:EmbeddingRDF

KnowledgeinHTML

SomecontentfromapresentationbyIvanHermanoftheW3c,IntroductiontoRDFa,givenatthe2011SemanticTechnologiesConference.

Page 2: rdfa - csee.umbc.eduRDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies

lSerializationofRDFembeddedinHTML,HTMLorXMLProvidessetofattributes(thea inRDFa)tousewithexistingtagstocarryRDFmetadata

l2004:workondevelopingstandardsbeganl2008:RDFa1.0arecommendation(butonlyinXHTML,whichfailedtolaunch)

l2012-15:RDFa1.1recommendation(worksinHTML4,HTML5)

lSeehttp://rdfa.info/

WhatisRDFa?

Page 3: rdfa - csee.umbc.eduRDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies

lRDFcontentspecifiedinXMLattributes oftagsratherthanelements

lTheXML/HTMLtreestructure isusedascontext,whenappropriate

lSomenewattributesareintroduced andsomeexistingones(@href,@rel)reused

lWhenpossible,HTMLtextcontentusedforliteralvalues

èSamefileusedbybrowser& RDFextractor

PrinciplesofRDFa

Page 4: rdfa - csee.umbc.eduRDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies

Webpageviewedbyaperson

http://www.w3.org/ns/entailment/data/RDFS.html

Page 5: rdfa - csee.umbc.eduRDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies

Thesource<p about="http://www.w3.org/ns/entailment/RDFS"

property="http://purl.org/dc/terms/description">Unique identifier for <em>RDFS Entailment</em>.</p>

Page 6: rdfa - csee.umbc.eduRDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies

SourceandgeneratedRDF…<p about="http://www.w3.org/ns/entailment/RDFS"

property="http://purl.org/dc/terms/description">Unique identifier for <em>RDFS Entailment</em>.</p>

<http://www.w3.org/ns/entailment/RDFS>… .

Page 7: rdfa - csee.umbc.eduRDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies

SourceandgeneratedRDF…<p about="http://www.w3.org/ns/entailment/RDFS"

property="http://purl.org/dc/terms/description">Unique identifier for <em>RDFS Entailment</em>.</p>

<http://www.w3.org/ns/entailment/RDFS><http://purl.org/dc/terms/description>

… .

Page 8: rdfa - csee.umbc.eduRDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies

SourceandgeneratedRDF…<p about="http://www.w3.org/ns/entailment/RDFS"

property="http://purl.org/dc/terms/description">Unique identifier for <em>RDFS Entailment</em>.</p>

<http://www.w3.org/ns/entailment/RDFS><http://purl.org/dc/terms/description>

"Unique identifier for RDFS Entailment." .

Page 9: rdfa - csee.umbc.eduRDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies

TheWebpageviewedbyaperson

Page 10: rdfa - csee.umbc.eduRDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies

Thesource<a about="http://www.w3.org/ns/entailment/RDFS"

rel="http://www.w3.org/2000/01/rdf-schema#seeAlso" href="http://www.w3.org/TR/2004/REC-rdf-mt-20040210/">

RDF Semantics.</a>

Page 11: rdfa - csee.umbc.eduRDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies

SourceandgeneratedRDF…<a about="http://www.w3.org/ns/entailment/RDFS"

rel="http://www.w3.org/2000/01/rdf-schema#seeAlso" href="http://www.w3.org/TR/2004/REC-rdf-mt-20040210/">

RDF Semantics.</a>

<http://www.w3.org/ns/entailment/RDFS>….

Page 12: rdfa - csee.umbc.eduRDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies

SourceandgeneratedRDF…<a about="http://www.w3.org/ns/entailment/RDFS"

rel="http://www.w3.org/2000/01/rdf-schema#seeAlso" href="http://www.w3.org/TR/2004/REC-rdf-mt-20040210/">

RDF Semantics.</a>

<http://www.w3.org/ns/entailment/RDFS><http://www.w3.org/2000/01/rdf-schema#seeAlso>

… .

Page 13: rdfa - csee.umbc.eduRDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies

SourceandgeneratedRDF…<a about="http://www.w3.org/ns/entailment/RDFS"

rel="http://www.w3.org/2000/01/rdf-schema#seeAlso" href="http://www.w3.org/TR/2004/REC-rdf-mt-20040210/">

RDF Semantics.</a>

<http://www.w3.org/ns/entailment/RDFS><http://www.w3.org/2000/01/rdf-schema#seeAlso>

<http://www.w3.org/TR/2004/REC-rdf-mt-20040210/> .

Page 14: rdfa - csee.umbc.eduRDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies

NtriplesinHTMLL

<http://www.w3.org/ns/entailment/RDFS> <http://purl.org/dc/terms/description>

"Unique identifier for RDFS Entailment." .<http://www.w3.org/ns/entailment/RDFS>

<http://www.w3.org/2000/01/rdf-schema#seeAlso><http://www.w3.org/TR/2004/REC-rdf-mt-20040210/> .

lAllowURI prefixesandsharedsubject,likethis@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .@prefix dcterms: <http://purl.org/dc/terms/> .

<http://www.w3.org/ns/entailment/RDFS>rdfs:seeAlso <http://www.w3.org/TR/2004/REC-rdf-mt-20040210/> ;dcterms:description "Unique identifier for RDFS Entailment." .

lMaybewecandobetter,insteadofthis

Page 15: rdfa - csee.umbc.eduRDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies

lTurtlesupportsseveralsimplifyingideaslUsecompactURIs (CURIE)whenpossible

– URIwithaprefixdefinedelsewhere,e.g.,foaf:mbox

lMakinguseofthenaturalstructurefor– sharedsubjects– sharedpredicates– creatingblanknodes– etc.

Turtlizing RDFa

Page 16: rdfa - csee.umbc.eduRDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies

CURIEdefinitionandusage<html>…<p about="http://www.w3.org/ns/entailment/RDFS"

property="http://purl.org/dc/terms/description">Unique identifier for <em>RDFS Entailment</em>.</p>

…</html>

l canbereplacedby:<html prefix="dcterms: http://purl.org/dc/terms/">

…<p about="http://www.w3.org/ns/entailment/RDFS"

property="dcterms:description">Unique identifier for <em>RDFS Entailment</em>.</p>

…</html>

Page 17: rdfa - csee.umbc.eduRDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies

lCanbeanywhereintheHTMLtreeandisvalidforentiresub-tree– i.e.,htmlelementnottheonlyplacetohaveit

lThesame@prefixattributecanholdseveraldefinitions:– prefix="dcterm:http://purl.org…foaf:http://…”

lCURIEsand“real”URIscanusuallybemixedlCURIEscannot beusedon@href

Detailson@prefixinRDFa

Page 18: rdfa - csee.umbc.eduRDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies

Sharingsubjects

<html prefix="dcterms: http://purl.org/dc/terms/rdfs: http://www.w3.org/2000/01/rdf-schema#">

…<body about="http://www.w3.org/ns/entailment/RDFS">

…<p property="dcterms:description">Unique identifier for <em>RDFS Entailment</em>.</p>

<p>…<a rel="rdfs:seeAlso" href="http://www.w3.org/TR/2004/REC-rdf-mt-20040210">RDFS Semantics</a>…</p>

Basicprinciple:@aboutisinheritedbychildrennodes,sonoreasontorepeatit

Page 19: rdfa - csee.umbc.eduRDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies

…yielding

@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .@prefix dcterms: <http://purl.org/dc/terms/> .

<http://www.w3.org/ns/entailment/RDFS>rdfs:seeAlso <http://www.w3.org/TR/2004/REC-rdf-mt-20040210/> ;dcterms:description "Unique identifier for RDFS Entailment." .

Page 20: rdfa - csee.umbc.eduRDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies

Onreusingliterals

lReusingliteralsisaplus,butyoudon’talwayswanttodoit

lThebasicrulesays:the(RDF)LiteralistheenclosedtextfromtheHTMLcontent

lThisisfinein80%ofthecases,but…l…itmaynotbenaturalinmanycases!

Page 21: rdfa - csee.umbc.eduRDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies

Example:dates<body about=".." prefix="dcterms: http://… xsd: http://…"

<address><p property="dcterms:date" datatype="xsd:date">2010-07-05</p>

</address></body>

lThisleadsto:@prefix dcterms: <http://…> .@prefix xsd: <http://…> .<..> dcterms:date "2010-07-05"^^xsd:date .

l2010-07-05isofficialISOformat(forxsd:date)but“July5,2010”ispreferredbypeople

Page 22: rdfa - csee.umbc.eduRDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies

Usageof@content<body about=".." prefix="dcterms: http://… xsd: http://…"

<address><p property="dcterms:date" datatype="xsd:date"

content="2010-07-05">July 5, 2010</p></address>

</body>

lAlsoleadsto:@prefix dcterms: <http://…> .@prefix xsd: <http://…> .<..> dcterms:date "2010-07-05"^^xsd:date .

Page 23: rdfa - csee.umbc.eduRDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies

lHereisourrulesofar– @aboutsetsthesubject– @hrefsetstheobject

lButthatisnotalwaysgoodenough– Wemaynotwanttointroduceanactivelink(i.e.,"a"element)onthewebpage

– whataboutotherlinksinHTML?

Onsubjectsandobjects

Page 24: rdfa - csee.umbc.eduRDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies

Wemaynotalwayswantlinks…

<span about="http://www.ivan-herman.net/foaf#me"><span rel="rdfs:seeAlso"

resource="http://www.w3.org/People/Ivan/">Activity Lead</span></span>

lThe RDFa @resource attribute is equivalent to @href

lSets the object, just like @href but is ignored by browsers, e.g.,:

Page 25: rdfa - csee.umbc.eduRDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies

Morefeatures

lRDFa 1.1hasmorefeaturesthatmakeiteasiertorepresentknowledgecompactlyinHTML

lThesetakeadvantageoftheHTMLtreecontext

lWe’llskipthedetails,whichyoucanfindin– RDFa1.1Primer– RDFa1.1Core

Page 26: rdfa - csee.umbc.eduRDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies

lSometoolsalreadyhaveRDFafacilities:– e.g.,itispossibletoaddtherightDTDtoDreamweaver,Amayahasitatitscore,etc.

lTherearepluginsto,e.g.,WordPress,togenerateRDFamarkup

lCMSsystems(likeDrupal7)mayhaveRDFabuiltintheirpublicationsystem– usersgenerateRDFawhethertheyknowaboutitornot…

AuthoringRDFa

Page 27: rdfa - csee.umbc.eduRDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies

lMajorsearchengines(Google,Yahoo)processRDFaforvocabulariestheyunderstandcanuse

lTherearelibraries,distillers,etc.,toextractRDFainformation– maybepartofRDFdevelopmentenvironmentslikeRedland,RDFLib

– see,forfurtherreferences,http://rdfa.info/wiki/Consume

lFacebook’s“socialgraph”isbasedonRDFa

ConsumingRDFa

Page 28: rdfa - csee.umbc.eduRDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies

ApagefromBestBuyRDFa for Facebook markup, JSON-LD for search engines

Page 29: rdfa - csee.umbc.eduRDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies

FB’sOpenGraphProtocol

Page 30: rdfa - csee.umbc.eduRDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies

lRDFa+HTML filecanjustbeonaserver– theclientextractstheRDFcontent

lContentnegotiationscanbesetupontheserverside– theclientgetstheformathe/sheasksfor– theRDFcontentcaneitherbegeneratedontheflyorstoredontheserverstatically

PublishingRDFa

Page 31: rdfa - csee.umbc.eduRDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies

Embeddedmetadata(microdataorRDFa)isusedtoimprovesearchresultpage– atthemomentonlyafewvocabulariesarerecognized,butthatisevolvingcontinually

Google’srichsnippets

Page 32: rdfa - csee.umbc.eduRDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies

AnumberofpopularsitespublishRDFaaspartoftheirnormalpages:

– Tesco,BestBuy,Slideshare,TheLondonGazette,Newsweek,MSNBC,O’ReillyCatalog,theWhiteHouse…

– CreativeCommonssnippetsareinRDFa(e.g.,onFlickr)

Effectsof,e.g.,GoogleorFacebook

Page 33: rdfa - csee.umbc.eduRDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies

CourtesyofJayMyers,BestBuy,SemTech2010Presentation

BestBuyexampleofRDFause

Page 34: rdfa - csee.umbc.eduRDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies

BestBuyexampleofRDFaUse

CourtesyofJayMyers,BestBuy,SemTech2010Presentation

Page 35: rdfa - csee.umbc.eduRDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies

lReportedinaBestBuyblog:– GoodRelations+RDFa improvedGoogleranktremendously

– 30%increaseintrafficonBestBuystorepages– Yahooobserversa15%increaseinclick-throughrate

lToday,BestBuyusesRDFaformuchmorethanjustsnippets– E.g.,tolocateshopsthathavecertainproductsonstock…

EffectsonBestBuy

Page 36: rdfa - csee.umbc.eduRDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies

LibraryofCongressRDFause

Page 37: rdfa - csee.umbc.eduRDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies

LibraryofCongressRDFause

Page 38: rdfa - csee.umbc.eduRDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies

Overstock.com example

Page 39: rdfa - csee.umbc.eduRDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies

Overstock.com example

Page 40: rdfa - csee.umbc.eduRDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies

Drupalcontentmanagementsystem

l RDFsupportinDrupalv.7

l MajorCMSsysteml HasRDFathiscore,pagescontainRDFa

l InonestepmillionsofpagesofadditionalRDFdata!

Page 41: rdfa - csee.umbc.eduRDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies

TheExaminer.com

Page 42: rdfa - csee.umbc.eduRDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies

TheExaminer.com

Page 43: rdfa - csee.umbc.eduRDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies

Extractingthedatardfa>pythongetdata.py "http://www.w3.org/ns/entailment/data/RDFS.html"@prefixdc:<http://purl.org/dc/terms/>.@prefixent:<http://www.w3.org/ns/entailment/>.…ent:RDFS aent:Entailment ;dc:creator <http://www.ivan-herman.net/foaf#me>;dc:date "2010-05-03"^^xsd:date ;dc:description "UniqueidentifierforRDFSEntailment";rdfs:comment "ThespecificationfortheRDFSentailmentis…SemanticsW3CRecommendation.";rdfs:isDefinedBy <http://www.w3.org/TR/2004/REC-rdf-mt-20040210/#rdfs_entailment>;rdfs:seeAlso <http://www.w3.org/TR/2004/REC-rdf-mt-20040210/>.

<http://www.w3.org/ns/entailment/data/RDFS.html>dc:title "InformationResourceRDFSEntailment";xhv:stylesheet <http://www.w3.org/StyleSheets/TR/base>.

<http://www.ivan-herman.net/foaf#me>afoaf:Person ;rdfs:seeAlso <http://www.ivan-herman.net/foaf>;foaf:mbox <mailto:[email protected]>;foaf:name "IvanHerman";foaf:title "SemanticWebActivityLead";foaf:workplaceHomepage <http://www.w3.org>.

Page 44: rdfa - csee.umbc.eduRDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies

getdata.py isverysimpleimportrdflib,sysifnot(1<len(sys.argv)<4):print'usage:pythongetdata.py url [‘json-ld’|rdfa |rdfa1.1|microdata|html]'

print'eg:pythongetdata.py "http://www.w3.org/ns/entailment/data/RDFS.html"'

sys.exit(0)

url =sys.argv[1]format=sys.argv[2]iflen(sys.argv)==3else'rdfa1.1’g=rdflib.Graph()g.parse(url,format=format)printg.serialize(format='n3')

Page 45: rdfa - csee.umbc.eduRDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies

OpenLinkStructuredDataSniffer*

* http://osds.openlinksw.com/

Page 46: rdfa - csee.umbc.eduRDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies

OpenLinkStructuredDataSniffer*

* http://osds.openlinksw.com/

Page 47: rdfa - csee.umbc.eduRDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies

lWebdeveloperswantcontentproviderstoaddstructureddatatoHTMLpages

lContentprovidersareincentivizedtodosobecausetheircontentwillbebetterunderstood,rankedhigher,moreuseful,etc.

lRDFaismostpowerful& flexibleknowledgemarkupstandardunderstoodbysearchengines

lRDFaisalsoanalternativeserializationoffullRDF

Conclusions