My Oracle Support Banner

How to Read Vertices which are Created with a String-id (Doc ID 2102207.1)

Last updated on OCTOBER 11, 2016

Applies to:

Oracle Big Data Spatial and Graph - Version 1.1 and later
Information in this document applies to any platform.

Goal

The goal of the note is to explain how to read vertices which are created with a string-id and avoid a problem where:

1. The vertices are added using OPG with a string-id (e.g. opg.addVertex( "1" ); ). So getId is going to return string.

2. But after shortestPath calculation vertices became Long. (Not all, first is still String). In this case when the getId method tries to convert Long to Sting it fails. An error is raised like below:

Error:

----- Shortest path from 7 to B ----
Vertices: 7 string
7 -> Exception in thread "main" java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.String
at fors.opg.AnalysTestGraph.getShortestPath(AnalysTestGraph.java:165)
at fors.opg.AnalysTestGraph.main(AnalysTestGraph.java:113)

 

Solution

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Goal
Solution


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.