atomic, i.e., they have no further set-theoretic struc-
ture. However, properties can be extended beyond
connecting atomic objects, i.e., to expressing relation-
ships between properties and atomic objects. This
process, carried out recursively, is called reification.
RDF(S) or RDF Schema is RDFs vocabulary descrip-
tion language. It has syntax to describe concepts
and resources using the meta-syntax of
rdfs:Class
,
rdf:type
, etc., and relationships between resources
through
rdf:property
. These meta classes are used
to specify properties of user defined schema. Details
of RDF/RDF(S) syntax and vocabulary descriptions
can be found in (Brickley and Guha, 2003).
A collection of RDF triples form a graph, i.e., if
the object of a triple is the subject of another triple,
then the two triples are merged together retaining the
common object only once (with one incoming edge
and one outgoing edge). Hayes and McBride (Hayes
and McBride, 2004) give semantics of RDF/RDF(S)
as RDF graphs (informally) using model theory. They
informally state an entailment relationship between
graphs. However, this semantics is lacking in sev-
eral respects. Firstly, they described containers such
as multisets and lists without semantics. As a remedy,
we provide rewrite rules for abstract data type (Har-
rison, 1993) for three collections, viz., sets, bags and
sequences and, correspondingly, extend RDF entail-
ments to include them.
3 CONTAINERS FORMALIZED
Sets, bags and sequences are abstract data types that
support a set of algebraic operations, described next.
In our formulation, a set is a collection of homoge-
neous base types (atomic or otherwise) that does not
allow duplicates or location ordering of its elements.
A bag, or a multi-set, on the other hand is a homoge-
neous collection that may contain duplicates. If T is a
type then we use the notation Bag[T] for the bag type
of objects of type T (respectively, Set[T] for sets). We
write x ∈ B to denote that x is an element in bag B (the
same notation is used for sets). In contrast to sets, the
multiplicity of an element in a bag is the number of
its repetitions in the bag (Grumbach and Milo, 1993;
Albert, 1991; Dayal et al., 1982; Kent, 1989; Mumick
et al., 1990). That is, modeled as a function, referred
to as profile function in the literature, mapping each
member of a bag B to its repetition count (a natural
number); represented in infix notation using the func-
tion symbol A. Thus, for x ∈ B, (x A B) ∈ N
+
(the set
of positive natural numbers). Size of a bag is given
by the number of objects in the bag, counting repe-
titions, and provides a basis for comparison amongst
bags based on their elements.
A sequence (Seq[T]) is a homogeneous collection
with linearly ordered members – an ordering based
on their, so called, location in the sequence. That is,
a function (called the ordering function) maps each
member of a sequence to the set N, represented by µ,
such that for no two distinct objects x, y of a sequence
S satisfies µ
S
(x) = µ
S
(y) (Our rewrite rules don’t
make explicit use of this function). In addition, two
functions head and tail return the first element and
rest of the elements of a sequence, i.e., first(S) = x iff
µ
S
(x) = 1 and last(S) = S’ iff µ
S
′
(y) = (µ
S
(y)−1), for
all y ∈ S, µ
S
(y) 6= 1. Next we provide algebraic specifi-
cations for the collection types (Harrison, 1993) using
the notation x : A for ‘x is of type A’.
Definition 1 (Basic algebra for sets of finite type)
Given base types T
i
(including boolean, N, etc.), the syntax
of operations on sets over T
i
(represented as Set[T
i
]) are:
Table 1: Set type.
Operation Type Name
{ x} T
i
→ Set[T
i
] Constructor
ins T
i
× Set[T
i
] → Set[T
i
] Insert
∪ Set[T
i
]× Set[T
i
] → Set[T
i
] Union
∩ Set[T
i
]× Set[T
i
] → Set[T
i
] Intersection
\ Set[T
i
]× Set[T
i
] → Set[T
i
] Minus
∈ T
i
× Set[T
i
] → boolean Membership
⊆ Set[T
i
]× Set[T
i
] → boolean Subset
== Set[T
i
]× Set[T
i
] → boolean Equality
rem T
i
× Set[T
i
] → Set[T
i
] Remove
cnt Set[T
i
] → N Cardinality
Properties of set (a) members, given a is of type Set[T
i
]:
x 6∈ {}
T
i
false
x ∈ a : Set[T
i
] ⇒ x : T
i
b : Set[T
i
] ⊂ a, x ∈ b ⇒ x : T
i
ins(x, a) : Set[T
i
] ⇒ x : T
i
rem(x,a) : Set[T
i
] ⇒ x : T
i
Axiomatic Semantics for operations on sets are as follows:
x ∈ ins(y, z) = true if x=y, x ∈ z otherwise
cnt({ }
T
i
) = 0
cnt(ins(x, z)) = 1+ cnt(z) i f x 6∈ z, cnt(z) otherwise
a ⊂ b = true i f (x ∈ a ⇒ x ∈ b)
false otherwise
a == b = a ⊂ b∧b ⊂ a
rem(x,z) = y such that x ∈ z∧ z = ins(x, y),
z otherwise
a\b = y such that x ∈ y ⇒ x ∈ a∧ x 6∈ b
a∩b = y such that x ∈ y ⇒ x ∈ a∧x ∈ b
a∪b = y such that x ∈ y ⇒ x ∈ a∨ x ∈ b
Basic bag algebra is presented next. Note that we
specify ‘additive union’ operation for bags instead of
WEBIST 2007 - International Conference on Web Information Systems and Technologies
92