Upload
isaura
View
47
Download
0
Embed Size (px)
DESCRIPTION
Practical RDF Chapter 5. Important Concepts from the W3C RDF Vocabulary/Schema. Shelley Powers, O’Reilly SNU IDB Lab. Hyewon Kim. Outline. Introduction RDF Vocabulary: Describing the Data Core RDF Schema Elements Refining RDF Vocabularies with Constraints RDF Schema Alternatives. - PowerPoint PPT Presentation
Citation preview
Practical RDFChapter 5. Important Concepts from the W3C RDF Vocabulary/SchemaShelley Powers, O’Reilly SNU IDB Lab.Hyewon Kim
Outline Introduction RDF Vocabulary: Describing the Data Core RDF Schema Elements Refining RDF Vocabularies with Constraints RDF Schema Alternatives
Introduction RDF (Resource Description Framework) specification
– Syntax specification How RDF constructs relate to each other How they can be diagrammed in XML
– Schema specification A ruled-based dictionary that defines the elements of impor-
tance to a domain Describes how these elements relate to one another
RDF Vocabulary: Describing the Data Metadata – data about data
– Same specification can be used with many different domain
Concept of metadata’s role– Relational database
Store many different types of data by using metadata structures
RDF Vocabulary: Describing the Data Metadata’s Role in Existing Applications (1/3)
Example
– Change the domain and the domain-specific storage con-structs become pretty useless
CUSTOMERPK CUSTOMER_I
D
CUSTOMER_ORDERPK,FK1PK,FK2
CUSTOMER IDORDER_ID
ORDERPK ORDER_ID
RDF Vocabulary: Describing the Data Metadata’s Role in Existing Applications (2/3)
Multiple uses of the same storage mechanism for dif -ferent domains– Relational database schema defines below
Database tables Primary and foreign key Columns
– Provide a domain-neutral description of information
Table 1 Table 2 Table 3 ….
customer
order Customer_order
table Col name1
Col name2 Col name3 ….
Order data count …customer
name Address …
Schema ta-ble
Schema column
RDF Vocabulary: Describing the Data Metadata’s Role in Existing Applications (3/3)
Same syntax for web resource– Don’t store information about a web resource in a domain-
specific XML element called WEB_PAGE– Store it on an rdf:Description element and use RDF to de-
fine the properties for this new resource
RDF Vocabulary: Describing the Data RDF Schema: Metadata Repository RDF Schema
– Provides the same functionality as the relational database schema
– Provides the resources necessary to describe the objects and properties of a domain-specific schemaVocabulary
It describes− Objects− Attributes− Relationships within a specific area of
interest
Core RDF Schema Elements RDF Schema elements
– Marked by a specific namespacexmlns:rdfs = “http://www.w3c.org/
2000/01/rdf-schema#”
Core RDF Schema ElementsOverview of the RDF Schema classes (1/6)
• All resources within RDF are implicitly members of this classrdfs:Resource
• Type or category of resourcerdfs:Class• Literals within RDF documents, such as text
stringsrdfs:Literal• Literals with RDf documents that use XML syn-
taxrdfs:XMLLiteral
• Superclass of all container classesrdfs:Container
• Members of containersrdfs:ContainerMembershipProperty
• Data typing informationrdfs:Datatype
Core RDF Schema ElementsOverview of the RDF Schema classes (2/6)
rdfs:Resource & rdfs:Class
– Every resource within an RDF document has a common an-cestor class
: rdf:resource
– All new resource types are identified by an rdfs:Class state-ment, including the rdfs:Resource element itself
<? Xml version=“1.0”?><rdf:RDF xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:pstcn=“http://buringbird.net/postcon/elements/1.0”> <rdf:Descriptoin rdf:about=“http://burningbird.net/articles/monsters3.htm”> <pstcn:author>Shelley Powers></pstcn:author> <pstcn:title>Architeuthis Dux</pstcn:title> <rdf:Description></rdf:RDF>
<rdfs:Class rdf:ID=“Article”> <rdfs:subClassOf rdf:resource=“http://www.w3.org/2000/01/rdf-schema#Resource/”></rdfs:Class>
Schema
Core RDF Schema ElementsOverview of the RDF Schema classes (3/6)
rdfs:Container– Superclass of all RDF container elements
rdf:Bag rdf:Seg rdf:Alt
rdfs:ContainerMembershipProperty– Resource is a member of a container
_1, _2, _3 and so on
Core RDF Schema ElementsOverview of the RDF Schema classes (4/6)
rdfs:Datatype– Class of all data types– Subclass of rdfs:Literal
rdfs:XMLLiteral– Allows to embed XML into the RDF/XML document
Subclass of rdfs:Literal Instance of rdfs:Datatype Class of all XML literals
Core RDF Schema ElementsOverview of the RDF Schema classes (5/6)
A few RDF classes– Cross the boundary between the metalanguage and in-
stances of the same• Include as member all reified RDF
statementsrdf:Statemen
t
• Used to group membersrdf:Bag, rdf:Seq, rdf:Alt
• Has members all RDF listsrdf:List
• Define the attributes that, in turn, describe the resourcerdf:Property
Core RDF Schema ElementsOverview of the RDF Schema classes (6/6)
RDF Schema for Article<? Xml version=“1.0”?><rdf:RDF xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:rdfs=“http://www.w3.org/2000/01/rdf-schema#” xmlns:pstcn=“http://buringbird.net/postcon/elements/1.0”>
<rdfs:Class rdf:about=“http://burningbird.net/postcon/elements/1.0/Article”> <rdfs:subClassOf rdf:resource=“http://www.w3.org/2000/01/rdf-schema#Resource”/> </rdfs:Class>
<rdf:Property rdf:about=“http://burningbird.net/postcon/elements/1.0/title”> <rdfs:domain rdf:resource=http://burningbird.net/postcon/elements/1.0/Article” /> </rdf:Property>
<rdf:Property rdf:about=“http://burningbird.net/postcon/elements/1.0/author”> <rdfs:domain rdf:resource=http://burningbird.net/postcon/elements/1.0/Article” /> </rdf:Property>
</rdf:RDF>
Core RDF Schema ElementsDemonstrations of the RDF Schema Properties (1/10)
Demonstrations of the RDF Schema Properties
RDF specifica-tion’s purpose
• Define resource and associated facts
• Provide a way to allow these resource/fact mappings to in-teract
RDF Schema spec-ification’s purpose
• Statement about each resource• Individual properties
Only difference between two One is instance of business data (such as Arti-
cle) The other is metadata ( related to the RDF
model)
Core RDF Schema ElementsDemonstrations of the RDF Schema Properties (2/10)
Core properties (from both the RDF and RDFS namespaces ) of RDF Schema rdfs:subClassOf rdfs:seeAlso rdfs:member rdfs:label rdf:subject rdf:object rdf:rest rdfs:range
rdfs:subPropertyOf rdfs:isDefinedBy rdfs:comment rdf:type rdf:predicate rdf:first rdfs:domain rdf:value
Core RDF Schema ElementsDemonstrations of the RDF Schema Properties (3/10)
rdfs:subClassOf– Identify a class that is a subclass of another
<rdfs:Class rdf:ID=“WebPage”> rdfs:subClassOf rdf:resource=“http://www.w3.org/2000/01/rdf-schema#Resource” /></rdfs:Class>
<rdfs:Class rdf:ID=“Article”> rdfs:subClassOf rdf:resource=“http://burningbird.net/schema#WebPage” /></rdfs:Class>
Core RDF Schema ElementsDemonstrations of the RDF Schema Properties (4/10)
rdfs:subPropertyOf<? Xml version=“1.0”?><rdf:RDF xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:rdfs=“http://www.w3.org/2000/01/rdf-schema#” xmlns:pstcn=“http://buringbird.net/postcon/elements/1.0”>
<rdfs:Class rdf:about=“http://burningbird.net/postcon/elements/1.0/Article”> <rdfs:subClassOf rdf:resource=“http://www.w3.org/2000/01/rdf-schema#Resource”/> </rdfs:Class>
<rdf:Property rdf:about=“http://burningbird.net/postcon/elements/1.0/title”> <rdfs:domain rdf:resource=http://burningbird.net/postcon/elements/1.0/Article” /> </rdf:Property>
<rdf:Property rdf:about=“http://burningbird.net/postcon/elements/1.0/author”> <rdfs:domain rdf:resource=http://burningbird.net/postcon/elements/1.0/Article” /> </rdf:Property>
<rdf:Property rdf:about=“http://burningbird.net/postcon/elements/1.0/primaryAuthor”> <rdfs:domain rdf:resource=“http://burningbird.net/postcon/elements/1.0/Article” /> <rdfs:subPropertyOf rdf:resource=“http://burningbird.net/postcon/elements/1.0/author” /> </rdf:Property>
<rdf:Property rdf:about=“http://burningbird.net/postcon/elements/1.0/secondaryAuthor”> <rdfs:domain rdf:resource=“http://burningbird.net/postcon/elements/1.0/Article” /> <rdfs:subPropertyOf rdf:resource=“http://burningbird.net/postcon/elements/1.0/au-thor” /> </rdf:Property>/rdf:RDF>
Core RDF Schema ElementsDemonstrations of the RDF Schema Properties (5/10)
rdfs:seeAlso– Another resource contains additional information<rdfs:Class rdf:about=“http://burningbird.net/postcon/elements/1.0/Article/History” > <rdfs:subClassOf rdf:resource=“http://www.w3.org/2000/01/rdf-schema#Resource” /></rdfs:Class>
<rdfs:Class rdf:about=“http://burningbird.net/postcon/elements/1.0/Article” > <rdfs:subClassOf rdf:resource=http://www.w3.org/2000/01/rdf-schema#Resource” /> <rdfs:seeAlso rdf:resource=“http://burningbird.net/postcon/elements/1.0/Article/History” /></rdfs:Class>
Core RDF Schema ElementsDemonstrations of the RDF Schema Properties (6/10)
rdfs:isDefinedBy– Identify the namespace for the resource
<rdfs:Class rdf:about="http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement” > <rdfs:isDefinedBy rdf:resource=“http://www.w3.org/1999/02/22-rdf-syntax-ns” /> <rdfs:label xml:lang=“en”>Statement</rdfs:label> <rdfs:subClassOf rdf:resource=“http://www.w3.org/2000/01/rdf-schema#Resource” /> <rdfs:comment>The class of RDF statement.</rdfs:comment></rdfs:Class>
<rdfs:Class rdf:about="http://www.w3.org/2000/01/rdf-schema#Literal” > <rdfs:isDefinedBy rdf:resource=“http://www.w3.org/2000/01/rdf-schema#” /> <rdfs:label xml:lang=“en”>Literal</rdfs:label> <rdfs:comment>This represents the set of atomic values, eg. Textual string</rdfs:comment></rdfs:Class>
Core RDF Schema ElementsDemonstrations of the RDF Schema Properties (7/10)
rdfs:member– Superproperty for each numbered container element
_1, _2, and so on
rdfs:comment– Provide human readability to an RDF model– Provide documentation of resources
rdfs:label– Provide a readable version of the resource’s name– Can attach xml:lang
Core RDF Schema ElementsDemonstrations of the RDF Schema Properties (8/10)
RDF Schema documentation elements<? xml version=“1.0”?><rdf:RDF xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:rdfs=“http://www.w3.org/2000/01/rdf-schema#” xmlns:pstcn=“http://buringbird.net/postcon/elements/1.0”>
<rdfs:Class rdf:about=“http://burningbird.net/postcon/elements/1.0/Article”> <rdfs:subClassOf rdf:resource=“http://www.w3.org/2000/01/rdf-schema#Resource”/> <rdfs:comment>Unique Online article</rdfs:comment> <rdfs:label xml:lang=“en”>Article</rdfs:label> </rdfs:Class>
<rdf:Property rdf:about=“http://burningbird.net/postcon/elements/1.0/title”> <rdf:type rdf:resource=“http://www.w3.org/2000/01/rdf-schema#Prpoerty” /> <rdfs:domain rdf:resource=“http://burningbird.net/postcon/elements/1.0/Article” /> <rdfs:comment>Online Article Title</rdfs:comment> <rdfs:label xml:lang=“en”>Article</rdfs:label> </rdf:Property>
<rdf:Property rdf:about=“http://burningbird.net/postcon/elements/1.0/author”> <rdf:type rdf:resource=“http://www.w3.org/2000/01/rdf-schema#Prpoerty” /> <rdfs:domain rdf:resource=“http://burningbird.net/postcon/elements/1.0/Article” /> <rdfs:comment>Primary author of article</rdfs:comment> <rdfs:label xml:lang=“en”>Author</rdfs:label> </rdf:Property></rdf:RDF>
Core RDF Schema ElementsDemonstrations of the RDF Schema Properties (9/10)
rdf:type– Define the type of resources– Usually assumed and is not explicitly given
<rdfs:Property rdf:about=“http://burningbird.net/postcon/elements/1.0/author” ><rdfs:domain rdf:resource=http://burningbird.net/postcon/elements/1.0/Article” /><rdfs:comment>Primary author of article</rdfs:comment><rdfs:label xml:lang=“en”>Author</rdfs:label><rdf:type rdf:resource=“http://www.w3.org/1999/02/22-rdf-schema#Property” />
</rdfs:Property>
Core RDF Schema ElementsDemonstrations of the RDF Schema Properties (10/10)
rdf:subject, rdf:predicate, rdf:object– Used with reification to explicitly define an RDF statement
rdf:first, rdf:rest– Explicitly define the relationships within a collection
Refining RDF Vocabularies with Constraints (1/2)
rdfs:domain– Associate a property with the resource– An RDF property can be used for more than one resource
type<? Xml version=“1.0”?><rdf:RDF xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:rdfs=“http://www.w3.org/2000/01/rdf-schema#” xmlns:pstcn=“http://buringbird.net/postcon/elements/1.0”>
<rdfs:Class rdf:about=“http://burningbird.net/postcon/elements/1.0/Article”> <rdfs:subClassOf rdf:resource=“http://www.w3.org/2000/01/rdf-schema#Resource”/> <rdfs:comment>Unique Online article</rdfs:comment> <rdfs:label xml:lang=“en”>Article</rdfs:label> </rdfs:Class>
<rdf:Property rdf:about=“http://burningbird.net/postcon/elements/1.0/title”> <rdf:type rdf:resource=http://www.w3.org/2000/01/rdf-schema#Prpoerty /> <rdfs:domain rdf:resource=“http://burningbird.net/postcon/elements/1.0/Article” /> <rdfs:comment>Online Article Title</rdfs:comment> <rdfs:label xml:lang=“en”>Article</rdfs:label> </rdf:Property>
<rdf:Property rdf:about=“http://burningbird.net/postcon/elements/1.0/author”> <rdf:type rdf:resource=http://www.w3.org/2000/01/rdf-schema#Prpoerty /> <rdfs:domain rdf:resource=“http://burningbird.net/postcon/elements/1.0/Article” /> <rdfs:comment>Primary author of article</rdfs:comment> <rdfs:label xml:lang=“en”>Author</rdfs:label> </rdf:Property></rdf:RDF>
Refining RDF Vocabularies with Constraints (2/2)
rdfs:range– Only one RDF range constraint can be attached to any prop-
erty– Can use a master class for a property (more than one data
type)<? Xml version=“1.0”?><rdf:RDF xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:rdfs=“http://www.w3.org/2000/01/rdf-schema#” xmlns:pstcn=“http://buringbird.net/postcon/elements/1.0”>
<rdfs:Class rdf:about=“http://burningbird.net/postcon/elements/1.0/WebPage”> <rdfs:subClassOf rdf:resource=“http://www.w3.org/2000/01/rdf-schema#Resource”/> </rdfs:Class>
<rdf:Class rdf:about=“http://burningbird.net/postcon/elements/1.0/Article”> <rdf:subClassOf rdf:resource=“http://burningbird.net/postcon/elements/1.0/WebPage” /> </rdf:Class>
<rdf:Class rdf:about=“http://burningbird.net/postcon/elements/1.0/Example”> <rdf:subClassOf rdf:resource=“http://burningbird.net/postcon/elements/1.0/WebPage” /> </rdf:Class>
<rdf:Class rdf:about=“http://burningbird.net/postcon/elements/1.0/Directory”> <rdf:subClassOf rdf:resource=“http://www.w3.org/2000/01/rdf-schema#Resource” /> </rdf:Class>
<rdf:Property rdf:about=“http://buringbird.net/postcon/elements/1.0/contains”> <rdf:domain rdf:resource=“http://burningbird.net/postcon/elements/1.0/Directory” /> <rdf:range rdf:resource=http://burningbird.net/postcon/elements/1.0/WebPage” /> </rdf:Property></rdf:RDF>
WebPage
ExampleArticle
Directorydomainrange
RDF Schema Alternatives (1/3)
DTD(Document Type Declarations) & XML Schema<!ELEMENT Items(item*)
<!ELEMENT item(productName, quantity, USPrice, comment? shipDate?)>
<!ATTLIST item partNum CDATA #REQUIRED>
<!ELEMENT productName (#PCDATA)>
<!ELEMENT quantity (#PCDATA)>
<!ELEMENT USPrice(#PCDATA)>
<!ELEMENT comment(#PCDATA)>
<!ELEMENT shipDate(#PCDATA)>
RDF Schema Alternatives (2/3)
DTD(Document Type Declarations) & XML Schema<xsd:element name=“Items”> <xsd:complexType name=“items”> <xsd:sequence> <xsd:element name=“item” minOccurs=“0” maxOccurs=“unbounded”> <xsd:complexType> <xsd:sequence> <xsd:element name=“productName” type=“xsd:string”/> <xsd:element name=“quantity”> <simpleType> <xsd:restriction base=“xsd:positiveInteger”> <xsd:maxExclusive value=“100”/> <xsd:restriction> </xsd:simpleType> </xsd:element> <xsd:element name=“USPrice” type=“xsd:decimal”/> <xsd:element name=“comment” minOccurs=“0”/> <xsd:element name=“shipDate” type=“xsd:date” minOccurs=“0”/> </xsd:sequence> <xsd:attribute name=“partNum” type=“SKU” use=“required” /> </complexType> </xsd:element> </xsd:sequence> </xsd:complxType></xsd:element>
RDF Schema Alternatives (3/3)
RELAX NG Compact Syntax– Combination of DTD readability and W3C XML Schema data
typingItems = element Items {item*}
Item = element item {att.partNum, productName, quantity, USPrice, com-ment?, shipDate? }
att.partNum = attribute partNum {text}
productName = element productName {text}
Quantity = element quantity {xsd:positiveInteger {maxExclusive=“100”}}
USPrice = element USPrice {xsd:decimal}
Comment = element comment {text}
shipDate = element shipDate {xsd:date}
Start = Items