60
Chapter 3 RDF Syntax 2

RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

Chapter3RDFSyntax2

Page 2: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

Topics•  BasicconceptsofRDF

•  Resources,proper3es,values,statements,triples•  URIsandURIrefs•  RDFgraphs•  Literals,qnames

•  Vocabulariesandmodeling•  Vocabularies•  Blanknodes,datamodeling,types,reifica3on•  Lists,bags,collec3ons

•  Serializa3onofRDFgraphs•  XML,Turtle,Ntriples

•  Cri3queofRDF

Page 3: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

Types

Page 4: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

RDFtype

l RDFhasatypepredicatethatlinksaresourcetoanotherthatdenotesitstype–  ex:johnrdf:typefoaf:Person.–  <hQp://example.org/john><hQp://www.w3.org/1999/02/22-rdf-syntax-ns#type><hQp://xmlns.com/foaf/0.1/Person>.

l RDFSaddssub-typeconcept&constraintsbetweenpredicates&typesoftheirarguments

l OWLaddss3llmoreconceptsopera3ngontypes

Page 5: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

DataModeling

Page 6: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

StructuredValuesinRDF

l Giventhetriplelike:ex:857exstaff:address"15GrantAve,Bedford,MA01730".

l Howcanwebestrepresentseparateinforma-3onforthestreet,city,stateandzipcode?

l Twopossibili3es:– Usefourpredicates(e.g.,exstaff:street_address,…)toassociatevalueswithexstaff:857

– CreateanaddressresourcetoaQachthefourpredicatestoandlinkthattoexstaff:addresswiththeex:addresspredicate

Page 7: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

StructuredValuesinRDF

Page 8: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

StructuredValuesinRDF

Orintriplesnota3on:

exstaff:85740exterms:addressexaddressid:85740.exaddressid:85740exterms:street"1501GrantAve".exaddressid:85740exterms:city"Bedford".exaddressid:85740exterms:state"MD".exaddressid:85740exterms:postalCode"01730".

Page 9: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

StructuredValuesinRDF

l Thisapproachinvolvesaddingmany“inter-mediate”URIrefs(e.g.,exaddressid:85740)foraggregateconceptslikeJohn'saddress

l Suchconceptsmayneverneedtobereferredtodirectlyfromoutsideapar3culargraph,andhencemaynotrequire“universal”idenDfiers

l RDFallowsustouseblanknodesandblanknodeidenDfierstodealwiththisissue–  NodeIDsinthe_namespacearebnodes,e.g._:

Page 10: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

KnowledgeTechnologiesManolisKoubarakis

10

BlankNode,akabnode

Page 11: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

BlankNodesUsingTriples

exstaff:85740exterms:address??.??exterms:postalCode"01730".Exstaff:72120exterms:address???.???exterms:postalCode"01702".

l Wewanttoensurethatthebnodesfor85740’sand72120’saddressesaredis3nct

l Thegraphicalnota3ondoesthisbyusingtwodifferentobjectsforthebnodes

l RDFallowsustoassignanspecialIDtoabnodewhiles3llmaintainingitsblanknodenature

Page 12: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

BlankNodeIdenDfiersexstaff:85740exterms:address_:johnaddress._:johnaddressexterms:street"1501GrantAvenue"._:johnaddressexterms:postalCode"01730".

l Dis3nctbnodemusthavedifferentbnodeidsl Bnodeidshavesignificanceonlyinasinglegraph– dbpedia:Alan_Turingreferstothesamethingineverygraph,butabnode_:1intwodifferentgraphsmaynot

– Mergingtwographsrequiresustorenametheirbnodeidstoavoidaccidentalconfla3on(e.g.,_:1=>_:100)

l Bnodeidsmayonlyappearassubjectsorobjectsandnotaspredicatesintriples

Page 13: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

SemanDcsofBlankNodes

l  Intermsoffirst-orderlogic,blanknodescorrespondtoexisten3allyquan3fiedvariables

l  Anotherexample:“John’smotheris50”l  FOL:∃xmother(john,x)∧age(x,50)l  RDF::john:mother_32.:_32:age“50”.

:john “50”:mother :age

Page 14: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

Blanknodesaregoodfor

l Represen3ngn-aryrelaDonshipsinRDFe.g.,therela3onshipbetweenJohnSmithandthestreet,city,state,andpostalcodecomponentsofhisaddress

l Tomakestatementsaboutresourcesthatdon’thaveURIsbutaredescribedbyrela3onshipswithotherresourcesthatdoe.g.,John’smother

Page 15: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

Example

l TomakestatementsaboutJaneSmithwecoulduseheremailaddressURI(mailto:[email protected])todenoteher

l Well,ifwedoso,howarewegoingtorecordinforma3onbothaboutJane'smailbox(e.g.,theserveritison)aswellasaboutJaneherself(e.g.,hercurrentphysicaladdress)?Similarly,ifweuseherWebpageURIetc.

Page 16: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

BnodeExample

WhenJaneherselfdoesnothaveaURI,ablanknodeprovidesabeQerwayofmodelingthissitua3on

_:janeexterms:mailbox<mailto:[email protected]>._:janerdf:typeexterms:Person._:janeexterms:name"JaneSmith"._:janeexterms:empID"23748"._:janeexterms:age"26".

Page 17: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

Anotherusecase:Measurements

l Whatdoesthismean?dbr:Niledbp:length"6853"^^xsd:integer

l Wecanclickondbp:lengthtoseeitsdefini3on

Page 18: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

Anotherusecase:Measurements

l Whatdoesthismean?dbr:Niledbp:length"6853"^^xsd:integer

l Wecanclickondbp:lengthtoseeitsdefini3ondbp:lengthrdf:typerdf:Property.dbp:lengthrdfs:label"Length"@en.

l Unfortunately,thedefini3ondoesn’tspecifytheunitofmeasurement.L

Page 19: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

Anotherusecase:Measurements

l Whatdoesthismean?dbr:Niledbp:length"6853"^^xsd:integer

l Measurementstypicallyhaveanumericvalueandaunit–  Weight:2.4poundsvs.2.4kilograms–  Length:5milesvs.5kilometers–  Price:29.00inUSDollarsvs.21.16Euro–  Time:30yearsvs.3milliseconds

l Wecanuseabnodetorepresentameasurementasapairwithavalueandunit

Page 20: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

Measurements

l Whatdoesthismean?dbr:Niledbp:length_:1._:1rdf:typeex:Measure._:1rdf:value”6853"^^xsd:integer._:1un:unitsdbr:Kilometre.

l TheRDFnamespacehasavaluepropertybutassignsnospecificmeaningtoit

Nile

dbr:Kiometre 6853

un:unit

rdf:type

ex:Measure dbp:length

rdf:value

Page 21: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

Serializa3on

Page 22: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

RDFSerializaDon•  AbstractmodelforRDFisagraph•  Serializeastextforexchange,storage,viewingandedi3ngintexteditors

•  Thebigthree•  XML/RDF–theoriginal•  Ntriples–simple,butverbose;goodforprocessing•  Turtle–compact,easyforpeopletoreadandwrite

•  Specialformats•  Trig–aformatfornamedgraphs•  RDFa–embedRDFinHTMLaQributes•  JSON-LD–RDFstatementsasaJSONobject

Page 23: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

XMLencodingforRDF

<rdf:RDFxmlns:rdf="hQp://www.w3.org/1999/02/22-rdf-syntax-ns#"xmlns:dc="hQp://purl.org/dc/elements/1.1/"xmlns:bib="hQp://daml.umbc.edu/ontologies/bib/"><rdf:Descrip3onabout="hQp://umbc.edu/~finin/talks/idm02/"><dc:3tle>IntelligentInforma3onSystemsontheWeb</dc:Title><dc:creator><rdf:Descrip3on><bib:name>TimFinin</bib:Name><bib:email>[email protected]</bib:Email><bib:affresource="hQp://umbc.edu/"/></rdf:Descrip3on></dc:creator></rdfdescrip3on></rdf:RDF>

RDF/XMLisaW3CStandardwidelyusedforstorageandexchangeBeingsupplantedbyotherformsComplexandconfusingsowewon’tspend3meonit

Page 24: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

Ntriples

l Goodforinges3ngintoaprogramorstorel Sequenceoftripleseachterminatedwitha.l URIsencasedinanglebrackets;noQNames;literalsindoublequotes

l Trivialtoparse/generate;mostcommondown-loadformatforRDFdatasets(e.g.,DBpedia)

l UseslotsofcharactersduetorepeatedURLs,butcompresseswell

<hQp://example.org/Turing><hQp://www.w3.org/1999/02/22-rdf-syntax-ns#type><hQp://xmlns.com/foaf/0.1/Person>.<hQp://example.org/Turing><hQp://xmlns.com/foaf/0.1/name>"AlanTuring".<hQp://www.w3.org/2001/sw/RDFCore/ntriples/><hQp://xmlns.com/foaf/0.1/mbox><mailto:[email protected]>.

W3CSpecifica3on

Page 25: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

Turtle

l Ntriples⊂Turtle⊂N3l Compact,easytoreadandwriteandparsel Qnames,[]nota3onforblanknodes,;and,@prefixrdf:<hQp://www.w3.org/1999/02/22-rdf-syntax-ns#>.@prefixdc:<hQp://purl.org/dc/elements/1.1/>.@prefixfoaf:<hQp://xmlns.com/foaf/0.1/>.

<hQp://www.w3.org/TR/rdf-syntax-grammar>dc:3tle"RDF/XMLSyntaxSpecifica3on(Revised)";dc:creator[foaf:name"DaveBeckeQ";foaf:mbox<mailto:[email protected]>,<mailto:[email protected]>].

Page 26: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

Somedetails

l @PREFIXlinesdefinenamespaceabbrevia3onsl BasicpaQernis

Subjpred1value1;pred2value2;pred3value3,value4.

l Specialnota3onfortherdf:typepredicate:johnafoaf:Person;foaf:name"JohnSmith".

l Specialnota3onforanonymousbnodes:johnfoaf:knows[afoaf:Person;foaf:nick"Bob"].

Page 27: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

NotaDon3orN3

l N3wasanearlyturtle-likenota3ondevelopedbyTim_BernersLeehimself

l  Includedsupportforinferencerules–  SeeCWMforso~ware

l NeverbecamearecommendedW3Cstandard–  Someofitsfeatureswereproblema3cforOWL–  SupplantedbyTurtle

Page 28: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

Try…

l RDFexamples:hQp://bit.ly/691rdfl Simple.Ql#AsimpleTurtleexample

@prefixfoaf:<hQp://xmlns.com/foaf/0.1/>.@prefix:<#>.

:johnafoaf:Person;foaf:gender"Male";foaf:name"JohnSmith","JohnnySmith";foaf:knows:mary,[afoaf:Person;foaf:mbox<mailto:[email protected]>].

:maryafoaf:Person;foaf:name"MarySmith".

Page 29: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

NotaDontranslaDon

l MostmodernSeman3cWebso~warecanreadandwriteinputinthethreemajorserializa3onnota3ons–  E.g.,Protégé,Jena,Sesame,…

l Therearealsosimpleprobramsthatcanconvertbetweenthem

l rdf2rdfisagoodexample–  WriQeninJava

Page 30: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

Reifica3on

Page 31: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

ReificaDon

l  Some3meswewishtomakestatementsaboutotherstatementsE.g.,torecordprovenancedata,probability,ortoassert:john:believes{:mary:loves:john}

l  Wemustbeabletorefertoastatementusinganiden3fier

l  RDFallowssuchreferencethroughareifica3onmechanismwhichturnsastatementintoaresource

Page 32: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

Reify

l Etymology:La3nresthingl Date:1854l Toregard(somethingabstract)asamaterialorconcretething

Page 33: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

Wikipedia:reificaDon(computerscience)

Reifica3onistheactofmakinganabstractcon-ceptorlow-levelimplementa3ondetailofapro-gramminglanguageaccessibletotheprogram-mer,o~enasafirst-classobject.Forexample,–  TheCprogramminglanguagereifiesthelow-leveldetailofmemoryaddresses.

–  TheSchemeprogramminglanguagereifiescon3nua-3ons(approximately,thecallstack).

–  InC#,reifica3onisusedtomakeparametricpolymor-phismimplementedasgenericsafirst-classfeatureofthelanguage.

–  …

Page 34: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

ReificaDonExample

:949352uni:name“GrigorisAntoniou”.

reifiesas

[ardf:Statement;rdf:subject::949352rdf:predicateuni:name;rdf:object“GrigorisAntoniou”].

Page 35: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

ReificaDonExample

<rdf:Descrip3onrdf:about="#949352”><uni:name>GrigorisAntoniou</uni:name></rdf:Descrip3on>

reifiesas

<rdf:Statementrdf:ID="StatementAbout949352"><rdf:subjectrdf:resource="#949352"/><rdf:predicaterdf:resource="hQp://example.org/uni-

ns#name"/><rdf:object>GrigorisAntoniou</rdf:object></rdf:Statement>

Page 36: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

AnotherreificaDonexample

“AlicesuspectsthatBoblovesCarol”@prefixep:<hQp://example.com/epis3mology>@prefixrdf:<hQp://www.w3.org/1999/02/22-rdf-syntax-ns#>.@prefixxsd:hQp://www.w3.org/2001/XMLSchema:bob:loves:carol.[:aliceep:believes[ardf:Statement;rdf:subject:bob;rdf:predicate:loves;rdf:object:carol;ex:certainty“0.50”^^xsd:integer]

Page 37: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

ReificaDon

l  rdf:subject,rdf:predicate&rdf:objectallowustoaccessthepartsofastatement

l  TheIDofthestatementcanbeusedtorefertoit,ascanbedoneforanydescrip3on

l  Wewriteanrdf:DescripDonifwedon’twanttotalkaboutastatementfurther

l  Wewriteanrdf:Statementifwewishtorefertoastatement

Page 38: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

Containers

Page 39: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

ContainerElements

l RDFhassomevocabularytodescribecollec3onsofthingsandmakestatementsaboutthem

l E.g.,wemaywishtotalkaboutthecoursesgivenbyapar3cularlecturer

l Thecontentofcontainerelementsarenamedrdf:_1,rdf:_2,etc.–  Alterna3velyrdf:li

l ContainersseemabitmessyinRDF,butareneededl  :john:teaches[ardf:Bag;rdf:li:cmsc201,:cmsc202,cmsc345.].

Page 40: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

ThreeTypesofContainerElements

l rdf:Baganunorderedcontainer,allowingmul3pleoccurrencese.g.,membersofthefaculty,documentsinafolder

l rdf:Seqanorderedcontainer,whichmaycontainmul3pleoccurrencese.g.,modulesofacourse,itemsonanagenda,alphabe3zedlistofstaffmembers

l rdf:Altasetofalterna3vese.g.,thedocumenthomesiteanditsmirrors,transla3onsofadocumentinvariouslanguages

Page 41: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

ExampleforaBagLet’sdescribeacoursewithacollec3onofstudents

Page 42: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

ExampleforaBag

@prefixrdf:<hQp://www.w3.org/1999/02/22-rdf-syntax-ns#>.@prefixs:<hQp://example.org/students/vocab#>.<hQp://example.org/courses/6.001>s:students[ardf:Bag;rdf:_1<hQp://example.org/students/Amy>;rdf:_2<hQp://example.org/students/Mohamed>;rdf:_3<hQp://example.org/students/Johann>;rdf:_4<hQp://example.org/students/Maria>;rdf:_5<hQp://example.org/students/Phuong>.].

Page 43: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

ExampleforAlternaDve

<uni:courserdf:ID="CIT1111" uni:courseName="DiscreteMathema3cs"><uni:lecturer> <rdf:Alt> <rdf:lirdf:resource="#949352"/> <rdf:lirdf:resource="#949318"/> </rdf:Alt></uni:lecturer>

</uni:course>

Page 44: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

Rdf:IDAkributeforContainerElements

<uni:lecturerrdf:ID="949318" uni:name="DavidBillington"><uni:coursesTaught> <rdf:Bagrdf:ID="DBcourses"> <rdf:_1rdf:resource="#CIT1111"/> <rdf:_2rdf:resource="#CIT3112"/> </rdf:Bag></uni:coursesTaught>

</uni:lecturer>

Page 45: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

BagsandSeqsareneverfull!l RDF’sseman3csis“openworld”,so…

– Notpossible”toclose”thecontainer,tosay:“theseareallelements,therearenomore”

– RDFisagraph,withnowaytoexcludethepossibilitythatthereisanothergraphsomewheredescribingaddi3onalmembers

l Listsarecollec3onswithonlythespecifiedmembersmen3oned.

l DescribedusingalinkedlistpaQernvia:– rdf:List,rdf:first,rdf:rest,rdf:nil

Page 46: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

Openvs.closedworldsemanDcsl Reasoningsystemsmakeadis3nc3onbetweenopenandclosedworldseman3cs– OWS:beingunabletoprovethatsomethingistrueorfalsesaysnothingaboutitsveracity

– CWS:whatcannotbeproventobetrueisfalse

l DefaultmodelforSeman3cWebisOWSThiswasadesigndecisionmadeearlyon

Page 47: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

Openvs.closedworldsemanDcsl ClassicallogicusesOpenWorldSeman3cs

BeingunabletoproveP=NPdoesn’tconvinceusthatit’sfalse

l DatabasesystemstypicallyassumeCWSTheDBincludesalltrainsbetweenNYCandDC

l Prolog’sunprovableoperator(notor\+)supportsCWSflys(x):-bird(x),\+flightless(x).flightless(x):-penguin(x);ostrich(x);emu(x).

l Somesystemsletusspecifyforwhichpredicateswehavecompleteknowledgeandforwhichwedon’t–  IfUMBC’sDBdoesn’tlistyouasregisteredforCMSC691,youarenotregistered

–  UMBC’sDBsystemknowssomeofyourminorsbutnotall

Page 48: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

RDFListsAnorderedlistofthethreestudentsinaclass

Page 49: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

RDFLists

@prefixrdf:<hQp://www.w3.org/1999/02/22-rdf-syntax-ns#>.@prefixs:<hQp://example.org/students/vocab#>.

<hQp://example.org/courses/6.001>s:students[ardf:List;rdf:first<hQp://example.org/students/Amy>;rdf:rest[ardf:listrdf:first<hQp://example.org/students/Mohamed>;rdf:rest[ardf:List;rdf:first<hQp://example.org/students/Johann>;rdf:restrdf:nil]]].

Page 50: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

RDFLists

Turtlehasspecialsyntaxtorepresentlists:

@prefixrdf:<hQp://www.w3.org/1999/02/22-rdf-syntax-ns#>.@prefixs:<hQp://example.org/students/vocab#>.

<hQp://example.org/courses/6.001>s:students(<hQp://example.org/students/Amy><hQp://example.org/students/Mohamed><hQp://example.org/students/Johann>).

Page 51: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

Cri3queofRDF

Page 52: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

RDFCriDque:ProperDes

l Proper3esarespecialkindsofresources– Proper3escanbeusedastheobjectinanobject-aQribute-valuetriple(statement)

– Definedindependentofresources

l Thispossibilityoffersflexibility

l ButitisunusualformodellinglanguagesandOOprogramminglanguages

l Itcanbeconfusingformodellers

Page 53: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

RDFCriDque:BinaryPredicates

l RDFusesonlybinaryproper3es–  Thisisarestric3onbecauseo~enweusepredicateswithmorethantwoarguments

–  Butbinarypredicatescansimulatethese

l Example:referee(X,Y,Z)–  XistherefereeinachessgamebetweenplayersYandZ

Page 54: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

RDFCriDque:BinaryPredicates

l Weintroduce:–  anewauxiliaryresourcechessGame–  thebinarypredicatesref,player1,andplayer2

l Wecanrepresentreferee(X,Y,Z)as:

Page 55: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

RDFCriDque:ReificaDon

l Thereifica3onmechanismisquitepowerfull ItappearsmisplacedinasimplelanguagelikeRDF

l MakingstatementsaboutstatementsintroducesalevelofcomplexitythatisnotnecessaryforabasiclayeroftheSeman3cWeb

l Instead,itwouldhaveappearedmorenaturaltoincludeitinmorepowerfullayers,whichprovidericherrepresenta3onalcapabili3es

Page 56: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

RDFCriDque:GraphRepresentaDon

l Thesimplegraphornetworkrepresenta3onhasmoredrawbacks

l Linearlanguagesintroducewaystorepresentthiswithparenthesesorawaytorepresentablockstructure

l Scoping,forexample,isclumsyatbestinRDFbelieve(john,and(love(bob,carol),love(carol,bob))

l Someoftheseareaddressedthroughtheno3onofanamedgraphinRDF

Page 57: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

RDFgraphmodelissimple

l RDF’sgraphmodelisasimpleonel Neo4Jisapopulargraphdatabasewherebothnodesandlinkscanhaveproper3es

Page 58: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

RDFCriDque:Summary

l RDFhasitsidiosyncrasiesandisnotanop3malmodelinglanguagebut

l Itisalreadyadefactostandardl Ithassufficientexpressivepower– Reasonablefounda3ononwhichtobuild

l UsingRDFoffersthebenefitthatinforma3onmapsunambiguouslytoamodel

Page 59: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

Conclusion

Page 60: RDF Syntax 2 - Department of Computer Science and Electrical … · 2016. 9. 26. · l RDF has some vocabulary to describe collec3ons of things and make statements about them l E.g.,

Topics•  BasicconceptsofRDF

•  Resources,proper3es,values,statements,triples•  URIsandURIrefs•  RDFgraphs•  Literals,qnames

•  Vocabulariesandmodeling•  Vocabularies•  Blanknodes,datamodeling,types,reifica3on•  Lists,bags,collec3ons

•  Serializa3onofRDFgraphs•  XML,Turtle,Ntriples

•  Cri3queofRDF