In the first ISIS-NBP nugget [1], we have briefly introduced the project's goals and architecture.
In the second ISIS-NBP nugget [2] we have tried to explain the concept of the ISIS-NBP Cell.
+-----------------------------+
| Databases |
| | |
| Console---Engine---Gateway |
+-----------------------------+
ISIS-NBP Cell
In this third nugget, we will focus on the Interactive Console.
The console is a command-line-based interface to provide interactive and direct access to databases managed by the cell. The Console can be run in the same machine where the ISIS-NBP Cell is installed, or can be run from a different (remote) machine given that both machines are network accessible.
The majority of ISIS-NBP users will "peek and poke" data records through the console, because it is fast and intuitive. Power users will learn how to do maintenance tasks and even develop short scripts to extend ISIS-NBP functionality. This is possible because there is a general purpose programming language embedded in the Console.
Without further ado, let us delve into a Console demonstration.
To start the ISIS-NBP Cell interactive console, open a shell (Unix terminal or Windows dos-box) and type:
pymx i
The name "pymx" is a homage to the widespread "mx" [3] tool, and to the Python [4] programming language, used in the development of ISIS-NBP. This name can change in the future, perhaps into something more intuitive such as "isisconsole". An important note: it is *not necessary* to know Python in order to use ISIS-NBP.
After the Cell is started in interactive mode, the following prompt appears:
Welcome to ISIS-NBP Cell 0.7.0 Interactive Console
Python 2.5.2 (r252:60911, Apr 21 2008, 11:12:42)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)]
Use the console to test and inspect the collections.
Type 'collection' to see a dictionary with all available collections.
Type '<Ctrl-D>' or 'exit()' followed by '<enter>' to quit
The available collections are: sample, test
In [1]:
The lines preceded by "In [number]:" indicate that the console is waiting for commands. Typing <return> or <enter> key signals that the typed command should be carried out. The results will be prefixed by "Out [number]:". For example, let us inspect the (always) available collection sample.
In [1]: sample
Out[1]: Collection sample with databases: cds.mst, xf0.mst
Now, we inspect the database "cds" inside the collection sample.
In [2]: sample.cds
Out[2]: cds (next mfn:151, type:0) in /pyisis/sample/cds.mst
We can also inspect record contents, doing:
In [3]: sample.cds[1]
Out[3]: mfn=1 length=8 (active)
69: Paper on: <plant physiology><plant transpiration><measurement
and instruments>
70: Magalhaes, A.C.
70: Franco, C.M.
44: Methodology of plant eco-physiology: proceedings of the
Montpellier Symposium
50: Incl. bibl.
24: Techniques for the measurement of transpiration of
individual plants
26: ^aParis^bUnesco^c-1965
30: ^ap. 211-224^billus.
If we are only interested in a particular field or sub-field, there are several ways to achieve the same result:
In [4]: sample.cds[1][26]
Out[4]: ^aParis^bUnesco^c-1965
In [5]: sample.cds[1].v26
Out[5]: ^aParis^bUnesco^c-1965
In [6]: sample.cds[1].v26.a
Out[6]: Paris
In [7]: sample.cds[1].v26["a"]
Out[7]: Paris
In [8]: sample.cds[1][26]["a"]
Out[8]: Paris
If you know the basics of display format commands of ISIS, you will understand the examples very fast, because they are very very very similar
very
Syntax: sample.cds[mfn] [tag] In the example above, record 1, field tag 26
sample.cds[mfn].vtt alternate syntax
Test: there are two alternate ways to get a subfield item. May you explain them?
Tip: you can mix the alternate modes to get fields and subfields, it works the same.
We can also create aliases for resources that we are going to use frequently.
In [12]: base = sample.cds
In [13]: r = base[3]
In [14]: r
Out[14]: mfn=3 length=7 (active)
69: Paper on: <plant physiology><moisture><temperature><wind>
<measurement and instruments><ecosystems>
70: Bosian, G.
44: Methodology of plant eco-physiology: proceedings of the
Montpellier Symposium
50: Incl. bibl.
24: Control of conditions in the plant chamber: fully automatic
regulation of wind velocity, temperature and relative humidity
to conform to microclimatic field conditions
26: ^c1965
30: ^ap. 233-238 ^billus.
In [15]: r.v30.b
Out[15]: illus.
Notice in the example above that not all input (In) commands generate outputs. In the next nugget we will further explore the Console.
This e-mail is a teaser, the third of a series that will give further details about the ISIS-NBP Cell, the project goals and development status quo. In the references section below, we give you pointers to previous nuggets.
References:
[1] 1st Isis-NBP nugget
https://listserv.surfnet.nl/scripts/wa.cgi?A2=ind0805&L=cds-isis&T=0&F=&S=&P=4804
[2] 2nd Isis-NBP nugget
https://listserv.surfnet.nl/scripts/wa.cgi?A2=ind0806&L=cds-isis&T=0&F=&S=&P=2294
[3] mx is the main utility of the CISIS package developed by BIREME
http://bvsmodelo.bvsalud.org/php/level.php?lang=en&component=31&item=1
[3] Python programming language
http://www.python.org
Ernesto Spinak
spinaker@adinet.com.uy
Montevideo, Uruguay
tel/fax (5982) 622-3352
celular (598) 99612238
No hay comentarios.:
Publicar un comentario