Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made sh:order a decimal (double) #102

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public List<PlantUmlProperty> readProperties(Resource nodeShape, List<PlantUmlBo
properties.sort((PlantUmlProperty ps1, PlantUmlProperty ps2) -> {
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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class PlantUmlDiagram {
protected List<PlantUmlBox> 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);
Expand Down Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public List<PlantUmlDiagramOutput> generateDiagrams(Model shaclGraph, Model owlG
List<PlantUmlDiagramOutput> 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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Literal> 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;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ public List<PropertyShapeTemplate> build(List<PropertyShapeTemplate> 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));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ public List<ShaclXsdProperty> readProperties(Resource nodeShape, List<ShaclXsdBo
if(ps2.getValue_order_shacl() != null) {
return ps1.getValue_order_shacl() - ps2.getValue_order_shacl();
} else {
return -1;
return -1.0;
}
} else {
if(ps2.getValue_order_shacl() != null) {
return 1;
return 1.0;
} else {
// both sh:order are null, try with sh:path
if(ps1.getValue_path() != null && ps2.getValue_path() != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class ShaclXsdProperty {
protected String value_uniquelang;
protected ShaclXsdBox value_node;
protected String value_class_property;
protected Integer value_order_shacl;
protected Double value_order_shacl;
protected String value_hasValue;
protected ShaclXsdBox value_qualifiedvalueshape;
protected String value_qualifiedMaxMinCount;
Expand Down Expand Up @@ -165,11 +165,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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,10 +286,10 @@ public String readShClass(Resource constraint) {
}


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) {
Expand Down