Page History
...
The BTE configuration file is located in path: [dspace]/config/spring/api/bte.xml
and it's a Spring XML configuration file that consists of Java beans. (If these terms are unknown to you, please refer to Spring Dependency Injection web site for more information.)
Explanation of beans:
bean
Code Block | ||
---|---|---|
| ||
<bean id="gr.ekt.bte.core.TransformationEngine" /> |
This bean is instantiated when the import takes place. It deploys a new BTE transformation engine that will do the transformation from one format to the other. It needs one input argument, the workflow (the processing step mentioned before) that will run when transformation takes place. Normally, you don't need to modify this bean.
bean
Code Block | ||
---|---|---|
| ||
<bean id="org.dspace.app.itemimport.DataLoaderService" /> |
Within this bean we declare all the possible data loaders that we need to support. Keep in mind that for each data loader we specify a key that can be used as the value of option "-i" in the import script that we mentioned earlier. Here is the point where you would add a new custom DataLoader in case the default ones doesn't match your needs.
Moreover, this bean holds the "outputMap" which is a Map between the internal keys that BTE uses to hold metadata and the DSpace metadata fields. (See later on, how data loaders specify the keys that BTE uses to hold the metadata)bean
Code Block | ||
---|---|---|
| ||
<bean id="linearWorkflow" /> |
This bean describes the processing steps. Currently there are no processing steps meaning that all records loaded by the data loader will pass to the output generator, unfiltered and unmodified. ( See next section "Case studies" for info about how to add a filter or a modifier) bean
Code Block | ||
---|---|---|
| ||
<bean id="gr.ekt.bteio.loaders.BibTeXDataLoader" |
...
/> <bean id="gr.ekt.bteio.loaders.CSVDataLoader" |
...
/> <bean id="gr.ekt.bteio.loaders.TSVDataLoader" |
...
/> <bean id="gr.ekt.bteio.loaders.RISDataLoader" |
...
/> <bean id="gr.ekt.bteio.loaders.EndnoteDataLoader" |
...
/> <bean id="gr.ekt.bteio.loaders.OAIPMHDataLoader" /> |
Each one of the 5 first data loaders (which are actually "file" data loaders) has the following properties:
a) filename: it is a String that specifies the filepath to the file that the loader will read data from. If you specify this property, you do not need to give the option "-s" to the import script in the command prompt. If you, however, specify this property and you also provide a "-s" option in the command line, the option "-s" will be taken into consideration by the data loader.
...
1) I have my data in a format different from the ones that are supported by this functionality. What can I do?
Either you try to easily transform your data to one of the supported formats or you need to create a new data loader. To do this, create a new Java class that implements the following Java interface from BTE:
Code Block |
---|
...
gr.ekt.bte.core.DataLoader |
...
You will need to implement the following method:
Code Block |
---|
...
| ||
public RecordSet |
...
getRecords() throws MalformedSourceException |
...
in which you have to create records - most probably you will need to create your own Record class (by implementing the gr.ekt.bte.core.Record class) and fill a RecordSet.
After that, you will need to declare the new DataLoader in the Spring XML configuration file (in the bean with id="org.dspace.app.itemimport.DataLoaderService") using your own key. Use this key as a value for option "-i" in the import key in order to specify that your data loader must run.
2) I need to filter some of the input records or modify some value from records before outputting them
In this case you will need to create your own filters and modifiers.
To create a new filter, you need to extend the following BTE abstact class:
Code Block |
---|
gr.ekt.bte.core.AbstractFilter |
You will need to implement the following method:
public abstract boolean isIncluded ( Record record
Code Block | ||
---|---|---|
| ||
public abstract boolean isIncluded ( Record record ) |
Return false if the specified record needs to be filtered, otherwise return true.
To create a new modifier, you need to extend the following BTE abstact class:
Code Block |
---|
gr.ekt.bte.core.AbstractModifier |
You will need to implement the following method:
public abstract Record modify ( Record record
Code Block | ||
---|---|---|
| ||
public abstract Record modify ( Record record ) |
within you can make any changes you like in the record. You can use the Record methods to get the values for a specific key and load new ones (For the later, you need to make the Record mutable)
After you create your own filters or modifiers you need to add them in the Spring XML configuration file as in the following example:
Code Block |
---|
...
| ||
<bean id="customfilter" |
...
class="org.mypackage.MyFilter" /> |
...
<bean |
...
id="linearWorkflow" |
...
class="gr.ekt.bte.core.LinearWorkflow"> |
...
<property name="steps"> |
...
<list> <ref bean="customfilter" /> |
...
</list> |
...
</property> |
...
</bean> |
You can add as many filters and modifiers you like to linearWorkflow, they will run the one after the other in the specified order.