Test that compaction falls back to terms if no property generator matches
authorMarkus Lanthaler <mark_lanthaler@gmx.net>
Thu, 13 Dec 2012 14:06:43 +0100
changeset 1034 9969321afca0
parent 1033 b6b3aa239af2
child 1035 17f0ba1e50a0
Test that compaction falls back to terms if no property generator matches

This addresses #142 and #160.
test-suite/tests/compact-0036-context.jsonld
test-suite/tests/compact-0036-in.jsonld
test-suite/tests/compact-0036-out.jsonld
test-suite/tests/compact-manifest.jsonld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/compact-0036-context.jsonld	Thu Dec 13 14:06:43 2012 +0100
@@ -0,0 +1,15 @@
+{
+  "@context": {
+    "site": "http://example.com/",
+    "doesntExist": "http://example.com/doesntExistInInputData",
+    "schema": "http://schema.org/",
+    "field_tags_term_set": { "@id": "site:vocab/field_tags", "@container": "@set" },
+    "field_tags_set": { "@id": [ "site:vocab/field_tags", "http://schema.org/about", "doesntExist" ], "@container": "@set" },
+    "field_tags_set_id": { "@id": [ "site:vocab/field_tags", "http://schema.org/about", "doesntExist" ], "@container": "@set", "@type": "@id" },
+    "field_related_set": { "@id": [ "site:vocab/field_related", "http://schema.org/about", "doesntExist" ], "@container": "@set" },
+    "field_related_term_list": { "@id": "site:vocab/field_related", "@container": "@list" },
+    "field_related_list": { "@id": [ "site:vocab/field_related", "http://schema.org/about", "doesntExist" ], "@container": "@list" },
+    "field_related_list_id": { "@id": [ "site:vocab/field_related", "http://schema.org/about", "doesntExist" ], "@container": "@list", "@type": "@id" },
+    "field_related_list_lang": { "@id": [ "site:vocab/field_related", "http://schema.org/about", "doesntExist" ], "@container": "@list", "@language": "en" }
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/compact-0036-in.jsonld	Thu Dec 13 14:06:43 2012 +0100
@@ -0,0 +1,39 @@
+[
+   {
+      "@id": "http://example.com/node/1",
+      "http://example.com/vocab/field_related": [
+         {
+            "@list": [
+               {
+                  "@id": "http://example.com/node/this-is-related-news"
+               },
+               {
+                  "@value": "This is a related string",
+                  "@language": "en"
+               }
+            ]
+         }
+      ],
+      "http://schema.org/about": [
+         {
+            "@list": [
+               {
+                  "@id": "http://example.com/node/this-is-related-news"
+               },
+               {
+                  "@value": "This is a related string",
+                  "@language": "en"
+               }
+            ]
+         },
+         {
+            "@id": "http://example.com/term/this-is-a-tag"
+         }
+      ],
+      "http://example.com/vocab/field_tags": [
+         {
+            "@id": "http://example.com/term/this-is-a-tag"
+         }
+      ]
+   }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/compact-0036-out.jsonld	Thu Dec 13 14:06:43 2012 +0100
@@ -0,0 +1,46 @@
+{
+  "@context": {
+    "site": "http://example.com/",
+    "doesntExist": "http://example.com/doesntExistInInputData",
+    "schema": "http://schema.org/",
+    "field_tags_term_set": { "@id": "site:vocab/field_tags", "@container": "@set" },
+    "field_tags_set": { "@id": [ "site:vocab/field_tags", "http://schema.org/about", "doesntExist" ], "@container": "@set" },
+    "field_tags_set_id": { "@id": [ "site:vocab/field_tags", "http://schema.org/about", "doesntExist" ], "@container": "@set", "@type": "@id" },
+    "field_related_set": { "@id": [ "site:vocab/field_related", "http://schema.org/about", "doesntExist" ], "@container": "@set" },
+    "field_related_term_list": { "@id": "site:vocab/field_related", "@container": "@list" },
+    "field_related_list": { "@id": [ "site:vocab/field_related", "http://schema.org/about", "doesntExist" ], "@container": "@list" },
+    "field_related_list_id": { "@id": [ "site:vocab/field_related", "http://schema.org/about", "doesntExist" ], "@container": "@list", "@type": "@id" },
+    "field_related_list_lang": { "@id": [ "site:vocab/field_related", "http://schema.org/about", "doesntExist" ], "@container": "@list", "@language": "en" }
+  },
+  "@id": "site:node/1",
+  "field_tags_term_set": [
+    {
+        "@id": "site:term/this-is-a-tag"
+    }
+  ],
+  "field_related_term_list": [
+    {
+      "@id": "site:node/this-is-related-news"
+    },
+    {
+      "@value": "This is a related string",
+      "@language": "en"
+    }
+  ],
+  "schema:about": [
+     {
+        "@list": [
+           {
+              "@id": "site:node/this-is-related-news"
+           },
+           {
+              "@value": "This is a related string",
+              "@language": "en"
+           }
+        ]
+     },
+     {
+        "@id": "site:term/this-is-a-tag"
+     }
+  ]
+}
--- a/test-suite/tests/compact-manifest.jsonld	Wed Dec 12 17:42:02 2012 -0800
+++ b/test-suite/tests/compact-manifest.jsonld	Thu Dec 13 14:06:43 2012 +0100
@@ -216,5 +216,11 @@
     "input": "compact-0035-in.jsonld",
     "context": "compact-0035-context.jsonld",
     "expect": "compact-0035-out.jsonld"
+  }, {
+    "@type": ["test:TestCase", "jld:CompactTest"],
+    "name": "Fall back to terms if no property generator matches",
+    "input": "compact-0036-in.jsonld",
+    "context": "compact-0036-context.jsonld",
+    "expect": "compact-0036-out.jsonld"
   }]
 }