Semantic Interaction in Web-based Retrieval Systems: Adopting Semantic Web Technologies and Social Networking Paradigms for Interacting with Semi-structured Web Data

ing from the content embedded in HTML and regarding each content element simply as a text or a bachelor tag, a tree abstraction for an HTML document can be obtained. The HTML tree consists of a root element, internal nodes (having tag names and tag attributes) that are HTML tags and leaf elements that can be text strings (PCDATA) or bachelor tags that have no closing tag in the HTML specification, which is in contrast to the XHTML specification where each opening tag must have a corresponding closing tag. The children of a node can be accessed using their labels or respective indices. The leaf elements can be reached by traversing along the path from the root to a leaf element. Paths that identify leaf elements can be represented as a list with the root as the first element. XHTML trees as well as XML trees can be modeled as unranked trees (Neven, 2002, Libkin, 2005) over a finite alphabet Σ following the definition provided below: Definiton 2.1. (XML as unranked ordered tree = Σ-tree). The set of Σ-trees, denoted by τΣ, is inductively defined as follows:  every σ ∈ Σ is a Σ-tree; (every tag/node is a tree)  if σ ∈ Σ and t1, . , tn ∈ τΣ, n≥1 then σ(t1, ., tn) is a Σ-tree. For every tree t ∈ τΣ, the set of nodes of t, denoted by Dom(t), is the subset of N∗ (the set of strings over the alphabet consisting of the natural numbers) defined as follows:  if t = σ(t1, ., tn) with σ ∈ Σ, n≥0, and t1, . , tn ∈ τΣ, then Dom(t) = {ε} ∪ {ui | i ∈ {1,. ,n}, u ∈ Dom(ti)}. XHTML is based on XML (a subset of SGML), while HTML was originally defined via SGML as its application. Consider, that the alphabet is only known if a schema is available, e.g. as DTD, XSD. As there is no a priori bound on the number of children of a node in a Σ-tree; such trees are therefore unranked. 20 CHAPTER 2. BASICS Thus, ε represents the root while ui represents the i-th child of u. Finally, labels can be assigned via a respective mapping, lab(u) as the label of u in t. Example 2.1. The domain of the HTML core tree (no leaves) shown graphically in Figure 2.1 (right) can be represented following the definitions above as a Σ-tree, here in list-form: {{ε}, {1}, {11}, {2}, {21}, {22}, {23}, {231},. }. Although relying on a finite alphabet is a restriction regarding XML representations, for HTML, which is based on a finite set of tag elements, this representation fits well. Definiton 2.2. (Binary relations in unranked trees.) Nodes in unranked trees are elements of N*, i.e. finite strings whose letters are natural numbers. A string s = n0n1,. defines a path from the root to a given node. The string s is built by applying string concatenation (dot operator) to the natural numbers ni ∈ N*. Then, basic binary relations on N* can be defined as:  child: s <child s’ ⇔ s’ = s · i for some i ∈ N  next sibling: s <nextsibling s’ ⇔ s’ = s0· i and s’ = s0 · (i+1) for some s0 ∈ N* and i ∈ N  first child: s <firstchild s ·0 From the algorithmic perspective such a tree can be created from the linear-scanned HTML source code by applying depth-first search and the