Each Daisy repository (since Daisy 2.0) has at least one namespace. The documents created in that repository will by default belong to one of those namespaces based on the configuration. The ID of a document is the combination of a numeric sequence and the namespace, for example:

2583-AWAN

Each repository server is responsible for maintaining the sequence number for the documents of their namespace. When a document is created with a foreign namespace (a namespace that is not managed by the current repository server), the sequence ID needs to be supplied, since it is assumed that another repository server is responsible for that namespace. On the other hand, when a document is created in the namespace that is managed by repository server itself, then a sequence ID cannot be supplied, as the repository server itself is then responsible for assigning the sequence ID.

A Daisy repository server doesn't really care whether foreign namespaces are really associated with other repository servers. The namespace could also come from an external application that creates documents (and maintains its own sequence counter), it could come from a manually created 'export' that is imported using the import tool, or a namespace created by an administrator. So for foreign namespaces, it just assumes someone else is responsible for assigning unique sequence numbers.

Namespace name

A namespace can be up to 200 characters and contain the characters a-z, A-Z, 0-9 and _ (underscore). The dot character is not allowed to avoid confusion with file name extensions (as the document ID will often be used in URLs), and the dash character is not allowed to avoid confusion with the separator between the sequence number and the namespace.

The namespace name is typically a short string. This approach has been choosen to keep the document IDs short and readable. But as a consequence, it requires some care to avoid conflicting namespaces within an organisation, and between organisations there's no control whatsoever.

If you want to avoid the possibilities of conflicts and don't care about the readability, it is always possible to use a longer string. For example, a registered domain name or a random generated string (GUID). However, in general we would recommend to stick with a short name.

The repository server installation tool gives some recommendations on namespace naming.

Namespace purpose

Namespaces have little purpose as long as documents are not exchanged between repositories. The main purpose of namespaces it to allow import/export (replication) of documents between repositories. If there wouldn't be namespacess, the document IDs between the repositories would not be unique and hence there would be conflicts. For example, in both repositories there might be a document with ID 55, though these would be different documents. It would of course be possible to assign new IDs to documents upon import, but then the identity of the original document would be lost, which would make subsequent 'update' imports difficult, and also requires updating links in all document content (which would mean the import tool has to understand the document formats).

Daisy namespaces

Namespace fingerprints

For each namespace, there is an associated namespace fingerprint. Since namespaces will usually be short strings, and since there might be people who choose the same namespace or simply used the proposed default (DSY), some additional verification is needed to assure that two namespaces are really the same. For this purpose, each namespace name is associated with a fingerprint. The namespace fingerprint is typically a longer random generated string.

The repository server keeps a table of the namespaces used in the repository and their corresponding fingerprints (these are the namespaces that are said to be registered in the repository). The registered namespace are viewable through the administration screen of the Daisy Wiki, which also allows unregistering unused namespaces.

For export/import, namespace fingerprint information is included in the export, so that it can be verified upon import.

Conditional namespaces

As of Daisy 2.3 it is possible for a repository to manage multiple namespaces and to configure conditional namespaces. In the configuration the administrator can set a condition for a namespace. A condition is an expression that is found in the where part of a Daisy query. It speaks for itself that the choice of namespace is only done on document creation and this also means that expressions using document id or namespace will not work since there is none.

Configuring the use of conditional namespaces is done in the myconfig.xml which is found under $DAISY_DATA/conf. It is simply done by adding another namespace element in the configuration of the target with path 'repository-manager'. Here is an example of what it might look like.

  <target path="/daisy/repository/repository-manager">
    <configuration>      
      <namespace>DSY</namespace> <!-- Default namespace -->
      <namespace test="documentType='SimpleDocument'">SD</namespace> <!-- Conditional namespace -->
    </configuration>
  </target>

Managed/unmanaged namespaces

Namespaces registered in the the repository can be either managed or unmanaged. Managed namespaces have the trait that document numbering is managed by the repository. These are generally the namespaces that are mentioned in the myconfig.xml.
Unmanaged namespace can be namespaces that have been created as a result of a document import or simply by an action of an administrator. Users are then responsible for chosing their own ids for these unmanaged namespaces. These functionality is only made visible in the wiki to administors.

Namespacing of non-document entities

At the time of this writing, only documents are namespaced. Thus other entities, like the document, part and field types are not in a namespace. The export/import tools assume that if the name corresponds, they are the same.