From cc9b8390aaacab15fd4cf8d6fa46ba167b16c57b Mon Sep 17 00:00:00 2001 From: Enrico Daga Date: Wed, 23 Mar 2022 17:48:43 +0000 Subject: [PATCH] Test Object -- #202 #233 --- .../json/test/MoreJSONTriplifierTest.java | 25 ++++++++++++++++--- .../src/test/resources/Object.json | 1 + .../src/test/resources/Object.ttl | 7 ++++++ 3 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 sparql-anything-json/src/test/resources/Object.json create mode 100644 sparql-anything-json/src/test/resources/Object.ttl diff --git a/sparql-anything-json/src/test/java/com/github/sparqlanything/json/test/MoreJSONTriplifierTest.java b/sparql-anything-json/src/test/java/com/github/sparqlanything/json/test/MoreJSONTriplifierTest.java index 55db0f3c..8014db6a 100644 --- a/sparql-anything-json/src/test/java/com/github/sparqlanything/json/test/MoreJSONTriplifierTest.java +++ b/sparql-anything-json/src/test/java/com/github/sparqlanything/json/test/MoreJSONTriplifierTest.java @@ -34,6 +34,8 @@ public MoreJSONTriplifierTest() { } @Override protected void properties(Properties properties) { + + // SliceArray if(name.getMethodName().equals("testSliceArray$1")){ properties.setProperty("blank-nodes", "false"); // properties.setProperty("slice", "true"); @@ -48,17 +50,21 @@ protected void properties(Properties properties) { properties.setProperty("blank-nodes", "false"); // properties.setProperty("slice", "true"); properties.setProperty("json.path", "$.*"); - }else if(name.getMethodName().equals("testSliceArray_2$1")){ + } + // SliceArray_2 + if(name.getMethodName().equals("testSliceArray_2$1")){ properties.setProperty("blank-nodes", "false"); // properties.setProperty("slice", "true"); }else if(name.getMethodName().equals("testSliceArray_2$2")){ properties.setProperty("blank-nodes", "false"); properties.setProperty("slice", "true"); - }else if(name.getMethodName().equals("testSliceArray_2$3")){ + } else if(name.getMethodName().equals("testSliceArray_2$3")){ properties.setProperty("blank-nodes", "false"); properties.setProperty("slice", "true"); properties.setProperty("json.path", "$.*"); - }else if(name.getMethodName().equals("testValueTypes_1$1")){ + } + // ValueTypes + if(name.getMethodName().equals("testValueTypes_1$1")){ properties.setProperty("blank-nodes", "false"); //properties.setProperty("slice", "true"); }else if(name.getMethodName().equals("testValueTypes_1$2")){ @@ -69,6 +75,11 @@ protected void properties(Properties properties) { properties.setProperty("slice", "true"); properties.setProperty("json.path", "$.*"); } + // Object + if(name.getMethodName().equals("testObject$1")){ + properties.setProperty("blank-nodes", "false"); +// properties.setProperty("slice", "true"); + } } @Test @@ -148,4 +159,12 @@ protected void properties(Properties properties) { //RDFDataMgr.write(System.err, result, Lang.N3); assertResultIsIsomorphicWithExpected(); } + + @Test + public void testObject$1(){ + L.info("Test simple Json object (one go)"); + //RDFDataMgr.write(System.err, result, Lang.N3); + assertResultIsIsomorphicWithExpected(); + } + } diff --git a/sparql-anything-json/src/test/resources/Object.json b/sparql-anything-json/src/test/resources/Object.json new file mode 100644 index 00000000..cef361bc --- /dev/null +++ b/sparql-anything-json/src/test/resources/Object.json @@ -0,0 +1 @@ +{"letter" : "A", "number": 1, "boolean": true} \ No newline at end of file diff --git a/sparql-anything-json/src/test/resources/Object.ttl b/sparql-anything-json/src/test/resources/Object.ttl new file mode 100644 index 00000000..c90573cd --- /dev/null +++ b/sparql-anything-json/src/test/resources/Object.ttl @@ -0,0 +1,7 @@ +@prefix rdf: . +@prefix rdfs: . +@prefix fx: . +@prefix xyz: . +@prefix xsd: . + + a fx:root ; xyz:letter "A" ; xyz:number "1"^^xsd:int ; ; xyz:boolean true . \ No newline at end of file