From a04af73f4851f017446a97af45bec5b0fdf54e5d Mon Sep 17 00:00:00 2001 From: dnllowe Date: Fri, 14 Jun 2019 23:10:07 -0400 Subject: [PATCH 1/9] Makes lexicographical sorting optional, preserving original object order instead --- src/json-ld.net/Core/JsonLdApi.cs | 65 +++++++++++++++++++++---- src/json-ld.net/Core/JsonLdOptions.cs | 12 +++++ src/json-ld.net/Core/JsonLdProcessor.cs | 14 +++++- 3 files changed, 79 insertions(+), 12 deletions(-) diff --git a/src/json-ld.net/Core/JsonLdApi.cs b/src/json-ld.net/Core/JsonLdApi.cs index 186d913..c5338db 100644 --- a/src/json-ld.net/Core/JsonLdApi.cs +++ b/src/json-ld.net/Core/JsonLdApi.cs @@ -122,7 +122,12 @@ public virtual JToken Compact(Context activeCtx, string activeProperty, JToken e JObject result = new JObject(); // 7) JArray keys = new JArray(element.GetKeys()); - keys.SortInPlace(); + + if (!opts.GetPreserveOrder()) + { + keys.SortInPlace(); + } + foreach (string expandedProperty in keys) { JToken expandedValue = elem[expandedProperty]; @@ -491,7 +496,12 @@ public virtual JToken Expand(Context activeCtx, string activeProperty, JToken el JObject result = new JObject(); // 7) JArray keys = new JArray(element.GetKeys()); - keys.SortInPlace(); + + if (!opts.GetPreserveOrder()) + { + keys.SortInPlace(); + } + foreach (string key in keys) { JToken value = elem[key]; @@ -808,7 +818,12 @@ public virtual JToken Expand(Context activeCtx, string activeProperty, JToken el expandedValue = new JArray(); // 7.6.2) JArray indexKeys = new JArray(value.GetKeys()); - indexKeys.SortInPlace(); + + if (!opts.GetPreserveOrder()) + { + indexKeys.SortInPlace(); + } + foreach (string index in indexKeys) { JToken indexValue = ((JObject)value)[index]; @@ -1290,7 +1305,12 @@ private void GenerateNodeMap(JToken element, JObject nodeMap, } // 6.11) JArray keys = new JArray(element.GetKeys()); - keys.SortInPlace(); + + if (!opts.GetPreserveOrder()) + { + keys.SortInPlace(); + } + foreach (string property_1 in keys) { var eachProperty_1 = property_1; @@ -1405,7 +1425,7 @@ public virtual JArray Frame(JToken input, JArray frame) { state.omitDefault = this.opts.GetOmitDefault().Value; } - // use tree map so keys are sotred by default + // use tree map so keys are sorted by default // XXX BUG BUG BUG XXX (sblom) Figure out where this needs to be sorted and use extension methods to return sorted enumerators or something! JObject nodes = new JObject(); GenerateNodeMap(input, nodes); @@ -1436,7 +1456,12 @@ private void Frame(JsonLdApi.FramingContext state, JObject nodes bool explicitOn = GetFrameFlag(frame, "@explicit", state.@explicit); // add matches to output JArray ids = new JArray(matches.GetKeys()); - ids.SortInPlace(); + + if (!opts.GetPreserveOrder()) + { + ids.SortInPlace(); + } + foreach (string id in ids) { if (property == null) @@ -1499,7 +1524,12 @@ private void Frame(JsonLdApi.FramingContext state, JObject nodes // iterate over subject properties JObject element = (JObject)matches[id]; JArray props = new JArray(element.GetKeys()); - props.SortInPlace(); + + if (!opts.GetPreserveOrder()) + { + props.SortInPlace(); + } + foreach (string prop in props) { // copy keywords to output @@ -1576,7 +1606,12 @@ private void Frame(JsonLdApi.FramingContext state, JObject nodes } // handle defaults props = new JArray(frame.GetKeys()); - props.SortInPlace(); + + if (!opts.GetPreserveOrder()) + { + props.SortInPlace(); + } + foreach (string prop_1 in props) { // skip keywords @@ -2116,7 +2151,12 @@ public virtual JArray FromRDF(RDFDataset dataset) JArray result = new JArray(); // 6) JArray ids = new JArray(defaultGraph.GetKeys()); - ids.SortInPlace(); + + if (!opts.GetPreserveOrder()) + { + ids.SortInPlace(); + } + foreach (string subject_1 in ids) { JsonLdApi.NodeMapNode node = (NodeMapNode)defaultGraph[subject_1]; @@ -2127,7 +2167,12 @@ public virtual JArray FromRDF(RDFDataset dataset) node["@graph"] = new JArray(); // 6.1.2) JArray keys = new JArray(graphMap[subject_1].GetKeys()); - keys.SortInPlace(); + + if (!opts.GetPreserveOrder()) + { + keys.SortInPlace(); + } + foreach (string s in keys) { JsonLdApi.NodeMapNode n = (NodeMapNode)graphMap[subject_1][s]; diff --git a/src/json-ld.net/Core/JsonLdOptions.cs b/src/json-ld.net/Core/JsonLdOptions.cs index 2478481..aaa4b2a 100644 --- a/src/json-ld.net/Core/JsonLdOptions.cs +++ b/src/json-ld.net/Core/JsonLdOptions.cs @@ -43,6 +43,8 @@ public virtual JsonLD.Core.JsonLdOptions Clone() private bool produceGeneralizedRdf = false; + private bool preserveOrder = false; + // base options // frame options // rdf conversion options @@ -147,6 +149,16 @@ public virtual void SetProduceGeneralizedRdf(bool produceGeneralizedRdf) this.produceGeneralizedRdf = produceGeneralizedRdf; } + public virtual bool GetPreserveOrder() + { + return preserveOrder; + } + + public virtual void SetPreserveOrder(bool preserveOrder) + { + this.preserveOrder = preserveOrder; + } + public string format = null; public bool useNamespaces = false; diff --git a/src/json-ld.net/Core/JsonLdProcessor.cs b/src/json-ld.net/Core/JsonLdProcessor.cs index f383f2c..07955be 100644 --- a/src/json-ld.net/Core/JsonLdProcessor.cs +++ b/src/json-ld.net/Core/JsonLdProcessor.cs @@ -201,7 +201,12 @@ public static JToken Flatten(JToken input, JToken context, JsonLdOptions opts) entry["@graph"] = new JArray(); } JArray keys = new JArray(graph.GetKeys()); - keys.SortInPlace(); + + if (!opts.GetPreserveOrder()) + { + keys.SortInPlace(); + } + foreach (string id in keys) { JObject node = (JObject)graph[id]; @@ -215,7 +220,12 @@ public static JToken Flatten(JToken input, JToken context, JsonLdOptions opts) JArray flattened = new JArray(); // 6) JArray keys_1 = new JArray(defaultGraph.GetKeys()); - keys_1.SortInPlace(); + + if (!opts.GetPreserveOrder()) + { + keys_1.SortInPlace(); + } + foreach (string id_1 in keys_1) { JObject node = (JObject)defaultGraph[id_1 From 058d7e1b77388187ec0e2c046aaa7b6806e77e6a Mon Sep 17 00:00:00 2001 From: dnllowe Date: Sun, 16 Jun 2019 18:17:00 -0400 Subject: [PATCH 2/9] Adds tests for JsonLdApi.FromRDF --- src/json-ld.net/Core/JsonLdApi.cs | 21 +- src/json-ld.net/Core/JsonLdOptions.cs | 21 +- src/json-ld.net/Core/JsonLdProcessor.cs | 13 +- src/json-ld.net/Core/NormalizeUtils.cs | 31 +- src/json-ld.net/json-ld.net.csproj | 3 +- test/json-ld.net.tests/ConformanceTests.cs | 47 +- test/json-ld.net.tests/JsonFetcher.cs | 31 + .../Sorting/W3C/expand-0002-in.jsonld | 18 + .../Sorting/W3C/expand-0002-out.jsonld | 9 + .../Sorting/W3C/expand-manifest.jsonld | 556 ++++++++++++ .../Sorting/W3C/flatten-0002-in.jsonld | 18 + .../Sorting/W3C/flatten-0002-out.jsonld | 38 + .../Sorting/W3C/flatten-manifest.jsonld | 330 +++++++ .../Sorting/W3C/frame-0002-in.jsonld | 28 + .../Sorting/W3C/frame-0002-out.jsonld | 23 + .../Sorting/W3C/fromRdf-context.jsonld | 11 + .../Sorting/W3C/fromRdf-in.json | 58 ++ .../Sorting/W3C/fromRdf-manifest.jsonld | 41 + .../Sorting/W3C/fromRdf-out-no-sorting.jsonld | 89 ++ .../W3C/fromRdf-out-sort-graph-nodes.jsonld | 89 ++ .../fromRdf-out-sort-graphs-and-nodes.jsonld | 89 ++ .../W3C/fromRdf-out-sort-graphs.jsonld | 89 ++ .../Sorting/W3C/normalize-0002-in.jsonld | 14 + .../Sorting/W3C/normalize-0002-out.nq | 1 + .../Sorting/W3C/normalize-manifest.jsonld | 353 ++++++++ .../Sorting/W3C/remote-doc-0002-in.json | 7 + .../Sorting/W3C/remote-doc-0002-out.jsonld | 4 + .../Sorting/W3C/remote-doc-manifest.jsonld | 129 +++ .../Sorting/W3C/toRdf-0002-in.jsonld | 5 + .../Sorting/W3C/toRdf-0002-out.nq | 1 + .../Sorting/W3C/toRdf-manifest.jsonld | 812 ++++++++++++++++++ test/json-ld.net.tests/SortingTests.cs | 173 ++++ .../json-ld.net.tests.csproj | 75 ++ 33 files changed, 3158 insertions(+), 69 deletions(-) create mode 100644 test/json-ld.net.tests/JsonFetcher.cs create mode 100644 test/json-ld.net.tests/Sorting/W3C/expand-0002-in.jsonld create mode 100644 test/json-ld.net.tests/Sorting/W3C/expand-0002-out.jsonld create mode 100644 test/json-ld.net.tests/Sorting/W3C/expand-manifest.jsonld create mode 100644 test/json-ld.net.tests/Sorting/W3C/flatten-0002-in.jsonld create mode 100644 test/json-ld.net.tests/Sorting/W3C/flatten-0002-out.jsonld create mode 100644 test/json-ld.net.tests/Sorting/W3C/flatten-manifest.jsonld create mode 100644 test/json-ld.net.tests/Sorting/W3C/frame-0002-in.jsonld create mode 100644 test/json-ld.net.tests/Sorting/W3C/frame-0002-out.jsonld create mode 100644 test/json-ld.net.tests/Sorting/W3C/fromRdf-context.jsonld create mode 100644 test/json-ld.net.tests/Sorting/W3C/fromRdf-in.json create mode 100644 test/json-ld.net.tests/Sorting/W3C/fromRdf-manifest.jsonld create mode 100644 test/json-ld.net.tests/Sorting/W3C/fromRdf-out-no-sorting.jsonld create mode 100644 test/json-ld.net.tests/Sorting/W3C/fromRdf-out-sort-graph-nodes.jsonld create mode 100644 test/json-ld.net.tests/Sorting/W3C/fromRdf-out-sort-graphs-and-nodes.jsonld create mode 100644 test/json-ld.net.tests/Sorting/W3C/fromRdf-out-sort-graphs.jsonld create mode 100644 test/json-ld.net.tests/Sorting/W3C/normalize-0002-in.jsonld create mode 100644 test/json-ld.net.tests/Sorting/W3C/normalize-0002-out.nq create mode 100644 test/json-ld.net.tests/Sorting/W3C/normalize-manifest.jsonld create mode 100644 test/json-ld.net.tests/Sorting/W3C/remote-doc-0002-in.json create mode 100644 test/json-ld.net.tests/Sorting/W3C/remote-doc-0002-out.jsonld create mode 100644 test/json-ld.net.tests/Sorting/W3C/remote-doc-manifest.jsonld create mode 100644 test/json-ld.net.tests/Sorting/W3C/toRdf-0002-in.jsonld create mode 100644 test/json-ld.net.tests/Sorting/W3C/toRdf-0002-out.nq create mode 100644 test/json-ld.net.tests/Sorting/W3C/toRdf-manifest.jsonld create mode 100644 test/json-ld.net.tests/SortingTests.cs diff --git a/src/json-ld.net/Core/JsonLdApi.cs b/src/json-ld.net/Core/JsonLdApi.cs index c5338db..2cb465a 100644 --- a/src/json-ld.net/Core/JsonLdApi.cs +++ b/src/json-ld.net/Core/JsonLdApi.cs @@ -123,7 +123,7 @@ public virtual JToken Compact(Context activeCtx, string activeProperty, JToken e // 7) JArray keys = new JArray(element.GetKeys()); - if (!opts.GetPreserveOrder()) + //if (opts.GetSortGraphNodes()) { keys.SortInPlace(); } @@ -435,8 +435,7 @@ public virtual JToken Compact(Context activeCtx, string activeProperty, JToken e /// /// JsonLdError /// - public virtual JToken Expand(Context activeCtx, string activeProperty, JToken element - ) + public virtual JToken Expand(Context activeCtx, string activeProperty, JToken element) { // 1) if (element.IsNull()) @@ -497,7 +496,7 @@ public virtual JToken Expand(Context activeCtx, string activeProperty, JToken el // 7) JArray keys = new JArray(element.GetKeys()); - if (!opts.GetPreserveOrder()) + //if (opts.GetSortGraphNodes()) { keys.SortInPlace(); } @@ -819,7 +818,7 @@ public virtual JToken Expand(Context activeCtx, string activeProperty, JToken el // 7.6.2) JArray indexKeys = new JArray(value.GetKeys()); - if (!opts.GetPreserveOrder()) + //if (opts.GetSortGraphNodes()) { indexKeys.SortInPlace(); } @@ -1306,7 +1305,7 @@ private void GenerateNodeMap(JToken element, JObject nodeMap, // 6.11) JArray keys = new JArray(element.GetKeys()); - if (!opts.GetPreserveOrder()) + //if (!opts.GetSortGraphNodes()) { keys.SortInPlace(); } @@ -1457,7 +1456,7 @@ private void Frame(JsonLdApi.FramingContext state, JObject nodes // add matches to output JArray ids = new JArray(matches.GetKeys()); - if (!opts.GetPreserveOrder()) + //if (!opts.GetSortGraphs()) { ids.SortInPlace(); } @@ -1525,7 +1524,7 @@ private void Frame(JsonLdApi.FramingContext state, JObject nodes JObject element = (JObject)matches[id]; JArray props = new JArray(element.GetKeys()); - if (!opts.GetPreserveOrder()) + //if (!opts.GetSortGraphNodes()) { props.SortInPlace(); } @@ -1607,7 +1606,7 @@ private void Frame(JsonLdApi.FramingContext state, JObject nodes // handle defaults props = new JArray(frame.GetKeys()); - if (!opts.GetPreserveOrder()) + //if (!opts.GetSortGraphNodes()) { props.SortInPlace(); } @@ -2152,7 +2151,7 @@ public virtual JArray FromRDF(RDFDataset dataset) // 6) JArray ids = new JArray(defaultGraph.GetKeys()); - if (!opts.GetPreserveOrder()) + if (!opts.GetSortGraphs()) { ids.SortInPlace(); } @@ -2168,7 +2167,7 @@ public virtual JArray FromRDF(RDFDataset dataset) // 6.1.2) JArray keys = new JArray(graphMap[subject_1].GetKeys()); - if (!opts.GetPreserveOrder()) + if (!opts.GetSortGraphNodes()) { keys.SortInPlace(); } diff --git a/src/json-ld.net/Core/JsonLdOptions.cs b/src/json-ld.net/Core/JsonLdOptions.cs index aaa4b2a..adfa13d 100644 --- a/src/json-ld.net/Core/JsonLdOptions.cs +++ b/src/json-ld.net/Core/JsonLdOptions.cs @@ -1,4 +1,3 @@ -using JsonLD.Core; using Newtonsoft.Json.Linq; namespace JsonLD.Core @@ -43,8 +42,9 @@ public virtual JsonLD.Core.JsonLdOptions Clone() private bool produceGeneralizedRdf = false; - private bool preserveOrder = false; + private bool sortGraphs = true; + private bool sortGraphNodes = true; // base options // frame options // rdf conversion options @@ -149,16 +149,25 @@ public virtual void SetProduceGeneralizedRdf(bool produceGeneralizedRdf) this.produceGeneralizedRdf = produceGeneralizedRdf; } - public virtual bool GetPreserveOrder() + public virtual bool GetSortGraphs() { - return preserveOrder; + return sortGraphs; } - public virtual void SetPreserveOrder(bool preserveOrder) + public virtual void SetSortGraphs(bool sortGraphs) { - this.preserveOrder = preserveOrder; + this.sortGraphs = sortGraphs; } + public virtual bool GetSortGraphNodes() + { + return sortGraphNodes; + } + + public virtual void SetSortGraphNodes(bool sortGraphNodes) + { + this.sortGraphNodes = sortGraphNodes; + } public string format = null; public bool useNamespaces = false; diff --git a/src/json-ld.net/Core/JsonLdProcessor.cs b/src/json-ld.net/Core/JsonLdProcessor.cs index 07955be..2260955 100644 --- a/src/json-ld.net/Core/JsonLdProcessor.cs +++ b/src/json-ld.net/Core/JsonLdProcessor.cs @@ -13,8 +13,7 @@ namespace JsonLD.Core public class JsonLdProcessor { /// - public static JObject Compact(JToken input, JToken context, JsonLdOptions - opts) + public static JObject Compact(JToken input, JToken context, JsonLdOptions opts) { // 1) // TODO: look into java futures/promises @@ -202,10 +201,7 @@ public static JToken Flatten(JToken input, JToken context, JsonLdOptions opts) } JArray keys = new JArray(graph.GetKeys()); - if (!opts.GetPreserveOrder()) - { - keys.SortInPlace(); - } + keys.SortInPlace(); foreach (string id in keys) { @@ -221,10 +217,7 @@ public static JToken Flatten(JToken input, JToken context, JsonLdOptions opts) // 6) JArray keys_1 = new JArray(defaultGraph.GetKeys()); - if (!opts.GetPreserveOrder()) - { - keys_1.SortInPlace(); - } + keys_1.SortInPlace(); foreach (string id_1 in keys_1) { diff --git a/src/json-ld.net/Core/NormalizeUtils.cs b/src/json-ld.net/Core/NormalizeUtils.cs index 91aa552..6ed92ee 100644 --- a/src/json-ld.net/Core/NormalizeUtils.cs +++ b/src/json-ld.net/Core/NormalizeUtils.cs @@ -45,7 +45,12 @@ public virtual object HashBlankNodes(IEnumerable unnamed_) // done, name blank nodes bool named = false; IList hashes = new List(unique.Keys); - hashes.SortInPlace(); + + //if (!options.GetSortGraphs()) + { + hashes.SortInPlace(); + } + foreach (string hash in hashes) { string bnode = unique[hash]; @@ -73,7 +78,12 @@ public virtual object HashBlankNodes(IEnumerable unnamed_) // names duplicate hash bnodes // enumerate duplicate hash groups in sorted order hashes = new List(duplicates.Keys); - hashes.SortInPlace(); + + //if (!options.GetSortGraphs()) + { + hashes.SortInPlace(); + } + // process each group for (int pgi = 0; ; pgi++) { @@ -108,8 +118,13 @@ public virtual object HashBlankNodes(IEnumerable unnamed_) normalized.Add(RDFDatasetUtils.ToNQuad(quad, quad.ContainsKey("name" ) && !(quad["name"] == null) ? (string)((IDictionary)((IDictionary)quad)["name"])["value"] : null)); } - // sort normalized output - normalized.SortInPlace(); + + //if (!options.GetSortGraphs()) + { + // sort normalized output + normalized.SortInPlace(); + } + // handle output format if (options.format != null) { @@ -141,8 +156,12 @@ public virtual object HashBlankNodes(IEnumerable unnamed_) { if (n_2 == group.Count) { - // name bnodes in hash order - results.SortInPlace(new _IComparer_145()); + //if (!options.GetSortGraphs()) + { + // name bnodes in hash order + results.SortInPlace(new _IComparer_145()); + } + foreach (NormalizeUtils.HashResult r in results) { // name all bnodes in path namer in diff --git a/src/json-ld.net/json-ld.net.csproj b/src/json-ld.net/json-ld.net.csproj index 611ba8e..7d0875b 100644 --- a/src/json-ld.net/json-ld.net.csproj +++ b/src/json-ld.net/json-ld.net.csproj @@ -3,7 +3,7 @@ JSON-LD processor for .NET Implements the W3C JSON-LD 1.0 standard. - 1.0.6 + 1.0.7.1 NuGet;linked-data-dotnet netstandard1.3;netstandard2.0;netcoreapp2.1 json-ld.net @@ -17,6 +17,7 @@ Implements the W3C JSON-LD 1.0 standard. false false false + true diff --git a/test/json-ld.net.tests/ConformanceTests.cs b/test/json-ld.net.tests/ConformanceTests.cs index 02eaa82..09bcaf8 100644 --- a/test/json-ld.net.tests/ConformanceTests.cs +++ b/test/json-ld.net.tests/ConformanceTests.cs @@ -1,13 +1,10 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; using Newtonsoft.Json.Linq; using Xunit; -using Xunit.Extensions; using System.IO; -using Newtonsoft.Json; using JsonLD.Core; using JsonLD.Util; @@ -16,7 +13,7 @@ namespace JsonLD.Test public class ConformanceTests { [Theory, ClassData(typeof(ConformanceCases))] - public void ConformanceTestPasses(string id, string testname, ConformanceCase conformanceCase) + public void ConformanceTestPasses(string id, ConformanceCase conformanceCase) { JToken result = conformanceCase.run(); if (conformanceCase.error != null) @@ -77,20 +74,21 @@ public ConformanceCases() public IEnumerator GetEnumerator() { + var jsonFetcher = new JsonFetcher(); + var rootDirectory = "W3C"; + foreach (string manifest in manifests) { - JToken manifestJson; - - manifestJson = GetJson(manifest); + JToken manifestJson = jsonFetcher.GetJson(manifest, rootDirectory); foreach (JObject testcase in manifestJson["sequence"]) { Func run; ConformanceCase newCase = new ConformanceCase(); - newCase.input = GetJson(testcase["input"]); - newCase.context = GetJson(testcase["context"]); - newCase.frame = GetJson(testcase["frame"]); + newCase.input = jsonFetcher.GetJson(testcase["input"], rootDirectory); + newCase.context = jsonFetcher.GetJson(testcase["context"], rootDirectory); + newCase.frame = jsonFetcher.GetJson(testcase["frame"], rootDirectory); var options = new JsonLdOptions("http://json-ld.org/test-suite/tests/" + (string)testcase["input"]); @@ -109,11 +107,11 @@ public IEnumerator GetEnumerator() else if (testType.Any((s) => (string)s == "jld:FromRDFTest")) { newCase.input = File.ReadAllText(Path.Combine("W3C", (string)testcase["input"])); - newCase.output = GetJson(testcase["expect"]); + newCase.output = jsonFetcher.GetJson(testcase["expect"], rootDirectory); } else { - newCase.output = GetJson(testcase["expect"]); + newCase.output = jsonFetcher.GetJson(testcase["expect"], rootDirectory); } } else @@ -138,7 +136,7 @@ public IEnumerator GetEnumerator() } if (optionDescription.TryGetValue("expandContext", out value)) { - newCase.context = GetJson(testcase["option"]["expandContext"]); + newCase.context = jsonFetcher.GetJson(testcase["option"]["expandContext"], rootDirectory); options.SetExpandContext((JObject)newCase.context); } if (optionDescription.TryGetValue("produceGeneralizedRdf", out value)) @@ -227,32 +225,11 @@ public IEnumerator GetEnumerator() newCase.run = run; - yield return new object[] { manifest + (string)testcase["@id"], (string)testcase["name"], newCase }; + yield return new object[] { manifest + (string)testcase["@id"], newCase }; } } } - private JToken GetJson(JToken j) - { - try - { - if (j == null || j.Type == JTokenType.Null) return null; - using (Stream manifestStream = File.OpenRead(Path.Combine("W3C", (string)j))) - using (TextReader reader = new StreamReader(manifestStream)) - using (JsonReader jreader = new Newtonsoft.Json.JsonTextReader(reader) - { - DateParseHandling = DateParseHandling.None - }) - { - return JToken.ReadFrom(jreader); - } - } - catch (Exception e) - { // TODO: this should not be here, figure out why this is needed or catch specific exception. - return null; - } - } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw new Exception("auggh"); diff --git a/test/json-ld.net.tests/JsonFetcher.cs b/test/json-ld.net.tests/JsonFetcher.cs new file mode 100644 index 0000000..35ec309 --- /dev/null +++ b/test/json-ld.net.tests/JsonFetcher.cs @@ -0,0 +1,31 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using System; +using System.IO; + +namespace JsonLD.Test +{ + public class JsonFetcher + { + public JToken GetJson(JToken j, string rootDirectory) + { + try + { + if (j == null || j.Type == JTokenType.Null) return null; + using (Stream manifestStream = File.OpenRead(Path.Combine(rootDirectory, (string)j))) + using (TextReader reader = new StreamReader(manifestStream)) + using (JsonReader jreader = new JsonTextReader(reader) + { + DateParseHandling = DateParseHandling.None + }) + { + return JToken.ReadFrom(jreader); + } + } + catch (Exception e) + { // TODO: this should not be here, figure out why this is needed or catch specific exception. + return null; + } + } + } +} \ No newline at end of file diff --git a/test/json-ld.net.tests/Sorting/W3C/expand-0002-in.jsonld b/test/json-ld.net.tests/Sorting/W3C/expand-0002-in.jsonld new file mode 100644 index 0000000..e4598e5 --- /dev/null +++ b/test/json-ld.net.tests/Sorting/W3C/expand-0002-in.jsonld @@ -0,0 +1,18 @@ +{ + "@context": { + "t1": "http://example.com/t1", + "t2": "http://example.com/t2", + "term1": "http://example.com/term1", + "term2": "http://example.com/term2", + "term3": "http://example.com/term3", + "term4": "http://example.com/term4", + "term5": "http://example.com/term5" + }, + "@id": "http://example.com/id1", + "@type": "t1", + "term1": "v1", + "term2": {"@value": "v2", "@type": "t2"}, + "term3": {"@value": "v3", "@language": "en"}, + "term4": 4, + "term5": [50, 51] +} diff --git a/test/json-ld.net.tests/Sorting/W3C/expand-0002-out.jsonld b/test/json-ld.net.tests/Sorting/W3C/expand-0002-out.jsonld new file mode 100644 index 0000000..cc8e658 --- /dev/null +++ b/test/json-ld.net.tests/Sorting/W3C/expand-0002-out.jsonld @@ -0,0 +1,9 @@ +[{ + "@id": "http://example.com/id1", + "@type": ["http://example.com/t1"], + "http://example.com/term1": [{"@value": "v1"}], + "http://example.com/term2": [{"@value": "v2", "@type": "http://example.com/t2"}], + "http://example.com/term3": [{"@value": "v3", "@language": "en"}], + "http://example.com/term4": [{"@value": 4}], + "http://example.com/term5": [{"@value": 50}, {"@value": 51}] +}] \ No newline at end of file diff --git a/test/json-ld.net.tests/Sorting/W3C/expand-manifest.jsonld b/test/json-ld.net.tests/Sorting/W3C/expand-manifest.jsonld new file mode 100644 index 0000000..49a200c --- /dev/null +++ b/test/json-ld.net.tests/Sorting/W3C/expand-manifest.jsonld @@ -0,0 +1,556 @@ +{ + "@context": "http://json-ld.org/test-suite/context.jsonld", + "@id": "", + "@type": "mf:Manifest", + "description": "JSON-LD to Expansion tests use object compare", + "name": "Expansion", + "baseIri": "http://json-ld.org/test-suite/tests/", + "sequence": [ + { + "@id": "#t0001", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "drop free-floating nodes", + "purpose": "Expand drops unreferenced nodes having only @id", + "input": "expand-0001-in.jsonld", + "expect": "expand-0001-out.jsonld" + }, { + "@id": "#t0002", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "basic", + "purpose": "Expanding terms with different types of values", + "input": "expand-0002-in.jsonld", + "expect": "expand-0002-out.jsonld" + }, { + "@id": "#t0003", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "drop null and unmapped properties", + "purpose": "Verifies that null values and unmapped properties are removed from expanded output", + "input": "expand-0003-in.jsonld", + "expect": "expand-0003-out.jsonld" + }, { + "@id": "#t0004", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "optimize @set, keep empty arrays", + "purpose": "Uses of @set are removed in expansion; values of @set, or just plain values which are empty arrays are retained", + "input": "expand-0004-in.jsonld", + "expect": "expand-0004-out.jsonld" + }, { + "@id": "#t0005", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "do not expand aliased @id/@type", + "purpose": "If a keyword is aliased, it is not used when expanding", + "input": "expand-0005-in.jsonld", + "expect": "expand-0005-out.jsonld" + }, { + "@id": "#t0006", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "alias keywords", + "purpose": "Aliased keywords expand in resulting document", + "input": "expand-0006-in.jsonld", + "expect": "expand-0006-out.jsonld" + }, { + "@id": "#t0007", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "date type-coercion", + "purpose": "Expand strings to expanded value with @type: xsd:dateTime", + "input": "expand-0007-in.jsonld", + "expect": "expand-0007-out.jsonld" + }, { + "@id": "#t0008", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "@value with @language", + "purpose": "Keep expanded values with @language, drop non-conforming value objects containing just @language", + "input": "expand-0008-in.jsonld", + "expect": "expand-0008-out.jsonld" + }, { + "@id": "#t0009", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "@graph with terms", + "purpose": "Use of @graph to contain multiple nodes within array", + "input": "expand-0009-in.jsonld", + "expect": "expand-0009-out.jsonld" + }, { + "@id": "#t0010", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "native types", + "purpose": "Expanding native scalar retains native scalar within expanded value", + "input": "expand-0010-in.jsonld", + "expect": "expand-0010-out.jsonld" + }, { + "@id": "#t0011", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "coerced @id", + "purpose": "A value of a property with @type: @id coercion expands to a node reference", + "input": "expand-0011-in.jsonld", + "expect": "expand-0011-out.jsonld" + }, { + "@id": "#t0012", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "@graph with embed", + "purpose": "Use of @graph to contain multiple nodes within array", + "input": "expand-0012-in.jsonld", + "expect": "expand-0012-out.jsonld" + }, { + "@id": "#t0013", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "expand already expanded", + "purpose": "Expand does not mess up already expanded document", + "input": "expand-0013-in.jsonld", + "expect": "expand-0013-out.jsonld" + }, { + "@id": "#t0014", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "@set of @value objects with keyword aliases", + "purpose": "Expanding aliased @set and @value", + "input": "expand-0014-in.jsonld", + "expect": "expand-0014-out.jsonld" + }, { + "@id": "#t0015", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "collapse set of sets, keep empty lists", + "purpose": "An array of multiple @set nodes are collapsed into a single array", + "input": "expand-0015-in.jsonld", + "expect": "expand-0015-out.jsonld" + }, { + "@id": "#t0016", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "context reset", + "purpose": "Setting @context to null within an embedded object resets back to initial context state", + "input": "expand-0016-in.jsonld", + "expect": "expand-0016-out.jsonld" + }, { + "@id": "#t0017", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "@graph and @id aliased", + "purpose": "Expanding with @graph and @id aliases", + "input": "expand-0017-in.jsonld", + "expect": "expand-0017-out.jsonld" + }, { + "@id": "#t0018", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "override default @language", + "purpose": "override default @language in terms; only language-tag strings", + "input": "expand-0018-in.jsonld", + "expect": "expand-0018-out.jsonld" + }, { + "@id": "#t0019", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "remove @value = null", + "purpose": "Expanding a value of null removes the value", + "input": "expand-0019-in.jsonld", + "expect": "expand-0019-out.jsonld" + }, { + "@id": "#t0020", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "do not remove @graph if not at top-level", + "purpose": "@graph used under a node is retained", + "input": "expand-0020-in.jsonld", + "expect": "expand-0020-out.jsonld" + }, { + "@id": "#t0021", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "do not remove @graph at top-level if not only property", + "purpose": "@graph used at the top level is retained if there are other properties", + "input": "expand-0021-in.jsonld", + "expect": "expand-0021-out.jsonld" + }, { + "@id": "#t0022", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "expand value with default language", + "purpose": "Expanding with a default language applies that language to string values", + "input": "expand-0022-in.jsonld", + "expect": "expand-0022-out.jsonld" + }, { + "@id": "#t0023", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Expanding list/set with coercion", + "purpose": "Expanding lists and sets with properties having coercion coerces list/set values", + "input": "expand-0023-in.jsonld", + "expect": "expand-0023-out.jsonld" + }, { + "@id": "#t0024", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Multiple contexts", + "purpose": "Tests that contexts in an array are merged", + "input": "expand-0024-in.jsonld", + "expect": "expand-0024-out.jsonld" + }, { + "@id": "#t0025", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Problematic IRI expansion tests", + "purpose": "Expanding different kinds of terms and Compact IRIs", + "input": "expand-0025-in.jsonld", + "expect": "expand-0025-out.jsonld" + }, { + "@id": "#t0026", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Term definition with @id: @type", + "purpose": "Expanding term mapping to @type uses @type syntax", + "input": "expand-0026-in.jsonld", + "expect": "expand-0026-out.jsonld" + }, { + "@id": "#t0027", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Duplicate values in @list and @set", + "purpose": "Duplicate values in @list and @set are not merged", + "input": "expand-0027-in.jsonld", + "expect": "expand-0027-out.jsonld" + }, { + "@id": "#t0028", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Use @vocab in properties and @type but not in @id", + "purpose": "@vocab is used to compact properties and @type, but is not used for @id", + "input": "expand-0028-in.jsonld", + "expect": "expand-0028-out.jsonld" + }, { + "@id": "#t0029", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Relative IRIs", + "purpose": "@base is used to compact @id; test with different relative IRIs", + "input": "expand-0029-in.jsonld", + "expect": "expand-0029-out.jsonld" + }, { + "@id": "#t0030", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Language maps", + "purpose": "Language Maps expand values to include @language", + "input": "expand-0030-in.jsonld", + "expect": "expand-0030-out.jsonld" + }, { + "@id": "#t0031", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "type-coercion of native types", + "purpose": "Expanding native types with type coercion adds the coerced type to an expanded value representation and retains the native value representation", + "input": "expand-0031-in.jsonld", + "expect": "expand-0031-out.jsonld" + }, { + "@id": "#t0032", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Null term and @vocab", + "purpose": "Mapping a term to null decouples it from @vocab", + "input": "expand-0032-in.jsonld", + "expect": "expand-0032-out.jsonld" + }, { + "@id": "#t0033", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Using @vocab with with type-coercion", + "purpose": "Verifies that terms can be defined using @vocab", + "input": "expand-0033-in.jsonld", + "expect": "expand-0033-out.jsonld" + }, { + "@id": "#t0034", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Multiple properties expanding to the same IRI", + "purpose": "Verifies multiple values from separate terms are deterministically made multiple values of the IRI associated with the terms", + "input": "expand-0034-in.jsonld", + "expect": "expand-0034-out.jsonld" + }, { + "@id": "#t0035", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Language maps with @vocab, default language, and colliding property", + "purpose": "Pathological tests of language maps", + "input": "expand-0035-in.jsonld", + "expect": "expand-0035-out.jsonld" + }, { + "@id": "#t0036", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Expanding @index", + "purpose": "Expanding index maps for terms defined with @container: @index", + "input": "expand-0036-in.jsonld", + "expect": "expand-0036-out.jsonld" + }, { + "@id": "#t0037", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Expanding @reverse", + "purpose": "Expanding @reverse keeps @reverse", + "input": "expand-0037-in.jsonld", + "expect": "expand-0037-out.jsonld" + }, { + "@id": "#t0038", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Expanding blank node labels", + "purpose": "Blank nodes are not relabeled during expansion", + "input": "expand-0038-in.jsonld", + "expect": "expand-0038-out.jsonld" + }, { + "@id": "#t0039", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Using terms in a reverse-maps", + "purpose": "Terms within @reverse are expanded", + "input": "expand-0039-in.jsonld", + "expect": "expand-0039-out.jsonld" + }, { + "@id": "#t0040", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "language and index expansion on non-objects", + "purpose": "Only invoke language and index map expansion if the value is a JSON object", + "input": "expand-0040-in.jsonld", + "expect": "expand-0040-out.jsonld" + }, { + "@id": "#t0041", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "@language: null", + "name": "@language: null resets the default language", + "input": "expand-0041-in.jsonld", + "expect": "expand-0041-out.jsonld" + }, { + "@id": "#t0042", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Reverse properties", + "purpose": "Expanding terms defined as reverse properties uses @reverse in expanded document", + "input": "expand-0042-in.jsonld", + "expect": "expand-0042-out.jsonld" + }, { + "@id": "#t0043", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Using reverse properties inside a @reverse-container", + "purpose": "Expanding a reverse property within a @reverse undoes both reversals", + "input": "expand-0043-in.jsonld", + "expect": "expand-0043-out.jsonld" + }, { + "@id": "#t0044", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Index maps with language mappings", + "purpose": "Ensure index maps use language mapping", + "input": "expand-0044-in.jsonld", + "expect": "expand-0044-out.jsonld" + }, { + "@id": "#t0045", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Top-level value objects", + "purpose": "Expanding top-level value objects causes them to be removed", + "input": "expand-0045-in.jsonld", + "expect": "expand-0045-out.jsonld" + }, { + "@id": "#t0046", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Free-floating nodes", + "purpose": "Expanding free-floating nodes causes them to be removed", + "input": "expand-0046-in.jsonld", + "expect": "expand-0046-out.jsonld" + }, { + "@id": "#t0047", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Free-floating values in sets and free-floating lists", + "purpose": "Free-floating values in sets are removed, free-floating lists are removed completely", + "input": "expand-0047-in.jsonld", + "expect": "expand-0047-out.jsonld" + }, { + "@id": "#t0048", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Terms are ignored in @id", + "purpose": "Values of @id are not expanded as terms", + "input": "expand-0048-in.jsonld", + "expect": "expand-0048-out.jsonld" + }, { + "@id": "#t0049", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "String values of reverse properties", + "purpose": "String values of a reverse property with @type: @id are treated as IRIs", + "input": "expand-0049-in.jsonld", + "expect": "expand-0049-out.jsonld" + }, { + "@id": "#t0050", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Term definitions with prefix separate from prefix definitions", + "purpose": "Term definitions using compact IRIs don't inherit the definitions of the prefix", + "input": "expand-0050-in.jsonld", + "expect": "expand-0050-out.jsonld" + }, { + "@id": "#t0051", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Expansion of keyword aliases in term definitions", + "purpose": "Expanding terms which are keyword aliases", + "input": "expand-0051-in.jsonld", + "expect": "expand-0051-out.jsonld" + }, { + "@id": "#t0052", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "@vocab-relative IRIs in term definitions", + "purpose": "If @vocab is defined, term definitions are expanded relative to @vocab", + "input": "expand-0052-in.jsonld", + "expect": "expand-0052-out.jsonld" + }, { + "@id": "#t0053", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Expand absolute IRI with @type: @vocab", + "purpose": "Expanding values of properties of @type: @vocab does not further expand absolute IRIs", + "input": "expand-0053-in.jsonld", + "expect": "expand-0053-out.jsonld" + }, { + "@id": "#t0054", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Expand term with @type: @vocab", + "purpose": "Expanding values of properties of @type: @vocab does not expand term values", + "input": "expand-0054-in.jsonld", + "expect": "expand-0054-out.jsonld" + }, { + "@id": "#t0055", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Expand @vocab-relative term with @type: @vocab", + "purpose": "Expanding values of properties of @type: @vocab expands relative IRIs using @vocab", + "input": "expand-0055-in.jsonld", + "expect": "expand-0055-out.jsonld" + }, { + "@id": "#t0056", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Use terms with @type: @vocab but not with @type: @id", + "purpose": "Checks that expansion uses appropriate base depending on term definition having @type @id or @vocab", + "input": "expand-0056-in.jsonld", + "expect": "expand-0056-out.jsonld" + }, { + "@id": "#t0057", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Expand relative IRI with @type: @vocab", + "purpose": "Relative values of terms with @type: @vocab expand relative to @vocab", + "input": "expand-0057-in.jsonld", + "expect": "expand-0057-out.jsonld" + }, { + "@id": "#t0058", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Expand compact IRI with @type: @vocab", + "purpose": "Compact IRIs are expanded normally even if term has @type: @vocab", + "input": "expand-0058-in.jsonld", + "expect": "expand-0058-out.jsonld" + }, { + "@id": "#t0059", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Reset @vocab by setting it to null", + "purpose": "Setting @vocab to null removes a previous definition", + "input": "expand-0059-in.jsonld", + "expect": "expand-0059-out.jsonld" + }, { + "@id": "#t0060", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Overwrite document base with @base and reset it again", + "purpose": "Setting @base to an IRI and then resetting it to nil", + "input": "expand-0060-in.jsonld", + "expect": "expand-0060-out.jsonld" + }, { + "@id": "#t0061", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Coercing native types to arbitrary datatypes", + "purpose": "Expanding native types when coercing to arbitrary datatypes", + "input": "expand-0061-in.jsonld", + "expect": "expand-0061-out.jsonld" + }, { + "@id": "#t0062", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Various relative IRIs with with @base", + "purpose": "Pathological relative IRIs", + "input": "expand-0062-in.jsonld", + "expect": "expand-0062-out.jsonld" + }, { + "@id": "#t0063", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Reverse property and index container", + "purpose": "Expaning reverse properties with an index-container", + "input": "expand-0063-in.jsonld", + "expect": "expand-0063-out.jsonld" + }, { + "@id": "#t0064", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "bnode values of reverse properties", + "purpose": "Expand reverse property whose values are unlabeled blank nodes", + "input": "expand-0064-in.jsonld", + "expect": "expand-0064-out.jsonld" + }, { + "@id": "#t0065", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Drop unmapped keys in reverse map", + "purpose": "Keys that are not mapped to an IRI in a reverse-map are dropped", + "input": "expand-0065-in.jsonld", + "expect": "expand-0065-out.jsonld" + }, { + "@id": "#t0066", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Reverse-map keys with @vocab", + "purpose": "Expand uses @vocab to expand keys in reverse-maps", + "input": "expand-0066-in.jsonld", + "expect": "expand-0066-out.jsonld" + }, { + "@id": "#t0067", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "prefix://suffix not a compact IRI", + "purpose": "prefix:suffix values are not interpreted as compact IRIs if suffix begins with two slashes", + "input": "expand-0067-in.jsonld", + "expect": "expand-0067-out.jsonld" + }, { + "@id": "#t0068", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "_:suffix values are not a compact IRI", + "purpose": "prefix:suffix values are not interpreted as compact IRIs if prefix is an underscore", + "input": "expand-0068-in.jsonld", + "expect": "expand-0068-out.jsonld" + }, { + "@id": "#t0069", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Compact IRI as term with type mapping", + "purpose": "Redefine compact IRI to define type mapping using the compact IRI itself as value of @id", + "input": "expand-0069-in.jsonld", + "expect": "expand-0069-out.jsonld" + }, { + "@id": "#t0070", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Compact IRI as term defined using equivalent compact IRI", + "purpose": "Redefine compact IRI to define type mapping using the compact IRI itself as string value", + "input": "expand-0070-in.jsonld", + "expect": "expand-0070-out.jsonld" + }, { + "@id": "#t0071", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Redefine terms looking like compact IRIs", + "purpose": "Term definitions may look like compact IRIs", + "input": "expand-0071-in.jsonld", + "expect": "expand-0071-out.jsonld" + }, { + "@id": "#t0072", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Redefine term using @vocab, not itself", + "purpose": "Redefining a term as itself when @vocab is defined uses @vocab, not previous term definition", + "input": "expand-0072-in.jsonld", + "expect": "expand-0072-out.jsonld" + }, { + "@id": "#t0073", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "@context not first property", + "purpose": "Objects are unordered, so serialized node definition containing @context may have @context at the end of the node definition", + "input": "expand-0073-in.jsonld", + "expect": "expand-0073-out.jsonld" + }, { + "@id": "#t0074", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "@id not first property", + "purpose": "Objects are unordered, so serialized node definition containing @id may have @id at the end of the node definition", + "input": "expand-0074-in.jsonld", + "expect": "expand-0074-out.jsonld" + }, { + "@id": "#t0075", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "@vocab as blank node identifier", + "purpose": "Use @vocab to map all properties to blank node identifiers", + "input": "expand-0075-in.jsonld", + "expect": "expand-0075-out.jsonld" + }, { + "@id": "#t0076", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "base option overrides document location", + "purpose": "Use of the base option overrides the document location", + "option": { + "base": "http://example/base/" + }, + "input": "expand-0076-in.jsonld", + "expect": "expand-0076-out.jsonld" + }, { + "@id": "#t0077", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "expandContext option", + "purpose": "Use of the expandContext option to expand the input document", + "option": { + "expandContext": "expand-0077-context.jsonld" + }, + "input": "expand-0077-in.jsonld", + "expect": "expand-0077-out.jsonld" + } + ] +} diff --git a/test/json-ld.net.tests/Sorting/W3C/flatten-0002-in.jsonld b/test/json-ld.net.tests/Sorting/W3C/flatten-0002-in.jsonld new file mode 100644 index 0000000..e4598e5 --- /dev/null +++ b/test/json-ld.net.tests/Sorting/W3C/flatten-0002-in.jsonld @@ -0,0 +1,18 @@ +{ + "@context": { + "t1": "http://example.com/t1", + "t2": "http://example.com/t2", + "term1": "http://example.com/term1", + "term2": "http://example.com/term2", + "term3": "http://example.com/term3", + "term4": "http://example.com/term4", + "term5": "http://example.com/term5" + }, + "@id": "http://example.com/id1", + "@type": "t1", + "term1": "v1", + "term2": {"@value": "v2", "@type": "t2"}, + "term3": {"@value": "v3", "@language": "en"}, + "term4": 4, + "term5": [50, 51] +} diff --git a/test/json-ld.net.tests/Sorting/W3C/flatten-0002-out.jsonld b/test/json-ld.net.tests/Sorting/W3C/flatten-0002-out.jsonld new file mode 100644 index 0000000..6c72e2d --- /dev/null +++ b/test/json-ld.net.tests/Sorting/W3C/flatten-0002-out.jsonld @@ -0,0 +1,38 @@ +[ + { + "@id": "http://example.com/id1", + "@type": [ + "http://example.com/t1" + ], + "http://example.com/term1": [ + { + "@value": "v1" + } + ], + "http://example.com/term2": [ + { + "@type": "http://example.com/t2", + "@value": "v2" + } + ], + "http://example.com/term3": [ + { + "@language": "en", + "@value": "v3" + } + ], + "http://example.com/term4": [ + { + "@value": 4 + } + ], + "http://example.com/term5": [ + { + "@value": 50 + }, + { + "@value": 51 + } + ] + } +] diff --git a/test/json-ld.net.tests/Sorting/W3C/flatten-manifest.jsonld b/test/json-ld.net.tests/Sorting/W3C/flatten-manifest.jsonld new file mode 100644 index 0000000..cea88ae --- /dev/null +++ b/test/json-ld.net.tests/Sorting/W3C/flatten-manifest.jsonld @@ -0,0 +1,330 @@ +{ + "@context": "http://json-ld.org/test-suite/context.jsonld", + "@id": "", + "@type": "mf:Manifest", + "name": "Flattening", + "description": "JSON-LD flattening tests use object comparison.", + "baseIri": "http://json-ld.org/test-suite/tests/", + "sequence": [ + { + "@id": "#t0001", + "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], + "name": "drop free-floating nodes", + "purpose": "Flattening drops unreferenced nodes having only @id", + "input": "flatten-0001-in.jsonld", + "expect": "flatten-0001-out.jsonld" + }, { + "@id": "#t0002", + "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], + "name": "basic", + "purpose": "Flattening terms with different types of values", + "input": "flatten-0002-in.jsonld", + "expect": "flatten-0002-out.jsonld" + }, { + "@id": "#t0003", + "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], + "name": "drop null and unmapped properties", + "purpose": "Verifies that null values and unmapped properties are removed from expanded output", + "input": "flatten-0003-in.jsonld", + "expect": "flatten-0003-out.jsonld" + }, { + "@id": "#t0004", + "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], + "name": "optimize @set, keep empty arrays", + "purpose": "Uses of @set are removed in expansion; values of @set, or just plain values which are empty arrays are retained", + "input": "flatten-0004-in.jsonld", + "expect": "flatten-0004-out.jsonld" + }, { + "@id": "#t0005", + "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], + "name": "do not expand aliased @id/@type", + "purpose": "If a keyword is aliased, it is not used when flattening", + "input": "flatten-0005-in.jsonld", + "expect": "flatten-0005-out.jsonld" + }, { + "@id": "#t0006", + "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], + "name": "alias keywords", + "purpose": "Aliased keywords expand in resulting document", + "input": "flatten-0006-in.jsonld", + "expect": "flatten-0006-out.jsonld" + }, { + "@id": "#t0007", + "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], + "name": "date type-coercion", + "purpose": "Expand strings to expanded value with @type: xsd:dateTime", + "input": "flatten-0007-in.jsonld", + "expect": "flatten-0007-out.jsonld" + }, { + "@id": "#t0008", + "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], + "name": "@value with @language", + "purpose": "Keep expanded values with @language, drop non-conforming value objects containing just @language", + "input": "flatten-0008-in.jsonld", + "expect": "flatten-0008-out.jsonld" + }, { + "@id": "#t0009", + "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], + "name": "@graph with terms", + "purpose": "Use of @graph to contain multiple nodes within array", + "input": "flatten-0009-in.jsonld", + "expect": "flatten-0009-out.jsonld" + }, { + "@id": "#t0010", + "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], + "name": "native types", + "purpose": "Flattening native scalar retains native scalar within expanded value", + "input": "flatten-0010-in.jsonld", + "expect": "flatten-0010-out.jsonld" + }, { + "@id": "#t0011", + "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], + "name": "coerced @id", + "purpose": "A value of a property with @type: @id coercion expands to a node reference", + "input": "flatten-0011-in.jsonld", + "expect": "flatten-0011-out.jsonld" + }, { + "@id": "#t0012", + "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], + "name": "@graph with embed", + "purpose": "Flattening objects containing chained objects flattens all objects", + "input": "flatten-0012-in.jsonld", + "expect": "flatten-0012-out.jsonld" + }, { + "@id": "#t0013", + "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], + "name": "flatten already expanded", + "purpose": "Flattening an expanded/flattened document maintains input document", + "input": "flatten-0013-in.jsonld", + "expect": "flatten-0013-out.jsonld" + }, { + "@id": "#t0014", + "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], + "name": "@set of @value objects with keyword aliases", + "purpose": "Flattening aliased @set and @value", + "input": "flatten-0014-in.jsonld", + "expect": "flatten-0014-out.jsonld" + }, { + "@id": "#t0015", + "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], + "name": "collapse set of sets, keep empty lists", + "purpose": "An array of multiple @set nodes are collapsed into a single array", + "input": "flatten-0015-in.jsonld", + "expect": "flatten-0015-out.jsonld" + }, { + "@id": "#t0016", + "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], + "name": "context reset", + "purpose": "Setting @context to null within an embedded object resets back to initial context state", + "input": "flatten-0016-in.jsonld", + "expect": "flatten-0016-out.jsonld" + }, { + "@id": "#t0017", + "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], + "name": "@graph and @id aliased", + "purpose": "Flattening with @graph and @id aliases", + "input": "flatten-0017-in.jsonld", + "expect": "flatten-0017-out.jsonld" + }, { + "@id": "#t0018", + "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], + "name": "override default @language", + "purpose": "override default @language in terms; only language-tag strings", + "input": "flatten-0018-in.jsonld", + "expect": "flatten-0018-out.jsonld" + }, { + "@id": "#t0019", + "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], + "name": "remove @value = null", + "purpose": "Flattening a value of null removes the value", + "input": "flatten-0019-in.jsonld", + "expect": "flatten-0019-out.jsonld" + }, { + "@id": "#t0020", + "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], + "name": "do not remove @graph if not at top-level", + "purpose": "@graph used under a node is retained", + "input": "flatten-0020-in.jsonld", + "expect": "flatten-0020-out.jsonld" + }, { + "@id": "#t0021", + "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], + "name": "do not remove @graph at top-level if not only property", + "purpose": "@graph used at the top level is retained if there are other properties", + "input": "flatten-0021-in.jsonld", + "expect": "flatten-0021-out.jsonld" + }, { + "@id": "#t0022", + "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], + "name": "flatten value with default language", + "purpose": "Flattening with a default language applies that language to string values", + "input": "flatten-0022-in.jsonld", + "expect": "flatten-0022-out.jsonld" + }, { + "@id": "#t0023", + "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], + "name": "Flattening list/set with coercion", + "purpose": "Flattening lists and sets with properties having coercion coerces list/set values", + "input": "flatten-0023-in.jsonld", + "expect": "flatten-0023-out.jsonld" + }, { + "@id": "#t0024", + "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], + "name": "Multiple contexts", + "purpose": "Tests that contexts in an array are merged", + "input": "flatten-0024-in.jsonld", + "expect": "flatten-0024-out.jsonld" + }, { + "@id": "#t0025", + "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], + "name": "Problematic IRI flattening tests", + "purpose": "Flattening different kinds of terms and Compact IRIs", + "input": "flatten-0025-in.jsonld", + "expect": "flatten-0025-out.jsonld" + }, { + "@id": "#t0026", + "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], + "name": "Term definition with @id: @type", + "purpose": "Flattening term mapping to @type uses @type syntax", + "input": "flatten-0026-in.jsonld", + "expect": "flatten-0026-out.jsonld" + }, { + "@id": "#t0027", + "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], + "name": "Duplicate values in @list and @set", + "purpose": "Duplicate values in @list and @set are not merged", + "input": "flatten-0027-in.jsonld", + "expect": "flatten-0027-out.jsonld" + }, { + "@id": "#t0028", + "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], + "name": "Use @vocab in properties and @type but not in @id", + "purpose": "@vocab is used to compact properties and @type, but is not used for @id", + "input": "flatten-0028-in.jsonld", + "expect": "flatten-0028-out.jsonld" + }, { + "@id": "#t0029", + "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], + "name": "Relative IRIs", + "purpose": "@base is used to compact @id; test with different relative IRIs", + "input": "flatten-0029-in.jsonld", + "expect": "flatten-0029-out.jsonld" + }, { + "@id": "#t0030", + "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], + "name": "Language maps", + "purpose": "Language Maps expand values to include @language", + "input": "flatten-0030-in.jsonld", + "expect": "flatten-0030-out.jsonld" + }, { + "@id": "#t0031", + "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], + "name": "type-coercion of native types", + "purpose": "Flattening native types with type coercion adds the coerced type to an expanded value representation and retains the native value representation", + "input": "flatten-0031-in.jsonld", + "expect": "flatten-0031-out.jsonld" + }, { + "@id": "#t0032", + "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], + "name": "Null term and @vocab", + "purpose": "Mapping a term to null decouples it from @vocab", + "input": "flatten-0032-in.jsonld", + "expect": "flatten-0032-out.jsonld" + }, { + "@id": "#t0033", + "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], + "name": "Using @vocab with with type-coercion", + "purpose": "Verifies that terms can be defined using @vocab", + "input": "flatten-0033-in.jsonld", + "expect": "flatten-0033-out.jsonld" + }, { + "@id": "#t0034", + "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], + "name": "Multiple properties expanding to the same IRI", + "purpose": "Verifies multiple values from separate terms are deterministically made multiple values of the IRI associated with the terms", + "input": "flatten-0034-in.jsonld", + "expect": "flatten-0034-out.jsonld" + }, { + "@id": "#t0035", + "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], + "name": "Language maps with @vocab, default language, and colliding property", + "purpose": "Pathological tests of language maps", + "input": "flatten-0035-in.jsonld", + "expect": "flatten-0035-out.jsonld" + }, { + "@id": "#t0036", + "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], + "name": "Flattening @index", + "purpose": "Flattening index maps for terms defined with @container: @index", + "input": "flatten-0036-in.jsonld", + "expect": "flatten-0036-out.jsonld" + }, { + "@id": "#t0037", + "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], + "name": "Flattening reverse properties", + "purpose": "Flattening @reverse keeps @reverse", + "input": "flatten-0037-in.jsonld", + "expect": "flatten-0037-out.jsonld" + }, { + "@id": "#t0038", + "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], + "name": "Flattening blank node labels", + "purpose": "Blank nodes are not relabeled during expansion", + "input": "flatten-0038-in.jsonld", + "expect": "flatten-0038-out.jsonld" + }, { + "@id": "#t0039", + "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], + "name": "Using terms in a reverse-maps", + "purpose": "Terms within @reverse are expanded", + "input": "flatten-0039-in.jsonld", + "expect": "flatten-0039-out.jsonld" + }, { + "@id": "#t0040", + "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], + "name": "language and index expansion on non-objects", + "purpose": "Only invoke language and index map expansion if the value is a JSON object", + "input": "flatten-0040-in.jsonld", + "expect": "flatten-0040-out.jsonld" + }, { + "@id": "#t0041", + "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], + "name": "Free-floating sets and lists", + "purpose": "Free-floating values in sets are removed, free-floating lists are removed completely", + "input": "flatten-0041-in.jsonld", + "expect": "flatten-0041-out.jsonld" + }, { + "@id": "#t0042", + "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], + "name": "List objects not equivalent", + "purpose": "Lists objects are implicit unlabeled blank nodes and thus never equivalent", + "input": "flatten-0042-in.jsonld", + "expect": "flatten-0042-out.jsonld" + }, { + "@id": "#t0043", + "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], + "name": "Sample test manifest extract", + "purpose": "Flatten a test manifest", + "input": "flatten-0043-in.jsonld", + "expect": "flatten-0043-out.jsonld" + }, { + "@id": "#t0044", + "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], + "name": "compactArrays option", + "purpose": "Setting compactArrays to false causes single element arrays to be retained", + "option": { + "compactArrays": false + }, + "input": "flatten-0044-in.jsonld", + "context": "flatten-0044-context.jsonld", + "expect": "flatten-0044-out.jsonld" + }, { + "@id": "#t0045", + "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], + "name": "Blank nodes with reverse properties", + "purpose": "Proper (re-)labeling of blank nodes if used with reverse properties.", + "input": "flatten-0045-in.jsonld", + "expect": "flatten-0045-out.jsonld" + } + ] +} diff --git a/test/json-ld.net.tests/Sorting/W3C/frame-0002-in.jsonld b/test/json-ld.net.tests/Sorting/W3C/frame-0002-in.jsonld new file mode 100644 index 0000000..ba0b5b1 --- /dev/null +++ b/test/json-ld.net.tests/Sorting/W3C/frame-0002-in.jsonld @@ -0,0 +1,28 @@ +{ + "@context": { + "dc": "http://purl.org/dc/elements/1.1/", + "ex": "http://example.org/vocab#", + "ex:contains": {"@type": "@id"} + }, + "@graph": [ + { + "@id": "http://example.org/test/#library", + "@type": "ex:Library", + "ex:contains": "http://example.org/test#book" + }, + { + "@id": "http://example.org/test#book", + "@type": "ex:Book", + "dc:contributor": "Writer", + "dc:title": "My Book", + "ex:contains": "http://example.org/test#chapter" + }, + { + "@id": "http://example.org/test#chapter", + "@type": "ex:Chapter", + "dc:description": "Fun", + "dc:title": "Chapter One", + "ex:act": "ex:ActOne" + } + ] +} \ No newline at end of file diff --git a/test/json-ld.net.tests/Sorting/W3C/frame-0002-out.jsonld b/test/json-ld.net.tests/Sorting/W3C/frame-0002-out.jsonld new file mode 100644 index 0000000..db497ad --- /dev/null +++ b/test/json-ld.net.tests/Sorting/W3C/frame-0002-out.jsonld @@ -0,0 +1,23 @@ +{ + "@context": { + "dc": "http://purl.org/dc/elements/1.1/", + "ex": "http://example.org/vocab#" + }, + "@graph": [{ + "@id": "http://example.org/test/#library", + "@type": "ex:Library", + "ex:contains": { + "@id": "http://example.org/test#book", + "@type": "ex:Book", + "dc:contributor": "Writer", + "dc:title": "My Book", + "ex:contains": { + "@id": "http://example.org/test#chapter", + "@type": "ex:Chapter", + "dc:description": "Fun", + "dc:title": "Chapter One", + "ex:act": "ex:ActOne" + } + } + }] +} \ No newline at end of file diff --git a/test/json-ld.net.tests/Sorting/W3C/fromRdf-context.jsonld b/test/json-ld.net.tests/Sorting/W3C/fromRdf-context.jsonld new file mode 100644 index 0000000..89933fe --- /dev/null +++ b/test/json-ld.net.tests/Sorting/W3C/fromRdf-context.jsonld @@ -0,0 +1,11 @@ +{ + "@context": { + "object1": { "@id": "http://example.org/object/1" }, + "object2": { "@id": "http://example.org/object/2" }, + "object3": { "@id": "http://example.org/object/3" }, + "value": { + "@id": "http://example.org/value", + "@value": "@id" + } + } +} diff --git a/test/json-ld.net.tests/Sorting/W3C/fromRdf-in.json b/test/json-ld.net.tests/Sorting/W3C/fromRdf-in.json new file mode 100644 index 0000000..9b9e54e --- /dev/null +++ b/test/json-ld.net.tests/Sorting/W3C/fromRdf-in.json @@ -0,0 +1,58 @@ +{ + "quads": [ + { + "graph": "http://example.org/node/3", + "subject": "http://example.org/object/3", + "predicate": "http://example.org/value", + "value": "n3-o3-value" + }, + { + "graph": "http://example.org/node/3", + "subject": "http://example.org/object/1", + "predicate": "http://example.org/value", + "value": "n3-o1-value" + }, + { + "graph": "http://example.org/node/3", + "subject": "http://example.org/object/2", + "predicate": "http://example.org/value", + "value": "n3-o2-value" + }, + { + "graph": "http://example.org/node/1", + "subject": "http://example.org/object/3", + "predicate": "http://example.org/value", + "value": "n1-o3-value" + }, + { + "graph": "http://example.org/node/1", + "subject": "http://example.org/object/1", + "predicate": "http://example.org/value", + "value": "n1-o1-value" + }, + { + "graph": "http://example.org/node/1", + "subject": "http://example.org/object/2", + "predicate": "http://example.org/value", + "value": "n1-o2-value" + }, + { + "graph": "http://example.org/node/2", + "subject": "http://example.org/object/3", + "predicate": "http://example.org/value", + "value": "n2-o3-value" + }, + { + "graph": "http://example.org/node/2", + "subject": "http://example.org/object/1", + "predicate": "http://example.org/value", + "value": "n2-o1-value" + }, + { + "graph": "http://example.org/node/2", + "subject": "http://example.org/object/2", + "predicate": "http://example.org/value", + "value": "n2-o2-value" + } + ] +} \ No newline at end of file diff --git a/test/json-ld.net.tests/Sorting/W3C/fromRdf-manifest.jsonld b/test/json-ld.net.tests/Sorting/W3C/fromRdf-manifest.jsonld new file mode 100644 index 0000000..8478617 --- /dev/null +++ b/test/json-ld.net.tests/Sorting/W3C/fromRdf-manifest.jsonld @@ -0,0 +1,41 @@ +{ + "@type": "mf:Manifest", + "test-context": "fromRdf-context.jsonld", + "name": "From RDF", + "description": "JSON-LD sorting graphs and nodes when running compact", + "input": "fromRdf-in.json", + "sequence": [ + { + "@id": "#t0001", + "sort-type": "jld:GraphsAndNodes", + "test-type": "jld:FromRDF", + "name": "sort graphs and nodes", + "purpose": "graphs and nodes sorted when running FromRDF", + "expect": "fromRdf-out-sort-graphs-and-nodes.jsonld" + }, + { + "@id": "#t0002", + "sort-type": "jld:Graphs", + "test-type": "jld:FromRDF", + "name": "sort graphs only", + "purpose": "graphs sorted when running FromRDF", + "expect": "fromRdf-out-sort-graphs.jsonld" + }, + { + "@id": "#t0003", + "sort-type": "jld:Nodes", + "test-type": "jld:FromRDF", + "name": "sort graph nodes only", + "purpose": "graph nodes sorted when running FromRDF", + "expect": "fromRdf-out-sort-graph-nodes.jsonld" + }, + { + "@id": "#t0004", + "sort-type": "jld:None", + "test-type": "jld:FromRDF", + "name": "sort nothing", + "purpose": "sort nothing running FromRDF", + "expect": "fromRdf-out-no-sorting.jsonld" + } + ] +} diff --git a/test/json-ld.net.tests/Sorting/W3C/fromRdf-out-no-sorting.jsonld b/test/json-ld.net.tests/Sorting/W3C/fromRdf-out-no-sorting.jsonld new file mode 100644 index 0000000..b5920e3 --- /dev/null +++ b/test/json-ld.net.tests/Sorting/W3C/fromRdf-out-no-sorting.jsonld @@ -0,0 +1,89 @@ +[ + { + "@id": "http://example.org/node/3", + "@graph": [ + { + "@id": "http://example.org/object/3", + "http://example.org/value": [ + { + "@id": "n3-o3-value" + } + ] + }, + { + "@id": "http://example.org/object/1", + "http://example.org/value": [ + { + "@id": "n3-o1-value" + } + ] + }, + { + "@id": "http://example.org/object/2", + "http://example.org/value": [ + { + "@id": "n3-o2-value" + } + ] + } + ] + }, + { + "@id": "http://example.org/node/1", + "@graph": [ + { + "@id": "http://example.org/object/3", + "http://example.org/value": [ + { + "@id": "n1-o3-value" + } + ] + }, + { + "@id": "http://example.org/object/1", + "http://example.org/value": [ + { + "@id": "n1-o1-value" + } + ] + }, + { + "@id": "http://example.org/object/2", + "http://example.org/value": [ + { + "@id": "n1-o2-value" + } + ] + } + ] + }, + { + "@id": "http://example.org/node/2", + "@graph": [ + { + "@id": "http://example.org/object/3", + "http://example.org/value": [ + { + "@id": "n2-o3-value" + } + ] + }, + { + "@id": "http://example.org/object/1", + "http://example.org/value": [ + { + "@id": "n2-o1-value" + } + ] + }, + { + "@id": "http://example.org/object/2", + "http://example.org/value": [ + { + "@id": "n2-o2-value" + } + ] + } + ] + } +] \ No newline at end of file diff --git a/test/json-ld.net.tests/Sorting/W3C/fromRdf-out-sort-graph-nodes.jsonld b/test/json-ld.net.tests/Sorting/W3C/fromRdf-out-sort-graph-nodes.jsonld new file mode 100644 index 0000000..0fcc4c8 --- /dev/null +++ b/test/json-ld.net.tests/Sorting/W3C/fromRdf-out-sort-graph-nodes.jsonld @@ -0,0 +1,89 @@ +[ + { + "@id": "http://example.org/node/3", + "@graph": [ + { + "@id": "http://example.org/object/1", + "http://example.org/value": [ + { + "@id": "n3-o1-value" + } + ] + }, + { + "@id": "http://example.org/object/2", + "http://example.org/value": [ + { + "@id": "n3-o2-value" + } + ] + }, + { + "@id": "http://example.org/object/3", + "http://example.org/value": [ + { + "@id": "n3-o3-value" + } + ] + } + ] + }, + { + "@id": "http://example.org/node/1", + "@graph": [ + { + "@id": "http://example.org/object/1", + "http://example.org/value": [ + { + "@id": "n1-o1-value" + } + ] + }, + { + "@id": "http://example.org/object/2", + "http://example.org/value": [ + { + "@id": "n1-o2-value" + } + ] + }, + { + "@id": "http://example.org/object/3", + "http://example.org/value": [ + { + "@id": "n1-o3-value" + } + ] + } + ] + }, + { + "@id": "http://example.org/node/2", + "@graph": [ + { + "@id": "http://example.org/object/1", + "http://example.org/value": [ + { + "@id": "n2-o1-value" + } + ] + }, + { + "@id": "http://example.org/object/2", + "http://example.org/value": [ + { + "@id": "n2-o2-value" + } + ] + }, + { + "@id": "http://example.org/object/3", + "http://example.org/value": [ + { + "@id": "n2-o3-value" + } + ] + } + ] + } +] \ No newline at end of file diff --git a/test/json-ld.net.tests/Sorting/W3C/fromRdf-out-sort-graphs-and-nodes.jsonld b/test/json-ld.net.tests/Sorting/W3C/fromRdf-out-sort-graphs-and-nodes.jsonld new file mode 100644 index 0000000..b9d5253 --- /dev/null +++ b/test/json-ld.net.tests/Sorting/W3C/fromRdf-out-sort-graphs-and-nodes.jsonld @@ -0,0 +1,89 @@ +[ + { + "@id": "http://example.org/node/1", + "@graph": [ + { + "@id": "http://example.org/object/1", + "http://example.org/value": [ + { + "@id": "n1-o1-value" + } + ] + }, + { + "@id": "http://example.org/object/2", + "http://example.org/value": [ + { + "@id": "n1-o2-value" + } + ] + }, + { + "@id": "http://example.org/object/3", + "http://example.org/value": [ + { + "@id": "n1-o3-value" + } + ] + } + ] + }, + { + "@id": "http://example.org/node/2", + "@graph": [ + { + "@id": "http://example.org/object/1", + "http://example.org/value": [ + { + "@id": "n2-o1-value" + } + ] + }, + { + "@id": "http://example.org/object/2", + "http://example.org/value": [ + { + "@id": "n2-o2-value" + } + ] + }, + { + "@id": "http://example.org/object/3", + "http://example.org/value": [ + { + "@id": "n2-o3-value" + } + ] + } + ] + }, + { + "@id": "http://example.org/node/3", + "@graph": [ + { + "@id": "http://example.org/object/1", + "http://example.org/value": [ + { + "@id": "n3-o1-value" + } + ] + }, + { + "@id": "http://example.org/object/2", + "http://example.org/value": [ + { + "@id": "n3-o2-value" + } + ] + }, + { + "@id": "http://example.org/object/3", + "http://example.org/value": [ + { + "@id": "n3-o3-value" + } + ] + } + ] + } +] \ No newline at end of file diff --git a/test/json-ld.net.tests/Sorting/W3C/fromRdf-out-sort-graphs.jsonld b/test/json-ld.net.tests/Sorting/W3C/fromRdf-out-sort-graphs.jsonld new file mode 100644 index 0000000..ce0a7cf --- /dev/null +++ b/test/json-ld.net.tests/Sorting/W3C/fromRdf-out-sort-graphs.jsonld @@ -0,0 +1,89 @@ +[ + { + "@id": "http://example.org/node/1", + "@graph": [ + { + "@id": "http://example.org/object/3", + "http://example.org/value": [ + { + "@id": "n1-o3-value" + } + ] + }, + { + "@id": "http://example.org/object/1", + "http://example.org/value": [ + { + "@id": "n1-o1-value" + } + ] + }, + { + "@id": "http://example.org/object/2", + "http://example.org/value": [ + { + "@id": "n1-o2-value" + } + ] + } + ] + }, + { + "@id": "http://example.org/node/2", + "@graph": [ + { + "@id": "http://example.org/object/3", + "http://example.org/value": [ + { + "@id": "n2-o3-value" + } + ] + }, + { + "@id": "http://example.org/object/1", + "http://example.org/value": [ + { + "@id": "n2-o1-value" + } + ] + }, + { + "@id": "http://example.org/object/2", + "http://example.org/value": [ + { + "@id": "n2-o2-value" + } + ] + } + ] + }, + { + "@id": "http://example.org/node/3", + "@graph": [ + { + "@id": "http://example.org/object/3", + "http://example.org/value": [ + { + "@id": "n3-o3-value" + } + ] + }, + { + "@id": "http://example.org/object/1", + "http://example.org/value": [ + { + "@id": "n3-o1-value" + } + ] + }, + { + "@id": "http://example.org/object/2", + "http://example.org/value": [ + { + "@id": "n3-o2-value" + } + ] + } + ] + } +] \ No newline at end of file diff --git a/test/json-ld.net.tests/Sorting/W3C/normalize-0002-in.jsonld b/test/json-ld.net.tests/Sorting/W3C/normalize-0002-in.jsonld new file mode 100644 index 0000000..bdcb83c --- /dev/null +++ b/test/json-ld.net.tests/Sorting/W3C/normalize-0002-in.jsonld @@ -0,0 +1,14 @@ +{ + "@context": { + "ex": "http://example.org/vocab#" + }, + "@id": "http://example.org/test#example1", + "ex:p": [ + { + "@id": "http://example.org/test#example2" + }, + { + "@id": "http://example.org/test#example2" + } + ] +} \ No newline at end of file diff --git a/test/json-ld.net.tests/Sorting/W3C/normalize-0002-out.nq b/test/json-ld.net.tests/Sorting/W3C/normalize-0002-out.nq new file mode 100644 index 0000000..529056c --- /dev/null +++ b/test/json-ld.net.tests/Sorting/W3C/normalize-0002-out.nq @@ -0,0 +1 @@ + . diff --git a/test/json-ld.net.tests/Sorting/W3C/normalize-manifest.jsonld b/test/json-ld.net.tests/Sorting/W3C/normalize-manifest.jsonld new file mode 100644 index 0000000..d4dcc36 --- /dev/null +++ b/test/json-ld.net.tests/Sorting/W3C/normalize-manifest.jsonld @@ -0,0 +1,353 @@ +{ + "@context": "http://json-ld.org/test-suite/context.jsonld", + "@id": "", + "@type": "mf:Manifest", + "name": "Normalization", + "description": "JSON-LD to normalized RDF tests output N-Quads and use string comparison.", + "baseIri": "http://json-ld.org/test-suite/tests/", + "sequence": [ + { + "@id": "#t0001", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "simple id", + "input": "normalize-0001-in.jsonld", + "expect": "normalize-0001-out.nq" + }, { + "@id": "#t0002", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "duplicate property iri values", + "input": "normalize-0002-in.jsonld", + "expect": "normalize-0002-out.nq" + }, { + "@id": "#t0003", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "bnode", + "input": "normalize-0003-in.jsonld", + "expect": "normalize-0003-out.nq" + }, { + "@id": "#t0004", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "bnode plus embed w/subject", + "input": "normalize-0004-in.jsonld", + "expect": "normalize-0004-out.nq" + }, { + "@id": "#t0005", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "bnode embed", + "input": "normalize-0005-in.jsonld", + "expect": "normalize-0005-out.nq" + }, { + "@id": "#t0006", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "multiple rdf types", + "input": "normalize-0006-in.jsonld", + "expect": "normalize-0006-out.nq" + }, { + "@id": "#t0007", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "coerce CURIE value", + "input": "normalize-0007-in.jsonld", + "expect": "normalize-0007-out.nq" + }, { + "@id": "#t0008", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "single subject complex", + "input": "normalize-0008-in.jsonld", + "expect": "normalize-0008-out.nq" + }, { + "@id": "#t0009", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "multiple subjects - complex", + "input": "normalize-0009-in.jsonld", + "expect": "normalize-0009-out.nq" + }, { + "@id": "#t0010", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "type", + "input": "normalize-0010-in.jsonld", + "expect": "normalize-0010-out.nq" + }, { + "@id": "#t0011", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "type-coerced type", + "input": "normalize-0011-in.jsonld", + "expect": "normalize-0011-out.nq" + }, { + "@id": "#t0012", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "type-coerced type, remove duplicate reference", + "input": "normalize-0012-in.jsonld", + "expect": "normalize-0012-out.nq" + }, { + "@id": "#t0013", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "type-coerced type, cycle", + "input": "normalize-0013-in.jsonld", + "expect": "normalize-0013-out.nq" + }, { + "@id": "#t0014", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "check types", + "input": "normalize-0014-in.jsonld", + "expect": "normalize-0014-out.nq" + }, { + "@id": "#t0015", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "top level context", + "input": "normalize-0015-in.jsonld", + "expect": "normalize-0015-out.nq" + }, { + "@id": "#t0016", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "blank node - dual link - embed", + "input": "normalize-0016-in.jsonld", + "expect": "normalize-0016-out.nq" + }, { + "@id": "#t0017", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "blank node - dual link - non-embed", + "input": "normalize-0017-in.jsonld", + "expect": "normalize-0017-out.nq" + }, { + "@id": "#t0018", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "blank node - self link", + "input": "normalize-0018-in.jsonld", + "expect": "normalize-0018-out.nq" + }, { + "@id": "#t0019", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "blank node - disjoint self links", + "input": "normalize-0019-in.jsonld", + "expect": "normalize-0019-out.nq" + }, { + "@id": "#t0020", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "blank node - diamond", + "input": "normalize-0020-in.jsonld", + "expect": "normalize-0020-out.nq" + }, { + "@id": "#t0021", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "blank node - circle of 2", + "input": "normalize-0021-in.jsonld", + "expect": "normalize-0021-out.nq" + }, { + "@id": "#t0022", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "blank node - double circle of 2", + "input": "normalize-0022-in.jsonld", + "expect": "normalize-0022-out.nq" + }, { + "@id": "#t0023", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "blank node - circle of 3", + "input": "normalize-0023-in.jsonld", + "expect": "normalize-0023-out.nq" + }, { + "@id": "#t0024", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "blank node - double circle of 3 (1-2-3)", + "input": "normalize-0024-in.jsonld", + "expect": "normalize-0024-out.nq" + }, { + "@id": "#t0025", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "blank node - double circle of 3 (1-3-2)", + "input": "normalize-0025-in.jsonld", + "expect": "normalize-0025-out.nq" + }, { + "@id": "#t0026", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "blank node - double circle of 3 (2-1-3)", + "input": "normalize-0026-in.jsonld", + "expect": "normalize-0026-out.nq" + }, { + "@id": "#t0027", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "blank node - double circle of 3 (2-3-1)", + "input": "normalize-0027-in.jsonld", + "expect": "normalize-0027-out.nq" + }, { + "@id": "#t0028", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "blank node - double circle of 3 (3-2-1)", + "input": "normalize-0028-in.jsonld", + "expect": "normalize-0028-out.nq" + }, { + "@id": "#t0029", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "blank node - double circle of 3 (3-1-2)", + "input": "normalize-0029-in.jsonld", + "expect": "normalize-0029-out.nq" + }, { + "@id": "#t0030", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "blank node - point at circle of 3", + "input": "normalize-0030-in.jsonld", + "expect": "normalize-0030-out.nq" + }, { + "@id": "#t0031", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "bnode (1)", + "input": "normalize-0031-in.jsonld", + "expect": "normalize-0031-out.nq" + }, { + "@id": "#t0032", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "bnode (2)", + "input": "normalize-0032-in.jsonld", + "expect": "normalize-0032-out.nq" + }, { + "@id": "#t0033", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "disjoint identical subgraphs (1)", + "input": "normalize-0033-in.jsonld", + "expect": "normalize-0033-out.nq" + }, { + "@id": "#t0034", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "disjoint identical subgraphs (2)", + "input": "normalize-0034-in.jsonld", + "expect": "normalize-0034-out.nq" + }, { + "@id": "#t0035", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "reordered w/strings (1)", + "input": "normalize-0035-in.jsonld", + "expect": "normalize-0035-out.nq" + }, { + "@id": "#t0036", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "reordered w/strings (2)", + "input": "normalize-0036-in.jsonld", + "expect": "normalize-0036-out.nq" + }, { + "@id": "#t0037", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "reordered w/strings (3)", + "input": "normalize-0037-in.jsonld", + "expect": "normalize-0037-out.nq" + }, { + "@id": "#t0038", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "reordered 4 bnodes, reordered 2 properties (1)", + "input": "normalize-0038-in.jsonld", + "expect": "normalize-0038-out.nq" + }, { + "@id": "#t0039", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "reordered 4 bnodes, reordered 2 properties (2)", + "input": "normalize-0039-in.jsonld", + "expect": "normalize-0039-out.nq" + }, { + "@id": "#t0040", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "reordered 6 bnodes (1)", + "input": "normalize-0040-in.jsonld", + "expect": "normalize-0040-out.nq" + }, { + "@id": "#t0041", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "reordered 6 bnodes (2)", + "input": "normalize-0041-in.jsonld", + "expect": "normalize-0041-out.nq" + }, { + "@id": "#t0042", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "reordered 6 bnodes (3)", + "input": "normalize-0042-in.jsonld", + "expect": "normalize-0042-out.nq" + }, { + "@id": "#t0043", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "literal with language", + "input": "normalize-0043-in.jsonld", + "expect": "normalize-0043-out.nq" + }, { + "@id": "#t0044", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "evil (1)", + "input": "normalize-0044-in.jsonld", + "expect": "normalize-0044-out.nq" + }, { + "@id": "#t0045", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "evil (2)", + "input": "normalize-0045-in.jsonld", + "expect": "normalize-0045-out.nq" + }, { + "@id": "#t0046", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "evil (3)", + "input": "normalize-0046-in.jsonld", + "expect": "normalize-0046-out.nq" + }, { + "@id": "#t0047", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "deep diff (1)", + "input": "normalize-0047-in.jsonld", + "expect": "normalize-0047-out.nq" + }, { + "@id": "#t0048", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "deep diff (2)", + "input": "normalize-0048-in.jsonld", + "expect": "normalize-0048-out.nq" + }, { + "@id": "#t0049", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "remove null", + "input": "normalize-0049-in.jsonld", + "expect": "normalize-0049-out.nq" + }, { + "@id": "#t0050", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "nulls", + "input": "normalize-0050-in.jsonld", + "expect": "normalize-0050-out.nq" + }, { + "@id": "#t0051", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "merging subjects", + "input": "normalize-0051-in.jsonld", + "expect": "normalize-0051-out.nq" + }, { + "@id": "#t0052", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "alias keywords", + "input": "normalize-0052-in.jsonld", + "expect": "normalize-0052-out.nq" + }, { + "@id": "#t0053", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "@list", + "input": "normalize-0053-in.jsonld", + "expect": "normalize-0053-out.nq" + }, { + "@id": "#t0054", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "t-graph", + "input": "normalize-0054-in.jsonld", + "expect": "normalize-0054-out.nq" + }, { + "@id": "#t0055", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "simple reorder (1)", + "input": "normalize-0055-in.jsonld", + "expect": "normalize-0055-out.nq" + }, { + "@id": "#t0056", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "simple reorder (2)", + "input": "normalize-0056-in.jsonld", + "expect": "normalize-0056-out.nq" + }, { + "@id": "#t0057", + "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], + "name": "unnamed graph", + "input": "normalize-0057-in.jsonld", + "expect": "normalize-0057-out.nq" + } + ] +} diff --git a/test/json-ld.net.tests/Sorting/W3C/remote-doc-0002-in.json b/test/json-ld.net.tests/Sorting/W3C/remote-doc-0002-in.json new file mode 100644 index 0000000..681f678 --- /dev/null +++ b/test/json-ld.net.tests/Sorting/W3C/remote-doc-0002-in.json @@ -0,0 +1,7 @@ +{ + "@context": { + "@vocab": "http://example/vocab#" + }, + "@id": "", + "term": "object" +} diff --git a/test/json-ld.net.tests/Sorting/W3C/remote-doc-0002-out.jsonld b/test/json-ld.net.tests/Sorting/W3C/remote-doc-0002-out.jsonld new file mode 100644 index 0000000..e4fc288 --- /dev/null +++ b/test/json-ld.net.tests/Sorting/W3C/remote-doc-0002-out.jsonld @@ -0,0 +1,4 @@ +[{ + "@id": "https://json-ld.org/test-suite/tests/remote-doc-0002-in.json", + "http://example/vocab#term": [{"@value": "object"}] +}] diff --git a/test/json-ld.net.tests/Sorting/W3C/remote-doc-manifest.jsonld b/test/json-ld.net.tests/Sorting/W3C/remote-doc-manifest.jsonld new file mode 100644 index 0000000..e9d9b4a --- /dev/null +++ b/test/json-ld.net.tests/Sorting/W3C/remote-doc-manifest.jsonld @@ -0,0 +1,129 @@ +{ + "@context": "http://json-ld.org/test-suite/context.jsonld", + "@id": "", + "@type": "mf:Manifest", + "description": "Tests appropriate document loading behavior as defined in the API", + "name": "Remote document", + "baseIri": "http://json-ld.org/test-suite/tests/", + "sequence": [ + { + "@id": "#t0001", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "load JSON-LD document", + "purpose": "Document loader loads a JSON-LD document.", + "input": "remote-doc-0001-in.jsonld", + "expect": "remote-doc-0001-out.jsonld" + }, { + "@id": "#t0002", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "load JSON document", + "purpose": "Document loader loads a JSON document.", + "input": "remote-doc-0002-in.json", + "expect": "remote-doc-0002-out.jsonld" + }, { + "@id": "#t0003", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "load JSON document with extension-type", + "purpose": "Document loader loads a JSON document having an extension mime-subtype.", + "option": { + "contentType": "application/jldTest+json" + }, + "input": "remote-doc-0003-in.jldt", + "expect": "remote-doc-0003-out.jsonld" + }, { + "@id": "#t0004", + "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], + "name": "loading an unknown type raises loading document failed", + "purpose": "Loading a document with a non-JSON mime type raises loading document failed", + "option": { + "contentType": "application/jldTest" + }, + "input": "remote-doc-0004-in.jldte", + "expect": "loading document failed" + }, { + "@id": "#t0005", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Load JSON-LD through 301 redirect", + "purpose": "Loading a document with a redirect should use the redirected URL as document base", + "option": { + "redirectTo": "remote-doc-0001-in.jsonld", + "httpStatus": 301 + }, + "input": "remote-doc-0005-in.jsonld", + "expect": "remote-doc-0001-out.jsonld" + }, { + "@id": "#t0006", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Load JSON-LD through 303 redirect", + "purpose": "Loading a document with a redirect should use the redirected URL as document base", + "option": { + "redirectTo": "remote-doc-0001-in.jsonld", + "httpStatus": 303 + }, + "input": "remote-doc-0006-in.jsonld", + "expect": "remote-doc-0001-out.jsonld" + }, { + "@id": "#t0007", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Load JSON-LD through 307 redirect", + "purpose": "Loading a document with a redirect should use the redirected URL as document base", + "option": { + "redirectTo": "remote-doc-0001-in.jsonld", + "httpStatus": 307 + }, + "input": "remote-doc-0007-in.jsonld", + "expect": "remote-doc-0001-out.jsonld" + }, { + "@id": "#t0008", + "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], + "name": "Non-existant file (404)", + "purpose": "Loading a non-existant file raises loading document failed error", + "input": "remote-doc-0008-in.jsonld", + "expect": "loading document failed" + }, { + "@id": "#t0009", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "load JSON-LD document with link", + "purpose": "If a context is specified in a link header, it is not used for JSON-LD.", + "option": { + "httpLink": "; rel=\"http://www.w3.org/ns/json-ld#context\"" + }, + "input": "remote-doc-0009-in.jsonld", + "expect": "remote-doc-0009-out.jsonld" + }, { + "@id": "#t0010", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "load JSON document with link", + "purpose": "If a context is specified in a link header, it is used for JSON.", + "option": { + "httpLink": "; rel=\"http://www.w3.org/ns/json-ld#context\"" + }, + "input": "remote-doc-0010-in.json", + "expect": "remote-doc-0010-out.jsonld" + }, { + "@id": "#t0011", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "load JSON document with extension-type with link", + "purpose": "If a context is specified in a link header, it is used for a JSON extension type.", + "input": "remote-doc-0011-in.jldt", + "option": { + "contentType": "application/jldTest+json", + "httpLink": "; rel=\"http://www.w3.org/ns/json-ld#context\"" + }, + "expect": "remote-doc-0011-out.jsonld" + }, { + "@id": "#t0012", + "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], + "name": "Multiple context link headers", + "purpose": "Loading a file when multiple link headers are returned is an error", + "option": { + "httpLink": [ + "; rel=\"http://www.w3.org/ns/json-ld#context\"", + "; rel=\"http://www.w3.org/ns/json-ld#context\"" + ] + }, + "input": "remote-doc-0012-in.json", + "expect": "multiple context link headers" + } + ] +} diff --git a/test/json-ld.net.tests/Sorting/W3C/toRdf-0002-in.jsonld b/test/json-ld.net.tests/Sorting/W3C/toRdf-0002-in.jsonld new file mode 100644 index 0000000..bd662d1 --- /dev/null +++ b/test/json-ld.net.tests/Sorting/W3C/toRdf-0002-in.jsonld @@ -0,0 +1,5 @@ +{ + "@context": {"foaf": "http://xmlns.com/foaf/0.1/"}, + "@id": "http://greggkellogg.net/foaf#me", + "foaf:name": "Gregg Kellogg" +} \ No newline at end of file diff --git a/test/json-ld.net.tests/Sorting/W3C/toRdf-0002-out.nq b/test/json-ld.net.tests/Sorting/W3C/toRdf-0002-out.nq new file mode 100644 index 0000000..f7238bf --- /dev/null +++ b/test/json-ld.net.tests/Sorting/W3C/toRdf-0002-out.nq @@ -0,0 +1 @@ + "Gregg Kellogg" . diff --git a/test/json-ld.net.tests/Sorting/W3C/toRdf-manifest.jsonld b/test/json-ld.net.tests/Sorting/W3C/toRdf-manifest.jsonld new file mode 100644 index 0000000..8abb3e5 --- /dev/null +++ b/test/json-ld.net.tests/Sorting/W3C/toRdf-manifest.jsonld @@ -0,0 +1,812 @@ +{ + "@context": "http://json-ld.org/test-suite/context.jsonld", + "@id": "", + "@type": "mf:Manifest", + "name": "Transform JSON-LD to RDF", + "description": "JSON-LD to RDF tests generate N-Quads output and use string comparison.", + "baseIri": "http://json-ld.org/test-suite/tests/", + "sequence": [ + { + "@id": "#t0001", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Plain literal with URIs", + "purpose": "Tests generation of a triple using full URIs and a plain literal.", + "input": "toRdf-0001-in.jsonld", + "expect": "toRdf-0001-out.nq" + }, { + "@id": "#t0002", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Plain literal with CURIE from default context", + "purpose": "Tests generation of a triple using a CURIE defined in the default context.", + "input": "toRdf-0002-in.jsonld", + "expect": "toRdf-0002-out.nq" + }, { + "@id": "#t0003", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Default subject is BNode", + "purpose": "Tests that a BNode is created if no explicit subject is set.", + "input": "toRdf-0003-in.jsonld", + "expect": "toRdf-0003-out.nq" + }, { + "@id": "#t0004", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Literal with language tag", + "purpose": "Tests that a plain literal is created with a language tag.", + "input": "toRdf-0004-in.jsonld", + "expect": "toRdf-0004-out.nq" + }, { + "@id": "#t0005", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Extended character set literal", + "purpose": "Tests that a literal may be created using extended characters.", + "input": "toRdf-0005-in.jsonld", + "expect": "toRdf-0005-out.nq" + }, { + "@id": "#t0006", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Typed literal", + "purpose": "Tests creation of a literal with a datatype.", + "input": "toRdf-0006-in.jsonld", + "expect": "toRdf-0006-out.nq" + }, { + "@id": "#t0007", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Tests 'a' generates rdf:type and object is implicit IRI", + "purpose": "Verify that 'a' is an alias for rdf:type, and the object is created as an IRI.", + "input": "toRdf-0007-in.jsonld", + "expect": "toRdf-0007-out.nq" + }, { + "@id": "#t0008", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Test prefix defined in @context", + "purpose": "Generate an IRI using a prefix defined within an @context.", + "input": "toRdf-0008-in.jsonld", + "expect": "toRdf-0008-out.nq" + }, { + "@id": "#t0009", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Test using an empty suffix", + "purpose": "An empty suffix may be used.", + "input": "toRdf-0009-in.jsonld", + "expect": "toRdf-0009-out.nq" + }, { + "@id": "#t0010", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Test object processing defines object", + "purpose": "A property referencing an associative array gets object from subject of array.", + "input": "toRdf-0010-in.jsonld", + "expect": "toRdf-0010-out.nq" + }, { + "@id": "#t0011", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Test object processing defines object with implicit BNode", + "purpose": "If no @ is specified, a BNode is created, and will be used as the object of an enclosing property.", + "input": "toRdf-0011-in.jsonld", + "expect": "toRdf-0011-out.nq" + }, { + "@id": "#t0012", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Multiple Objects for a Single Property", + "purpose": "Tests that Multiple Objects are for a Single Property using array syntax.", + "input": "toRdf-0012-in.jsonld", + "expect": "toRdf-0012-out.nq" + }, { + "@id": "#t0013", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Creation of an empty list", + "purpose": "Tests that @list: [] generates an empty list.", + "input": "toRdf-0013-in.jsonld", + "expect": "toRdf-0013-out.nq" + }, { + "@id": "#t0014", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Creation of a list with single element", + "purpose": "Tests that @list generates a list.", + "input": "toRdf-0014-in.jsonld", + "expect": "toRdf-0014-out.nq" + }, { + "@id": "#t0015", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Creation of a list with multiple elements", + "purpose": "Tests that list with multiple elements.", + "input": "toRdf-0015-in.jsonld", + "expect": "toRdf-0015-out.nq" + }, { + "@id": "#t0016", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Empty IRI expands to resource location", + "purpose": "Expanding an empty IRI uses the test file location.", + "input": "toRdf-0016-in.jsonld", + "expect": "toRdf-0016-out.nq" + }, { + "@id": "#t0017", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Relative IRI expands relative resource location", + "purpose": "Expanding a relative IRI uses the test file location.", + "input": "toRdf-0017-in.jsonld", + "expect": "toRdf-0017-out.nq" + }, { + "@id": "#t0018", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Frag ID expands relative resource location", + "purpose": "Expanding a fragment uses the test file location.", + "input": "toRdf-0018-in.jsonld", + "expect": "toRdf-0018-out.nq" + }, { + "@id": "#t0019", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Test type coercion to anyURI", + "purpose": "Tests coercion of object to anyURI when specified.", + "input": "toRdf-0019-in.jsonld", + "expect": "toRdf-0019-out.nq" + }, { + "@id": "#t0020", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Test type coercion to typed literal", + "purpose": "Tests coercion of object to a typed literal when specified.", + "input": "toRdf-0020-in.jsonld", + "expect": "toRdf-0020-out.nq" + }, { + "@id": "#t0022", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Test coercion of double value", + "purpose": "Tests that a decimal value generates a xsd:double typed literal;.", + "input": "toRdf-0022-in.jsonld", + "expect": "toRdf-0022-out.nq" + }, { + "@id": "#t0023", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Test coercion of integer value", + "purpose": "Tests that a decimal value generates a xsd:integer typed literal.", + "input": "toRdf-0023-in.jsonld", + "expect": "toRdf-0023-out.nq" + }, { + "@id": "#t0024", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Test coercion of boolean value", + "purpose": "Tests that a decimal value generates a xsd:boolean typed literal.", + "input": "toRdf-0024-in.jsonld", + "expect": "toRdf-0024-out.nq" + }, { + "@id": "#t0025", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Test list coercion with single element", + "purpose": "Tests that an array with a single element on a property with @list coercion creates an RDF Collection.", + "input": "toRdf-0025-in.jsonld", + "expect": "toRdf-0025-out.nq" + }, { + "@id": "#t0026", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Test creation of multiple types", + "purpose": "Tests that @type with an array of types creates multiple types.", + "input": "toRdf-0026-in.jsonld", + "expect": "toRdf-0026-out.nq" + }, { + "@id": "#t0027", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Simple named graph (Wikidata)", + "purpose": "Using @graph with other keys places triples in a named graph.", + "input": "toRdf-0027-in.jsonld", + "expect": "toRdf-0027-out.nq" + }, { + "@id": "#t0028", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Simple named graph", + "purpose": "Signing a graph.", + "input": "toRdf-0028-in.jsonld", + "expect": "toRdf-0028-out.nq" + }, { + "@id": "#t0029", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "named graph with embedded named graph", + "purpose": "Tests that named graphs containing named graphs flatten to single level of graph naming.", + "input": "toRdf-0029-in.jsonld", + "expect": "toRdf-0029-out.nq" + }, { + "@id": "#t0030", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "top-level graph with string subject reference", + "purpose": "Tests graphs containing subject references as strings.", + "input": "toRdf-0030-in.jsonld", + "expect": "toRdf-0030-out.nq" + }, { + "@id": "#t0031", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Reverse property", + "purpose": "Tests conversion of reverse properties.", + "input": "toRdf-0031-in.jsonld", + "expect": "toRdf-0031-out.nq" + }, { + "@id": "#t0032", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "@context reordering", + "purpose": "Tests that generated triples do not depend on order of @context.", + "input": "toRdf-0032-in.jsonld", + "expect": "toRdf-0032-out.nq" + }, { + "@id": "#t0033", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "@id reordering", + "purpose": "Tests that generated triples do not depend on order of @id.", + "input": "toRdf-0033-in.jsonld", + "expect": "toRdf-0033-out.nq" + }, { + "@id": "#t0034", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "context properties reordering", + "purpose": "Tests that generated triples do not depend on order of properties inside @context.", + "input": "toRdf-0034-in.jsonld", + "expect": "toRdf-0034-out.nq" + }, { + "@id": "#t0035", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "non-fractional numbers converted to xsd:double", + "purpose": "xsd:double's canonical lexical is used when converting numbers without fraction that are coerced to xsd:double", + "input": "toRdf-0035-in.jsonld", + "expect": "toRdf-0035-out.nq" + }, { + "@id": "#t0036", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Use nodeMapGeneration bnode labels", + "purpose": "The toRDF algorithm does not relabel blank nodes; it reuses the counter from the nodeMapGeneration to generate new ones", + "input": "toRdf-0036-in.jsonld", + "expect": "toRdf-0036-out.nq" + }, { + "@id": "#t0041", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "drop free-floating nodes", + "purpose": "Free-floating nodes do not generate RDF triples", + "input": "toRdf-0041-in.jsonld", + "expect": "toRdf-0041-out.nq" + }, { + "@id": "#t0042", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "basic", + "purpose": "Basic RDF conversion", + "input": "toRdf-0042-in.jsonld", + "expect": "toRdf-0042-out.nq" + }, { + "@id": "#t0043", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "drop null and unmapped properties", + "purpose": "Properties mapped to null or which are never mapped are dropped", + "input": "toRdf-0043-in.jsonld", + "expect": "toRdf-0043-out.nq" + }, { + "@id": "#t0044", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "optimize @set, keep empty arrays", + "purpose": "RDF version of expand-0004", + "input": "toRdf-0044-in.jsonld", + "expect": "toRdf-0044-out.nq" + }, { + "@id": "#t0045", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "do not expand aliased @id/@type", + "purpose": "RDF version of expand-0005", + "input": "toRdf-0045-in.jsonld", + "expect": "toRdf-0045-out.nq" + }, { + "@id": "#t0046", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "alias keywords", + "purpose": "RDF version of expand-0006", + "input": "toRdf-0046-in.jsonld", + "expect": "toRdf-0046-out.nq" + }, { + "@id": "#t0047", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "date type-coercion", + "purpose": "Type-coerced dates generate typed literals", + "input": "toRdf-0047-in.jsonld", + "expect": "toRdf-0047-out.nq" + }, { + "@id": "#t0048", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "@value with @language", + "purpose": "RDF version of expand-0008", + "input": "toRdf-0048-in.jsonld", + "expect": "toRdf-0048-out.nq" + }, { + "@id": "#t0049", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "@graph with terms", + "purpose": "RDF version of expand-0009", + "input": "toRdf-0049-in.jsonld", + "expect": "toRdf-0049-out.nq" + }, { + "@id": "#t0050", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "native types", + "purpose": "Native types generate typed literals", + "input": "toRdf-0050-in.jsonld", + "expect": "toRdf-0050-out.nq" + }, { + "@id": "#t0051", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "coerced @id", + "purpose": "RDF version of expand-0011", + "input": "toRdf-0051-in.jsonld", + "expect": "toRdf-0051-out.nq" + }, { + "@id": "#t0052", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "@graph with embed", + "purpose": "RDF version of expand-0012", + "input": "toRdf-0052-in.jsonld", + "expect": "toRdf-0052-out.nq" + }, { + "@id": "#t0053", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "expand already expanded", + "purpose": "RDF version of expand-0013", + "input": "toRdf-0053-in.jsonld", + "expect": "toRdf-0053-out.nq" + }, { + "@id": "#t0054", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "@set of @value objects with keyword aliases", + "purpose": "RDF version of expand-0014", + "input": "toRdf-0054-in.jsonld", + "expect": "toRdf-0054-out.nq" + }, { + "@id": "#t0055", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "collapse set of sets, keep empty lists", + "purpose": "RDF version of expand-0015", + "input": "toRdf-0055-in.jsonld", + "expect": "toRdf-0055-out.nq" + }, { + "@id": "#t0056", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "context reset", + "purpose": "RDF version of expand-0016", + "input": "toRdf-0056-in.jsonld", + "expect": "toRdf-0056-out.nq" + }, { + "@id": "#t0057", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "@graph and @id aliased", + "purpose": "RDF version of expand-0017", + "input": "toRdf-0057-in.jsonld", + "expect": "toRdf-0057-out.nq" + }, { + "@id": "#t0058", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "override default @language", + "purpose": "RDF version of expand-0018", + "input": "toRdf-0058-in.jsonld", + "expect": "toRdf-0058-out.nq" + }, { + "@id": "#t0059", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "remove @value = null", + "purpose": "RDF version of expand-0019", + "input": "toRdf-0059-in.jsonld", + "expect": "toRdf-0059-out.nq" + }, { + "@id": "#t0060", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "do not remove @graph if not at top-level", + "purpose": "Embedded @graph without @id creates BNode-labeled named graph", + "input": "toRdf-0060-in.jsonld", + "expect": "toRdf-0060-out.nq" + }, { + "@id": "#t0061", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "do not remove @graph at top-level if not only property", + "purpose": "RDF version of expand-0021", + "input": "toRdf-0061-in.jsonld", + "expect": "toRdf-0061-out.nq" + }, { + "@id": "#t0062", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "expand value with default language", + "purpose": "RDF version of expand-0022", + "input": "toRdf-0062-in.jsonld", + "expect": "toRdf-0062-out.nq" + }, { + "@id": "#t0063", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Lists and sets of properties with list/set coercion", + "purpose": "RDF version of expand-0023", + "input": "toRdf-0063-in.jsonld", + "expect": "toRdf-0063-out.nq" + }, { + "@id": "#t0064", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Multiple contexts", + "purpose": "RDF version of expand-0024", + "input": "toRdf-0064-in.jsonld", + "expect": "toRdf-0064-out.nq" + }, { + "@id": "#t0065", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Problematic IRI expansion tests", + "purpose": "RDF version of expand-0025", + "input": "toRdf-0065-in.jsonld", + "expect": "toRdf-0065-out.nq" + }, { + "@id": "#t0066", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Expanding term mapping to @type uses @type syntax", + "purpose": "RDF version of expand-0026", + "input": "toRdf-0066-in.jsonld", + "expect": "toRdf-0066-out.nq" + }, { + "@id": "#t0067", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Keep duplicate values in @list and @set", + "purpose": "RDF version of expand-0027", + "input": "toRdf-0067-in.jsonld", + "expect": "toRdf-0067-out.nq" + }, { + "@id": "#t0068", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Use @vocab in properties and @type but not in @id", + "purpose": "RDF version of expand-0028", + "input": "toRdf-0068-in.jsonld", + "expect": "toRdf-0068-out.nq" + }, { + "@id": "#t0069", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Relative IRIs", + "purpose": "RDF version of expand-0029", + "input": "toRdf-0069-in.jsonld", + "expect": "toRdf-0069-out.nq" + }, { + "@id": "#t0070", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Language maps", + "purpose": "RDF version of expand-0030", + "input": "toRdf-0070-in.jsonld", + "expect": "toRdf-0070-out.nq" + }, { + "@id": "#t0071", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "type-coercion of native types", + "purpose": "RDF version of expand-0031", + "input": "toRdf-0071-in.jsonld", + "expect": "toRdf-0071-out.nq" + }, { + "@id": "#t0072", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Mapping a term to null decouples it from @vocab", + "purpose": "RDF version of expand-0032", + "input": "toRdf-0072-in.jsonld", + "expect": "toRdf-0072-out.nq" + }, { + "@id": "#t0073", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Using @vocab with with type-coercion", + "purpose": "RDF version of expand-0033", + "input": "toRdf-0073-in.jsonld", + "expect": "toRdf-0073-out.nq" + }, { + "@id": "#t0074", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Multiple properties expanding to the same IRI", + "purpose": "RDF version of expand-0034", + "input": "toRdf-0074-in.jsonld", + "expect": "toRdf-0074-out.nq" + }, { + "@id": "#t0075", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Language maps with @vocab, default language, and colliding property", + "purpose": "RDF version of expand-0035", + "input": "toRdf-0075-in.jsonld", + "expect": "toRdf-0075-out.nq" + }, { + "@id": "#t0076", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Expanding @index", + "purpose": "RDF version of expand-0036", + "input": "toRdf-0076-in.jsonld", + "expect": "toRdf-0076-out.nq" + }, { + "@id": "#t0077", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Expanding @reverse", + "purpose": "RDF version of expand-0037", + "input": "toRdf-0077-in.jsonld", + "expect": "toRdf-0077-out.nq" + }, { + "@id": "#t0078", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Drop blank node predicates by default", + "purpose": "Triples with blank node predicates are dropped by default.", + "input": "toRdf-0078-in.jsonld", + "expect": "toRdf-0078-out.nq" + }, { + "@id": "#t0079", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Using terms in a reverse-maps", + "purpose": "RDF version of expand-0039", + "input": "toRdf-0079-in.jsonld", + "expect": "toRdf-0079-out.nq" + }, { + "@id": "#t0080", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "language and index expansion on non-objects", + "purpose": "RDF version of expand-0040", + "input": "toRdf-0080-in.jsonld", + "expect": "toRdf-0080-out.nq" + }, { + "@id": "#t0081", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Reset the default language", + "purpose": "RDF version of expand-0041", + "input": "toRdf-0081-in.jsonld", + "expect": "toRdf-0081-out.nq" + }, { + "@id": "#t0082", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Expanding reverse properties", + "purpose": "RDF version of expand-0042", + "input": "toRdf-0082-in.jsonld", + "expect": "toRdf-0082-out.nq" + }, { + "@id": "#t0083", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Using reverse properties inside a @reverse-container", + "purpose": "RDF version of expand-0043", + "input": "toRdf-0083-in.jsonld", + "expect": "toRdf-0083-out.nq" + }, { + "@id": "#t0084", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Ensure index maps use language mapping", + "purpose": "RDF version of expand-0044", + "input": "toRdf-0084-in.jsonld", + "expect": "toRdf-0084-out.nq" + }, { + "@id": "#t0085", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Top-level value objects are removed", + "purpose": "RDF version of expand-0045", + "input": "toRdf-0085-in.jsonld", + "expect": "toRdf-0085-out.nq" + }, { + "@id": "#t0086", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Free-floating nodes are removed", + "purpose": "RDF version of expand-0046", + "input": "toRdf-0086-in.jsonld", + "expect": "toRdf-0086-out.nq" + }, { + "@id": "#t0087", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Remove free-floating set values and lists", + "purpose": "RDF version of expand-0047", + "input": "toRdf-0087-in.jsonld", + "expect": "toRdf-0087-out.nq" + }, { + "@id": "#t0088", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Terms are ignored in @id", + "purpose": "RDF version of expand-0048", + "input": "toRdf-0088-in.jsonld", + "expect": "toRdf-0088-out.nq" + }, { + "@id": "#t0089", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Using strings as value of a reverse property", + "purpose": "RDF version of expand-0049", + "input": "toRdf-0089-in.jsonld", + "expect": "toRdf-0089-out.nq" + }, { + "@id": "#t0090", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Term definitions with prefix separate from prefix definitions", + "purpose": "RDF version of expand-0050", + "input": "toRdf-0090-in.jsonld", + "expect": "toRdf-0090-out.nq" + }, { + "@id": "#t0091", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Expansion of keyword aliases in term definitions", + "purpose": "RDF version of expand-0051", + "input": "toRdf-0091-in.jsonld", + "expect": "toRdf-0091-out.nq" + }, { + "@id": "#t0092", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "@vocab-relative IRIs in term definitions", + "purpose": "RDF version of expand-0052", + "input": "toRdf-0092-in.jsonld", + "expect": "toRdf-0092-out.nq" + }, { + "@id": "#t0093", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Expand absolute IRI with @type: @vocab", + "purpose": "RDF version of expand-0053", + "input": "toRdf-0093-in.jsonld", + "expect": "toRdf-0093-out.nq" + }, { + "@id": "#t0094", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Expand term with @type: @vocab", + "purpose": "RDF version of expand-0054", + "input": "toRdf-0094-in.jsonld", + "expect": "toRdf-0094-out.nq" + }, { + "@id": "#t0095", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Expand @vocab-relative term with @type: @vocab", + "purpose": "RDF version of expand-0055", + "input": "toRdf-0095-in.jsonld", + "expect": "toRdf-0095-out.nq" + }, { + "@id": "#t0096", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Use terms with @type: @vocab but not with @type: @id", + "purpose": "RDF version of expand-0056", + "input": "toRdf-0096-in.jsonld", + "expect": "toRdf-0096-out.nq" + }, { + "@id": "#t0097", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Expand relative IRI with @type: @vocab", + "purpose": "RDF version of expand-0057", + "input": "toRdf-0097-in.jsonld", + "expect": "toRdf-0097-out.nq" + }, { + "@id": "#t0098", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Expand compact IRI with @type: @vocab", + "purpose": "RDF version of expand-0058", + "input": "toRdf-0098-in.jsonld", + "expect": "toRdf-0098-out.nq" + }, { + "@id": "#t0099", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Reset @vocab by setting it to null", + "purpose": "RDF version of expand-0059", + "input": "toRdf-0099-in.jsonld", + "expect": "toRdf-0099-out.nq" + }, { + "@id": "#t0100", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Overwrite document base with @base and reset it again", + "purpose": "RDF version of expand-0060", + "input": "toRdf-0100-in.jsonld", + "expect": "toRdf-0100-out.nq" + }, { + "@id": "#t0101", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Coercing native types to arbitrary datatypes", + "purpose": "RDF version of expand-0061", + "input": "toRdf-0101-in.jsonld", + "expect": "toRdf-0101-out.nq" + }, { + "@id": "#t0102", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Various relative IRIs with with @base", + "purpose": "RDF version of expand-0062", + "input": "toRdf-0102-in.jsonld", + "expect": "toRdf-0102-out.nq" + }, { + "@id": "#t0103", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Expand a reverse property with an index-container", + "purpose": "RDF version of expand-0063", + "input": "toRdf-0103-in.jsonld", + "expect": "toRdf-0103-out.nq" + }, { + "@id": "#t0104", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Expand reverse property whose values are unlabeled blank nodes", + "purpose": "RDF version of expand-0064", + "input": "toRdf-0104-in.jsonld", + "expect": "toRdf-0104-out.nq" + }, { + "@id": "#t0105", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Keys that are not mapped to an IRI in a reverse-map are dropped", + "purpose": "RDF version of expand-0065", + "input": "toRdf-0105-in.jsonld", + "expect": "toRdf-0105-out.nq" + }, { + "@id": "#t0106", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Use @vocab to expand keys in reverse-maps", + "purpose": "RDF version of expand-0066", + "input": "toRdf-0106-in.jsonld", + "expect": "toRdf-0106-out.nq" + }, { + "@id": "#t0107", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "prefix:://sufffix not a compact IRI", + "purpose": "RDF version of expand-0067", + "input": "toRdf-0107-in.jsonld", + "expect": "toRdf-0107-out.nq" + }, { + "@id": "#t0108", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "_::sufffix not a compact IRI", + "purpose": "RDF version of expand-0068", + "input": "toRdf-0108-in.jsonld", + "expect": "toRdf-0108-out.nq" + }, { + "@id": "#t0109", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Compact IRI as term with type mapping", + "purpose": "RDF version of expand-0069", + "input": "toRdf-0109-in.jsonld", + "expect": "toRdf-0109-out.nq" + }, { + "@id": "#t0110", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Redefine compact IRI with itself", + "purpose": "RDF version of expand-0070", + "input": "toRdf-0110-in.jsonld", + "expect": "toRdf-0110-out.nq" + }, { + "@id": "#t0111", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Redefine terms looking like compact IRIs", + "purpose": "RDF version of expand-0071", + "input": "toRdf-0111-in.jsonld", + "expect": "toRdf-0111-out.nq" + }, { + "@id": "#t0112", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Redefine term using @vocab, not itself", + "purpose": "RDF version of expand-0072", + "input": "toRdf-0112-in.jsonld", + "expect": "toRdf-0112-out.nq" + }, { + "@id": "#t0113", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Dataset with a IRI named graph", + "purpose": "Basic use of creating a named graph using an IRI name", + "input": "toRdf-0113-in.jsonld", + "expect": "toRdf-0113-out.nq" + }, { + "@id": "#t0114", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Dataset with a IRI named graph", + "purpose": "Basic use of creating a named graph using a BNode name", + "input": "toRdf-0114-in.jsonld", + "expect": "toRdf-0114-out.nq" + }, { + "@id": "#t0115", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Dataset with a default and two named graphs", + "purpose": "Dataset with a default and two named graphs (IRI and BNode)", + "input": "toRdf-0115-in.jsonld", + "expect": "toRdf-0115-out.nq" + }, { + "@id": "#t0116", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Dataset from node with embedded named graph", + "purpose": "Embedding @graph in a node creates a named graph", + "input": "toRdf-0116-in.jsonld", + "expect": "toRdf-0116-out.nq" + }, { + "@id": "#t0117", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Dataset from node with embedded named graph (bnode)", + "purpose": "Embedding @graph in a node creates a named graph. Graph name is created if there is no subject", + "input": "toRdf-0117-in.jsonld", + "expect": "toRdf-0117-out.nq" + }, { + "@id": "#t0118", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "produce generalized RDF flag", + "purpose": "Triples with blank node predicates are not dropped if the produce generalized RDF flag is true.", + "option": { + "produceGeneralizedRdf": true + }, + "input": "toRdf-0118-in.jsonld", + "expect": "toRdf-0118-out.nq" + }, { + "@id": "#t0119", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Blank nodes with reverse properties", + "purpose": "Proper (re-)labeling of blank nodes if used with reverse properties.", + "input": "toRdf-0119-in.jsonld", + "expect": "toRdf-0119-out.nq" + } + ] +} diff --git a/test/json-ld.net.tests/SortingTests.cs b/test/json-ld.net.tests/SortingTests.cs new file mode 100644 index 0000000..37cb0ba --- /dev/null +++ b/test/json-ld.net.tests/SortingTests.cs @@ -0,0 +1,173 @@ +using JsonLD.Core; +using JsonLD.Util; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.IO; +using Xunit; + +namespace JsonLD.Test +{ + public class SortingTests + { + [Theory, MemberData(nameof(SortingTestCases))] + public void RunJsonLdProcessor(string id, SortingTestCase testCase) + { + JToken result = testCase.run(); + if (testCase.error != null) + { + Assert.True(((string)result["error"]).StartsWith((string)testCase.error), "Resulting error doesn't match expectations."); + } + else + { + if (!JsonLdUtils.DeepCompare(result, testCase.output)) + { +#if DEBUG + Console.WriteLine(id); + Console.WriteLine("Actual:"); + Console.Write(JSONUtils.ToPrettyString(result)); + Console.WriteLine("--------------------------"); + Console.WriteLine("Expected:"); + Console.Write(JSONUtils.ToPrettyString(testCase.output)); + Console.WriteLine("--------------------------"); +#endif + + Assert.True(false, "Returned JSON doesn't match expectations."); + } + } + } + + public class SortingTestCase + { + public JToken input { get; set; } + public JToken context { get; set; } + public JToken output { get; set; } + public JToken frame { get; set; } + public JToken error { get; set; } + public Func run { get; set; } + } + + private static string[] GetManifests() + { + return new[] { + //"compact-manifest.jsonld" + //"expand-manifest.jsonld", + //"flatten-manifest.jsonld", + //"frame-manifest.jsonld", + //"toRdf-manifest.jsonld", + "fromRdf-manifest.jsonld", + //"normalize-manifest.jsonld" + }; + } + + public static IEnumerable SortingTestCases() + { + var manifests = GetManifests(); + var jsonFetcher = new JsonFetcher(); + var rootDirectory = Path.Combine("Sorting", "W3C"); + + foreach (string manifest in manifests) + { + JToken manifestJson = jsonFetcher.GetJson(manifest, rootDirectory); + + foreach (JObject testcase in manifestJson["sequence"]) + { + Func run; + SortingTestCase newCase = new SortingTestCase(); + + newCase.input = jsonFetcher.GetJson(manifestJson["input"], rootDirectory); + newCase.output = jsonFetcher.GetJson(testcase["expect"], rootDirectory); + newCase.context = jsonFetcher.GetJson(manifestJson["test-context"], rootDirectory); + + var options = new JsonLdOptions(); + + var sortType = (string)testcase["sort-type"]; + + if (sortType == "jld:GraphsAndNodes") + { + options.SetSortGraphs(true); + options.SetSortGraphNodes(true); + } + else if (sortType == "jld:Graphs") + { + options.SetSortGraphs(true); + options.SetSortGraphNodes(false); + } + else if (sortType == "jld:Nodes") + { + options.SetSortGraphs(false); + options.SetSortGraphNodes(true); + } + else if (sortType == "jld:None") + { + options.SetSortGraphs(false); + options.SetSortGraphNodes(false); + } + + JsonLdApi jsonLdApi = new JsonLdApi(options); + Context activeCtx = new Context(newCase.context, options); + + var testType = (string)testcase["test-type"]; + + //if (testType == "jld:Compact") + { + // run = () => jsonLdApi.FromRDF(rdf); + } + //else if (testType == "jld:Expand") + //{ + // //run = () => JsonLdProcessor.Expand(newCase.input, options); + //} + //else if (testType == "jld:Flatten") + //{ + // //run = () => JsonLdProcessor.Flatten(newCase.input, newCase.context, options); + //} + //else if (testType == "jld:Frame") + //{ + // //run = () => JsonLdProcessor.Frame(newCase.input, newCase.frame, options); + //} + //else if (testType == "jld:Normalize") + //{ + // run = () => new JValue( + // RDFDatasetUtils.ToNQuads((RDFDataset)JsonLdProcessor.Normalize(newCase.input, options)).Replace("\n", "\r\n") + // ); + //} + //else if (testType == "jld:ToRDF") + //{ + // options.format = "application/nquads"; + // //run = () => new JValue( + // // ((string)JsonLdProcessor.ToRDF(newCase.input, options)).Replace("\n", "\r\n") + // //); + //} + //else if (testType == "jld:FromRDF") + { + JToken quads = newCase.input["quads"]; + RDFDataset rdf = new RDFDataset(); + + foreach (JToken quad in quads) + { + string subject = (string)quad["subject"]; + string predicate = (string)quad["predicate"]; + string value = (string)quad["value"]; + string graph = (string)quad["graph"]; + + rdf.AddQuad(subject, predicate, value, graph); + } + + options.format = "application/nquads"; + + run = () => jsonLdApi.FromRDF(rdf); + } + //else + //{ + // run = () => { throw new Exception("Couldn't find a test type, apparently."); }; + //} + + newCase.run = run; + + yield return new object[] { manifest + (string)testcase["@id"], newCase }; + } + } + } + } +} diff --git a/test/json-ld.net.tests/json-ld.net.tests.csproj b/test/json-ld.net.tests/json-ld.net.tests.csproj index e743c9b..4f236a6 100644 --- a/test/json-ld.net.tests/json-ld.net.tests.csproj +++ b/test/json-ld.net.tests/json-ld.net.tests.csproj @@ -27,4 +27,79 @@ + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + \ No newline at end of file From 743598fc0d9d3588d5efb7f57f794aca015e3eba Mon Sep 17 00:00:00 2001 From: dnllowe Date: Sun, 16 Jun 2019 19:58:21 -0400 Subject: [PATCH 3/9] Limits ordering logic to JsonLdApi.FromRdf --- src/json-ld.net/Core/JsonLdApi.cs | 39 +- src/json-ld.net/Core/JsonLdOptions.cs | 20 +- src/json-ld.net/Core/NormalizeUtils.cs | 24 +- .../Sorting/W3C/compact-context.jsonld | 4 + .../Sorting/W3C/compact-in.jsonld | 89 ++ .../Sorting/W3C/compact-manifest.jsonld | 41 + .../Sorting/W3C/expand-0002-in.jsonld | 18 - .../Sorting/W3C/expand-0002-out.jsonld | 9 - .../Sorting/W3C/expand-manifest.jsonld | 556 ------------ .../Sorting/W3C/flatten-0002-in.jsonld | 18 - .../Sorting/W3C/flatten-0002-out.jsonld | 38 - .../Sorting/W3C/flatten-manifest.jsonld | 330 ------- .../Sorting/W3C/frame-0002-in.jsonld | 28 - .../Sorting/W3C/frame-0002-out.jsonld | 23 - .../Sorting/W3C/fromRdf-context.jsonld | 11 - .../Sorting/W3C/fromRdf-manifest.jsonld | 3 +- .../Sorting/W3C/normalize-0002-in.jsonld | 14 - .../Sorting/W3C/normalize-0002-out.nq | 1 - .../Sorting/W3C/normalize-manifest.jsonld | 353 -------- .../Sorting/W3C/remote-doc-0002-in.json | 7 - .../Sorting/W3C/remote-doc-0002-out.jsonld | 4 - .../Sorting/W3C/remote-doc-manifest.jsonld | 129 --- .../Sorting/W3C/toRdf-0002-in.jsonld | 5 - .../Sorting/W3C/toRdf-0002-out.nq | 1 - .../Sorting/W3C/toRdf-manifest.jsonld | 812 ------------------ test/json-ld.net.tests/SortingTests.cs | 74 +- .../W3C/compact-0010-out.jsonld | 48 +- .../json-ld.net.tests.csproj | 59 +- 28 files changed, 220 insertions(+), 2538 deletions(-) create mode 100644 test/json-ld.net.tests/Sorting/W3C/compact-context.jsonld create mode 100644 test/json-ld.net.tests/Sorting/W3C/compact-in.jsonld create mode 100644 test/json-ld.net.tests/Sorting/W3C/compact-manifest.jsonld delete mode 100644 test/json-ld.net.tests/Sorting/W3C/expand-0002-in.jsonld delete mode 100644 test/json-ld.net.tests/Sorting/W3C/expand-0002-out.jsonld delete mode 100644 test/json-ld.net.tests/Sorting/W3C/expand-manifest.jsonld delete mode 100644 test/json-ld.net.tests/Sorting/W3C/flatten-0002-in.jsonld delete mode 100644 test/json-ld.net.tests/Sorting/W3C/flatten-0002-out.jsonld delete mode 100644 test/json-ld.net.tests/Sorting/W3C/flatten-manifest.jsonld delete mode 100644 test/json-ld.net.tests/Sorting/W3C/frame-0002-in.jsonld delete mode 100644 test/json-ld.net.tests/Sorting/W3C/frame-0002-out.jsonld delete mode 100644 test/json-ld.net.tests/Sorting/W3C/fromRdf-context.jsonld delete mode 100644 test/json-ld.net.tests/Sorting/W3C/normalize-0002-in.jsonld delete mode 100644 test/json-ld.net.tests/Sorting/W3C/normalize-0002-out.nq delete mode 100644 test/json-ld.net.tests/Sorting/W3C/normalize-manifest.jsonld delete mode 100644 test/json-ld.net.tests/Sorting/W3C/remote-doc-0002-in.json delete mode 100644 test/json-ld.net.tests/Sorting/W3C/remote-doc-0002-out.jsonld delete mode 100644 test/json-ld.net.tests/Sorting/W3C/remote-doc-manifest.jsonld delete mode 100644 test/json-ld.net.tests/Sorting/W3C/toRdf-0002-in.jsonld delete mode 100644 test/json-ld.net.tests/Sorting/W3C/toRdf-0002-out.nq delete mode 100644 test/json-ld.net.tests/Sorting/W3C/toRdf-manifest.jsonld diff --git a/src/json-ld.net/Core/JsonLdApi.cs b/src/json-ld.net/Core/JsonLdApi.cs index 2cb465a..ea373f4 100644 --- a/src/json-ld.net/Core/JsonLdApi.cs +++ b/src/json-ld.net/Core/JsonLdApi.cs @@ -123,10 +123,7 @@ public virtual JToken Compact(Context activeCtx, string activeProperty, JToken e // 7) JArray keys = new JArray(element.GetKeys()); - //if (opts.GetSortGraphNodes()) - { - keys.SortInPlace(); - } + keys.SortInPlace(); foreach (string expandedProperty in keys) { @@ -496,10 +493,7 @@ public virtual JToken Expand(Context activeCtx, string activeProperty, JToken el // 7) JArray keys = new JArray(element.GetKeys()); - //if (opts.GetSortGraphNodes()) - { - keys.SortInPlace(); - } + keys.SortInPlace(); foreach (string key in keys) { @@ -818,10 +812,7 @@ public virtual JToken Expand(Context activeCtx, string activeProperty, JToken el // 7.6.2) JArray indexKeys = new JArray(value.GetKeys()); - //if (opts.GetSortGraphNodes()) - { - indexKeys.SortInPlace(); - } + indexKeys.SortInPlace(); foreach (string index in indexKeys) { @@ -1305,10 +1296,7 @@ private void GenerateNodeMap(JToken element, JObject nodeMap, // 6.11) JArray keys = new JArray(element.GetKeys()); - //if (!opts.GetSortGraphNodes()) - { - keys.SortInPlace(); - } + keys.SortInPlace(); foreach (string property_1 in keys) { @@ -1456,10 +1444,7 @@ private void Frame(JsonLdApi.FramingContext state, JObject nodes // add matches to output JArray ids = new JArray(matches.GetKeys()); - //if (!opts.GetSortGraphs()) - { - ids.SortInPlace(); - } + ids.SortInPlace(); foreach (string id in ids) { @@ -1524,10 +1509,7 @@ private void Frame(JsonLdApi.FramingContext state, JObject nodes JObject element = (JObject)matches[id]; JArray props = new JArray(element.GetKeys()); - //if (!opts.GetSortGraphNodes()) - { - props.SortInPlace(); - } + props.SortInPlace(); foreach (string prop in props) { @@ -1606,10 +1588,7 @@ private void Frame(JsonLdApi.FramingContext state, JObject nodes // handle defaults props = new JArray(frame.GetKeys()); - //if (!opts.GetSortGraphNodes()) - { - props.SortInPlace(); - } + props.SortInPlace(); foreach (string prop_1 in props) { @@ -2151,7 +2130,7 @@ public virtual JArray FromRDF(RDFDataset dataset) // 6) JArray ids = new JArray(defaultGraph.GetKeys()); - if (!opts.GetSortGraphs()) + if (opts.GetSortGraphsFromRdf()) { ids.SortInPlace(); } @@ -2167,7 +2146,7 @@ public virtual JArray FromRDF(RDFDataset dataset) // 6.1.2) JArray keys = new JArray(graphMap[subject_1].GetKeys()); - if (!opts.GetSortGraphNodes()) + if (opts.GetSortGraphNodesFromRdf()) { keys.SortInPlace(); } diff --git a/src/json-ld.net/Core/JsonLdOptions.cs b/src/json-ld.net/Core/JsonLdOptions.cs index adfa13d..ebd2cc2 100644 --- a/src/json-ld.net/Core/JsonLdOptions.cs +++ b/src/json-ld.net/Core/JsonLdOptions.cs @@ -42,9 +42,9 @@ public virtual JsonLD.Core.JsonLdOptions Clone() private bool produceGeneralizedRdf = false; - private bool sortGraphs = true; + private bool sortGraphsFromRdf = true; - private bool sortGraphNodes = true; + private bool sortGraphNodesFromRdf = true; // base options // frame options // rdf conversion options @@ -149,24 +149,24 @@ public virtual void SetProduceGeneralizedRdf(bool produceGeneralizedRdf) this.produceGeneralizedRdf = produceGeneralizedRdf; } - public virtual bool GetSortGraphs() + public virtual bool GetSortGraphsFromRdf() { - return sortGraphs; + return sortGraphsFromRdf; } - public virtual void SetSortGraphs(bool sortGraphs) + public virtual void SetSortGraphsFromRdf(bool sortGraphs) { - this.sortGraphs = sortGraphs; + this.sortGraphsFromRdf = sortGraphs; } - public virtual bool GetSortGraphNodes() + public virtual bool GetSortGraphNodesFromRdf() { - return sortGraphNodes; + return sortGraphNodesFromRdf; } - public virtual void SetSortGraphNodes(bool sortGraphNodes) + public virtual void SetSortGraphNodesFromRdf(bool sortGraphNodes) { - this.sortGraphNodes = sortGraphNodes; + this.sortGraphNodesFromRdf = sortGraphNodes; } public string format = null; diff --git a/src/json-ld.net/Core/NormalizeUtils.cs b/src/json-ld.net/Core/NormalizeUtils.cs index 6ed92ee..5e43029 100644 --- a/src/json-ld.net/Core/NormalizeUtils.cs +++ b/src/json-ld.net/Core/NormalizeUtils.cs @@ -46,10 +46,7 @@ public virtual object HashBlankNodes(IEnumerable unnamed_) bool named = false; IList hashes = new List(unique.Keys); - //if (!options.GetSortGraphs()) - { - hashes.SortInPlace(); - } + hashes.SortInPlace(); foreach (string hash in hashes) { @@ -79,10 +76,7 @@ public virtual object HashBlankNodes(IEnumerable unnamed_) // enumerate duplicate hash groups in sorted order hashes = new List(duplicates.Keys); - //if (!options.GetSortGraphs()) - { - hashes.SortInPlace(); - } + hashes.SortInPlace(); // process each group for (int pgi = 0; ; pgi++) @@ -119,11 +113,8 @@ public virtual object HashBlankNodes(IEnumerable unnamed_) ) && !(quad["name"] == null) ? (string)((IDictionary)((IDictionary)quad)["name"])["value"] : null)); } - //if (!options.GetSortGraphs()) - { - // sort normalized output - normalized.SortInPlace(); - } + // sort normalized output + normalized.SortInPlace(); // handle output format if (options.format != null) @@ -156,11 +147,8 @@ public virtual object HashBlankNodes(IEnumerable unnamed_) { if (n_2 == group.Count) { - //if (!options.GetSortGraphs()) - { - // name bnodes in hash order - results.SortInPlace(new _IComparer_145()); - } + // name bnodes in hash order + results.SortInPlace(new _IComparer_145()); foreach (NormalizeUtils.HashResult r in results) { diff --git a/test/json-ld.net.tests/Sorting/W3C/compact-context.jsonld b/test/json-ld.net.tests/Sorting/W3C/compact-context.jsonld new file mode 100644 index 0000000..fab1a80 --- /dev/null +++ b/test/json-ld.net.tests/Sorting/W3C/compact-context.jsonld @@ -0,0 +1,4 @@ +{ + "@context": { + } +} \ No newline at end of file diff --git a/test/json-ld.net.tests/Sorting/W3C/compact-in.jsonld b/test/json-ld.net.tests/Sorting/W3C/compact-in.jsonld new file mode 100644 index 0000000..5a11289 --- /dev/null +++ b/test/json-ld.net.tests/Sorting/W3C/compact-in.jsonld @@ -0,0 +1,89 @@ +[ + { + "@id": "http://example.org/node/3", + "@graph": [ + { + "@id": "http://example.org/object/3", + "http://example.org/value": [ + { + "@id": "n3-o3-value" + } + ] + }, + { + "@id": "http://example.org/object/1", + "http://example.org/value": [ + { + "@id": "n3-o1-value" + } + ] + }, + { + "@id": "http://example.org/object/2", + "http://example.org/value": [ + { + "@id": "n3-o2-value" + } + ] + } + ] + }, + { + "@id": "http://example.org/node/1", + "@graph": [ + { + "@id": "http://example.org/object/3", + "http://example.org/value": [ + { + "@id": "n1-o3-value" + } + ] + }, + { + "@id": "http://example.org/object/1", + "http://example.org/value": [ + { + "@id": "n1-o1-value" + } + ] + }, + { + "@id": "http://example.org/object/2", + "http://example.org/value": [ + { + "@id": "n1-o2-value" + } + ] + } + ] + }, + { + "@id": "http://example.org/node/2", + "@graph": [ + { + "@id": "http://example.org/object/3", + "http://example.org/value": [ + { + "@id": "n2-o3-value" + } + ] + }, + { + "@id": "http://example.org/object/1", + "http://example.org/value": [ + { + "@id": "n2-o1-value" + } + ] + }, + { + "@id": "http://example.org/object/2", + "http://example.org/value": [ + { + "@id": "n2-o2-value" + } + ] + } + ] + } +] \ No newline at end of file diff --git a/test/json-ld.net.tests/Sorting/W3C/compact-manifest.jsonld b/test/json-ld.net.tests/Sorting/W3C/compact-manifest.jsonld new file mode 100644 index 0000000..bff774d --- /dev/null +++ b/test/json-ld.net.tests/Sorting/W3C/compact-manifest.jsonld @@ -0,0 +1,41 @@ +{ + "@type": "mf:Manifest", + "name": "Compaction", + "description": "JSON-LD sorting graphs and nodes when running Compact", + "test-context": "compact-context.jsonld", + "input": "compact-in.jsonld", + "sequence": [ + { + "@id": "#t0001", + "sort-type": "jld:GraphsAndNodes", + "test-type": "jld:Compact", + "name": "sort graphs and nodes", + "purpose": "graphs and nodes sorted when running Compact", + "expect": "compact-out-sort-graphs-and-nodes.jsonld" + }, + { + "@id": "#t0002", + "sort-type": "jld:Graphs", + "test-type": "jld:Compact", + "name": "sort graphs only", + "purpose": "graphs sorted when running Compact", + "expect": "compact-out-sort-graphs.jsonld" + }, + { + "@id": "#t0003", + "sort-type": "jld:Nodes", + "test-type": "jld:Compact", + "name": "sort graph nodes only", + "purpose": "graph nodes sorted when running Compact", + "expect": "compact-out-sort-graph-nodes.jsonld" + }, + { + "@id": "#t0004", + "sort-type": "jld:None", + "test-type": "jld:Compact", + "name": "sort nothing", + "purpose": "sort nothing running Compact", + "expect": "compact-out-no-sorting.jsonld" + } + ] +} diff --git a/test/json-ld.net.tests/Sorting/W3C/expand-0002-in.jsonld b/test/json-ld.net.tests/Sorting/W3C/expand-0002-in.jsonld deleted file mode 100644 index e4598e5..0000000 --- a/test/json-ld.net.tests/Sorting/W3C/expand-0002-in.jsonld +++ /dev/null @@ -1,18 +0,0 @@ -{ - "@context": { - "t1": "http://example.com/t1", - "t2": "http://example.com/t2", - "term1": "http://example.com/term1", - "term2": "http://example.com/term2", - "term3": "http://example.com/term3", - "term4": "http://example.com/term4", - "term5": "http://example.com/term5" - }, - "@id": "http://example.com/id1", - "@type": "t1", - "term1": "v1", - "term2": {"@value": "v2", "@type": "t2"}, - "term3": {"@value": "v3", "@language": "en"}, - "term4": 4, - "term5": [50, 51] -} diff --git a/test/json-ld.net.tests/Sorting/W3C/expand-0002-out.jsonld b/test/json-ld.net.tests/Sorting/W3C/expand-0002-out.jsonld deleted file mode 100644 index cc8e658..0000000 --- a/test/json-ld.net.tests/Sorting/W3C/expand-0002-out.jsonld +++ /dev/null @@ -1,9 +0,0 @@ -[{ - "@id": "http://example.com/id1", - "@type": ["http://example.com/t1"], - "http://example.com/term1": [{"@value": "v1"}], - "http://example.com/term2": [{"@value": "v2", "@type": "http://example.com/t2"}], - "http://example.com/term3": [{"@value": "v3", "@language": "en"}], - "http://example.com/term4": [{"@value": 4}], - "http://example.com/term5": [{"@value": 50}, {"@value": 51}] -}] \ No newline at end of file diff --git a/test/json-ld.net.tests/Sorting/W3C/expand-manifest.jsonld b/test/json-ld.net.tests/Sorting/W3C/expand-manifest.jsonld deleted file mode 100644 index 49a200c..0000000 --- a/test/json-ld.net.tests/Sorting/W3C/expand-manifest.jsonld +++ /dev/null @@ -1,556 +0,0 @@ -{ - "@context": "http://json-ld.org/test-suite/context.jsonld", - "@id": "", - "@type": "mf:Manifest", - "description": "JSON-LD to Expansion tests use object compare", - "name": "Expansion", - "baseIri": "http://json-ld.org/test-suite/tests/", - "sequence": [ - { - "@id": "#t0001", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "drop free-floating nodes", - "purpose": "Expand drops unreferenced nodes having only @id", - "input": "expand-0001-in.jsonld", - "expect": "expand-0001-out.jsonld" - }, { - "@id": "#t0002", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "basic", - "purpose": "Expanding terms with different types of values", - "input": "expand-0002-in.jsonld", - "expect": "expand-0002-out.jsonld" - }, { - "@id": "#t0003", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "drop null and unmapped properties", - "purpose": "Verifies that null values and unmapped properties are removed from expanded output", - "input": "expand-0003-in.jsonld", - "expect": "expand-0003-out.jsonld" - }, { - "@id": "#t0004", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "optimize @set, keep empty arrays", - "purpose": "Uses of @set are removed in expansion; values of @set, or just plain values which are empty arrays are retained", - "input": "expand-0004-in.jsonld", - "expect": "expand-0004-out.jsonld" - }, { - "@id": "#t0005", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "do not expand aliased @id/@type", - "purpose": "If a keyword is aliased, it is not used when expanding", - "input": "expand-0005-in.jsonld", - "expect": "expand-0005-out.jsonld" - }, { - "@id": "#t0006", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "alias keywords", - "purpose": "Aliased keywords expand in resulting document", - "input": "expand-0006-in.jsonld", - "expect": "expand-0006-out.jsonld" - }, { - "@id": "#t0007", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "date type-coercion", - "purpose": "Expand strings to expanded value with @type: xsd:dateTime", - "input": "expand-0007-in.jsonld", - "expect": "expand-0007-out.jsonld" - }, { - "@id": "#t0008", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "@value with @language", - "purpose": "Keep expanded values with @language, drop non-conforming value objects containing just @language", - "input": "expand-0008-in.jsonld", - "expect": "expand-0008-out.jsonld" - }, { - "@id": "#t0009", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "@graph with terms", - "purpose": "Use of @graph to contain multiple nodes within array", - "input": "expand-0009-in.jsonld", - "expect": "expand-0009-out.jsonld" - }, { - "@id": "#t0010", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "native types", - "purpose": "Expanding native scalar retains native scalar within expanded value", - "input": "expand-0010-in.jsonld", - "expect": "expand-0010-out.jsonld" - }, { - "@id": "#t0011", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "coerced @id", - "purpose": "A value of a property with @type: @id coercion expands to a node reference", - "input": "expand-0011-in.jsonld", - "expect": "expand-0011-out.jsonld" - }, { - "@id": "#t0012", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "@graph with embed", - "purpose": "Use of @graph to contain multiple nodes within array", - "input": "expand-0012-in.jsonld", - "expect": "expand-0012-out.jsonld" - }, { - "@id": "#t0013", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "expand already expanded", - "purpose": "Expand does not mess up already expanded document", - "input": "expand-0013-in.jsonld", - "expect": "expand-0013-out.jsonld" - }, { - "@id": "#t0014", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "@set of @value objects with keyword aliases", - "purpose": "Expanding aliased @set and @value", - "input": "expand-0014-in.jsonld", - "expect": "expand-0014-out.jsonld" - }, { - "@id": "#t0015", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "collapse set of sets, keep empty lists", - "purpose": "An array of multiple @set nodes are collapsed into a single array", - "input": "expand-0015-in.jsonld", - "expect": "expand-0015-out.jsonld" - }, { - "@id": "#t0016", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "context reset", - "purpose": "Setting @context to null within an embedded object resets back to initial context state", - "input": "expand-0016-in.jsonld", - "expect": "expand-0016-out.jsonld" - }, { - "@id": "#t0017", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "@graph and @id aliased", - "purpose": "Expanding with @graph and @id aliases", - "input": "expand-0017-in.jsonld", - "expect": "expand-0017-out.jsonld" - }, { - "@id": "#t0018", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "override default @language", - "purpose": "override default @language in terms; only language-tag strings", - "input": "expand-0018-in.jsonld", - "expect": "expand-0018-out.jsonld" - }, { - "@id": "#t0019", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "remove @value = null", - "purpose": "Expanding a value of null removes the value", - "input": "expand-0019-in.jsonld", - "expect": "expand-0019-out.jsonld" - }, { - "@id": "#t0020", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "do not remove @graph if not at top-level", - "purpose": "@graph used under a node is retained", - "input": "expand-0020-in.jsonld", - "expect": "expand-0020-out.jsonld" - }, { - "@id": "#t0021", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "do not remove @graph at top-level if not only property", - "purpose": "@graph used at the top level is retained if there are other properties", - "input": "expand-0021-in.jsonld", - "expect": "expand-0021-out.jsonld" - }, { - "@id": "#t0022", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "expand value with default language", - "purpose": "Expanding with a default language applies that language to string values", - "input": "expand-0022-in.jsonld", - "expect": "expand-0022-out.jsonld" - }, { - "@id": "#t0023", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Expanding list/set with coercion", - "purpose": "Expanding lists and sets with properties having coercion coerces list/set values", - "input": "expand-0023-in.jsonld", - "expect": "expand-0023-out.jsonld" - }, { - "@id": "#t0024", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Multiple contexts", - "purpose": "Tests that contexts in an array are merged", - "input": "expand-0024-in.jsonld", - "expect": "expand-0024-out.jsonld" - }, { - "@id": "#t0025", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Problematic IRI expansion tests", - "purpose": "Expanding different kinds of terms and Compact IRIs", - "input": "expand-0025-in.jsonld", - "expect": "expand-0025-out.jsonld" - }, { - "@id": "#t0026", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Term definition with @id: @type", - "purpose": "Expanding term mapping to @type uses @type syntax", - "input": "expand-0026-in.jsonld", - "expect": "expand-0026-out.jsonld" - }, { - "@id": "#t0027", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Duplicate values in @list and @set", - "purpose": "Duplicate values in @list and @set are not merged", - "input": "expand-0027-in.jsonld", - "expect": "expand-0027-out.jsonld" - }, { - "@id": "#t0028", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Use @vocab in properties and @type but not in @id", - "purpose": "@vocab is used to compact properties and @type, but is not used for @id", - "input": "expand-0028-in.jsonld", - "expect": "expand-0028-out.jsonld" - }, { - "@id": "#t0029", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Relative IRIs", - "purpose": "@base is used to compact @id; test with different relative IRIs", - "input": "expand-0029-in.jsonld", - "expect": "expand-0029-out.jsonld" - }, { - "@id": "#t0030", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Language maps", - "purpose": "Language Maps expand values to include @language", - "input": "expand-0030-in.jsonld", - "expect": "expand-0030-out.jsonld" - }, { - "@id": "#t0031", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "type-coercion of native types", - "purpose": "Expanding native types with type coercion adds the coerced type to an expanded value representation and retains the native value representation", - "input": "expand-0031-in.jsonld", - "expect": "expand-0031-out.jsonld" - }, { - "@id": "#t0032", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Null term and @vocab", - "purpose": "Mapping a term to null decouples it from @vocab", - "input": "expand-0032-in.jsonld", - "expect": "expand-0032-out.jsonld" - }, { - "@id": "#t0033", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Using @vocab with with type-coercion", - "purpose": "Verifies that terms can be defined using @vocab", - "input": "expand-0033-in.jsonld", - "expect": "expand-0033-out.jsonld" - }, { - "@id": "#t0034", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Multiple properties expanding to the same IRI", - "purpose": "Verifies multiple values from separate terms are deterministically made multiple values of the IRI associated with the terms", - "input": "expand-0034-in.jsonld", - "expect": "expand-0034-out.jsonld" - }, { - "@id": "#t0035", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Language maps with @vocab, default language, and colliding property", - "purpose": "Pathological tests of language maps", - "input": "expand-0035-in.jsonld", - "expect": "expand-0035-out.jsonld" - }, { - "@id": "#t0036", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Expanding @index", - "purpose": "Expanding index maps for terms defined with @container: @index", - "input": "expand-0036-in.jsonld", - "expect": "expand-0036-out.jsonld" - }, { - "@id": "#t0037", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Expanding @reverse", - "purpose": "Expanding @reverse keeps @reverse", - "input": "expand-0037-in.jsonld", - "expect": "expand-0037-out.jsonld" - }, { - "@id": "#t0038", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Expanding blank node labels", - "purpose": "Blank nodes are not relabeled during expansion", - "input": "expand-0038-in.jsonld", - "expect": "expand-0038-out.jsonld" - }, { - "@id": "#t0039", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Using terms in a reverse-maps", - "purpose": "Terms within @reverse are expanded", - "input": "expand-0039-in.jsonld", - "expect": "expand-0039-out.jsonld" - }, { - "@id": "#t0040", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "language and index expansion on non-objects", - "purpose": "Only invoke language and index map expansion if the value is a JSON object", - "input": "expand-0040-in.jsonld", - "expect": "expand-0040-out.jsonld" - }, { - "@id": "#t0041", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "@language: null", - "name": "@language: null resets the default language", - "input": "expand-0041-in.jsonld", - "expect": "expand-0041-out.jsonld" - }, { - "@id": "#t0042", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Reverse properties", - "purpose": "Expanding terms defined as reverse properties uses @reverse in expanded document", - "input": "expand-0042-in.jsonld", - "expect": "expand-0042-out.jsonld" - }, { - "@id": "#t0043", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Using reverse properties inside a @reverse-container", - "purpose": "Expanding a reverse property within a @reverse undoes both reversals", - "input": "expand-0043-in.jsonld", - "expect": "expand-0043-out.jsonld" - }, { - "@id": "#t0044", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Index maps with language mappings", - "purpose": "Ensure index maps use language mapping", - "input": "expand-0044-in.jsonld", - "expect": "expand-0044-out.jsonld" - }, { - "@id": "#t0045", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Top-level value objects", - "purpose": "Expanding top-level value objects causes them to be removed", - "input": "expand-0045-in.jsonld", - "expect": "expand-0045-out.jsonld" - }, { - "@id": "#t0046", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Free-floating nodes", - "purpose": "Expanding free-floating nodes causes them to be removed", - "input": "expand-0046-in.jsonld", - "expect": "expand-0046-out.jsonld" - }, { - "@id": "#t0047", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Free-floating values in sets and free-floating lists", - "purpose": "Free-floating values in sets are removed, free-floating lists are removed completely", - "input": "expand-0047-in.jsonld", - "expect": "expand-0047-out.jsonld" - }, { - "@id": "#t0048", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Terms are ignored in @id", - "purpose": "Values of @id are not expanded as terms", - "input": "expand-0048-in.jsonld", - "expect": "expand-0048-out.jsonld" - }, { - "@id": "#t0049", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "String values of reverse properties", - "purpose": "String values of a reverse property with @type: @id are treated as IRIs", - "input": "expand-0049-in.jsonld", - "expect": "expand-0049-out.jsonld" - }, { - "@id": "#t0050", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Term definitions with prefix separate from prefix definitions", - "purpose": "Term definitions using compact IRIs don't inherit the definitions of the prefix", - "input": "expand-0050-in.jsonld", - "expect": "expand-0050-out.jsonld" - }, { - "@id": "#t0051", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Expansion of keyword aliases in term definitions", - "purpose": "Expanding terms which are keyword aliases", - "input": "expand-0051-in.jsonld", - "expect": "expand-0051-out.jsonld" - }, { - "@id": "#t0052", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "@vocab-relative IRIs in term definitions", - "purpose": "If @vocab is defined, term definitions are expanded relative to @vocab", - "input": "expand-0052-in.jsonld", - "expect": "expand-0052-out.jsonld" - }, { - "@id": "#t0053", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Expand absolute IRI with @type: @vocab", - "purpose": "Expanding values of properties of @type: @vocab does not further expand absolute IRIs", - "input": "expand-0053-in.jsonld", - "expect": "expand-0053-out.jsonld" - }, { - "@id": "#t0054", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Expand term with @type: @vocab", - "purpose": "Expanding values of properties of @type: @vocab does not expand term values", - "input": "expand-0054-in.jsonld", - "expect": "expand-0054-out.jsonld" - }, { - "@id": "#t0055", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Expand @vocab-relative term with @type: @vocab", - "purpose": "Expanding values of properties of @type: @vocab expands relative IRIs using @vocab", - "input": "expand-0055-in.jsonld", - "expect": "expand-0055-out.jsonld" - }, { - "@id": "#t0056", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Use terms with @type: @vocab but not with @type: @id", - "purpose": "Checks that expansion uses appropriate base depending on term definition having @type @id or @vocab", - "input": "expand-0056-in.jsonld", - "expect": "expand-0056-out.jsonld" - }, { - "@id": "#t0057", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Expand relative IRI with @type: @vocab", - "purpose": "Relative values of terms with @type: @vocab expand relative to @vocab", - "input": "expand-0057-in.jsonld", - "expect": "expand-0057-out.jsonld" - }, { - "@id": "#t0058", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Expand compact IRI with @type: @vocab", - "purpose": "Compact IRIs are expanded normally even if term has @type: @vocab", - "input": "expand-0058-in.jsonld", - "expect": "expand-0058-out.jsonld" - }, { - "@id": "#t0059", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Reset @vocab by setting it to null", - "purpose": "Setting @vocab to null removes a previous definition", - "input": "expand-0059-in.jsonld", - "expect": "expand-0059-out.jsonld" - }, { - "@id": "#t0060", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Overwrite document base with @base and reset it again", - "purpose": "Setting @base to an IRI and then resetting it to nil", - "input": "expand-0060-in.jsonld", - "expect": "expand-0060-out.jsonld" - }, { - "@id": "#t0061", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Coercing native types to arbitrary datatypes", - "purpose": "Expanding native types when coercing to arbitrary datatypes", - "input": "expand-0061-in.jsonld", - "expect": "expand-0061-out.jsonld" - }, { - "@id": "#t0062", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Various relative IRIs with with @base", - "purpose": "Pathological relative IRIs", - "input": "expand-0062-in.jsonld", - "expect": "expand-0062-out.jsonld" - }, { - "@id": "#t0063", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Reverse property and index container", - "purpose": "Expaning reverse properties with an index-container", - "input": "expand-0063-in.jsonld", - "expect": "expand-0063-out.jsonld" - }, { - "@id": "#t0064", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "bnode values of reverse properties", - "purpose": "Expand reverse property whose values are unlabeled blank nodes", - "input": "expand-0064-in.jsonld", - "expect": "expand-0064-out.jsonld" - }, { - "@id": "#t0065", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Drop unmapped keys in reverse map", - "purpose": "Keys that are not mapped to an IRI in a reverse-map are dropped", - "input": "expand-0065-in.jsonld", - "expect": "expand-0065-out.jsonld" - }, { - "@id": "#t0066", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Reverse-map keys with @vocab", - "purpose": "Expand uses @vocab to expand keys in reverse-maps", - "input": "expand-0066-in.jsonld", - "expect": "expand-0066-out.jsonld" - }, { - "@id": "#t0067", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "prefix://suffix not a compact IRI", - "purpose": "prefix:suffix values are not interpreted as compact IRIs if suffix begins with two slashes", - "input": "expand-0067-in.jsonld", - "expect": "expand-0067-out.jsonld" - }, { - "@id": "#t0068", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "_:suffix values are not a compact IRI", - "purpose": "prefix:suffix values are not interpreted as compact IRIs if prefix is an underscore", - "input": "expand-0068-in.jsonld", - "expect": "expand-0068-out.jsonld" - }, { - "@id": "#t0069", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Compact IRI as term with type mapping", - "purpose": "Redefine compact IRI to define type mapping using the compact IRI itself as value of @id", - "input": "expand-0069-in.jsonld", - "expect": "expand-0069-out.jsonld" - }, { - "@id": "#t0070", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Compact IRI as term defined using equivalent compact IRI", - "purpose": "Redefine compact IRI to define type mapping using the compact IRI itself as string value", - "input": "expand-0070-in.jsonld", - "expect": "expand-0070-out.jsonld" - }, { - "@id": "#t0071", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Redefine terms looking like compact IRIs", - "purpose": "Term definitions may look like compact IRIs", - "input": "expand-0071-in.jsonld", - "expect": "expand-0071-out.jsonld" - }, { - "@id": "#t0072", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Redefine term using @vocab, not itself", - "purpose": "Redefining a term as itself when @vocab is defined uses @vocab, not previous term definition", - "input": "expand-0072-in.jsonld", - "expect": "expand-0072-out.jsonld" - }, { - "@id": "#t0073", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "@context not first property", - "purpose": "Objects are unordered, so serialized node definition containing @context may have @context at the end of the node definition", - "input": "expand-0073-in.jsonld", - "expect": "expand-0073-out.jsonld" - }, { - "@id": "#t0074", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "@id not first property", - "purpose": "Objects are unordered, so serialized node definition containing @id may have @id at the end of the node definition", - "input": "expand-0074-in.jsonld", - "expect": "expand-0074-out.jsonld" - }, { - "@id": "#t0075", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "@vocab as blank node identifier", - "purpose": "Use @vocab to map all properties to blank node identifiers", - "input": "expand-0075-in.jsonld", - "expect": "expand-0075-out.jsonld" - }, { - "@id": "#t0076", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "base option overrides document location", - "purpose": "Use of the base option overrides the document location", - "option": { - "base": "http://example/base/" - }, - "input": "expand-0076-in.jsonld", - "expect": "expand-0076-out.jsonld" - }, { - "@id": "#t0077", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "expandContext option", - "purpose": "Use of the expandContext option to expand the input document", - "option": { - "expandContext": "expand-0077-context.jsonld" - }, - "input": "expand-0077-in.jsonld", - "expect": "expand-0077-out.jsonld" - } - ] -} diff --git a/test/json-ld.net.tests/Sorting/W3C/flatten-0002-in.jsonld b/test/json-ld.net.tests/Sorting/W3C/flatten-0002-in.jsonld deleted file mode 100644 index e4598e5..0000000 --- a/test/json-ld.net.tests/Sorting/W3C/flatten-0002-in.jsonld +++ /dev/null @@ -1,18 +0,0 @@ -{ - "@context": { - "t1": "http://example.com/t1", - "t2": "http://example.com/t2", - "term1": "http://example.com/term1", - "term2": "http://example.com/term2", - "term3": "http://example.com/term3", - "term4": "http://example.com/term4", - "term5": "http://example.com/term5" - }, - "@id": "http://example.com/id1", - "@type": "t1", - "term1": "v1", - "term2": {"@value": "v2", "@type": "t2"}, - "term3": {"@value": "v3", "@language": "en"}, - "term4": 4, - "term5": [50, 51] -} diff --git a/test/json-ld.net.tests/Sorting/W3C/flatten-0002-out.jsonld b/test/json-ld.net.tests/Sorting/W3C/flatten-0002-out.jsonld deleted file mode 100644 index 6c72e2d..0000000 --- a/test/json-ld.net.tests/Sorting/W3C/flatten-0002-out.jsonld +++ /dev/null @@ -1,38 +0,0 @@ -[ - { - "@id": "http://example.com/id1", - "@type": [ - "http://example.com/t1" - ], - "http://example.com/term1": [ - { - "@value": "v1" - } - ], - "http://example.com/term2": [ - { - "@type": "http://example.com/t2", - "@value": "v2" - } - ], - "http://example.com/term3": [ - { - "@language": "en", - "@value": "v3" - } - ], - "http://example.com/term4": [ - { - "@value": 4 - } - ], - "http://example.com/term5": [ - { - "@value": 50 - }, - { - "@value": 51 - } - ] - } -] diff --git a/test/json-ld.net.tests/Sorting/W3C/flatten-manifest.jsonld b/test/json-ld.net.tests/Sorting/W3C/flatten-manifest.jsonld deleted file mode 100644 index cea88ae..0000000 --- a/test/json-ld.net.tests/Sorting/W3C/flatten-manifest.jsonld +++ /dev/null @@ -1,330 +0,0 @@ -{ - "@context": "http://json-ld.org/test-suite/context.jsonld", - "@id": "", - "@type": "mf:Manifest", - "name": "Flattening", - "description": "JSON-LD flattening tests use object comparison.", - "baseIri": "http://json-ld.org/test-suite/tests/", - "sequence": [ - { - "@id": "#t0001", - "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], - "name": "drop free-floating nodes", - "purpose": "Flattening drops unreferenced nodes having only @id", - "input": "flatten-0001-in.jsonld", - "expect": "flatten-0001-out.jsonld" - }, { - "@id": "#t0002", - "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], - "name": "basic", - "purpose": "Flattening terms with different types of values", - "input": "flatten-0002-in.jsonld", - "expect": "flatten-0002-out.jsonld" - }, { - "@id": "#t0003", - "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], - "name": "drop null and unmapped properties", - "purpose": "Verifies that null values and unmapped properties are removed from expanded output", - "input": "flatten-0003-in.jsonld", - "expect": "flatten-0003-out.jsonld" - }, { - "@id": "#t0004", - "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], - "name": "optimize @set, keep empty arrays", - "purpose": "Uses of @set are removed in expansion; values of @set, or just plain values which are empty arrays are retained", - "input": "flatten-0004-in.jsonld", - "expect": "flatten-0004-out.jsonld" - }, { - "@id": "#t0005", - "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], - "name": "do not expand aliased @id/@type", - "purpose": "If a keyword is aliased, it is not used when flattening", - "input": "flatten-0005-in.jsonld", - "expect": "flatten-0005-out.jsonld" - }, { - "@id": "#t0006", - "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], - "name": "alias keywords", - "purpose": "Aliased keywords expand in resulting document", - "input": "flatten-0006-in.jsonld", - "expect": "flatten-0006-out.jsonld" - }, { - "@id": "#t0007", - "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], - "name": "date type-coercion", - "purpose": "Expand strings to expanded value with @type: xsd:dateTime", - "input": "flatten-0007-in.jsonld", - "expect": "flatten-0007-out.jsonld" - }, { - "@id": "#t0008", - "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], - "name": "@value with @language", - "purpose": "Keep expanded values with @language, drop non-conforming value objects containing just @language", - "input": "flatten-0008-in.jsonld", - "expect": "flatten-0008-out.jsonld" - }, { - "@id": "#t0009", - "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], - "name": "@graph with terms", - "purpose": "Use of @graph to contain multiple nodes within array", - "input": "flatten-0009-in.jsonld", - "expect": "flatten-0009-out.jsonld" - }, { - "@id": "#t0010", - "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], - "name": "native types", - "purpose": "Flattening native scalar retains native scalar within expanded value", - "input": "flatten-0010-in.jsonld", - "expect": "flatten-0010-out.jsonld" - }, { - "@id": "#t0011", - "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], - "name": "coerced @id", - "purpose": "A value of a property with @type: @id coercion expands to a node reference", - "input": "flatten-0011-in.jsonld", - "expect": "flatten-0011-out.jsonld" - }, { - "@id": "#t0012", - "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], - "name": "@graph with embed", - "purpose": "Flattening objects containing chained objects flattens all objects", - "input": "flatten-0012-in.jsonld", - "expect": "flatten-0012-out.jsonld" - }, { - "@id": "#t0013", - "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], - "name": "flatten already expanded", - "purpose": "Flattening an expanded/flattened document maintains input document", - "input": "flatten-0013-in.jsonld", - "expect": "flatten-0013-out.jsonld" - }, { - "@id": "#t0014", - "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], - "name": "@set of @value objects with keyword aliases", - "purpose": "Flattening aliased @set and @value", - "input": "flatten-0014-in.jsonld", - "expect": "flatten-0014-out.jsonld" - }, { - "@id": "#t0015", - "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], - "name": "collapse set of sets, keep empty lists", - "purpose": "An array of multiple @set nodes are collapsed into a single array", - "input": "flatten-0015-in.jsonld", - "expect": "flatten-0015-out.jsonld" - }, { - "@id": "#t0016", - "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], - "name": "context reset", - "purpose": "Setting @context to null within an embedded object resets back to initial context state", - "input": "flatten-0016-in.jsonld", - "expect": "flatten-0016-out.jsonld" - }, { - "@id": "#t0017", - "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], - "name": "@graph and @id aliased", - "purpose": "Flattening with @graph and @id aliases", - "input": "flatten-0017-in.jsonld", - "expect": "flatten-0017-out.jsonld" - }, { - "@id": "#t0018", - "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], - "name": "override default @language", - "purpose": "override default @language in terms; only language-tag strings", - "input": "flatten-0018-in.jsonld", - "expect": "flatten-0018-out.jsonld" - }, { - "@id": "#t0019", - "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], - "name": "remove @value = null", - "purpose": "Flattening a value of null removes the value", - "input": "flatten-0019-in.jsonld", - "expect": "flatten-0019-out.jsonld" - }, { - "@id": "#t0020", - "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], - "name": "do not remove @graph if not at top-level", - "purpose": "@graph used under a node is retained", - "input": "flatten-0020-in.jsonld", - "expect": "flatten-0020-out.jsonld" - }, { - "@id": "#t0021", - "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], - "name": "do not remove @graph at top-level if not only property", - "purpose": "@graph used at the top level is retained if there are other properties", - "input": "flatten-0021-in.jsonld", - "expect": "flatten-0021-out.jsonld" - }, { - "@id": "#t0022", - "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], - "name": "flatten value with default language", - "purpose": "Flattening with a default language applies that language to string values", - "input": "flatten-0022-in.jsonld", - "expect": "flatten-0022-out.jsonld" - }, { - "@id": "#t0023", - "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], - "name": "Flattening list/set with coercion", - "purpose": "Flattening lists and sets with properties having coercion coerces list/set values", - "input": "flatten-0023-in.jsonld", - "expect": "flatten-0023-out.jsonld" - }, { - "@id": "#t0024", - "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], - "name": "Multiple contexts", - "purpose": "Tests that contexts in an array are merged", - "input": "flatten-0024-in.jsonld", - "expect": "flatten-0024-out.jsonld" - }, { - "@id": "#t0025", - "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], - "name": "Problematic IRI flattening tests", - "purpose": "Flattening different kinds of terms and Compact IRIs", - "input": "flatten-0025-in.jsonld", - "expect": "flatten-0025-out.jsonld" - }, { - "@id": "#t0026", - "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], - "name": "Term definition with @id: @type", - "purpose": "Flattening term mapping to @type uses @type syntax", - "input": "flatten-0026-in.jsonld", - "expect": "flatten-0026-out.jsonld" - }, { - "@id": "#t0027", - "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], - "name": "Duplicate values in @list and @set", - "purpose": "Duplicate values in @list and @set are not merged", - "input": "flatten-0027-in.jsonld", - "expect": "flatten-0027-out.jsonld" - }, { - "@id": "#t0028", - "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], - "name": "Use @vocab in properties and @type but not in @id", - "purpose": "@vocab is used to compact properties and @type, but is not used for @id", - "input": "flatten-0028-in.jsonld", - "expect": "flatten-0028-out.jsonld" - }, { - "@id": "#t0029", - "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], - "name": "Relative IRIs", - "purpose": "@base is used to compact @id; test with different relative IRIs", - "input": "flatten-0029-in.jsonld", - "expect": "flatten-0029-out.jsonld" - }, { - "@id": "#t0030", - "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], - "name": "Language maps", - "purpose": "Language Maps expand values to include @language", - "input": "flatten-0030-in.jsonld", - "expect": "flatten-0030-out.jsonld" - }, { - "@id": "#t0031", - "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], - "name": "type-coercion of native types", - "purpose": "Flattening native types with type coercion adds the coerced type to an expanded value representation and retains the native value representation", - "input": "flatten-0031-in.jsonld", - "expect": "flatten-0031-out.jsonld" - }, { - "@id": "#t0032", - "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], - "name": "Null term and @vocab", - "purpose": "Mapping a term to null decouples it from @vocab", - "input": "flatten-0032-in.jsonld", - "expect": "flatten-0032-out.jsonld" - }, { - "@id": "#t0033", - "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], - "name": "Using @vocab with with type-coercion", - "purpose": "Verifies that terms can be defined using @vocab", - "input": "flatten-0033-in.jsonld", - "expect": "flatten-0033-out.jsonld" - }, { - "@id": "#t0034", - "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], - "name": "Multiple properties expanding to the same IRI", - "purpose": "Verifies multiple values from separate terms are deterministically made multiple values of the IRI associated with the terms", - "input": "flatten-0034-in.jsonld", - "expect": "flatten-0034-out.jsonld" - }, { - "@id": "#t0035", - "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], - "name": "Language maps with @vocab, default language, and colliding property", - "purpose": "Pathological tests of language maps", - "input": "flatten-0035-in.jsonld", - "expect": "flatten-0035-out.jsonld" - }, { - "@id": "#t0036", - "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], - "name": "Flattening @index", - "purpose": "Flattening index maps for terms defined with @container: @index", - "input": "flatten-0036-in.jsonld", - "expect": "flatten-0036-out.jsonld" - }, { - "@id": "#t0037", - "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], - "name": "Flattening reverse properties", - "purpose": "Flattening @reverse keeps @reverse", - "input": "flatten-0037-in.jsonld", - "expect": "flatten-0037-out.jsonld" - }, { - "@id": "#t0038", - "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], - "name": "Flattening blank node labels", - "purpose": "Blank nodes are not relabeled during expansion", - "input": "flatten-0038-in.jsonld", - "expect": "flatten-0038-out.jsonld" - }, { - "@id": "#t0039", - "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], - "name": "Using terms in a reverse-maps", - "purpose": "Terms within @reverse are expanded", - "input": "flatten-0039-in.jsonld", - "expect": "flatten-0039-out.jsonld" - }, { - "@id": "#t0040", - "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], - "name": "language and index expansion on non-objects", - "purpose": "Only invoke language and index map expansion if the value is a JSON object", - "input": "flatten-0040-in.jsonld", - "expect": "flatten-0040-out.jsonld" - }, { - "@id": "#t0041", - "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], - "name": "Free-floating sets and lists", - "purpose": "Free-floating values in sets are removed, free-floating lists are removed completely", - "input": "flatten-0041-in.jsonld", - "expect": "flatten-0041-out.jsonld" - }, { - "@id": "#t0042", - "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], - "name": "List objects not equivalent", - "purpose": "Lists objects are implicit unlabeled blank nodes and thus never equivalent", - "input": "flatten-0042-in.jsonld", - "expect": "flatten-0042-out.jsonld" - }, { - "@id": "#t0043", - "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], - "name": "Sample test manifest extract", - "purpose": "Flatten a test manifest", - "input": "flatten-0043-in.jsonld", - "expect": "flatten-0043-out.jsonld" - }, { - "@id": "#t0044", - "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], - "name": "compactArrays option", - "purpose": "Setting compactArrays to false causes single element arrays to be retained", - "option": { - "compactArrays": false - }, - "input": "flatten-0044-in.jsonld", - "context": "flatten-0044-context.jsonld", - "expect": "flatten-0044-out.jsonld" - }, { - "@id": "#t0045", - "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"], - "name": "Blank nodes with reverse properties", - "purpose": "Proper (re-)labeling of blank nodes if used with reverse properties.", - "input": "flatten-0045-in.jsonld", - "expect": "flatten-0045-out.jsonld" - } - ] -} diff --git a/test/json-ld.net.tests/Sorting/W3C/frame-0002-in.jsonld b/test/json-ld.net.tests/Sorting/W3C/frame-0002-in.jsonld deleted file mode 100644 index ba0b5b1..0000000 --- a/test/json-ld.net.tests/Sorting/W3C/frame-0002-in.jsonld +++ /dev/null @@ -1,28 +0,0 @@ -{ - "@context": { - "dc": "http://purl.org/dc/elements/1.1/", - "ex": "http://example.org/vocab#", - "ex:contains": {"@type": "@id"} - }, - "@graph": [ - { - "@id": "http://example.org/test/#library", - "@type": "ex:Library", - "ex:contains": "http://example.org/test#book" - }, - { - "@id": "http://example.org/test#book", - "@type": "ex:Book", - "dc:contributor": "Writer", - "dc:title": "My Book", - "ex:contains": "http://example.org/test#chapter" - }, - { - "@id": "http://example.org/test#chapter", - "@type": "ex:Chapter", - "dc:description": "Fun", - "dc:title": "Chapter One", - "ex:act": "ex:ActOne" - } - ] -} \ No newline at end of file diff --git a/test/json-ld.net.tests/Sorting/W3C/frame-0002-out.jsonld b/test/json-ld.net.tests/Sorting/W3C/frame-0002-out.jsonld deleted file mode 100644 index db497ad..0000000 --- a/test/json-ld.net.tests/Sorting/W3C/frame-0002-out.jsonld +++ /dev/null @@ -1,23 +0,0 @@ -{ - "@context": { - "dc": "http://purl.org/dc/elements/1.1/", - "ex": "http://example.org/vocab#" - }, - "@graph": [{ - "@id": "http://example.org/test/#library", - "@type": "ex:Library", - "ex:contains": { - "@id": "http://example.org/test#book", - "@type": "ex:Book", - "dc:contributor": "Writer", - "dc:title": "My Book", - "ex:contains": { - "@id": "http://example.org/test#chapter", - "@type": "ex:Chapter", - "dc:description": "Fun", - "dc:title": "Chapter One", - "ex:act": "ex:ActOne" - } - } - }] -} \ No newline at end of file diff --git a/test/json-ld.net.tests/Sorting/W3C/fromRdf-context.jsonld b/test/json-ld.net.tests/Sorting/W3C/fromRdf-context.jsonld deleted file mode 100644 index 89933fe..0000000 --- a/test/json-ld.net.tests/Sorting/W3C/fromRdf-context.jsonld +++ /dev/null @@ -1,11 +0,0 @@ -{ - "@context": { - "object1": { "@id": "http://example.org/object/1" }, - "object2": { "@id": "http://example.org/object/2" }, - "object3": { "@id": "http://example.org/object/3" }, - "value": { - "@id": "http://example.org/value", - "@value": "@id" - } - } -} diff --git a/test/json-ld.net.tests/Sorting/W3C/fromRdf-manifest.jsonld b/test/json-ld.net.tests/Sorting/W3C/fromRdf-manifest.jsonld index 8478617..2718fa2 100644 --- a/test/json-ld.net.tests/Sorting/W3C/fromRdf-manifest.jsonld +++ b/test/json-ld.net.tests/Sorting/W3C/fromRdf-manifest.jsonld @@ -1,8 +1,7 @@ { "@type": "mf:Manifest", - "test-context": "fromRdf-context.jsonld", "name": "From RDF", - "description": "JSON-LD sorting graphs and nodes when running compact", + "description": "JSON-LD sorting graphs and nodes when running FromRDF", "input": "fromRdf-in.json", "sequence": [ { diff --git a/test/json-ld.net.tests/Sorting/W3C/normalize-0002-in.jsonld b/test/json-ld.net.tests/Sorting/W3C/normalize-0002-in.jsonld deleted file mode 100644 index bdcb83c..0000000 --- a/test/json-ld.net.tests/Sorting/W3C/normalize-0002-in.jsonld +++ /dev/null @@ -1,14 +0,0 @@ -{ - "@context": { - "ex": "http://example.org/vocab#" - }, - "@id": "http://example.org/test#example1", - "ex:p": [ - { - "@id": "http://example.org/test#example2" - }, - { - "@id": "http://example.org/test#example2" - } - ] -} \ No newline at end of file diff --git a/test/json-ld.net.tests/Sorting/W3C/normalize-0002-out.nq b/test/json-ld.net.tests/Sorting/W3C/normalize-0002-out.nq deleted file mode 100644 index 529056c..0000000 --- a/test/json-ld.net.tests/Sorting/W3C/normalize-0002-out.nq +++ /dev/null @@ -1 +0,0 @@ - . diff --git a/test/json-ld.net.tests/Sorting/W3C/normalize-manifest.jsonld b/test/json-ld.net.tests/Sorting/W3C/normalize-manifest.jsonld deleted file mode 100644 index d4dcc36..0000000 --- a/test/json-ld.net.tests/Sorting/W3C/normalize-manifest.jsonld +++ /dev/null @@ -1,353 +0,0 @@ -{ - "@context": "http://json-ld.org/test-suite/context.jsonld", - "@id": "", - "@type": "mf:Manifest", - "name": "Normalization", - "description": "JSON-LD to normalized RDF tests output N-Quads and use string comparison.", - "baseIri": "http://json-ld.org/test-suite/tests/", - "sequence": [ - { - "@id": "#t0001", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "simple id", - "input": "normalize-0001-in.jsonld", - "expect": "normalize-0001-out.nq" - }, { - "@id": "#t0002", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "duplicate property iri values", - "input": "normalize-0002-in.jsonld", - "expect": "normalize-0002-out.nq" - }, { - "@id": "#t0003", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "bnode", - "input": "normalize-0003-in.jsonld", - "expect": "normalize-0003-out.nq" - }, { - "@id": "#t0004", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "bnode plus embed w/subject", - "input": "normalize-0004-in.jsonld", - "expect": "normalize-0004-out.nq" - }, { - "@id": "#t0005", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "bnode embed", - "input": "normalize-0005-in.jsonld", - "expect": "normalize-0005-out.nq" - }, { - "@id": "#t0006", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "multiple rdf types", - "input": "normalize-0006-in.jsonld", - "expect": "normalize-0006-out.nq" - }, { - "@id": "#t0007", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "coerce CURIE value", - "input": "normalize-0007-in.jsonld", - "expect": "normalize-0007-out.nq" - }, { - "@id": "#t0008", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "single subject complex", - "input": "normalize-0008-in.jsonld", - "expect": "normalize-0008-out.nq" - }, { - "@id": "#t0009", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "multiple subjects - complex", - "input": "normalize-0009-in.jsonld", - "expect": "normalize-0009-out.nq" - }, { - "@id": "#t0010", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "type", - "input": "normalize-0010-in.jsonld", - "expect": "normalize-0010-out.nq" - }, { - "@id": "#t0011", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "type-coerced type", - "input": "normalize-0011-in.jsonld", - "expect": "normalize-0011-out.nq" - }, { - "@id": "#t0012", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "type-coerced type, remove duplicate reference", - "input": "normalize-0012-in.jsonld", - "expect": "normalize-0012-out.nq" - }, { - "@id": "#t0013", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "type-coerced type, cycle", - "input": "normalize-0013-in.jsonld", - "expect": "normalize-0013-out.nq" - }, { - "@id": "#t0014", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "check types", - "input": "normalize-0014-in.jsonld", - "expect": "normalize-0014-out.nq" - }, { - "@id": "#t0015", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "top level context", - "input": "normalize-0015-in.jsonld", - "expect": "normalize-0015-out.nq" - }, { - "@id": "#t0016", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "blank node - dual link - embed", - "input": "normalize-0016-in.jsonld", - "expect": "normalize-0016-out.nq" - }, { - "@id": "#t0017", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "blank node - dual link - non-embed", - "input": "normalize-0017-in.jsonld", - "expect": "normalize-0017-out.nq" - }, { - "@id": "#t0018", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "blank node - self link", - "input": "normalize-0018-in.jsonld", - "expect": "normalize-0018-out.nq" - }, { - "@id": "#t0019", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "blank node - disjoint self links", - "input": "normalize-0019-in.jsonld", - "expect": "normalize-0019-out.nq" - }, { - "@id": "#t0020", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "blank node - diamond", - "input": "normalize-0020-in.jsonld", - "expect": "normalize-0020-out.nq" - }, { - "@id": "#t0021", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "blank node - circle of 2", - "input": "normalize-0021-in.jsonld", - "expect": "normalize-0021-out.nq" - }, { - "@id": "#t0022", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "blank node - double circle of 2", - "input": "normalize-0022-in.jsonld", - "expect": "normalize-0022-out.nq" - }, { - "@id": "#t0023", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "blank node - circle of 3", - "input": "normalize-0023-in.jsonld", - "expect": "normalize-0023-out.nq" - }, { - "@id": "#t0024", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "blank node - double circle of 3 (1-2-3)", - "input": "normalize-0024-in.jsonld", - "expect": "normalize-0024-out.nq" - }, { - "@id": "#t0025", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "blank node - double circle of 3 (1-3-2)", - "input": "normalize-0025-in.jsonld", - "expect": "normalize-0025-out.nq" - }, { - "@id": "#t0026", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "blank node - double circle of 3 (2-1-3)", - "input": "normalize-0026-in.jsonld", - "expect": "normalize-0026-out.nq" - }, { - "@id": "#t0027", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "blank node - double circle of 3 (2-3-1)", - "input": "normalize-0027-in.jsonld", - "expect": "normalize-0027-out.nq" - }, { - "@id": "#t0028", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "blank node - double circle of 3 (3-2-1)", - "input": "normalize-0028-in.jsonld", - "expect": "normalize-0028-out.nq" - }, { - "@id": "#t0029", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "blank node - double circle of 3 (3-1-2)", - "input": "normalize-0029-in.jsonld", - "expect": "normalize-0029-out.nq" - }, { - "@id": "#t0030", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "blank node - point at circle of 3", - "input": "normalize-0030-in.jsonld", - "expect": "normalize-0030-out.nq" - }, { - "@id": "#t0031", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "bnode (1)", - "input": "normalize-0031-in.jsonld", - "expect": "normalize-0031-out.nq" - }, { - "@id": "#t0032", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "bnode (2)", - "input": "normalize-0032-in.jsonld", - "expect": "normalize-0032-out.nq" - }, { - "@id": "#t0033", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "disjoint identical subgraphs (1)", - "input": "normalize-0033-in.jsonld", - "expect": "normalize-0033-out.nq" - }, { - "@id": "#t0034", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "disjoint identical subgraphs (2)", - "input": "normalize-0034-in.jsonld", - "expect": "normalize-0034-out.nq" - }, { - "@id": "#t0035", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "reordered w/strings (1)", - "input": "normalize-0035-in.jsonld", - "expect": "normalize-0035-out.nq" - }, { - "@id": "#t0036", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "reordered w/strings (2)", - "input": "normalize-0036-in.jsonld", - "expect": "normalize-0036-out.nq" - }, { - "@id": "#t0037", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "reordered w/strings (3)", - "input": "normalize-0037-in.jsonld", - "expect": "normalize-0037-out.nq" - }, { - "@id": "#t0038", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "reordered 4 bnodes, reordered 2 properties (1)", - "input": "normalize-0038-in.jsonld", - "expect": "normalize-0038-out.nq" - }, { - "@id": "#t0039", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "reordered 4 bnodes, reordered 2 properties (2)", - "input": "normalize-0039-in.jsonld", - "expect": "normalize-0039-out.nq" - }, { - "@id": "#t0040", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "reordered 6 bnodes (1)", - "input": "normalize-0040-in.jsonld", - "expect": "normalize-0040-out.nq" - }, { - "@id": "#t0041", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "reordered 6 bnodes (2)", - "input": "normalize-0041-in.jsonld", - "expect": "normalize-0041-out.nq" - }, { - "@id": "#t0042", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "reordered 6 bnodes (3)", - "input": "normalize-0042-in.jsonld", - "expect": "normalize-0042-out.nq" - }, { - "@id": "#t0043", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "literal with language", - "input": "normalize-0043-in.jsonld", - "expect": "normalize-0043-out.nq" - }, { - "@id": "#t0044", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "evil (1)", - "input": "normalize-0044-in.jsonld", - "expect": "normalize-0044-out.nq" - }, { - "@id": "#t0045", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "evil (2)", - "input": "normalize-0045-in.jsonld", - "expect": "normalize-0045-out.nq" - }, { - "@id": "#t0046", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "evil (3)", - "input": "normalize-0046-in.jsonld", - "expect": "normalize-0046-out.nq" - }, { - "@id": "#t0047", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "deep diff (1)", - "input": "normalize-0047-in.jsonld", - "expect": "normalize-0047-out.nq" - }, { - "@id": "#t0048", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "deep diff (2)", - "input": "normalize-0048-in.jsonld", - "expect": "normalize-0048-out.nq" - }, { - "@id": "#t0049", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "remove null", - "input": "normalize-0049-in.jsonld", - "expect": "normalize-0049-out.nq" - }, { - "@id": "#t0050", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "nulls", - "input": "normalize-0050-in.jsonld", - "expect": "normalize-0050-out.nq" - }, { - "@id": "#t0051", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "merging subjects", - "input": "normalize-0051-in.jsonld", - "expect": "normalize-0051-out.nq" - }, { - "@id": "#t0052", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "alias keywords", - "input": "normalize-0052-in.jsonld", - "expect": "normalize-0052-out.nq" - }, { - "@id": "#t0053", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "@list", - "input": "normalize-0053-in.jsonld", - "expect": "normalize-0053-out.nq" - }, { - "@id": "#t0054", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "t-graph", - "input": "normalize-0054-in.jsonld", - "expect": "normalize-0054-out.nq" - }, { - "@id": "#t0055", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "simple reorder (1)", - "input": "normalize-0055-in.jsonld", - "expect": "normalize-0055-out.nq" - }, { - "@id": "#t0056", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "simple reorder (2)", - "input": "normalize-0056-in.jsonld", - "expect": "normalize-0056-out.nq" - }, { - "@id": "#t0057", - "@type": ["jld:PositiveEvaluationTest", "jld:NormalizeTest"], - "name": "unnamed graph", - "input": "normalize-0057-in.jsonld", - "expect": "normalize-0057-out.nq" - } - ] -} diff --git a/test/json-ld.net.tests/Sorting/W3C/remote-doc-0002-in.json b/test/json-ld.net.tests/Sorting/W3C/remote-doc-0002-in.json deleted file mode 100644 index 681f678..0000000 --- a/test/json-ld.net.tests/Sorting/W3C/remote-doc-0002-in.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "@context": { - "@vocab": "http://example/vocab#" - }, - "@id": "", - "term": "object" -} diff --git a/test/json-ld.net.tests/Sorting/W3C/remote-doc-0002-out.jsonld b/test/json-ld.net.tests/Sorting/W3C/remote-doc-0002-out.jsonld deleted file mode 100644 index e4fc288..0000000 --- a/test/json-ld.net.tests/Sorting/W3C/remote-doc-0002-out.jsonld +++ /dev/null @@ -1,4 +0,0 @@ -[{ - "@id": "https://json-ld.org/test-suite/tests/remote-doc-0002-in.json", - "http://example/vocab#term": [{"@value": "object"}] -}] diff --git a/test/json-ld.net.tests/Sorting/W3C/remote-doc-manifest.jsonld b/test/json-ld.net.tests/Sorting/W3C/remote-doc-manifest.jsonld deleted file mode 100644 index e9d9b4a..0000000 --- a/test/json-ld.net.tests/Sorting/W3C/remote-doc-manifest.jsonld +++ /dev/null @@ -1,129 +0,0 @@ -{ - "@context": "http://json-ld.org/test-suite/context.jsonld", - "@id": "", - "@type": "mf:Manifest", - "description": "Tests appropriate document loading behavior as defined in the API", - "name": "Remote document", - "baseIri": "http://json-ld.org/test-suite/tests/", - "sequence": [ - { - "@id": "#t0001", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "load JSON-LD document", - "purpose": "Document loader loads a JSON-LD document.", - "input": "remote-doc-0001-in.jsonld", - "expect": "remote-doc-0001-out.jsonld" - }, { - "@id": "#t0002", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "load JSON document", - "purpose": "Document loader loads a JSON document.", - "input": "remote-doc-0002-in.json", - "expect": "remote-doc-0002-out.jsonld" - }, { - "@id": "#t0003", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "load JSON document with extension-type", - "purpose": "Document loader loads a JSON document having an extension mime-subtype.", - "option": { - "contentType": "application/jldTest+json" - }, - "input": "remote-doc-0003-in.jldt", - "expect": "remote-doc-0003-out.jsonld" - }, { - "@id": "#t0004", - "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], - "name": "loading an unknown type raises loading document failed", - "purpose": "Loading a document with a non-JSON mime type raises loading document failed", - "option": { - "contentType": "application/jldTest" - }, - "input": "remote-doc-0004-in.jldte", - "expect": "loading document failed" - }, { - "@id": "#t0005", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Load JSON-LD through 301 redirect", - "purpose": "Loading a document with a redirect should use the redirected URL as document base", - "option": { - "redirectTo": "remote-doc-0001-in.jsonld", - "httpStatus": 301 - }, - "input": "remote-doc-0005-in.jsonld", - "expect": "remote-doc-0001-out.jsonld" - }, { - "@id": "#t0006", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Load JSON-LD through 303 redirect", - "purpose": "Loading a document with a redirect should use the redirected URL as document base", - "option": { - "redirectTo": "remote-doc-0001-in.jsonld", - "httpStatus": 303 - }, - "input": "remote-doc-0006-in.jsonld", - "expect": "remote-doc-0001-out.jsonld" - }, { - "@id": "#t0007", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Load JSON-LD through 307 redirect", - "purpose": "Loading a document with a redirect should use the redirected URL as document base", - "option": { - "redirectTo": "remote-doc-0001-in.jsonld", - "httpStatus": 307 - }, - "input": "remote-doc-0007-in.jsonld", - "expect": "remote-doc-0001-out.jsonld" - }, { - "@id": "#t0008", - "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], - "name": "Non-existant file (404)", - "purpose": "Loading a non-existant file raises loading document failed error", - "input": "remote-doc-0008-in.jsonld", - "expect": "loading document failed" - }, { - "@id": "#t0009", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "load JSON-LD document with link", - "purpose": "If a context is specified in a link header, it is not used for JSON-LD.", - "option": { - "httpLink": "; rel=\"http://www.w3.org/ns/json-ld#context\"" - }, - "input": "remote-doc-0009-in.jsonld", - "expect": "remote-doc-0009-out.jsonld" - }, { - "@id": "#t0010", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "load JSON document with link", - "purpose": "If a context is specified in a link header, it is used for JSON.", - "option": { - "httpLink": "; rel=\"http://www.w3.org/ns/json-ld#context\"" - }, - "input": "remote-doc-0010-in.json", - "expect": "remote-doc-0010-out.jsonld" - }, { - "@id": "#t0011", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "load JSON document with extension-type with link", - "purpose": "If a context is specified in a link header, it is used for a JSON extension type.", - "input": "remote-doc-0011-in.jldt", - "option": { - "contentType": "application/jldTest+json", - "httpLink": "; rel=\"http://www.w3.org/ns/json-ld#context\"" - }, - "expect": "remote-doc-0011-out.jsonld" - }, { - "@id": "#t0012", - "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], - "name": "Multiple context link headers", - "purpose": "Loading a file when multiple link headers are returned is an error", - "option": { - "httpLink": [ - "; rel=\"http://www.w3.org/ns/json-ld#context\"", - "; rel=\"http://www.w3.org/ns/json-ld#context\"" - ] - }, - "input": "remote-doc-0012-in.json", - "expect": "multiple context link headers" - } - ] -} diff --git a/test/json-ld.net.tests/Sorting/W3C/toRdf-0002-in.jsonld b/test/json-ld.net.tests/Sorting/W3C/toRdf-0002-in.jsonld deleted file mode 100644 index bd662d1..0000000 --- a/test/json-ld.net.tests/Sorting/W3C/toRdf-0002-in.jsonld +++ /dev/null @@ -1,5 +0,0 @@ -{ - "@context": {"foaf": "http://xmlns.com/foaf/0.1/"}, - "@id": "http://greggkellogg.net/foaf#me", - "foaf:name": "Gregg Kellogg" -} \ No newline at end of file diff --git a/test/json-ld.net.tests/Sorting/W3C/toRdf-0002-out.nq b/test/json-ld.net.tests/Sorting/W3C/toRdf-0002-out.nq deleted file mode 100644 index f7238bf..0000000 --- a/test/json-ld.net.tests/Sorting/W3C/toRdf-0002-out.nq +++ /dev/null @@ -1 +0,0 @@ - "Gregg Kellogg" . diff --git a/test/json-ld.net.tests/Sorting/W3C/toRdf-manifest.jsonld b/test/json-ld.net.tests/Sorting/W3C/toRdf-manifest.jsonld deleted file mode 100644 index 8abb3e5..0000000 --- a/test/json-ld.net.tests/Sorting/W3C/toRdf-manifest.jsonld +++ /dev/null @@ -1,812 +0,0 @@ -{ - "@context": "http://json-ld.org/test-suite/context.jsonld", - "@id": "", - "@type": "mf:Manifest", - "name": "Transform JSON-LD to RDF", - "description": "JSON-LD to RDF tests generate N-Quads output and use string comparison.", - "baseIri": "http://json-ld.org/test-suite/tests/", - "sequence": [ - { - "@id": "#t0001", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Plain literal with URIs", - "purpose": "Tests generation of a triple using full URIs and a plain literal.", - "input": "toRdf-0001-in.jsonld", - "expect": "toRdf-0001-out.nq" - }, { - "@id": "#t0002", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Plain literal with CURIE from default context", - "purpose": "Tests generation of a triple using a CURIE defined in the default context.", - "input": "toRdf-0002-in.jsonld", - "expect": "toRdf-0002-out.nq" - }, { - "@id": "#t0003", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Default subject is BNode", - "purpose": "Tests that a BNode is created if no explicit subject is set.", - "input": "toRdf-0003-in.jsonld", - "expect": "toRdf-0003-out.nq" - }, { - "@id": "#t0004", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Literal with language tag", - "purpose": "Tests that a plain literal is created with a language tag.", - "input": "toRdf-0004-in.jsonld", - "expect": "toRdf-0004-out.nq" - }, { - "@id": "#t0005", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Extended character set literal", - "purpose": "Tests that a literal may be created using extended characters.", - "input": "toRdf-0005-in.jsonld", - "expect": "toRdf-0005-out.nq" - }, { - "@id": "#t0006", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Typed literal", - "purpose": "Tests creation of a literal with a datatype.", - "input": "toRdf-0006-in.jsonld", - "expect": "toRdf-0006-out.nq" - }, { - "@id": "#t0007", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Tests 'a' generates rdf:type and object is implicit IRI", - "purpose": "Verify that 'a' is an alias for rdf:type, and the object is created as an IRI.", - "input": "toRdf-0007-in.jsonld", - "expect": "toRdf-0007-out.nq" - }, { - "@id": "#t0008", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Test prefix defined in @context", - "purpose": "Generate an IRI using a prefix defined within an @context.", - "input": "toRdf-0008-in.jsonld", - "expect": "toRdf-0008-out.nq" - }, { - "@id": "#t0009", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Test using an empty suffix", - "purpose": "An empty suffix may be used.", - "input": "toRdf-0009-in.jsonld", - "expect": "toRdf-0009-out.nq" - }, { - "@id": "#t0010", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Test object processing defines object", - "purpose": "A property referencing an associative array gets object from subject of array.", - "input": "toRdf-0010-in.jsonld", - "expect": "toRdf-0010-out.nq" - }, { - "@id": "#t0011", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Test object processing defines object with implicit BNode", - "purpose": "If no @ is specified, a BNode is created, and will be used as the object of an enclosing property.", - "input": "toRdf-0011-in.jsonld", - "expect": "toRdf-0011-out.nq" - }, { - "@id": "#t0012", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Multiple Objects for a Single Property", - "purpose": "Tests that Multiple Objects are for a Single Property using array syntax.", - "input": "toRdf-0012-in.jsonld", - "expect": "toRdf-0012-out.nq" - }, { - "@id": "#t0013", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Creation of an empty list", - "purpose": "Tests that @list: [] generates an empty list.", - "input": "toRdf-0013-in.jsonld", - "expect": "toRdf-0013-out.nq" - }, { - "@id": "#t0014", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Creation of a list with single element", - "purpose": "Tests that @list generates a list.", - "input": "toRdf-0014-in.jsonld", - "expect": "toRdf-0014-out.nq" - }, { - "@id": "#t0015", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Creation of a list with multiple elements", - "purpose": "Tests that list with multiple elements.", - "input": "toRdf-0015-in.jsonld", - "expect": "toRdf-0015-out.nq" - }, { - "@id": "#t0016", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Empty IRI expands to resource location", - "purpose": "Expanding an empty IRI uses the test file location.", - "input": "toRdf-0016-in.jsonld", - "expect": "toRdf-0016-out.nq" - }, { - "@id": "#t0017", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Relative IRI expands relative resource location", - "purpose": "Expanding a relative IRI uses the test file location.", - "input": "toRdf-0017-in.jsonld", - "expect": "toRdf-0017-out.nq" - }, { - "@id": "#t0018", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Frag ID expands relative resource location", - "purpose": "Expanding a fragment uses the test file location.", - "input": "toRdf-0018-in.jsonld", - "expect": "toRdf-0018-out.nq" - }, { - "@id": "#t0019", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Test type coercion to anyURI", - "purpose": "Tests coercion of object to anyURI when specified.", - "input": "toRdf-0019-in.jsonld", - "expect": "toRdf-0019-out.nq" - }, { - "@id": "#t0020", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Test type coercion to typed literal", - "purpose": "Tests coercion of object to a typed literal when specified.", - "input": "toRdf-0020-in.jsonld", - "expect": "toRdf-0020-out.nq" - }, { - "@id": "#t0022", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Test coercion of double value", - "purpose": "Tests that a decimal value generates a xsd:double typed literal;.", - "input": "toRdf-0022-in.jsonld", - "expect": "toRdf-0022-out.nq" - }, { - "@id": "#t0023", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Test coercion of integer value", - "purpose": "Tests that a decimal value generates a xsd:integer typed literal.", - "input": "toRdf-0023-in.jsonld", - "expect": "toRdf-0023-out.nq" - }, { - "@id": "#t0024", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Test coercion of boolean value", - "purpose": "Tests that a decimal value generates a xsd:boolean typed literal.", - "input": "toRdf-0024-in.jsonld", - "expect": "toRdf-0024-out.nq" - }, { - "@id": "#t0025", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Test list coercion with single element", - "purpose": "Tests that an array with a single element on a property with @list coercion creates an RDF Collection.", - "input": "toRdf-0025-in.jsonld", - "expect": "toRdf-0025-out.nq" - }, { - "@id": "#t0026", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Test creation of multiple types", - "purpose": "Tests that @type with an array of types creates multiple types.", - "input": "toRdf-0026-in.jsonld", - "expect": "toRdf-0026-out.nq" - }, { - "@id": "#t0027", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Simple named graph (Wikidata)", - "purpose": "Using @graph with other keys places triples in a named graph.", - "input": "toRdf-0027-in.jsonld", - "expect": "toRdf-0027-out.nq" - }, { - "@id": "#t0028", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Simple named graph", - "purpose": "Signing a graph.", - "input": "toRdf-0028-in.jsonld", - "expect": "toRdf-0028-out.nq" - }, { - "@id": "#t0029", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "named graph with embedded named graph", - "purpose": "Tests that named graphs containing named graphs flatten to single level of graph naming.", - "input": "toRdf-0029-in.jsonld", - "expect": "toRdf-0029-out.nq" - }, { - "@id": "#t0030", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "top-level graph with string subject reference", - "purpose": "Tests graphs containing subject references as strings.", - "input": "toRdf-0030-in.jsonld", - "expect": "toRdf-0030-out.nq" - }, { - "@id": "#t0031", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Reverse property", - "purpose": "Tests conversion of reverse properties.", - "input": "toRdf-0031-in.jsonld", - "expect": "toRdf-0031-out.nq" - }, { - "@id": "#t0032", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "@context reordering", - "purpose": "Tests that generated triples do not depend on order of @context.", - "input": "toRdf-0032-in.jsonld", - "expect": "toRdf-0032-out.nq" - }, { - "@id": "#t0033", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "@id reordering", - "purpose": "Tests that generated triples do not depend on order of @id.", - "input": "toRdf-0033-in.jsonld", - "expect": "toRdf-0033-out.nq" - }, { - "@id": "#t0034", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "context properties reordering", - "purpose": "Tests that generated triples do not depend on order of properties inside @context.", - "input": "toRdf-0034-in.jsonld", - "expect": "toRdf-0034-out.nq" - }, { - "@id": "#t0035", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "non-fractional numbers converted to xsd:double", - "purpose": "xsd:double's canonical lexical is used when converting numbers without fraction that are coerced to xsd:double", - "input": "toRdf-0035-in.jsonld", - "expect": "toRdf-0035-out.nq" - }, { - "@id": "#t0036", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Use nodeMapGeneration bnode labels", - "purpose": "The toRDF algorithm does not relabel blank nodes; it reuses the counter from the nodeMapGeneration to generate new ones", - "input": "toRdf-0036-in.jsonld", - "expect": "toRdf-0036-out.nq" - }, { - "@id": "#t0041", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "drop free-floating nodes", - "purpose": "Free-floating nodes do not generate RDF triples", - "input": "toRdf-0041-in.jsonld", - "expect": "toRdf-0041-out.nq" - }, { - "@id": "#t0042", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "basic", - "purpose": "Basic RDF conversion", - "input": "toRdf-0042-in.jsonld", - "expect": "toRdf-0042-out.nq" - }, { - "@id": "#t0043", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "drop null and unmapped properties", - "purpose": "Properties mapped to null or which are never mapped are dropped", - "input": "toRdf-0043-in.jsonld", - "expect": "toRdf-0043-out.nq" - }, { - "@id": "#t0044", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "optimize @set, keep empty arrays", - "purpose": "RDF version of expand-0004", - "input": "toRdf-0044-in.jsonld", - "expect": "toRdf-0044-out.nq" - }, { - "@id": "#t0045", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "do not expand aliased @id/@type", - "purpose": "RDF version of expand-0005", - "input": "toRdf-0045-in.jsonld", - "expect": "toRdf-0045-out.nq" - }, { - "@id": "#t0046", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "alias keywords", - "purpose": "RDF version of expand-0006", - "input": "toRdf-0046-in.jsonld", - "expect": "toRdf-0046-out.nq" - }, { - "@id": "#t0047", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "date type-coercion", - "purpose": "Type-coerced dates generate typed literals", - "input": "toRdf-0047-in.jsonld", - "expect": "toRdf-0047-out.nq" - }, { - "@id": "#t0048", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "@value with @language", - "purpose": "RDF version of expand-0008", - "input": "toRdf-0048-in.jsonld", - "expect": "toRdf-0048-out.nq" - }, { - "@id": "#t0049", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "@graph with terms", - "purpose": "RDF version of expand-0009", - "input": "toRdf-0049-in.jsonld", - "expect": "toRdf-0049-out.nq" - }, { - "@id": "#t0050", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "native types", - "purpose": "Native types generate typed literals", - "input": "toRdf-0050-in.jsonld", - "expect": "toRdf-0050-out.nq" - }, { - "@id": "#t0051", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "coerced @id", - "purpose": "RDF version of expand-0011", - "input": "toRdf-0051-in.jsonld", - "expect": "toRdf-0051-out.nq" - }, { - "@id": "#t0052", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "@graph with embed", - "purpose": "RDF version of expand-0012", - "input": "toRdf-0052-in.jsonld", - "expect": "toRdf-0052-out.nq" - }, { - "@id": "#t0053", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "expand already expanded", - "purpose": "RDF version of expand-0013", - "input": "toRdf-0053-in.jsonld", - "expect": "toRdf-0053-out.nq" - }, { - "@id": "#t0054", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "@set of @value objects with keyword aliases", - "purpose": "RDF version of expand-0014", - "input": "toRdf-0054-in.jsonld", - "expect": "toRdf-0054-out.nq" - }, { - "@id": "#t0055", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "collapse set of sets, keep empty lists", - "purpose": "RDF version of expand-0015", - "input": "toRdf-0055-in.jsonld", - "expect": "toRdf-0055-out.nq" - }, { - "@id": "#t0056", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "context reset", - "purpose": "RDF version of expand-0016", - "input": "toRdf-0056-in.jsonld", - "expect": "toRdf-0056-out.nq" - }, { - "@id": "#t0057", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "@graph and @id aliased", - "purpose": "RDF version of expand-0017", - "input": "toRdf-0057-in.jsonld", - "expect": "toRdf-0057-out.nq" - }, { - "@id": "#t0058", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "override default @language", - "purpose": "RDF version of expand-0018", - "input": "toRdf-0058-in.jsonld", - "expect": "toRdf-0058-out.nq" - }, { - "@id": "#t0059", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "remove @value = null", - "purpose": "RDF version of expand-0019", - "input": "toRdf-0059-in.jsonld", - "expect": "toRdf-0059-out.nq" - }, { - "@id": "#t0060", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "do not remove @graph if not at top-level", - "purpose": "Embedded @graph without @id creates BNode-labeled named graph", - "input": "toRdf-0060-in.jsonld", - "expect": "toRdf-0060-out.nq" - }, { - "@id": "#t0061", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "do not remove @graph at top-level if not only property", - "purpose": "RDF version of expand-0021", - "input": "toRdf-0061-in.jsonld", - "expect": "toRdf-0061-out.nq" - }, { - "@id": "#t0062", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "expand value with default language", - "purpose": "RDF version of expand-0022", - "input": "toRdf-0062-in.jsonld", - "expect": "toRdf-0062-out.nq" - }, { - "@id": "#t0063", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Lists and sets of properties with list/set coercion", - "purpose": "RDF version of expand-0023", - "input": "toRdf-0063-in.jsonld", - "expect": "toRdf-0063-out.nq" - }, { - "@id": "#t0064", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Multiple contexts", - "purpose": "RDF version of expand-0024", - "input": "toRdf-0064-in.jsonld", - "expect": "toRdf-0064-out.nq" - }, { - "@id": "#t0065", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Problematic IRI expansion tests", - "purpose": "RDF version of expand-0025", - "input": "toRdf-0065-in.jsonld", - "expect": "toRdf-0065-out.nq" - }, { - "@id": "#t0066", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Expanding term mapping to @type uses @type syntax", - "purpose": "RDF version of expand-0026", - "input": "toRdf-0066-in.jsonld", - "expect": "toRdf-0066-out.nq" - }, { - "@id": "#t0067", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Keep duplicate values in @list and @set", - "purpose": "RDF version of expand-0027", - "input": "toRdf-0067-in.jsonld", - "expect": "toRdf-0067-out.nq" - }, { - "@id": "#t0068", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Use @vocab in properties and @type but not in @id", - "purpose": "RDF version of expand-0028", - "input": "toRdf-0068-in.jsonld", - "expect": "toRdf-0068-out.nq" - }, { - "@id": "#t0069", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Relative IRIs", - "purpose": "RDF version of expand-0029", - "input": "toRdf-0069-in.jsonld", - "expect": "toRdf-0069-out.nq" - }, { - "@id": "#t0070", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Language maps", - "purpose": "RDF version of expand-0030", - "input": "toRdf-0070-in.jsonld", - "expect": "toRdf-0070-out.nq" - }, { - "@id": "#t0071", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "type-coercion of native types", - "purpose": "RDF version of expand-0031", - "input": "toRdf-0071-in.jsonld", - "expect": "toRdf-0071-out.nq" - }, { - "@id": "#t0072", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Mapping a term to null decouples it from @vocab", - "purpose": "RDF version of expand-0032", - "input": "toRdf-0072-in.jsonld", - "expect": "toRdf-0072-out.nq" - }, { - "@id": "#t0073", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Using @vocab with with type-coercion", - "purpose": "RDF version of expand-0033", - "input": "toRdf-0073-in.jsonld", - "expect": "toRdf-0073-out.nq" - }, { - "@id": "#t0074", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Multiple properties expanding to the same IRI", - "purpose": "RDF version of expand-0034", - "input": "toRdf-0074-in.jsonld", - "expect": "toRdf-0074-out.nq" - }, { - "@id": "#t0075", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Language maps with @vocab, default language, and colliding property", - "purpose": "RDF version of expand-0035", - "input": "toRdf-0075-in.jsonld", - "expect": "toRdf-0075-out.nq" - }, { - "@id": "#t0076", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Expanding @index", - "purpose": "RDF version of expand-0036", - "input": "toRdf-0076-in.jsonld", - "expect": "toRdf-0076-out.nq" - }, { - "@id": "#t0077", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Expanding @reverse", - "purpose": "RDF version of expand-0037", - "input": "toRdf-0077-in.jsonld", - "expect": "toRdf-0077-out.nq" - }, { - "@id": "#t0078", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Drop blank node predicates by default", - "purpose": "Triples with blank node predicates are dropped by default.", - "input": "toRdf-0078-in.jsonld", - "expect": "toRdf-0078-out.nq" - }, { - "@id": "#t0079", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Using terms in a reverse-maps", - "purpose": "RDF version of expand-0039", - "input": "toRdf-0079-in.jsonld", - "expect": "toRdf-0079-out.nq" - }, { - "@id": "#t0080", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "language and index expansion on non-objects", - "purpose": "RDF version of expand-0040", - "input": "toRdf-0080-in.jsonld", - "expect": "toRdf-0080-out.nq" - }, { - "@id": "#t0081", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Reset the default language", - "purpose": "RDF version of expand-0041", - "input": "toRdf-0081-in.jsonld", - "expect": "toRdf-0081-out.nq" - }, { - "@id": "#t0082", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Expanding reverse properties", - "purpose": "RDF version of expand-0042", - "input": "toRdf-0082-in.jsonld", - "expect": "toRdf-0082-out.nq" - }, { - "@id": "#t0083", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Using reverse properties inside a @reverse-container", - "purpose": "RDF version of expand-0043", - "input": "toRdf-0083-in.jsonld", - "expect": "toRdf-0083-out.nq" - }, { - "@id": "#t0084", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Ensure index maps use language mapping", - "purpose": "RDF version of expand-0044", - "input": "toRdf-0084-in.jsonld", - "expect": "toRdf-0084-out.nq" - }, { - "@id": "#t0085", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Top-level value objects are removed", - "purpose": "RDF version of expand-0045", - "input": "toRdf-0085-in.jsonld", - "expect": "toRdf-0085-out.nq" - }, { - "@id": "#t0086", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Free-floating nodes are removed", - "purpose": "RDF version of expand-0046", - "input": "toRdf-0086-in.jsonld", - "expect": "toRdf-0086-out.nq" - }, { - "@id": "#t0087", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Remove free-floating set values and lists", - "purpose": "RDF version of expand-0047", - "input": "toRdf-0087-in.jsonld", - "expect": "toRdf-0087-out.nq" - }, { - "@id": "#t0088", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Terms are ignored in @id", - "purpose": "RDF version of expand-0048", - "input": "toRdf-0088-in.jsonld", - "expect": "toRdf-0088-out.nq" - }, { - "@id": "#t0089", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Using strings as value of a reverse property", - "purpose": "RDF version of expand-0049", - "input": "toRdf-0089-in.jsonld", - "expect": "toRdf-0089-out.nq" - }, { - "@id": "#t0090", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Term definitions with prefix separate from prefix definitions", - "purpose": "RDF version of expand-0050", - "input": "toRdf-0090-in.jsonld", - "expect": "toRdf-0090-out.nq" - }, { - "@id": "#t0091", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Expansion of keyword aliases in term definitions", - "purpose": "RDF version of expand-0051", - "input": "toRdf-0091-in.jsonld", - "expect": "toRdf-0091-out.nq" - }, { - "@id": "#t0092", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "@vocab-relative IRIs in term definitions", - "purpose": "RDF version of expand-0052", - "input": "toRdf-0092-in.jsonld", - "expect": "toRdf-0092-out.nq" - }, { - "@id": "#t0093", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Expand absolute IRI with @type: @vocab", - "purpose": "RDF version of expand-0053", - "input": "toRdf-0093-in.jsonld", - "expect": "toRdf-0093-out.nq" - }, { - "@id": "#t0094", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Expand term with @type: @vocab", - "purpose": "RDF version of expand-0054", - "input": "toRdf-0094-in.jsonld", - "expect": "toRdf-0094-out.nq" - }, { - "@id": "#t0095", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Expand @vocab-relative term with @type: @vocab", - "purpose": "RDF version of expand-0055", - "input": "toRdf-0095-in.jsonld", - "expect": "toRdf-0095-out.nq" - }, { - "@id": "#t0096", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Use terms with @type: @vocab but not with @type: @id", - "purpose": "RDF version of expand-0056", - "input": "toRdf-0096-in.jsonld", - "expect": "toRdf-0096-out.nq" - }, { - "@id": "#t0097", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Expand relative IRI with @type: @vocab", - "purpose": "RDF version of expand-0057", - "input": "toRdf-0097-in.jsonld", - "expect": "toRdf-0097-out.nq" - }, { - "@id": "#t0098", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Expand compact IRI with @type: @vocab", - "purpose": "RDF version of expand-0058", - "input": "toRdf-0098-in.jsonld", - "expect": "toRdf-0098-out.nq" - }, { - "@id": "#t0099", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Reset @vocab by setting it to null", - "purpose": "RDF version of expand-0059", - "input": "toRdf-0099-in.jsonld", - "expect": "toRdf-0099-out.nq" - }, { - "@id": "#t0100", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Overwrite document base with @base and reset it again", - "purpose": "RDF version of expand-0060", - "input": "toRdf-0100-in.jsonld", - "expect": "toRdf-0100-out.nq" - }, { - "@id": "#t0101", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Coercing native types to arbitrary datatypes", - "purpose": "RDF version of expand-0061", - "input": "toRdf-0101-in.jsonld", - "expect": "toRdf-0101-out.nq" - }, { - "@id": "#t0102", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Various relative IRIs with with @base", - "purpose": "RDF version of expand-0062", - "input": "toRdf-0102-in.jsonld", - "expect": "toRdf-0102-out.nq" - }, { - "@id": "#t0103", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Expand a reverse property with an index-container", - "purpose": "RDF version of expand-0063", - "input": "toRdf-0103-in.jsonld", - "expect": "toRdf-0103-out.nq" - }, { - "@id": "#t0104", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Expand reverse property whose values are unlabeled blank nodes", - "purpose": "RDF version of expand-0064", - "input": "toRdf-0104-in.jsonld", - "expect": "toRdf-0104-out.nq" - }, { - "@id": "#t0105", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Keys that are not mapped to an IRI in a reverse-map are dropped", - "purpose": "RDF version of expand-0065", - "input": "toRdf-0105-in.jsonld", - "expect": "toRdf-0105-out.nq" - }, { - "@id": "#t0106", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Use @vocab to expand keys in reverse-maps", - "purpose": "RDF version of expand-0066", - "input": "toRdf-0106-in.jsonld", - "expect": "toRdf-0106-out.nq" - }, { - "@id": "#t0107", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "prefix:://sufffix not a compact IRI", - "purpose": "RDF version of expand-0067", - "input": "toRdf-0107-in.jsonld", - "expect": "toRdf-0107-out.nq" - }, { - "@id": "#t0108", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "_::sufffix not a compact IRI", - "purpose": "RDF version of expand-0068", - "input": "toRdf-0108-in.jsonld", - "expect": "toRdf-0108-out.nq" - }, { - "@id": "#t0109", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Compact IRI as term with type mapping", - "purpose": "RDF version of expand-0069", - "input": "toRdf-0109-in.jsonld", - "expect": "toRdf-0109-out.nq" - }, { - "@id": "#t0110", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Redefine compact IRI with itself", - "purpose": "RDF version of expand-0070", - "input": "toRdf-0110-in.jsonld", - "expect": "toRdf-0110-out.nq" - }, { - "@id": "#t0111", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Redefine terms looking like compact IRIs", - "purpose": "RDF version of expand-0071", - "input": "toRdf-0111-in.jsonld", - "expect": "toRdf-0111-out.nq" - }, { - "@id": "#t0112", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Redefine term using @vocab, not itself", - "purpose": "RDF version of expand-0072", - "input": "toRdf-0112-in.jsonld", - "expect": "toRdf-0112-out.nq" - }, { - "@id": "#t0113", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Dataset with a IRI named graph", - "purpose": "Basic use of creating a named graph using an IRI name", - "input": "toRdf-0113-in.jsonld", - "expect": "toRdf-0113-out.nq" - }, { - "@id": "#t0114", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Dataset with a IRI named graph", - "purpose": "Basic use of creating a named graph using a BNode name", - "input": "toRdf-0114-in.jsonld", - "expect": "toRdf-0114-out.nq" - }, { - "@id": "#t0115", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Dataset with a default and two named graphs", - "purpose": "Dataset with a default and two named graphs (IRI and BNode)", - "input": "toRdf-0115-in.jsonld", - "expect": "toRdf-0115-out.nq" - }, { - "@id": "#t0116", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Dataset from node with embedded named graph", - "purpose": "Embedding @graph in a node creates a named graph", - "input": "toRdf-0116-in.jsonld", - "expect": "toRdf-0116-out.nq" - }, { - "@id": "#t0117", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Dataset from node with embedded named graph (bnode)", - "purpose": "Embedding @graph in a node creates a named graph. Graph name is created if there is no subject", - "input": "toRdf-0117-in.jsonld", - "expect": "toRdf-0117-out.nq" - }, { - "@id": "#t0118", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "produce generalized RDF flag", - "purpose": "Triples with blank node predicates are not dropped if the produce generalized RDF flag is true.", - "option": { - "produceGeneralizedRdf": true - }, - "input": "toRdf-0118-in.jsonld", - "expect": "toRdf-0118-out.nq" - }, { - "@id": "#t0119", - "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], - "name": "Blank nodes with reverse properties", - "purpose": "Proper (re-)labeling of blank nodes if used with reverse properties.", - "input": "toRdf-0119-in.jsonld", - "expect": "toRdf-0119-out.nq" - } - ] -} diff --git a/test/json-ld.net.tests/SortingTests.cs b/test/json-ld.net.tests/SortingTests.cs index 37cb0ba..8b4ce88 100644 --- a/test/json-ld.net.tests/SortingTests.cs +++ b/test/json-ld.net.tests/SortingTests.cs @@ -1,6 +1,5 @@ using JsonLD.Core; using JsonLD.Util; -using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; @@ -21,7 +20,7 @@ public void RunJsonLdProcessor(string id, SortingTestCase testCase) } else { - if (!JsonLdUtils.DeepCompare(result, testCase.output)) + if (!JsonLdUtils.DeepCompare(result, testCase.output, true)) { #if DEBUG Console.WriteLine(id); @@ -41,8 +40,8 @@ public void RunJsonLdProcessor(string id, SortingTestCase testCase) public class SortingTestCase { public JToken input { get; set; } - public JToken context { get; set; } public JToken output { get; set; } + public JToken context { get; set; } public JToken frame { get; set; } public JToken error { get; set; } public Func run { get; set; } @@ -51,13 +50,8 @@ public class SortingTestCase private static string[] GetManifests() { return new[] { - //"compact-manifest.jsonld" - //"expand-manifest.jsonld", - //"flatten-manifest.jsonld", - //"frame-manifest.jsonld", - //"toRdf-manifest.jsonld", "fromRdf-manifest.jsonld", - //"normalize-manifest.jsonld" + //"compact-manifest.jsonld" }; } @@ -73,12 +67,11 @@ public static IEnumerable SortingTestCases() foreach (JObject testcase in manifestJson["sequence"]) { - Func run; + Func run = null; SortingTestCase newCase = new SortingTestCase(); newCase.input = jsonFetcher.GetJson(manifestJson["input"], rootDirectory); newCase.output = jsonFetcher.GetJson(testcase["expect"], rootDirectory); - newCase.context = jsonFetcher.GetJson(manifestJson["test-context"], rootDirectory); var options = new JsonLdOptions(); @@ -86,60 +79,37 @@ public static IEnumerable SortingTestCases() if (sortType == "jld:GraphsAndNodes") { - options.SetSortGraphs(true); - options.SetSortGraphNodes(true); + options.SetSortGraphsFromRdf(true); + options.SetSortGraphNodesFromRdf(true); } else if (sortType == "jld:Graphs") { - options.SetSortGraphs(true); - options.SetSortGraphNodes(false); + options.SetSortGraphsFromRdf(true); + options.SetSortGraphNodesFromRdf(false); } else if (sortType == "jld:Nodes") { - options.SetSortGraphs(false); - options.SetSortGraphNodes(true); + options.SetSortGraphsFromRdf(false); + options.SetSortGraphNodesFromRdf(true); } else if (sortType == "jld:None") { - options.SetSortGraphs(false); - options.SetSortGraphNodes(false); + options.SetSortGraphsFromRdf(false); + options.SetSortGraphNodesFromRdf(false); } JsonLdApi jsonLdApi = new JsonLdApi(options); - Context activeCtx = new Context(newCase.context, options); var testType = (string)testcase["test-type"]; - //if (testType == "jld:Compact") + if (testType == "jld:Compact") { - // run = () => jsonLdApi.FromRDF(rdf); + newCase.context = jsonFetcher.GetJson(manifestJson["test-context"], rootDirectory); + Context activeCtx = new Context(newCase.context, options); + + run = () => jsonLdApi.Compact(activeCtx, null, newCase.input); } - //else if (testType == "jld:Expand") - //{ - // //run = () => JsonLdProcessor.Expand(newCase.input, options); - //} - //else if (testType == "jld:Flatten") - //{ - // //run = () => JsonLdProcessor.Flatten(newCase.input, newCase.context, options); - //} - //else if (testType == "jld:Frame") - //{ - // //run = () => JsonLdProcessor.Frame(newCase.input, newCase.frame, options); - //} - //else if (testType == "jld:Normalize") - //{ - // run = () => new JValue( - // RDFDatasetUtils.ToNQuads((RDFDataset)JsonLdProcessor.Normalize(newCase.input, options)).Replace("\n", "\r\n") - // ); - //} - //else if (testType == "jld:ToRDF") - //{ - // options.format = "application/nquads"; - // //run = () => new JValue( - // // ((string)JsonLdProcessor.ToRDF(newCase.input, options)).Replace("\n", "\r\n") - // //); - //} - //else if (testType == "jld:FromRDF") + else if (testType == "jld:FromRDF") { JToken quads = newCase.input["quads"]; RDFDataset rdf = new RDFDataset(); @@ -158,10 +128,10 @@ public static IEnumerable SortingTestCases() run = () => jsonLdApi.FromRDF(rdf); } - //else - //{ - // run = () => { throw new Exception("Couldn't find a test type, apparently."); }; - //} + else + { + run = () => { throw new Exception("Couldn't find a test type, apparently."); }; + } newCase.run = run; diff --git a/test/json-ld.net.tests/W3C/compact-0010-out.jsonld b/test/json-ld.net.tests/W3C/compact-0010-out.jsonld index 43b3d1d..d082ddb 100644 --- a/test/json-ld.net.tests/W3C/compact-0010-out.jsonld +++ b/test/json-ld.net.tests/W3C/compact-0010-out.jsonld @@ -1,20 +1,34 @@ { - "@context": { - "homepage": { - "@id": "http://xmlns.com/foaf/0.1/homepage", - "@type": "@id" + "@context": { + "homepage": { + "@id": "http://xmlns.com/foaf/0.1/homepage", + "@type": "@id" + }, + "name": "http://xmlns.com/foaf/0.1/name" }, - "name": "http://xmlns.com/foaf/0.1/name" - }, - "@graph": [ - { - "@id": "http://example.com/john", - "homepage": "http://john.doe.org/", - "name": "John Doe" - }, - { - "@id": "http://example.com/jane", - "name": "Jane Doe" - } - ] + "@graph": [ + { + "@id": "http://example.com/john", + "homepage": "http://john.doe.org/", + "name": "John Doe" + }, + { + "@id": "http://example.com/jane", + "name": "Jane Doe" + } + ] } + +[ + { + "@id": "http://example.com/john", + "http://xmlns.com/foaf/0.1/homepage": { + "@id": "http://john.doe.org/" + }, + "http://xmlns.com/foaf/0.1/name": "John Doe" + }, + { + "@id": "http://example.com/jane", + "http://xmlns.com/foaf/0.1/name": "Jane Doe" + } +] diff --git a/test/json-ld.net.tests/json-ld.net.tests.csproj b/test/json-ld.net.tests/json-ld.net.tests.csproj index 4f236a6..5e5c133 100644 --- a/test/json-ld.net.tests/json-ld.net.tests.csproj +++ b/test/json-ld.net.tests/json-ld.net.tests.csproj @@ -28,7 +28,13 @@ - + + PreserveNewest + + + PreserveNewest + + PreserveNewest @@ -49,57 +55,6 @@ PreserveNewest - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - \ No newline at end of file From af6061039ae9758c80964bde500cf13ed9df4c54 Mon Sep 17 00:00:00 2001 From: dnllowe Date: Sun, 16 Jun 2019 20:41:05 -0400 Subject: [PATCH 4/9] Removes line spaces that were added --- src/json-ld.net/Core/JsonLdApi.cs | 14 -------------- src/json-ld.net/Core/JsonLdProcessor.cs | 4 ---- src/json-ld.net/Core/NormalizeUtils.cs | 2 -- 3 files changed, 20 deletions(-) diff --git a/src/json-ld.net/Core/JsonLdApi.cs b/src/json-ld.net/Core/JsonLdApi.cs index ea373f4..6672070 100644 --- a/src/json-ld.net/Core/JsonLdApi.cs +++ b/src/json-ld.net/Core/JsonLdApi.cs @@ -122,9 +122,7 @@ public virtual JToken Compact(Context activeCtx, string activeProperty, JToken e JObject result = new JObject(); // 7) JArray keys = new JArray(element.GetKeys()); - keys.SortInPlace(); - foreach (string expandedProperty in keys) { JToken expandedValue = elem[expandedProperty]; @@ -492,9 +490,7 @@ public virtual JToken Expand(Context activeCtx, string activeProperty, JToken el JObject result = new JObject(); // 7) JArray keys = new JArray(element.GetKeys()); - keys.SortInPlace(); - foreach (string key in keys) { JToken value = elem[key]; @@ -811,9 +807,7 @@ public virtual JToken Expand(Context activeCtx, string activeProperty, JToken el expandedValue = new JArray(); // 7.6.2) JArray indexKeys = new JArray(value.GetKeys()); - indexKeys.SortInPlace(); - foreach (string index in indexKeys) { JToken indexValue = ((JObject)value)[index]; @@ -1295,9 +1289,7 @@ private void GenerateNodeMap(JToken element, JObject nodeMap, } // 6.11) JArray keys = new JArray(element.GetKeys()); - keys.SortInPlace(); - foreach (string property_1 in keys) { var eachProperty_1 = property_1; @@ -1443,9 +1435,7 @@ private void Frame(JsonLdApi.FramingContext state, JObject nodes bool explicitOn = GetFrameFlag(frame, "@explicit", state.@explicit); // add matches to output JArray ids = new JArray(matches.GetKeys()); - ids.SortInPlace(); - foreach (string id in ids) { if (property == null) @@ -1508,9 +1498,7 @@ private void Frame(JsonLdApi.FramingContext state, JObject nodes // iterate over subject properties JObject element = (JObject)matches[id]; JArray props = new JArray(element.GetKeys()); - props.SortInPlace(); - foreach (string prop in props) { // copy keywords to output @@ -1587,9 +1575,7 @@ private void Frame(JsonLdApi.FramingContext state, JObject nodes } // handle defaults props = new JArray(frame.GetKeys()); - props.SortInPlace(); - foreach (string prop_1 in props) { // skip keywords diff --git a/src/json-ld.net/Core/JsonLdProcessor.cs b/src/json-ld.net/Core/JsonLdProcessor.cs index 2260955..b77acbb 100644 --- a/src/json-ld.net/Core/JsonLdProcessor.cs +++ b/src/json-ld.net/Core/JsonLdProcessor.cs @@ -200,9 +200,7 @@ public static JToken Flatten(JToken input, JToken context, JsonLdOptions opts) entry["@graph"] = new JArray(); } JArray keys = new JArray(graph.GetKeys()); - keys.SortInPlace(); - foreach (string id in keys) { JObject node = (JObject)graph[id]; @@ -216,9 +214,7 @@ public static JToken Flatten(JToken input, JToken context, JsonLdOptions opts) JArray flattened = new JArray(); // 6) JArray keys_1 = new JArray(defaultGraph.GetKeys()); - keys_1.SortInPlace(); - foreach (string id_1 in keys_1) { JObject node = (JObject)defaultGraph[id_1 diff --git a/src/json-ld.net/Core/NormalizeUtils.cs b/src/json-ld.net/Core/NormalizeUtils.cs index 5e43029..82d3bc4 100644 --- a/src/json-ld.net/Core/NormalizeUtils.cs +++ b/src/json-ld.net/Core/NormalizeUtils.cs @@ -45,7 +45,6 @@ public virtual object HashBlankNodes(IEnumerable unnamed_) // done, name blank nodes bool named = false; IList hashes = new List(unique.Keys); - hashes.SortInPlace(); foreach (string hash in hashes) @@ -75,7 +74,6 @@ public virtual object HashBlankNodes(IEnumerable unnamed_) // names duplicate hash bnodes // enumerate duplicate hash groups in sorted order hashes = new List(duplicates.Keys); - hashes.SortInPlace(); // process each group From 47779110d78e5b26642374b215374604588b788e Mon Sep 17 00:00:00 2001 From: dnllowe Date: Sun, 16 Jun 2019 20:47:25 -0400 Subject: [PATCH 5/9] Updates to csproj version --- src/json-ld.net/Core/NormalizeUtils.cs | 4 ---- src/json-ld.net/json-ld.net.csproj | 3 +-- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/json-ld.net/Core/NormalizeUtils.cs b/src/json-ld.net/Core/NormalizeUtils.cs index 82d3bc4..bf746ed 100644 --- a/src/json-ld.net/Core/NormalizeUtils.cs +++ b/src/json-ld.net/Core/NormalizeUtils.cs @@ -46,7 +46,6 @@ public virtual object HashBlankNodes(IEnumerable unnamed_) bool named = false; IList hashes = new List(unique.Keys); hashes.SortInPlace(); - foreach (string hash in hashes) { string bnode = unique[hash]; @@ -75,7 +74,6 @@ public virtual object HashBlankNodes(IEnumerable unnamed_) // enumerate duplicate hash groups in sorted order hashes = new List(duplicates.Keys); hashes.SortInPlace(); - // process each group for (int pgi = 0; ; pgi++) { @@ -113,7 +111,6 @@ public virtual object HashBlankNodes(IEnumerable unnamed_) // sort normalized output normalized.SortInPlace(); - // handle output format if (options.format != null) { @@ -147,7 +144,6 @@ public virtual object HashBlankNodes(IEnumerable unnamed_) { // name bnodes in hash order results.SortInPlace(new _IComparer_145()); - foreach (NormalizeUtils.HashResult r in results) { // name all bnodes in path namer in diff --git a/src/json-ld.net/json-ld.net.csproj b/src/json-ld.net/json-ld.net.csproj index 7d0875b..6fbc093 100644 --- a/src/json-ld.net/json-ld.net.csproj +++ b/src/json-ld.net/json-ld.net.csproj @@ -3,7 +3,7 @@ JSON-LD processor for .NET Implements the W3C JSON-LD 1.0 standard. - 1.0.7.1 + 1.0.7 NuGet;linked-data-dotnet netstandard1.3;netstandard2.0;netcoreapp2.1 json-ld.net @@ -17,7 +17,6 @@ Implements the W3C JSON-LD 1.0 standard. false false false - true From 4b310d516a28629990866c6c0306429c7e9714d0 Mon Sep 17 00:00:00 2001 From: Daniel Lowe Date: Sun, 16 Jun 2019 21:04:02 -0400 Subject: [PATCH 6/9] Rename test case --- test/json-ld.net.tests/SortingTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/json-ld.net.tests/SortingTests.cs b/test/json-ld.net.tests/SortingTests.cs index 8b4ce88..1975263 100644 --- a/test/json-ld.net.tests/SortingTests.cs +++ b/test/json-ld.net.tests/SortingTests.cs @@ -11,7 +11,7 @@ namespace JsonLD.Test public class SortingTests { [Theory, MemberData(nameof(SortingTestCases))] - public void RunJsonLdProcessor(string id, SortingTestCase testCase) + public void RunJsonLdApi(string id, SortingTestCase testCase) { JToken result = testCase.run(); if (testCase.error != null) From 5a5662fbe6b6ba1249645d339d5b1357a579fe2f Mon Sep 17 00:00:00 2001 From: dnllowe Date: Sun, 16 Jun 2019 21:06:43 -0400 Subject: [PATCH 7/9] Removes leftover test code --- .../W3C/compact-0010-out.jsonld | 48 +++++++------------ 1 file changed, 17 insertions(+), 31 deletions(-) diff --git a/test/json-ld.net.tests/W3C/compact-0010-out.jsonld b/test/json-ld.net.tests/W3C/compact-0010-out.jsonld index d082ddb..43b3d1d 100644 --- a/test/json-ld.net.tests/W3C/compact-0010-out.jsonld +++ b/test/json-ld.net.tests/W3C/compact-0010-out.jsonld @@ -1,34 +1,20 @@ { - "@context": { - "homepage": { - "@id": "http://xmlns.com/foaf/0.1/homepage", - "@type": "@id" - }, - "name": "http://xmlns.com/foaf/0.1/name" + "@context": { + "homepage": { + "@id": "http://xmlns.com/foaf/0.1/homepage", + "@type": "@id" }, - "@graph": [ - { - "@id": "http://example.com/john", - "homepage": "http://john.doe.org/", - "name": "John Doe" - }, - { - "@id": "http://example.com/jane", - "name": "Jane Doe" - } - ] -} - -[ - { - "@id": "http://example.com/john", - "http://xmlns.com/foaf/0.1/homepage": { - "@id": "http://john.doe.org/" - }, - "http://xmlns.com/foaf/0.1/name": "John Doe" + "name": "http://xmlns.com/foaf/0.1/name" }, - { - "@id": "http://example.com/jane", - "http://xmlns.com/foaf/0.1/name": "Jane Doe" - } -] + "@graph": [ + { + "@id": "http://example.com/john", + "homepage": "http://john.doe.org/", + "name": "John Doe" + }, + { + "@id": "http://example.com/jane", + "name": "Jane Doe" + } + ] +} From 69820b32a2fa5179ad596ea4e72cdf35d270904b Mon Sep 17 00:00:00 2001 From: "Daniel L. Lowe" Date: Mon, 1 Jun 2020 23:19:51 -0400 Subject: [PATCH 8/9] Updates test Moves to ExtendedFunctionalityTests Refactors to create room for more extended functionality tests --- .../Sorting}/fromRdf-in.json | 0 .../Sorting}/fromRdf-manifest.jsonld | 0 .../Sorting}/fromRdf-out-no-sorting.jsonld | 0 .../fromRdf-out-sort-graph-nodes.jsonld | 0 .../fromRdf-out-sort-graphs-and-nodes.jsonld | 0 .../Sorting}/fromRdf-out-sort-graphs.jsonld | 0 ...Tests.cs => ExtendedFunctionalityTests.cs} | 44 ++++----- .../Sorting/W3C/compact-context.jsonld | 4 - .../Sorting/W3C/compact-in.jsonld | 89 ------------------- .../Sorting/W3C/compact-manifest.jsonld | 41 --------- .../json-ld.net.tests.csproj | 21 ++--- 11 files changed, 28 insertions(+), 171 deletions(-) rename test/json-ld.net.tests/{Sorting/W3C => ExtendedFunctionality/Sorting}/fromRdf-in.json (100%) rename test/json-ld.net.tests/{Sorting/W3C => ExtendedFunctionality/Sorting}/fromRdf-manifest.jsonld (100%) rename test/json-ld.net.tests/{Sorting/W3C => ExtendedFunctionality/Sorting}/fromRdf-out-no-sorting.jsonld (100%) rename test/json-ld.net.tests/{Sorting/W3C => ExtendedFunctionality/Sorting}/fromRdf-out-sort-graph-nodes.jsonld (100%) rename test/json-ld.net.tests/{Sorting/W3C => ExtendedFunctionality/Sorting}/fromRdf-out-sort-graphs-and-nodes.jsonld (100%) rename test/json-ld.net.tests/{Sorting/W3C => ExtendedFunctionality/Sorting}/fromRdf-out-sort-graphs.jsonld (100%) rename test/json-ld.net.tests/{SortingTests.cs => ExtendedFunctionalityTests.cs} (80%) delete mode 100644 test/json-ld.net.tests/Sorting/W3C/compact-context.jsonld delete mode 100644 test/json-ld.net.tests/Sorting/W3C/compact-in.jsonld delete mode 100644 test/json-ld.net.tests/Sorting/W3C/compact-manifest.jsonld diff --git a/test/json-ld.net.tests/Sorting/W3C/fromRdf-in.json b/test/json-ld.net.tests/ExtendedFunctionality/Sorting/fromRdf-in.json similarity index 100% rename from test/json-ld.net.tests/Sorting/W3C/fromRdf-in.json rename to test/json-ld.net.tests/ExtendedFunctionality/Sorting/fromRdf-in.json diff --git a/test/json-ld.net.tests/Sorting/W3C/fromRdf-manifest.jsonld b/test/json-ld.net.tests/ExtendedFunctionality/Sorting/fromRdf-manifest.jsonld similarity index 100% rename from test/json-ld.net.tests/Sorting/W3C/fromRdf-manifest.jsonld rename to test/json-ld.net.tests/ExtendedFunctionality/Sorting/fromRdf-manifest.jsonld diff --git a/test/json-ld.net.tests/Sorting/W3C/fromRdf-out-no-sorting.jsonld b/test/json-ld.net.tests/ExtendedFunctionality/Sorting/fromRdf-out-no-sorting.jsonld similarity index 100% rename from test/json-ld.net.tests/Sorting/W3C/fromRdf-out-no-sorting.jsonld rename to test/json-ld.net.tests/ExtendedFunctionality/Sorting/fromRdf-out-no-sorting.jsonld diff --git a/test/json-ld.net.tests/Sorting/W3C/fromRdf-out-sort-graph-nodes.jsonld b/test/json-ld.net.tests/ExtendedFunctionality/Sorting/fromRdf-out-sort-graph-nodes.jsonld similarity index 100% rename from test/json-ld.net.tests/Sorting/W3C/fromRdf-out-sort-graph-nodes.jsonld rename to test/json-ld.net.tests/ExtendedFunctionality/Sorting/fromRdf-out-sort-graph-nodes.jsonld diff --git a/test/json-ld.net.tests/Sorting/W3C/fromRdf-out-sort-graphs-and-nodes.jsonld b/test/json-ld.net.tests/ExtendedFunctionality/Sorting/fromRdf-out-sort-graphs-and-nodes.jsonld similarity index 100% rename from test/json-ld.net.tests/Sorting/W3C/fromRdf-out-sort-graphs-and-nodes.jsonld rename to test/json-ld.net.tests/ExtendedFunctionality/Sorting/fromRdf-out-sort-graphs-and-nodes.jsonld diff --git a/test/json-ld.net.tests/Sorting/W3C/fromRdf-out-sort-graphs.jsonld b/test/json-ld.net.tests/ExtendedFunctionality/Sorting/fromRdf-out-sort-graphs.jsonld similarity index 100% rename from test/json-ld.net.tests/Sorting/W3C/fromRdf-out-sort-graphs.jsonld rename to test/json-ld.net.tests/ExtendedFunctionality/Sorting/fromRdf-out-sort-graphs.jsonld diff --git a/test/json-ld.net.tests/SortingTests.cs b/test/json-ld.net.tests/ExtendedFunctionalityTests.cs similarity index 80% rename from test/json-ld.net.tests/SortingTests.cs rename to test/json-ld.net.tests/ExtendedFunctionalityTests.cs index 1975263..41c18dd 100644 --- a/test/json-ld.net.tests/SortingTests.cs +++ b/test/json-ld.net.tests/ExtendedFunctionalityTests.cs @@ -8,10 +8,12 @@ namespace JsonLD.Test { - public class SortingTests + public class ExtendedFunctionalityTests { - [Theory, MemberData(nameof(SortingTestCases))] - public void RunJsonLdApi(string id, SortingTestCase testCase) + public const string ManifestRoot = "ExtendedFunctionality"; + + [Theory, MemberData(nameof(ExtendedFunctionalityCases))] + public void ExtendedFunctionalityTestPasses(string id, ExtendedFunctionalityTestCase testCase) { JToken result = testCase.run(); if (testCase.error != null) @@ -37,7 +39,7 @@ public void RunJsonLdApi(string id, SortingTestCase testCase) } } - public class SortingTestCase + public class ExtendedFunctionalityTestCase { public JToken input { get; set; } public JToken output { get; set; } @@ -47,28 +49,33 @@ public class SortingTestCase public Func run { get; set; } } - private static string[] GetManifests() + public static IEnumerable ExtendedFunctionalityCases() { - return new[] { - "fromRdf-manifest.jsonld", - //"compact-manifest.jsonld" - }; + foreach (var testCase in SortingTestCases()) + { + yield return testCase; + } } + private static string[] SortingManifests = + { + "fromRdf-manifest.jsonld" + }; + public static IEnumerable SortingTestCases() { - var manifests = GetManifests(); var jsonFetcher = new JsonFetcher(); - var rootDirectory = Path.Combine("Sorting", "W3C"); - - foreach (string manifest in manifests) + var rootDirectory = Path.Combine(ManifestRoot, "Sorting"); + var cases = new List { }; + + foreach (string manifest in SortingManifests) { JToken manifestJson = jsonFetcher.GetJson(manifest, rootDirectory); foreach (JObject testcase in manifestJson["sequence"]) { Func run = null; - SortingTestCase newCase = new SortingTestCase(); + ExtendedFunctionalityTestCase newCase = new ExtendedFunctionalityTestCase(); newCase.input = jsonFetcher.GetJson(manifestJson["input"], rootDirectory); newCase.output = jsonFetcher.GetJson(testcase["expect"], rootDirectory); @@ -102,14 +109,7 @@ public static IEnumerable SortingTestCases() var testType = (string)testcase["test-type"]; - if (testType == "jld:Compact") - { - newCase.context = jsonFetcher.GetJson(manifestJson["test-context"], rootDirectory); - Context activeCtx = new Context(newCase.context, options); - - run = () => jsonLdApi.Compact(activeCtx, null, newCase.input); - } - else if (testType == "jld:FromRDF") + if (testType == "jld:FromRDF") { JToken quads = newCase.input["quads"]; RDFDataset rdf = new RDFDataset(); diff --git a/test/json-ld.net.tests/Sorting/W3C/compact-context.jsonld b/test/json-ld.net.tests/Sorting/W3C/compact-context.jsonld deleted file mode 100644 index fab1a80..0000000 --- a/test/json-ld.net.tests/Sorting/W3C/compact-context.jsonld +++ /dev/null @@ -1,4 +0,0 @@ -{ - "@context": { - } -} \ No newline at end of file diff --git a/test/json-ld.net.tests/Sorting/W3C/compact-in.jsonld b/test/json-ld.net.tests/Sorting/W3C/compact-in.jsonld deleted file mode 100644 index 5a11289..0000000 --- a/test/json-ld.net.tests/Sorting/W3C/compact-in.jsonld +++ /dev/null @@ -1,89 +0,0 @@ -[ - { - "@id": "http://example.org/node/3", - "@graph": [ - { - "@id": "http://example.org/object/3", - "http://example.org/value": [ - { - "@id": "n3-o3-value" - } - ] - }, - { - "@id": "http://example.org/object/1", - "http://example.org/value": [ - { - "@id": "n3-o1-value" - } - ] - }, - { - "@id": "http://example.org/object/2", - "http://example.org/value": [ - { - "@id": "n3-o2-value" - } - ] - } - ] - }, - { - "@id": "http://example.org/node/1", - "@graph": [ - { - "@id": "http://example.org/object/3", - "http://example.org/value": [ - { - "@id": "n1-o3-value" - } - ] - }, - { - "@id": "http://example.org/object/1", - "http://example.org/value": [ - { - "@id": "n1-o1-value" - } - ] - }, - { - "@id": "http://example.org/object/2", - "http://example.org/value": [ - { - "@id": "n1-o2-value" - } - ] - } - ] - }, - { - "@id": "http://example.org/node/2", - "@graph": [ - { - "@id": "http://example.org/object/3", - "http://example.org/value": [ - { - "@id": "n2-o3-value" - } - ] - }, - { - "@id": "http://example.org/object/1", - "http://example.org/value": [ - { - "@id": "n2-o1-value" - } - ] - }, - { - "@id": "http://example.org/object/2", - "http://example.org/value": [ - { - "@id": "n2-o2-value" - } - ] - } - ] - } -] \ No newline at end of file diff --git a/test/json-ld.net.tests/Sorting/W3C/compact-manifest.jsonld b/test/json-ld.net.tests/Sorting/W3C/compact-manifest.jsonld deleted file mode 100644 index bff774d..0000000 --- a/test/json-ld.net.tests/Sorting/W3C/compact-manifest.jsonld +++ /dev/null @@ -1,41 +0,0 @@ -{ - "@type": "mf:Manifest", - "name": "Compaction", - "description": "JSON-LD sorting graphs and nodes when running Compact", - "test-context": "compact-context.jsonld", - "input": "compact-in.jsonld", - "sequence": [ - { - "@id": "#t0001", - "sort-type": "jld:GraphsAndNodes", - "test-type": "jld:Compact", - "name": "sort graphs and nodes", - "purpose": "graphs and nodes sorted when running Compact", - "expect": "compact-out-sort-graphs-and-nodes.jsonld" - }, - { - "@id": "#t0002", - "sort-type": "jld:Graphs", - "test-type": "jld:Compact", - "name": "sort graphs only", - "purpose": "graphs sorted when running Compact", - "expect": "compact-out-sort-graphs.jsonld" - }, - { - "@id": "#t0003", - "sort-type": "jld:Nodes", - "test-type": "jld:Compact", - "name": "sort graph nodes only", - "purpose": "graph nodes sorted when running Compact", - "expect": "compact-out-sort-graph-nodes.jsonld" - }, - { - "@id": "#t0004", - "sort-type": "jld:None", - "test-type": "jld:Compact", - "name": "sort nothing", - "purpose": "sort nothing running Compact", - "expect": "compact-out-no-sorting.jsonld" - } - ] -} diff --git a/test/json-ld.net.tests/json-ld.net.tests.csproj b/test/json-ld.net.tests/json-ld.net.tests.csproj index 7feb73e..372434c 100644 --- a/test/json-ld.net.tests/json-ld.net.tests.csproj +++ b/test/json-ld.net.tests/json-ld.net.tests.csproj @@ -28,31 +28,22 @@ - + PreserveNewest - + PreserveNewest - + PreserveNewest - + PreserveNewest - + PreserveNewest - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - + PreserveNewest From 0e35a8f1556d6303cbdb7bf5af5e1cf4f8c3ec3a Mon Sep 17 00:00:00 2001 From: "Daniel L. Lowe" Date: Mon, 1 Jun 2020 23:22:59 -0400 Subject: [PATCH 9/9] Some cleanup --- test/json-ld.net.tests/ExtendedFunctionalityTests.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/json-ld.net.tests/ExtendedFunctionalityTests.cs b/test/json-ld.net.tests/ExtendedFunctionalityTests.cs index 41c18dd..f0c4f68 100644 --- a/test/json-ld.net.tests/ExtendedFunctionalityTests.cs +++ b/test/json-ld.net.tests/ExtendedFunctionalityTests.cs @@ -10,7 +10,7 @@ namespace JsonLD.Test { public class ExtendedFunctionalityTests { - public const string ManifestRoot = "ExtendedFunctionality"; + private const string ManifestRoot = "ExtendedFunctionality"; [Theory, MemberData(nameof(ExtendedFunctionalityCases))] public void ExtendedFunctionalityTestPasses(string id, ExtendedFunctionalityTestCase testCase) @@ -62,11 +62,10 @@ public static IEnumerable ExtendedFunctionalityCases() "fromRdf-manifest.jsonld" }; - public static IEnumerable SortingTestCases() + private static IEnumerable SortingTestCases() { var jsonFetcher = new JsonFetcher(); var rootDirectory = Path.Combine(ManifestRoot, "Sorting"); - var cases = new List { }; foreach (string manifest in SortingManifests) {