Skip to content

Commit

Permalink
[Feature #25] Change column's id, remove redundant code
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew-Kulich committed May 17, 2022
1 parent 685bb09 commit 106a5cc
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ ExecutionContext executeSelf() {
inputTableSchema = query.getSingleResult();
LOG.debug("Custom table schema found.");
}else if(tableSchemaCount > 1) {
LOG.error("More than one table schema found.");
LOG.warn("More than one table schema found. Ignoring schemas {}. ", query.getResultList());
}else {
LOG.debug("No custom table schema found.");
}
Expand All @@ -171,10 +171,7 @@ ExecutionContext executeSelf() {
"The number of columns in the table schema does not match the number of columns in the table." + "\n"
// .append(evidence).append("\n") TODO: rdf triples of evidence
;

if (ExecutionConfig.isExitOnError()) {
throw new TableSchemaException(mergedMsg, this);
}else LOG.error(mergedMsg);
logError(mergedMsg);
}

List<Column> schemaColumns = new ArrayList<>(header.length);
Expand All @@ -195,9 +192,7 @@ ExecutionContext executeSelf() {
// .append(evidence).append("\n") TODO: rdf triples of evidence
;

if (ExecutionConfig.isExitOnError()) {
throw new TableSchemaException(mergedMsg, this);
}else LOG.error(mergedMsg);
logError(mergedMsg);
}
}

Expand Down Expand Up @@ -604,4 +599,10 @@ private Column getColumnFromTableSchema(String columnTitle, TableSchema tableSch
}
return null;
}

private void logError(String msg) {
if (ExecutionConfig.isExitOnError()) {
throw new TableSchemaException(msg, this);
}else LOG.error(msg);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.ModelFactory;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

import java.io.*;
Expand Down Expand Up @@ -53,7 +52,6 @@ public void executeWithSimpleTransformation() throws URISyntaxException, IOExcep
assertTrue(outputContext.getDefaultModel().size() > 0);
}

@Disabled
@Test
public void executeWithDuplicateColumnsThrowsResourceNotUniqueException()
throws URISyntaxException, IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,42 @@
:input-data-schema a owl:Ontology .

:input-table-schema a csvw:TableSchema ;
csvw:column :bookingno_i ;
csvw:column :Employee_No ;
csvw:column :user_sign ;
csvw:column :Start_Date ;
csvw:column :Start_Time ;
csvw:column :End_Date ;
csvw:column :bookingno_i_column ;
csvw:column :Employee_No_column ;
csvw:column :user_sign_column ;
csvw:column :Start_Date_column ;
csvw:column :Start_Time_column ;
csvw:column :End_Date_column ;
.

:bookingno_i a csvw:Column;
:bookingno_i_column a csvw:Column;
csvw:name "bookingno_i" ;
csvw:property :bookingno_i ;
csvw:title "bookingno_i"
.
:Employee_No a csvw:Column;
:Employee_No_column a csvw:Column;
csvw:name "Employee_No" ;
csvw:property :Employee_No ;
csvw:title "Employee No"
.
:user_sign a csvw:Column;
:user_sign_column a csvw:Column;
csvw:name "user_sign" ;
csvw:property :user_sign ;
csvw:title "user_sign"
.
:Start_Date a csvw:Column;
:Start_Date_column a csvw:Column;
csvw:name "Start_Date" ;
csvw:property :Start_Date ;
csvw:title "Start Date"
.

:Start_Time a csvw:Column;
:Start_Time_column a csvw:Column;
csvw:name "Start_Time" ;
csvw:property :Start_Time ;
csvw:title "Start Time"
.

:End_Date a csvw:Column;
:End_Date_column a csvw:Column;
csvw:name "End_Date" ;
csvw:property :End_Date ;
csvw:title "End Date"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,42 @@
:input-data-schema a owl:Ontology .

:input-table-schema a csvw:TableSchema ;
csvw:column :bookingno_i ;
csvw:column :Employee_No ;
csvw:column :user_sign ;
csvw:column :Start_Date ;
csvw:column :Start_Time ;
csvw:column :End_Date ;
csvw:column :bookingno_i_column ;
csvw:column :Employee_No_column ;
csvw:column :user_sign_column ;
csvw:column :Start_Date_column ;
csvw:column :Start_Time_column ;
csvw:column :End_Date_column ;
.

:bookingno_i a csvw:Column;
:bookingno_i_column a csvw:Column;
csvw:name "bookingno_i" ;
csvw:property :bookingno_i ;
csvw:title "bookingno_i"
.
:Employee_No a csvw:Column;
:Employee_No_column a csvw:Column;
csvw:name "Employee_No" ;
csvw:property :Employee_No ;
csvw:title "Employee No"
.
:user_sign a csvw:Column;
:user_sign_column a csvw:Column;
csvw:name "user_sign" ;
csvw:property :user_sign ;
csvw:title "user_sign"
.
:Start_Date a csvw:Column;
:Start_Date_column a csvw:Column;
csvw:name "Start_Date" ;
csvw:property :Start_Date ;
csvw:title "Start Date"
.

:Start_Time a csvw:Column;
:Start_Time_column a csvw:Column;
csvw:name "Start_Time" ;
csvw:property :Start_Time ;
csvw:title "Start Time"
.

:End_Date a csvw:Column;
:End_Date_column a csvw:Column;
csvw:name "End_Date" ;
csvw:property :End_Date ;
csvw:title "End Date"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,42 @@
:input-data-schema a owl:Ontology .

:input-table-schema a csvw:TableSchema ;
csvw:column :bookingno_i ;
csvw:column :Employee_No ;
csvw:column :user_sign ;
csvw:column :Start_Date ;
csvw:column :Start_Time ;
csvw:column :End_Date ;
csvw:column :bookingno_i_column ;
csvw:column :Employee_No_column ;
csvw:column :user_sign_column ;
csvw:column :Start_Date_column ;
csvw:column :Start_Time_column ;
csvw:column :End_Date_column ;
.

:bookingno_i a csvw:Column;
:bookingno_i_column a csvw:Column;
csvw:name "bookingno_i" ;
csvw:property :bookingno_i ;
csvw:title "bookingno_i"
.
:Employee_No a csvw:Column;
:Employee_No_column a csvw:Column;
csvw:name "Employee_No" ;
csvw:property :Employee_No ;
csvw:title "Employee No"
.
:user_sign a csvw:Column;
:user_sign_column a csvw:Column;
csvw:name "user_sign" ;
csvw:property :user_sign ;
csvw:title "user_sign"
.
:Start_Date a csvw:Column;
:Start_Date_column a csvw:Column;
csvw:name "Start_Date" ;
csvw:property :Start_Date ;
csvw:title "Start Date"
.

:Start_Time a csvw:Column;
:Start_Time_column a csvw:Column;
csvw:name "Start_Time" ;
csvw:property :Start_Time ;
csvw:title "Start Time"
.

:End_Date a csvw:Column;
:End_Date_column a csvw:Column;
csvw:name "End_Date" ;
csvw:property :End_Date ;
csvw:title "End Date"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,42 @@
:input-data-schema a owl:Ontology .

:input-table-schema a csvw:TableSchema ;
csvw:column :bookingno_i ;
csvw:column :Employee_No ;
csvw:column :user_sign ;
csvw:column :Start_Date ;
csvw:column :Start_Time ;
csvw:column :Date ;
csvw:column :bookingno_i_column ;
csvw:column :Employee_No_column ;
csvw:column :user_sign_column ;
csvw:column :Start_Date_column ;
csvw:column :Start_Time_column ;
csvw:column :Date_column ;
.

:bookingno_i a csvw:Column;
:bookingno_i_column a csvw:Column;
csvw:name "bookingno_i" ;
csvw:property :bookingno_i ;
csvw:title "bookingno_i"
.
:Employee_No a csvw:Column;
:Employee_No_column a csvw:Column;
csvw:name "Employee_No" ;
csvw:property :Employee_No ;
csvw:title "Employee No"
.
:user_sign a csvw:Column;
:user_sign_column a csvw:Column;
csvw:name "user_sign" ;
csvw:property :user_sign ;
csvw:title "user_sign"
.
:Start_Date a csvw:Column;
:Start_Date_column a csvw:Column;
csvw:name "Start_Date" ;
csvw:property :Start_Date ;
csvw:title "Start Date"
.

:Start_Time a csvw:Column;
:Start_Time_column a csvw:Column;
csvw:name "Start_Time" ;
csvw:property :Start_Time ;
csvw:title "Start Time"
.

:Date a csvw:Column;
:Date_column a csvw:Column;
csvw:name "Date" ;
csvw:property :Date ;
csvw:title "Date"
Expand Down

0 comments on commit 106a5cc

Please sign in to comment.