Xindice Command Line Tools Reference 0.9

The Apache Software Foundation

Jay Kalafus

Kimbro Staken

This documentation is a work in progress. Links to the most current version can be found at http://www.dbxml.org/docs/

This version of the document covers Xindice 1.0.

$Id: ToolsReference.xml,v 1.4 2002/03/14 06:15:16 kstaken Exp $


1. Collection Management Commands
Adding a Collection
Deleting a Collection
List Collections
2. Document Management Commands
Adding a Document
Adding Multiple Documents
Deleting a Document
Retrieving a Document
Importing a Directory Tree
Exporting a Directory Tree
3. XMLObject Management Actions
Adding a XMLObject
Deleting a XMLObject
Listing XMLObjects
Invoke an XMLObject
4. Collection Indexer Actions
Adding a Collection Indexer
Deleting a Collection Indexer
Listing Collection Indexers
5. Xpath Query Actions
Executing an Xpath Query against a Collection
6. Miscellaneous Actions
Shutting down the server
Accessing online Help

1. Collection Management Commands

Adding a Collection

Adds a new collection to the database. When adding a collection under an existing collection hierarchy all parent collections must already exist in the database.

Summary:

xindiceadmin add_collection {-c context} {-n name} [-v ]

Action:add_collection
Abberviated-Action:ac
Access Level:Admin

Parameters:

-c The collection context under which to create the new collection.
-n The name of the collection to create
-v Show verbose output

Examples:

1.1. Creating a Top Level Collection

               xindiceadmin add_collection -c /db -n pebbles
            

1.2. Creating a Sub Collection Under an Existing Collection

               xindiceadmin add_collection -c /db/pebbles -n boulder
            

Deleting a Collection

Deletes a collection or subcollection from the database. If deleting a collection that has subcollections and documents they will also be deleted.

Summary:

xindiceadmin delete_collection {-c context} {-n name} [-y ] [-v ]

Action:delete_collection
Abberviated-Action:dc
Access Level:Admin

Parameters:

-c The collection context under which to delete the collection.
-n The name of the collection to delete.
-y Do not ask for confirmation of delete
-v Show verbose output

Examples:

1.3. Deleting a Top Level Collection

               xindiceadmin delete_collection -c /db -n pebbles
            

1.4. Deleting a Sub Collection

               xindiceadmin delete_collection -c /db/pebbles -n boulder
            

List Collections

List all collections under the collection context given. If no collection is given then the root collection will be asumed.

Summary:

xindice list_collections [-c context] [-v ]

Action:list_collections
Abberviated-Action:lc
Access Level:User

Parameters:

-c The collection context under which all sub collections are listed
-v Show verbose output

Examples:

1.5. Listing the Top Level Collections

               xindice list_collections -c /db
            

1.6. Listing a Sub Collection

               xindice list_collections -c /db/pebbles
            

2. Document Management Commands

Adding a Document

Adds a document to a collection or nested collection. Adding a document requires two parameters - the collection it will be stored under, and the file path to the document. If a document key is not provided an auto-generated system key will be used for the document. Documents cannot be added to collections that do not already exist. When entering the file path be sure to include the path and file extension.

Summary:

xindice add_document {-c context} {-f file path} [-n key to assign to document] [-v ]

Action:add_document
Abberviated-Action:ad
Access Level:User

Parameters:

-c The collection context under which to add the document
-f The complete file path to the document being added
-n The key to assign to the document
-v Show verbose output

Examples:

2.1. Adding a document to a collection with a key of "stones"

               xindice add_document -c /db/pebbles -f /tmp/stones.xml -n stones
            

2.2. Adding a document to the root collection with an automatically generated key

               xindice add_document -c /db -f /tmp/bookmarks.xml
            

Adding Multiple Documents

Adds multiple documents to a collection or a nested collection. This command requires two arguments: the collection to store the documents under and the directory path containing the documents. Documents can be added to collections as well as subcollections as long as they exist. Documents added will be assigned their file name as the document key. The optional "extension" parameter can be used to import documents with a certain file extension. Document keys are shown as they are created.

Summary:

xindice add_multiple_documents {-c context} {-f Directory to use } [-e file extenstion ] [-v ]

Action:add_multiple_documents
Abberviated-Action:addmultiple
Access Level:User

Parameters:

-c The collection context under which to add the documents
-f The path to the directory to import documents from
-e The file extension to use when importing documents
-v Show verbose output

Examples:

2.3. Adding all files from a directory to a collection

               xindice add_multiple_documents -c /db/pebbles -f /tmp/mydocs
            

2.4. Adding all files from a directory with an extension of ".xml"

               xindice add_multiple_documents -c /db/pebbles -f /tmp/mydocs -e xml
            

Deleting a Document

Deletes an existing document from a collection or nested collection within the database.

Summary:

xindice delete_document {-c context} {-n document key} [-v ]

Action:delete_document
Abberviated-Action:dd
Access Level:User

Parameters:

-c The collection context under which to delete the document
-n The key of the document to be deleted
-v Show verbose output

Examples:

2.5. Deleting a Document from a collection

               xindice delete_document -c /db/pebbles -n stones
            

Retrieving a Document

Retrieves an existing document from a collection or nested collection within the database. The complete path where the document will be stored is required. If the file path passed in does not exist, it will be created . If the file argument given already exists, it will be overwritten automatically.

Summary:

xindice retrieve_document {-c context} {-n document key} {-f file path and name } [-v ]

Action:retrieve_document
Abberviated-Action:rd
Access Level:User

Parameters:

-c The collection context under which to retrieve the document
-n The key of the document to be retrieved
-f The file path to store the document under
-v Show verbose output
-u The URI for the Xindice host to use. http://host:[port]

Examples:

2.6. Retrieving a document from a collection

               xindice retrieve_document -c /db/pebbles -n stones -f /tmp/stones.xml
            

Importing a Directory Tree

Adds multiple documents into a collection or a nested collection within the database, copying the directory structure into the database as collections. This command is designed to take a directory and create a collection from it's name. Directories under the directory will also be created as collections, duplicating the directory tree. The files within the specified directory are converted into Documents and then stored into the newly created collection with their filenames as the document keys. The optional "extension" parameter can be used to only import documents with a certain file extension. If the collection name used already exists it will be overwritten. Collection and document keys will are shown as they are created.

Summary:

xindiceadmin import {-c context} {-f file path and name } [-e file extenstion ] [-v ]

Action:import
Abberviated-Action:import
Access Level:Admin

Parameters:

-c The collection context under which to import the documents
-f The path to the documents being added
-e The file extension to use when importing documents
-v Show verbose output

Examples:

2.7. Importing all directories and documents

               xindiceadmin import -c /db/pebbles -f /tmp/flintstones
            

2.8. Importing all directories and documents with an extension of ".xml"

               xindiceadmin import -c /db/pebbles -f /tmp/flintstones -e xml
            

Exporting a Directory Tree

Creates an identical directory tree from a collection including any subcollections. The directory tree will be created starting at the directory passed in as an argument. This command requires the collection which you are eporting and the directory to export to as arguments.

Summary:

xindice export {-c context} {-f directory path} [-v ]

Action:export
Abberviated-Action:export
Access Level:User

Parameters:

-c The collection context under which to export the document tree
-f The directory to create the collection structure under
-v Show verbose output

Examples:

2.9. Creating a directory tree indentical to a collection

               xindice export -c /db/pebbles -f /tmp/pebbles
            

3. XMLObject Management Actions

Adding a XMLObject

Adds a new XMLObject or nested XMLObject to the database. Adding an XMLObject requires an implementing class and a name. In order to add the XMLObject the collection that it is being added to must already exist. to sucessfully complete this topertation, the implementing class must be in the server's classpath.

Summary:

xindiceadmin add_xmlobject {-c context} {-i implementing class} {-n object name } [-v ]

Action:add_xmlobject
Abberviated-Action:ao
Access Level:Admin

Parameters:

-c The collection context under which to add the XMLObject
-i The fully qualified class name for the implementing class
-n The name to assign to the XMLObject
-v Show verbose output

Examples:

3.1. Create a XMLObject in the pebbles collection

               xindiceadmin add_xmlobject -c /db/pebbles -i example.XmlRockObject -n rockXMLObject
            

3.2. Create a XMLObject in a sub collection

               xindiceadmin add_xmlobject -c /db/pebbles/boulder -i example.XmlRockObject -n rockXMLObject
            

Deleting a XMLObject

Deletes an XMLObject or nested XMLObject from the database. Deleting an XMLObject requires the collection name and the XMLObject name.

Summary:

xindiceadmin delete_xmlobject {-c context} {-n name } [-v ]

Action:delete_xmlobject
Abberviated-Action:do
Access Level:Admin

Parameters:

-c The collection context under which to delete the XMLObject
-n The name of the XMLObject to delete
-v Show verbose output

Examples:

3.3. Delete an XMLObject in the pebbles collection

               xindiceadmin delete_xmlobject -c /db/pebbles -n rockXMLObject
            

3.4. Delete an XMLObject from the boulder sub collection

               xindiceadmin delete_xmlobject -c /db/pebbles/boulder -n rockXMLObject
            

Listing XMLObjects

Lists all XMLObjects or nested XMLObjects in the database. The listing of XMLObjects works in a similar fashion to listing collections.

Summary:

xindice lists_xmlobjects {-c context} [-v ]

Action:list_xmlobjects
Abberviated-Action:lo
Access Level:User

Parameters:

-c The collection context under which to list the XMLObjects
-v Show verbose output

Examples:

3.5. List all XMLObjects in the pebbles collection

               xindice list_xmlobjects -c /db/pebbles
            

3.6. List all XMLObjects in the boulder sub collection

               xindice list_xmlobjects -c /db/pebbles/boulder
            

Invoke an XMLObject

Allows the invocation of an XMLObject in the database. This command requires two arguments - the collection to invoke the object under and the URI for the XMLObject. The URI given can be either relative or the absolute path. (See the users guide for more information on URI's)

Summary:

xindice invoke {-c context} {-o object URI} [-v ]

Action:invoke
Abberviated-Action:invoke
Access Level:User

Parameters:

-c The collection context under which to invoke the XMLObject
-o The XMLObject that is being invoked
-v Show verbose output

Examples:

3.7. Invoke the rockXMLObject in the pebbles collection

               xindice invoke -c /db/pebbles -o rockXMLObject
            

3.8. Invoke a rockXMLObject with a method named crush that takes a name parameter named rock

               xindice invoke -c /db/pebbles -o rockXMLObject/crush?rock=boulder
            

4. Collection Indexer Actions

Adding a Collection Indexer

Adds a new collection index or nested collection index to the database. In order to add the collection index, the collection it is being added to must already exist. This command allows you to supply optional parameters for setting the index page size, setting the maximum key size for the index, and the index data type.

Summary:

xindiceadmin add_indexer {-c context} {-n index name } {-p index pattern} [--pagesize pagesize] [--maxkeysize max key size] [-t index type] [-v ]

Action:add_indexer
Abberviated-Action:ai
Access Level:Admin

Parameters:

-c The collection context under which to add the indexer
-n The name of the index being added
-p The pattern used to create the index
--maxkeysize The MaxKeySize for the index ( default: 0 = none )
--pagesize The PageSize for the index ( default: 4096)
-t The data type for the index to create. Possible values are:
      string   Non-normalized string value
      trimmed  Normalized (whitespace stripped) string value
      short    16-bit signed short integer
      int      32-bit signed integer
      long     64-bit signed integer
      float    32-bit floating point value
      double   64-bit floating point value (XPath number)
      byte     8-bit signed byte
      char     16-bit signed character
      boolean  8-bit boolean value
      name     Store document keys that contain the pattern
-v Show verbose output

Examples:

4.1. To create a collection index in the pebbles collection for docuemnts with a "rock" element

               xindiceadmin add_indexer -c /db/pebbles -n rockindex -p rock
            

4.2. To create a collection index in the boulder sub collection for documents containing a rock elements with an attribute of "hard"

               xindiceadmin add_indexer -c /db/pebbles/boulder -n hardindex -p rock@type
            

Deleting a Collection Indexer

Deletes a collection index or a nested collection index from the database. Deleting an index requires the collection and index name. If a collection index is deleted, the collection will still remain.

Summary:

xindiceadmin delete_indexer {-c context} {-n index name} [-v ]

Action:delete_indexer
Abberviated-Action:di
Access Level:Admin

Parameters:

-c The collection context under which to delete the index
-n The name of the indexer being deleted
-v Show verbose output

Examples:

4.3. Delete a collecion index in the pebbles collection

               xindiceadmin delete_indexer -c /db/pebbles -n hardindex
            

Listing Collection Indexers

Lists all collection indexers or nested collection indexes in the database. The listing of indexes works in a similar fashion to listing collections

Summary:

xindiceadmin list_indexers {-c context} [-v ]

Action:list_indexers
Abberviated-Action:li
Access Level:Admin

Parameters:

-c The collection context under which to list the indexers
-v Show verbose output

Examples:

4.4. To list all collection indexes from the pebbles collection

               xindiceadmin list_indexers -c /db/pebbles
            

5. Xpath Query Actions

Executing an Xpath Query against a Collection

Execute an Xpath query against a collection or nested collection. The command requires two arguments : the collection to query against and the query string to use.

Summary:

xindice xpath {-c context} {-q query} [-v ]

Action:xpath
Abberviated-Action:xpath
Access Level:User

Parameters:

-c The collection context under which to execute the query
-q The query to execute against the collection
-v Show verbose output

Examples:

5.1. Run an Xpath query against all documents in the pebbles collection with "rock" node that has the type attribute = "hard"

               xindice xpath -c /db/pebbles -q /rock[@type="hard"]
            

6. Miscellaneous Actions

Shutting down the server

Shutdown the Xindice server

Summary:

xindiceadmin shutdown [-v ]

Action:shutdown
Abberviated-Action:shutdown
Access Level:Admin

Parameters:

-v Show verbose output

Examples:

6.1. Shutdown the server

               xindiceadmin shutdown
            

Accessing online Help

Show the online help

Summary:

xindice help [-v ]

Action:help
Abberviated-Action:help
Access Level:User

Parameters:

-v Show verbose output

Examples:

6.2. Show online Help

               xindice help