Labeled directed graphs and their representation as extended links were introduced earlier. In this chapter we study a special type of labeled digraph called entity-relationship graphs or E-R graphs.
An E-R graph has two types of nodes: resources (boxes) and literals (ellipses). An arc points from a resource node to a literal node or to another resource node. Resources represent objects and are labeled by URIs. Arcs represent properties. A property is either a relationship to another resource or an attribute. Literals represent attribute values.
Here's a sample E-R graph:
This graph represents three facts:
Intro to Programming is a 3 unit course.
The instructor of Intro to Programming is Smith.
The rank of Smith is Professor.
The Resource Description Framework (RDF) is an XML language that allows us to represent E-R graphs. The first step is to assign a URI to each resource. There are several ways to do this.
It might be the case that Intro to Programming and Prof. Smith have web pages:
http://www.uoa.edu/courses/introToProg.html
http://www.uoa.edu/facluty/smith.html
In this case we can use the URLs of these web pages.
University of
http://www.uoa.edu/ontology/introToProg
http://www.uoa.edu/ontology/smith
Fragmented identifiers can also be used:
http://www.uoa.edu/ontology#cs46
http://www.uoa.edu/ontology#fac3420
An RDF document is a collection of descriptions. Each description describes a resource. The content of a description represent the resource's properties. Here's the beginning of an RDF serialization of our E-R graph:
<?xml version = "1.0"?>
<rdf:RDF
xmlns:uoa =
"http://www.uoa.edu"
xmlns:rdf =
"http:www.w3c.org/1999//02/22/22-rdf-syntax-ns#">
<rdf:description about =
"http://www.uoa.edu/courses/introToProg.html">
</rdf:description>
<rdf:description about =
"http://www.uoa.edu/faculty/smith.html">
</rdf:description>
</rdf:RDF>
Here's the format of a description:
<rdf:description about = "URI">
<!-- properties of this resource go
here -->
</rdf:description>
Any XML element can be a property. Generally, the tag corresponds to the property and the content corresponds to the value of the property.
If the value of a property is another resource, we can use the resource attribute to specify the URI.
Next we add a our properties to courses.xml:
<?xml version = "1.0"?>
<rdf:RDF
xmlns = "http://www.uoa.edu"
xmlns:rdf =
"http:www.w3c.org/1999//02/22/22-rdf-syntax-ns#">
<rdf:description about =
"http://www.uoa.edu/courses/introToProg.html">
<units> 3 </units>
<instructor rdf:resource =
"http://www.uoa.edu/faculty/smith.html"/>
</rdf:description>
<rdf:description about =
"http://www.uoa.edu/faculty/smith.html">
<rank> Professor </rank>
</rdf:description>
</rdf:RDF>
Here's another version that uses node identifiers:
<?xml version = "1.0"?>
<rdf:RDF
xmlns = "http://www.uoa.edu"
xmlns:rdf =
"http:www.w3c.org/1999//02/22/22-rdf-syntax-ns#">
<rdf:description rdf:nodeID =
"cs46">
<units> 3 </units>
<instructor rdf:nodeID =
"fac2450"/>
</rdf:description>
<rdf:description rdf:nodeID =
"fac2450">
<rank> Professor </rank>
</rdf:description>
</rdf:RDF>
It's easy to represent class hierarchies using E-R graphs:
Using RDF Schema (RDF-S) we can translate this diagram into an XML document:
<?xml version = "1.0"?>
<rdf:RDF
xmlns = "http://www.uoa.edu"
xmlns:rdf =
"http:www.w3c.org/1999//02/22/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
<rdf:Description
rdf:ID="Course">
<rdf:type rdf:resource=
"http://www.w3.org/2000/01/rdf-schema#Class"/>
</rdf:Description>
<rdf:Description
rdf:ID="Lecture">
<rdf:type rdf:resource=
"http://www.w3.org/2000/01/rdf-schema#Class"/>
<rdfs:subClassOf
rdf:resource="#Course"/>
</rdf:Description>
<rdf:Description
rdf:ID="Instructor">
<rdf:type rdf:resource=
"http://www.w3.org/2000/01/rdf-schema#Class"/>
</rdf:Description>
<rdf:Description rdf:ID="Professor">
<rdf:type rdf:resource=
"http://www.w3.org/2000/01/rdf-schema#Class"/>
<rdfs:subClassOf
rdf:resource="#Instructor"/>
</rdf:Description>
</rdf:RDF>
In this example we used the rdf:type attribute to indicate that the types of our resources were classes. We can also use the type attribute to declare the types of our resources:
Here's the XML version:
<?xml version = "1.0"?>
<rdf:RDF
xmlns = "http://www.uoa.edu"
xmlns:rdf =
"http:www.w3c.org/1999//02/22/22-rdf-syntax-ns#">
<rdf:description rdf:nodeID =
"cs46">
<units> 3 </units>
<instructor rdf:nodeID =
"fac2450"/>
<rdf:type rdf:resource=
"http://www.uoa.edu/schemas/classes#Lecture"/>
</rdf:description>
<rdf:description rdf:nodeID =
"fac2450">
<rank> Professor </rank>
<rdf:type rdf:resource=
"http://www.uoa.edu/schemas/classes#Professor"/>
</rdf:description>
</rdf:RDF>
Alternatively, we could use classes as tags:
<?xml version = "1.0"?>
<rdf:RDF
xmlns = "http://www.uoa.edu"
xmlns:rdf = "http:www.w3c.org/1999//02/22/22-rdf-syntax-ns#">
<Lecture rdf:nodeID =
"cs46">
<units> 3 </units>
<instructor rdf:nodeID =
"fac2450"/>
</Lecture >
<Professor rdf:nodeID =
"fac2450">
<rank> Professor </rank>
</Professor>
</rdf:RDF>
In UML objects are instances of classes, and the links between objects are instances of associations. We have already seen how we can declare classes in RDF-S and assert that a resource is an instance of a class. We can also declare associations in RDF-S:
<rdf:description rdf:ID = "Property">
<rdf:type rdf:resource
="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"/>
<rdfs:domain
rdf:resource="#Class1"/>
<rdfs:range
rdf:resource="#Class2"/>
</rdf:Description>
We can add the following descriptions to classes.xml:
<rdf:Description rdf:ID="teaches">
<rdf:type rdf:resource=
"http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"/>
<rdfs:domain
rdf:resource="#Course"/>
<rdfs:range
rdf:resource="#Instructor"/>
</rdf:Description>
<rdf:Description rdf:ID="units">
<rdf:type rdf:resource=
"http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"/>
<rdfs:domain
rdf:resource="#Course"/>
<rdfs:range rdf:resource=
"http://www.w3.org/2001/XMLSchema#integer"/>
</rdf:Description>
<?xml version = "1.0"?>
<rdf:RDF
xmlns = "http://www.uoa.edu"
xmlns:rdf =
"http:www.w3c.org/1999//02/22/22-rdf-syntax-ns#">
<Lecture rdf:nodeID =
"cs46">
<units> 3 </units>
<teaches rdf:nodeID =
"fac2450"/>
</Lecture >
<Professor rdf:nodeID =
"fac2450">
<rank> Professor </rank>
</Professor>
</rdf:RDF>
<rdf:RDF
xmlns:rdf =
"http://www.w3c.org/1999//02/22/22-rdf-syntax-ns#">
<rdf:Description about =
"http://www.demo.com/smith.html"
<created-on> Jan 1, 1998
</created-on>
<created-by
rdf:nodeID = "j1"/>
</rdf:Description>
<rdf:Description about =
"http://www.demo.com/jones.html"
<created-on> Jan 2, 1998
</created-on>
<created-by
rdf:nodeID = "j1"/>
</rdf:Description>
<rdf:Description rdf:nodeID =
"j1">
<name> Johnson </name>
<homePage rdf:resource =
"http://www.demo.com/Johnson.html"/>
</rdf:Description>
</rdf:RDF>
<rdf:RDF
xmlns:rdf =
"http://www.w3c.org/1999//02/22/22-rdf-syntax-ns#">
<rdf:Description about =
"http://www.demo.com/smith.html"
<created-on
rdf:dataType = "http://www.w3.org/2001/XMLSchema#date">
1998-1-16
</created-on>
<created-by
rdf:nodeID = "j1"/>
</rdf:Description>
<rdf:Description about =
"http://www.demo.com/jones.html"
<created-on
rdf:dataType = "http://www.w3.org/2001/XMLSchema#date">
1998-1-2
</created-on>
<created-by
rdf:nodeID = "j1"/>
</rdf:Description>
<rdf:Description rdf:nodeID =
"j1">
<name> Johnson </name>
<homePage rdf:resource =
"http://www.demo.com/Johnson.html"/>
</rdf:Description>
</rdf:RDF>
<rdf:RDF
xmlns:rdf =
"http://www.w3c.org/1999//02/22/22-rdf-syntax-ns#">
<rdf:Description about =
"#employee10"
<created-on
rdf:dataType = "http://www.w3.org/2001/XMLSchema#date">
1998-1-16
</created-on>
<created-by
rdf:nodeID = "j1"/>
</rdf:Description>
<rdf:Description about =
"#employee13"
<created-on
rdf:dataType = "http://www.w3.org/2001/XMLSchema#date">
1998-1-2
</created-on>
<created-by
rdf:nodeID = "j1"/>
</rdf:Description>
<rdf:Description rdf:nodeID =
"employee17">
<name> Johnson </name>
<homePage rdf:resource =
"http://www.demo.com/Johnson.html"/>
</rdf:Description>
</rdf:RDF>
http://www.demo.com/site#employee13
<rdf:Bag>
<!-- element resources go here
-->
</rdf:Bag>
rdf:Seq
rdf:Alt
An application domain is a real-world context of some application. Hospital, School, Government, Business, etc. are all application domains.
An ontology is a model of an application domain. It specifies:
terms
classes and objects
relationships and links
rules and facts
constraints
An ontology sits in the middle of a spectrum of domain models:
Domain Theory (rules)
Ontology (rules, constraints, )
E-R Models (objects, classes, relationships, schemas)
Thesaurus (terms, synonyms, hypernyms, hyponyms)
Taxonomies and Partonomic Hierarchies (is-a, is-part-of)
We have seen that RDF and RDF-S allow us to represent E-R models as XML documents. Particular combinations of classes, and relationships between them can be expressed in XML using OWL (Ontology Web Language). OWL has roughly the same expressive strength as UML. RuleML and other XML languages are being proposed for representing Domain theories.