66package application ;
77
88import core .*;
9+ import customWriter .CustomRDFFormat ;
910import gui .ComboBoxCell ;
1011import gui .GUIhelper ;
1112import gui .TableColumnsSetup ;
2425import javafx .scene .control .*;
2526import javafx .scene .control .cell .PropertyValueFactory ;
2627import javafx .scene .input .MouseEvent ;
28+ import javafx .scene .text .Font ;
2729import javafx .scene .text .Text ;
2830import javafx .stage .FileChooser ;
2931import javafx .stage .Modality ;
5961
6062public class MainController implements Initializable {
6163
64+ public TabPane tabPaneConstraintsDetails ;
65+ public Tab tabCreateCompleteSM1 ;
66+ public Tab tabCreateCompleteSM11 ;
67+ public Button btnRunExcelShape ;
68+ public Button btnResetExcelShape ;
69+ public Tab tabCreateCompleteSM2 ;
70+ public Button fbtnRunRDFConvert ;
71+ public Tab tabOutputWindow ;
72+ public Button btnResetIDComp ;
73+ public Font x3 ;
6274 @ FXML
6375 private TextArea foutputWindow ;
6476 @ FXML
@@ -68,8 +80,6 @@ public class MainController implements Initializable {
6880 @ FXML
6981 private TextField fPathRdffile2 ;
7082 @ FXML
71- private Button btnResetRDFComp ;
72- @ FXML
7383 private Button btnRunRDFcompare ;
7484 @ FXML
7585 private TabPane tabPaneDown ;
@@ -114,8 +124,6 @@ public class MainController implements Initializable {
114124 @ FXML
115125 private TextField fNSexcelShape ;
116126 @ FXML
117- private Button btnRunExcelShape ;
118- @ FXML
119127 private TextField fPathXLSfileForShape ;
120128 @ FXML
121129 private TextField fsourcePathTextField ;
@@ -124,8 +132,6 @@ public class MainController implements Initializable {
124132 @ FXML
125133 private ChoiceBox ftargetFormatChoiceBox ;
126134 @ FXML
127- private Button fbtnRunRDFConvert ;
128- @ FXML
129135 private TextField frdfConvertXmlBase ;
130136 @ FXML
131137 private CheckBox fcbShowXMLDeclaration ;
@@ -170,8 +176,6 @@ public class MainController implements Initializable {
170176 @ FXML
171177 private ChoiceBox fcbIDformat ;
172178 @ FXML
173- private Button btnResetIDComp ;
174- @ FXML
175179 private Button btnRunIDcompare ;
176180 @ FXML
177181 private TextField fPathIDfile1 ;
@@ -255,6 +259,8 @@ public class MainController implements Initializable {
255259
256260 public static TextArea foutputWindowVar ;
257261 public static boolean excludeMRID ;
262+ public static List <File > inputXLS ;
263+ public static List <File > rdfProfileFileList ;
258264
259265
260266 public MainController () {
@@ -1055,7 +1061,124 @@ private void actionBtnRunRDFcompare() throws FileNotFoundException {
10551061
10561062 }
10571063
1064+ @ FXML
1065+ // action on menu Generation of instance data based on xls template
1066+ private void actionMenuInstanceDataGenxls () throws IOException {
1067+
1068+ System .out .print ("Conversion in progress.\n " );
1069+ progressBar .setProgress (0 );
1070+ shaclNodataMap = 1 ; // as this mapping should not be used for this task
1071+ //select file
1072+ FileChooser filechooser = new FileChooser ();
1073+ filechooser .getExtensionFilters ().addAll (new FileChooser .ExtensionFilter ("Input template instance data XLS" , "*.xlsx" ));
1074+ filechooser .setInitialDirectory (new File (MainController .prefs .get ("LastWorkingFolder" ,"" )));
1075+ List <File > fileLxml ;
1076+ fileLxml = filechooser .showOpenMultipleDialog (null );
1077+
1078+
1079+ if (fileLxml != null ) {// the file is selected
1080+ MainController .prefs .put ("LastWorkingFolder" , fileLxml .get (0 ).getParent ());
1081+ MainController .inputXLS = fileLxml ;
10581082
1083+ //select file
1084+ FileChooser filechooser1 = new FileChooser ();
1085+ filechooser1 .getExtensionFilters ().addAll (new FileChooser .ExtensionFilter ("RDF profile file" , "*.rdf" , "*.ttl" ));
1086+ filechooser1 .setInitialDirectory (new File (MainController .prefs .get ("LastWorkingFolder" ,"" )));
1087+ List <File > fileL ;
1088+ fileL = filechooser1 .showOpenMultipleDialog (null );
1089+
1090+
1091+ if (fileL !=null ) {// the file is selected
1092+ MainController .prefs .put ("LastWorkingFolder" , fileL .get (0 ).getParent ());
1093+ MainController .rdfProfileFileList = fileL ;
1094+
1095+ //String xmlBase = "http://entsoe.eu/ns/nc";
1096+ //String xmlBase = "http://iec.ch/TC57/CIM100";
1097+ String xmlBase = "" ;
1098+
1099+ //set properties for the export
1100+ String formatGeneratedModel = "61970-552 CIM XML (.xml)" ; //fcbGenDataFormat.getSelectionModel().getSelectedItem().toString();
1101+ Map <String , Object > saveProperties = new HashMap <>();
1102+ if (formatGeneratedModel .equals ("61970-552 CIM XML (.xml)" )) {
1103+ saveProperties .put ("filename" , "test" );
1104+ saveProperties .put ("showXmlDeclaration" , "true" );
1105+ saveProperties .put ("showDoctypeDeclaration" , "false" );
1106+ saveProperties .put ("tab" , "2" );
1107+ saveProperties .put ("relativeURIs" , "same-document" );
1108+ saveProperties .put ("showXmlEncoding" , "true" );
1109+ saveProperties .put ("xmlBase" , xmlBase );
1110+ saveProperties .put ("rdfFormat" , CustomRDFFormat .RDFXML_CUSTOM_PLAIN_PRETTY );
1111+ saveProperties .put ("useAboutRules" , true ); //switch to trigger file chooser and adding the property
1112+ saveProperties .put ("useEnumRules" , true ); //switch to trigger special treatment when Enum is referenced
1113+ saveProperties .put ("useFileDialog" , true );
1114+ saveProperties .put ("fileFolder" , "C:" );
1115+ saveProperties .put ("dozip" , false );
1116+ saveProperties .put ("instanceData" , "true" ); //this is to only print the ID and not with namespace
1117+ saveProperties .put ("showXmlBaseDeclaration" , "false" );
1118+
1119+ saveProperties .put ("putHeaderOnTop" , true );
1120+ saveProperties .put ("headerClassResource" , "http://iec.ch/TC57/61970-552/ModelDescription/1#FullModel" );
1121+ saveProperties .put ("extensionName" , "RDF XML" );
1122+ saveProperties .put ("fileExtension" , "*.xml" );
1123+ saveProperties .put ("fileDialogTitle" , "Save RDF XML for" );
1124+ //RDFFormat rdfFormat=RDFFormat.RDFXML;
1125+ //RDFFormat rdfFormat=RDFFormat.RDFXML_PLAIN;
1126+ //RDFFormat rdfFormat = RDFFormat.RDFXML_ABBREV;
1127+ //RDFFormat rdfFormat = CustomRDFFormat.RDFXML_CUSTOM_PLAIN_PRETTY;
1128+ //RDFFormat rdfFormat = CustomRDFFormat.RDFXML_CUSTOM_PLAIN;
1129+
1130+ } else if (formatGeneratedModel .equals ("Custom RDF XML Plain (.xml)" )) {
1131+ saveProperties .put ("filename" , "test" );
1132+ saveProperties .put ("showXmlDeclaration" , "true" );
1133+ saveProperties .put ("showDoctypeDeclaration" , "false" );
1134+ saveProperties .put ("tab" , "2" );
1135+ saveProperties .put ("relativeURIs" , "same-document" );
1136+ saveProperties .put ("showXmlEncoding" , "true" );
1137+ saveProperties .put ("xmlBase" , xmlBase );
1138+ saveProperties .put ("rdfFormat" , CustomRDFFormat .RDFXML_CUSTOM_PLAIN );
1139+ saveProperties .put ("useAboutRules" , true ); //switch to trigger file chooser and adding the property
1140+ saveProperties .put ("useEnumRules" , true ); //switch to trigger special treatment when Enum is referenced
1141+ saveProperties .put ("useFileDialog" , true );
1142+ saveProperties .put ("fileFolder" , "C:" );
1143+ saveProperties .put ("dozip" , false );
1144+ saveProperties .put ("instanceData" , "true" ); //this is to only print the ID and not with namespace
1145+ saveProperties .put ("showXmlBaseDeclaration" , "false" );
1146+
1147+ saveProperties .put ("putHeaderOnTop" , true );
1148+ saveProperties .put ("headerClassResource" , "http://iec.ch/TC57/61970-552/ModelDescription/1#FullModel" );
1149+ saveProperties .put ("extensionName" , "RDF XML" );
1150+ saveProperties .put ("fileExtension" , "*.xml" );
1151+ saveProperties .put ("fileDialogTitle" , "Save RDF XML for" );
1152+ }
1153+
1154+
1155+
1156+ boolean profileModelUnionFlag = false ;
1157+ boolean instanceModelUnionFlag = false ;
1158+ boolean shaclModelUnionFlag = false ;
1159+ String eqbdID = null ;
1160+ String tpbdID = null ;
1161+ boolean persistentEQflag = false ;
1162+
1163+
1164+ Map <String , Boolean > inputData = new HashMap <>();
1165+ inputData .put ("rdfs" , true );
1166+ inputData .put ("baseModel" , false );
1167+ inputData .put ("shacl" , false );
1168+
1169+ progressBar .setProgress (ProgressIndicator .INDETERMINATE_PROGRESS );
1170+
1171+ ModelManipulationFactory .generateDataFromXls (xmlBase , profileModelUnionFlag , instanceModelUnionFlag , inputData , shaclModelUnionFlag ,eqbdID ,tpbdID ,saveProperties ,persistentEQflag );
1172+
1173+ progressBar .setProgress (1 );
1174+ System .out .print ("Conversion finished.\n " );
1175+ }else {
1176+ System .out .print ("Conversion terminated.\n " );
1177+ }
1178+ }else {
1179+ System .out .print ("Conversion terminated.\n " );
1180+ }
1181+ }
10591182
10601183 @ FXML
10611184 //This is the menu item "Create datatypes map" - loads RDFfile(s) and creates the map
@@ -2604,7 +2727,7 @@ private void actionBtnRunExcelShape(ActionEvent actionEvent) throws IOException
26042727
26052728 //if (file != null) {// the file is selected
26062729
2607- dataExcel = ExcelTools .importXLSX (String .valueOf (MainController .xlsFileExcelShacl ));
2730+ dataExcel = ExcelTools .importXLSX (String .valueOf (MainController .xlsFileExcelShacl ), 0 );
26082731 //System.out.println(dataExcel);
26092732 // }
26102733 //TODO: this can be made with many additional options e.g. what to be added and in which model to be added. Now it is primitive to solve a simple task
0 commit comments