Adding extended notes

While it is possible for each user to keep a personal note along with each dataset in a database, this mechanism is not very flexible. Extended notes go far beyond these simple notes:

How to create xnote datasets

Just like the risx reference data, extended notes use a particular XML format. It is best explained with a short example:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xnoteset PUBLIC "-//Markus Hoenicka//DTD Xnote V1.1//EN" "" [
<!ENTITY lt "&#38;#60;">
<!ENTITY gt "&#62;">
<!ENTITY amp "&#38;#38;">
  <xnote key="notekey">

    <content type="application/xhtml+xml" xml:lang="en-us"><para id='2' style='bold'>the note proper</para></content>
    <link type="reference" target="Phadke1994"/>
    <link type="author" target="Walsh,N."/>
    <link type="journalabbrev" target="Biochem.Pharmacol."/>

We can easily recognize the following features:

How to add and update extended notes

You'll notice that managing extended notes is very similar to managing references. There are analogous commands to add and update extended notes. However, there is also one command specific to extended notes that helps you maintain the links to other database objects. Let's first go ahead and add a file containing extended notes:

refdbc: addnote /usr/local/share/refdb/examples/xnoteset.xml
try to add set as note 1
Note key: markus2003
Adding input set 1 successful
try to add set as note 2
Note key: secondnote
Adding input set 2 successful
2 note(s) added, 0 skipped, 0 failed

If you want to edit an existing note, you've got two options, depending on what you want to change. If you want to change the contents proper, or maybe add or change keywords, use the following commands:

Note: In this example we'll assume that you already know the ID of the note that you want to change. You'll learn later how to find a note by all sorts of criteria like title, keywords and the like. This section also has additional information on the getnote command used here.

refdbc: getnote -t xnote :NID:=1 -o editme.xml
543 byte written to /usr/home/markus/refdb/editme.xml
1 note(s) retrieved

This command will retrieve the note with the ID 1 in the xnote XML format and write the data to the file editme.xml. Now you can edit this file to your liking, and then send it back to the database like this:

refdbc: updatenote editme.xml
try to replace note 1
Note key: firstnote
Updating input set 1 successful
1 note(s) updated, 0 added, 0 skipped, 0 failed

If you want to add or remove links within an existing extended note, you may also find the following command helpful:

refdbc: addlink :NID:=1 :CK:=Miller1999
:NID: 1 -> :CK: Miller1999
1 link(s) added, 0 skipped, 0 failed

The first argument to this command must be either the ID of an extended note (":NID:") or the key (":NCK:"). The following arguments are interpreted as a list of objects that the note should be linked to. In this case, the citation key of a reference is specified. If you use the -r option with this command, the specified links will be removed.