Skip to content

Commit eb06bff

Browse files
author
Chavdar Ivanov
committed
v1.0.0, public release
1 parent fa2bce4 commit eb06bff

9 files changed

Lines changed: 403 additions & 120 deletions

File tree

10.6 KB
Binary file not shown.

src/main/java/application/MainController.java

Lines changed: 156 additions & 108 deletions
Large diffs are not rendered by default.

src/main/java/application/PreferencesController.java

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,19 @@ public class PreferencesController implements Initializable {
2626
private TextField frdfnamespace;
2727
@FXML
2828
private Button btnCancel;
29+
@FXML
30+
private TextField fIOprefix;
31+
@FXML
32+
private TextField fIOuri;
33+
@FXML
34+
private TextField fprefixEU;
35+
@FXML
36+
private TextField fprefixOther;
37+
@FXML
38+
private TextField furiEU;
39+
@FXML
40+
private TextField furiOther;
41+
2942
public static Stage guiPrefStage;
3043

3144

@@ -48,6 +61,13 @@ private void actionBtnOK(ActionEvent actionEvent) {
4861
MainController.prefs.put("CIMnamespace", fCIMnamespace.getText());
4962
MainController.prefs.put("rdfNamespace", frdfnamespace.getText());
5063
MainController.prefs.put("cimsNamespace", fcimsnamespace.getText());
64+
MainController.prefs.put("IOprefix", fIOprefix.getText());
65+
MainController.prefs.put("IOuri", fIOuri.getText());
66+
67+
MainController.prefs.put("prefixEU", fprefixEU.getText());
68+
MainController.prefs.put("uriEU", furiEU.getText());
69+
MainController.prefs.put("prefixOther", fprefixOther.getText());
70+
MainController.prefs.put("uriOther", furiOther.getText());
5171

5272
//close the gui
5373
guiPrefStage.close();
@@ -77,6 +97,14 @@ public static void prefDefault(){
7797
MainController.prefs.put("CIMnamespace", "http://iec.ch/TC57/CIM100#");
7898
MainController.prefs.put("rdfNamespace", "http://www.w3.org/1999/02/22-rdf-syntax-ns#");
7999
MainController.prefs.put("cimsNamespace", "http://iec.ch/TC57/1999/rdf-schema-extensions-19990926#");
100+
MainController.prefs.put("IOprefix", "ido");
101+
MainController.prefs.put("IOuri", "http://iec.ch/TC57/ns/CIM/IdentifiedObject/constraints/3.0#");
102+
103+
MainController.prefs.put("prefixEU", "eu");
104+
MainController.prefs.put("uriEU", "http://iec.ch/TC57/CIM100-European#");
105+
MainController.prefs.put("prefixOther", "");
106+
MainController.prefs.put("uriOther", "");
107+
80108
}
81109

82110

@@ -86,5 +114,12 @@ private void prefToGui(){
86114
fCIMnamespace.setText(MainController.prefs.get("CIMnamespace",""));
87115
fcimsnamespace.setText(MainController.prefs.get("cimsNamespace",""));
88116
frdfnamespace.setText(MainController.prefs.get("rdfNamespace",""));
117+
fIOprefix.setText(MainController.prefs.get("IOprefix",""));
118+
fIOuri.setText(MainController.prefs.get("IOuri",""));
119+
120+
fprefixEU.setText(MainController.prefs.get("prefixEU",""));
121+
furiEU.setText(MainController.prefs.get("uriEU",""));
122+
fprefixOther.setText(MainController.prefs.get("prefixOther",""));
123+
furiOther.setText(MainController.prefs.get("uriOther",""));
89124
}
90125
}

src/main/java/core/ShaclTools.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ public static Model addPropertyNode(Model shapeModel, Resource nodeShapeResource
533533
//just linked with the nodeshape
534534
String nsURIprofileID="";
535535
if (localName.contains("IdentifiedObject")){
536-
nsURIprofileID="http://iec.ch/TC57/ns/CIM/IdentifiedObject/constraints/3.0#";
536+
nsURIprofileID=MainController.prefs.get("IOuri","");
537537
} else {
538538
nsURIprofileID=nsURIprofile;
539539
}
@@ -794,7 +794,7 @@ public static Model addPropertyNodeCardinality(Model shapeModel, Resource nodeSh
794794
*/
795795
//The if here is to ensure that all property shapes for IdentifiedObjects are in one namespace
796796
if (localName.contains("IdentifiedObject")){
797-
nsURIprofile="http://iec.ch/TC57/ns/CIM/IdentifiedObject/constraints/3.0#";
797+
nsURIprofile=MainController.prefs.get("IOuri","");
798798
}
799799

800800
//the if is checking if the property shape is existing, if it is existing a new one is not added, but it is
@@ -936,8 +936,9 @@ public static Model addPropertyGroup(Model shapeModel, String nsURIprofile, Stri
936936
//open the ChoiceDialog for the save file and save the file in different formats
937937
public static File saveShapesFile(Model shapeModel, String baseURI, int dirOnly, String title) throws IOException {
938938
File savedFile = null;
939-
String[] choiceDialogItems = {"TURTLE", "RDFXML", "RDFXML_PLAIN", "RDFXML_ABBREV" ,"NTRIPLES",
940-
"JSONLD", "N3", "RDFJSON"};
939+
//String[] choiceDialogItems = {"TURTLE", "RDFXML", "RDFXML_PLAIN", "RDFXML_ABBREV" ,"NTRIPLES",
940+
// "JSONLD", "N3", "RDFJSON"};
941+
String[] choiceDialogItems = {"TURTLE", "RDFXML"};
941942
ChoiceDialog choiceDialog = new ChoiceDialog("TURTLE", Arrays.asList(choiceDialogItems));//Alert(Alert.AlertType.ERROR);
942943
choiceDialog.setContentText("Please select the type of the file.");
943944
choiceDialog.setHeaderText("Do you want to save the SHACL model as file?");
@@ -995,7 +996,7 @@ public static File fileSave(Model model, String extensionText, String extension,
995996

996997
if (rdfFormat.getLang().getLabel().toUpperCase().equals("RDF/XML")) {
997998
//Update - test the writer
998-
baseURI = "http://iec.ch/TC57/61970-600/CoreEquipment-European/3/0/cgmes/shapes";
999+
//baseURI = "http://iec.ch/TC57/61970-600/CoreEquipment-European/3/0/cgmes/shapes";
9991000

10001001
Map<String, Object> properties = new HashMap<>();
10011002
properties.put("showXmlDeclaration", "true");
@@ -1114,7 +1115,8 @@ public static Model createShapesModelFromProfile(Model model, String nsPrefixpro
11141115
//add the additional two namespaces
11151116
shapeModel.setNsPrefix("sh", SH.NS);
11161117
shapeModel.setNsPrefix("dash", DASH.NS);
1117-
shapeModel.setNsPrefix("ido","http://iec.ch/TC57/ns/CIM/IdentifiedObject/constraints/3.0#"); // the uri for the identified object related shapes
1118+
1119+
shapeModel.setNsPrefix(MainController.prefs.get("IOprefix",""),MainController.prefs.get("IOuri","")); // the uri for the identified object related shapes
11181120

11191121
//adding the the two PropertyGroup-s
11201122
String localNameGroup = "CardinalityGroup";

src/main/java/gui/GUIhelper.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,9 @@ public static Dialog<HashMap<String, String>> choiceDialog2Choices(String title,
142142

143143
return dialog;
144144
}
145+
146+
147+
145148
public static Pair<Integer,Model> getShapeModel(String shapeModelName){
146149
Model shapeModel = null;
147150
int index=0;

0 commit comments

Comments
 (0)