Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

It is important to note that this should be done when the repository is first set up, before any content has been added.

Using SPARQL-Update to Bind Prefixes

To ensure that specific namespaces are used (i.e., treated as sacred) by Fedora 4 when doing a SPARQL update, ensure that the namespace prefix URI includes a terminating character. Otherwise system-generated JCR namespaces (e.g., ns001, ns002), and not the user-supplied namespaces, will get registered. Therefore, the following statement could lead to unexpected namespaces. F4 will register a system-generated namespace and you would not find "http://myurl.org" namespace in the system.

Note

This functionality is currently not working; see

Jira
serverDuraSpace JIRA
columnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolution
serverIdc815ca92-fd23-34c2-8fe3-956808caf8c5
keyFCREPO-2376

Code Block
titleProblematic Usage
linenumberstrue
PREFIX esc: <http://myurl.org>
INSERT {
<>
esc:package "ppp";
}
WHERE { }

 

Therefore, the URI prefix in line 1 should have a terminating character, e.g., a slash or a hash. 

Code Block
titleRecommended Usage
linenumberstrue
PREFIX esc: <http://myurl.org/>
. . .

"Initializing" a Repository with Additional Bindings

The inadvertent binding of namespaces to system-generated prefixes can be prevented by preemptively binding the namespaces that are likely to be used to standard prefixes.  This can be accomplished by creating a dummy node in the repository, adding desired namepace prefixes and RDF triples via a SPARQL update query, and then deleting the dummy node and the resulting tombstone to remove traces of this operation from the repository.  Even after all traces of the initialization node have been removed, the namespace bindings will persist in the repository and be available as RDF triples are added in the future.

Note

This functionality is currently not working; see

Jira
serverDuraSpace JIRA
columnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolution
serverIdc815ca92-fd23-34c2-8fe3-956808caf8c5
keyFCREPO-2376

Note

This workaround should be unnecessary after the completion of:

Jira
serverDuraSpace JIRA
serverIdc815ca92-fd23-34c2-8fe3-956808caf8c5
keyFCREPO-2184

Code Block
languagebash
titleSample Namespace Initialization Script
linenumberstrue
#!/bin/bash
 
REST="http://localhost:8080/fcrepo/rest"
USER="fedoraAdmin"
PASSWORD="secret3"
 
QUERY="
    PREFIX pcdm: <http://pcdm.org/models#> 
    PREFIX bibo: <http://purl.org/ontology/bibo/>
    INSERT DATA { 
        <> a pcdm:Object ;
            bibo:shortTitle 'Fedora4 Site Initialization Page' .
        }"
 
curl -u $USER:$PASSWORD -X PUT "$REST/initialize/"
curl -u $USER:$PASSWORD -X PATCH -H "Content-Type: application/sparql-update" \
    --data "$QUERY" "$REST/initialize"
curl -u $USER:$PASSWORD -X DELETE "$REST/initialize"
curl -u $USER:$PASSWORD -X DELETE "$REST/initialize/fcr:tombstone"