<?xml version="1.0" encoding="UTF-8"?>

<!--
  - Licensed to the Apache Software Foundation (ASF) under one or more
  - contributor license agreements.  See the NOTICE file distributed with
  - this work for additional information regarding copyright ownership.
  - The ASF licenses this file to You under the Apache License, Version 2.0
  - (the "License"); you may not use this file except in compliance with
  - the License.  You may obtain a copy of the License at
  -
  -     http://www.apache.org/licenses/LICENSE-2.0
  -
  - Unless required by applicable law or agreed to in writing, software
  - distributed under the License is distributed on an "AS IS" BASIS,
  - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  - See the License for the specific language governing permissions and
  - limitations under the License.
  -
  - $Id$
  -->

<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.1//EN" "document-v11.dtd">

<!--
  - Version: $Revision$ $Date$
  - Author: Kimbro Staken (kstaken@xmldatabases.org)
  -->

<document>
  <header>
    <title>Xindice 1.1 Commandline Tool Guide</title>
    <version>$Revision$</version>
    <authors>
      <person id="jk" name="Jay Kalafus" email=""/>
      <person id="ks" name="Kimbro Staken" email=""/>
    </authors>
    <notice/>
    <abstract/>
  </header>

  <body>
    <note>
      If you notice incorrectness in this documentation, please
      <link href="../mail.html">notify</link> Xindice community. Your feedback
      will help create better documentation.
    </note>

    <section>
      <title>Collection Management Commands</title>

      <section>
        <title>Adding a Collection</title>
        <p>
          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.
        </p>
        <section>
          <title>Summary:</title>
        </section>
        <p>
          <code>xindice add_collection -c (or context)
                  -n (or name) [-v (or )]
          </code>
        </p>
        <table>
          <tr>
            <td>Action:</td>
            <td>
              <code>add_collection</code>
            </td>
          </tr>
          <tr>
            <td>Abberviated-Action:</td>
            <td>
              <code>ac</code>
            </td>
          </tr>
          <tr>
            <td>Access Level:</td>
            <td>Admin</td>
          </tr>
        </table>
        <section>
          <title>Parameters:</title>
        </section>
        <ul>
          <li>
            <code>-c</code> The collection context under which to create the new
                  collection.
          </li>
          <li>
            <code>-n</code> The name of the collection to create
          </li>
          <li>
            <code>-v</code> Show verbose output
          </li>
        </ul>
        <section>
          <title>Examples:</title>
        </section>
        <section>
          <title>Creating a Top Level Collection</title>
          <source><![CDATA[
  xindice add_collection -c /db -n pebbles
          ]]></source>
        </section>
        <section>
          <title>Creating a Sub Collection Under an Existing Collection</title>
          <source><![CDATA[
  xindice add_collection -c /db/pebbles -n boulder
          ]]></source>
        </section>
      </section>

      <section>
        <title>Deleting a Collection</title>
        <p>
          Deletes a collection or subcollection from the database. If deleting
          a collection that has subcollections and documents they will also be
          deleted.
        </p>
        <section>
          <title>Summary:</title>
        </section>
        <p>
          <code>xindice delete_collection -c (or context)
                  -n (or name)
                  [-v (or )]
          </code>
        </p>
        <table>
          <tr>
            <td>Action:</td>
            <td>
              <code>delete_collection</code>
            </td>
          </tr>
          <tr>
            <td>Abberviated-Action:</td>
            <td>
              <code>dc</code>
            </td>
          </tr>
          <tr>
            <td>Access Level:</td>
            <td>Admin</td>
          </tr>
        </table>
        <section>
          <title>Parameters:</title>
        </section>
        <ul>
          <li>
            <code>-c</code> The collection context under which to delete the collection.
          </li>
          <li>
            <code>-n</code> The name of the collection to delete.
          </li>
          <li>
            <code>-v</code> Show verbose output
          </li>
        </ul>
        <section>
          <title>Examples:</title>
        </section>
        <section>
          <title>Deleting a Top Level Collection</title>
          <source><![CDATA[
  xindice delete_collection -c /db -n pebbles
          ]]></source>
        </section>
        <section>
          <title>Deleting a Sub Collection</title>
          <source><![CDATA[
  xindice delete_collection -c /db/pebbles -n boulder
          ]]></source>
        </section>
      </section>

      <section>
        <title>List Collections</title>
        <p>
          List all collections under the collection context given.
        </p>
        <section>
          <title>Summary:</title>
        </section>
        <p>
          <code>xindice list_collections -c (or context) [-v (or )]</code>
        </p>
        <table>
          <tr>
            <td>Action:</td>
            <td>
              <code>list_collections</code>
            </td>
          </tr>
          <tr>
            <td>Abberviated-Action:</td>
            <td>
              <code>lc</code>
            </td>
          </tr>
          <tr>
            <td>Access Level:</td>
            <td>User</td>
          </tr>
        </table>
        <section>
          <title>Parameters:</title>
        </section>
        <ul>
          <li>
            <code>-c</code> The collection context under which all sub collections are listed
          </li>
          <li>
            <code>-v</code> Show verbose output
          </li>
        </ul>
        <section>
          <title>Examples:</title>
        </section>
        <section>
          <title>Listing the Top Level Collections</title>
          <source><![CDATA[
  xindice list_collections -c /db
          ]]></source>
        </section>
        <section>
          <title>Listing a Sub Collection</title>
          <source><![CDATA[
  xindice list_collections -c /db/pebbles
          ]]></source>
        </section>
      </section>
    </section>

    <section>
      <title>Document Management Commands</title>

      <section>
        <title>Adding a Document</title>
        <p>
          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.
        </p>
        <section>
          <title>Summary:</title>
        </section>
        <p>
          <code>xindice add_document -c (or context)
                  -f (or file path)
                  [-n (or key to assign to document)]
                  [-v (or )]
          </code>
        </p>
        <table>
          <tr>
            <td>Action:</td>
            <td>
              <code>add_document</code>
            </td>
          </tr>
          <tr>
            <td>Abberviated-Action:</td>
            <td>
              <code>ad</code>
            </td>
          </tr>
          <tr>
            <td>Access Level:</td>
            <td>User</td>
          </tr>
        </table>
        <section>
          <title>Parameters:</title>
        </section>
        <ul>
          <li>
            <code>-c</code> The collection context under which to add the document
          </li>
          <li>
            <code>-f</code> The complete file path to the document being added
          </li>
          <li>
            <code>-n</code> The key to assign to the document
          </li>
          <li>
            <code>-v</code> Show verbose output
          </li>
        </ul>
        <section>
          <title>Examples:</title>
        </section>
        <section>
          <title>Adding a document to a collection with a key of "stones"</title>
          <source><![CDATA[
  xindice add_document -c /db/pebbles -f /tmp/stones.xml -n stones
          ]]></source>
        </section>
        <section>
          <title>Adding a document to the root collection with an automatically generated key</title>
          <source><![CDATA[
  xindice add_document -c /db -f /tmp/bookmarks.xml
          ]]></source>
        </section>
      </section>

      <section>
        <title>Adding Multiple Documents</title>
        <p>
          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.
        </p>
        <section>
          <title>Summary:</title>
        </section>
        <p>
          <code>xindice add_multiple_documents -c (or context)
                  -f (or Directory to use )
                  [-e (or file extenstion )]
                  [-v (or )]
          </code>
        </p>
        <table>
          <tr>
            <td>Action:</td>
            <td>
              <code>add_multiple_documents</code>
            </td>
          </tr>
          <tr>
            <td>Abberviated-Action:</td>
            <td>
              <code>addmultiple</code>
            </td>
          </tr>
          <tr>
            <td>Access Level:</td>
            <td>User</td>
          </tr>
        </table>
        <section>
          <title>Parameters:</title>
        </section>
        <ul>
          <li>
            <code>-c</code> The collection context under which to add the documents
          </li>
          <li>
            <code>-f</code> The path to the directory to import documents from
          </li>
          <li>
            <code>-e</code> The file extension to use when importing documents
          </li>
          <li>
            <code>-v</code> Show verbose output
          </li>
        </ul>
        <section>
          <title>Examples:</title>
        </section>
        <section>
          <title>Adding all files from a directory to a collection</title>
          <source><![CDATA[
  xindice add_multiple_documents -c /db/pebbles -f /tmp/mydocs
          ]]></source>
        </section>
        <section>
          <title>Adding all files from a directory with an extension of ".xml" </title>
          <source><![CDATA[
  xindice add_multiple_documents -c /db/pebbles -f /tmp/mydocs -e xml
          ]]></source>
        </section>
      </section>

      <section>
        <title>Deleting a Document</title>
        <p>
          Deletes an existing document from a collection or nested collection
          within the database.
        </p>
        <section>
          <title>Summary:</title>
        </section>
        <p>
          <code>xindice delete_document -c (or context)
                  -n (or document key)
                  [-v (or )]
          </code>
        </p>
        <table>
          <tr>
            <td>Action:</td>
            <td>
              <code>delete_document</code>
            </td>
          </tr>
          <tr>
            <td>Abberviated-Action:</td>
            <td>
              <code>dd</code>
            </td>
          </tr>
          <tr>
            <td>Access Level:</td>
            <td>User</td>
          </tr>
        </table>
        <section>
          <title>Parameters:</title>
        </section>
        <ul>
          <li>
            <code>-c</code> The collection context under which to delete the document
          </li>
          <li>
            <code>-n</code> The key of the document to be deleted
          </li>
          <li>
            <code>-v</code> Show verbose output
          </li>
        </ul>
        <section>
          <title>Examples:</title>
        </section>
        <section>
          <title>Deleting a Document from a collection</title>
          <source><![CDATA[
  xindice delete_document -c /db/pebbles -n stones
          ]]></source>
        </section>
      </section>

      <section>
        <title>Retrieving a Document</title>
        <p>
               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.
        </p>
        <section>
          <title>Summary:</title>
        </section>
        <p>
          <code>xindice retrieve_document -c (or context)
                  -n (or document key)
                  -f (or file path and name )
                  [-v (or )]
          </code>
        </p>
        <table>
          <tr>
            <td>Action:</td>
            <td>
              <code>retrieve_document</code>
            </td>
          </tr>
          <tr>
            <td>Abberviated-Action:</td>
            <td>
              <code>rd</code>
            </td>
          </tr>
          <tr>
            <td>Access Level:</td>
            <td>User</td>
          </tr>
        </table>
        <section>
          <title>Parameters:</title>
        </section>
        <ul>
          <li>
            <code>-c</code> The collection context under which to retrieve the document
          </li>
          <li>
            <code>-n</code> The key of the document to be retrieved
          </li>
          <li>
            <code>-f</code> The file path to store the document under
          </li>
          <li>
            <code>-v</code> Show verbose output
          </li>
        </ul>
        <section>
          <title>Examples:</title>
        </section>
        <section>
          <title>Retrieving a document from a collection</title>
          <source><![CDATA[
  xindice retrieve_document -c /db/pebbles -n stones -f /tmp/stones.xml
          ]]></source>
        </section>
      </section>

      <section>
        <title>Importing a Directory Tree</title>
        <p>
          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.
        </p>
        <section>
          <title>Summary:</title>
        </section>
        <p>
          <code>xindice import -c (or context)
                  -f (or file path and name )
                  [-e (or file extenstion )]
                  [-v (or ) ]
          </code>
        </p>
        <table>
          <tr>
            <td>Action:</td>
            <td>
              <code>import</code>
            </td>
          </tr>
          <tr>
            <td>Abberviated-Action:</td>
            <td>
              <code>import</code>
            </td>
          </tr>
          <tr>
            <td>Access Level:</td>
            <td>Admin</td>
          </tr>
        </table>
        <section>
          <title>Parameters:</title>
        </section>
        <ul>
          <li>
            <code>-c</code> The collection context under which to import the documents
          </li>
          <li>
            <code>-f</code> The path to the documents being added
          </li>
          <li>
            <code>-e</code> The file extension to use when importing documents
          </li>
          <li>
            <code>-v</code> Show verbose output
          </li>
        </ul>
        <section>
          <title>Examples:</title>
        </section>
        <section>
          <title>Importing all directories and documents</title>
          <source><![CDATA[
  xindice import -c /db/pebbles -f /tmp/flintstones
          ]]></source>
        </section>
        <section>
          <title>Importing all directories and documents with an extension of ".xml" </title>
          <source><![CDATA[
  xindice import -c /db/pebbles -f /tmp/flintstones -e xml
          ]]></source>
        </section>
      </section>

      <section>
        <title>Exporting a Directory Tree</title>
        <p>
          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.
        </p>
        <section>
          <title>Summary:</title>
        </section>
        <p>
          <code>xindice export -c (or context) -f (or directory path) [-v (or )]</code>
        </p>
        <table>
          <tr>
            <td>Action:</td>
            <td>
              <code>export</code>
            </td>
          </tr>
          <tr>
            <td>Abberviated-Action:</td>
            <td>
              <code>export</code>
            </td>
          </tr>
          <tr>
            <td>Access Level:</td>
            <td>User</td>
          </tr>
        </table>
        <section>
          <title>Parameters:</title>
        </section>
        <ul>
          <li>
            <code>-c</code> The collection context under which to export the document tree
          </li>
          <li>
            <code>-f</code> The directory to create the collection structure under
          </li>
          <li>
            <code>-v</code> Show verbose output
          </li>
        </ul>
        <section>
          <title>Examples:</title>
        </section>
        <section>
          <title>Creating a directory tree indentical to a collection</title>
          <source><![CDATA[
  xindice export -c /db/pebbles -f /tmp/pebbles
          ]]></source>
        </section>
      </section>
    </section>

    <section>
      <title>Collection Indexer Actions</title>
      <section>
        <title>Adding a Collection Indexer</title>
        <p>
          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.
        </p>
        <section>
          <title>Summary:</title>
        </section>
        <p>
          <code>xindice add_indexer
                  -c (or context)
                  -n (or index name )
                  -p (or index pattern)
                  [--pagesize (or pagesize)]
                  [--maxkeysize (or max key size)]
                  [-t (or  index type)]
                  [-v (or )]
          </code>
        </p>
        <table>
          <tr>
            <td>Action:</td>
            <td>
              <code>add_indexer</code>
            </td>
          </tr>
          <tr>
            <td>Abberviated-Action:</td>
            <td>
              <code>ai</code>
            </td>
          </tr>
          <tr>
            <td>Access Level:</td>
            <td>Admin</td>
          </tr>
        </table>
        <section>
          <title>Parameters:</title>
        </section>
        <ul>
          <li>
            <code>-c</code> The collection context under which to add the indexer
          </li>
          <li>
            <code>-n</code> The name of the index being added
          </li>
          <li>
            <code>-p</code> The pattern used to create the index
          </li>
          <li>
            <code>--maxkeysize</code> The MaxKeySize for the index ( default: 0 = none )
          </li>
          <li>
            <code>--pagesize</code> The PageSize for the index ( default: 4096)
          </li>
          <li>
            <code>-t</code>
                  The data type for the index to create.  Possible values are:
            <code><![CDATA[      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]]></code>
          </li>
          <li>
            <code>-v</code> Show verbose output
          </li>
        </ul>
        <section>
          <title>Examples:</title>
        </section>
        <section>
          <title>
            To create a collection index in the pebbles collection for
            documents with a "rock" element
          </title>
          <source><![CDATA[
  xindice add_indexer -c /db/pebbles -n rockindex -p rock
          ]]></source>
        </section>
        <section>
          <title>
            To create a collection index in the boulder sub collection
            for documents containing a rock elements with an attribute of "hard"
          </title>
          <source><![CDATA[
  xindice add_indexer -c /db/pebbles/boulder -n hardindex -p rock@hard
          ]]></source>
        </section>
      </section>

      <section>
        <title>Deleting a Collection Indexer</title>
        <p>
          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.
        </p>
        <section>
          <title>Summary:</title>
        </section>
        <p>
          <code>xindice delete_indexer -c (or context) -n (or index name) [-v (or )]</code>
        </p>
        <table>
          <tr>
            <td>Action:</td>
            <td>
              <code>delete_indexer  </code>
            </td>
          </tr>
          <tr>
            <td>Abberviated-Action:</td>
            <td>
              <code>di  </code>
            </td>
          </tr>
          <tr>
            <td>Access Level:</td>
            <td>Admin  </td>
          </tr>
        </table>
        <section>
          <title>Parameters:</title>
        </section>
        <ul>
          <li>
            <code>-c</code> The collection context under which to delete the index
          </li>
          <li>
            <code>-n</code> The name of the indexer being deleted
          </li>
          <li>
            <code>-v</code> Show verbose output
          </li>
        </ul>
        <section>
          <title>Examples:</title>
        </section>
        <section>
          <title>Delete a collecion index in the pebbles collection</title>
          <source><![CDATA[
  xindice delete_indexer -c /db/pebbles -n hardindex
          ]]></source>
        </section>
      </section>

      <section>
        <title>Listing Collection Indexers</title>
        <p>
          Lists all collection indexers or nested collection indexes in the
          database. The listing of indexes works in a similar fashion to
          listing collections
        </p>
        <section>
          <title>Summary:</title>
        </section>
        <p>
          <code>xindice list_indexers -c (or context) [-v (or )]</code>
        </p>
        <table>
          <tr>
            <td>Action:</td>
            <td>
              <code>list_indexers</code>
            </td>
          </tr>
          <tr>
            <td>Abberviated-Action:</td>
            <td>
              <code>li</code>
            </td>
          </tr>
          <tr>
            <td>Access Level:</td>
            <td>Admin</td>
          </tr>
        </table>
        <section>
          <title>Parameters:</title>
        </section>
        <ul>
          <li>
            <code>-c</code> The collection context under which to list the indexers
          </li>
          <li>
            <code>-v</code> Show verbose output
          </li>
        </ul>
        <section>
          <title>Examples:</title>
        </section>
        <section>
          <title>To list all collection indexes from the pebbles collection  </title>
          <source><![CDATA[
  xindice list_indexers -c /db/pebbles
          ]]></source>
        </section>
      </section>
    </section>

    <section>
      <title>Xpath Query Actions</title>
      <section>
        <title>Executing an Xpath Query against a Collection</title>
        <p>
          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.
        </p>
        <section>
          <title>Summary:</title>
        </section>
        <p>
          <code>xindice xpath -c (or context) -q (or query) -s (or prefix=namespace) [-v (or )]</code>
        </p>
        <table>
          <tr>
            <td>Action:</td>
            <td>
              <code>xpath</code>
            </td>
          </tr>
          <tr>
            <td>Abberviated-Action:</td>
            <td>
              <code>xpath</code>
            </td>
          </tr>
          <tr>
            <td>Access Level:</td>
            <td>User</td>
          </tr>
        </table>
        <section>
          <title>Parameters:</title>
        </section>
        <ul>
          <li>
            <code>-c</code> The collection context under which to execute the query
          </li>
          <li>
            <code>-q</code> The query to execute against the collection
          </li>
          <li>
            <code>-s</code> Semi-colon delimited list of namespaces for query
            in the form prefix=namespace-uri
          </li>
          <li>
            <code>-v</code> Show verbose output
          </li>
        </ul>
        <section>
          <title>Examples:</title>
        </section>
        <section>
          <title>
            Run an Xpath query against all documents in the pebbles collection
            with "rock" node that has the type attribute = "hard"
          </title>
          <source><![CDATA[
  xindice xpath -c /db/pebbles -q "/rock[@type='hard']"
          ]]></source>
        </section>
        <section>
          <title>
            Run an Xpath query against all documents in the pebbles collection
            with "rock" node that has the type attribute = "hard" when the rock
            element is in the namespace http://www.bedrock.com
          </title>
          <source><![CDATA[
  xindice xpath -c /db/pebbles -s "br=http://www.bedrock.com" -q "/br:rock[@type='hard']"
          ]]></source>
        </section>
      </section>
    </section>

    <section>
      <title>Miscellaneous Actions</title>
      <section>
        <title>Shutting down the server</title>
        <p>Shutdown the Xindice server</p>
        <section>
          <title>Summary:</title>
        </section>
        <p>
          <code>xindice shutdown [-v (or )]
          </code>
        </p>
        <table>
          <tr>
            <td>Action:</td>
            <td>
              <code>shutdown</code>
            </td>
          </tr>
          <tr>
            <td>Abberviated-Action:</td>
            <td>
              <code>shutdown</code>
            </td>
          </tr>
          <tr>
            <td>Access Level:</td>
            <td>Admin</td>
          </tr>
        </table>
        <section>
          <title>Parameters:</title>
        </section>
        <ul>
          <li>
            <code>-v</code> Show verbose output
          </li>
        </ul>
        <section>
          <title>Examples:</title>
        </section>
        <section>
          <title>Shutdown the server</title>
          <source><![CDATA[
  xindice shutdown
          ]]></source>
        </section>
      </section>
      <section>
        <title>Accessing online Help</title>
        <p>Show the online help</p>
        <section>
          <title>Summary:</title>
        </section>
        <p>
          <code>xindice help [-v (or )]</code>
        </p>
        <table>
          <tr>
            <td>Action:</td>
            <td>
              <code>help</code>
            </td>
          </tr>
          <tr>
            <td>Abberviated-Action:</td>
            <td>
              <code>help</code>
            </td>
          </tr>
          <tr>
            <td>Access Level:</td>
            <td>User</td>
          </tr>
        </table>
        <section>
          <title>Parameters:</title>
        </section>
        <ul>
          <li>
            <code>-v</code> Show verbose output
          </li>
        </ul>
        <section>
          <title>Examples:</title>
        </section>
        <section>
          <title>Show online Help</title>
          <source><![CDATA[
  xindice help
          ]]></source>
        </section>
      </section>
    </section>
  </body>
</document>
