Oracle® Spatial Java API Reference
10g Release 2 (10.2)

B14373-02


oracle.spatial.network
Class NetworkManager

java.lang.Object
  extended by oracle.spatial.network.NetworkManager


public class NetworkManager
extends java.lang.Object

This class defines methods for the network data I/O and network analysis.


Method Summary
static Path[] allPaths(Network network, int startNodeID, int goalNodeID, int depthLimit, double costLimit, int noOfSolutions)
          Returns all paths between the start node and the goal node.
static Path[] allPaths(Network network, int startNodeID, int goalNodeID, NetworkConstraint constraint, int noOfSolutions)
          Returns all paths between the start node and the goal node.
static Path[] allPaths(Network network, int startNodeID, int goalNodeID, NetworkConstraint constraint, int noOfSolutions, oracle.spatial.network.AStarCostFunction costFunction, double searchMultiplier)
          Returns all paths between the start node and the goal node.
static Path[] allPaths(Path complexPath, int depthLimit, double costLimit, int noOfSolutions)
          Returns all paths between the start node and the goal node of the complex path.
static void clearNetworkCache()
          Clears the network cache
static void createNetworkHiearchy(Network network, int numHierarchy, int[] ndNumLevel)
          Creates a network hiearchy with the given number of levels.
static void createNetworkPartitionTable(java.sql.Connection conn, java.lang.String partitionTableName)
          Creates a network partition table.
static void createRefConstraints(java.sql.Connection conn, java.lang.String networkName)
          Creates the referential constraints on the link and the path tables.
static void deregisterNetworkConstraint(java.sql.Connection conn, java.lang.String networkConstraintName)
          Deregister given constraint from user_sdo_network_constraints
static void disableRefConstraints(java.sql.Connection conn, java.lang.String networkName)
          Disables the referential constraints on the link and the path tables.
static void dropNetwork(java.sql.Connection conn, java.lang.String networkName)
          Drops the network from the database.
static void dropRefConstraints(java.sql.Connection conn, java.lang.String networkName)
          Drops the referential constraints on the link and the path tables.
static void enableRefConstraints(java.sql.Connection conn, java.lang.String networkName)
          Enables the referential constraints on the link and the path tables.
static int findConnectedComponents(Network network)
          Returns the number of connected components in the network.
static java.util.Vector findConnectedComponentVector(Network network)
          Returns connected components of the network in a Vector.
static int findMaxNodeDegree(Network network, int degreeType)
          Finds the maximum node degree of the network
static MBR findMBR(Node[] nodeArray, double expandFactor)
          Returns the MBR of the node array and expanded it by the specified factor.
static int findMinNodeDegree(Network network, int degreeType)
          Finds the minimum node degree of the network
static Node[] findNodesWithinDegreeBounds(Network network, int degreeType, int minDegree, int maxDegree)
          Finds nodes with degree within the given degree bounds.
static Node[] findReachableNodes(Network network, int sourceNodeID)
          Returns all nodes that can be reached from the source node.
static Node[] findReachableNodes(Network network, int sourceNodeID, MBR mbr)
          Returns all nodes that can be reached from the source node.
static Node[] findReachableNodes(Network network, int sourceNodeID, MBR mbr, int depthLimit)
          Returns all nodes that can be reached from the source node.
static Node[] findReachableNodes(Network network, int sourceNodeID, MBR mbr, int depthLimit, int maxNoOfNodes)
          Returns all nodes that can be reached from the source node.
static Node[] findReachableNodes(Network network, int sourceNodeID, NetworkConstraint constraint)
          Returns all nodes that can be reached from the source node.
static Node[] findReachingNodes(Network network, int targetNodeID)
          Returns all nodes that can reach the target node.
static Node[] findReachingNodes(Network network, int targetNodeID, MBR mbr)
          Returns all nodes that can reach the target node.
static Node[] findReachingNodes(Network network, int targetNodeID, MBR mbr, int depthLimit)
          Returns all nodes that can reach the target node.
static Node[] findReachingNodes(Network network, int targetNodeID, NetworkConstraint constraint)
          Returns all nodes that can reach the target node.
static long getMaxFlow(Network network, int sourceNodeID, int sinkNodeID, java.util.Vector linkFlowVec)
          Retunrs the max flow between the source node and the sink node
static java.util.HashMap getNetworkCacheMap()
          Returns the network cache as a HashMap with network name (type: String) as keys and networks (type: Network) as values
static Network getNetworkFromCache(java.lang.String networkName)
          Gets the network from the network cache if the specified network is not in the cache, an NetworkDataException exception will be thrown.
static int getNetworkIDFromName(java.sql.Connection conn, java.lang.String networkName)
          Returns the network ID from a given network name
static java.util.HashMap getNetworkIDs(java.sql.Connection conn)
          Retunrs network names and IDs from the database.
static java.lang.String getNetworkNameFromID(java.sql.Connection conn, int networkID)
          Returns the network name from a given network ID
static java.util.HashMap getNetworkNames(java.sql.Connection conn)
          Retunrs network names and IDs from the database.
static int getNodePartitionID(java.sql.Connection conn, java.lang.String networkName, int nodeID)
          Returns the partition ID of the given node
static int[] getPartitionIDArray(java.sql.Connection conn, java.lang.String networkName)
          Returns node partition IDs in an array
static java.lang.String getVersion()
          Returns the version of the SDO networkAdapter.
static void insertGeomMetadata(java.sql.Connection conn, java.lang.String tableName, java.lang.String geomColumnName, int srid, SDODimArray dimArray)
          Inserts the geometry metadata to the database.
static boolean isNetworkPartitioned(java.sql.Connection conn, java.lang.String networkName)
           
static boolean isPartitionedByNode(java.sql.Connection conn, java.lang.String networkName)
           
static boolean isReachable(Network network, int sourceNodeID, int targetNodeID)
          Checks if the source node can reach the target node.
static boolean isReachable(Network network, int sourceNodeID, int targetNodeID, MBR mbr, int depthLimit)
          Checks if the source node can reach the target node.
static boolean isReachable(Network network, int sourceNodeID, int targetNodeID, NetworkConstraint constraint)
          Checks if the source node can reach the target node.
static void makeLogical(Network network)
          Convert a spatial network to a logical network Note this only updates the network metadata information original spatial information remains unahcnged
static void makeSpatial(Network network, java.lang.String nodeGeomColumn, java.lang.String linkGeomColumn, java.lang.String pathGeomColumn)
          Convert a logical network to a spatial network Note this only updates the network metadata information
static Network mcst(Network network)
          Returns the minimum cost spanning tree (Kruskal Algorithm) as a network.
static Link[] mcstLinkArray(Network network)
          Returns the minimum cost spanning tree (Kruskal Algorithm).
static Path[] nearestNeighbors(Network network, int startNodeID, int noOfNeighbors)
          Returns the shortest paths of the N nearest neighbors from the start node.
static Path[] nearestNeighbors(Network network, int startNodeID, int noOfNeighbors, NetworkConstraint constraint)
          Returns the shortest paths of the N nearest neighbors from the start node.
static Path[] nearestNeighbors(Network network, int startNodeID, int noOfNeighbors, NetworkConstraint constraint, GoalNode goalNodeFilter)
          Returns the shortest paths of the N nearest neighbors from the specified start node.
static Path[] nearestReachingNeighbors(Network network, int startNodeID, int noOfNeighbors)
          Returns the shortest paths of the N nearest reaching neighbors to the specified start node.
static Path[] nearestReachingNeighbors(Network network, int startNodeID, int noOfNeighbors, GoalNode goalNodeFilter)
          Returns the shortest paths of the N nearest reaching neighbors to the specified start node.
static Path[] nearestReachingNeighbors(Network network, int startNodeID, int noOfNeighbors, NetworkConstraint constraint, GoalNode goalNodeFilter)
          Returns the shortest paths of the N nearest reaching neighbors to the specified start node.
static boolean networkExists(java.sql.Connection conn, java.lang.String networkName)
          Checks if the given network exists in the database.
static double partitionNetwork(java.sql.Connection connection, java.lang.String networkName, int numPartition)
          Partitions the spatial network with K-Means method.
static double partitionNetwork(Network net, int numPartition)
          Partitions the given network into the given numPartition partitions.
static void putNetworkToCache(java.lang.String networkName, Network network)
          Puts a network in the network cahce
static Network readBlobNetwork(java.sql.Connection conn, java.lang.String networkName)
          Returns the network from a partition table.
static Network readNetwork(java.sql.Connection conn, java.lang.String networkName)
          Returns the read-only network from the database.
static Network readNetwork(java.sql.Connection conn, java.lang.String networkName, boolean readForUpdate)
          Returns the network from the database.
static Network readNetwork(java.sql.Connection conn, java.lang.String networkName, boolean readForUpdate, UserDataIO ioFunction, java.lang.String sqlNodeFilter, java.lang.String sqlLinkFilter, java.lang.String sqlPathFilter)
          Returns the network with regard to the given filters.
static Network readNetwork(java.sql.Connection conn, java.lang.String networkName, boolean readForUpdate, UserDataIO ioFunction, java.lang.String sqlNodeFilter, java.lang.String sqlLinkFilter, java.lang.String sqlPathFilter, boolean linksWithinNodeSet)
          Returns the network with regard to the given filters.
static Network readNetwork(java.sql.Connection conn, java.lang.String networkName, int linkLevel, boolean readForUpdate)
          Returns the network with the specified link level.
static Network readNetwork(java.sql.Connection conn, java.lang.String networkName, int linkLevel, boolean readForUpdate, UserDataIO ioFunction)
          Returns the network with the specified link level.
static Network readNetwork(java.sql.Connection conn, java.lang.String networkName, MBR mbr, boolean readForUpdate)
          Returns the network that is inside the specified MBR.
static Network readNetwork(java.sql.Connection conn, java.lang.String networkName, MBR mbr, boolean readForUpdate, UserDataIO ioFunction)
          Returns the network that is inside the specified MBR.
static Network readNetworkByLinkPartition(java.sql.Connection conn, java.lang.String networkName, int partitionID, boolean readForUpdate, UserDataIO ioFunction)
          Returns the network with the specified link partition ID.
static Network readNetworkByNodePartition(java.sql.Connection conn, java.lang.String networkName, int partitionID, boolean readForUpdate, UserDataIO ioFunction)
          Returns the network with the specified node partition ID.
static NetworkConstraint readNetworkConstraint(java.sql.Connection conn, java.lang.String networkConstraintName)
          Reads in the given network constraint from the database to memory
static java.util.HashMap readNetworkConstraints(java.sql.Connection conn)
          Reads in the given network constraints from the database to memory
static Network readNetworkFromXML(java.io.Reader reader)
          Reads from XML into an instance of the Network class according to the XML schema defined in oracle/spatial/network/xmlschemas/network.xsd
static java.util.HashMap readNetworkMetadata(java.sql.Connection conn)
          Returns all network metadata from the database.
static NetworkMetadata readNetworkMetadata(java.sql.Connection conn, int networkID)
          Returns the network metadata from the database by network ID.
static NetworkMetadata readNetworkMetadata(java.sql.Connection conn, java.lang.String networkName)
          Returns the network metadata from the database by network name.
static Network readNetworkPartition(java.sql.Connection conn, java.lang.String networkName, int partitionID)
          Reads the network partition from the database.
static Network readNetworkPartition(java.sql.Connection conn, java.lang.String networkName, java.lang.String partitionTableName)
          Reads the network partition from the partition table.
static Network readNetworkPartition(java.sql.Connection conn, java.lang.String networkName, java.lang.String partitionTableName, int partitionID)
          Reads the network partition from the database.
static void registerNetworkConstraint(java.sql.Connection conn, java.lang.String networkConstraintName, java.lang.String className, java.lang.String directoryName, java.lang.String description)
          Register given network constraint into user_sdo_network_constraints
static void removeNetworkToCache(java.lang.String networkName, Network network)
          Removes a network from the network cahce
static Path shortestPath(Network network, int startNodeID, int goalNodeID)
          Returns the shortest path based on the Dijkstra algorithm.
static Path shortestPath(Network network, int startNodeID, int goalNodeID, NetworkConstraint constraint)
          Returns the shortest path based on the Dijkstra algorithm.
static Path shortestPath(Path complexPath, NetworkConstraint constraint)
          Returns the shortest path based on the Dijkstra algorithm.
static Path shortestPathAStar(Network network, int startNodeID, int goalNodeID)
          Returns the shortest path based on the A* search algorithm.
static Path shortestPathAStar(Network network, int startNodeID, int goalNodeID, NetworkConstraint constraint)
          Returns the shortest path based on the A* search algorithm.
static Path shortestPathAStar(Network network, int startNodeID, int goalNodeID, NetworkConstraint constraint, oracle.spatial.network.AStarCostFunction userCostFunction, double searchMultiplier)
          Returns the shortest path based on the A* search algorithm.
static Path shortestPathDijkstra(Network network, int startNodeID, int goalNodeID)
          Returns the shortest path based on the Dijkstra algorithm.
static Path shortestPathDijkstra(Network network, int startNodeID, int goalNodeID, NetworkConstraint constraint)
          Returns the shortest path based on the Dijkstra algorithm.
static Path shortestPathDijkstra(Path complexPath, NetworkConstraint constraint)
          Returns the shortest path based on the Dijkstra algorithm.
static Path[] shortestPaths(Network network, int startNodeID)
          Returns all shortest paths from the given start node based on the Dijkstra algorithm.
static Path[] shortestPaths(Network network, int startNodeID, NetworkConstraint constraint)
          Returns the shortest paths from the specified source node to any other nodes based on the Dijkstra algorithm.
static java.util.Set[] spatialCluster(Network network, int noOfClusters)
           
static Path tspPath(Network network, int[] nodeIDArray, boolean isClosed, boolean useExactCost, NetworkConstraint constraint)
          Returns a TSP tour.
static Path tspPath(Network network, int[] nodeIDArray, NetworkConstraint constraint)
          Returns a TSP tour.
static Path tspPath(Node[] nodeArray, boolean isClosed, boolean useExactCost, NetworkConstraint constraint)
          Returns a TSP tour.
static java.lang.String validateNetwork(Network network)
          Validates the reference relationship of the given network return the validation result as a String
static java.lang.String validateNetworkSchema(java.sql.Connection conn, java.lang.String networkName)
          Validates the network tables and reports any errors if exist.
static Path[] withinCost(Network network, int startNodeID, double cost)
          Returns the shortest paths of the nodes that are within the specified cost from the given node.
static Path[] withinCost(Network network, int startNodeID, double cost, NetworkConstraint constraint)
          Returns all paths that are within the specified cost.
static Path[] withinReachingCost(Network network, int startNodeID, double cost)
          Returns all reaching paths that are within the specified cost.
static Path[] withinReachingCost(Network network, int startNodeID, double cost, NetworkConstraint constraint)
          Returns all reaching paths that are within the specified cost.
static void writeNetwork(java.sql.Connection conn, Network network)
          Writes the network to the database.
static void writeNetwork(java.sql.Connection conn, Network network, UserDataIO ioFunction)
          Writes the network to the database.
static void writeNetworkMetadata(java.sql.Connection conn, NetworkMetadata metadata)
          Writes the network metadata to the database.
static void writeNetworkPartition(java.sql.Connection conn, Network network, java.lang.String partitionTableName)
          Writes the network partitions to the partition table.
static void writeNetworkPartition(java.sql.Connection conn, Network network, java.lang.String partitionTableName, boolean writeOriginalNetwork)
          Writes the network partitions to the partition table.
static void writeNetworkPartition(java.sql.Connection conn, java.lang.String networkName, java.lang.String partitionTableName)
          Writes the network partitions to the partition table.
static void writeNetworkToXML(Network network, java.io.Writer writer)
          writeNetworkToXML() writes an instance of the Network class to XML according the the XML schema defined in oracle/spatial/network/xmlschemas/network.xsd.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Method Detail

getVersion

public static java.lang.String getVersion()
Returns the version of the SDO networkAdapter.
Returns:
adapter version

readNetwork

public static Network readNetwork(java.sql.Connection conn,
                                  java.lang.String networkName)
                           throws java.sql.SQLException,
                                  NetworkDataException
Returns the read-only network from the database.
Parameters:
conn - the database connection
networkName - the network name
Throws:
java.sql.SQLException
NetworkDataException

readNetwork

public static Network readNetwork(java.sql.Connection conn,
                                  java.lang.String networkName,
                                  boolean readForUpdate)
                           throws java.sql.SQLException,
                                  NetworkDataException
Returns the network from the database.
Parameters:
conn - the database connection
networkName - the network name
readForUpdate - the update mode if true or the read-only mode if false
Throws:
java.sql.SQLException
NetworkDataException

readNetwork

public static Network readNetwork(java.sql.Connection conn,
                                  java.lang.String networkName,
                                  MBR mbr,
                                  boolean readForUpdate)
                           throws java.sql.SQLException,
                                  NetworkDataException
Returns the network that is inside the specified MBR.
Parameters:
conn - the database connection
networkName - the network name
mbr - the bounding MBR
readForUpdate - the update mode if true or the read-only mode if false
Throws:
java.sql.SQLException
NetworkDataException

readNetwork

public static Network readNetwork(java.sql.Connection conn,
                                  java.lang.String networkName,
                                  int linkLevel,
                                  boolean readForUpdate)
                           throws java.sql.SQLException,
                                  NetworkDataException
Returns the network with the specified link level.
Parameters:
conn - the database connection
networkName - the network name
linkLevel - the link level
readForUpdate - the update mode if true, read-only mode otherwise
Throws:
java.sql.SQLException
NetworkDataException

readNetwork

public static Network readNetwork(java.sql.Connection conn,
                                  java.lang.String networkName,
                                  MBR mbr,
                                  boolean readForUpdate,
                                  UserDataIO ioFunction)
                           throws java.sql.SQLException,
                                  NetworkDataException
Returns the network that is inside the specified MBR.
Parameters:
conn - the database connection
networkName - the network name
mbr - the bounding MBR
readForUpdate - the update mode if true or the read-only mode otherwise
ioFunction - the UserDataIO implementation for reading user data
Throws:
java.sql.SQLException
NetworkDataException

readNetwork

public static Network readNetwork(java.sql.Connection conn,
                                  java.lang.String networkName,
                                  boolean readForUpdate,
                                  UserDataIO ioFunction,
                                  java.lang.String sqlNodeFilter,
                                  java.lang.String sqlLinkFilter,
                                  java.lang.String sqlPathFilter,
                                  boolean linksWithinNodeSet)
                           throws java.sql.SQLException,
                                  NetworkDataException
Returns the network with regard to the given filters.
Parameters:
conn - the database connection
networkName - the network name
readForUpdate - the update mode if true or the read-only mode otherwise
ioFunction - the UserDataIO implementation for reading user data
sqlNodeFilter - SQL node filter
sqlLinkFilter - SQL link filter
sqlPathFilter - SQL path filter
Throws:
java.sql.SQLException
NetworkDataException

readNetwork

public static Network readNetwork(java.sql.Connection conn,
                                  java.lang.String networkName,
                                  boolean readForUpdate,
                                  UserDataIO ioFunction,
                                  java.lang.String sqlNodeFilter,
                                  java.lang.String sqlLinkFilter,
                                  java.lang.String sqlPathFilter)
                           throws java.sql.SQLException,
                                  NetworkDataException
Returns the network with regard to the given filters.
Parameters:
conn - the database connection
networkName - the network name
readForUpdate - the update mode if true or the read-only mode otherwise
ioFunction - the UserDataIO implementation for reading user data
sqlNodeFilter - SQL node filter
sqlLinkFilter - SQL link filter
sqlPathFilter - SQL path filter
Throws:
java.sql.SQLException
NetworkDataException

readBlobNetwork

public static Network readBlobNetwork(java.sql.Connection conn,
                                      java.lang.String networkName)
                               throws java.sql.SQLException,
                                      NetworkDataException
Returns the network from a partition table.
Parameters:
conn - the database connection
networkName - the network name Note that the blob network is read only
Throws:
java.sql.SQLException
NetworkDataException

readNetworkByNodePartition

public static Network readNetworkByNodePartition(java.sql.Connection conn,
                                                 java.lang.String networkName,
                                                 int partitionID,
                                                 boolean readForUpdate,
                                                 UserDataIO ioFunction)
                                          throws java.sql.SQLException,
                                                 NetworkDataException
Returns the network with the specified node partition ID.
Parameters:
conn - the database connection
networkName - the network name
partitionID - the node partition ID
readForUpdate - the update mode if true or the read-only mode otherwise
ioFunction - the UserDataIO implementation for reading user data
Throws:
java.sql.SQLException
NetworkDataException

readNetworkByLinkPartition

public static Network readNetworkByLinkPartition(java.sql.Connection conn,
                                                 java.lang.String networkName,
                                                 int partitionID,
                                                 boolean readForUpdate,
                                                 UserDataIO ioFunction)
                                          throws java.sql.SQLException,
                                                 NetworkDataException
Returns the network with the specified link partition ID.
Parameters:
conn - the database connection
networkName - the network name
partitionID - the link partition ID
readForUpdate - the update mode if true or the read-only mode otherwise
ioFunction - the UserDataIO implementation for reading user data
Throws:
java.sql.SQLException
NetworkDataException

readNetwork

public static Network readNetwork(java.sql.Connection conn,
                                  java.lang.String networkName,
                                  int linkLevel,
                                  boolean readForUpdate,
                                  UserDataIO ioFunction)
                           throws java.sql.SQLException,
                                  NetworkDataException
Returns the network with the specified link level.
Parameters:
conn - the database connection
networkName - the network name
linkLevel - the link level
readForUpdate - the update mode if true or the read-only mode otherwise
ioFunction - the UserDataIO implementation for reading user data
Throws:
java.sql.SQLException
NetworkDataException

readNetworkMetadata

public static java.util.HashMap readNetworkMetadata(java.sql.Connection conn)
                                             throws java.sql.SQLException,
                                                    NetworkDataException
Returns all network metadata from the database.
Parameters:
conn - the database connection
Returns:
a HashMap with the network names as keys and NetworkMetadata as values
Throws:
java.sql.SQLException
NetworkDataException

readNetworkMetadata

public static NetworkMetadata readNetworkMetadata(java.sql.Connection conn,
                                                  java.lang.String networkName)
                                           throws java.sql.SQLException,
                                                  NetworkDataException
Returns the network metadata from the database by network name.
Parameters:
conn - the database connection
networkName - the network name
Returns:
a NetworkMetadata
Throws:
java.sql.SQLException
NetworkDataException

readNetworkMetadata

public static NetworkMetadata readNetworkMetadata(java.sql.Connection conn,
                                                  int networkID)
                                           throws java.sql.SQLException,
                                                  NetworkDataException
Returns the network metadata from the database by network ID.
Parameters:
conn - the database connection
networkID - the network name
Returns:
NetworkMetadata
Throws:
java.sql.SQLException
NetworkDataException

writeNetworkMetadata

public static void writeNetworkMetadata(java.sql.Connection conn,
                                        NetworkMetadata metadata)
                                 throws java.sql.SQLException,
                                        NetworkDataException
Writes the network metadata to the database.
Parameters:
conn - the database connection
metadata - the network metadata
Throws:
java.sql.SQLException
NetworkDataException

writeNetwork

public static void writeNetwork(java.sql.Connection conn,
                                Network network)
                         throws java.sql.SQLException,
                                NetworkDataException
Writes the network to the database.
Parameters:
conn - the database connection
network - the specified network
Throws:
java.sql.SQLException
NetworkDataException

writeNetwork

public static void writeNetwork(java.sql.Connection conn,
                                Network network,
                                UserDataIO ioFunction)
                         throws java.sql.SQLException,
                                NetworkDataException
Writes the network to the database.
Parameters:
conn - the database connection
network - the specified network
ioFunction - the UserDataIO implementation for writing user data
Throws:
java.sql.SQLException
NetworkDataException

readNetworkConstraints

public static java.util.HashMap readNetworkConstraints(java.sql.Connection conn)
                                                throws java.sql.SQLException,
                                                       NetworkDataException,
                                                       java.lang.ClassNotFoundException,
                                                       java.lang.InstantiationException,
                                                       java.lang.IllegalAccessException
Reads in the given network constraints from the database to memory
Parameters:
conn - database connection
Returns:
the desired network constraints in a HashMap with constraint name as keys and constraint classes as values
Throws:
java.sql.SQLException
NetworkDataException
java.lang.ClassNotFoundException
java.lang.InstantiationException
java.lang.IllegalAccessException

readNetworkConstraint

public static NetworkConstraint readNetworkConstraint(java.sql.Connection conn,
                                                      java.lang.String networkConstraintName)
                                               throws java.sql.SQLException,
                                                      NetworkDataException,
                                                      java.lang.ClassNotFoundException,
                                                      java.lang.InstantiationException,
                                                      java.lang.IllegalAccessException
Reads in the given network constraint from the database to memory
Parameters:
conn - database connection
networkConstraintName - the name of the network constraint
Returns:
the desired network constraint
Throws:
java.sql.SQLException
NetworkDataException
java.lang.ClassNotFoundException
java.lang.InstantiationException
java.lang.IllegalAccessException

registerNetworkConstraint

public static void registerNetworkConstraint(java.sql.Connection conn,
                                             java.lang.String networkConstraintName,
                                             java.lang.String className,
                                             java.lang.String directoryName,
                                             java.lang.String description)
                                      throws java.sql.SQLException,
                                             NetworkDataException
Register given network constraint into user_sdo_network_constraints
Parameters:
conn -
networkConstraintName -
className - Should be given without suffix ".class"
directoryName - Must be the name of a valid Oracle directory object
description -
Throws:
java.sql.SQLException
NetworkDataException

deregisterNetworkConstraint

public static void deregisterNetworkConstraint(java.sql.Connection conn,
                                               java.lang.String networkConstraintName)
                                        throws java.sql.SQLException,
                                               NetworkDataException
Deregister given constraint from user_sdo_network_constraints
Parameters:
conn -
networkConstraintName -
Throws:
java.sql.SQLException
NetworkDataException

mcst

public static Network mcst(Network network)
Returns the minimum cost spanning tree (Kruskal Algorithm) as a network.
Parameters:
network - the specified network

mcstLinkArray

public static Link[] mcstLinkArray(Network network)
Returns the minimum cost spanning tree (Kruskal Algorithm). as an array of links.
Parameters:
network - the specified network

isReachable

public static boolean isReachable(Network network,
                                  int sourceNodeID,
                                  int targetNodeID,
                                  MBR mbr,
                                  int depthLimit)
                           throws NetworkDataException
Checks if the source node can reach the target node.
Parameters:
network - the specified network
sourceNodeID - the source node ID
targetNodeID - the target node ID
mbr - the bounding MBR
depthLimit - the depth limit
Returns:
true if reachable or false otherwise
Throws:
NetworkDataException

isReachable

public static boolean isReachable(Network network,
                                  int sourceNodeID,
                                  int targetNodeID)
                           throws NetworkDataException
Checks if the source node can reach the target node.
Parameters:
network - the specified network
sourceNodeID - the source node ID
targetNodeID - the target node ID
Returns:
true if reachable or false otherwise
Throws:
NetworkDataException

isReachable

public static boolean isReachable(Network network,
                                  int sourceNodeID,
                                  int targetNodeID,
                                  NetworkConstraint constraint)
                           throws NetworkDataException
Checks if the source node can reach the target node.
Parameters:
network - the specified network
sourceNodeID - the source node ID
targetNodeID - the target node ID
constraint - the network constraint
Returns:
true if reachable or false otherwise
Throws:
NetworkDataException

findConnectedComponents

public static int findConnectedComponents(Network network)
Returns the number of connected components in the network. The component number of each node will be set. The component number can be obtained using getComponentNo() from a node. Nodes that belong to the same component have the same component number. Note this function is not thread safe as it sets the component number of each node.
Parameters:
network - the specified network

findConnectedComponentVector

public static java.util.Vector findConnectedComponentVector(Network network)
Returns connected components of the network in a Vector. The number of connected components is the size of the return Vector. Each connected component is returned as a HashSet containing all nodes in the Vector. Note this function is thread safe and no Node component number will be set.
Parameters:
network - the specified network

findReachableNodes

public static Node[] findReachableNodes(Network network,
                                        int sourceNodeID)
                                 throws NetworkDataException
Returns all nodes that can be reached from the source node.
Parameters:
network - the specified network
sourceNodeID - the source node ID
Throws:
NetworkDataException

findReachableNodes

public static Node[] findReachableNodes(Network network,
                                        int sourceNodeID,
                                        MBR mbr)
                                 throws NetworkDataException
Returns all nodes that can be reached from the source node.
Parameters:
network - the specified network
sourceNodeID - the source node ID
mbr - the bounding MBR
Returns:
an array of nodes that can be reached
Throws:
NetworkDataException

findReachableNodes

public static Node[] findReachableNodes(Network network,
                                        int sourceNodeID,
                                        MBR mbr,
                                        int depthLimit)
                                 throws NetworkDataException
Returns all nodes that can be reached from the source node.
Parameters:
network - the specified network
sourceNodeID - the source node ID
mbr - the MBR
depthLimit - the depth limit
Returns:
an array of nodes that can be reached
Throws:
NetworkDataException

findReachableNodes

public static Node[] findReachableNodes(Network network,
                                        int sourceNodeID,
                                        MBR mbr,
                                        int depthLimit,
                                        int maxNoOfNodes)
                                 throws NetworkDataException
Returns all nodes that can be reached from the source node.
Parameters:
network - the specified network
sourceNodeID - the source node ID
mbr - the MBR
depthLimit - the depth limit
maxNoOfNodes - max. no of nodes returned
Returns:
an array of nodes that can be reached
Throws:
NetworkDataException

findReachableNodes

public static Node[] findReachableNodes(Network network,
                                        int sourceNodeID,
                                        NetworkConstraint constraint)
                                 throws NetworkDataException
Returns all nodes that can be reached from the source node.
Parameters:
network - the specified network
sourceNodeID - the source node ID
constraint - the network constraint
Returns:
an array of nodes that can be reached
Throws:
NetworkDataException

findReachingNodes

public static Node[] findReachingNodes(Network network,
                                       int targetNodeID)
                                throws NetworkDataException
Returns all nodes that can reach the target node.
Parameters:
network - the specified network
targetNodeID - the target node ID
Returns:
an array of nodes that can reach the target node
Throws:
NetworkDataException

findReachingNodes

public static Node[] findReachingNodes(Network network,
                                       int targetNodeID,
                                       MBR mbr)
                                throws NetworkDataException
Returns all nodes that can reach the target node.
Parameters:
network - the specified network
targetNodeID - the target node ID
mbr - the MBR
Returns:
an array of nodes that can reach the target node
Throws:
NetworkDataException

findReachingNodes

public static Node[] findReachingNodes(Network network,
                                       int targetNodeID,
                                       MBR mbr,
                                       int depthLimit)
                                throws NetworkDataException
Returns all nodes that can reach the target node.
Parameters:
network - the specified network
targetNodeID - the target node ID
mbr - the MBR
depthLimit - the depth limit
Returns:
an array of nodes that can reach the target node
Throws:
NetworkDataException

findReachingNodes

public static Node[] findReachingNodes(Network network,
                                       int targetNodeID,
                                       NetworkConstraint constraint)
                                throws NetworkDataException
Returns all nodes that can reach the target node.
Parameters:
network - the specified network
targetNodeID - the target node ID
constraint - the network constraint
Returns:
an array of nodes that can reach the target node
Throws:
NetworkDataException

shortestPathAStar

public static Path shortestPathAStar(Network network,
                                     int startNodeID,
                                     int goalNodeID,
                                     NetworkConstraint constraint,
                                     oracle.spatial.network.AStarCostFunction userCostFunction,
                                     double searchMultiplier)
                              throws NetworkDataException
Returns the shortest path based on the A* search algorithm.
Parameters:
network - the specified network
startNodeID - the start node ID
goalNodeID - the goal node ID
constraint - the network constraint, null if none
userCostFunction - a user-defined A* heuristic cost function
searchMultiplier - a multiplier that applied to the user cost (default = 1.0)
Throws:
NetworkDataException

shortestPathAStar

public static Path shortestPathAStar(Network network,
                                     int startNodeID,
                                     int goalNodeID,
                                     NetworkConstraint constraint)
                              throws NetworkDataException
Returns the shortest path based on the A* search algorithm.
Parameters:
network - the specified network
startNodeID - the start node ID
goalNodeID - the goal node ID
constraint - the network constraint, null if none
Throws:
NetworkDataException

shortestPathAStar

public static Path shortestPathAStar(Network network,
                                     int startNodeID,
                                     int goalNodeID)
                              throws NetworkDataException
Returns the shortest path based on the A* search algorithm.
Parameters:
network - the specified network
startNodeID - the start node ID
goalNodeID - the goal node ID
Throws:
NetworkDataException

shortestPath

public static Path shortestPath(Network network,
                                int startNodeID,
                                int goalNodeID)
                         throws NetworkDataException
Returns the shortest path based on the Dijkstra algorithm.
Parameters:
network - the specified network
startNodeID - the start node ID
goalNodeID - the goal node ID
Throws:
NetworkDataException

shortestPath

public static Path shortestPath(Network network,
                                int startNodeID,
                                int goalNodeID,
                                NetworkConstraint constraint)
                         throws NetworkDataException
Returns the shortest path based on the Dijkstra algorithm.
Parameters:
network - the given network
startNodeID - the start node ID
goalNodeID - the goal node ID
constraint - the network constraint, null if none
Throws:
NetworkDataException

shortestPath

public static Path shortestPath(Path complexPath,
                                NetworkConstraint constraint)
                         throws NetworkDataException
Returns the shortest path based on the Dijkstra algorithm.
Parameters:
complexPath - the given complex path
constraint - the network constraint, null if none
Throws:
NetworkDataException

shortestPathDijkstra

public static Path shortestPathDijkstra(Network network,
                                        int startNodeID,
                                        int goalNodeID,
                                        NetworkConstraint constraint)
                                 throws NetworkDataException
Returns the shortest path based on the Dijkstra algorithm.
Parameters:
network - the given network
startNodeID - the start node ID
goalNodeID - the goal node ID
constraint - the network constraint, null if none
Throws:
NetworkDataException

shortestPathDijkstra

public static Path shortestPathDijkstra(Network network,
                                        int startNodeID,
                                        int goalNodeID)
                                 throws NetworkDataException
Returns the shortest path based on the Dijkstra algorithm.
Parameters:
network - the given network
startNodeID - the start node ID
goalNodeID - the goal node ID
Throws:
NetworkDataException

shortestPathDijkstra

public static Path shortestPathDijkstra(Path complexPath,
                                        NetworkConstraint constraint)
                                 throws NetworkDataException
Returns the shortest path based on the Dijkstra algorithm.
Parameters:
complexPath - the given complex path
constraint - the network constraint, null if none
Throws:
NetworkDataException

shortestPaths

public static Path[] shortestPaths(Network network,
                                   int startNodeID,
                                   NetworkConstraint constraint)
                            throws NetworkDataException
Returns the shortest paths from the specified source node to any other nodes based on the Dijkstra algorithm.
Parameters:
network - the given network
startNodeID - the start node ID
constraint - the network constraint, null if none
Returns:
an array of all shortest paths from given start node
Throws:
NetworkDataException

shortestPaths

public static Path[] shortestPaths(Network network,
                                   int startNodeID)
                            throws NetworkDataException
Returns all shortest paths from the given start node based on the Dijkstra algorithm.
Parameters:
network - the given network
startNodeID - the start node ID
Returns:
an array of all shortest paths from given start node
Throws:
NetworkDataException

allPaths

public static Path[] allPaths(Network network,
                              int startNodeID,
                              int goalNodeID,
                              int depthLimit,
                              double costLimit,
                              int noOfSolutions)
                       throws NetworkDataException
Returns all paths between the start node and the goal node.
Parameters:
network - the given network
startNodeID - the start node ID
goalNodeID - the goal node ID
depthLimit - the depth limit
costLimit - the cost limit
noOfSolutions - the number of solutions specified
Returns:
an array of all paths from the start node to the goal node
Throws:
NetworkDataException

allPaths

public static Path[] allPaths(Network network,
                              int startNodeID,
                              int goalNodeID,
                              NetworkConstraint constraint,
                              int noOfSolutions)
                       throws NetworkDataException
Returns all paths between the start node and the goal node.
Parameters:
network - the given network
startNodeID - the start node ID
goalNodeID - the goal node ID
constraint - the network constraint
noOfSolutions - the number of solutions specified
Returns:
an array of all paths from the start node to the goal node
Throws:
NetworkDataException

allPaths

public static Path[] allPaths(Network network,
                              int startNodeID,
                              int goalNodeID,
                              NetworkConstraint constraint,
                              int noOfSolutions,
                              oracle.spatial.network.AStarCostFunction costFunction,
                              double searchMultiplier)
                       throws NetworkDataException
Returns all paths between the start node and the goal node.
Parameters:
network - the given network
startNodeID - the start node ID
goalNodeID - the goal node ID
constraint - the network constraint
noOfSolutions - the number of solutions specified
costFunction - the user defined cost function
searchMultiplier - the search multiplier
Returns:
an array of all paths from the start node to the goal node
Throws:
NetworkDataException

allPaths

public static Path[] allPaths(Path complexPath,
                              int depthLimit,
                              double costLimit,
                              int noOfSolutions)
                       throws NetworkDataException
Returns all paths between the start node and the goal node of the complex path.
Parameters:
complexPath - the given complex path
depthLimit - the depth limit
costLimit - the cost limit
Returns:
an array of all paths from given start node to the goal node
Throws:
NetworkDataException

withinCost

public static Path[] withinCost(Network network,
                                int startNodeID,
                                double cost,
                                NetworkConstraint constraint)
                         throws NetworkDataException
Returns all paths that are within the specified cost.
Parameters:
network - the given network
startNodeID - the start node ID
cost - the cost limit
constraint - the network constraint, null if none
Returns:
all paths from the start node bound by the given cost
Throws:
NetworkDataException

withinCost

public static Path[] withinCost(Network network,
                                int startNodeID,
                                double cost)
                         throws NetworkDataException
Returns the shortest paths of the nodes that are within the specified cost from the given node.
Parameters:
network - the given network
startNodeID - the start node ID
cost - the cost limit
Returns:
all paths from the start node bound by the given cost
Throws:
NetworkDataException

withinReachingCost

public static Path[] withinReachingCost(Network network,
                                        int startNodeID,
                                        double cost)
                                 throws NetworkDataException
Returns all reaching paths that are within the specified cost.
Parameters:
network - the given network
startNodeID - the start node ID
cost - the cost limit
Returns:
all paths from the start node bound by the given cost
Throws:
NetworkDataException

withinReachingCost

public static Path[] withinReachingCost(Network network,
                                        int startNodeID,
                                        double cost,
                                        NetworkConstraint constraint)
                                 throws NetworkDataException
Returns all reaching paths that are within the specified cost.
Parameters:
network - the given network
startNodeID - the start node ID
cost - the cost limit
constraint - the network constraint, null if none
Returns:
all paths from the start node bound by the given cost
Throws:
NetworkDataException

nearestNeighbors

public static Path[] nearestNeighbors(Network network,
                                      int startNodeID,
                                      int noOfNeighbors,
                                      NetworkConstraint constraint,
                                      GoalNode goalNodeFilter)
                               throws NetworkDataException
Returns the shortest paths of the N nearest neighbors from the specified start node. and goal node filter
Parameters:
network - the given network
startNodeID - the start node ID
noOfNeighbors - the number of neighbors
constraint - the network constraint
goalNodeFilter - the goal node filter
Returns:
an array of paths of the nearest neighbors
Throws:
NetworkDataException

nearestNeighbors

public static Path[] nearestNeighbors(Network network,
                                      int startNodeID,
                                      int noOfNeighbors,
                                      NetworkConstraint constraint)
                               throws NetworkDataException
Returns the shortest paths of the N nearest neighbors from the start node.
Parameters:
network - the given network
startNodeID - the start node ID
noOfNeighbors - the number of neighbors
constraint - the network constraint
Returns:
an array of paths of the nearest neighbors
Throws:
NetworkDataException

nearestNeighbors

public static Path[] nearestNeighbors(Network network,
                                      int startNodeID,
                                      int noOfNeighbors)
                               throws NetworkDataException
Returns the shortest paths of the N nearest neighbors from the start node.
Parameters:
network - the given network
startNodeID - the start node ID
noOfNeighbors - the number of neighbors
Returns:
an array of paths of the nearest neighbors
Throws:
NetworkDataException

nearestReachingNeighbors

public static Path[] nearestReachingNeighbors(Network network,
                                              int startNodeID,
                                              int noOfNeighbors,
                                              NetworkConstraint constraint,
                                              GoalNode goalNodeFilter)
                                       throws NetworkDataException
Returns the shortest paths of the N nearest reaching neighbors to the specified start node. and goal node filter
Parameters:
network - the given network
startNodeID - the start node ID
noOfNeighbors - the number of neighbors
constraint - the network constraint
goalNodeFilter - the goal node filter
Returns:
an array of paths of the nearest neighbors
Throws:
NetworkDataException

nearestReachingNeighbors

public static Path[] nearestReachingNeighbors(Network network,
                                              int startNodeID,
                                              int noOfNeighbors,
                                              GoalNode goalNodeFilter)
                                       throws NetworkDataException
Returns the shortest paths of the N nearest reaching neighbors to the specified start node. and goal node filter
Parameters:
network - the given network
startNodeID - the start node ID
noOfNeighbors - the number of neighbors
goalNodeFilter - the goal node filter
Returns:
an array of paths of the nearest neighbors
Throws:
NetworkDataException

nearestReachingNeighbors

public static Path[] nearestReachingNeighbors(Network network,
                                              int startNodeID,
                                              int noOfNeighbors)
                                       throws NetworkDataException
Returns the shortest paths of the N nearest reaching neighbors to the specified start node. and goal node filter
Parameters:
network - the given network
startNodeID - the start node ID
noOfNeighbors - the number of neighbors
Returns:
an array of paths of the nearest neighbors
Throws:
NetworkDataException

validateNetworkSchema

public static java.lang.String validateNetworkSchema(java.sql.Connection conn,
                                                     java.lang.String networkName)
Validates the network tables and reports any errors if exist.
Returns:
"TRUE" if no errors, return the specific error message otherwise

networkExists

public static boolean networkExists(java.sql.Connection conn,
                                    java.lang.String networkName)
                             throws java.sql.SQLException
Checks if the given network exists in the database.
Parameters:
conn - the database connection
networkName - the network name
Returns:
true if network exists, false otherwise
Throws:
java.sql.SQLException

dropNetwork

public static void dropNetwork(java.sql.Connection conn,
                               java.lang.String networkName)
                        throws java.sql.SQLException
Drops the network from the database.
Parameters:
conn - the database connection
networkName - the network to be dropped
Throws:
java.sql.SQLException

writeNetworkPartition

public static void writeNetworkPartition(java.sql.Connection conn,
                                         Network network,
                                         java.lang.String partitionTableName,
                                         boolean writeOriginalNetwork)
                                  throws NetworkDataException,
                                         java.sql.SQLException
Writes the network partitions to the partition table.
Throws:
NetworkDataException
java.sql.SQLException

writeNetworkPartition

public static void writeNetworkPartition(java.sql.Connection conn,
                                         Network network,
                                         java.lang.String partitionTableName)
                                  throws NetworkDataException,
                                         java.sql.SQLException
Writes the network partitions to the partition table.
Throws:
NetworkDataException
java.sql.SQLException

writeNetworkPartition

public static void writeNetworkPartition(java.sql.Connection conn,
                                         java.lang.String networkName,
                                         java.lang.String partitionTableName)
                                  throws NetworkDataException,
                                         java.sql.SQLException
Writes the network partitions to the partition table.
Throws:
NetworkDataException
java.sql.SQLException

readNetworkPartition

public static Network readNetworkPartition(java.sql.Connection conn,
                                           java.lang.String networkName,
                                           java.lang.String partitionTableName)
                                    throws java.sql.SQLException,
                                           NetworkDataException
Reads the network partition from the partition table.
Throws:
java.sql.SQLException
NetworkDataException

createNetworkHiearchy

public static void createNetworkHiearchy(Network network,
                                         int numHierarchy,
                                         int[] ndNumLevel)
                                  throws NetworkDataException,
                                         java.sql.SQLException
Creates a network hiearchy with the given number of levels. This operation stops when the givne number of hierarchy levels has been built or it can not achieve the meaningful reduction of node numbers from one level to the next level. In the latter case, the resultant number of hierarchy levels can be less than the given number of hierarchy levels.
Parameters:
network - the network whose hierarchy will be built. The assumption is that no hierarchy exists in this network before invoking this function.
numHierarchy - the extra number of hierarchy levels for this network. This number should be greater than one and less than the number o nodes in the given network. Since we assume the original network is at the level 1, after this operation, we will have numHierarchy+1 levels of network hierarchy. specifies the additional numHierarchy levels on top of the original network which is at the level one.
ndNumLevel - the number of nodes specified at each level. Here the node number should decrease with the increase of the level as we assume the original network is at the bottom level, i.e. level 1.
Throws:
NetworkDataException
java.sql.SQLException

createNetworkPartitionTable

public static void createNetworkPartitionTable(java.sql.Connection conn,
                                               java.lang.String partitionTableName)
                                        throws java.sql.SQLException
Creates a network partition table.
Throws:
java.sql.SQLException

readNetworkPartition

public static Network readNetworkPartition(java.sql.Connection conn,
                                           java.lang.String networkName,
                                           java.lang.String partitionTableName,
                                           int partitionID)
                                    throws java.sql.SQLException,
                                           NetworkDataException
Reads the network partition from the database.
Throws:
java.sql.SQLException
NetworkDataException

readNetworkPartition

public static Network readNetworkPartition(java.sql.Connection conn,
                                           java.lang.String networkName,
                                           int partitionID)
                                    throws java.sql.SQLException,
                                           NetworkDataException
Reads the network partition from the database.
Throws:
java.sql.SQLException
NetworkDataException

createRefConstraints

public static void createRefConstraints(java.sql.Connection conn,
                                        java.lang.String networkName)
                                 throws java.sql.SQLException
Creates the referential constraints on the link and the path tables. When the constraints are created, they are enabled by default and can be disabled later.
Parameters:
conn - the database connection
networkName - the network name
Throws:
java.sql.SQLException

enableRefConstraints

public static void enableRefConstraints(java.sql.Connection conn,
                                        java.lang.String networkName)
                                 throws java.sql.SQLException
Enables the referential constraints on the link and the path tables.
Parameters:
conn - the database connection
networkName - the network name
Throws:
java.sql.SQLException

getMaxFlow

public static long getMaxFlow(Network network,
                              int sourceNodeID,
                              int sinkNodeID,
                              java.util.Vector linkFlowVec)
                       throws NetworkDataException,
                              java.io.IOException
Retunrs the max flow between the source node and the sink node
Parameters:
network - network to be analyzed
sourceNodeID - source Node ID
sinkNodeID - sink node ID
linkFlowVec - link flow returned in a Vector
Returns:
the max. flow
Throws:
NetworkDataException
java.io.IOException

disableRefConstraints

public static void disableRefConstraints(java.sql.Connection conn,
                                         java.lang.String networkName)
                                  throws java.sql.SQLException
Disables the referential constraints on the link and the path tables.
Parameters:
conn - the database connection
networkName - the network name
Throws:
java.sql.SQLException

dropRefConstraints

public static void dropRefConstraints(java.sql.Connection conn,
                                      java.lang.String networkName)
                               throws java.sql.SQLException
Drops the referential constraints on the link and the path tables.
Parameters:
conn - the database connection
networkName - the network name
Throws:
java.sql.SQLException

findMBR

public static MBR findMBR(Node[] nodeArray,
                          double expandFactor)
Returns the MBR of the node array and expanded it by the specified factor.

tspPath

public static Path tspPath(Network network,
                           int[] nodeIDArray,
                           NetworkConstraint constraint)
                    throws NetworkDataException
Returns a TSP tour.
Parameters:
network - the specified network
nodeIDArray - an array containing IDs of nodes to be visited
constraint - the network constraint
Throws:
NetworkDataException

tspPath

public static Path tspPath(Network network,
                           int[] nodeIDArray,
                           boolean isClosed,
                           boolean useExactCost,
                           NetworkConstraint constraint)
                    throws NetworkDataException
Returns a TSP tour.
Parameters:
network - the specified network
nodeIDArray - an array containing IDs of nodes to be visited
isClosed - is the tour is closed?
useExactCost - if true, use the real cost, use the Cartesian distance otherwise
constraint - the network constraint
Throws:
NetworkDataException

tspPath

public static Path tspPath(Node[] nodeArray,
                           boolean isClosed,
                           boolean useExactCost,
                           NetworkConstraint constraint)
                    throws NetworkDataException
Returns a TSP tour.
Parameters:
nodeArray - an array containing nodes to be visited
isClosed - is the tour closed?
useExactCost - if true, use the real cost, use the Cartesian distance otherwise
constraint - network constraint
Throws:
NetworkDataException

partitionNetwork

public static double partitionNetwork(Network net,
                                      int numPartition)
                               throws NetworkDataException
Partitions the given network into the given numPartition partitions.
Parameters:
net - the network to be partitioned
numPartition - the number of partition
Returns:
the return value is the iner-partition link costs
Throws:
NetworkDataException

partitionNetwork

public static double partitionNetwork(java.sql.Connection connection,
                                      java.lang.String networkName,
                                      int numPartition)
                               throws NetworkDataException,
                                      java.sql.SQLException
Partitions the spatial network with K-Means method.
Parameters:
connection - the connection to the database
networkName - the name of the network to be partitioned
numPartition - the required number of partitions
Returns:
the return value is the iner-partition link costs
Throws:
NetworkDataException
java.sql.SQLException

spatialCluster

public static java.util.Set[] spatialCluster(Network network,
                                             int noOfClusters)

readNetworkFromXML

public static Network readNetworkFromXML(java.io.Reader reader)
                                  throws java.io.IOException,
                                         oracle.xml.util.XMLException,
                                         oracle.xml.parser.v2.XMLParseException,
                                         oracle.xml.parser.schema.XSDException,
                                         NetworkDataException
Reads from XML into an instance of the Network class according to the XML schema defined in oracle/spatial/network/xmlschemas/network.xsd
Parameters:
reader - - A character stream that produces an XML document that conforms to the XML Schema in oracle/spatial/network/xmlschemas/network.xsd
Returns:
An instance of Network which is the Java object equivalent of the XML document supplied by reader.
Throws:
java.io.IOException
oracle.xml.util.XMLException
oracle.xml.parser.v2.XMLParseException
oracle.xml.parser.schema.XSDException
NetworkDataException

writeNetworkToXML

public static void writeNetworkToXML(Network network,
                                     java.io.Writer writer)
                              throws java.io.IOException,
                                     NetworkDataException
writeNetworkToXML() writes an instance of the Network class to XML according the the XML schema defined in oracle/spatial/network/xmlschemas/network.xsd.
Parameters:
network - - instance of Network class to serialize to XML
writer - - instance of Writer class to write the XML to
Throws:
java.io.IOException
NetworkDataException

makeSpatial

public static void makeSpatial(Network network,
                               java.lang.String nodeGeomColumn,
                               java.lang.String linkGeomColumn,
                               java.lang.String pathGeomColumn)
Convert a logical network to a spatial network Note this only updates the network metadata information
Parameters:
network - network to be converted
nodeGeomColumn - geometry column name for node table
linkGeomColumn - geometry column name for link table
pathGeomColumn - geometry column name for path table

makeLogical

public static void makeLogical(Network network)
Convert a spatial network to a logical network Note this only updates the network metadata information original spatial information remains unahcnged
Parameters:
network - network to be converted

insertGeomMetadata

public static void insertGeomMetadata(java.sql.Connection conn,
                                      java.lang.String tableName,
                                      java.lang.String geomColumnName,
                                      int srid,
                                      SDODimArray dimArray)
                               throws java.sql.SQLException
Inserts the geometry metadata to the database.
Parameters:
conn - the database connection
tableName - the geometry table name
geomColumnName - the geometry column name
srid - the SRID
dimArray - the SDODimArray
Throws:
java.sql.SQLException

getNetworkNameFromID

public static java.lang.String getNetworkNameFromID(java.sql.Connection conn,
                                                    int networkID)
                                             throws java.sql.SQLException
Returns the network name from a given network ID
Parameters:
conn - the database connection
networkID - the network ID
Throws:
java.sql.SQLException

getNetworkIDFromName

public static int getNetworkIDFromName(java.sql.Connection conn,
                                       java.lang.String networkName)
                                throws java.sql.SQLException
Returns the network ID from a given network name
Parameters:
conn - the database connection
networkName - the network name
Throws:
java.sql.SQLException

getNetworkNames

public static java.util.HashMap getNetworkNames(java.sql.Connection conn)
                                         throws java.sql.SQLException
Retunrs network names and IDs from the database. The result is in a HashMap with names as keys and IDs as values (Integers)
Parameters:
conn - the database connection
Returns:
a HashMap with network names as keys and IDs as values
Throws:
java.sql.SQLException

getNetworkIDs

public static java.util.HashMap getNetworkIDs(java.sql.Connection conn)
                                       throws java.sql.SQLException
Retunrs network names and IDs from the database. The result is in a HashMap with IDs as keys (Integers) and names as values
Parameters:
conn - the database connection
Returns:
a HashMap with network IDs as keys and names as values
Throws:
java.sql.SQLException

getPartitionIDArray

public static int[] getPartitionIDArray(java.sql.Connection conn,
                                        java.lang.String networkName)
                                 throws java.sql.SQLException,
                                        NetworkDataException
Returns node partition IDs in an array
Parameters:
conn - database connection
networkName - network name in database
Throws:
java.sql.SQLException
NetworkDataException

getNodePartitionID

public static int getNodePartitionID(java.sql.Connection conn,
                                     java.lang.String networkName,
                                     int nodeID)
                              throws java.sql.SQLException,
                                     NetworkDataException
Returns the partition ID of the given node
Parameters:
conn - database connection
networkName - network name in database
nodeID - given node ID
Throws:
java.sql.SQLException
NetworkDataException

isNetworkPartitioned

public static boolean isNetworkPartitioned(java.sql.Connection conn,
                                           java.lang.String networkName)
                                    throws NetworkDataException,
                                           java.sql.SQLException
Throws:
NetworkDataException
java.sql.SQLException

isPartitionedByNode

public static boolean isPartitionedByNode(java.sql.Connection conn,
                                          java.lang.String networkName)
                                   throws NetworkDataException,
                                          java.sql.SQLException
Throws:
NetworkDataException
java.sql.SQLException

validateNetwork

public static java.lang.String validateNetwork(Network network)
Validates the reference relationship of the given network return the validation result as a String

getNetworkFromCache

public static Network getNetworkFromCache(java.lang.String networkName)
                                   throws NetworkDataException
Gets the network from the network cache if the specified network is not in the cache, an NetworkDataException exception will be thrown. To put a network in the cache, use Networkmanager.putNetworkToCache(networkname, network)
Parameters:
networkName - network name
Throws:
NetworkDataException

putNetworkToCache

public static void putNetworkToCache(java.lang.String networkName,
                                     Network network)
Puts a network in the network cahce
Parameters:
networkName - network name
network - network to be cached

removeNetworkToCache

public static void removeNetworkToCache(java.lang.String networkName,
                                        Network network)
Removes a network from the network cahce
Parameters:
networkName - network name

getNetworkCacheMap

public static java.util.HashMap getNetworkCacheMap()
Returns the network cache as a HashMap with network name (type: String) as keys and networks (type: Network) as values

clearNetworkCache

public static void clearNetworkCache()
Clears the network cache

findNodesWithinDegreeBounds

public static Node[] findNodesWithinDegreeBounds(Network network,
                                                 int degreeType,
                                                 int minDegree,
                                                 int maxDegree)
Finds nodes with degree within the given degree bounds. Note the result will be sorted accoding to the degree in a decreasing order.
Parameters:
degreeType - type of node degree, -1 : in-degree, 1: out-degree and 0: degree
minDegree - minmum node degree
maxDegree - maximum node degree

findMaxNodeDegree

public static int findMaxNodeDegree(Network network,
                                    int degreeType)
Finds the maximum node degree of the network
Parameters:
degreeType - type of node degree, -1 : in-degree, 1: out-degree and 0: degree

findMinNodeDegree

public static int findMinNodeDegree(Network network,
                                    int degreeType)
Finds the minimum node degree of the network
Parameters:
degreeType - type of node degree, -1 : in-degree, 1: out-degree and 0: degree

Oracle® Spatial Java API Reference
10g Release 2 (10.2)

B14373-02


Copyright © 2006, Oracle. All Rights Reserved.