Difference between revisions of "API:bin/import"

From EPrints Documentation
Jump to: navigation, search
m (pointing out to useful list of available filters)
 
(2 intermediate revisions by 2 users not shown)
Line 8: Line 8:
 
'''import''' - Import a file using an import plugin.
 
'''import''' - Import a file using an import plugin.
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
 
 
<!-- Pod2Wiki=head_synopsis -->
 
<!-- Pod2Wiki=head_synopsis -->
 
==SYNOPSIS==
 
==SYNOPSIS==
Line 21: Line 18:
 
'''import''' <em>repository_id</em> ['''options'''] <em>dataset</em> <em>plugin</em> <em>filename</em>  
 
'''import''' <em>repository_id</em> ['''options'''] <em>dataset</em> <em>plugin</em> <em>filename</em>  
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
 
 
<!-- Pod2Wiki=head_description -->
 
<!-- Pod2Wiki=head_description -->
 
==DESCRIPTION==
 
==DESCRIPTION==
 
This command imports a set of EPrints from a file into the given dataset.
 
This command imports a set of EPrints from a file into the given dataset.
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
bin/import <REPOSITORYID> eprint --verbose
<span style='display:none'>User Comments</span>
+
presents a list of all available import filters (as well as missing perl modules causing some deactivations)
 +
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
 
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
 
 
<!-- Pod2Wiki=head_arguments -->
 
<!-- Pod2Wiki=head_arguments -->
 +
 
==ARGUMENTS==
 
==ARGUMENTS==
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
* <em>repository_id</em>  
<span style='display:none'>User Comments</span>
+
: The ID of the EPrint repository to import to.
<!-- Edit below this comment -->
 
 
 
 
 
<!-- Pod2Wiki= -->
 
</div>
 
<!-- Pod2Wiki=item_i_repository_id -->
 
===<em>repository_id</em> ===
 
 
 
The ID of the EPrint repository to import to.
 
 
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
 
 
<!-- Pod2Wiki= -->
 
</div>
 
<!-- Pod2Wiki=item_i_dataset -->
 
===<em>dataset</em>===
 
 
 
The name of the dataset to import into, such as "eprint","archive", "subject" or "user".
 
 
 
Please note that for the "subject" dataset, you are probably better off using the import_subjects tool which will empty the dataset before importing.
 
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
* <em>dataset</em>
<span style='display:none'>User Comments</span>
+
: The name of the dataset to import into, such as "eprint","archive", "subject" or "user".
<!-- Edit below this comment -->
 
  
 +
: Please note that for the "subject" dataset, you are probably better off using the import_subjects tool which will empty the dataset before importing.
  
<!-- Pod2Wiki= -->
+
* <em>plugin</em>
</div>
+
: The id of the input plugin to use. This should not include the leading "Import::". Examples: BibTeX, XML.
<!-- Pod2Wiki=item_i_plugin -->
 
===<em>plugin</em>===
 
  
The id of the input plugin to use. This should not include the leading "Import::". Examples: BibTeX, XML.
+
: If this is ommited or an invalid plugin is requested, then 'import' will list all plugins compatible with the dataset and exit.
  
If this is ommited or an invalid plugin is requested, then 'import' will list all plugins compatible with the dataset and exit.
+
* <em>filename</em>
 +
: Filename to read from. To read from STDIN specify '-'.
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
 
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
 
 
<!-- Pod2Wiki=head_options -->
 
<!-- Pod2Wiki=head_options -->
 
==OPTIONS==
 
==OPTIONS==
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
* '''--user USERID/USERNAME'''  
<span style='display:none'>User Comments</span>
+
: For eprint datasets only. (not user or subject).
<!-- Edit below this comment -->
 
 
 
  
<!-- Pod2Wiki= -->
+
: Sets the userid/username of the user in the system who will own the imported records.
</div>
 
<!-- Pod2Wiki=item_b_user_userid_username -->
 
==='''--user USERID/USERNAME''' ===
 
  
For eprint datasets only. (not user or subject).  
+
: Usually required for importing EPrint records. This may not be required if the import format contains the userid value, eg. an import in the EPrints 3 XML format.
  
Sets the userid/username of the user in the system who will own the imported records.
+
: If this is an integer then it is assumed to be the userid of the user, otherwise it is assumed to be the username.
  
Usually required for importing EPrint records. This may not be required if the import format contains the userid value, eg. an import in the EPrints 3 XML format.
+
: You may wish to create one or more "bulk import" users and make imported eprint records belong to them.
  
If this is an integer then it is assumed to be the userid of the user, otherwise it is assumed to be the username.
+
* '''--argument key=value'''
 +
: Add an argument to the import plugin. May be repeated. Effects depend on the import plugin.
  
You may wish to create one or more "bulk import" users and make imported eprint records belong to them.
+
* '''--parse-only'''
 +
: Don't import, just check the file.
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
* '''--migration'''
<span style='display:none'>User Comments</span>
+
: Turn on all the options needed to correctly import an XML data file exported from version 2, using the migration toolkit. Implies --enable-web-imports --enable-file-imports --force
<!-- Edit below this comment -->
 
 
 
 
 
<!-- Pod2Wiki= -->
 
</div>
 
<!-- Pod2Wiki=item_b_arg_key_value -->
 
==='''--arg key=value'''===
 
  
Add an argument to the import plugin. May be repeated. Effects depend on the import plugin.
+
* '''--enable-import-fields'''
 +
: Allow the import to set fields that are set as not to be imported. This is typically used to specify the imported object id.
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
* '''--enable-file-imports'''
<span style='display:none'>User Comments</span>
+
: Allow the imported data to import files from the local filesystem. This can obviously be seen as a security hole if you don't trust the data you are importing. This sets the "enable_file_imports" configuration option for this session only.
<!-- Edit below this comment -->
 
  
 +
* '''--enable-web-imports'''
 +
: Allow the imported data to import files from the Web. This can obviously be seen as a security hole if you don't trust the data you are importing. This sets the "enable_web_imports" configuration option for this session only.
  
<!-- Pod2Wiki= -->
+
* '''--xml'''
</div>
+
: Output to STDOUT the parsed objects in EPrints XML (does not import anything).
<!-- Pod2Wiki=item_b_parse_only -->
 
==='''--parse-only'''===
 
  
Don't import, just check the file.
+
* '''--update'''
 +
: Normally you can not import a new item with the same id as an existing item. With this option enabled existing items will be updated with the new item. Combine with --enable-import-fields to update all field values.
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
* '''--force'''
<span style='display:none'>User Comments</span>
+
: Don't ask any questions, just do it!
<!-- Edit below this comment -->
 
  
 +
* '''--help'''
 +
: Print a brief help message and exit.
  
<!-- Pod2Wiki= -->
+
* '''--man'''
</div>
+
: Print the full manual page and then exit.
<!-- Pod2Wiki=item_b_migration -->
 
==='''--migration'''===
 
  
Turn on all the options needed to correctly import an XML data file exported from version 2, using the migration toolkit. Implies --enable-web-imports --enable-file-imports --force
+
* '''--quiet'''
 +
: Be vewwy vewwy quiet. This option will supress all output unless an error occurs.
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
* '''--verbose'''
<span style='display:none'>User Comments</span>
+
: Explain in detail what is going on. May be repeated for greater effect.
<!-- Edit below this comment -->
 
  
 +
: Shows why a plugin is disabled.
  
<!-- Pod2Wiki= -->
+
* '''--version'''
</div>
+
: Output version information and exit.
<!-- Pod2Wiki=item_b_enable_file_imports -->
 
==='''--enable-file-imports'''===
 
  
Allow the imported data to import files from the local filesystem. This can obviously be seen as a security hole if you don't trust the data you are importing. This sets the "enable_file_imports" configuration option for this session only.
+
<pre>
 +
 
 +
</pre>
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
 
+
'''Please note''' that the ''--update'' option described above '''will not''' work in EPrint versions prior to v3.3.12 without an edit to the bin/import module. See here for details. [https://github.com/eprints/eprints/commit/a5eb05abd14606d26f746e1f2d499bd11104c3ae]
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
+
<!-- Pod2Wiki=head_copyright -->
<!-- Pod2Wiki=item_b_enable_web_imports -->
+
==COPYRIGHT==
==='''--enable-web-imports'''===
+
Copyright 2000-2011 University of Southampton.
 
 
Allow the imported data to import files from the Web. This can obviously be seen as a security hole if you don't trust the data you are importing. This sets the "enable_web_imports" configuration option for this session only.
 
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
This file is part of EPrints http://www.eprints.org/.
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
  
 +
EPrints is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  
<!-- Pod2Wiki= -->
+
EPrints is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
</div>
 
<!-- Pod2Wiki=item_b_update -->
 
==='''--update'''===
 
  
Normally you can not import a new item with the same id as an existing item. With this option enabled existing items will be updated with the new item (implies --enable-import-ids).
+
You should have received a copy of the GNU General Public License along with EPrints.  If not, see http://www.gnu.org/licenses/.
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
+
<!-- Pod2Wiki=_postamble_ -->
<!-- Pod2Wiki=item_b_force -->
 
==='''--force'''===
 
 
 
Don't ask any questions, just do it!
 
 
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
 
 
<!-- Pod2Wiki= -->
 
</div>
 
<!-- Pod2Wiki=item_b_help -->
 
==='''--help'''===
 
 
Print a brief help message and exit.
 
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
<!-- Pod2Wiki= -->
 
</div>
 
<!-- Pod2Wiki=item_b_man -->
 
==='''--man'''===
 
 
Print the full manual page and then exit.
 
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
<!-- Pod2Wiki= -->
 
</div>
 
<!-- Pod2Wiki=item_b_quiet -->
 
==='''--quiet'''===
 
 
Be vewwy vewwy quiet. This option will supress all output unless an error occurs.
 
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
<!-- Pod2Wiki= -->
 
</div>
 
<!-- Pod2Wiki=item_b_verbose -->
 
==='''--verbose'''===
 
 
Explain in detail what is going on. May be repeated for greater effect.
 
 
Shows why a plugin is disabled.
 
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
<!-- Pod2Wiki= -->
 
</div>
 
<!-- Pod2Wiki=item_b_version -->
 
==='''--version'''===
 
 
Output version information and exit.
 
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
<!-- Pod2Wiki= -->
 
</div>
 
<!-- Pod2Wiki=head_copyright -->
 
==COPYRIGHT==
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
 
 
<!-- Pod2Wiki= -->
 
</div>
 
<!-- Pod2Wiki=_postamble_ --><!-- Edit below this comment -->
 

Latest revision as of 13:43, 29 January 2015

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 - Import a file using an import plugin.


SYNOPSIS

import repository_id [options] dataset

import repository_id [options] dataset plugin filename


DESCRIPTION

This command imports a set of EPrints from a file into the given dataset.

bin/import <REPOSITORYID> eprint --verbose

presents a list of all available import filters (as well as missing perl modules causing some deactivations)


ARGUMENTS

  • repository_id
The ID of the EPrint repository to import to.
  • dataset
The name of the dataset to import into, such as "eprint","archive", "subject" or "user".
Please note that for the "subject" dataset, you are probably better off using the import_subjects tool which will empty the dataset before importing.
  • plugin
The id of the input plugin to use. This should not include the leading "Import::". Examples: BibTeX, XML.
If this is ommited or an invalid plugin is requested, then 'import' will list all plugins compatible with the dataset and exit.
  • filename
Filename to read from. To read from STDIN specify '-'.


OPTIONS

  • --user USERID/USERNAME
For eprint datasets only. (not user or subject).
Sets the userid/username of the user in the system who will own the imported records.
Usually required for importing EPrint records. This may not be required if the import format contains the userid value, eg. an import in the EPrints 3 XML format.
If this is an integer then it is assumed to be the userid of the user, otherwise it is assumed to be the username.
You may wish to create one or more "bulk import" users and make imported eprint records belong to them.
  • --argument key=value
Add an argument to the import plugin. May be repeated. Effects depend on the import plugin.
  • --parse-only
Don't import, just check the file.
  • --migration
Turn on all the options needed to correctly import an XML data file exported from version 2, using the migration toolkit. Implies --enable-web-imports --enable-file-imports --force
  • --enable-import-fields
Allow the import to set fields that are set as not to be imported. This is typically used to specify the imported object id.
  • --enable-file-imports
Allow the imported data to import files from the local filesystem. This can obviously be seen as a security hole if you don't trust the data you are importing. This sets the "enable_file_imports" configuration option for this session only.
  • --enable-web-imports
Allow the imported data to import files from the Web. This can obviously be seen as a security hole if you don't trust the data you are importing. This sets the "enable_web_imports" configuration option for this session only.
  • --xml
Output to STDOUT the parsed objects in EPrints XML (does not import anything).
  • --update
Normally you can not import a new item with the same id as an existing item. With this option enabled existing items will be updated with the new item. Combine with --enable-import-fields to update all field values.
  • --force
Don't ask any questions, just do it!
  • --help
Print a brief help message and exit.
  • --man
Print the full manual page and then exit.
  • --quiet
Be vewwy vewwy quiet. This option will supress all output unless an error occurs.
  • --verbose
Explain in detail what is going on. May be repeated for greater effect.
Shows why a plugin is disabled.
  • --version
Output version information and exit.
  

Please note that the --update option described above will not work in EPrint versions prior to v3.3.12 without an edit to the bin/import module. See here for details. [1]

COPYRIGHT

Copyright 2000-2011 University of Southampton.

This file is part of EPrints http://www.eprints.org/.

EPrints is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

EPrints is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with EPrints. If not, see http://www.gnu.org/licenses/.