Java Code Examples for org.apache.tinkerpop.gremlin.structure.io.Io#Builder

The following examples show how to use org.apache.tinkerpop.gremlin.structure.io.Io#Builder . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestGraph.java    From hugegraph with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public <I extends Io> I io(final Io.Builder<I> builder) {
    HugeGraphSONModule.OPTIMIZE_SERIALIZE = false;
    return (I) builder.graph(this).onMapper(mapper ->
        mapper.addRegistry(HugeGraphIoRegistry.instance())
    ).create();
}
 
Example 2
Source File: SqlgGraph.java    From sqlg with MIT License 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public <I extends Io> I io(final Io.Builder<I> builder) {
    if (builder.requiresVersion(GryoVersion.V1_0) || builder.requiresVersion(GraphSONVersion.V1_0))
        return (I) builder.graph(this).onMapper(mapper -> mapper.addRegistry(SqlgIoRegistryV1.instance())).create();
    else if (builder.requiresVersion(GraphSONVersion.V2_0))   // there is no gryo v2
        return (I) builder.graph(this).onMapper(mapper -> mapper.addRegistry(SqlgIoRegistryV2.instance())).create();
    else
        return (I) builder.graph(this).onMapper(mapper -> mapper.addRegistry(SqlgIoRegistryV3.instance())).create();
}
 
Example 3
Source File: BaseTest.java    From sqlg with MIT License 5 votes vote down vote up
protected void loadGratefulDead(SqlgGraph sqlgGraph) {
    Io.Builder<GraphSONIo> builder = GraphSONIo.build(GraphSONVersion.V3_0);
    final GraphReader reader = sqlgGraph.io(builder).reader().create();
    try (final InputStream stream = AbstractGremlinTest.class.getResourceAsStream("/grateful-dead-v3d0.json")) {
        reader.readGraph(stream, sqlgGraph);
    } catch (IOException e) {
        Assert.fail(e.getMessage());
    }
}
 
Example 4
Source File: BaseTest.java    From sqlg with MIT License 5 votes vote down vote up
protected void loadModern(SqlgGraph sqlgGraph) {
    Io.Builder<GraphSONIo> builder = GraphSONIo.build(GraphSONVersion.V3_0);
    final GraphReader reader = sqlgGraph.io(builder).reader().create();
    try (final InputStream stream = AbstractGremlinTest.class.getResourceAsStream("/tinkerpop-modern-v3d0.json")) {
        reader.readGraph(stream, sqlgGraph);
    } catch (IOException e) {
        Assert.fail(e.getMessage());
    }
}
 
Example 5
Source File: TinkerGraph.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
@Override
public <I extends Io> I io(final Io.Builder<I> builder) {
    if (builder.requiresVersion(GryoVersion.V1_0) || builder.requiresVersion(GraphSONVersion.V1_0))
        return (I) builder.graph(this).onMapper(mapper -> mapper.addRegistry(TinkerIoRegistryV1d0.instance())).create();
    else if (builder.requiresVersion(GraphSONVersion.V2_0))   // there is no gryo v2
        return (I) builder.graph(this).onMapper(mapper -> mapper.addRegistry(TinkerIoRegistryV2d0.instance())).create();
    else
        return (I) builder.graph(this).onMapper(mapper -> mapper.addRegistry(TinkerIoRegistryV3d0.instance())).create();
}
 
Example 6
Source File: TinkerGraph.java    From tinkergraph-gremlin with Apache License 2.0 5 votes vote down vote up
@Override
public <I extends Io> I io(final Io.Builder<I> builder) {
    if (builder.requiresVersion(GryoVersion.V1_0) || builder.requiresVersion(GraphSONVersion.V1_0))
        return (I) builder.graph(this).onMapper(mapper -> mapper.addRegistry(TinkerIoRegistryV1d0.instance())).create();
    else if (builder.requiresVersion(GraphSONVersion.V2_0))   // there is no gryo v2
        return (I) builder.graph(this).onMapper(mapper -> mapper.addRegistry(TinkerIoRegistryV2d0.instance())).create();
    else
        return (I) builder.graph(this).onMapper(mapper -> mapper.addRegistry(TinkerIoRegistryV3d0.instance())).create();
}
 
Example 7
Source File: StandardHugeGraph.java    From hugegraph with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public <I extends Io> I io(final Io.Builder<I> builder) {
    return (I) builder.graph(this).onMapper(mapper ->
        mapper.addRegistry(HugeGraphIoRegistry.instance())
    ).create();
}
 
Example 8
Source File: TitanBlueprintsGraph.java    From titan1withtp3.1 with Apache License 2.0 4 votes vote down vote up
@Override
public <I extends Io> I io(final Io.Builder<I> builder) {
    return (I) builder.graph(this).registry(TitanIoRegistry.INSTANCE).create();
}
 
Example 9
Source File: TitanBlueprintsTransaction.java    From titan1withtp3.1 with Apache License 2.0 4 votes vote down vote up
@Override
public <I extends Io> I io(final Io.Builder<I> builder) {
    return getGraph().io(builder);
}
 
Example 10
Source File: GryoIo.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
/**
 * Create a new builder using the default version of Gryo - v3.
 */
public static Io.Builder<GryoIo> build() {
    return build(GryoVersion.V3_0);
}
 
Example 11
Source File: GryoIo.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
/**
 * Create a new builder using the specified version of Gryo.
 */
public static Io.Builder<GryoIo> build(final GryoVersion version) {
    return new Builder(version);
}
 
Example 12
Source File: GryoIo.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
@Override
public Io.Builder<GryoIo> graph(final Graph g) {
    this.graph = g;
    return this;
}
 
Example 13
Source File: GraphSONIo.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
/**
 * Create a new builder using the default version of GraphSON - v3.
 */
public static Io.Builder<GraphSONIo> build() {
    return build(GraphSONVersion.V3_0);
}
 
Example 14
Source File: GraphSONIo.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
/**
 * Create a new builder using the specified version of GraphSON.
 */
public static Io.Builder<GraphSONIo> build(final GraphSONVersion version) {
    return new Builder(version);
}
 
Example 15
Source File: GraphSONIo.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
@Override
public Io.Builder<GraphSONIo> graph(final Graph g) {
    this.graph = g;
    return this;
}
 
Example 16
Source File: GraphMLIo.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
public static Io.Builder<GraphMLIo> build() {
    return new Builder();
}
 
Example 17
Source File: GraphMLIo.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
@Override
public Io.Builder<GraphMLIo> graph(final Graph g) {
    this.graph = g;
    return this;
}
 
Example 18
Source File: BitsyGraph.java    From bitsy with Apache License 2.0 4 votes vote down vote up
@Override
public <I extends Io> I io(final Io.Builder<I> builder) {
    return (I) builder.graph(this).onMapper(m -> m.addRegistry(BitsyIoRegistryV3d0.instance())).create();
}
 
Example 19
Source File: HugeGraphAuthProxy.java    From hugegraph with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings({ "rawtypes", "deprecation" })
@Override
public <I extends Io> I io(final Io.Builder<I> builder) {
    this.verifyStatusPermission();
    return this.hugegraph.io(builder);
}
 
Example 20
Source File: Graph.java    From tinkerpop with Apache License 2.0 2 votes vote down vote up
/**
 * Construct a particular {@link Io} implementation for reading and writing the {@code Graph} and other data.
 * End-users will "select" the {@link Io} implementation that they want to use by supplying the
 * {@link Io.Builder} that constructs it.  In this way, {@code Graph} vendors can supply their {@link IoRegistry}
 * to that builder thus allowing for custom serializers to be auto-configured into the {@link Io} instance.
 * Registering custom serializers is particularly useful for those  graphs that have complex types for
 * {@link Element} identifiers.
 * </p>
 * For those graphs that do not need to register any custom serializers, the default implementation should suffice.
 * If the default is overridden, take care to register the current graph via the
 * {@link org.apache.tinkerpop.gremlin.structure.io.Io.Builder#graph(Graph)} method.
 *
 * @deprecated As of release 3.4.0, replaced by {@link GraphTraversalSource#io(String)}.
 */
@Deprecated
public default <I extends Io> I io(final Io.Builder<I> builder) {
    return (I) builder.graph(this).create();
}