|
|
You'll usually want to edit an Oedipus database by dropping certain
categories, or by only keeping a specific subtree. Writing a full
Web-based tool for editing a database is a sizable job, and
one I haven't attempted yet. I may never work on such an
editing tool, because I'm most interested in re-using dmoz.org's data,
not in setting up a competing effort.
As a simple demo, I've written a character-based tool that
resembles a Unix shell. You can walk around the tree of topics and
subtopics, in much the same way that you'd walk around a file system's
directory tree.
odpsh.py is only a demo. If you want to do
complicated transformations or edits, you're much better off
implementing them in Python, a programming language much more powerful
than any shell.
Command List
-
cd topic
- Change current topic to topic. You can use a leading
'/' to start from the root of the tree, or use .. to move one level
up, toward the root.
-
clear
- Clear the ODP database, erasing all the topics and pages.
-
ls
- List contents of the current topic.
-
mkeditor
- Create a new editor within the current topic.
You will be prompted for the editor's ID.
-
mkletterbar
- Create a letterbar link.
You will be prompted for the destination topic that is the target of the link.
-
mknewsgroup
-
Create a newsgroup within the current topic.
You will be prompted for the newsgroup name.
-
mkpage
- Create a new external page within the current topic.
You will be prompted for the URL, a title, and a description.
-
mkrelated
- Create a related topic link, used for 'See also' references).
You will be prompted for the destination topic.
-
mksymbolic
- Create a new symbolic link to another topic. You will be
prompted for the destination topic, and the title of the link.
-
mktopic
- Create a new subtopic within the current topic.
You will be prompted for the topic's title.
-
mv
- Move a subtopic to another topic.
You will be prompted for the name of the topic to move, and its
destination.
-
parse contentfile structurefile
- Parse the two named XML files,
adding their contents to the in-memory database.
-
pwd
- Print current topic.
-
quit
- Exit the ODP shell.
-
rdf contentfile structurefile
- Generate two XML files
containing the current database, writing them to the provided filenames.
-
rm topic
- Delete a subtopic.
-
stats
- Print statistics (# of subcategories, # of links)
for current topic.
-
tree
- Display tree of subcategories for current topic.
Example Transcript
[amk@mira ODP-0.04]$ python odpsh.py
ODP> mktopic
Title:CAD Software
ODP> mktopic
Title:Books
ODP> ls
Subtopics:
CAD Software Books
ODP> cd CAD Software
ODP> mkpage
URL:http://www.memcap.com
Title:MEMCAP
Description (. to end):
Software for designing MEMS-based caps.
.
ODP> mktopic
Title:User Groups
ODP> ls
Pages:
<ExternalPage http://www.memcap.com>
Subtopics:
User Groups
ODP> cd ..
ODP> mkeditor
Editor ID:amk1
ODP> rdf /tmp/content.xml /tmp/struct.xml
ODP> quit
[amk@mira ODP-0.04]$
|