How to create a new namespace in fedora 4.0.1

247 views
Skip to first unread message

jgu...@gmail.com

unread,
Feb 23, 2015, 6:11:09 AM2/23/15
to fedor...@googlegroups.com
Hi,

I want to create and register a new namespace in fedora 4.0.1, but don't know how to achieve this.

Following excerpt is taken from the fedora-4.1-documentation (at https://wiki.duraspace.org/display/FEDORA41/Configuration+Options+Inventory#ConfigurationOptionsInventory-FedoraNodeTypes-nodedefinitionsintermsofnamespaceproperties):



Fedora Node Types - node definitions in terms of namespace properties

Defining .cnd files such as these in repository.json will register namespaces and node types found within:

fcrepo4/fcrepo-kernel/src/main/resources/fedora-node-types.cnd

fcrepo4/fcrepo-auth-roles-common/src/main/resources/cnd/access-control.cnd

Alternatively from definition in .cnd files as above, forms are available to add namespaces and nodetypes at these URL endpoints:

http://<host>/rest/fcr:namespaces
http://<host>/rest/fcr:nodetypes



But http://localhost:8080/rest/fcr:namespaces gives me a "The namespace prefix (fcr) has not been registered" and in my production environment I don't have a file called "fedora-node-types.cnd".

Jens




Andrew Woods

unread,
Feb 23, 2015, 10:41:42 AM2/23/15
to fedor...@googlegroups.com
Hello Jens,
Thanks for raising the out-dated documentation. The excerpt you referenced has now been removed.

Namespaces within the repository are expected to be created in a standard RDF/SPARQL-Update [1] approach using prefix declarations. Can you expand on your use of and expectations around namespaces?

Regards,
Andrew


--
You received this message because you are subscribed to the Google Groups "Fedora Tech" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fedora-tech...@googlegroups.com.
To post to this group, send email to fedor...@googlegroups.com.
Visit this group at http://groups.google.com/group/fedora-tech.
For more options, visit https://groups.google.com/d/optout.

jgu...@gmail.com

unread,
Feb 25, 2015, 2:43:50 AM2/25/15
to fedor...@googlegroups.com
Hello Andrew,

I wanted to have my own field names with my own prefix.

Such as

esc:knowledge
esc:package

where 'esc' is my own prefix and 'knowledge' and 'package' are my own fields. I thought I would have to create a new namespace to achieve this.

What I now tried to do is the following:

Created a new resource 'testcontainer'.

Tried to update the resource at

http://localhost:8080/rest/testcontainer

with the following sparql:


PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX esc: <http://myarbitraryurl.org>

INSERT {
<>
dc:title "ttt";
dc:anyfield "fff";
esc:package "ppp";
esc:knowledge "kkk"
}
WHERE { }

 
After clicking 'Update' I can see these fields in the Properties-area:

...
ns001: myarbitraryurl.orgknowledge
    kkk
ns001: myarbitraryurl.orgpackage
    ppp
dc: anyfield
    fff
dc: title
    ttt
...


It looks as if a new prefix has been created ('ns001') and 2 new fields, named 'myarbitraryurl.orgknowledge'
 and '
myarbitraryurl.orgpackage'.

What I wanted of course is this:

esc: knowledge
    kkk
esc: package
    ppp

...


Obviously something went wrong. Maybe it's because 'myarbitraryurl.org' is not really registered anywhere (must it?).

Besides, I was surprised to see that apparently any fieldname is accepted for dc.

Jens

Andrew Woods

unread,
Feb 25, 2015, 2:02:43 PM2/25/15
to fedor...@googlegroups.com
Hello Jens,
It looks you are doing exactly the right things in your sparql-update. In running through your example myself, I hit the same perplexing issue you saw with the "esc:<http://myarbitraryurl.org>" prefix/namespace declaration not being properly interpreted. With further investigation, it appears that this particular issue is arising from the fact that your namespace URI contains no terminating nor intermediate delimiter (i.e. '/' or '#').

Try your example again, but change the namespace URI to something along the lines of any of the following:

I would expect all of the above to work. But I would also expect your original namespace to work, and have created a ticket to look into it more deeply.

As for the ability to assign any random predicate to a standardized namespace, such as "dc:anyfield" in your example, it is up to the user to use namespaces and terms in alignment with their defining ontologies (if you wish to do so). Fedora ensures syntactic, but not ontologic validity.
Thanks,
Andrew

jgu...@gmail.com

unread,
Mar 2, 2015, 1:53:41 AM3/2/15
to fedor...@googlegroups.com
Hello Andrew,

I changed my URI according to your suggestions and it works fine now.

Thanks,
Jens

Ruth Tillman

unread,
Jun 16, 2015, 1:46:28 PM6/16/15
to fedor...@googlegroups.com
Hi Andrew,

I had a similar issue and found this thread, got that fixed, but now the back-end is suggesting "PREFIX ns001 etc." along with all the dc, foaf, etc. that's normally in there. It's not a huge deal, but I could see future errors producing ns002, etc. Is there a way to remove these from the suggested list?

Ruth

Andrew Woods

unread,
Jun 16, 2015, 2:38:44 PM6/16/15
to fedor...@googlegroups.com
Hello Ruth,
You may find the following thread interesting:
Andrew

Ruth Tillman

unread,
Jun 17, 2015, 8:45:35 AM6/17/15
to fedor...@googlegroups.com
Looks good. Thank you, Andrew.
Reply all
Reply to author
Forward
0 new messages