org.apache.tinkerpop.gremlin.structure.io.Io Java Examples

The following examples show how to use org.apache.tinkerpop.gremlin.structure.io.Io. 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: 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 #2
Source File: LegacyGraphSONReader.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
/**
 * This method is not supported for this reader.
 *
 * @throws UnsupportedOperationException when called.
 */
@Override
public Vertex readVertex(final InputStream inputStream, final Function<Attachable<Vertex>, Vertex> vertexAttachMethod,
                         final Function<Attachable<Edge>, Edge> edgeAttachMethod,
                         final Direction attachEdgesOfThisDirection) throws IOException {
    throw Io.Exceptions.readerFormatIsForFullGraphSerializationOnly(this.getClass());
}
 
Example #3
Source File: LegacyGraphSONReader.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
/**
 * This method is not supported for this reader.
 *
 * @throws UnsupportedOperationException when called.
 */
@Override
public Iterator<Vertex> readVertices(final InputStream inputStream,
                                     final Function<Attachable<Vertex>, Vertex> vertexAttachMethod,
                                     final Function<Attachable<Edge>, Edge> edgeAttachMethod,
                                     final Direction attachEdgesOfThisDirection) throws IOException {
    throw Io.Exceptions.readerFormatIsForFullGraphSerializationOnly(this.getClass());
}
 
Example #4
Source File: GraphMLReader.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
/**
 * This method is not supported for this reader.
 *
 * @throws UnsupportedOperationException when called.
 */
@Override
public Iterator<Vertex> readVertices(final InputStream inputStream,
                                     final Function<Attachable<Vertex>, Vertex> vertexAttachMethod,
                                     final Function<Attachable<Edge>, Edge> edgeAttachMethod,
                                     final Direction attachEdgesOfThisDirection) throws IOException {
    throw Io.Exceptions.readerFormatIsForFullGraphSerializationOnly(this.getClass());
}
 
Example #5
Source File: GraphMLReader.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
/**
 * This method is not supported for this reader.
 *
 * @throws UnsupportedOperationException when called.
 */
@Override
public Vertex readVertex(final InputStream inputStream, final Function<Attachable<Vertex>, Vertex> vertexAttachMethod,
                         final Function<Attachable<Edge>, Edge> edgeAttachMethod,
                         final Direction attachEdgesOfThisDirection) throws IOException {
    throw Io.Exceptions.readerFormatIsForFullGraphSerializationOnly(this.getClass());
}
 
Example #6
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 #7
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 #8
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 #9
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 #10
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 #11
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 #12
Source File: TinkerGraphTest.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
@Override
public Io create() {
    calledCreate++;
    return mock(Io.class);
}
 
Example #13
Source File: GraphMLReader.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
/**
 * This method is not supported for this reader.
 *
 * @throws UnsupportedOperationException when called.
 */
@Override
public Property readProperty(final InputStream inputStream,
                             final Function<Attachable<Property>, Property> propertyAttachMethod) throws IOException {
    throw Io.Exceptions.readerFormatIsForFullGraphSerializationOnly(this.getClass());
}
 
Example #14
Source File: GraphMLReader.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
/**
 * This method is not supported for this reader.
 *
 * @throws UnsupportedOperationException when called.
 */
@Override
public VertexProperty readVertexProperty(final InputStream inputStream,
                                         final Function<Attachable<VertexProperty>, VertexProperty> vertexPropertyAttachMethod) throws IOException {
    throw Io.Exceptions.readerFormatIsForFullGraphSerializationOnly(this.getClass());
}
 
Example #15
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 #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: LegacyGraphSONReader.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
/**
 * This method is not supported for this reader.
 *
 * @throws UnsupportedOperationException when called.
 */
@Override
public Property readProperty(final InputStream inputStream,
                             final Function<Attachable<Property>, Property> propertyAttachMethod) throws IOException {
    throw Io.Exceptions.readerFormatIsForFullGraphSerializationOnly(this.getClass());
}
 
Example #18
Source File: LegacyGraphSONReader.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
/**
 * This method is not supported for this reader.
 *
 * @throws UnsupportedOperationException when called.
 */
@Override
public VertexProperty readVertexProperty(final InputStream inputStream,
                                         final Function<Attachable<VertexProperty>, VertexProperty> vertexPropertyAttachMethod) throws IOException {
    throw Io.Exceptions.readerFormatIsForFullGraphSerializationOnly(this.getClass());
}
 
Example #19
Source File: HugeGraphIoRegistry.java    From hugegraph with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("rawtypes")
@Override
public void register(Class<? extends Io> ioClass, Class clazz, Object ser) {
    super.register(ioClass, clazz, ser);
}
 
Example #20
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 #21
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 #22
Source File: TinkerGraphTest.java    From tinkergraph-gremlin with Apache License 2.0 4 votes vote down vote up
@Override
public Io create() {
    calledCreate++;
    return mock(Io.class);
}
 
Example #23
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 #24
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 #25
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 #26
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 #27
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 #28
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 #29
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 #30
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;
}