Add complex property generator compaction test
authorMarkus Lanthaler <mark_lanthaler@gmx.net>
Mon, 10 Dec 2012 19:37:33 +0100
changeset 1017 4c7cf7a89e50
parent 1016 29372731bd72
child 1018 7d551722c894
Add complex property generator compaction test

This addresses #142 and #160.
test-suite/tests/compact-0032-context.jsonld
test-suite/tests/compact-0032-in.jsonld
test-suite/tests/compact-0032-out.jsonld
test-suite/tests/compact-manifest.jsonld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/compact-0032-context.jsonld	Mon Dec 10 19:37:33 2012 +0100
@@ -0,0 +1,17 @@
+{
+  "@context": {
+    "vocab": "http://example.com/vocab/",
+    "sharedTerm": "http://www.example.org/shared/term",
+    "@language": "de",
+    "propGenA": {
+      "@id": [ "vocab:propGenA", "sharedTerm" ]
+    },
+    "propGenB": {
+      "@id": [ "sharedTerm", "vocab:propGenB", "http://example.com/somethingElse" ],
+      "@container": "@list"
+    },
+    "propGenC": {
+      "@id": [ "sharedTerm", "vocab:propGenB", "http://example.com/somethingElse" ]
+    }
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/compact-0032-in.jsonld	Mon Dec 10 19:37:33 2012 +0100
@@ -0,0 +1,748 @@
+[
+  {
+    "@id": "http://ex.com/root",
+    "http://example.com/vocab/propGenA": [
+      {
+        "@value": "propGenA.coll.1",
+        "@language": "de"
+      },
+      {
+        "http://example.com/vocab/term": [
+          {
+            "@value": "collission",
+            "@language": "de"
+          }
+        ]
+      },
+      {
+        "@id": "http://ex.com/propA.1"
+      },
+      {
+        "http://example.com/vocab/term": [
+          {
+            "@value": "http://ex.com/propA.2",
+            "@language": "de"
+          }
+        ],
+        "@id": "_:t0"
+      },
+      {
+        "@value": "propA.3",
+        "@language": "de"
+      },
+      {
+        "@id": "http://ex.com/propA.4"
+      },
+      {
+        "http://example.com/vocab/nested": [
+          {
+            "http://example.com/vocab/nested": [
+              {
+                "@value": 10510
+              },
+              {
+                "@value": "propA.5.1.1",
+                "@language": "de"
+              },
+              {
+                "@id": "http://ex.com/propA.5.1.2"
+              },
+              {
+                "http://example.com/vocab/term": [
+                  {
+                    "@value": "http://ex.com/propA.5.1.3",
+                    "@language": "de"
+                  }
+                ],
+                "@id": "_:t3"
+              }
+            ],
+            "http://example.com/vocab/term": [
+              {
+                "@value": "http://ex.com/propA.5.1",
+                "@language": "de"
+              }
+            ],
+            "@id": "_:t2"
+          },
+          {
+            "@id": "http://ex.com/propA.5.2",
+            "http://example.com/vocab/nested": [
+              {
+                "@value": "propA.5.2.1",
+                "@language": "de"
+              },
+              {
+                "http://example.com/vocab/term": [
+                  {
+                    "@value": "http://ex.com/propA.5.2.2",
+                    "@language": "de"
+                  }
+                ],
+                "@id": "_:t4"
+              },
+              {
+                "@id": "http://ex.com/propA.5.2.3"
+              },
+              {
+                "@value": 10524
+              }
+            ]
+          }
+        ],
+        "http://example.com/vocab/term": [
+          {
+            "@value": "http://ex.com/propA.5",
+            "@language": "de"
+          }
+        ],
+        "@id": "_:t1"
+      },
+      {
+        "@value": 10600
+      },
+      {
+        "http://example.com/vocab/term": [
+          {
+            "@value": "collission",
+            "@language": "de"
+          }
+        ],
+        "@id": "_:t5"
+      }
+    ],
+    "http://example.com/vocab/propGenB": [
+      {
+        "@value": "propGenB.coll.1",
+        "@language": "de"
+      },
+      {
+        "http://example.com/vocab/term": [
+          {
+            "@value": "collission",
+            "@language": "de"
+          }
+        ]
+      },
+      {
+        "@list": [
+          {
+            "@value": 20000,
+            "@type": "http://datatype.example.org/type"
+          },
+          {
+            "@value": "propB.1",
+            "@type": "http://datatype.example.org/type"
+          },
+          {
+            "http://example.com/vocab/term": [
+              {
+                "@value": "collission",
+                "@language": "de"
+              }
+            ],
+            "@id": "_:t6"
+          },
+          {
+            "@id": "http://ex.com/propB.2",
+            "http://example.com/vocab/nested": [
+              {
+                "http://example.com/vocab/nested": [
+                  {
+                    "@value": 20110
+                  },
+                  {
+                    "@value": "propB.2.1.1",
+                    "@language": "de"
+                  },
+                  {
+                    "@id": "http://ex.com/propB.2.1.2"
+                  },
+                  {
+                    "http://example.com/vocab/term": [
+                      {
+                        "@value": "http://ex.com/propB.2.1.3",
+                        "@language": "de"
+                      }
+                    ],
+                    "@id": "_:t8"
+                  }
+                ],
+                "http://example.com/vocab/term": [
+                  {
+                    "@value": "http://ex.com/propB.2.1",
+                    "@language": "de"
+                  }
+                ],
+                "@id": "_:t7"
+              },
+              {
+                "@id": "http://ex.com/propB.2.2",
+                "http://example.com/vocab/nested": [
+                  {
+                    "@value": "propB.2.2.1",
+                    "@language": "de"
+                  },
+                  {
+                    "http://example.com/vocab/term": [
+                      {
+                        "@value": "http://ex.com/propB.2.2.2",
+                        "@language": "de"
+                      }
+                    ],
+                    "@id": "_:t9"
+                  },
+                  {
+                    "@id": "http://ex.com/propB.2.2.3"
+                  },
+                  {
+                    "@value": 20224
+                  }
+                ]
+              }
+            ]
+          },
+          {
+            "http://example.com/vocab/term": [
+              {
+                "@value": "http://ex.com/propB.3",
+                "@language": "de"
+              }
+            ],
+            "@id": "_:t10"
+          }
+        ]
+      },
+      {
+        "http://example.com/vocab/term": [
+          {
+            "@value": "collission",
+            "@language": "de"
+          }
+        ],
+        "@id": "_:t11"
+      },
+      {
+        "@value": "propC.2",
+        "@language": "en"
+      },
+      {
+        "@value": 30300
+      },
+      {
+        "@id": "http://ex.com/propC.4"
+      },
+      {
+        "http://example.com/vocab/nested": [
+          {
+            "http://example.com/vocab/nested": [
+              {
+                "@value": 10510
+              },
+              {
+                "@value": "propC.5.1.1",
+                "@language": "de"
+              },
+              {
+                "@id": "http://ex.com/propC.5.1.2"
+              },
+              {
+                "http://example.com/vocab/term": [
+                  {
+                    "@value": "http://ex.com/propC.5.1.3",
+                    "@language": "de"
+                  }
+                ],
+                "@id": "_:t14"
+              }
+            ],
+            "http://example.com/vocab/term": [
+              {
+                "@value": "http://ex.com/propC.5.1",
+                "@language": "de"
+              }
+            ],
+            "@id": "_:t13"
+          },
+          {
+            "@id": "http://ex.com/propC.5.2",
+            "http://example.com/vocab/nested": [
+              {
+                "@value": "propC.5.2.1",
+                "@language": "de"
+              },
+              {
+                "http://example.com/vocab/term": [
+                  {
+                    "@value": "http://ex.com/propC.5.2.2",
+                    "@language": "de"
+                  }
+                ],
+                "@id": "_:t15"
+              },
+              {
+                "@id": "http://ex.com/propC.5.2.3"
+              },
+              {
+                "@value": 10524
+              }
+            ]
+          }
+        ],
+        "http://example.com/vocab/term": [
+          {
+            "@value": "http://ex.com/propC.5",
+            "@language": "de"
+          }
+        ],
+        "@id": "_:t12"
+      }
+    ],
+    "http://www.example.org/shared/term": [
+      {
+        "@id": "http://ex.com/propA.1"
+      },
+      {
+        "http://example.com/vocab/term": [
+          {
+            "@value": "http://ex.com/propA.2",
+            "@language": "de"
+          }
+        ],
+        "@id": "_:t0"
+      },
+      {
+        "@value": "propA.3",
+        "@language": "de"
+      },
+      {
+        "@id": "http://ex.com/propA.4"
+      },
+      {
+        "http://example.com/vocab/nested": [
+          {
+            "http://example.com/vocab/nested": [
+              {
+                "@value": 10510
+              },
+              {
+                "@value": "propA.5.1.1",
+                "@language": "de"
+              },
+              {
+                "@id": "http://ex.com/propA.5.1.2"
+              },
+              {
+                "http://example.com/vocab/term": [
+                  {
+                    "@value": "http://ex.com/propA.5.1.3",
+                    "@language": "de"
+                  }
+                ],
+                "@id": "_:t3"
+              }
+            ],
+            "http://example.com/vocab/term": [
+              {
+                "@value": "http://ex.com/propA.5.1",
+                "@language": "de"
+              }
+            ],
+            "@id": "_:t2"
+          },
+          {
+            "@id": "http://ex.com/propA.5.2",
+            "http://example.com/vocab/nested": [
+              {
+                "@value": "propA.5.2.1",
+                "@language": "de"
+              },
+              {
+                "http://example.com/vocab/term": [
+                  {
+                    "@value": "http://ex.com/propA.5.2.2",
+                    "@language": "de"
+                  }
+                ],
+                "@id": "_:t4"
+              },
+              {
+                "@id": "http://ex.com/propA.5.2.3"
+              },
+              {
+                "@value": 10524
+              }
+            ]
+          }
+        ],
+        "http://example.com/vocab/term": [
+          {
+            "@value": "http://ex.com/propA.5",
+            "@language": "de"
+          }
+        ],
+        "@id": "_:t1"
+      },
+      {
+        "@value": 10600
+      },
+      {
+        "http://example.com/vocab/term": [
+          {
+            "@value": "collission",
+            "@language": "de"
+          }
+        ],
+        "@id": "_:t5"
+      },
+      {
+        "@list": [
+          {
+            "@value": 20000,
+            "@type": "http://datatype.example.org/type"
+          },
+          {
+            "@value": "propB.1",
+            "@type": "http://datatype.example.org/type"
+          },
+          {
+            "http://example.com/vocab/term": [
+              {
+                "@value": "collission",
+                "@language": "de"
+              }
+            ],
+            "@id": "_:t6"
+          },
+          {
+            "@id": "http://ex.com/propB.2",
+            "http://example.com/vocab/nested": [
+              {
+                "http://example.com/vocab/nested": [
+                  {
+                    "@value": 20110
+                  },
+                  {
+                    "@value": "propB.2.1.1",
+                    "@language": "de"
+                  },
+                  {
+                    "@id": "http://ex.com/propB.2.1.2"
+                  },
+                  {
+                    "http://example.com/vocab/term": [
+                      {
+                        "@value": "http://ex.com/propB.2.1.3",
+                        "@language": "de"
+                      }
+                    ],
+                    "@id": "_:t8"
+                  }
+                ],
+                "http://example.com/vocab/term": [
+                  {
+                    "@value": "http://ex.com/propB.2.1",
+                    "@language": "de"
+                  }
+                ],
+                "@id": "_:t7"
+              },
+              {
+                "@id": "http://ex.com/propB.2.2",
+                "http://example.com/vocab/nested": [
+                  {
+                    "@value": "propB.2.2.1",
+                    "@language": "de"
+                  },
+                  {
+                    "http://example.com/vocab/term": [
+                      {
+                        "@value": "http://ex.com/propB.2.2.2",
+                        "@language": "de"
+                      }
+                    ],
+                    "@id": "_:t9"
+                  },
+                  {
+                    "@id": "http://ex.com/propB.2.2.3"
+                  },
+                  {
+                    "@value": 20224
+                  }
+                ]
+              }
+            ]
+          },
+          {
+            "http://example.com/vocab/term": [
+              {
+                "@value": "http://ex.com/propB.3",
+                "@language": "de"
+              }
+            ],
+            "@id": "_:t10"
+          }
+        ]
+      },
+      {
+        "http://example.com/vocab/term": [
+          {
+            "@value": "collission",
+            "@language": "de"
+          }
+        ],
+        "@id": "_:t11"
+      },
+      {
+        "@value": "propC.2",
+        "@language": "en"
+      },
+      {
+        "@value": 30300
+      },
+      {
+        "@id": "http://ex.com/propC.4"
+      },
+      {
+        "http://example.com/vocab/nested": [
+          {
+            "http://example.com/vocab/nested": [
+              {
+                "@value": 10510
+              },
+              {
+                "@value": "propC.5.1.1",
+                "@language": "de"
+              },
+              {
+                "@id": "http://ex.com/propC.5.1.2"
+              },
+              {
+                "http://example.com/vocab/term": [
+                  {
+                    "@value": "http://ex.com/propC.5.1.3",
+                    "@language": "de"
+                  }
+                ],
+                "@id": "_:t14"
+              }
+            ],
+            "http://example.com/vocab/term": [
+              {
+                "@value": "http://ex.com/propC.5.1",
+                "@language": "de"
+              }
+            ],
+            "@id": "_:t13"
+          },
+          {
+            "@id": "http://ex.com/propC.5.2",
+            "http://example.com/vocab/nested": [
+              {
+                "@value": "propC.5.2.1",
+                "@language": "de"
+              },
+              {
+                "http://example.com/vocab/term": [
+                  {
+                    "@value": "http://ex.com/propC.5.2.2",
+                    "@language": "de"
+                  }
+                ],
+                "@id": "_:t15"
+              },
+              {
+                "@id": "http://ex.com/propC.5.2.3"
+              },
+              {
+                "@value": 10524
+              }
+            ]
+          }
+        ],
+        "http://example.com/vocab/term": [
+          {
+            "@value": "http://ex.com/propC.5",
+            "@language": "de"
+          }
+        ],
+        "@id": "_:t12"
+      }
+    ],
+    "http://example.com/somethingElse": [
+      {
+        "@list": [
+          {
+            "@value": 20000,
+            "@type": "http://datatype.example.org/type"
+          },
+          {
+            "@value": "propB.1",
+            "@type": "http://datatype.example.org/type"
+          },
+          {
+            "http://example.com/vocab/term": [
+              {
+                "@value": "collission",
+                "@language": "de"
+              }
+            ],
+            "@id": "_:t6"
+          },
+          {
+            "@id": "http://ex.com/propB.2",
+            "http://example.com/vocab/nested": [
+              {
+                "http://example.com/vocab/nested": [
+                  {
+                    "@value": 20110
+                  },
+                  {
+                    "@value": "propB.2.1.1",
+                    "@language": "de"
+                  },
+                  {
+                    "@id": "http://ex.com/propB.2.1.2"
+                  },
+                  {
+                    "http://example.com/vocab/term": [
+                      {
+                        "@value": "http://ex.com/propB.2.1.3",
+                        "@language": "de"
+                      }
+                    ],
+                    "@id": "_:t8"
+                  }
+                ],
+                "http://example.com/vocab/term": [
+                  {
+                    "@value": "http://ex.com/propB.2.1",
+                    "@language": "de"
+                  }
+                ],
+                "@id": "_:t7"
+              },
+              {
+                "@id": "http://ex.com/propB.2.2",
+                "http://example.com/vocab/nested": [
+                  {
+                    "@value": "propB.2.2.1",
+                    "@language": "de"
+                  },
+                  {
+                    "http://example.com/vocab/term": [
+                      {
+                        "@value": "http://ex.com/propB.2.2.2",
+                        "@language": "de"
+                      }
+                    ],
+                    "@id": "_:t9"
+                  },
+                  {
+                    "@id": "http://ex.com/propB.2.2.3"
+                  },
+                  {
+                    "@value": 20224
+                  }
+                ]
+              }
+            ]
+          },
+          {
+            "http://example.com/vocab/term": [
+              {
+                "@value": "http://ex.com/propB.3",
+                "@language": "de"
+              }
+            ],
+            "@id": "_:t10"
+          }
+        ]
+      },
+      {
+        "http://example.com/vocab/term": [
+          {
+            "@value": "collission",
+            "@language": "de"
+          }
+        ],
+        "@id": "_:t11"
+      },
+      {
+        "@value": "propC.2",
+        "@language": "en"
+      },
+      {
+        "@value": 30300
+      },
+      {
+        "@id": "http://ex.com/propC.4"
+      },
+      {
+        "http://example.com/vocab/nested": [
+          {
+            "http://example.com/vocab/nested": [
+              {
+                "@value": 10510
+              },
+              {
+                "@value": "propC.5.1.1",
+                "@language": "de"
+              },
+              {
+                "@id": "http://ex.com/propC.5.1.2"
+              },
+              {
+                "http://example.com/vocab/term": [
+                  {
+                    "@value": "http://ex.com/propC.5.1.3",
+                    "@language": "de"
+                  }
+                ],
+                "@id": "_:t14"
+              }
+            ],
+            "http://example.com/vocab/term": [
+              {
+                "@value": "http://ex.com/propC.5.1",
+                "@language": "de"
+              }
+            ],
+            "@id": "_:t13"
+          },
+          {
+            "@id": "http://ex.com/propC.5.2",
+            "http://example.com/vocab/nested": [
+              {
+                "@value": "propC.5.2.1",
+                "@language": "de"
+              },
+              {
+                "http://example.com/vocab/term": [
+                  {
+                    "@value": "http://ex.com/propC.5.2.2",
+                    "@language": "de"
+                  }
+                ],
+                "@id": "_:t15"
+              },
+              {
+                "@id": "http://ex.com/propC.5.2.3"
+              },
+              {
+                "@value": 10524
+              }
+            ]
+          }
+        ],
+        "http://example.com/vocab/term": [
+          {
+            "@value": "http://ex.com/propC.5",
+            "@language": "de"
+          }
+        ],
+        "@id": "_:t12"
+      }
+    ]
+  }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/compact-0032-out.jsonld	Mon Dec 10 19:37:33 2012 +0100
@@ -0,0 +1,184 @@
+{
+  "@context": {
+    "vocab": "http://example.com/vocab/",
+    "sharedTerm": "http://www.example.org/shared/term",
+    "@language": "de",
+    "propGenA": {
+      "@id": [ "vocab:propGenA", "sharedTerm" ]
+    },
+    "propGenB": {
+      "@id": [ "sharedTerm", "vocab:propGenB", "http://example.com/somethingElse" ],
+      "@container": "@list"
+    },
+    "propGenC": {
+      "@id": [ "sharedTerm", "vocab:propGenB", "http://example.com/somethingElse" ]
+    }
+  },
+  "@id": "http://ex.com/root",
+  "propGenA": [
+    {
+      "@id": "http://ex.com/propA.1"
+    },
+    {
+      "@id": "_:t10",
+      "vocab:term": "http://ex.com/propA.2"
+    },
+    "propA.3",
+    {
+      "@id": "http://ex.com/propA.4"
+    },
+    {
+      "@id": "_:t11",
+      "vocab:term": "http://ex.com/propA.5",
+      "vocab:nested": [
+        {
+          "@id": "_:t12",
+          "vocab:term": "http://ex.com/propA.5.1",
+          "vocab:nested": [
+            10510,
+            "propA.5.1.1",
+            {
+              "@id": "http://ex.com/propA.5.1.2"
+            },
+            {
+              "@id": "_:t13",
+              "vocab:term": "http://ex.com/propA.5.1.3"
+            }
+          ]
+        },
+        {
+          "@id": "http://ex.com/propA.5.2",
+          "vocab:nested": [
+            "propA.5.2.1",
+            {
+              "@id": "_:t14",
+              "vocab:term": "http://ex.com/propA.5.2.2"
+            },
+            {
+              "@id": "http://ex.com/propA.5.2.3"
+            },
+            10524
+          ]
+        }
+      ]
+    },
+    10600,
+    {
+      "@id": "_:t15",
+      "vocab:term": "collission"
+    }
+  ],
+  "propGenB": [
+    {
+      "@value": 20000,
+      "@type": "http://datatype.example.org/type"
+    },
+    {
+      "@value": "propB.1",
+      "@type": "http://datatype.example.org/type"
+    },
+    {
+      "@id": "_:t0",
+      "vocab:term": "collission"
+    },
+    {
+      "@id": "http://ex.com/propB.2",
+      "vocab:nested": [
+        {
+         "@id": "_:t1",
+          "vocab:term": "http://ex.com/propB.2.1",
+          "vocab:nested": [
+            20110,
+            "propB.2.1.1",
+            {
+              "@id": "http://ex.com/propB.2.1.2"
+            },
+            {
+              "@id": "_:t2",
+              "vocab:term": "http://ex.com/propB.2.1.3"
+            }
+          ]
+        },
+        {
+          "@id": "http://ex.com/propB.2.2",
+          "vocab:nested": [
+            "propB.2.2.1",
+            {
+              "@id": "_:t3",
+              "vocab:term": "http://ex.com/propB.2.2.2"
+            },
+            {
+              "@id": "http://ex.com/propB.2.2.3"
+            },
+            20224
+          ]
+        }
+      ]
+    },
+    {
+      "@id": "_:t4",
+      "vocab:term": "http://ex.com/propB.3"
+    }
+  ],
+  "propGenC": [
+    {
+      "@id": "_:t5",
+      "vocab:term": "collission"
+    },
+    {
+      "@value": "propC.2",
+      "@language": "en"
+    },
+    30300,
+    {
+      "@id": "http://ex.com/propC.4"
+    },
+    {
+      "@id": "_:t6",
+      "vocab:term": "http://ex.com/propC.5",
+      "vocab:nested": [
+        {
+         "@id": "_:t7",
+          "vocab:term": "http://ex.com/propC.5.1",
+          "vocab:nested": [
+            10510,
+            "propC.5.1.1",
+            {
+              "@id": "http://ex.com/propC.5.1.2"
+            },
+            {
+              "@id": "_:t8",
+              "vocab:term": "http://ex.com/propC.5.1.3"
+            }
+          ]
+        },
+        {
+          "@id": "http://ex.com/propC.5.2",
+          "vocab:nested": [
+            "propC.5.2.1",
+            {
+              "@id": "_:t9",
+              "vocab:term": "http://ex.com/propC.5.2.2"
+            },
+            {
+              "@id": "http://ex.com/propC.5.2.3"
+            },
+            10524
+          ]
+        }
+      ]
+    }
+  ],
+  "vocab:propGenA": [
+    "propGenA.coll.1",
+    {
+      "vocab:term": "collission"
+    }
+  ],
+  "vocab:propGenB": [
+    "propGenB.coll.1",
+    {
+      "vocab:term": "collission"
+    }
+  ]
+}
--- a/test-suite/tests/compact-manifest.jsonld	Mon Dec 10 19:36:06 2012 +0100
+++ b/test-suite/tests/compact-manifest.jsonld	Mon Dec 10 19:37:33 2012 +0100
@@ -192,5 +192,11 @@
     "input": "compact-0031-in.jsonld",
     "context": "compact-0031-context.jsonld",
     "expect": "compact-0031-out.jsonld"
+  }, {
+    "@type": ["test:TestCase", "jld:CompactTest"],
+    "name": "Complex property generator test case with multiple colliding IRIs",
+    "input": "compact-0032-in.jsonld",
+    "context": "compact-0032-context.jsonld",
+    "expect": "compact-0032-out.jsonld"
   }]
 }