15.5.1.1.2 Loading Edge Providers
You can add an edge provider, by calling
alterationBuilder.addEdgeProvider(EntityProviderConfig edgeProviderConfig) where edgeProviderConfig
. edgeProviderConfig
is an edge provider configuration and it provides configuration details such as:
- location of the datasource to load from
- the stored format
- properties of the edge provider
The source and destination vertex providers to which it is linked must either be already in the base graph (and not removed in the alteration), or added with the alteration.
Additionally, you can also add the provider by calling alterationBuilder.addVertexProvider(String pathToVertexProviderConfig)
where pathToVertexProviderConfig
points to a file accessible from the client that contains a JSON representation of an vertex provider configuration.
For example, an edge provider can be added in the alteration as shown:
// loading by indicating the path to the JSON file
alterationBuilder.addEdgeProvider("<path-to-edge-provider-configuration>");
// or by first loading the content of a JSON file into an EntityProviderConfig object
EntityProviderConfig edgeProviderConfig = new AnyFormatEntityProviderConfigFactory().fromPath("<path-to-edge-provider-configuration>");
alterationBuilder.addEdgeProvider(edgeProviderConfig);
Alternatively, the edge provider configuration can be built programmatically:
FileEntityProviderConfigBuilder edgeProviderConfigBuilder = new FileEntityProviderConfigBuilder().
setFormat().
setName("typicalEdgeProvider").
hasHeader(true).
setUris("").
setSourceVertexProvider("typicalVertexProvider").
setDestinationVertexProvider("anotherTypicalVertexProvider").
setSourceColumn("source").
setDestinationColumn("destination").
setKeyColumn("EID").
createKeyMapping(true).
setErrorHandlingOnMissingVertex(OnMissingVertex.IGNORE_EDGE).
addProperty("cost", PropertyType.DOUBLE);
EntityProviderConfig edgeProviderConfig = edgeProviderConfigBuilder.build();
alterationBuilder.addEdgeProvider(edgeProviderConfig);
Parent topic: Loading Or Removing Additional Vertex or Edge Providers