An explain plan in Oracle is a detailed step by step set of instructions that an SQL statement makes in order to run the SQL query. Typically, Oracle will use an optimizer strategy, and will select the explain plan with the lowest cost associated with running it. As a developer, sometimes we might want to view an explain plan to help optimize a query, by modifying our SQL, or adding new indexes to a particular column to help decrease the cost of the best explain plan.
As someone who is not that familiar with explain plans himself, the purpose of the post is to simply introduce the concepts of explain plans, how to run them, and a very quick overview on how to interpret some of the data contained in them.
WordNet and ConceptNet are two popular databases of words and concepts that are used in a number of AI applications. This post will look at how we can combine the two of them into one searchable graph using Neo4j.
Before I start, some people may view this as a redundant task because ConceptNet already ingests WordNet, so why not just stick with loading ConceptNet into Neo4j?
While this is true, WordNet models its relationships at the synset level, while ConceptNet seeks to undo this (https://github.com/commonsense/conceptnet5/wiki/FAQ). This exercise is to combine both these types of abstractions into one large graph that we can use, allowing us to create graph queries against either network, or create queries that can combine both.
The rest of this post will give a quick overview of WordNet and ConceptNet, the graph model I’ve developer so far, a python script that will generate some import files for Neo4j, and finally some example cypher queries. For those just interested in the python script, you can find it at https://github.com/tomkdickinson/wordnet_conceptnet_neo4j. Continue reading
ConceptNet is a pretty useful semantic network, and can either be accessed online, or ran locally with Docker (https://github.com/commonsense/conceptnet5/wiki/Running-your-own-copy).
However, as someone who uses Neo4J quite a bit, it’d be useful to run cypher queries over some of those relationships.
To that end, I’ve written a quick script that will take as input, a csv dump of ConceptNet, and convert it into a csv format for Neo4J. You can then use ./neo4j-import to import that data into a ConceptNet database (takes less than a minute which is pretty handy!).
Currently, I’ve only included the following triples in the import script:
start_uri, relationship, end_uri
However, I’ll update the script to add in the other interesting hypergraph properties, enriching the edges of the Neo4J graph.
The script can be found here: https://github.com/tomkdickinson/conceptnet_neo4j
Details for using the ./neo4j-import tool can also be found here: http://neo4j.com/docs/operations-manual/current/tutorial/import-tool/