API:bin/import subjects

From EPrints Documentation
Revision as of 15:27, 16 December 2011 by Tdb01r (talk | contribs)
Jump to: navigation, search

EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects


API: Core API

Latest Source Code (3.4, 3.3) | Revision Log | Before editing this page please read Pod2Wiki


NAME

import_subjects - rebuild an EPrint repository subjects list from the contents of a file

User Comments


SYNOPSIS

import_subjects repository_id [options] [subjectfile]

User Comments


DESCRIPTION

Import a set of subjects into an EPrints repository. The subjects are the heirarchical tree of options for "subject" type metadata fields in an eprint repository.

Use the staff admin subject editor for little tweaks. Use this command for the initial setup or bulk editing subjects. Use the exporter to dump the current subjects if you (an administrator) have edited them online.

This script should also be run after create_tables.

Without the --force option, this script asks for confirmation before actually erasing anything.

User Comments


ARGUMENTS

User Comments


repository_id

The ID of the EPrint repository to use.

User Comments


subjectfile

This is the file to import the subjects from. If you do not specify it then the system will use "subjects" from the given repository cfg directory.

User Comments


OPTIONS

User Comments


--xml

Import XML format instead of flat text.

User Comments


--help

Print a brief help message and exit.

User Comments


--man

Print the full manual page and then exit.

User Comments


--quiet

Be vewwy vewwy quiet. This option will supress all output unless an error occurs.

User Comments


--verbose

Explain in detail what is going on. May be repeated for greater effect.

User Comments


--version

Output version information and exit.

User Comments


--nopurge

Do not purge the existing records from the subject table before importing this file. Rather than do this, it's probably easier to export the current subjects as XML, then combine in your new file and reimport it.

User Comments


--force

Don't ask before making the changes.

User Comments


FILE FORMAT

There are two different file formats excepted, the default colon seperated file and XML in the eprints export format.

The colon seperated ASCII is easier to edit, but is more limited. It is not intended for UTF-8 encoded characters and can only specify subject names in the default language.

The XML format can contain any unicode characters and also allows multiple languages for the names of subjects. You may wish to dump the current subjects out of eprints as XML. Edit it. Then re-import it. The downside is that this format is far more verbose.

User Comments


The ASCII Default Format

This is the default format.

Comments may be placed on lines begining with a hash (#)

Each (non-comment) line of the file should be in the following format:

subjectid:name:parents:depositable

eg.

blgc-bphy:Biophysics:blgc,phys:1

Please see the main documentation for the meaning of these fields.

User Comments


subjectid

An ASCII string which is a unique ID for this subject.

User Comments


name

The name of this subject, in the default language of the repository.

User Comments


parents

A comma seperated list of the parents of this subject. Be careful not to cause loops. The top level subject id is ROOT and should not be imported as it always exists.

User Comments


depositable

A boolean value ( 1 or 0 ) which indicates if this subject may have eprints associated with it.

User Comments


The XML File Format

This is the standard eprints export format. It looks like this:

 <eprintsdata>
   <record>
     <field name="subjectid">phys</field>
     <field name="name"><lang id="en">Physical Sciences &amp; Mathematics</lang></field>
     <field name="parents">subjects</field>
     <field name="depositable">FALSE!/field!
   </record>
   .
   .
   .
 </eprintsdata>
 

The fields have the same meaning as described for the ASCII format, with the following variations. The name field can (and should) have a name for each language supported by the repository. Multiple parents are indicated by multiple <ltfield name="parents<gt>> elements. Depositable should be either TRUE or FALSE.


User Comments


COPYRIGHT

User Comments