File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
src/main/java/n10s/experimental/dimodel Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ public Map<String, Object> getNodeSchemasAsJsonObject(){
5252 props .forEach ( (k , v ) -> {
5353 Map <String , Object > prop = new HashMap <>();
5454 prop .put ("property" , k .getLocalName ());
55- prop .put ("type" , v !=null ?v . getLocalName ( ):"string" );
55+ prop .put ("type" , v !=null ?convertToDIDataType ( v ):"string" );
5656 prop .put ("identifier" , k .stringValue ());
5757 properties .add (prop );
5858 });
@@ -64,6 +64,22 @@ public Map<String, Object> getNodeSchemasAsJsonObject(){
6464 return map ;
6565 }
6666
67+ private String convertToDIDataType (IRI datatype ) {
68+ if (datatype .equals (XSD .INTEGER )||datatype .equals (XSD .INT )||datatype .equals (XSD .POSITIVE_INTEGER )||
69+ datatype .equals (XSD .NEGATIVE_INTEGER )||datatype .equals (XSD .NON_POSITIVE_INTEGER )||
70+ datatype .equals (XSD .NON_NEGATIVE_INTEGER )||datatype .equals (XSD .LONG )||datatype .equals (XSD .SHORT )||
71+ datatype .equals (XSD .UNSIGNED_LONG )||datatype .equals (XSD .UNSIGNED_SHORT )){
72+ return "integer" ;
73+ } else if (datatype .equals (XSD .DECIMAL )||datatype .equals (XSD .FLOAT )||datatype .equals (XSD .DOUBLE )) {
74+ return "float" ;
75+ } else if (datatype .equals (XSD .BOOLEAN )){
76+ return "boolean" ;
77+ } else {
78+ return "string" ;
79+ }
80+
81+ }
82+
6783 public Map <String , Object > getRelSchemasAsJsonObject (){
6884 Map <String , Object > map = new HashMap <>();
6985 rels .forEach ( (k ,v ) -> {
You can’t perform that action at this time.
0 commit comments