200 likes | 411 Views
Resource Description Framework (RDF). Lecture # 6 Faculty of Computer Science, IBA. value. resource. property. RDF. Fundamental concept of RDF are Resource Properties Statements. RDF:resource.
E N D
Resource Description Framework (RDF) Lecture # 6 Faculty of Computer Science, IBA
value resource property RDF • Fundamental concept of RDF are • Resource • Properties • Statements Quratulain
RDF:resource • We can denote that two entities are the same using therdf:resource attribute. For example <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:xsd="http://www.w3.org/2001/XLMSchema#" xmlns:uni="http://www.mydomain.org/uni-ns"> <rdf:Descriptionrdf:about="CSE661"> <uni:courseName>Semantic Web</uni:courseName> <uni:isTaughtByrdf:resource=“FAC949"/> </rdf:Description> <rdf:Descriptionrdf:about=“FAC949"> <uni:name>Quratulain</uni:name> <uni:title>Assistant Professor</uni:title> </rdf:Description> Quratulain
Nested Descriptions: Example <rdf:Descriptionrdf:about="CSE661"> <uni:courseName>Semantic Web</uni:courseName> <uni:isTaughtBy> <rdf:Descriptionrdf:ID=“FAC949"> <uni:name>Sana</uni:name> <uni:title>Associate Professor</uni:title> </rdf:Description> </uni:isTaughtBy> </rdf:Description> • Although a descriptions defined within another description, its scope is global. Quratulain
Rdf:type Element <rdf:Descriptionrdf:ID=“CSE661"> <rdf:typerdf:resource="http://www.iba.edu.pk/uni-ns#course"/> <uni:courseName>Semantic Web</uni:courseName> <uni:isTaughtByrdf:resource="#FAC949"/> </rdf:Description> <rdf:Descriptionrdf:ID=“FAC949"> <rdf:typerdf:resource="http://www.iba.edu.pk/uni-ns#lecturer"/> <uni:name>Sana</uni:name> <uni:title>Associate Professor</uni:title> </rdf:Description> Quratulain
Abbreviated Syntax • Simplification rules: • Childless property elements within description elements may be replaced by XML attributes • For description elements with a typing element we can use the name specified in the rdf:type element instead of rdf:Description • These rules create syntactic variations of the same RDF statement • They are equivalent according to the RDF data model, although they have different XML syntax Quratulain
Abbreviated Syntax: Example of rule#1 <rdf:Descriptionrdf:ID="CSE661"> <rdf:typerdf:resource="http://www.iba.edu.pk/uni-ns#course"/> <uni:courseName>Semantic Web</uni:courseName> <uni:isTaughtByrdf:resource="#FAC949"/> </rdf:Description> <rdf:Descriptionrdf:ID="CSE661“ uni:courseName=“Semantic Web"> <rdf:typerdf:resource="http://www.iba.edu.pk/uni-ns#course"/> <uni:isTaughtByrdf:resource="#FAC949"/> </rdf:Description> Quratulain
Abbreviated Syntax: Example of rule#2 <rdf:Descriptionrdf:ID="CSE661"> <rdf:typerdf:resource="http://www.iba.edu.pk/uni-ns#course"/> <uni:courseName>Semantic Web</uni:courseName> <uni:isTaughtByrdf:resource="#FAC949"/> </rdf:Description> <uni:courserdf:ID="CSE661"uni:courseName=“Semantic Web"> <uni:isTaughtByrdf:resource="#FAC949"/> </uni:course> Quratulain
Syntactic variation of same RDF statement <rdf:Descriptionrdf:ID="CSE661"> <rdf:typerdf:resource="http://www.iba.edu.pk/uni-ns#course"/> <uni:courseName>Semantic Web</uni:courseName> <uni:isTaughtByrdf:resource="#FAC949"/> </rdf:Description> <rdf:Descriptionrdf:ID="CSE661“ uni:courseName=“Semantic Web"> <rdf:typerdf:resource="http://www.iba.edu.pk/uni-ns#course"/> <uni:isTaughtByrdf:resource="#FAC949"/> </rdf:Description> <uni:courserdf:ID="CSE661"uni:courseName=“Semantic Web"> <uni:isTaughtByrdf:resource="#FAC949"/> </uni:course> Quratulain
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
Rdf:ID Attribute for Container Elements <uni:lecturerrdf:ID= "FAC949"uni:name="Asif"> <uni:coursesTaught> <rdf:Bagrdf:ID="DBcourses"> <rdf:_1 rdf:resource="#CSE101"/> <rdf:_2 rdf:resource="#CSE102"/> </rdf:Bag> </uni:coursesTaught> </uni:lecturer> 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
RDF Collections • Shorthand syntax: • "Collection" value for the rdf:parseType attribute: <rdf:Descriptionrdf:about="#CSE101"> <uni:isTaughtByrdf:parseType="Collection"> <rdf:Descriptionrdf:about=“#FAC491"/> <rdf:Descriptionrdf:about="#FAC493"/> <rdf:Descriptionrdf:about="#FAC498"/> </uni:isTaughtBy> </rdf:Description> 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
<rdf:Description rdf:about=“#NYT”> <claims> <rdf:Description rdf:about=“#pers05”> <authorOf>ISBN...</authorOf> </rdf:Description> </claims> </rdf:Description> Author-of pers05 ISBN... Reification • Any statement can be an object graphs can be nested - reification claims NYT Quratulain
<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> Reification <rdf:Descriptionrdf:about=“#NYT”> <claims> <rdf:Descriptionrdf:about=“#pers05”> <authorOf>ISBN...</authorOf> </rdf:Description> </claims> </rdf:Description> • RDF turns a statement into resource. Quratulain