Package org.neo4j.kernel

Examples of org.neo4j.kernel.EmbeddedReadOnlyGraphDatabase


    int maxPapers = 1000000;
    int maxAuthors = 1000000;

    // Import Neo4j DB
    System.out.println("Reading neo4j db from " + Config.get().neo4jDbPath);
    EmbeddedReadOnlyGraphDatabase graphDB = new EmbeddedReadOnlyGraphDatabase(Config.get().neo4jDbPath);

    // Get 'author names' and 'paper titles' along with their page ranks into one big list
    ArrayList<CompleteEntry> PaperEntryList = new ArrayList<CompleteEntry>(1000000);
    ArrayList<CompleteEntry> AuthorEntryList = new ArrayList<CompleteEntry>(500000);

    //final int PAPER_TYPE = 0;
    //final int AUTHOR_TYPE = 1;

    int counter = 0;
    for (Node node: graphDB.getAllNodes()) {
      if (isPaperNode(node)) {
        CompleteEntry entry = new CompleteEntry();
        entry.FromPaperNode(node);
        PaperEntryList.add(entry);
      }
     
      if (isAuthorNode(node)) {
        CompleteEntry entry = new CompleteEntry();
        entry.FromAuthorNode(node);
        AuthorEntryList.add(entry);
      }
     
      counter++;
      if (counter % 10000 == 0){
        IOHelper.log("Adding entries. Processed " + counter + " nodes. Filled " + (PaperEntryList.size() + AuthorEntryList.size())+ " index entries.");
//        break;
      }

    }

    // Finished db reading.
    graphDB.shutdown();

    // sort list by page rank
    System.out.println("Sorting index entries.");
    Collections.sort(PaperEntryList, new Comparator<CompleteEntry>() {
      @Override
View Full Code Here


  /**
   * @param args
   */
  public static void main(String[] args) {
    EmbeddedReadOnlyGraphDatabase graphDB = new EmbeddedReadOnlyGraphDatabase(Config.get().neo4jDbPath);
    FriendOfAFriendQueryBenchmark foafqb = new FriendOfAFriendQueryBenchmark(graphDB);
   
    int cnt = 0;
   
    System.out.println("done start benchmark");
View Full Code Here

    final Map<String, String> graphConfig = loadDatabaseConfig(config);

    // load database from path specified
    AbstractGraphDatabase database;
    if (config.getReadOnly()) {
      database = new EmbeddedReadOnlyGraphDatabase(
          config.getDatabasePath(), graphConfig);
    } else {
      database = new EmbeddedGraphDatabase(config.getDatabasePath(),
          graphConfig);
    }
View Full Code Here

    @Test
    public void testSimple()
    {
        DbRepresentation someData = createSomeData();
        GraphDatabaseService readGraphDb = new EmbeddedReadOnlyGraphDatabase( PATH );
        assertEquals( someData, DbRepresentation.of( readGraphDb ) );

        Transaction tx = readGraphDb.beginTx();
        try
        {
            readGraphDb.createNode();
        }
        catch ( ReadOnlyDbException e )
        {
            // good
        }
        tx.finish();
        readGraphDb.shutdown();
    }
View Full Code Here

    public static void createDatabase()
    {
        String storeDir = "target/var/id_test";
        AbstractNeo4jTestCase.deleteFileOrDirectory( new File( storeDir ) );
        graphdb = new EmbeddedGraphDatabase( storeDir );
        graphDbReadOnly = new EmbeddedReadOnlyGraphDatabase( storeDir );
    }
View Full Code Here

TOP

Related Classes of org.neo4j.kernel.EmbeddedReadOnlyGraphDatabase

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.