Пример #1
0
  @Test
  public void test() throws Exception {
    OwlLoadConfiguration config = new OwlLoadConfiguration();
    Neo4jConfiguration neo4jConfig = new Neo4jConfiguration();
    neo4jConfig.setLocation(folder.getRoot().getAbsolutePath());
    config.setGraphConfiguration(neo4jConfig);
    OntologySetup ontSetup = new OntologySetup();
    ontSetup.setUrl("http://127.0.0.1:10000/main.owl");
    config.getOntologies().add(ontSetup);
    BatchOwlLoader.load(config);

    GraphDatabaseService graphDb =
        new GraphDatabaseFactory().newEmbeddedDatabase(folder.getRoot().toString());
    graphDb.beginTx();
    GraphvizWriter writer = new GraphvizWriter();
    Walker walker = Walker.fullGraph(graphDb);
    writer.emit(new File("/tmp/test.dot"), walker);
  }
 @Override
 protected GraphTransactionalImpl createInstance() throws Exception {
   GraphDatabaseService graphDb =
       new GraphDatabaseFactory().newEmbeddedDatabase(new File(path).toString());
   Neo4jConfiguration config = new Neo4jConfiguration();
   config
       .getExactNodeProperties()
       .addAll(
           newHashSet(
               NodeProperties.LABEL, Concept.SYNONYM, Concept.ABREVIATION, Concept.ACRONYM));
   config
       .getIndexedNodeProperties()
       .addAll(
           newHashSet(
               NodeProperties.LABEL,
               Concept.CATEGORY,
               Concept.SYNONYM,
               Concept.ABREVIATION,
               Concept.ACRONYM));
   Neo4jModule.setupAutoIndexing(graphDb, config);
   IdMap idMap = new IdMap();
   RelationshipMap relationahipMap = new RelationshipMap();
   return new GraphTransactionalImpl(graphDb, idMap, relationahipMap);
 }