Presentation is loading. Please wait.

Presentation is loading. Please wait.

.opennet Technologies XML Examples: RDF & RSS

Similar presentations


Presentation on theme: ".opennet Technologies XML Examples: RDF & RSS"— Presentation transcript:

1 .opennet Technologies XML Examples: RDF & RSS
Fall Semester MW 5:00 pm - 6:20 pm CENTRAL (not Indiana) Time Geoffrey Fox and Bryan Carpenter PTLIU Laboratory for Community Grids Computer Science, Informatics, Physics Indiana University Bloomington IN 47404 9/21/2018 xmlexamplesrdffall01

2 Basic Principles We describe the use of XML to specify Metadata – data about data Metadata can also be thought of as “overall properties” of an entity Example: Author is part of Metadata for Books or Computer Programs Example: Capacity of Football stadium could be key part of metadata for universities Here we describe a general framework -- RDF (Resource Description Framework) for making assertions about metadata We previously described a particular example – DC (Dublin Core) of metadata about bibliographic material – books, web pages etc. 9/21/2018 xmlexamplesrdffall01

3 References on RDF There are two W3C documents about RDF which are quite hard to read RDF Model and Syntax: Defines basic ideas for any metadata vocabulary RDF Schema Describes general structure of a metadata vocabulary One of the earliest users of RDF was Netscape in their Mozilla (Netscape 6) activity where they use RDF to describe user specific information about browser – actually this describes trees in areas of bookmarks and as RDF naturally defines general graphs I found this short discussion an interesting comment on a non metadata application of RDF 9/21/2018 xmlexamplesrdffall01

4 RDF Statements Predicate Subject Object
The essence of RDF is a statement which has a subject and predicate and an object The “subject” has the property “predicate” with value “object” The Web Page has the title “RDF Model and Syntax” Mary had a husband called John Statements can specify metadata but more generally any facts expressible in this way One can associate multiple objects with a subject and so build up a general node of a tree with parent as subject and objects as children. Thus RDF can define a general tree fragment as shown on next foil 9/21/2018 xmlexamplesrdffall01

5 Same Predicate: Student Same or Different Predicates
RDF Tree Fragment Class Agatha Henry Fred Same Predicate: Student Freddie B- Different Predicates Nick name grade General Subject Object Same or Different Predicates Specific 9/21/2018 xmlexamplesrdffall01

6 RDF Building Concepts Resource: Any identifiable object – must have a URI of style begin://rootlabel/nextlabel/…./lastlabel This URI could be a Web address but anything of “approved format” is allowed – each person could start their own personal://Country/SSNorEquivalent/Classify/How/you/want/item URI syntax is Property: A special resource of “type” property Object: Either a resource or a literal – a literal is something like a text or even XML string. Example: take a case with Property as Name. This Name could have a URI derived from the URI of the Dublin Core Schema and Name’s definition therein. So Name is indeed a Resource Then the object could either be literal “Geoffrey Fox” or resource given by my home page 9/21/2018 xmlexamplesrdffall01

7 What is a URL URN or URI ? http://www.w3.org/Addressing/ 9/21/2018
xmlexamplesrdffall01

8 URI PURL’s Persistent URL’s at are URN’s that are also URL’s gotten by using an intermediate directory that maps permanent name to ephemeral URL’s If you use abc://d/e/g … , then MUST be a hierarchical labeling and familiar relative addresses are allowed ../differentparent goes up one level // is always root Should get in habit of using URI’s that are persistent labels as these are key to registry and discovery systems lists “URI Schemes” such as afs (Andrew File system), fax, file, ftp, gopher, http, imap, ldap, news, nfs, nntp, pop, rtsp, sip, tel, telnet, wais, z39.50r, z39.50s (z39.50 is databasesearch and retrieval protocol) I will use my own URI’s (petokc:// …) for work I am doing with ERDC 9/21/2018 xmlexamplesrdffall01

9 An Example of RDF and Dublin Core
<rdf:RDF xmlns:rdf=" xmlns:dc=" <rdf:Description about=" <dc:Title>D-Lib Program - Research in Digital Libraries</dc:Title> <dc:Description>The D-Lib program supports the community of people with research interests in digital libraries and electronic publishing. </dc:Description> <dc:Publisher>Corporation For National Research Initiatives</dc:Publisher> <dc:Date> </dc:Date> <dc:Subject> <rdf:Bag> <rdf:li>Research; statistical methods</rdf:li> <rdf:li>Education, research, related topics</rdf:li> <rdf:li>Library use Studies</rdf:li> </rdf:Bag> </dc:Subject> <dc:Type>World Wide Web Home Page</dc:Type> <dc:Format>text/html</dc:Format> <dc:Language>en</dc:Language> </rdf:Description> </rdf:RDF> 9/21/2018 xmlexamplesrdffall01

10 Comments on Example We define the RDF and DC (Dublin Core) Namespaces
We define resource with <rdf:Description about=“. We want to add DC metadata describing this web page We see Dublin Core metadata Title, Description, Publisher, Date, Subject, Type, format, Language We see use of RDF Bag syntax to specify 3 separate “subject” values Note that RDF provides the overall framework with the description tag mapping a resource ( to a set of properties The properties are defined in a completely different namespace – the Dublin Core RDF provides useful expressivity with a “collection” syntax of which bag (unordered collection) is one example 9/21/2018 xmlexamplesrdffall01

11 RDF Basics Now we go back and define basic RDF syntax in more detail
Consider the simple statement: Ora Lassila is the creator of the resource Or “ has creator Ora Lassila”. Or in general "<subject> HAS <predicate> <object>". Specified by <rdf:RDF> <rdf:Description about=" <s:Creator>Ora Lassila</s:Creator> </rdf:Description> </rdf:RDF> Predicate(property) Subject Resource Object 9/21/2018 xmlexamplesrdffall01

12 Anonymous resources We may wish to specify multiple properties which can do with a diagram like that here and with typical RDF syntax <rdf:RDF> <rdf:Description about=" <s:Creator> <v:Name>Ora Lassila</v:Name> </s:Creator> </rdf:Description> </rdf:RDF> Anonymous Resource 9/21/2018 xmlexamplesrdffall01

13 Tree-like Syntax <rdf:RDF> <rdf:Description about=" <s:Creator> <rdf:Description about=" <v:Name>Ora Lassila</v:Name> </rdf:Description> </s:Creator> </rdf:Description> </rdf:RDF> Here We give the anonymous resource a name such as “employee 85740” with a URI pointing to “employee database entry” 9/21/2018 xmlexamplesrdffall01

14 Abbreviations We can put the predicate=“object” specification as an attribute. For our simplest case this gives: <rdf:RDF> <rdf:Description about=" s:Creator="Ora Lassila" /> </rdf:RDF> We can abbreviate our last example: <rdf:RDF> <rdf:Description about=" <s:Creator rdf:resource=" v:Name="Ora Lassila" /> </rdf:Description> </rdf:RDF> These abbreviations both shorten the text and hide XML tags as attributes. This means that undesirable actions/errors by browsers that don’t know various namespaces are avoided 9/21/2018 xmlexamplesrdffall01

15 Example of a Bag I We already have seen the Bag syntax illustrated. There are three collections in RDF: Bag,Seq and Alt. Lets look at Bag again The students in course are Amy, Tim, John, Mary, and Sue. This statement is represented graphically as shown. One can represent it either using a syntax like HTML unordered lists or using explicit member references such as rdf:_1=" Amy” 9/21/2018 xmlexamplesrdffall01

16 Bag Collection II This is most directly written
<rdf:RDF> <rdf:Description about=" <s:students> <rdf:Bag> <rdf:li resource=" <rdf:li resource=" <rdf:li resource=" <rdf:li resource=" <rdf:li resource=" </rdf:Bag> </s:students> </rdf:Description> </rdf:RDF> 9/21/2018 xmlexamplesrdffall01

17 Alternative Bag Syntax
<rdf:RDF> <rdf:Description about=" <s:students rdf:type=“ rdf:_1=“ rdf:_2=" rdf:_3=" rdf:_4=" rdf:_5=" /> </rdf:Description> </rdf:RDF> 9/21/2018 xmlexamplesrdffall01

18 Alternative Bag Syntax
<rdf:RDF> <rdf:Description about=" <s:students rdf:type=“ rdf:_1=“ rdf:_2=" rdf:_3=" rdf:_4=" rdf:_5=" /> </rdf:Description> </rdf:RDF> 9/21/2018 xmlexamplesrdffall01

19 The three basic Collections
Bag: (rdf:Bag) An unordered list of resources or literals. Bags are used to declare that a property has multiple values and that there is no significance to the order in which the values are given. Bag might be used to give a list of part numbers where the order of processing the parts does not matter. Duplicate values are permitted. Sequence: (rdf:Seq) An ordered list of resources or literals. Sequence is used to declare that a property has multiple values and that the order of the values is significant. Sequence might be used, for example, to preserve an alphabetical ordering of values. Duplicate values are permitted. Alternative: (rdf:Alt) A list of resources or literals that represent alternatives for the (single) value of a property. Alternative might be used to provide alternative language translations for the title of a work, or to provide a list of Internet mirror sites at which a resource might be found. An application using a property whose value is an Alternative collection is aware that it can choose any one of the items in the list as appropriate. Alt must have at least one member; the first member of Alt is default object. 9/21/2018 xmlexamplesrdffall01

20 about and aboutEach I Let us define a collection with local name pages
<rdf:Bag ID="pages“ > <rdf:li resource=" /> <rdf:li resource=" /> </rdf:Bag> Then we can define the creator of the Collection by: <rdf:Description about="#pages"> <s:Creator>Ora Lassila</s:Creator> </rdf:Description> Now this does not say anything about the creator of the individual resources in the bag For this we need aboutEach 9/21/2018 xmlexamplesrdffall01

21 about and aboutEach II <rdf:Description aboutEach="#pages"> <s:Creator>Ora Lassila</s:Creator> </rdf:Description> Is equivalent to two separate “about” descriptions – one for each member of the bag <rdf:Description about=" <s:Creator>Ora Lassila</s:Creator> </rdf:Description> <rdf:Description about=" <s:Creator>Ora Lassila</s:Creator> </rdf:Description> 9/21/2018 xmlexamplesrdffall01

22 aboutEachPrefix I if the two resources and exist then: <rdf:Description aboutEachPrefix=" <s:Copyright>© 1998, The Foo Organization</s:Copyright> </rdf:Description> Says that these two pages have the same copyright information If billions of documents in this collection (i.e. with this prefix, then all are given this copyright metadata) For two documents we can define this information in other ways given on next page 9/21/2018 xmlexamplesrdffall01

23 aboutEachPrefix II <rdf:Description about=" <s:Copyright>© 1998, The Foo Organization</s:Copyright> </rdf:Description> <rdf:Description about=" Or you could use Bag notation <rdf:Description aboutEach=“#docpages"> <rdf:Bag ID="docpages"> <rdf:li resource=" <rdf:li resource=" </rdf:Bag> 9/21/2018 xmlexamplesrdffall01

24 rdf:value <RDF xmlns=" xmlns:rdf=" xmlns:n=" <Description about="John_Smith"> <n:weight rdf:parseType="Resource"> <rdf:value> 200 </rdf:value> <n:units rdf:resource=" </n:weight> </Description> </RDF> <rdf:value is primary value of weight This syntax allows directly non-binary relations 9/21/2018 xmlexamplesrdffall01

25 <rdf:value <rdf:parseType <dcq Example
<rdf:Description about=“ ……………………. <dc:Contributor rdf:parseType="Resource"> <dcq:AgentType rdf:resource=" <rdf:value>Amy Friedlander</rdf:value> </dc:Contributor> <dc:Relation rdf:parseType="Resource"> <dcq:RelationType rdf:resource=" <rdf:value resource=“ /> </dc:Relation> </rdf:Description> 9/21/2018 xmlexamplesrdffall01

26 <rdf:value <rdf:parseType <dcq
<tag rdf:parseType=“.” >Contents</tag> Attribute rdf:parseType can either be “Literal” or “Resource” If “Resource”, then Contents of this tag must “match the syntax of a rdf:description tag” and define a resource If no XML tags in contents or rdf:parseType=“Literal”, then RDF processor will NOT process Contents In previous page, we use rdf:value to specify a principal value and a qualification (dcq namespace for Dublin Core Qualifier) RelationType Anonymous Resource Relation rdf:value 9/21/2018 xmlexamplesrdffall01

27 rdf:parseType=“Literal”
Here is an example: <dc:Title rdf:parseType="Literal“ > Ramifications of <apply> <power/> <apply> <plus/> <ci>a</ci> <ci>b</ci> </apply> <cn>2</cn> </apply> to World Peace </dc:Title> Here the MathML text is NOT interpreted by RDF but considered as an XML string defining this resource 9/21/2018 xmlexamplesrdffall01

28 Mozilla RDF Tags http://dmoz.org/rdf/tags.html 9/21/2018
xmlexamplesrdffall01

29 Mozilla Use of RDF This is edited to be small. See web page 9/21/2018 xmlexamplesrdffall01

30 Syndication: RDF to define Web Pages
As discussed, RDF was originally designed to specify information (meta-data) about web pages so that one could search for pages more effectively We can use it as basis of Syndication which can be defined as making data available online for retrieval and further transmission, aggregation, or online publication. This is equivalent to defining contents of web pages in terms of links, text, images as well other issues such as rights and authorship. The PET OKC (Online Knowledge Center) is designed to supported as a “syndication service” There are several interesting syndication systems which are all XML based 9/21/2018 xmlexamplesrdffall01

31 Examples of Information Nugget Streams I
New York Times shows a page full of nuggets which point to more detailed descriptions 9/21/2018 xmlexamplesrdffall01

32 Examples of Information Nugget Streams II
The nuggets can be smaller and can include adverts Syndication systems define nuggets including link to more detailed information 9/21/2018 xmlexamplesrdffall01

33 Syndication Systems RSS version 0.91 Rich (originally RDF) Site Summary was originally developed by Netscape as a channel description framework / content-gathering mechanism for their My Netscape Network (MNN at RSS version 1 RDF Site Summary restores original RDF support and develops a basic framework which has RSS RDF and application dependent Schemas RSS feeds carry an array of content types: news headlines, discussion forums, software announcements, and various bits of specialized data (such as homes for sale, sports scores, Chemistry, PET etc. which would have their own Schema). Open Content Syndication OCS is similar to RSS version 1 ICE Information Content and Exchange is more complicated 9/21/2018 xmlexamplesrdffall01

34 The OKC Information Channels
FMS/C4I IMT SIP ET CCM CEA CEN CDLT CFD CSM OKC EOTC EQM CWO CE JSU IU ERDC Army ……. RSS Streams Integrated by PET Online Knowledge Center OKC HPCMP Streams delivered by HTTP (forms) or SMTP (mail) using SOAP message format 9/21/2018 xmlexamplesrdffall01

35 ICE’s Claim to Fame ICE is intended to support the full range of content syndication. It has a number of commercial implementations, generally targeted at businesses that wish to distribute or aggregate large volumes of content with numerous business partners. Thus, it offers a range of options including: delivery of arbitrary content types, including web pages support of both push and pull delivery of content access control and customization of content Both "full update" and "incremental update" supported, with atomicity of updates, recovery mechanisms for error conditions, etc. content delivered in-line or by reference confirmation of delivery auditing of ICE operations rich scheduling of ICE delivery meta-data relating to intellectual property, usage rights, copyright, etc. automated negotiation of delivery and other parameters extensible syndication discovery protocol 9/21/2018 xmlexamplesrdffall01

36 RSS Version 1 Example I <?xml version="1.0"?> <rdf:RDF
xmlns:rdf=" xmlns=" > <channel rdf:about=" <title> XML.com </title> <link> </link> <description> XML.com features a rich mix of information and services for the XML community. </description> <image rdf:resource=" /> 9/21/2018 xmlexamplesrdffall01

37 RSS Version 1 Example II <items> <rdf:Seq>
<rdf:li resource=" /> <rdf:li resource=" /> </rdf:Seq> </items> </channel> <image rdf:about=" <title> XML.com </title> <link> </link> <url> </url> </image> 9/21/2018 xmlexamplesrdffall01

38 RSS Version 1 Example III
<item rdf:about=" <title> Processing Inclusions with XSLT </title> <link> </link> <description> Processing document inclusions with general XML tools can be problematic. This article proposes a way of preserving inclusion information through SAX-based processing. </description> </item> <item rdf:about=" <title> Putting RDF to Work </title> <link> </link> Tool and API support for the Resource Description Framework is slowly coming of age. Edd Dumbill takes a look at RDFDB, one of the most exciting new RDF toolkits. </rdf:RDF> 9/21/2018 xmlexamplesrdffall01

39 RSS Basic Structure RSS has a simple set of basic elements:
There is RDF itself plus <channel> <title> <link> <description> <image> <items> <textinput> <url> <item> <title> <link> <description> <textinput> <name> 9/21/2018 xmlexamplesrdffall01

40 RSS Modules RSS Modules correspond to application specific extensions to basic capabilities. There are three modules “shipped” with current RSS (actually two shipped and one more approved) Dublin Core Syndication Content Here are others proposed 9/21/2018 xmlexamplesrdffall01

41 Syndication Module in RSS
How often to update page 9/21/2018 xmlexamplesrdffall01

42 Dublin Core, Company, TextInput Modules
9/21/2018 xmlexamplesrdffall01

43 Content Module in RSS 9/21/2018 xmlexamplesrdffall01

44 Using RSS If you are a news provider: BBC CNN AP Reuters, XYZ newsgroup, HPCwire, personal archive etc. You make a list of news nuggets in RSS providing an “abstract” in title/description and link for further data This is a channel If you a portal manager: PET OKC, New York Times, Yahoo etc. you use one of many software packages (we will use Jetspeed to read RSS file (with ongoing updates) and provide digest with possible link to further information There is no special agreement as to way to encode list of channels gives 1725 channels (20 November 2001) in rssfeeds XML syntax (see Class Web Site ( has copy of this) 9/21/2018 xmlexamplesrdffall01

45 Example of Syndication Site
Channel RSS Entry 9/21/2018 xmlexamplesrdffall01

46 RSSFeeds Example Each channel is a news feed
This is a modification of RSS extending channel element 9/21/2018 xmlexamplesrdffall01

47 Useful RSS usage Links Syndication Sites are illustrated by:
[rss file: ] was generated from RSS File is a smaller RSS file driving a Bluetooth site 9/21/2018 xmlexamplesrdffall01

48 A small RSS News Stream Note HTML embedded in RSS which is version 0.91 9/21/2018 xmlexamplesrdffall01

49 RDF Statements I There is a formal way of looking at RDF statements which break it up into (subject,predicate,object) triple This allows (as on next foil) one to maker statements about statements rdf:Statement - This class corresponds to the set called the 'Statement ‘ in the formal model for RDF. rdf:subject - This corresponds to the property called the 'subject' in the formal model for RDF. Its rdfs:domain is rdf:Statement and rdfs:range is rdfs:Resource. This is used to specify the resource described by a reified statement. rdf:predicate - This corresponds to the property called the 'predicate' in the formal model for RDF. Its rdfs:domain is rdf:Statement and rdfs:range is rdf:Property. This is used to identify the property used in the modeled statement. rdf:object - This corresponds to the property called the 'object' in the formal model for RDF. Its rdfs:domain is rdf:Statement. This is used to identify the property value in the modeled statement. 9/21/2018 xmlexamplesrdffall01

50 RDF Statements II <rdf:RDF xmlns:rdf=" xmlns:a=" <rdf:Description> <rdf:subject resource=" /> <rdf:predicate resource=" /> <rdf:object>Ora Lassila</rdf:object> <rdf:type resource=" /> <a:attributedTo>Ralph Swick</a:attributedTo> </rdf:Description> </rdf:RDF> Here we attribute assertion (statement) to Raplh Swick 9/21/2018 xmlexamplesrdffall01

51 ID and bagID in RDF If another Description or property value needs to refer to the in-line resource it will use the value of the ID of that resource in its own about attribute. The ID attribute signals the creation of a new resource and the about attribute refers to an existing resource; therefore either ID or about may be specified on Description but not both together in the same element. The values for each ID attribute must not appear in more than one ID attribute within a single document. There is also bagID used to label container containing formal RDF Statements We can write: <rdf:RDF> <rdf:Description about=" bagID="D_001"> <s:Creator>Ora Lassila</s:Creator> <s:Title>Ora's Home Page</s:Title> </rdf:Description> </rdf:RDF> And then add assertion about attribution via <rdf:Description aboutEach="#D_001"> <a:attributedTo>Ralph Swick</a:attributedTo> </rdf:Description> 9/21/2018 xmlexamplesrdffall01

52 RDF Schema This sets up a framework like the Java (and other languages) to define classes and other features of Resources that enable one to talk about Resources as Instances of classes Below rounded rectangles represents a class of resources The outermost rectangle is the set of all resources i.e. all “objects” Classes are themselves resources and 5 examples are given corresponding to four rounded rectangles and literals (which are not resources even though the literal class is a resource Literals are objects 9/21/2018 xmlexamplesrdffall01

53 RDF Schema This shows a Motor Vehicle Metadata with Sub Classes
9/21/2018 xmlexamplesrdffall01

54 Motor Vehicle Class Hierarchy
This picture shows the RDF graph corresponding to previous example 9/21/2018 xmlexamplesrdffall01

55 RDF Schema Core Properties
rdf:type This indicates that a resource is a member of a class, and thus has all the characteristics that are to be expected of a member of that class. When a resource has an rdf:type property whose value is some specific class, we say that the resource is an instance of the specified class. The value of an rdf:type property for some resource is another resource which must be an instance of rdfs:Class. The resource known as rdfs:Class is itself a resource of rdf:type rdfs:Class. Individual classes (for example, 'Dog') will always have an rdf:type property whose value is rdfs:Class (or some subclass of rdfs:Class, as described in section 2.3.2). A resource may be an instance of more than one class. rdfs:subClassOf This property specifies a subset/superset relation between classes. The rdfs:subClassOf property is transitive. If class A is a subclass of some broader class B, and B is a subclass of C, then A is also implicitly a subclass of C. Consequently, resources that are instances of class A will also be instances of C, since A is a sub-set of both B and C. Only instances of rdfs:Class can have the rdfs:subClassOf property and the property value is always of rdf:type rdfs:Class. A class may be a subclass of more than one class. 9/21/2018 xmlexamplesrdffall01

56 RDF Core Classes There are three core classes rdfs:Resource
RDF Schema is There are three core classes rdfs:Resource All things being described by RDF expressions are called resources, and are considered to be instances of the class rdfs:Resource. rdf:Property represents the subset of RDF resources that are properties rdfs:Class This corresponds to the generic concept of a Type or Category, similar to the notion of a Class in object-oriented programming languages such as Java. When a schema defines a new class, the resource representing that class must have an rdf:type property whose value is the resource rdfs:Class. RDF classes can be defined to represent almost anything, such as Web pages, people, document types, databases or abstract concepts. 9/21/2018 xmlexamplesrdffall01

57 rdfs:subPropertyOf The property rdfs:subPropertyOf is an instance of rdf:Property that is used to specify that one property is a specialization of another. A property may be a specialization of zero, one or more properties. If some property P2 is a subPropertyOf another more general property P1, and if a resource A has a P2 property with a value B, this implies that the resource A also has a P1 property with value B. A property can never be declared to be a subproperty of itself, nor of any of its own subproperties Here is an example with biologicalFather as a subpropertyOf biologicalParent Note use of ID 9/21/2018 xmlexamplesrdffall01

58 rdfs:seeAlso and rdfs:isDefinedBy
The property rdfs:seeAlso specifies a resource that might provide additional information about the subject resource. This property may be specialized using rdfs:subPropertyOf to more precisely indicate the nature of the information the object resource has about the subject resource. The object and the subject resources are constrained only to be instances of the class rdfs:Resource. rdfs:isDefinedBy The property rdfs:isDefinedBy is a subproperty of rdfs:seeAlso, and indicates the resource defining the subject resource. As with rdf:seeAlso, this property can be applied to any instance of rdfs:Resource and may have as its value any rdfs:Resource. 9/21/2018 xmlexamplesrdffall01

59 rdfs Constraints rdfs:ConstraintResource
This resource defines a subclass of rdfs:Resource whose instances are RDF schema constructs involved in the expression of constraints. The purpose of this class is to provide a mechanism that allows RDF processors to assess their ability to use the constraint information associated with an RDF model. Since this specification does not provide a mechanism for the dynamic discovery of new forms of constraint, an RDF Schema 1.0 processor encountering previously unknown instances of rdfs:ConstraintResource can be sure that it is unqualified to determine the meaning of those constraints. rdfs:ConstraintProperty This resource defines a subclass of rdf:Property, all of whose instances are properties used to specify constraints. This class is a subclass of rdfs:ConstraintResource and corresponds to the subset of that class representing properties. Both rdfs:domain and rdfs:range are instances of rdfs:ConstraintProperty. 9/21/2018 xmlexamplesrdffall01

60 Rdf:range rdfs:domain
rdfs:range An instance of ConstraintProperty that is used to indicate the class(es) that the values of a property must be members of. The value of a range property is always a Class. Range constraints are only applied to properties. A property can have at most one range property. It is possible for it to have no range, in which case the class of the property value is unconstrained. rdfs:domain An instance of ConstraintProperty that is used to indicate the class(es) on whose members a property can be used. A property may have zero, one, or more than one class as its domain. If there is no domain property, the property may be used with any resource. If there is exactly one domain property, it may only be used on instances of that class (which is the value of the domain property). If there is more than one domain property, the constrained property can be used with instances of any of the classes (that are values of those domain properties). 9/21/2018 xmlexamplesrdffall01

61 Example of rdfs:domain and rdfs:range
Note domain tells you about “subject” – resource being described by a particular property range tells you about allowed values of property “registeredTo” applies to MotorVehicle’s and must be a Person 9/21/2018 xmlexamplesrdffall01

62 Useful Base rdf rdfs Properties and Classes
rdfs:comment - This property is used to provide a human-readable description of a resource. rdfs:label - This property is used to provide a human-readable version of a resource name. rdfs:Literal - This class corresponds to the set called the 'Literals' in the formal model for RDF. Atomic values such as textual strings are examples of RDF literals. rdfs:Container - This class describes rdf:Bag rdf:Seq rdf:Alt. It is an instance of rdfs:Class and rdfs:subClassOf of rdfs:Resource. rdf:Bag - This is the class called 'Bag' in the formal model for RDF. It is an instance of rdfs:Class and rdfs:subClassOf rdfs:Container. rdf:Seq - This is the class called 'Sequence' in the formal model for RDF. rdf:Alt - This is the class called 'Alternative' in the formal model for RDF. rdfs:ContainerMembershipProperty - This class has as members the properties _1, _2, _3 ... used to indicate container membership. This is a rdfs:subClassOf rdf:Property. rdf:value - This property corresponds to the 'value' property of an rdf:object. 9/21/2018 xmlexamplesrdffall01

63 Example of a Person RDFS Schema I
9/21/2018 xmlexamplesrdffall01

64 Example of a Person RDFS Schema II
In previous foil, Person is a class with a corresponding human-readable description of "The class of people". Animal is a class presumed to be defined in another schema. All persons are animals, so we declare that Person is a subclass of Animal. A Person may have an age property. The value of age is an integer. A Person may also have an ssn ("Social Security Number") property. The value of ssn is an integer. A Person's marital status is one of {Single, Married, Divorced, Widowed}. This is achieved through use of the rdfs:range constraint: we define both a maritalStatus property and a class MaritalStatus (adopting the convention of using lower case letters to begin the names of properties, and capitals for classes). We then use rdfs:range to state that a maritalStatus property only 'makes sense' when it has a value which is an instance of the class MaritalStatus. The schema then defines a number of instances of this class. Whether resources declared to be of type MaritalStatus in another graph are trusted is an application level decision. 9/21/2018 xmlexamplesrdffall01

65 rdfs Example This is an RDF vocabulary for use with searchable Internet services. SearchQuery is declared to be a class. Every SearchQuery can have both a queryString whose value is an rdfs:Literal and a queryService whose value is a SearchService. A SearchService is a subclass of InternetService (which is defined elsewhere). A SearchQuery has some number of result properties (whose value is SearchResult). Each SearchResult has a title (value is a rdfs:Literal), a rating and of course, the page itself. 9/21/2018 xmlexamplesrdffall01


Download ppt ".opennet Technologies XML Examples: RDF & RSS"

Similar presentations


Ads by Google