A Fedora repository includes a number of predefined namespace bindings (essentially, a mapping that connects a particular prefix to a URI, allowing for a more convenient and human-readable rendering of RDF). Predefined namespaces include DC, FOAF, Fedora, and LDP, among others. As additional namespaces are used in the course of depositing materials into the repository, each new namespace will automatically be bound to its own prefix the first time it is used. Once a URI is bound to a particular namespace prefix, it cannot be changed. A full list of the bound namespaces for a given Fedora repository at any given moment can be seen in the HTTP REST interface, as a list of pre-populated "PREFIX ..." bindings in the SPARQL update query text-box.
Custom Namespace registry
This optional feature allows an administrator to provide a list of custom namespace prefixes that will override the default prefix registry. The custom namespaces are loaded on start-up via a YAML file. The namespaces can be modified while Fedora is running. Changes may take a few minutes to take effect.
Below is a sample YAML namespace configuration file, custom_namespaces.yml. Notice the "awesome" prefix definition at the bottom of the list. We will use this in the following example. NB: the custom file will override all default namespace prefixes. In other words, the custom file becomes the definitive registry. Any namespaces that are not prefixed will be returned as full URIs in the response.
Fedora can activate the file by using the
-Dfcrepo.namespace.registry system parameter, either on the command line or by adding it to the list of other params that provide paths to other configuration files:
In order to demonstrate how this feature works, try starting Fedora without defining a custom namespace registry:
Once Fedora is running, run the following curl command
When you retrieve this resource,
notice the new predicate is expressed as the full URI.
Also notice there are built in prefixes for common namespaces. Now restart Fedora with the custom namespaces yml enabled:
Retrieve the item and see how your custom namespace prefix is being used.
Suppose, you later decide that the "awesome" namespace was mislabelled. Instead you really wanted the namespace to be "justokay". Edit the file /my/fedora/path/custom_namespaces.yml to change "awesome" to "justokay", save the file and wait a few seconds, then check the namespace output again: