From 7be68d8e905aaaf38b32d492f4e4e8bf2ab95a79 Mon Sep 17 00:00:00 2001 From: Justin Emgarten Date: Fri, 20 May 2016 15:00:06 -0700 Subject: [PATCH 1/8] Adding nuget.org package source --- NuGet.Config | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 NuGet.Config diff --git a/NuGet.Config b/NuGet.Config new file mode 100644 index 0000000..d83f0ce --- /dev/null +++ b/NuGet.Config @@ -0,0 +1,10 @@ + + + + + + + + + + From 7c8c16a3f886f8b31c6672525c31d2a20e64bb68 Mon Sep 17 00:00:00 2001 From: Justin Emgarten Date: Sun, 5 Jun 2016 22:45:52 -0700 Subject: [PATCH 2/8] Updating dotnet rc2 install url --- build.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.ps1 b/build.ps1 index 5791303..fdea86b 100644 --- a/build.ps1 +++ b/build.ps1 @@ -30,7 +30,7 @@ $env:DOTNET_INSTALL_DIR=$NuGetClientRoot New-Item -ItemType Directory -Force -Path $CLIRoot -wget https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0/scripts/obtain/install.ps1 -OutFile cli/install.ps1 +wget https://raw.githubusercontent.com/dotnet/cli/5a77b03f36904670faa36c0d294237ec8841e8f1/scripts/obtain/dotnet-install.ps1 -OutFile cli/install.ps1 & cli/install.ps1 -Channel beta -i $CLIRoot -Version 1.0.0-preview1-002702 From 4838b02ddc10f22e0eb9a41d719197114ca2bbf6 Mon Sep 17 00:00:00 2001 From: Harikrishna Menon Date: Wed, 22 Jun 2016 21:39:43 -0700 Subject: [PATCH 3/8] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 9932132..a7b214d 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,8 @@ A JSON-LD processor for .NET. v1.0.5 is available on NuGet.org at https://www.nuget.org/packages/json-ld.net/ +This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. + #### Supported frameworks * NET 4.0 From 258473e969188f83c668f10f43542180e46ab5ce Mon Sep 17 00:00:00 2001 From: Andrew Stewart Gibson Date: Fri, 22 Jun 2018 21:43:57 +0100 Subject: [PATCH 4/8] Corrected -out files to reflect the canonical versions hosted on json-ld.net (#24) --- test/json-ld.net.tests/W3C/remote-doc-0001-out.jsonld | 2 +- test/json-ld.net.tests/W3C/remote-doc-0002-out.jsonld | 2 +- test/json-ld.net.tests/W3C/remote-doc-0003-out.jsonld | 2 +- test/json-ld.net.tests/W3C/remote-doc-0009-out.jsonld | 2 +- test/json-ld.net.tests/W3C/remote-doc-0010-out.jsonld | 2 +- test/json-ld.net.tests/W3C/remote-doc-0011-out.jsonld | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/json-ld.net.tests/W3C/remote-doc-0001-out.jsonld b/test/json-ld.net.tests/W3C/remote-doc-0001-out.jsonld index 5d1957a..00d00cc 100644 --- a/test/json-ld.net.tests/W3C/remote-doc-0001-out.jsonld +++ b/test/json-ld.net.tests/W3C/remote-doc-0001-out.jsonld @@ -1,4 +1,4 @@ [{ - "@id": "http://json-ld.org/test-suite/tests/remote-doc-0001-in.jsonld", + "@id": "https://json-ld.org/test-suite/tests/remote-doc-0001-in.jsonld", "http://example/vocab#term": [{"@value": "object"}] }] diff --git a/test/json-ld.net.tests/W3C/remote-doc-0002-out.jsonld b/test/json-ld.net.tests/W3C/remote-doc-0002-out.jsonld index b41edc7..e4fc288 100644 --- a/test/json-ld.net.tests/W3C/remote-doc-0002-out.jsonld +++ b/test/json-ld.net.tests/W3C/remote-doc-0002-out.jsonld @@ -1,4 +1,4 @@ [{ - "@id": "http://json-ld.org/test-suite/tests/remote-doc-0002-in.json", + "@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/W3C/remote-doc-0003-out.jsonld b/test/json-ld.net.tests/W3C/remote-doc-0003-out.jsonld index 4564d66..ba4d9f3 100644 --- a/test/json-ld.net.tests/W3C/remote-doc-0003-out.jsonld +++ b/test/json-ld.net.tests/W3C/remote-doc-0003-out.jsonld @@ -1,4 +1,4 @@ [{ - "@id": "http://json-ld.org/test-suite/tests/remote-doc-0003-in.jldt", + "@id": "https://json-ld.org/test-suite/tests/remote-doc-0003-in.jldt", "http://example/vocab#term": [{"@value": "object"}] }] diff --git a/test/json-ld.net.tests/W3C/remote-doc-0009-out.jsonld b/test/json-ld.net.tests/W3C/remote-doc-0009-out.jsonld index 427bc1e..09f0b3b 100644 --- a/test/json-ld.net.tests/W3C/remote-doc-0009-out.jsonld +++ b/test/json-ld.net.tests/W3C/remote-doc-0009-out.jsonld @@ -1,4 +1,4 @@ [{ - "@id": "http://json-ld.org/test-suite/tests/remote-doc-0009-in.jsonld", + "@id": "https://json-ld.org/test-suite/tests/remote-doc-0009-in.jsonld", "http://example/0009/term": [{"@value": "value1"}] }] \ No newline at end of file diff --git a/test/json-ld.net.tests/W3C/remote-doc-0010-out.jsonld b/test/json-ld.net.tests/W3C/remote-doc-0010-out.jsonld index 804502e..29fc493 100644 --- a/test/json-ld.net.tests/W3C/remote-doc-0010-out.jsonld +++ b/test/json-ld.net.tests/W3C/remote-doc-0010-out.jsonld @@ -1,4 +1,4 @@ [{ - "@id": "http://json-ld.org/test-suite/tests/remote-doc-0010-in.json", + "@id": "https://json-ld.org/test-suite/tests/remote-doc-0010-in.json", "http://example/vocab#term": [{"@value": "value"}] }] diff --git a/test/json-ld.net.tests/W3C/remote-doc-0011-out.jsonld b/test/json-ld.net.tests/W3C/remote-doc-0011-out.jsonld index 0450834..20fda82 100644 --- a/test/json-ld.net.tests/W3C/remote-doc-0011-out.jsonld +++ b/test/json-ld.net.tests/W3C/remote-doc-0011-out.jsonld @@ -1,4 +1,4 @@ [{ - "@id": "http://json-ld.org/test-suite/tests/remote-doc-0011-in.jldt", + "@id": "https://json-ld.org/test-suite/tests/remote-doc-0011-in.jldt", "http://example/vocab#term": [{"@value": "value"}] }] From 508c98889a3652c36f7cf75bc77dfe1bb93aa8c3 Mon Sep 17 00:00:00 2001 From: Damon Tivel Date: Wed, 11 Jul 2018 00:18:52 -0700 Subject: [PATCH 5/8] Fix build script issues. (#33) --- build.ps1 | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/build.ps1 b/build.ps1 index fdea86b..915e8db 100644 --- a/build.ps1 +++ b/build.ps1 @@ -10,6 +10,27 @@ $CLIRoot = Join-Path $RepoRoot 'cli' $DotNetExe = Join-Path $CLIRoot 'dotnet.exe' $NuGetExe = Join-Path $RepoRoot '.nuget\nuget.exe' +Function Error-Log { + param( + [string]$ErrorMessage, + [switch]$Fatal) + if (-not $Fatal) { + Write-Error "[$(Trace-Time)]`t$ErrorMessage" + } + else { + Write-Error "[$(Trace-Time)]`t[FATAL] $ErrorMessage" -ErrorAction Stop + } +} + +Function Trace-Time() { + $currentTime = Get-Date + $lastTime = $Global:LastTraceTime + $Global:LastTraceTime = $currentTime + "{0:HH:mm:ss} +{1:F0}" -f $currentTime, ($currentTime - $lastTime).TotalSeconds +} + +$Global:LastTraceTime = Get-Date + rm -r $ArtifactsDir -Force | Out-Null New-Item -ItemType Directory -Force -Path $CLIRoot | Out-Null @@ -55,6 +76,7 @@ pushd $TestDir & $DotNetExe test --configuration $Configuration -f netcoreapp1.0 if (-not $?) { + popd Error-Log "Tests failed!!!" Exit 1 } @@ -62,11 +84,12 @@ if (-not $?) { # net46 & $DotNetExe build --configuration $Configuration -f net46 --runtime win7-x64 -$xunit = Join-Path $RepoRoot packages\xunit.runner.console.2.1.0\tools\xunit.console.x86.exe +$xunit = Join-Path $RepoRoot packages\xunit.runner.console.2.1.0\tools\xunit.console.exe -& $xunit bin\release\net46\win7-x64\json-ld.net.tests.dll -html (Join-Path $ArtifactsDir "testresults.html") +& $xunit bin\$Configuration\net46\win7-x64\json-ld.net.tests.dll -html (Join-Path $ArtifactsDir "testresults.html") if (-not $?) { + popd Write-Host "Tests failed!!!" Exit 1 } From 66f585b9f8d9d3f91da2314f57befcd26b505e5f Mon Sep 17 00:00:00 2001 From: Damon Tivel Date: Wed, 11 Jul 2018 00:25:57 -0700 Subject: [PATCH 6/8] Improve framing performance with large sets of objects. (#32) --- src/json-ld.net/Core/JsonLdApi.cs | 24 +++++++++++++++++++-- src/json-ld.net/Core/JsonLdSet.cs | 33 +++++++++++++++++++++++++++++ src/json-ld.net/Core/JsonLdUtils.cs | 14 ++++++++---- 3 files changed, 65 insertions(+), 6 deletions(-) create mode 100644 src/json-ld.net/Core/JsonLdSet.cs diff --git a/src/json-ld.net/Core/JsonLdApi.cs b/src/json-ld.net/Core/JsonLdApi.cs index 60d61b8..186d913 100644 --- a/src/json-ld.net/Core/JsonLdApi.cs +++ b/src/json-ld.net/Core/JsonLdApi.cs @@ -1072,14 +1072,34 @@ internal virtual void GenerateNodeMap(JToken element, JObject /// internal virtual void GenerateNodeMap(JToken element, JObject nodeMap, string activeGraph, JToken activeSubject, string activeProperty, JObject list) + { + GenerateNodeMap(element, nodeMap, activeGraph, activeSubject, activeProperty, list, skipSetContainsCheck: false); + } + + private void GenerateNodeMap(JToken element, JObject nodeMap, + string activeGraph, JToken activeSubject, string activeProperty, JObject list, bool skipSetContainsCheck) { // 1) if (element is JArray) { + JsonLdSet set = null; + + if (list == null) + { + set = new JsonLdSet(); + } + // 1.1) foreach (JToken item in (JArray)element) { - GenerateNodeMap(item, nodeMap, activeGraph, activeSubject, activeProperty, list); + skipSetContainsCheck = false; + + if (set != null) + { + skipSetContainsCheck = set.Add(item); + } + + GenerateNodeMap(item, nodeMap, activeGraph, activeSubject, activeProperty, list, skipSetContainsCheck); } return; } @@ -1204,7 +1224,7 @@ internal virtual void GenerateNodeMap(JToken element, JObject if (list == null) { // 6.6.2.1+2) - JsonLdUtils.MergeValue(node, activeProperty, reference); + JsonLdUtils.MergeValue(node, activeProperty, reference, skipSetContainsCheck); } else { diff --git a/src/json-ld.net/Core/JsonLdSet.cs b/src/json-ld.net/Core/JsonLdSet.cs new file mode 100644 index 0000000..a43edc0 --- /dev/null +++ b/src/json-ld.net/Core/JsonLdSet.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using Newtonsoft.Json.Linq; + +namespace JsonLD.Core +{ + internal sealed class JsonLdSet + { + private readonly Lazy> _objects; + + internal JsonLdSet() + { + _objects = new Lazy>(() => new HashSet(StringComparer.Ordinal)); + } + + internal bool Add(JToken token) + { + if (token == null) + { + throw new ArgumentNullException(nameof(token)); + } + + if (token is JObject) + { + var id = token["@id"]; + + return id != null && _objects.Value.Add(id.Value()); + } + + return false; + } + } +} \ No newline at end of file diff --git a/src/json-ld.net/Core/JsonLdUtils.cs b/src/json-ld.net/Core/JsonLdUtils.cs index b0d61b8..fc07804 100644 --- a/src/json-ld.net/Core/JsonLdUtils.cs +++ b/src/json-ld.net/Core/JsonLdUtils.cs @@ -148,8 +148,12 @@ public static bool DeepContains(JArray values, JToken value) return false; } - internal static void MergeValue(JObject obj, string key, JToken - value) + internal static void MergeValue(JObject obj, string key, JToken value) + { + MergeValue(obj, key, value, skipSetContainsCheck: false); + } + + internal static void MergeValue(JObject obj, string key, JToken value, bool skipSetContainsCheck) { if (obj == null) { @@ -161,8 +165,10 @@ internal static void MergeValue(JObject obj, string key, JToken values = new JArray(); obj[key] = values; } - if ("@list".Equals(key) || (value is JObject && ((IDictionary - )value).ContainsKey("@list")) || !DeepContains(values, (JToken)value)) + if (skipSetContainsCheck || + "@list".Equals(key) || + (value is JObject && ((IDictionary)value).ContainsKey("@list")) || + !DeepContains(values, (JToken)value)) { values.Add(value); } From c0d3b8fdbe4626bbda01c39f438104413b0d524a Mon Sep 17 00:00:00 2001 From: Damon Tivel Date: Wed, 11 Jul 2018 00:37:31 -0700 Subject: [PATCH 7/8] Memoize counts. (#30) --- build.ps1 | 8 ++++++-- src/json-ld.net/Core/JsonLdUtils.cs | 10 ++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/build.ps1 b/build.ps1 index 915e8db..ad01962 100644 --- a/build.ps1 +++ b/build.ps1 @@ -10,6 +10,12 @@ $CLIRoot = Join-Path $RepoRoot 'cli' $DotNetExe = Join-Path $CLIRoot 'dotnet.exe' $NuGetExe = Join-Path $RepoRoot '.nuget\nuget.exe' + +if (Test-Path $ArtifactsDir) +{ + rm -r $ArtifactsDir -Force | Out-Null +} + Function Error-Log { param( [string]$ErrorMessage, @@ -31,8 +37,6 @@ Function Trace-Time() { $Global:LastTraceTime = Get-Date -rm -r $ArtifactsDir -Force | Out-Null - New-Item -ItemType Directory -Force -Path $CLIRoot | Out-Null New-Item -ItemType Directory -Force -Path $ArtifactsDir | Out-Null diff --git a/src/json-ld.net/Core/JsonLdUtils.cs b/src/json-ld.net/Core/JsonLdUtils.cs index fc07804..75f7928 100644 --- a/src/json-ld.net/Core/JsonLdUtils.cs +++ b/src/json-ld.net/Core/JsonLdUtils.cs @@ -88,14 +88,16 @@ public static bool DeepCompare(JToken v1, JToken v2, bool listOrderMatters) { JArray l1 = (JArray)v1; JArray l2 = (JArray)v2; - if (l1.Count != l2.Count) + var l1Count = l1.Count; + var l2Count = l2.Count; + if (l1Count != l2Count) { return false; } // used to mark members of l2 that we have already matched to avoid // matching the same item twice for lists that have duplicates - bool[] alreadyMatched = new bool[l2.Count]; - for (int i = 0; i < l1.Count; i++) + bool[] alreadyMatched = new bool[l2Count]; + for (int i = 0; i < l1Count; i++) { JToken o1 = l1[i]; bool gotmatch = false; @@ -105,7 +107,7 @@ public static bool DeepCompare(JToken v1, JToken v2, bool listOrderMatters) } else { - for (int j = 0; j < l2.Count; j++) + for (int j = 0; j < l2Count; j++) { if (!alreadyMatched[j] && DeepCompare(o1, l2[j], listOrderMatters)) { From e76a3a0ee4e691861d662f29e9f7983069fce75d Mon Sep 17 00:00:00 2001 From: Andrew Stewart Gibson Date: Tue, 24 Jul 2018 10:07:41 +0100 Subject: [PATCH 8/8] Changes for v1.0.6 (#35) * v1.0.6 * Update project.json --- src/json-ld.net/project.json | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/json-ld.net/project.json b/src/json-ld.net/project.json index 46cb5e0..ce920d5 100644 --- a/src/json-ld.net/project.json +++ b/src/json-ld.net/project.json @@ -1,17 +1,18 @@ { - "version": "1.0.5", + "version": "1.0.6", "authors": [ - "NuGet" + "NuGet", + "linked-data-dotnet" ], "description": "JSON-LD processor for .NET\n\nImplements the W3C JSON-LD 1.0 standard.", "packOptions": { - "licenseUrl": "https://raw.github.com/NuGet/json-ld.net/master/LICENSE", + "licenseUrl": "https://raw.githubusercontent.com/linked-data-dotnet/json-ld.net/master/LICENSE", "tags": [ "json-ld", "jsonld", "json", "linked-data", "rdf", "semantic", "web" ], "iconUrl": "http://json-ld.org/images/json-ld-logo-64.png", - "projectUrl": "https://github.com/NuGet/json-ld.net/", + "projectUrl": "https://github.com/linked-data-dotnet/json-ld.net/", "owners": [ - "NuGet" + "linked-data-dotnet" ] },