Importing GraphML files in JUNG - jung

I am new to JUNG, can any one show me how to import a GraphML to JUNG.

I'm not sure if you're working with a database, but if you are this is very easy with Neo4J. Neo4J supports import/export from .graphml files. Once you have everything done, you can hook up your Neo4J database to JUNG using blueprints. It takes no more than 2 lines of code:
com.tinkerpop.blueprints.Graph g = new Neo4JGraph(gds);
GraphJung gj = new GraphJung(g);
In which gds is the GraphDatabaseService object from Neo4J. Like I said, very easy, and you can imagine the possibilities with a powerful graph database behind your application.

Related

py2neo (Neo4j) bulk operation

I have created a nice graph using Neo4j Desktop, using a local CSV file that I added to the project. now I'm trying to use python to do that automatically for that I'm trying to use methods from here https://py2neo.org/2021.1/bulk/index.html like create/merge nodes/relatioships.
I have 2 questions,
Do I need to use create method (create node for exmaple) and after that to use merge method (merge nodes for this example) or can use merge nodes from the begining?
I have tried to use merge only and I got some wierd things when I'm using large sample size.
2)After creation of nodes and relationships how can I change the visualization of the nodes (put some value in the node)?
*If there is an other way to use python to create graph from a big CSV file I would like to hear, Thanks!

Creating knowledge graphs in Neo4j

1.Can Neo4j store RDF directly? we understand it can import RDF and export RDF but how is the data stored internally.
We also understand in Neo4j we can create property graphs and make it as a KG using APOC procedures and algorithms available,is that the case or are we missing anything?
2. We would like to understand, how an entity will be tagged against an ontology in Neo4j KG implementation.
You can import RDF data into Neo4j, however it will not be exactly in that format. Using Neosemantics, the triples will be converted into a property graph.
Neosematics can reconvert the property graph data back into triples should that be required.

Custom ETL OrientDB from PostgreSQL

I am working on a Rails project, the database is OrientDB graph database. I need to transfer data from Postgres to OrientDB graph. I have written scripts to in Ruby to fetch data from postgres and load it into the graph structure by creating relevant edges and nodes.
However this process is very slow and is taking months to enter million records. The graph is somewhat a densely connected graph.
I wanted to use the inbuilt ETL configuration provided by OrientDB but it seems relatively complex since I need to create multiple vertexes from fields in the same table and then connect them. I referred to this documentation.
Can I write custom ETL to load data into OrientDB with the same speed as done by inbuilt ETL tool?
Also, are there any benchmarks for the speed of data loading into OrientDB.
if ETL doesn't fit your needs you can write a custom importer using Java or any other JVM language of your choice.
If you only need to import the db once, the best way is to use plocal access (embedded) and then move the resulting database under the server.
With this approach, you can achieve the best performances, because the network isn't involved.
The code should be something like this snippet:
OrientGraphFactory fc = new OrientGraphFactory("plocal:./databases/import", "admin", "admin");
Connection conn = DriverManager.getConnection("jdbc....");
Statement stmt = conn.createStatement();
ResultSet resultSet = stmt.executeQuery("SELECT * from table ");
while (resultSet.next()) {
OrientGraph graph = fc.getTx();
OrientVertex vertex1 = graph.addVertex("class:Class1", "name", resultSet.getString("name"));
OrientVertex vertex2 = graph.addVertex("class:Class2", "city", resultSet.getString("city"));
graph.addEdge(null, vertex1, vertex2, "class:edgeClass");
graph.shutdown();
}
fc.close();
resultSet.close();
stmt.close();
conn.close();
It is more pseudo code than working code, but take it as a template for operations needed to import a single query/table from the original RDBMS.
About performance, it is quite hard to give numbers, it depends on many factors: schema complexity, type of access (plocal, remote), lookups, connection's speed of the data source.
Few more words about teleporter. It will import the original database schema and data inside OrientDB, automatically. AFAIK you have a working OrientDB and for sure Teleporter will not create the same schema on OrientDb you did.

Batch insertion in Neo4j

I am new to neo4j. I have created graph database in neo4j i.e "my.graphdb" which also include schema indexes. Now I want to use this database into my java program. For that I used batch insertion. Also I am creating schema indexes in my java program. But when I run the program it gives me following exception.
Exception :
java.lang.UnsupportedOperationException: Schema modification is currently not available
through the BatchDatabase API.
In short, I want to use my existing graph database (my.graphdb) into new java program. Moreover, I want to use my existing data and indexes present in my.graphdb to insert new nodes and relationships.
Please let me know what should I do ?
The BatchGraphDatabase should not be used.
Use the BatchInserter or the transactional EmbeddedGraphDatabase.
The Batchinserter also supports the creation of schema indexes which are populated at shutdown (test with a small dataset first, it can take a while, will be faster in 2.0.1).

Neo4j staged batch import

I want to import existing entities and their relationships from MySQL database to a new Neo4j db. I have several questions that I still do not quite understand -
Based on the description of the batch importer, it appears as if I need to have both an entity and relationship file. Can I execute an import without one or the other file type?
Can I execute a series of batch imports, using different files for different entities?
Are you using the batch importer from the Neo4j website or the one by jexp/Michael Hunger ?
If it's the jexp batch-import you could execute just the entity/nodes file (resulting in a bunch of nodes and no edges) or just the rels file (resulting in an empty graph since there's no nodes to connect). Or you could import the nodes, then import the rels, either in the same import or in a series of imports.

Resources