@@ -8,21 +8,15 @@ export function query(input, query, output, useDb = false) {
88 `Querying ${ input } failed.`
99 ) ;
1010 } else {
11- throwOnError (
12- `robot query -i ${ input } --query ${ query } ${ output } ` ,
13- `Querying ${ input } failed.`
14- ) ;
11+ throwOnError ( `robot query -i ${ input } --query ${ query } ${ output } ` , `Querying ${ input } failed.` ) ;
1512 }
1613}
1714
1815export function materialize ( input , output ) {
19- throwOnError (
20- `robot query -i ${ input } --create-tdb true --tdb-directory ${ output } ` ,
21- 'Materialization failed.'
22- ) ;
16+ throwOnError ( `robot query -i ${ input } --create-tdb true --tdb-directory ${ output } ` , 'Materialization failed.' ) ;
2317}
2418
25- export function extract ( input , upperTerm , lowerTerms , output , intermediates = " all" , outputFormat = " owl" ) {
19+ export function extract ( input , upperTerm , lowerTerms , output , intermediates = ' all' , outputFormat = ' owl' ) {
2620 throwOnError (
2721 `robot extract -i ${ input } \
2822 --method MIREOT \
@@ -34,7 +28,7 @@ export function extract(input, upperTerm, lowerTerms, output, intermediates = "a
3428 ) ;
3529}
3630
37- export function subset ( input , seedTerms , output , outputFormat = " owl" ) {
31+ export function subset ( input , seedTerms , output , outputFormat = ' owl' ) {
3832 throwOnError (
3933 `robot extract -i ${ input } \
4034 --method subset \
@@ -44,7 +38,7 @@ export function subset(input, seedTerms, output, outputFormat = "owl") {
4438 ) ;
4539}
4640
47- export function module ( input , seedTerms , output , method = " BOT" , outputFormat = " owl" ) {
41+ export function module ( input , seedTerms , output , method = ' BOT' , outputFormat = ' owl' ) {
4842 throwOnError (
4943 `robot extract -i ${ input } \
5044 --method ${ method } \
@@ -54,8 +48,8 @@ export function module(input, seedTerms, output, method = "BOT", outputFormat =
5448 ) ;
5549}
5650
57- export function filter ( input , anyTerms , annotationTerms = [ 'rdfs:label' ] , output , outputFormat = " owl" ) {
58- const termArguments = annotationTerms . map ( term => `--term ${ term } ` ) . join ( " " ) ;
51+ export function filter ( input , anyTerms , annotationTerms = [ 'rdfs:label' ] , output , outputFormat = ' owl' ) {
52+ const termArguments = annotationTerms . map ( ( term ) => `--term ${ term } ` ) . join ( ' ' ) ;
5953 throwOnError (
6054 `robot filter -i ${ input } \
6155 --include-terms ${ anyTerms } \
@@ -65,45 +59,36 @@ export function filter(input, anyTerms, annotationTerms = ['rdfs:label'], output
6559 ) ;
6660}
6761
68- export function merge ( inputs , output , outputFormat = " owl" ) {
62+ export function merge ( inputs , output , outputFormat = ' owl' ) {
6963 // Convert the inputs to OWL/XML format to avoid blank node collisions
7064 const owlInputs = [ ] ;
71- for ( const input of inputs ) {
72- const output = `${ input } .owl` ;
73- throwOnError (
74- `robot convert -i ${ input } --format owl -o ${ output } ` ,
75- 'Convert to OWL during merging failed.'
76- ) ;
77- owlInputs . push ( output ) ;
78- }
65+ inputs . forEach ( ( input , index ) => {
66+ const owlOutput = `${ output } .merge_${ index } .owl` ;
67+ throwOnError ( `robot convert -i ${ input } --format owl -o ${ owlOutput } ` , 'Convert to OWL during merging failed.' ) ;
68+ owlInputs . push ( owlOutput ) ;
69+ } ) ;
7970 // Merge the OWL input files
80- const inputParams = owlInputs . reduce (
81- ( collector , owlInput ) => ( `${ collector } --input ${ owlInput } ` ) , "" ) ;
71+ const inputParams = owlInputs . reduce ( ( collector , owlInput ) => `${ collector } --input ${ owlInput } ` , '' ) ;
8272 try {
8373 throwOnError (
8474 `robot merge ${ inputParams } \
8575 convert --format ${ outputFormat } -o ${ output } ` ,
8676 'Merge ontologies failed. See errors above.'
8777 ) ;
88- } finally { // Clean up the generated OWL inputs
78+ } finally {
79+ // Clean up the generated OWL inputs
8980 for ( const owlInput of owlInputs ) {
9081 sh . rm ( '-f' , owlInput ) ;
9182 }
9283 }
9384}
9485
9586export function convert ( input , output , outputFormat ) {
96- throwOnError (
97- `robot convert -i ${ input } --format ${ outputFormat } -o ${ output } ` ,
98- 'Data conversion failed.'
99- ) ;
87+ throwOnError ( `robot convert -i ${ input } --format ${ outputFormat } -o ${ output } ` , 'Data conversion failed.' ) ;
10088}
10189
10290export function remove ( input , output , subsetSelector ) {
103- throwOnError (
104- `robot remove --input ${ input } --select ${ subsetSelector } -o ${ output } ` ,
105- 'Data removal failed.'
106- ) ;
91+ throwOnError ( `robot remove --input ${ input } --select ${ subsetSelector } -o ${ output } ` , 'Data removal failed.' ) ;
10792}
10893
10994export function exclude ( input , exclude_file , output ) {
@@ -112,4 +97,3 @@ export function exclude(input, exclude_file, output) {
11297 'Data exclusion failed.'
11398 ) ;
11499}
115-
0 commit comments