Friday 9 December 2011

OpenCycloGraph

A recent post to MudBytes on using real world natural resource and mineral data to make a game, made me think of OpenCyc.  I've played around with it in the past, but it is somewhat complicated.  Starting it up also starts up a web interface through which the ontology can be either clicked through, or searched for specific terms.  Even so, it is still hard to get a grip on what is in there and what it means.


Even people who know it well enough to be ready to extend the ontologies are warned that it can be difficult to know whether whatever you wish to add is in there or not.  Just clicking through the data, or searching on relevant searching terms that come to mind, I sort of wished for a graph to click through.  And this reminded me of opencyclograph.  OpenCycloGraph can be pointed at a running instance of OpenCyc, and from there it can fetch and display the hierarchy of concepts.


In the screenshot above, it can be seen showing the results of a search for "Mineral".

Unfortunately, OpenCycloGraph is not quite ready for use.  There are no binaries provided at the Google Code project.  This means that anyone wanting to use it, needs to do a little bit of legwork.  I'll note below what I did, although I've never really worked in Java or used this IDE before, so maybe I'm doing it a little harder than I need to.

  1. Download and install NetBeans.
  2. Run NetBeans and import the code as a project.
  3. Find the "GLPanel.java" file under CycloGraph/src/com.touchgraph.graphlayout in NetBeans.
  4. Right click on it, and select "Run File".
At this point, you will see a window looking something like the above.  However, it won't be able to find a running instance of OpenCyc so it won't really be useful.
  1. Download and extract OpenCyc 2.0.
  2. Try and run its "scripts/run-cyc.bat".  If it fails due to lack of memory, edit the BAT script and modify it to run the 64-bit version (this is a two line change).
  3. Once it has started running on "localhost" up go back into NetBeans.
  4. Search for "CycServer" which is used in OpenCycloGraph as the default address where it should look for a running instance of OpenCyc.  It should be in "GLPanel.java", line 1282.  Replace it with "localhost".


Now when you right-click on "GLPanel.java" and select "Run File", it should "work correctly" for selected values of "work correctly".

You start by entering a search term and hitting enter.


This will populate the graph, and from there you can click on related entries of interest.



Note that you can see what the relation is, for example above you can see that "NonMetal" is 'disjointWith' "Metal" which seems not very useful to the end user and more likely was added to help out OpenCyc inferencing.

If you find a node and want to know more, you can right click and select "Inspect Node" to update/synchronise the browser display in the left-hand pane. 


And that's about it.  There's a video of me generically browsing game world relevant information for about a minute and a half below.  One application would be adding a "light" verb and linking it to objects which are CombustibleFuelSources, for instance.


An aspect of OpenCyc that escapes me is that either some data is missing and was not released as part of the cut-down OpenCyc public ontology, or I just don't know how to query it yet.  Case in point is Mass, massOfObject and MassOfObjectFn.  I am unable to locate any entries which map values for these to other ontology objects.

No comments:

Post a Comment