diff --git a/src/main/java/n10s/experimental/dimodel/DIMNodeDef.java b/src/main/java/n10s/experimental/dimodel/DIMNodeDef.java index f3dd150a..e9054f32 100644 --- a/src/main/java/n10s/experimental/dimodel/DIMNodeDef.java +++ b/src/main/java/n10s/experimental/dimodel/DIMNodeDef.java @@ -52,7 +52,7 @@ public Map getNodeSchemasAsJsonObject(){ props.forEach( (k, v) -> { Map prop = new HashMap<>(); prop.put("property", k.getLocalName()); - prop.put("type", v!=null?v.getLocalName():"string"); + prop.put("type", v!=null?convertToDIDataType(v):"string"); prop.put("identifier", k.stringValue()); properties.add(prop); }); @@ -64,6 +64,22 @@ public Map getNodeSchemasAsJsonObject(){ return map; } + private String convertToDIDataType(IRI datatype) { + if (datatype.equals(XSD.INTEGER)||datatype.equals(XSD.INT)||datatype.equals(XSD.POSITIVE_INTEGER)|| + datatype.equals(XSD.NEGATIVE_INTEGER)||datatype.equals(XSD.NON_POSITIVE_INTEGER)|| + datatype.equals(XSD.NON_NEGATIVE_INTEGER)||datatype.equals(XSD.LONG)||datatype.equals(XSD.SHORT)|| + datatype.equals(XSD.UNSIGNED_LONG)||datatype.equals(XSD.UNSIGNED_SHORT)){ + return "integer"; + } else if (datatype.equals(XSD.DECIMAL)||datatype.equals(XSD.FLOAT)||datatype.equals(XSD.DOUBLE)) { + return "float"; + } else if (datatype.equals(XSD.BOOLEAN)){ + return "boolean"; + } else { + return "string"; + } + + } + public Map getRelSchemasAsJsonObject(){ Map map = new HashMap<>(); rels.forEach( (k,v) -> {