6 Network Data Model Overview

6

Network Data Model Overview

This chapter explains the concepts and operations related to the Oracle Spatial network data model. It assumes that you are familiar with the following information:

  • The main topology concepts explained in Chapter 1, especially those related to nodes and links

  • The main Oracle Spatial concepts, data types, and operations, as documented in

Although this chapter discusses some network-related terms as they relate to Oracle Spatial, it assumes that you are familiar with basic network data modeling concepts.

This chapter contains the following major sections:

6.1

Introduction to Network Modeling

In many applications, capabilities or objects are modeled as nodes and links in a network. The network model contains logical information such as connectivity relationships among nodes and links, directions of links, and costs of nodes and links. With logical network information, you can analyze a network and answer questions, many of them related to path computing and tracing. For example, for a biochemical pathway, you can find all possible reaction paths between two chemical compounds; or for a road network, you can find the following information:

  • What is the shortest (distance) or fastest (travel time) path between two cities?

  • What is the closest hotel to a specific airport, and how can I get there?

In additional to logical network information, spatial information such as node locations and link geometries can be associated with the logical network. This information can help you to model the logical information (such as the cost of a route, because its physical length can be directly computed from its spatial representation).

The generic data model and network analysis capability can model and analyze many kinds of network applications in addition to traditional geographical information systems (GIS). For example, in biochemistry, applications may need to model reaction pathway networks for living organisms; and in the pharmaceutical industry, applications that model the drug discovery process may need to model protein-protein interaction.

The network modeling capabilities of Spatial include schema objects and an application programming interface (API). The schema objects include metadata and network tables. The API includes a server-side PL/SQL API (the SDO_NET package) for creating, managing, and analyzing networks in the database, and a middle-tier (or client-side) Java API for network analysis.

6.2

Main Steps in Using the Network Data Model

This section summarizes the main steps for working with the network data model in Oracle Spatial. It refers to important concepts, structures, and operations that are described in detail in other sections.

There are two basic approaches to creating a network:

  • Let Spatial perform most operations, using procedures with names in the form CREATE_<network-type>_NETWORK. (See Section 6.2.1.)

  • Perform the operations yourself: create the necessary network tables and update the network metadata. (See Section 6.2.2.)

With each approach, you must insert the network data into the network tables. You can then use the network data model PL/SQL and Java application programming interfaces (APIs) to update the network and perform other operations. (The PL/SQL and Java APIs are described in Section 6.8.)

6.2.1

Letting Spatial Perform Most Operations

To create a network by letting Spatial perform most of the necessary operations, follow these steps:

  1. Create the network using a procedure with a name in the form CREATE_<network-type>_NETWORK, where <network-type> reflects the type of network that you want to create:

    • SDO_NET.CREATE_SDO_NETWORK for a spatial network with non-LRS SDO_GEOMETRY objects

    • SDO_NET.CREATE_LRS_NETWORK for a spatial network with LRS SDO_GEOMETRY objects

    • SDO_NET.CREATE_TOPO_NETWORK for a spatial network with topology geometry (SDO_TOPO_GEOMETRY) objects

    • SDO_NET.CREATE_LOGICAL_NETWORK for a logical network

    Each of these procedures creates the necessary network data model tables (described in Section 6.6) and inserts a row with the appropriate network metadata information into the xxx_SDO_NETWORK_METADATA views (described in Section 6.7.1).

    Each procedure has two formats: one format creates all network data model tables using default names for the tables and certain columns, and other format lets you specify names for the tables and certain columns. The default names for the network data model tables are <network-name>_NODE$, <network-name>_LINK$, <network-name>_PATH$, and <network-name>_PLINK$. The default name for cost columns in the network data model tables is COST, and the default name for geometry columns is GEOMETRY.

  2. Insert data into the node and link tables, and if necessary into the path and path-link tables. (The node, link, path, and path-link tables are described in Section 6.6.)

  3. Validate the network, using the SDO_NET.VALIDATE_NETWORK procedure.

  4. For a spatial (SDO or LRS) network, insert the appropriate information into the USER_SDO_GEOM_METADATA view, and create spatial indexes on the geometry columns.

6.2.2

Performing the Operations Yourself

To create a network by performing the necessary operations yourself, follow these steps:

  1. Create the node table, using the SDO_NET.CREATE_NODE_TABLE procedure. (The node table is described in Section 6.6.1.)

  2. Insert data into the node table.

  3. Create the link table, using the SDO_NET.CREATE_LINK_TABLE procedure. (The link table is described in Section 6.6.2).

  4. Insert data into the link table.

  5. Optionally, create the path table, using the SDO_NET.CREATE_PATH_TABLE procedure. (The path table is described in Section 6.6.3).

  6. If you created the path table, create the path-link table, using the SDO_NET.CREATE_PATH_LINK_TABLE procedure. (The path-link table is described in Section 6.6.4).

  7. If you created the path table and if you want to create paths, insert data into the table.

  8. If you inserted data into the path table, insert the appropriate rows into the path-link table.

  9. Insert a row into the USER_SDO_NETWORK_METADATA view with information about the network. (The USER_SDO_NETWORK_METADATA view is described in Section 6.7.1.)

  10. For a spatial (SDO or LRS) network, insert the appropriate information into the USER_SDO_GEOM_METADATA view, and create spatial indexes on the geometry columns.

  11. Validate the network, using the SDO_NET.VALIDATE_NETWORK procedure.

You can change the sequence of some of these steps. For example, you can create both the node and link tables first, and then insert data into each one; and you can insert the row into the USER_SDO_NETWORK_METADATA view before you create the node and link tables.

6.3

Network Data Model Concepts

A network is a type of mathematical graph that captures relationships between objects using connectivity. The connectivity may or may not be based on spatial proximity. For example, if two towns are on opposite sides of a lake, the shortest path based on spatial proximity (a straight line across the middle of the lake) is not relevant if you want to drive from one town to the other. Instead, to find the shortest driving distance, you need connectivity information about roads and intersections and about the “cost” of individual links.

A network consists of a set of nodes and links. Each link (sometimes also called an edge or a segment) specifies two nodes. A network can be directed or undirected, although links and paths typically have direction.

The following are some key terms related to the network data model:

  • A node represents an object of interest.

  • A link represents a relationship between two nodes. A link may be directed (that is, have a direction) or undirected (that is, not have a direction).

  • A path is an alternating sequence of nodes and links, beginning and ending with nodes, and usually with no nodes and links appearing more than once. (Repeating nodes and links within a path are permitted, but are rare in most network applications.)

  • A network is a set of nodes and links. A network is directed if the links that is contains are directed, and a network is undirected if the links that it contains are undirected.

  • A logical network contains connectivity information but no geometric information. This is the model used for network analysis. A logical network can be treated as a directed graph or undirected graph, depending on the application.

  • A spatial network contains both connectivity information and geometric information. In a spatial network, the nodes and links are SDO_GEOMETRY geometry objects without LRS information (an SDO network) or with LRS information (an LRS network), or SDO_TOPO_GEOMETRY objects (a topology geometry network).

    In an LRS network, each node includes a geometry ID value and a measure value, and each link includes a geometry ID value and start and end measure values; and the geometry ID value in each case refers to an SDO_GEOMETRY object with LRS information. A spatial network can be directed or undirected, depending on the application.

  • A feature is an object of interest in a network application that is associated with a node or link. For example, in a transportation network, features include exits and intersections (mapped to nodes), and highways and streets (mapped to links).

  • Cost is a non-negative numeric attribute that can be associated with links or nodes for computing the minimum cost path, which is the path that has the minimum total cost from a start node to an end node. You can specify a single cost factor, such as driving time or driving distance for links, in the network metadata.

  • Reachable nodes are all nodes that can be reached from a given node. Reaching nodes are all nodes that can reach a given node.

  • The degree of a node is the number of links to (that is, incident upon) the node. The in-degree is the number of inbound links, and the out-degree is the number of outbound links.

  • Network constraints are restrictions defined on network analysis computations (for example, that driving routes must consist of expressways and major highways).

  • A spanning tree of a connected graph is a tree (that is, a graph with no cycles) that connects all nodes of the graph. (The directions of links are ignored in a spanning tree.) The minimum cost spanning tree is the spanning tree that connects all nodes and has the minimum total cost.

6.4

Network Applications

Networks are used in applications to find how different objects are connected to each other. The connectivity is often expressed in terms of adjacency and path relationships. Two nodes are adjacent if they are connected by a link. There are often several paths between any two given nodes, and you may want to find the path with the minimum cost.

This section describes some typical examples of different kinds of network applications.

6.4.1

Road Network Example

In a typical road network, the intersections of roads are nodes and the road segments between two intersections are links. The spatial representation of a road is not inherently related to the nodes and links in the network. For example, a shape point in the spatial representation of a road (reflecting a sharp turn in the road) is not a node in the network if that shape point is not associated with an intersection; and a single spatial object may make up several links in a network (such as a straight segment intersected by three crossing roads). An important operation with a road network is to find the path from a start point to an end point, minimizing either the travel time or distance. There may be additional constraints on the path computation, such as having the path go through a particular landmark or avoid a particular intersection.

6.4.2

Train (Subway) Network Example

The subway network of any major city is probably best modeled as a logical network, assuming that precise spatial representation of the stops and track lines is unimportant. In such a network, all stops on the system constitute the nodes of the network, and a link is the connection between two stops if a train travels directly between these two stops. Important operations with a train network include finding all stations that can be reached from a specified station, finding the number of stops between two specified stations, and finding the travel time between two stations.

6.4.3

Utility Network Example

Utility networks, such as power line or cable networks, must often be configured to minimize the cost. An important operation with a utility network is to determine the connections among nodes, using minimum cost spanning tree algorithms, to provide the required quality of service at the minimum cost. Another important operation is reachability analysis, so that, for example, if a station in a water network is shut down, you know which areas will be affected.

6.4.4

Biochemical Network Example

Biochemical processes can be modeled as biochemical networks to represent reactions and regulations in living organisms. For example, metabolic pathways are networks involved in enzymatic reactions, while regulatory pathways represent protein-protein interactions. In this example, a pathway is a network; genes, proteins, and chemical compounds are nodes; and reactions among nodes are links. Important operations for a biochemical network include computing paths and the degrees of nodes.

6.5

Network Hierarchy

Some network applications require representations at different levels of abstraction. For example, two major processes might be represented as nodes with a link between them at the highest level of abstraction, and each major process might have several subordinate processes that are represented as nodes and links at the next level down.

A network hierarchy allows you to represent a network with multiple levels of abstraction by assigning a hierarchy level to each node. (Links are not assigned a hierarchy level, and links can be between nodes in the same hierarchy level or in different levels.) The lowest (most detailed) level in the hierarchy is level 1, and successive higher levels are numbered 2, 3, and so on.

Nodes at adjacent levels of a network hierarchy have parent-child relationships. Each node at the higher level can be the parent node for one or more nodes at the lower level. Each node at the lower level can be a child node of one node at the higher level.

Links can also have parent-child relationships. However, because links are not assigned to a hierarchy level, there is not necessarily a relationship between link parent-child relationships and network hierarchy levels.

Figure 6-1 shows a simple hierarchical network, in which there are two levels.

Figure 6-1 Network Hierarchy

Description of net_hier.gif follows
Description of the illustration net_hier.gif

As shown in Figure 6-1:

  • The top level (level 2) contains two nodes. Each node is the parent node of several nodes in the bottom level. The link between the nodes in the top level is the parent link of two links between nodes in the bottom level.

  • The bottom level (level 1) shows the nodes that make up each node in the top level. It also shows the links between nodes that are child nodes of each parent node in the top level, and two links between nodes that have different parent nodes.

  • The links between nodes in the bottom level that have different parent nodes are shown with dark connecting lines. These links are child links of the single link between the nodes in the top level in the hierarchy. (However, these two links in the bottom level could also be defined as not being child links of any parent link between nodes in a higher level.)

  • The parent-child relationships between each parent node and link and its child nodes and links are shown with dashed lines with arrowheads at both ends.

Although it is not shown in Figure 6-1, links can cross hierarchy levels. For example, a link could be defined between a node in the top level and any node in the bottom level. In this case, there would not be a parent-child relationship between the links.

6.6

Network Data Model Tables

The connectivity information for a spatial network is stored in two tables: a node table and a link table. In addition, path information can be stored in a path table and a path-link table. You can have Spatial create these tables automatically when you create the network using a CREATE_<network-type>_NETWORK procedure; or you can create these tables using the SDO_NET.CREATE_NODE_TABLE, SDO_NET.CREATE_LINK_TABLE, SDO_NET.CREATE_PATH_TABLE, and SDO_NET.CREATE_PATH_LINK_TABLE procedures.

These tables contain columns with predefined names, and you must not change any of the predefined column names; however, you can add columns to the tables by using the ALTER TABLE statement with the ADD COLUMN clause. For example, although each link and path table is created with a single COST column, you can create additional columns and associate them with other comparable attributes. For example, if you wanted to assign a driving time, scenic appeal rating, and a danger rating to each link, you could use the COST column for driving time, add columns for SCENIC_APPEAL and DANGER to the link table, and populate all three columns with values to be interpreted by applications.

6.6.1

Node Table

Each network has a node table that can contain the columns described in Table 6-1. (The specific columns depend on the network type and whether the network is hierarchical or not.)

Table 6-1 Node Table Columns

Column Name
Data Type
Description

NODE_ID
NUMBER
ID number that uniquely identifies this node within the network.

NODE_NAME
VARCHAR2(32)
Name of the node.

NODE_TYPE
VARCHAR2(24)
User-defined string to identify the node type.

ACTIVE
VARCHAR2(1)
Contains Y if the node is active (visible in the network), or N if the node is not active.

PARTITION_ID
NUMBER
Reserved for future use.

<node_geometry_column>, or GEOM_ID and MEASURE
SDO_GEOMETRY, or SDO_TOPO_GEOMETRY, or NUMBER
For a spatial (SDO, non-LRS) network, name of the SDO_GEOMETRY column containing the geometry objects associated with the node.

For a spatial topology network, name of the SDO_TOPO_GEOMETRY column containing the topology geometry objects associated with the node.

For a spatial LRS network, GEOM_ID and MEASURE columns (both of type NUMBER) for the geometry objects associated with the node.

For a logical network, this column is not used.

For a spatial SDO or topology network, the actual column name is either a default name or what you specified as the geom_column parameter value in the call to the SDO_NET.CREATE_NODE_TABLE procedure.

<node_cost_column>
NUMBER
Name of the column containing the cost value to be associated with the node, for use by applications that use the network. The actual column name is either a default name or what you specified as the cost_column parameter value in the call to the SDO_NET.CREATE_NODE_TABLE procedure. The cost value can represent anything you want, for example, the toll to be paid at a toll booth.

HIERARCHY_LEVEL
NUMBER
For hierarchical networks only: number indicating the level in the network hierarchy for this node. (Section 6.5 explains network hierarchy.)

PARENT_NODE_ID
NUMBER
For hierarchical networks only: node ID of the parent node of this node. (Section 6.5 explains network hierarchy.)

6.6.2

Link Table

Each network has a link table that contains the columns described in Table 6-2.

Table 6-2 Link Table Columns

Column Name
Data Type
Description

LINK_ID
NUMBER
ID number that uniquely identifies this link within the network.

LINK_NAME
VARCHAR2(32)
Name of the link.

START_NODE_ID
NUMBER
Node ID of the node that starts the link.

END_NODE_ID
NUMBER
Node ID of the node that ends the link.

LINK_TYPE
VARCHAR2(24)
User-defined string to identify the link type.

ACTIVE
VARCHAR2(1)
Contains Y if the link is active (visible in the network), or N if the link is not active.

LINK_LEVEL
NUMBER
Priority level for the link; used for hierarchical modeling, so that links with higher priority levels can be considered first in computing a path.

<link_geometry_column>; or GEOM_ID, START_MEASURE, and END_MESURE
SDO_GEOMETRY, or SDO_TOPO_GEOMETRY, or NUMBER
For a spatial (SDO, non-LRS) network, name of the SDO_GEOMETRY column containing the geometry objects associated with the link.

For a spatial topology network, name of the SDO_TOPO_GEOMETRY column containing the topology geometry objects associated with the link.

For a spatial LRS network, GEOM_ID, START_MEASURE, and END_MEASURE columns (all of type NUMBER) for the geometry objects associated with the link.

For a logical network, this column is not used.

For a spatial SDO or topology network, the actual column name is either a default name or what you specified as the geom_column parameter value in the call to the SDO_NET.CREATE_LINK_TABLE procedure.

<link_cost_column>
NUMBER
Name of the column containing the cost value to be associated with the link, for use by applications that use the network. The actual column name is either a default name or what you specified as the cost_column parameter value in the call to the SDO_NET.CREATE_LINK_TABLE procedure. The cost value can represent anything you want, for example, the estimated driving time for the link.

PARENT_LINK_ID
NUMBER
For hierarchical networks only: link ID of the parent link of this link. (Section 6.5 explains parent-child relationships in a network hierarchy.)

6.6.3

Path Table

Each network can have a path table. A path is an ordered sequence of links, and is usually created as a result of network analysis. A path table provides a way to store the result of this analysis. For each path table, you must create an associated path-link table (described in Section 6.6.4). Each path table contains the columns described in Table 6-3.

Table 6-3 Path Table Columns

Column Name
Data Type
Description

PATH_ID
NUMBER
ID number that uniquely identifies this path within the network.

PATH_NAME
VARCHAR2(32)
Name of the path.

START_NODE_ID
NUMBER
Node ID of the node that starts the first link in the path.

END_NODE_ID
NUMBER
Node ID of the node that ends the last link in the path.

PATH_TYPE
VARCHAR2(24)
User-defined string to identify the path type.

COST
NUMBER
Cost value to be associated with the path, for use by applications that use the network. The cost value can represent anything you want, for example, the estimated driving time for the path.

SIMPLE
VARCHAR2(1)
Contains Y if the path is a simple path, or N if the path is a complex path. In a simple path, the links form an ordered list that can be traversed from the start node to the end node with each link visited once. In a complex path, there are multiple options for going from the start node to the end node.

<path_geometry_column>
SDO_GEOMETRY
For all network types except logical, name of the column containing the geometry object associated with the path. The actual column name is either a default name or what you specified as the geom_column parameter value in the call to the SDO_NET.CREATE_PATH_TABLE procedure.

For a logical network, this column is not used.

6.6.4

Path-Link Table

For each path table (described in Section 6.6.3), you must create a path-link table. Each row in the path-link table uniquely identifies a link within a path in a network. The order of rows in the path-link table is not significant. Each path-link table contains the columns described in Table 6-4.

Table 6-4 Path-Link Table Columns

Column Name
Data Type
Description

PATH_ID
NUMBER
ID number of the path in the network.

LINK_ID
NUMBER
ID number of the link in the network. Each combination of PATH_ID and LINK_ID must be unique within the network.

SEQ_NO
NUMBER
Unique sequence number of the link in the path. (The sequence numbers start at 1.) Sequence numbers allow paths to contain repeating nodes and links.

6.7

Network Data Model Metadata Views

There is a set of network metadata views for each schema (user): xxx_SDO_NETWORK_METADATA, where xxx can be USER or ALL. These views are created by Spatial.

6.7.1

xxx_SDO_NETWORK_METADATA Views

The following views contain information about networks:

  • USER_SDO_NETWORK_METADATA contains information about all networks owned by the user.

  • ALL_SDO_NETWORK_METADATA contains information about all networks on which the user has SELECT permission.

If you create a network using one of the CREATE_<network-type>_NETWORK procedures, the information in these views is automatically updated to reflect the new network; otherwise, you must insert information about the network into the USER_SDO_NETWORK_METADATA view.

The USER_SDO_NETWORK_METADATA and ALL_SDO_NETWORK_METADATA views contain the same columns, as shown Table 6-5, except that the USER_SDO_NETWORK_METADATA view does not contain the OWNER column. (The columns are listed in their order in the view definition.)

Table 6-5 Columns in the xxx_SDO_NETWORK_METADATA Views

Column Name
Data Type
Purpose

OWNER
VARCHAR2(32)
Owner of the network. (ALL_SDO_NETWORK_METADATA view only.)

NETWORK
VARCHAR2(32)
Name of the network.

NETWORK_CATEGORY
VARCHAR2(12)
Contains SPATIAL if the network nodes and links are associated with spatial geometries; contains LOGICAL if the network nodes and links are not associated with spatial geometries.

GEOMETRY_TYPE
VARCHAR2(20)
If NETWORK_CATEGORY is SPATIAL, contains a value indicating the geometry type of nodes and links: SDO_GEOMETRY for non-LRS SDO_GEOMETRY objects, LRS_GEOMETRY for LRS SDO_GEOMETRY objects, TOPO_GEOMETRY for SDO_TOPO_GEOMETRY objects.

NETWORK_TYPE
VARCHAR2(24)
User-defined string to identify the network type.

NO_OF_HIERARCHY_LEVELS
NUMBER
Number of levels in the network hierarchy. Contains 1 if there is no hierarchy. (See Section 6.5 for information about network hierarchy.)

NO_OF_PARTITIONS
NUMBER
(Must be 1 for the current release. Other values may be supported in future releases.)

LRS_TABLE_NAME
VARCHAR2(12)
If GEOMETRY_TYPE is SDO_GEOMETRY, contains the name of the table containing geometries associated with nodes.

LRS_GEOM_COLUMN
VARCHAR2(12)
If LRS_TABLE_NAME contains a table name, identifies the geometry column in that table.

NODE_TABLE_NAME
VARCHAR2(32)
If GEOMETRY_TYPE is SDO_GEOMETRY, contains the name of the table containing geometries associated with nodes. (The node table is described in Section 6.6.1.)

NODE_GEOM_COLUMN
VARCHAR2(32)
If NODE_TABLE_NAME contains a table name, identifies the geometry column in that table.

NODE_COST_COLUMN
VARCHAR2(32)
If NODE_TABLE_NAME contains a table name, identifies the cost column in that table.

LINK_TABLE_NAME
VARCHAR2(32)
If GEOMETRY_TYPE is SDO_GEOMETRY, contains the name of the table containing geometries associated with links. (The link table is described in Section 6.6.2.)

LINK_GEOM_COLUMN
VARCHAR2(32)
If LINK_TABLE_NAME contains a table name, identifies the geometry column in that table.

LINK_DIRECTION
VARCHAR2(12)
Contains a value indicating the type for all links in the network: UNDIRECTED or DIRECTED.

LINK_COST_COLUMN
VARCHAR2(32)
If LINK_TABLE_NAME contains a table name, identifies the optional numeric column containing a cost value for each link.

PATH_TABLE_NAME
VARCHAR2(32)
Contains the name of an optional table containing information about paths. (The path table is described in Section 6.6.3.)

PATH_GEOM_COLUMN
VARCHAR2(32)
If PATH_TABLE_NAME is associated with a spatial network, identifies the geometry column in that table.

PATH_LINK_TABLE_NAME
VARCHAR2(32)
Contains the name of an optional table containing information about links for each path. (The path-link table is described in Section 6.6.4.)

PARTITION_TABLE_NAME
VARCHAR2(32)
Reserved for future use.