Introduction to RDF and RDFS

cs.um.edu.mt
  • No tags were found...

Introduction to RDF and RDFS

Introduction to RDF and RDFSCharlie Abelacharlie.abela@um.edu.mt


2 Lecture Outline• Introduction to RDF– Basic building blocks: resources– Different notations for RDF• Triples• Graphs• RDF/XML– Exercise• RDFS: compliments RDF– Exercise


3 Moving up the layers


4 Scenario• Jim’s searching experience over the Web is notbrilliant• It gets really frustrating at times when he needsto find relevant informationAARRRGGHH….


5 Scenario (2)• Jim’s colleague Johnhas recently startedusing an applicationcalled PEA (PersonalAssistant)• PEA can learn aboutthe user’s interests andis able to help out Johnin many tasks.• During its learningprocess PEA implicitlygathers informationabout John’s interests•John is interested inmusic•John keeps afavourites’ list of songtitles


7 Scenario (4)"Mr.Dynamite"http://www.w3.org/2001/vcard-rdf/3.0#nicknamehttp://www.singerInfo.com/singers#singerhttp://www.w3.org/1999/02/22-rdf-syntax-ns#typehttp://www.favsongs.com/singers#sngr005http://www.w3.org/2001/vcard-rdf/3.0#name"James Brown"http://www.singerInfo.com/singers#interpretshttp://www.songInfo.com/songs#songhttp://www.w3.org/1999/02/22-rdf-syntax-ns#typehttp://www.favsongs.com/singers#sng023http://www.songInfo.org/songs#titlehttp://www.songInfo.com/songs#video"I Feel Good"http://www.songInfo.com/songs#lyricsurlhttp://www.youtube.com/watch?v=IWcNiebYGuohttp://www.funky-stuff.com/jamesbrown/Lyrics/IFeelGood.htm


8 RDF Introduction• Resource Description Framework is a language whose mainintent is to provide a common framework for expressingmachine-processable information• Through RDF it is possible to represent both physicallyaccessible entities, as well as abstract entities (i.e. those thatcannot be retrieved)– physical entity: a person’s Web page– abstract entity: the resource pointing to information about theperson himself• It also facilitates information exchange between differentapplications


9 RDF: The Basics• Basic building block: triple– It is called a statement– Sentence:• “Dan Brown is the author of the Da Vinci Code” is such astatement– Subject: Dan Brown– Predicate: authorOf– Object: Da Vinci Code• RDF has been given an XML syntax– This syntax inherits the benefits of XML


10 RDF: The Basics (2)• The fundamental components of RDF are:– Resources: anything defined through a URI• http://www.category.com/authors#Dan_Brown– Properties: resources that describe a relation• books:authorOf (authorOf relation defined in booksdomain)• essentially binary relations– Statements: assign a value to a property associated with aspecific resource•


11 Resources• We can think of a resource as an object, a“thing” we want to talk about (i.e. has anidentity)– E.g. authors, books, publishers, places, people• Every resource (physical or abstract) has aURI, a Universal Resource Identifier• A URI can be– a URL (Web address)• http://www.bookresource.com/pub/books.html– some other kind of unique identifier• #book102 (references a unique book resource)


12 Properties• Properties are special kinds of resources• They describe relations betweenresources– E.g. “written_by”, “age”, “title”, etc.• Properties are also identified by URIs– authorOf relation used in association with abook resourceDa_Vinci_Code


13 Statements• RDF statements assert the properties ofresources• Values can be resources or literals– Literals are atomic values (strings)• Three views of an RDF statement– as a triple– as a directed graph– as RDF/XML serialisation


14 Example: As a Triplesubject resource property resource object value• The triple (x,P,y) can be considered as alogical formula P(x,y)– Binary predicate P relates object x to object y– RDF offers only binary predicates (properties)– Any n-ary relation in RDF has to be convertedinto a set of binary relations


15 Example: As a Graph• A directed graph with labeled nodes and arcs– from the resource (the subject of the statement)– to the value (the object of the statement)• Known in AI as a semantic nethttp://www.bookstore.com/books#auth1102#auth1102http://www.authorsInfo.com/authors#namehttp://www.booksInfo.com/books#authorOf"Dan Brown""Da Vinci Code"


16 RDF/XML• An RDF document is represented by anXML element with the tag rdf:RDF• The content of this element is a number ofdescriptions, which use rdf:Descriptiontags.• Every description makes a statement abouta resource, usually identified in 2 ways:– an about attribute, referencing an existingdescription– an ID attribute, creating a new description


17 RDF/XML (2)• The rdf:Description element makes astatement about the resource auth1102• Within the description– the property is used as a tag– the content is the value of the propertyDan Brownpropertyvalue


18 Example: RDF/XMLQNameDan BrownDa_Vinci_Code


19 Concise representation]>


20 XML Schema data types• In RDF, typed literals can be used– Usually through the use of XML Schema• In which case the XML Schemanamespace has to be declared in thenamespace blockDan Brown22/06/1964


21 Using rdf:type• Declare a statement which formally defines adescriptionDanBrown22/06/1964• Declares auth1102 to be of type author(itself defined in the authors vocabulary)


22 Bookstore.rdfDa VinciCode978-0385504201Dan Brown22/06/1964


23 XML Vs RDF978-0385504201XMLRDF/XMLDa Vinci Code978-0385504201Dan Brown


24 XML vs RDF IIbookIDbook102authortitleISBNIDnamename978-0385504201auth1102Dan BrownDa Vinci Code


25 XML vs RDF IIIDa Vinci Codehttp://www.booksInfo.com/books#titlehttp://www.bookstore.com/books#book102http://www.booksInfo.com/books#ISBNhttp://www.authorsInfo.org/authors#authorOf978-0385504201http://www.bookstore.com/books#auth1102http://www.authorsInfo.org/authors#dobhttp://www.w3.org/1999/02/22-rdf-syntax-ns#typehttp://www.authorsInfo.org/authors#name22/06/64authors:authorDan Brown


26 Container Elements• Collections of resources or attributes canbe defined within a container element.• RDF provides three types of containers:– rdf:Bag an unordered container, may containmultiple occurrences– rdf:Seq an order container, may containmultiple occurrences– rdf:Alt a set of alternatives


27 Container Elements: Bag• Dan Brown is the author of three books(defined elsewhere), order of publication isnot importantDan Brown


28 Container Elements: Seq• However if its needed to specify thatauthorOf specifies ordering information(e.g. based on publication dates)Dan Brown


29 Container Elements: Alt• Alt implies a list of alternatives from whichonly one can be chosenDa Vinci Code978-0385504201engdocmtdoc


30 Closed container• If we need to specify that the listed resources areALL the members of the container we need touse the List structure


31 Closed collection• A shorthand syntax for a closed collectionexistsDan Brown


32 Describing Bookmarks12/12/07news + googleGoogle NewsNewsrdf:nodeID is used to indicate an anonymous node


33Describing a Processlsassexesystem325.1.2600.2180MicrosoftCorporation


34 Exercises• Write the following statements in RDF and draw the associatedgraphs (use any required namespaces)– The library is located in Bremen– The book with title “Artificial Intelligence” and ISBN 978-123458 iswritten by the author Henry Wise– The author William Start wrote the books with titles “Modern WebServices” and “Theory of Computation”– The email address of lecturer John Brown is john.brown@widget.org– Lecturer John Brown has an office in the Department of AI. Theoffice is situated on the 2 nd floor of the Computer Building.• Write RDF statements about a catalogue of products.– Each catalogue has an ID and a description and consists of a list ofproducts– Each product is associated with a department and has a product IDand a description– Multiple products may be associated with the same department


35RDFS


36RDF/XML Definitions/GraphView• The library is located in BremenBremen


37 Graph View•The book with title “Artificial Intelligence” and ISBN 978-123458is written by the author Henry Wise


38 RDF/XML Definitions II• The book with title “Artificial Intelligence” and ISBN978-123458 is written by the author Henry WiseArtificial IntelligenceISBN 978123478Henry Wise


39 Graph View•The author William Start wrote the books with titles “Modern WebServices” and “Theory of Computation”


40 RDF/XML Definition• The author William Start wrote the bookswith titles “Modern Web Services” and“Theory of Computation”William Start


41 Moving up the layers


42 RDF Schema• Consider the following XMLDan BrownJohn NewsJohn Davies • Though XML is correct, it is semanticallyunsatisfactory (John News, John Davies andDan Brown are types of authors)• Need to be able to define something of thissort:– journalists and magazine contributors are allauthors– authors are writers


43 RDF Schema II• RDF makes no assumptions about any specificdomain, nor does it define the semantics of such adomain• To define the terminology related to any domain aschema language such as RDF Schema can beused• Relation between RDF and RDF Schema is not thesame as that between XML and XML Schema– XML schema constraints the structure of XML documents– RDFS defines the vocabulary used within an RDF datamodel– through RDFS its possible to• specify the properties that can be applied to an object• specify the values that such properties can take• declare relationships between objects


44 RDF Schema III• The user can describe any particular domain using:– Classes and Properties: differentiate between individualobjects (or instances) and classes of object• author: Dan Brown and class of authors• restrict properties to apply to certain things– Only authors can contribute to certain magazines i.e. restrict thedomain of contributors to a magazine as ranging only over authors– Class Hierarchies and Inheritance• Classes of authors, writers, journalists, reporters, editors etc– authors, journalists and reporters are all writers (journalist is asubclass of writer)– Property Hierarchies• E.g. the property “authorOf” is a subproperty of “contributesTo”• However the converse may not necessarily be always true


45 Core Classes• rdfs:Resource, the class of allresources• rdfs:Class, the class of all classes• rdfs:Literal, the class of all literals(strings)• rdf:Property, the class of allproperties.Representsprocessesthe class of all


46 Core Properties• rdf:type, which relates a resource to its class– The resource is declared to be an instance of that class• rdfs:subClassOf, which relates a class to one of itssuperclasses– All instances of a class are instances of its superclass• rdfs:subPropertyOf, relates a property to one of itssuperproperties


47 Core Properties (2)• rdfs:domain, which specifies the domain of a property P– The class of those resources that may appear as subjects ina triple with predicate P– If the domain is not specified, then any resource can be thesubject• rdfs:range, which specifies the range of a property P– The class of those resources that may appear as values (ofobjects) in a triple with predicate P


48 ExampleLiteralhas_namehas_nameBookContributorsubClassOfauthorOfsubClassOfhas_editorWritersubClassOfsubClassOfEditorAuthorJournalist


49 RDFS ExampleThe class of books


50 RDFS Example II


51 CompleteExample


52 Instance ExampleSemantic Web PrimerMITGrigoris AntoniouFrank van Harmelen


53 Applications of RDF/S: FOAF• FOAF (Friend of a Friend)• FOAF is a way of providing affiliation and othersocial information about yourself• Also a way of describing a network of friends andothers we know, in such a way that automatedprocesses such as web bots can find thisinformation and incorporate it with other FOAF files• The FOAF-a-matic is a web form and the submittedinformation is used to generate the RDF/XML for aspecific FOAF file and add it to the FOAF network.


54 Foaf Example0b62d4242736e64be6138547c79a811b3e82fd52JimHendlerJim HendlerTetherless World Constellation Chairjhendlergolbeckfinin


55 Photos of People I KnowFOAFPEAJohnFOAFPeterFOAFPersonalisedViewPhotosfrom friends'websites


56 RDF Tools• RDF Store: stores RDF models in relational dbs (persistentstorage)– Jena can be hooked with MySQL, PostgreSQL or Oracledb• RDF validator: validates RDF and presents different views(triples and dg) of result• RDF Editors:– Protégé: http://protege.stanford.edu/– Oiled: http://oiled.man.ac.uk/– SWOOP: http://www.mindswap.org/2004/SWOOP/• RDF visualiser– RDF Viz (visualises graphs)• Search for schemas:– SWOOGLE: http://swoogle.umbc.edu/


57 Further Information• Semantic Web Primer, Chapter 3• RDF Primer, E. Miller– http://www.w3.org/TR/rdf-primer/• RDF tutorial examples– http://www.zvon.org/xxl/RDFTutorial/General/contents.html• The Semantic Web: roles of XML and RDF,Stefan Decker,– http://www.ontoknowledge.org/oil/downl/IEEE00.pdf• Jena RDF tutorial,– http://jena.sourceforge.net/documentation.html


58 Exercisexsd:stringxsd:stringxsd:stringxsd:stringcopyRightYearcopyRightContenthas_phonehas_nameCopyrightsxsd:stringAuthorcopyrightedByhas_titlepublishesPublicationsubClassOfsubClassOfsubClassOfArticleConference_PaperBook• Create an RDFS vocabulary for thisscenario• Create an instance file with an authorthat has published 3 differentpublications. You can add relevantproperties to the basic conceptsISBNxsd:stringpublisherNamexsd:string

More magazines by this user
Similar magazines