240 likes | 340 Vues
Explore the essentials of RDF in Semantic Web, including URI construction, namespaces, datatypes, multiple values, and blank nodes. Enhance your understanding with practical examples and learn to represent real-world objects online effectively.
E N D
Semantic Web Quratulain Rajput Faculty of Computer Science, IBA Spring2013
RDF • To represent web as: “ the web of real world object rather than only web of documents.” Quratulain Rajput
RDF • Construction of URI Scheme:[//authority]path[?query][#fragment] [Note: path and fragment are optional.] http://www.iba.edu.pk/ http://cs.iba.edu.pk/faculty.html#sghani https://www.google.com.pk/search?q=textmining+the+quran&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a Quratulain Rajput
RDF <rdf:Descriptionrdf:about=“http://ww.iba.edu.pk/asif”> <hasAge>40</hasAge> </rdf:Description> <rdf:Descriptionrdf:about=“http://ww.iba.edu.pk/asif”> <writeBook> <rdf:Descriptionrdf:about=“http://www.semantic-web- book.org/”> </rdf:Description> </writeBook> </rdf:Description> Quratulain Rajput
XML namespaces and RDF • Draw for the following description. Quratulain Rajput
RDF Representation • Draw Graphs, are these represent same meaning? Quratulain Rajput
IRI • IRI (International Resource Identifier) is extended URI by allowing non-Latin (Chinese, Urdu, Arabic) characters. Quratulain Rajput
Shorter URI • xmlns can only used with xml tags and with attribute but not as value of attribute (e.g allowed with rdf:about, rdf:resource). • Use of Xml:base with rdf:about <xml version=“1.0“ encoding=“utf-8“> <rdf:RDFxmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#“ xmlns:data=“http://iba.edu.pk/research#“ xml:base=“http://iba.edu.pk/Faculty“> <rdf:Descriptionrdf:about=“#Quratulain“data:teaches=“Semantic Web“> <data:writesWiki rdf:resource=“http://cse661semanticwebspring2013.wikispaces.com/“/> </rdf:Description> </rdf:RDF> Quratulain Rajput
Shorter URI • Use of xml:base with rdf:ID (used only once) <xml version=“1.0“ encoding=“utf-8“> <rdf:RDFxmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#“ xmlns:data=“http://iba.edu.pk/research#“ xml:base=“http://iba.edu.pk/Faculty“> <rdf:Descriptionrdf:ID=“Quratulain“data:teaches=“Semantic Web“> <data:writesWiki rdf:resource=“http://cse661semanticwebspring2013.wikispaces.com/“/> </rdf:Description> </rdf:RDF> Quratulain Rajput
Rdf:Datatypes • RDF describe data values by means of literals. • E.G string, number etc. • Each datatype is uniquely identified by a URI. • RDF use the xml-schema for datatype description. <xml version=“1.0“ encoding=“utf-8“> <rdf:RDFxmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#“ xmlns:course=“http://iba.edu.pk/MS/courses#“ > <rdf:Descriptionrdf:about=“http://iba.edu.pk/MS/CSE661“> <course:Namerdf:datatype=“http://www.w3c.org/2001/XMLSchema#string“> Semantic Web </course:Name> <course:credit rdf:datatype= “http://www.w3c.org/2001/XMLSchema#integer“> 3 </course:credit> </rdf:Description></rdf:RDF> Quratulain Rajput
<xml version=“1.0“ encoding=“utf-8“> <rdf:RDFxmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#“ xmlns:course=“http://iba.edu.pk/MS/course#“ > <rdf:Descriptionrdf:about=“http://iba.edu.pk/MS/CSE661“> <course:Namerdf:datatype=“http://www.w3c.org/2001/XMLSchema#string“> Semantic Web </course:Name> <course:credit rdf:datatype= “http://www.w3c.org/2001/XMLSchema#integer“> 3 </course:credit> </rdf:Description></rdf:RDF> http://iba.edu.pk/MS/course#Name Semantic Web http://iba.edu.pk/MS/CSE661 4 http://iba.edu.pk/MS/course#credit Quratulain Rajput
Multiple values Relation • Problem: which height belong to which member. • Solution: A node with no unique name is called blank node. • It use to aggregate facts in form of list. Asif saad http://www.footballpakistan.com/hasMember http://www.footballpakistan.com/hasMember http://www.footballpakistan.com/team http://www.footballpakistan.com/hasHeight http://www.footballpakistan.com/hasHeight 6.5ft 6 ft Quratulain Rajput
Blank Node • Blank node cannot be addressed globally with URI. 6 ft saad http://www.footballpakistan.com/hasName http://www.footballpakistan.com/hasHeight http://www.footballpakistan.com/hasMember http://www.footballpakistan.com/hasHeight http://www.footballpakistan.com/team 6.5ft http://www.footballpakistan.com/hasMember Asif http://www.footballpakistan.com/hasName Quratulain Rajput Quratulain Rajput 13
Blank Node <rdf:Description rdf:about=“http://footballpakistan.com/team#Mem“> <te:hasMemberrdf:parseType=“Resource“/> <te:hasName>Asif</te:hasName> <te:hasHeight>6.5</te:hasHeight> </te:hasMember> </rdf:Description> Quratulain Rajput
Blank node with name • Blank node can be assign name if needed. <rdf:Description rdf:about=“http://footballpakistan.com/team#Mem“> <te:hasMemberrdf:nodeID=“M1”/> </rdf:Description> <rdf:Descriptionrdf:nodeID=“M1”> <te:hasName>Asif</te:hasName> <te:hasHeight>6.5</te:hasHeight> </te:hasMember> </rdf:Description> Quratulain Rajput
Container Elements • Represents a group of resources or literals E.g., we may wish to talk about the courses given by a particular lecturer • The content of container elements are named rdf:_1, rdf:_2, etc. or alternatively rdf:li Quratulain
Three Types of Container Elements • rdf:Bag an unordered container, allowing multiple occurrences • E.g. members of the faculty board, documents in a folder • rdf:Seq an ordered container, which may contain multiple occurrences • E.g. modules of a course, items on an agenda, an alphabetized list of staff members (order is imposed) • rdf:Alt a set of alternatives • E.g. the document home and mirrors, translations of a document in various languages Quratulain
Example for a Bag <uni:lecturerrdf:ID= "FAC949"uni:name="Atif" uni:title="Professor"> <uni:coursesTaught> <rdf:Bag> <rdf:_1 rdf:resource="#CSE101"/> <rdf:_2 rdf:resource="#CSE206"/> </rdf:Bag> </uni:coursesTaught> </uni:lecturer> Quratulain
Example for Alternative <uni:courserdf:ID=“CSE206" uni:courseName=“Data Structures"> <uni:lecturer> <rdf:Alt> <rdf:lirdf:resource="#FAC949"/> <rdf:lirdf:resource="#FAC318"/> </rdf:Alt> </uni:lecturer> </uni:course> Quratulain
Question Describe it using container? Referee(X,Y,Z) : X is the referee in a chess game between players Y and Z Quratulain
RDF Collections • A limitation of these containers is that there is no way to close them • “these are all the members of the container” • RDF provides support for describing groups containing only the specified members, in the form of RDF collections • list structure in the RDF graph • constructed using a predefined collection vocabulary: rdf:List,rdf:first,rdf:restand rdf:nil Quratulain
Reification • In RDF it is possible to make statement about statement such as Ahmed belief that Hassan is the creator of the web page http://www.xyz.com How would you do this?try. RDF allow this using reification mechanism. Quratulain
Reification <rdf:Description rdf:about=“#NYT”> <claims> <rdf:Description rdf:about=“#pers05”> <authorOf>ISBN...</authorOf> </rdf:Description> </claims> </rdf:Description> Author-of pers05 ISBN... • Any statement can be an object graphs can be nested - reification claims NYT Quratulain
Reification <rdf:Statementrdf:about=“Statementaboutpers05”> <rdf:subjectrdf:resource=“#pers05”/> <rdf:predicaterdf:resource=“#authorOf”/> <rdf:object>ISBN</rdf:object> </rdf:Statement> <rdf:Descriptionrdf:about=“#NYT”> <claims> <rdf:Descriptionrdf:resource=“#Statementaboutpers05”/> </claims> </rdf:Description> <rdf:Descriptionrdf:about=“#NYT”> <claims> <rdf:Descriptionrdf:about=“#pers05”> <authorOf>ISBN...</authorOf> </rdf:Description> </claims> </rdf:Description> • RDF turns a statement into resource. Quratulain