14.5.1.1.3 Adding Additional Empty Vertex or Edge Providers
You can also add empty vertex or edge providers, without having the providers connected to any specific datasource.
The names and types of the properties of each empty provider can be specified programmatically. Similarly, you can also specify if a key mapping for the providers needs to be created.
Adding Additional Empty Vertex Providers
You can add an empty vertex provider by calling
alterationBuilder.addEmptyVertexProvider(String
vertexProviderName)
. You can then add properties, specify the key
column, create the key mapping programmatically as shown in the following
example.
See the GraphAlterationEmptyVertexProviderBuilder Interface in the Javadoc for more details.
opg4j> alterationBuilder.addEmptyVertexProvider("AccountsProvider").
...> setLabel("Accounts").
...> createKeyMapping(true).
...> addProperty("NAME", PropertyType.STRING)
$14 ==> oracle.pgx.api.graphalteration.internal.GraphAlterationEmptyVertexProviderBuilderImpl@4b3ea082
alterationBuilder.addEmptyVertexProvider("AccountsProvider")
.setLabel("Accounts")
.createKeyMapping(true)
.addProperty("NAME", PropertyType.STRING);
Adding Additional Empty Edge Providers
You can add an empty edge provider by calling
alterationBuilder.addEmptyEdgeProvider(String providerName, String
sourceProvider, String destProvider)
. You can then add properties,
specify the key column, create the key mapping programmatically as shown in the
following example.
See the GraphAlterationEmptyEdgeProviderBuilder Interface in the Javadoc for more details.
opg4j> alterationBuilder.addEmptyEdgeProvider("TransactionProvider", "Accounts", "Accounts").
...> setLabel("Transfers").
...> createKeyMapping(false). // set to false if no keys are needed
...> addProperty("Description", PropertyType.STRING)
$26 ==> oracle.pgx.api.graphalteration.internal.GraphAlterationEmptyEdgeProviderBuilderImpl@54720caf
alterationBuilder.addEmptyEdgeProvider("TransactionProvider", "Accounts", "Accounts")
.setLabel("Transfers")
.createKeyMapping(false)
.addProperty("Description", PropertyType.STRING);
Parent topic: Loading Or Removing Additional Vertex or Edge Providers