• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java IoCore类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.tinkerpop.gremlin.structure.io.IoCore的典型用法代码示例。如果您正苦于以下问题:Java IoCore类的具体用法?Java IoCore怎么用?Java IoCore使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IoCore类属于org.apache.tinkerpop.gremlin.structure.io包,在下文中一共展示了IoCore类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: loadGraph

import org.apache.tinkerpop.gremlin.structure.io.IoCore; //导入依赖的package包/类
private void loadGraph() {
    final File f = new File(graphLocation);
    if (f.exists() && f.isFile()) {
        try {
            if (graphFormat.equals("graphml")) {
                io(IoCore.graphml()).readGraph(graphLocation);
            } else if (graphFormat.equals("graphson")) {
                io(IoCore.graphson()).readGraph(graphLocation);
            } else if (graphFormat.equals("gryo")) {
                io(IoCore.gryo()).readGraph(graphLocation);
            } else {
                io(IoCore.createIoBuilder(graphFormat)).readGraph(graphLocation);
            }
        } catch (Exception ex) {
            throw new RuntimeException(String.format("Could not load graph at %s with %s", graphLocation, graphFormat), ex);
        }
    }
}
 
开发者ID:ShiftLeftSecurity,项目名称:tinkergraph-gremlin,代码行数:19,代码来源:TinkerGraph.java


示例2: loadGraph

import org.apache.tinkerpop.gremlin.structure.io.IoCore; //导入依赖的package包/类
public boolean loadGraph(String name)
{
  tg = TinkerGraph.open() ;
  
  try
  {
    tg.io(IoCore.graphml()).readGraph(name);
  }
  catch( IOException e )
  {
    System.out.println("GraphStats - GraphML file not found");
    return false;
  }
  g = tg.traversal();
  return true;
}
 
开发者ID:krlawrence,项目名称:graph,代码行数:17,代码来源:GraphSearch3.java


示例3: loadGraph

import org.apache.tinkerpop.gremlin.structure.io.IoCore; //导入依赖的package包/类
public boolean loadGraph(String name)
{
  tg = TinkerGraph.open() ;
  
  try
  {
    tg.io(IoCore.graphml()).readGraph(name);
  }
  catch( IOException e )
  {
    System.out.println("GraphStats - Air routes GraphML file not found");
    return false;
  }
  g = tg.traversal();
  return true;
}
 
开发者ID:krlawrence,项目名称:graph,代码行数:17,代码来源:GraphSearch.java


示例4: saveGraph

import org.apache.tinkerpop.gremlin.structure.io.IoCore; //导入依赖的package包/类
private void saveGraph() {
    final File f = new File(graphLocation);
    if (f.exists()) {
        f.delete();
    } else {
        final File parent = f.getParentFile();
        if (!parent.exists()) {
            parent.mkdirs();
        }
    }

    try {
        if (graphFormat.equals("graphml")) {
            io(IoCore.graphml()).writeGraph(graphLocation);
        } else if (graphFormat.equals("graphson")) {
            io(IoCore.graphson()).writeGraph(graphLocation);
        } else if (graphFormat.equals("gryo")) {
            io(IoCore.gryo()).writeGraph(graphLocation);
        } else {
            io(IoCore.createIoBuilder(graphFormat)).writeGraph(graphLocation);
        }
    } catch (Exception ex) {
        throw new RuntimeException(String.format("Could not save graph at %s with %s", graphLocation, graphFormat), ex);
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:26,代码来源:TinkerGraph.java


示例5: loadGraph

import org.apache.tinkerpop.gremlin.structure.io.IoCore; //导入依赖的package包/类
private void loadGraph() {
	final File f = new File(graphLocation);
    if (f.exists() && f.isFile()) {
        try {
            if (graphFormat.equals("graphml")) {
                io(IoCore.graphml()).readGraph(graphLocation);
            } else if (graphFormat.equals("graphson")) {
                io(IoCore.graphson()).readGraph(graphLocation);
            } else if (graphFormat.equals("gryo")) {
                io(IoCore.gryo()).readGraph(graphLocation);
            } else {
                io(IoCore.createIoBuilder(graphFormat)).readGraph(graphLocation);
            }
        } catch (Exception ex) {
            throw new RuntimeException(String.format("Could not load graph at %s with %s", graphLocation, graphFormat), ex);
        }
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:19,代码来源:LiteGraph.java


示例6: saveGraph

import org.apache.tinkerpop.gremlin.structure.io.IoCore; //导入依赖的package包/类
private void saveGraph() {
	
	final File f = new File(graphLocation);
    if (f.exists()) {
        f.delete();
    } else {
        final File parent = f.getParentFile();
        if (!parent.exists()) {
            parent.mkdirs();
        }
    }

    try {
        if (graphFormat.equals("graphml")) {
            io(IoCore.graphml()).writeGraph(graphLocation);
        } else if (graphFormat.equals("graphson")) {
            io(IoCore.graphson()).writeGraph(graphLocation);
        } else if (graphFormat.equals("gryo")) {
            io(IoCore.gryo()).writeGraph(graphLocation);
        } else {
            io(IoCore.createIoBuilder(graphFormat)).writeGraph(graphLocation);
        }
    } catch (Exception ex) {
        throw new RuntimeException(String.format("Could not save graph at %s with %s", graphLocation, graphFormat), ex);
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:27,代码来源:LiteGraph.java


示例7: persistModel

import org.apache.tinkerpop.gremlin.structure.io.IoCore; //导入依赖的package包/类
@Override
public void persistModel() throws IOException, XMLStreamException, ClassNotFoundException, IllegalAccessException,
		InstantiationException {
	final TinkerGraphFormat format = gc.getGraphFormat();
	Builder<?> builder = null;
	switch (format) {
	case GRAPHML:
		builder = IoCore.graphml();
		break;
	case GRAPHSON:
		builder = IoCore.graphson();
		break;
	case GRYO:
		builder = IoCore.gryo();
		break;
	default:
		throw new UnsupportedOperationException("Format " + format + " is not supported.");
	}

	final String postfix = "-tinkerpop." + format.toString().toLowerCase();
	final String fileName = gc.getConfigBase().getModelPathWithoutExtension() + postfix;
	graph.io(builder).writeGraph(fileName);
	graph.close();
}
 
开发者ID:FTSRG,项目名称:trainbenchmark,代码行数:25,代码来源:TinkerGraphSerializer.java


示例8: writeGraph

import org.apache.tinkerpop.gremlin.structure.io.IoCore; //导入依赖的package包/类
public String writeGraph() {
  java.io.OutputStream output = new java.io.OutputStream() {
    private StringBuilder stringBuilder = new StringBuilder();
    @Override
    public void write(int chr) throws java.io.IOException {
      stringBuilder.append((char) chr );
    }

    @Override
    public String toString() {
      return stringBuilder.toString();
    }
  };
  try {
    graph.io(IoCore.graphson()).writer().create().writeGraph(output, graph);
  } catch (java.io.IOException e) {
    e.printStackTrace();
  }

  String wellformedJson = "[" + String.join(",\n", (CharSequence[]) output.toString().split("\n")) + "]";
  com.google.gson.Gson gson = new GsonBuilder().setPrettyPrinting().create();
  com.google.gson.JsonParser jp = new JsonParser();
  com.google.gson.JsonElement je = jp.parse(wellformedJson);
  return gson.toJson(je);
}
 
开发者ID:HuygensING,项目名称:timbuctoo,代码行数:26,代码来源:TestableTinkerPopGraphManager.java


示例9: saveGraph

import org.apache.tinkerpop.gremlin.structure.io.IoCore; //导入依赖的package包/类
private void saveGraph() {
    final File f = new File(graphLocation);
    if (f.exists()) {
        f.delete();
    } else {
        final File parent = f.getParentFile();

        // the parent would be null in the case of an relative path if the graphLocation was simply: "f.gryo"
        if (parent != null && !parent.exists()) {
            parent.mkdirs();
        }
    }

    try {
        if (graphFormat.equals("graphml")) {
            io(IoCore.graphml()).writeGraph(graphLocation);
        } else if (graphFormat.equals("graphson")) {
            io(IoCore.graphson()).writeGraph(graphLocation);
        } else if (graphFormat.equals("gryo")) {
            io(IoCore.gryo()).writeGraph(graphLocation);
        } else {
            io(IoCore.createIoBuilder(graphFormat)).writeGraph(graphLocation);
        }
    } catch (Exception ex) {
        throw new RuntimeException(String.format("Could not save graph at %s with %s", graphLocation, graphFormat), ex);
    }
}
 
开发者ID:ShiftLeftSecurity,项目名称:tinkergraph-gremlin,代码行数:28,代码来源:TinkerGraph.java


示例10: shouldSerializeTinkerGraphToGryo

import org.apache.tinkerpop.gremlin.structure.io.IoCore; //导入依赖的package包/类
@Test
public void shouldSerializeTinkerGraphToGryo() throws Exception {
    final TinkerGraph graph = TinkerFactory.createModern();
    try (final ByteArrayOutputStream out = new ByteArrayOutputStream()) {
        graph.io(IoCore.gryo()).writer().create().writeObject(out, graph);
        final byte[] b = out.toByteArray();
        try (final ByteArrayInputStream inputStream = new ByteArrayInputStream(b)) {
            final TinkerGraph target = graph.io(IoCore.gryo()).reader().create().readObject(inputStream, TinkerGraph.class);
            IoTest.assertModernGraph(target, true, false);
        }
    }
}
 
开发者ID:ShiftLeftSecurity,项目名称:tinkergraph-gremlin,代码行数:13,代码来源:TinkerGraphTest.java


示例11: shouldSerializeTinkerGraphWithMultiPropertiesToGryo

import org.apache.tinkerpop.gremlin.structure.io.IoCore; //导入依赖的package包/类
@Test
public void shouldSerializeTinkerGraphWithMultiPropertiesToGryo() throws Exception {
    final TinkerGraph graph = TinkerFactory.createTheCrew();
    try (final ByteArrayOutputStream out = new ByteArrayOutputStream()) {
        graph.io(IoCore.gryo()).writer().create().writeObject(out, graph);
        final byte[] b = out.toByteArray();
        try (final ByteArrayInputStream inputStream = new ByteArrayInputStream(b)) {
            final TinkerGraph target = graph.io(IoCore.gryo()).reader().create().readObject(inputStream, TinkerGraph.class);
            IoTest.assertCrewGraph(target, false);
        }
    }
}
 
开发者ID:ShiftLeftSecurity,项目名称:tinkergraph-gremlin,代码行数:13,代码来源:TinkerGraphTest.java


示例12: shouldSerializeTinkerGraphToGraphSON

import org.apache.tinkerpop.gremlin.structure.io.IoCore; //导入依赖的package包/类
@Test
public void shouldSerializeTinkerGraphToGraphSON() throws Exception {
    final TinkerGraph graph = TinkerFactory.createModern();
    try (final ByteArrayOutputStream out = new ByteArrayOutputStream()) {
        graph.io(IoCore.graphson()).writer().create().writeObject(out, graph);
        try (final ByteArrayInputStream inputStream = new ByteArrayInputStream(out.toByteArray())) {
            final TinkerGraph target = graph.io(IoCore.graphson()).reader().create().readObject(inputStream, TinkerGraph.class);
            IoTest.assertModernGraph(target, true, false);
        }
    }
}
 
开发者ID:ShiftLeftSecurity,项目名称:tinkergraph-gremlin,代码行数:12,代码来源:TinkerGraphTest.java


示例13: shouldSerializeTinkerGraphWithMultiPropertiesToGraphSON

import org.apache.tinkerpop.gremlin.structure.io.IoCore; //导入依赖的package包/类
@Test
public void shouldSerializeTinkerGraphWithMultiPropertiesToGraphSON() throws Exception {
    final TinkerGraph graph = TinkerFactory.createTheCrew();
    try (final ByteArrayOutputStream out = new ByteArrayOutputStream()) {
        graph.io(IoCore.graphson()).writer().create().writeObject(out, graph);
        try (final ByteArrayInputStream inputStream = new ByteArrayInputStream(out.toByteArray())) {
            final TinkerGraph target = graph.io(IoCore.graphson()).reader().create().readObject(inputStream, TinkerGraph.class);
            IoTest.assertCrewGraph(target, false);
        }
    }
}
 
开发者ID:ShiftLeftSecurity,项目名称:tinkergraph-gremlin,代码行数:12,代码来源:TinkerGraphTest.java


示例14: shouldSerializeTinkerGraphToGraphSONWithTypes

import org.apache.tinkerpop.gremlin.structure.io.IoCore; //导入依赖的package包/类
@Test
public void shouldSerializeTinkerGraphToGraphSONWithTypes() throws Exception {
    final TinkerGraph graph = TinkerFactory.createModern();
    final Mapper<ObjectMapper> mapper = graph.io(IoCore.graphson()).mapper().typeInfo(TypeInfo.PARTIAL_TYPES).create();
    try (final ByteArrayOutputStream out = new ByteArrayOutputStream()) {
        final GraphWriter writer = GraphSONWriter.build().mapper(mapper).create();
        writer.writeObject(out, graph);
        try (final ByteArrayInputStream inputStream = new ByteArrayInputStream(out.toByteArray())) {
            final GraphReader reader = GraphSONReader.build().mapper(mapper).create();
            final TinkerGraph target = reader.readObject(inputStream, TinkerGraph.class);
            IoTest.assertModernGraph(target, true, false);
        }
    }
}
 
开发者ID:ShiftLeftSecurity,项目名称:tinkergraph-gremlin,代码行数:15,代码来源:TinkerGraphTest.java


示例15: setup

import org.apache.tinkerpop.gremlin.structure.io.IoCore; //导入依赖的package包/类
@Override
public void setup(final Map<String,Object> config) {
    logger.info("Initializing authentication with the {}", SimpleAuthenticator.class.getName());

    if (null == config) {
        throw new IllegalArgumentException(String.format(
                "Could not configure a %s - provide a 'config' in the 'authentication' settings",
                SimpleAuthenticator.class.getName()));
    }

    if (!config.containsKey(CONFIG_CREDENTIALS_DB)) {
        throw new IllegalStateException(String.format(
                "Credentials configuration missing the %s key that points to a graph config file", CONFIG_CREDENTIALS_DB));
    }

    final Graph graph = GraphFactory.open((String) config.get(CONFIG_CREDENTIALS_DB));

    if (graph instanceof TinkerGraph) {
        // have to create the indices because they are not stored in gryo
        final TinkerGraph tinkerGraph = (TinkerGraph) graph;
        tinkerGraph.createIndex(PROPERTY_USERNAME, Vertex.class);

        // we deprecated credentialsLocation, but we still need to support it.  if it is present as a key, we can
        // load the data as we always did.
        if (config.containsKey(CONFIG_CREDENTIALS_LOCATION)) {
            logger.warn("Using {} configuration option which is deprecated - prefer including the location of the credentials graph data in the TinkerGraph config file.");
            final String location = (String) config.get(CONFIG_CREDENTIALS_LOCATION);
            try {
                tinkerGraph.io(IoCore.gryo()).readGraph(location);
            } catch (IOException e) {
                logger.warn("Could not read credentials graph from {} - authentication is enabled, but with an empty user database", location);
            }
        }
    }

    credentialStore = CredentialGraph.credentials(graph);
    logger.info("CredentialGraph initialized at {}", credentialStore);
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:39,代码来源:SimpleAuthenticator.java


示例16: serializeDeserialize

import org.apache.tinkerpop.gremlin.structure.io.IoCore; //导入依赖的package包/类
private Pair<StarGraph, Integer> serializeDeserialize(final StarGraph starGraph) {
    final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    try {
        graph.io(IoCore.gryo()).writer().create().writeObject(outputStream, starGraph);
        return Pair.with(graph.io(IoCore.gryo()).reader().create().readObject(new ByteArrayInputStream(outputStream.toByteArray()), StarGraph.class), outputStream.size());
    } catch (IOException ioe) {
        throw new RuntimeException(ioe);
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:10,代码来源:StarGraphTest.java


示例17: shouldSerializeTinkerGraphToGraphSONWithTypes

import org.apache.tinkerpop.gremlin.structure.io.IoCore; //导入依赖的package包/类
@Test
public void shouldSerializeTinkerGraphToGraphSONWithTypes() throws Exception {
    final TinkerGraph graph = TinkerFactory.createModern();
    final Mapper<ObjectMapper> mapper = graph.io(IoCore.graphson()).mapper().embedTypes(true).create();
    try (final ByteArrayOutputStream out = new ByteArrayOutputStream()) {
        final GraphWriter writer = GraphSONWriter.build().mapper(mapper).create();
        writer.writeObject(out, graph);
        try (final ByteArrayInputStream inputStream = new ByteArrayInputStream(out.toByteArray())) {
            final GraphReader reader = GraphSONReader.build().mapper(mapper).create();
            final TinkerGraph target = reader.readObject(inputStream, TinkerGraph.class);
            IoTest.assertModernGraph(target, true, false);
        }
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:15,代码来源:TinkerGraphTest.java


示例18: loadFromDisk

import org.apache.tinkerpop.gremlin.structure.io.IoCore; //导入依赖的package包/类
public void loadFromDisk(final String file) {
  try {
    System.out.println("loading db from " + file + "...");
    graph.io(IoCore.gryo()).readGraph(file);
  } catch (final IOException e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:HuygensING,项目名称:antioch,代码行数:9,代码来源:Storage.java


示例19: saveToDisk

import org.apache.tinkerpop.gremlin.structure.io.IoCore; //导入依赖的package包/类
private void saveToDisk(final String file) {
  if (file != null) {
    System.out.println("storing db to " + file + "...");
    try {
      graph.io(IoCore.gryo()).writeGraph(file);
    } catch (final IOException e) {
      throw new RuntimeException(e);
    }
  }
}
 
开发者ID:HuygensING,项目名称:antioch,代码行数:11,代码来源:Storage.java


示例20: exportToGson

import org.apache.tinkerpop.gremlin.structure.io.IoCore; //导入依赖的package包/类
@Override
public void exportToGson(OutputStream os) throws IOException {

    GraphSONMapper mapper = getGraph().io(IoCore.graphson()).mapper().create();
    GraphSONWriter.Builder builder = GraphSONWriter.build();
    builder.mapper(mapper);
    GraphSONWriter writer = builder.create();
    writer.writeGraph(os, getGraph());
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:10,代码来源:Titan1Graph.java



注:本文中的org.apache.tinkerpop.gremlin.structure.io.IoCore类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ContactID类代码示例发布时间:2022-05-22
下一篇:
Java ImeAdapter类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap