From ee766bd6e197e5c04b475e028fe645a6334688d4 Mon Sep 17 00:00:00 2001 From: Adam Gustafson Date: Fri, 14 Jul 2023 19:27:47 -0600 Subject: [PATCH] Made sh:order a decimal (double) --- .../fr/sparna/rdf/shacl/diagram/PlantUmlBoxReader.java | 2 +- .../java/fr/sparna/rdf/shacl/diagram/PlantUmlDiagram.java | 6 +++--- .../rdf/shacl/diagram/PlantUmlDiagramGenerator.java | 2 +- .../sparna/rdf/shacl/diagram/PlantUmlDiagramOutput.java | 6 +++--- .../sparna/rdf/shacl/diagram/PlantUmlDiagramReader.java | 8 ++++---- .../fr/sparna/rdf/shacl/diagram/PlantUmlProperty.java | 6 +++--- .../sparna/rdf/shacl/diagram/PlantUmlPropertyReader.java | 4 ++-- .../java/fr/sparna/rdf/shacl/excel/ColumnsHeader.java | 4 ++-- .../rdf/shacl/excel/PropertyShapeTemplateReader.java | 4 ++-- .../rdf/shacl/excel/model/PropertyShapeTemplate.java | 6 +++--- .../fr/sparna/rdf/shacl/shacl2xsd/ShaclXsdBoxReader.java | 4 ++-- .../fr/sparna/rdf/shacl/shacl2xsd/ShaclXsdProperty.java | 6 +++--- .../rdf/shacl/shacl2xsd/ShaclXsdPropertyReader.java | 4 ++-- 13 files changed, 31 insertions(+), 31 deletions(-) diff --git a/shacl-diagram/src/main/java/fr/sparna/rdf/shacl/diagram/PlantUmlBoxReader.java b/shacl-diagram/src/main/java/fr/sparna/rdf/shacl/diagram/PlantUmlBoxReader.java index 15369cdb..1f0f32e1 100644 --- a/shacl-diagram/src/main/java/fr/sparna/rdf/shacl/diagram/PlantUmlBoxReader.java +++ b/shacl-diagram/src/main/java/fr/sparna/rdf/shacl/diagram/PlantUmlBoxReader.java @@ -80,7 +80,7 @@ public List readProperties(Resource nodeShape, List { if(ps1.getValue_order_shacl() != null) { if(ps2.getValue_order_shacl() != null) { - return ps1.getValue_order_shacl() - ps2.getValue_order_shacl(); + return (int) (ps1.getValue_order_shacl() - ps2.getValue_order_shacl()); } else { return -1; } diff --git a/shacl-diagram/src/main/java/fr/sparna/rdf/shacl/diagram/PlantUmlDiagram.java b/shacl-diagram/src/main/java/fr/sparna/rdf/shacl/diagram/PlantUmlDiagram.java index 669d5be3..01d470fc 100644 --- a/shacl-diagram/src/main/java/fr/sparna/rdf/shacl/diagram/PlantUmlDiagram.java +++ b/shacl-diagram/src/main/java/fr/sparna/rdf/shacl/diagram/PlantUmlDiagram.java @@ -10,7 +10,7 @@ public class PlantUmlDiagram { protected List boxes = new ArrayList<>(); protected String title; protected String description; - protected int orderDiagram; + protected double orderDiagram; public PlantUmlBox findBoxById(String id) { return this.boxes.stream().filter(b -> b.getLabel().equals(id)).findFirst().orElse(null); @@ -43,11 +43,11 @@ public void setDescription(String description) { this.description = description; } - public int getOrderDiagram() { + public double getOrderDiagram() { return orderDiagram; } - public void setOrderDiagram(Integer orderDiagram) { + public void setOrderDiagram(Double orderDiagram) { orderDiagram = orderDiagram; } } diff --git a/shacl-diagram/src/main/java/fr/sparna/rdf/shacl/diagram/PlantUmlDiagramGenerator.java b/shacl-diagram/src/main/java/fr/sparna/rdf/shacl/diagram/PlantUmlDiagramGenerator.java index 4e5cea14..321d5602 100644 --- a/shacl-diagram/src/main/java/fr/sparna/rdf/shacl/diagram/PlantUmlDiagramGenerator.java +++ b/shacl-diagram/src/main/java/fr/sparna/rdf/shacl/diagram/PlantUmlDiagramGenerator.java @@ -90,7 +90,7 @@ public List generateDiagrams(Model shaclGraph, Model owlG List codePlantUml = diagrams.stream().map(d -> new PlantUmlDiagramOutput(d, renderer)).sorted((o1,o2) -> { if(o1.getDiagramOrder() > 0) { if(o2.getDiagramOrder() > 0) { - return o1.getDiagramOrder() - o2.getDiagramOrder(); + return (int) (o1.getDiagramOrder() - o2.getDiagramOrder()); }else { return -1; } diff --git a/shacl-diagram/src/main/java/fr/sparna/rdf/shacl/diagram/PlantUmlDiagramOutput.java b/shacl-diagram/src/main/java/fr/sparna/rdf/shacl/diagram/PlantUmlDiagramOutput.java index 8ad09df7..85db7026 100644 --- a/shacl-diagram/src/main/java/fr/sparna/rdf/shacl/diagram/PlantUmlDiagramOutput.java +++ b/shacl-diagram/src/main/java/fr/sparna/rdf/shacl/diagram/PlantUmlDiagramOutput.java @@ -6,7 +6,7 @@ public class PlantUmlDiagramOutput { private String diagramUri; private String diagramTitle; private String diagramDescription; - private int diagramOrder; + private double diagramOrder; public PlantUmlDiagramOutput(PlantUmlDiagram d, PlantUmlRenderer renderer) { super(); @@ -77,11 +77,11 @@ public String getPlantUmlString() { return plantUmlString; } - public int getDiagramOrder() { + public double getDiagramOrder() { return diagramOrder; } - public void setDiagramOrder(int diagramOrder) { + public void setDiagramOrder(double diagramOrder) { this.diagramOrder = diagramOrder; } diff --git a/shacl-diagram/src/main/java/fr/sparna/rdf/shacl/diagram/PlantUmlDiagramReader.java b/shacl-diagram/src/main/java/fr/sparna/rdf/shacl/diagram/PlantUmlDiagramReader.java index 65519b21..a6b0557d 100644 --- a/shacl-diagram/src/main/java/fr/sparna/rdf/shacl/diagram/PlantUmlDiagramReader.java +++ b/shacl-diagram/src/main/java/fr/sparna/rdf/shacl/diagram/PlantUmlDiagramReader.java @@ -64,12 +64,12 @@ public String readDctDescription(Resource r, String lang) { return ConstraintValueReader.readLiteralInLangAsString(r, DCTerms.description, lang); } - public int readShOrder(Resource r) { + public double readShOrder(Resource r) { List values = ConstraintValueReader.readLiteralInLang(r, SH.order, null); - if(values != null && values.size() > 0) { - return values.get(0).asLiteral().getInt(); + if (values != null && values.size() > 0) { + return values.get(0).asLiteral().getDouble(); } else { - return -1; + return -1.0; } } diff --git a/shacl-diagram/src/main/java/fr/sparna/rdf/shacl/diagram/PlantUmlProperty.java b/shacl-diagram/src/main/java/fr/sparna/rdf/shacl/diagram/PlantUmlProperty.java index 85ea05fb..966f0f2f 100644 --- a/shacl-diagram/src/main/java/fr/sparna/rdf/shacl/diagram/PlantUmlProperty.java +++ b/shacl-diagram/src/main/java/fr/sparna/rdf/shacl/diagram/PlantUmlProperty.java @@ -20,7 +20,7 @@ public class PlantUmlProperty { protected PlantUmlBox value_node; // contains a shortForm of the sh:class protected String value_class_property; - protected Integer value_order_shacl; + protected Double value_order_shacl; protected String value_hasValue; protected PlantUmlBox value_qualifiedvalueshape; protected String value_qualifiedMaxMinCount; @@ -169,11 +169,11 @@ public void setValue_class_property(String value_class_property) { this.value_class_property = value_class_property; } - public Integer getValue_order_shacl() { + public Double getValue_order_shacl() { return value_order_shacl; } - public void setValue_order_shacl(Integer value_order_shacl) { + public void setValue_order_shacl(Double value_order_shacl) { this.value_order_shacl = value_order_shacl; } diff --git a/shacl-diagram/src/main/java/fr/sparna/rdf/shacl/diagram/PlantUmlPropertyReader.java b/shacl-diagram/src/main/java/fr/sparna/rdf/shacl/diagram/PlantUmlPropertyReader.java index 5e1950db..a75461c7 100644 --- a/shacl-diagram/src/main/java/fr/sparna/rdf/shacl/diagram/PlantUmlPropertyReader.java +++ b/shacl-diagram/src/main/java/fr/sparna/rdf/shacl/diagram/PlantUmlPropertyReader.java @@ -333,10 +333,10 @@ public String resolveShClassReference(Model model, Resource classUri) { } - public Integer readShOrder(Resource constraint) { + public Double readShOrder(Resource constraint) { String v = constraintValueReader.readValueconstraint(constraint, SH.order); - return (v != null)?Integer.parseInt(v):null; + return (v != null) ? Double.parseDouble(v) : null; } public String readShHasValue(Resource constraint) { diff --git a/shacl-excel/src/main/java/fr/sparna/rdf/shacl/excel/ColumnsHeader.java b/shacl-excel/src/main/java/fr/sparna/rdf/shacl/excel/ColumnsHeader.java index 7e2c69b4..e4126d43 100644 --- a/shacl-excel/src/main/java/fr/sparna/rdf/shacl/excel/ColumnsHeader.java +++ b/shacl-excel/src/main/java/fr/sparna/rdf/shacl/excel/ColumnsHeader.java @@ -21,10 +21,10 @@ public List build(List template, L tmpColumns.setSh_name("URI"); tmpColumns.setSh_description("URI of the class. This column can use prefixes declared above in the header"); tmpColumns.setSh_path("URI"); - tmpColumns.setSh_order(1); + tmpColumns.setSh_order(1.0); tmp.add(tmpColumns); - Integer nCount = 2; + Double nCount = 2.0; if (template.size() > 0) { template.sort(Comparator.comparing(PropertyShapeTemplate::getSh_order).thenComparing(PropertyShapeTemplate::getSh_name)); diff --git a/shacl-excel/src/main/java/fr/sparna/rdf/shacl/excel/PropertyShapeTemplateReader.java b/shacl-excel/src/main/java/fr/sparna/rdf/shacl/excel/PropertyShapeTemplateReader.java index 4c690f8f..9e5fd414 100644 --- a/shacl-excel/src/main/java/fr/sparna/rdf/shacl/excel/PropertyShapeTemplateReader.java +++ b/shacl-excel/src/main/java/fr/sparna/rdf/shacl/excel/PropertyShapeTemplateReader.java @@ -37,8 +37,8 @@ public String readShDescription(Resource constraint) { return constraintValueReader.readValueconstraint(constraint,SH.description); } - public Integer readShOrder(Resource constraint) { - return Integer.valueOf(constraintValueReader.readValueconstraint(constraint,SH.order)); + public Double readShOrder(Resource constraint) { + return Double.valueOf(constraintValueReader.readValueconstraint(constraint, SH.order)); } public String readShDatatype(Resource constraint) { diff --git a/shacl-excel/src/main/java/fr/sparna/rdf/shacl/excel/model/PropertyShapeTemplate.java b/shacl-excel/src/main/java/fr/sparna/rdf/shacl/excel/model/PropertyShapeTemplate.java index 41bba22f..c6853af8 100644 --- a/shacl-excel/src/main/java/fr/sparna/rdf/shacl/excel/model/PropertyShapeTemplate.java +++ b/shacl-excel/src/main/java/fr/sparna/rdf/shacl/excel/model/PropertyShapeTemplate.java @@ -5,7 +5,7 @@ public class PropertyShapeTemplate { protected String Sh_path; protected String Sh_description; protected String Sh_name; - protected Integer Sh_order; + protected Double Sh_order; protected String datatype; protected String Sh_UniqueLang; @@ -39,10 +39,10 @@ public String getSh_name() { public void setSh_name(String sh_name) { Sh_name = sh_name; } - public Integer getSh_order() { + public Double getSh_order() { return Sh_order; } - public void setSh_order(Integer sh_order) { + public void setSh_order(Double sh_order) { Sh_order = sh_order; } } diff --git a/shacl2xsd/src/main/java/fr/sparna/rdf/shacl/shacl2xsd/ShaclXsdBoxReader.java b/shacl2xsd/src/main/java/fr/sparna/rdf/shacl/shacl2xsd/ShaclXsdBoxReader.java index 7f65e197..1d5a41c9 100644 --- a/shacl2xsd/src/main/java/fr/sparna/rdf/shacl/shacl2xsd/ShaclXsdBoxReader.java +++ b/shacl2xsd/src/main/java/fr/sparna/rdf/shacl/shacl2xsd/ShaclXsdBoxReader.java @@ -72,11 +72,11 @@ public List readProperties(Resource nodeShape, List