内容分析教案semantic web tutorial_第1页
内容分析教案semantic web tutorial_第2页
内容分析教案semantic web tutorial_第3页
内容分析教案semantic web tutorial_第4页
内容分析教案semantic web tutorial_第5页
已阅读5页,还剩206页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

IntroductiontotheSemanticWeb

(tutorial)

LiangHong

hong@Introduction1.Introduction2.TheBasis:RDF/RDFSchema3.HowtogetRDFData4.LinkingData5.QueryRDFData6.Ontologies(OWL)7.ConclusionsLet’sorganizeatriptoBudapestfromAmsterdamusingtheWeb!Youtrytofindaproperflightwith……abig,reputableairline,or……theairlineofthetargetcountry,or……oralowcostoneYouhavetofindahotel,soyoulookfor……areallycheapaccommodation,or……orareallyluxuriousone,or……anintermediateone…oops,thatisnogood,thepageisinHungarianthatalmostnobodyunderstands,but……thisonecouldworkOfcourse,youcoulddecidetotrustaspecializedsite……likethisone,or……orthisoneYoumaywanttoknowsomethingaboutBudapest;lookforsomephotographs……onflickr……onGoogle……oryoucanlookatmine…ora(social)travelsiteWhathappenedhere?Youhadtoconsultalargenumberofsites,alldifferentinstyle,purpose,possiblylanguage…YouhadtomentallyintegrateallthoseinformationtoachieveyourgoalsWeallknowthat,sometimes,thisisalongandtediousprocess!Allthosepagesareonlytipsofrespectiveicebergs:therealdataishiddensomewhereindatabases,XMLfiles,Excelsheets,

…youhaveonlyaccesstowhattheWebpagedesignersallowyoutoseeSpecializedsites(Expedia,TripAdvisor)doabitmore:theygatherandcombinedatafromothersources(usuallywiththeapprovalofthedataowners)buttheystillcontrolhowyouseethosesourcesButsometimesyouwanttopersonalize:accesstheoriginaldataandcombineityourself!Hereisanotherexample…Anotherexample:socialsites.Ihavealistof“friends”by……Dopplr,…Twine,…LinkedIn,…and,ofcourse,FacebookIhadtotypeinandconnectwithfriendsagainandagainforeachsiteindependentlyThisisevenworsethenbefore:Ifeedtheicebergs,butIstilldonothaveaneasyaccesstodata…Putitanotherway…WewouldliketoextendthecurrentWebtoa“Webofdata”:allowforapplicationstoexploitthedatadirectlyWhatwouldweliketohave?UsethedataontheWebthesamewayaswedowithdocuments:beabletolinktodata(independentlyoftheirpresentation)usethatdatathewayIwant(presentit,mineit,etc)agents,programs,scripts,etc,shouldbeabletointerpretpartofthatdataButwait!Isn’twhatmashupsitesarealreadydoing?A“mashup”example:Insomeways,yes,andthatshowsthehugepowerofwhatsuchWebofdataprovidesButmashupsitesareforcedtodoveryad-hocjobsvariousdatasourcesexposetheirdataviaWebServiceseachwithadifferentAPI,adifferentlogic,differentstructurethesesitesareforcedtoreinventthewheelmanytimesbecausethereisnostandardwayofdoingthingsAnotherExample--FreebaseAFreebasegraphisanentitygraphofpeople,placesandthings,builtbyacommunitythatlovesopendata.Examples:“Findingallactornameswhowerebornin1950”?ItishardtogetanswerstothisqueryinWiki,sinceWikiisnotstructural-data.ThedatainFreebaseisstructured(inSematicWebDatamodel),whichcanbeassesseddirectly.AnotherExample—UsingFreebaseinWSJPutitanotherway(again)…WewouldliketoextendthecurrentWebtoastandardwayfora“Webofdata”Butwhatdoesthismean?Whatmakesthecurrent(document)Webwork?peoplecreatedifferentdocumentstheygiveanaddresstoit(ie,aURI)andmakeitaccessibletoothersontheWebSteven’ssiteonAmsterdam

(doneforsomevisitingfriends)Thensomemagichappens…OthersdiscoverthesiteandtheylinktoitThemoretheylinktoit,themoreimportantandwellknownthepagebecomesremember,thisiswhat,eg,Googleexploits!Thisisthe“Networkeffect”:somepagesbecomeimportant,andothersbegintorelyoniteveniftheauthordidnotexpectit…Thiscouldbeexpected…butthisone,fromtheothersideoftheGlobe,wasnot…WhatwouldthatmeanforaWebofData?Lessonslearned:weshouldbeableto:“publish”thedatatomakeitknownontheWebstandardwaysshouldbeusedinsteadofad-hocapproachestheanalogousapproachtodocuments:giveURI-stothedatamakeitpossibleto“link”tothatURIfromothersourcesofdata(notonlyWebpages)ie,applicationsshouldnotbeforcedtomaketargeteddevelopmentstoaccessthedatageneric,standardapproachesshouldsufficeandletthenetworkeffectworkitsway…ButitisalittlebitmorecomplicatedOnthetraditionalWeb,humansareimplicitlytakenintoaccountAWeblinkhasa“context”thatapersonmayuseEg:addressfieldonmypage:…leadingtothispageAhumanunderstandsthatthisismyinstitution’shomepageHe/sheknowswhatitmeans(realizesthatitisaresearchinstituteinAmsterdam)OnaWebofData,somethingismissing;machinescan’tmakesenseofthelinkaloneNewlessonlearned:extrainformation(“label”)mustbeaddedtoalink:“thislinkstomyinstitution,whichisaresearchinstitute”thisinformationshouldbemachinereadablethisisacharacterization(or“classification”)ofboththelinkanditstargetinsomecases,theclassificationshouldallowforsomelimited“reasoning”LetusputittogetherWhatweneedforaWebofData:useURI-stopublishdata,notonlyfulldocumentsallowthedatatolinktootherdatacharacterize/classifythedataandthelinks(the“terms”)toconveysomeextrameaningandusestandardsforallthese!现有的Web存在的问题:1.高匹配,低精度2.检索词对于词汇高度敏感3.检索的结果是单一的网页解决的途径:1.人工智能+计算语言学2.语义网SowhatistheSemanticWeb?Itis,essentially,theWebofData.

“SemanticWebTechnologies”isacollectionofstandardtechnologiestorealizeaWebofDataItisthatsimple…Ofcourse,thedevilisinthedetailsacommonmodelhastobeprovidedformachinestodescribe,query,etc,thedataandtheirconnectionsthe“classification”ofthetermscanbecomeverycomplexforspecificknowledgeareas:thisiswhereontologies,thesauri,etc,enterthegame…Inwhatfollows…WewilluseasimplisticexampletointroducethemaintechnicalconceptsThedetailswillbeforlaterduringthecourseTheroughstructureofdataintegrationMapthevariousdataontoanabstractdatarepresentationmakethedataindependentofitsinternalrepresentation…MergetheresultingrepresentationsStartmakingqueriesonthewhole!queriesthatcouldnothavebeendoneontheindividualdatasetsAsimplifiedbookstoredata(dataset“A”)1st:exportyourdataasasetofrelationsSomenotesontheexportingthedataRelationsformagraphthenodesrefertothe“real”dataorcontainsomeliteralhowthegraphisrepresentedinmachineisimmaterialfornowDataexportdoesnotnecessarilymeanphysicalconversionofthedatarelationscanbegeneratedon-the-flyatquerytimeviaSQL“bridges”scrapingHTMLpagesextractingdatafromExcelsheetsetc.OnecanexportpartofthedataAnotherbookstoredata(dataset“F”)2nd:exportyoursecondsetofdata3rd:startmergingyourdata3rd:startmergingyourdata(cont.)3rd:mergeidenticalresourcesStartmakingqueries…Userofdata“F”cannowaskquerieslike:“givemethetitleoftheoriginal”Thisinformationisnotinthedataset“F”……butcanberetrievedbymergingwithdataset“A”!However,morecanbeachieved…We“feel”thata:authorandf:auteurshouldbethesameButanautomaticmergedoestnotknowthat!Letusaddsomeextrainformationtothemergeddata:a:authorsameasf:auteurbothidentifya“Person”atermthatacommunitymayhavealreadydefined:a“Person”isuniquelyidentifiedbyhis/hernameand,say,homepageitcanbeusedasa“category”forcertaintypeofresources3rdrevisited:usetheextraknowledgeStartmakingricherqueries!Userofdataset“F”cannowquery:well…“givemethehomepageoftheoriginal’s‘auteur’”Theinformationisnotindatasets“F”or“A”……butwasmadeavailableby:mergingdatasets“A”anddatasets“F”addingthreesimpleextrastatementsasanextra“glue”CombinewithdifferentdatasetsUsing,e.g.,the“Person”,thedatasetcanbecombinedwithothersourcesForexample,datainWikipediacanbeextractedusingdedicatedtoolse.g.,the“dbpedia”projectcanextractthe“infobox”informationfromWikipediaalready…MergewithWikipediadataMergewithWikipediadataMergewithWikipediadataIsthatsurprising?Itmaylooklikeitbut,infact,itshouldnotbe…WhathappenedviaautomaticmeansisdoneeverydaybyWebusers!Thedifference:abitofextrarigoursothatmachinescoulddothis,tooWhatdidwedo?Wecombineddifferentdatasetsthataresomewhereonthewebareofdifferentformats(mysql,excelsheet,XHTML,etc)havedifferentnamesforrelationsWecouldcombinethedatabecausesomeURI-swereidentical(theISBN-sinthiscase)Wecouldaddsomesimpleadditionalinformation(the“glue”),possiblyusingcommonterminologiesthatacommunityhasproducedAsaresult,newrelationscouldbefoundandretrievedItcouldbecomeevenmorepowerfulWecouldaddextraknowledgetothemergeddatasetse.g.,afullclassificationofvarioustypesoflibrarydatageographicalinformationetc.Thisiswhereontologies,extrarules,etc,comeinontologies/rulesetscanberelativelysimpleandsmall,orhuge,oranythinginbetween…EvenmorepowerfulqueriescanbeaskedasaresultWhatdidwedo?(cont)TheBasis:RDF

ResourceDescriptionFrameworkRDFtriplesLetusbegintoformalizewhatwedid!we“connected”thedata…butasimpleconnectionisnotenough…datashouldbenamedsomehowhencetheRDFTriples:alabelledconnectionbetweentworesourcesRDFtriples(cont.)AnRDFTriple(s,p,o)issuchthat:“s”,“p”areURI-s(UniformResourceIdentifier),ie,resourcesontheWeb;“o”isaURIoraliteral“s”,“p”,and“o”standfor“subject”,“property”,and“object”hereisthecompletetriple:RDFisageneralmodelforsuchtriples(withmachinereadableformatslikeRDF/XML,Turtle,N3,RXR,…)

(<http://…isbn…6682>,<http://…/original>,<http://…isbn…409X>)RDFtriples(cont.)ResourcescanuseanyURI,e.g.:(home)

(//q[@a=b])URI-scanalsodenotenonWebentities:ismenotmyhomepage,notmypublicationlist,butmeRDFtriplesformadirected,labelledgraphAsimpleRDFexample(inRDF/XML)<rdf:Descriptionrdf:about="http://…/isbn/2020386682"><f:titrexml:lang="fr">Lepalaisdesmirroirs</f:titre><f:originalrdf:resource="http://…/isbn/000651409X"/></rdf:Description>(Note:namespacesareusedtosimplifytheURI-s)AsimpleRDFexample(inTurtle)<http://…/isbn/2020386682>f:titre"Lepalaisdesmirroirs"@fr;f:original<http://…/isbn/000651409X>.RDF的基本概念资源Resource:可以将资源视为一个对象,也就是所要谈论到的“事物”。资源用URI来标识!属性Property:属性是一类特殊的资源,描述资源之间的关系。属性也是由URI来标识,这样使得用户有了一个全球通用的唯一命名系统。

Example:FOAF称述Statement:称述用于描述资源所具有的属性。一个称述由一个“<S,P,O>”的三元组来标识。“Internal”nodesConsiderthefollowingstatement:“thepublisherisa«thing»thathasanameandanaddress”Untilnow,nodeswereidentifiedwithaURI.But……whatistheURIof«thing»?Internalidentifier(“blanknodes”)SyntaxisserializationdependentA234isinvisiblefromoutside(itisnota“real”URI!);itisaninternalidentifierforaresource<rdf:Descriptionrdf:about="http://…/isbn/000651409X"><a:publisherrdf:nodeID="A234"/></rdf:Description><rdf:Descriptionrdf:nodeID="A234"><a:p_name>HarpersCollins</a:p_name><a:city>HarpersCollins</a:city></rdf:Description><http://…/isbn/2020386682>a:publisher_:A234._:A234a:p_name"HarpersCollins".Blanknodes:thesystemcanalsodoitLetthesystemcreatea“nodeID”internally(youdonotreallycareaboutthename…)<rdf:Descriptionrdf:about="http://…/isbn/000651409X"><a:publisher><rdf:Description><a:p_name>HarpersCollins</a:p_name>…</rdf:Description></a:publisher></rdf:Description>SameinTurtle<http://…/isbn/000651409X>a:publisher[a:p_name"HarpersCollins";…].Blanknodes:somemoreremarksBlanknodesrequireattentionwhenmergingblanksnodeswithidenticalnodeID-sindifferentgraphsaredifferentimplementationsmustbecareful…ManyapplicationsprefernottouseblanknodesanddefinenewURI-s“on-the-fly”RDFinprogrammingpracticeForexample,usingJava+Jena(HP’sBristolLab):a“Model”objectiscreatedtheRDFfileisparsedandresultsstoredintheModeltheModeloffersmethodstoretrieve:triples(property,object)pairsforaspecificsubject(subject,property)pairsforspecificobjectetc.therestisconventionalprogramming…SimilartoolsexistinPython,PHP,etc.Jenaexample//createamodelModelmodel=newModelMem();Resourcesubject=model.createResource("URI_of_Subject")//'in'referstotheinputfilemodel.read(newInputStreamReader(in));StmtIteratoriter=model.listStatements(subject,null,null);while(iter.hasNext()){st=iter.next();p=st.getProperty();o=st.getObject();do_something(p,o);}MergeinpracticeEnvironmentsmergegraphsautomaticallye.g.,inJena,theModelcanloadseveralfilestheloadmergesthenewstatementsautomaticallyIntegrateknowledgeforChineseMedicineIntegrationofalargenumberofTCMdatabasesaround80databases,around200,000recordseachFormbasedqueryinterfaceforendusersCourtesyofHuajunChen,ZhejiangUniversity,(SWEOCaseStudy)IntegrateknowledgeforChineseMedicineOnelevelhigherup

(RDFS,Datatypes)NeedforRDFschemasFirststeptowardsthe“extraknowledge”:definethetermswecanusewhatrestrictionsapplywhatextrarelationshipsarethere?Officially:“RDFVocabularyDescriptionLanguage”theterm“Schema”isretainedforhistoricalreasons…Classes,resources,…Thinkofwellknowntraditionalontologiesortaxonomies:usetheterm“novel”“everynovelisafiction”“«TheGlassPalace»isanovel”etc.RDFSdefinesresourcesandclasses:everythinginRDFisa“resource”“classes”arealsoresources,but……theyarealsoacollectionofpossibleresources(i.e.,“individuals”)“fiction”,“novel”,…Classes,resources,…(cont.)Relationshipsaredefinedamongclassesandresources:“typing”:anindividualbelongstoaspecificclass“«TheGlassPalace»isanovel”tobemoreprecise:“«»isanovel”“subclassing”:allinstancesofonearealsotheinstancesoftheother(“everynovelisafiction”)RDFSformalizesthesenotionsinRDFClasses,resourcesinRDF(S)RDFSdefinesthemeaningoftheseterms(theseareallspecialURI-s,wejustusethenamespaceabbreviation)SchemaexampleinRDF/XMLTheschemapart:<rdf:Descriptionrdf:ID="Novel"><rdf:typerdf:resource=""/></rdf:Description>TheRDFdataonaspecificnovel:<rdf:Descriptionrdf:about="http://…/isbn/000651409X"><rdf:typerdf:resource="http://…/bookSchema.rdf#Novel"/></rdf:Description>FurtherremarksontypesAresourcemaybelongtoseveralclassesrdf:typeisjustaproperty…“«TheGlassPalace»isanovel,but«TheGlassPalace»isalsoan«inventoryitem»…”i.e.,itisnotlikeadatatype!Thetypeinformationmaybeveryimportantforapplicationse.g.,itmaybeusedforacategorizationofpossiblenodesprobablythemostfrequentlyusedRDFproperty…(rememberthe“Person”inourexample?)InferredpropertiesisnotintheoriginalRDFdata……butcanbeinferredfromtheRDFSrulesRDFSenvironmentsreturnthattriple,too (<http://…/isbn/000651409X>rdf:type#Fiction)Inference:letusbeformal…TheRDFSemanticsdocumenthasalistof(33)entailmentrules:“ifsuchandsuchtriplesareinthegraph,addthisandthis”dothatrecursivelyuntilthegraphdoesnotchangeTherelevantruleforourexample:If:uuurdfs:subClassOfxxx.vvvrdf:typeuuu.Thenadd:vvvrdf:typexxx.PropertiesPropertyisaspecialclass(rdf:Property)propertiesarealsoresourcesidentifiedbyURI-sThereisalsoapossibilityfora“sub-property”allresourcesboundbythe“sub”arealsoboundbytheotherRangeanddomainofpropertiescanbespecifiedi.e.,whattypeofresourcesserveasobjectandsubjectPropertyspecificationserializedInRDF/XML:<rdf:Propertyrdf:ID="title"><rdfs:domainrdf:resource="#Fiction"/><rdfs:rangerdf:resource=""/></rdf:Property>InTurtle::titlerdf:typerdf:Property;rdfs:domain:Fiction;rdfs:rangerdfs:Literal.Whatdoesthismean?Again,newrelationscanbededuced.Indeed,if:titlerdf:typerdf:Property;rdfs:domain:Fiction;rdfs:rangerdfs:Literal.<http://…/isbn/000651409X>:title"TheGlassPalace".thenthesystemcaninferthat:<http://…/isbn/000651409X>rdf:type:Fiction.LiteralsLiteralsmayhaveadatatypefloats,integers,booleans,etc,definedinXMLSchemasfullXMLfragments(Natural)languagecanalsobespecifiedExamplesfordatatypes<http://…/isbn/000651409X>:page_number"543"^^xsd:integer;:publ_date"2000"^^xsd:gYear;:price"6.99"^^xsd:float.AbitofRDFScantakeyoufar…Rememberthepowerofmerge?Wecouldhaveused,inourexample:f:auteurisasubpropertyofa:authorandviceversa

(althoughwewillseeotherwaystodothat…)Ofcourse,insomecases,morecomplexknowledgeisnecessary(seelater…)RDFSchema核心类:rdfs:Resource,所有资源的类rdfs:Class,所有类的类rdfs:Literal,所有文字(字符串)的类rdfs:Property,所有属性的类rdf:Statement,所有具体化称述的类RDFSchema1)用于定义关系的核心属性:rdf:type,把一个资源和它的所属的类联系起来rdfs:subClassOf,把一个类和它的父类联系起来rdfs:subPropertyOf,把一个属性和它的一个父亲属性联系起来2)用于定义关系的核心属性:rdfs:domain,限定属性P的定义域rdf:range,限定属性P的值域例子<rdfs:Classrdf:about=“授课者”><rdfs:subClassOfrdf:resouce=“教工”/></rdfs:Class><rdf:Propertyrdf:ID=“电话号码”><rdfs:domainrdf:resouce=“#教工”/><rdfs:rangerdf:resouce=“&rdf;Literal”/></rdf:Property>Univ.ofPlymouth’sresourcemanagementCourtesyofChrisClarke,Talis,andFionaGreig,UniversityofPlymouth(SWEOCaseStudy)Managesteachingmaterialsforstudents(includinginstructorannotations,bookmarks,A/V,…)quicklyadaptstochanges(eg,librarysubscriptions)usessimple(public)vocabulariestobinddatalinkstoexternaldatasetsHowtogetRDFData?

(Microformats,GRDDL,RDFa)SimpleapproachWriteRDF/XMLorTurtle“manually”Insomecasesthatisnecessary,butitreallydoesnotscale…RDFwithXHTMLObviously,ahugesourceofinformationByaddingsome“meta”information,thesamesourcecanbereusedfor,eg,dataintegration,bettermashups,etctypicalexample:yourpersonalinformation,likeaddress,shouldbereadableforhumansandprocessablebymachinesTwosolutionshaveemerged:extractthestructurefromthepageandconvertthecontentintoRDFaddRDFstatementsdirectlyintoXHTMLviaRDFaExtractRDFUseintelligent“scrapers”or“wrappers”toextractastructure(henceRDF)fromaWebpagesorXMLfiles……andthengenerateRDFautomatically(e.g.,viaanXSLTscript)119InformationExtraction(IE):TexttoRecordsMaxPlanck4/23,1858KielAlbertEinstein3/14,1879UlmMahatmaGandhi10/2,1869PorbandarPersonBirthDateBirthPlace...PersonScientificResultMaxPlanckQuantumTheoryPersonCollaboratorMaxPlanckAlbertEinsteinMaxPlanckNielsBohrPlanck‘sconstant6.2261023JsConstantValueDimensioncombineNLP,patternmatching,lexicons,statisticallearningextractedfactsoftenhaveconfidence<1DBwithuncertainty(probabilisticDB)expensiveanderror-proneFormalizingthescraperapproach:GRDDLGRDDLformalizesthescraperapproach.Forexample:<htmlxmlns=""><headprofile=""><title>SomeDocument</title><linkrel="transformation"href="http:…/dc-extract.xsl"/><metaname="DC.Subject"content="Somesubject"/>...</head>...<spanclass="date">2006-01-02</span>...</html>yields,throughdc-extract.xsl:<>dc:subject"Somesubject";dc:date"2006-01-02".GRDDLThetransformationitselfhastobeprovidedforeachsetofconventionsAmoregeneralsyntaxisdefinedforXMLformatsingeneral(e.g.,viathenamespacedocument)amethodtogetdatainotherformatstoRDF(e.g.,XBRL)Examplefor“structure”:microformatsNotaSemanticWebspecification,originallythereisaseparatemicroformatcommunityApproach:re-use(X)HTMLattributesandelementstoadd“meta”informationtypically@abbr,@class,@title,…differentcommunityagreementsfordifferentapplicationsRDFaRDFaextends(X)HTMLabitby:defininggeneralattributestoaddmetadatatoanyelementsprovidesanalmostcomplete“serialization”ofRDFinXHTMLRDFaexampleForexample:<divabout=""><spanproperty="dc:date">March23,2004</span><spanproperty="dc:title">Rollershitcasinofor£1.3m</span>By<spanproperty="dc:creator">SteveBird</span>.See<ahref=""rel="dcmtype:MovingImage">alsovideofootage</a>…</div>yields,throughanRDFaprocessor:<>dc:date"March23,2004";dc:title"Rollershitcasinofor£1.3m;dc:creator"SteveBird";dcmtype:MovingImage<>.Example:Yahoo’sSearchMonkeySearchbasedresultsmaybecustomizedviasmallapplicationsMetadatainpages(inRDFa,microformatsetc)arereusedCourtesyofPeterMika,Yahoo!Research,(SWEOCaseStudy)Example:Google’srichsnipletEmbeddedmetadata(inmicroformatorRDFa)isusedtoimprovesearchresultpageatthemomentonlyafewvocabulariesarerecognized,butthatwillevolveovertheyearsExample:RDFadatabythe

LondonGazetteExample:RDFadatabythe

LondonGazetteBridgetorelationaldatabasesDataontheWebaremostlystoredindatabases“Bridges”arebeingdefined:alayerbetweenRDFandtherelationaldataRDBtablesare“mapped”toRDFgraphs,possiblyontheflydifferentmappingapproachesarebeingusedanumberRDBsystemsofferthisfacilityalready(eg,Oracle,OpenLink,…)AsurveyonmappingtechniqueshasbeenpublishedatW3CAcharterisunderreviewforaW3Cgroup,tostartinSeptemberLinkingDataLinkingOpenDataProjectGoal:“expose”opendatasetsinRDFSetRDFlinksamongthedataitemsfromdifferentdatasetsSetupqueryendpointsAltogetherbillionsoftriples,millionsoflinks…Exampledatasource:DBpediaDBpediaisacommunityefforttoextractstructured(“infobox”)informationfromWikipediaprovideaqueryendpointtothedatasetinterlinktheDBpediadatasetwithotherdatasetsontheWebExtractingWikipediastructureddata@prefixdbpedia<>.@prefixdbterm<>.dbpedia:Amsterdam

dbterm:officialName“Amsterdam”;

dbterm:longd“4”;dbterm:longm“53”;dbterm:longs“32”;...

dbterm:leaderTitle“Mayor”;

dbterm:leaderNamedbpedia:Job_Cohen;...dbterm:areaTotalKm“219”;...dbpedia:ABN_AMROdbterm:locationdbpedia:Amsterdam;...Automaticlinksamongopendatasets<Amsterdam>

owl:sameAs<...>;owl:sameAs<>;...<>owl:sameAs<Amsterdam>wgs84_pos:lat“52.3666667”;wgs84_pos:long“4.8833333”;geo:inCountry<>;...Processorscanswitchautomaticallyfromonetotheother…TheLOD“cloud”,March2008TheLOD“cloud”,September2008TheLOD“cloud”,July2009TheLOD“cloud”,Sep.2011

31billionRDFtriplesUsingtheLODtobuildWebsite:BBCUsingtheLODtobuildWebsite:BBCUsingtheLODtobuildWebsite:BBCQueryRDFData

(SPARQL)RDFdataaccessHowdoIquerytheRDFdata?e.g.,howdoIgettotheDBpediadata?QueryingRDFgraphsRemembertheJenaidiom:StmtIteratoriter=model.listStatements(subject,null,null);while(iter.hasNext()){st=iter.next();p=st.getProperty();o=st.getObject();do_something(p,o);Inpractice,morecomplexqueriesintotheRDFdataarenecessarysomethinglike:“givemethe(a,b)pairofresources,forwhichthereisanxsuchthat(xparenta)and(bbrotherx)holds”(ie,returntheuncles)theserulesmaybecomequitecomplexThegoalofSPARQL(QueryLanguageforRDF)AnalysetheJenaexampleStmtIteratoriter=model.listStatements(subject,null,null);while(iter.hasNext()){st=iter.next();p=st.getProperty();o=st.getObject();do_something(p,o);The(subject,?p,?o)isapatternforwhatwearelookingfor(with?pand?oas“unknowns”)General:graphpatternsThefundamentalidea:usegraphpatternsthepatterncontainsunboundsymbolsbybindingthesymbols,subgraphsoftheRDFgraphareselectedifthereissuchaselection,thequeryreturnsboundresourcesOurJenaexampleinSPARQLSELECT?p?oWHERE{subject?p?o}ThetriplesinWHEREdefinethegraphpattern,with?pand?o“unbound”symbolsThequeryreturnsallp,opairsSimpleSPARQLexampleSELECT?isbn?price?currency#note:not?x!WHERE{?isbna:price?x.?xrdf:value?price.?xp:currency?currency.}SimpleSPARQLexampleReturns:

[[<..49X>,33,£],[<..49X>,50,€],[<..6682>,60,€],[<..6682>,78,$]]SELECT?isbn?price?currency#note:not?x!WHERE{?isbna:price?x.?xrdf:value?price.?xp:currency?currency.}PatternconstraintsSELECT?isbn?price?currency#note:not?x!WHERE{?isbna:price?x.?xrdf:value?price.?xp:currency?currency.FILTER(?currency==€}Returns:[[<..409X>,50,€],[<..6682>,60,€]]RDFDataModel151URIURILiteralsRDFGraph152EntityVertexLiteralVertexSPARQLQueries153SPARQLQuery:Select?nameWhere{?m<hasName>?name.?m<BornOnDate>“1809-02-12”.?m<DiedOnDate>“1865-04-15”.}QueryGraphSubgraphMatchvs.SPARQLQueries154OtherSPARQLfeaturesLimitthenumberofreturnedresults;removeduplicates,sortthem,…OptionalbranchesinthequerySpecifyseveraldatasources(viaURI-s)withinthequery(essentially,amerge!)ConstructagraphcombiningaseparatepatternandthequeryresultsUsedatatypesand/orlanguagetagswhenmatchingapatternSPARQLusageinpracticeSPARQLisusuallyusedoverthenetworkseparatedocumentsdefinetheprotocolandtheresultformatSPARQLProtocolforRDFwithHTTPandSOAPbindingsSPARQLresultsinXMLorJSONformatsBigdatasetsusuallyoffer“SP

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论