Network Data Model Application Programming Interface

The Oracle Spatial Network Data Model feature includes two client application programming interfaces (APIs): a PL/SQL interface provided by the SDO_NET package and a Java interface.

Both interfaces let you create and update network data, and the Java interface lets you perform network analysis. It is recommended that you use only PL/SQL or SQL to populate network tables and to create indexes, and that you mainly use Java for application development.

The following performance considerations apply to the PL/SQL and Java APIs:

Network Data Model PL/SQL Interface

The SDO_NET package provides subprograms for creating, accessing, and managing networks on a database server. Example: Spatial (LRS) Network Example (PL/SQL) in Network Examples shows the use of SDO_NET functions and procedures.

The SDO_NET subprograms can be grouped into the following logical categories:

For reference information about each SDO_NET function and procedure, see SDO_NET Package Subprograms.

Network Data Model Java Interface

Note: Effective with Oracle AI Database 26ai, the Oracle Spatial Network Data Model APIs are compiled with JDK 11 as the OJVM in the database supports JDK 11. However, the APIs will continue to be supported on JDK8 for backwards compatibility. When using the API, ensure that all the related JAR files are consistent with the JDK version (JDK 8 or JDK 11) that is being used. See RDBMS and JDK Version Compatibility for Oracle JDBC Drivers for more information on the JDBC drivers that are supported for the different JDK versions.

The Network Data Model feature includes the load on demand Java interface. Complete reference information about this interface is provided in Oracle Spatial Java API Reference. The classes of the load on demand Java interface are in the oracle.spatial.network.lod package and its subpackages.

The Spatial Java class libraries are in .jar files under the <ORACLE_HOME>/md/jlib/ directory.

Network Metadata and Data Management

You can use the Java API to perform network metadata and data management operations such as the following:

Network Analysis Using the Load on Demand Approach

You can use the oracle.spatial.network.lod.NetworkAnalyst class to perform network analysis operations, such as the following, using the load on demand approach:

Network Data Model XML Interface

Note: To efficiently and securely implement your customized network analysis, Oracle Spatial is deprecating the NDM XML API. Instead, use the Load On Demand (LOD) API. The LOD API provides customization interfaces that allow you to easily and securely implement your customization. In addition, you can also use the NDM Contraction Hierarchies REST API for high performance network analysis.

You can use the Network Data Model XML API to perform network analysis. Web service requests are supported through Oracle Spatial web services, which are described in Oracle Spatial Developer’s Guide.

HTTP requests can be sent to the web service from Java, PLSQL, or .NET programs or simply from a HTML form. The SDO_NET.POST_XML function (described in SDO_NET Package Subprograms) enables PL/SQL users to call the web service.

The XML schema of the Network Data Model XML API is described in the following: $ORACLE_HOME/md/doc/sdondmxml.zip

User-Specified Implementations

The XML API can take user-specified constraints, cost calculators, or even network analysis algorithm settings, by letting you specify the Java class that implements the LOD interfaces. For any implementation that requires input parameters, such as truck weight or height in a trucking constraint implementation, the Java class must implement the oracle.spatial.network.lod.XMLConfigurable interface, that is, it must implement the following two methods:

The init method lets you pass in the input parameter as an XML element, which must follow the schema returned from the getXMLSchema method.

The following XML code segment is an example of how to configure the shortest path algorithm for a shortest path analysis request:

<startPoint>
  <nodeID>123</nodeID>
</startPoint>
<endPoint>
  <nodeID>456</nodeID>
</endPoint>
<shortestPathAlgorithm>
  <className>oracle.spatial.network.lod.AStar</className>
  <parameters>
    <heuristicCostFunction>
      <className>oracle.spatial.network.lod.GeodeticCostFunction</className>
      <parameters>
        <userDataCategory>0</userDataCategory>
        <xCoordUserDataIndex>0</xCoordUserDataIndex>
        <yCoordUserDataIndex>1</yCoordUserDataIndex>
      </parameters>
    </heuristicCostFunction>
    <linkLevelSelector>
      <className>oracle.spatial.network.lod.DynamicLinkLevelSelector</className>
      <parameters>
        <maxLinkLevel>2</maxLinkLevel>
        <costThreshold linkLevel="1">40000</costThreshold>
        <numHighLevelNeighbors>8</numHighLevelNeighbors>
        <costMultiplier>1.5</costMultiplier>
        <costFunction>
          <className>oracle.spatial.network.lod.GeodeticCostFunction</className>
          <parameters>
            <userDataCategory>0</userDataCategory>
            <xCoordUserDataIndex>0</xCoordUserDataIndex>
            <yCoordUserDataIndex>1</yCoordUserDataIndex>
          </parameters>
        </costFunction>
      </parameters>
    </linkLevelSelector>
  </parameters>
</shortestPathAlgorithm>

More examples of the XML API are provided with the NDM tutorial (see Network Data Model Tutorial and Other Resources).