old07

How to import one's own content into out-of-the-box DeepaMehta

DeepaMehta allows to import data from external databases. It is possible to abuse the "Movies and Actors" example to import your own data.

Find the example

  • In the map selection box, click on the arrowhead of the dropdown-list next to TypeBuilder? and select root.
  • right-click anywhere on the light yellow background canvas and select Create Topic Map,
  • Enter a name in the name field in the "property panel" on the right-hand side, e. g. "explore",
  • double-click the new topicmap,
  • right-click the background again, and select Search > Topicmap.
  • a container icon saying 20 Topicmaps will appear.
  • right-click this container icon, select Show result > "Movies and Actors".

(If "Movies and Actors" is not among the 20 available items, the installation defaults may have changed beyond the ones I encountered with version 2.0b7 at Nov 24, 2006).

  • doubleclick Movies and Actors.

Replace the example data

Locate the file db_inserts.sql in the DeepaMehta distribution directory [path\]?deepamehta-2.0b7\install\examples\movies\db\ make a backup copy, and open the original file with an editor. Use your favourite office application to generate lines resembling the second section (reading "INSERT INTO Actor ...)" but containing your own values. For instance, if you have a simple text list of items, import them into MS Access or a similar app, and use the expression generator to compose a query like

"INSERT INTO Actor VALUES (" & [Tabelle1][ID] & ", '" & [Tabelle1][Feld1] & "');"

Export the query into a text file, and copy and paste its content to replace the Actor section in db_inserts.sql.

Alternate method without database: you may use a word processor like MS word to edit the simple text list input:

  • Search and replace ^p (press accent circumflex key, press space key, press "p", which means: start of paragraph);
  • replace by
');^pINSERT INTO Actor VALUES (, '
  • cut and paste the surplus code portion from the last line to the first line where it is missing,
  • fill in incrementing integers manually between the opening parenthesis and the comma. (You may replace this manual step by adapting the method to a spreadsheet application's "autofill" function.)

Replace the database content

Stop DeepaMehta. Switch to the command prompt where you normally start DeepaMehta.

  • Instead of ant dm, type the following:
ant dropdb -Ddb.name=movies -Ddb.userid=movies

Reply to prompts with "y" and the MySQL? root password.

  • Rebuild the database with ant installmovies
  • and restart DeepaMehta ant dm

Now you should be able to see your own "Actors" when exploring the map using (rightclick on the Actors container icon) > Show result, and while gradually revealing them, you may connect them with associations to other topic types like "Movies" or to generic topics.

Extension

If your data include an n:m relationship (e. g., categories in addition to the single list items) you may analoguously use your data base program to prepare replacements for further sections of db_inserts.sql : fill in the categories as "Movies", and the relationship as "Mitwirkung" (German for starring).