From 6fef0c30db2ed09a6bc0bdf91721ea216ade1d1c Mon Sep 17 00:00:00 2001 From: tpluscode Date: Wed, 25 May 2016 19:32:52 +0200 Subject: [PATCH 1/3] update jsonld.net --- paket.lock | 6 ++++-- src/Example/Nancy.Rdf.Sample/Nancy.Rdf.Sample.csproj | 2 +- src/Nancy.Rdf.Tests/Nancy.Rdf.Tests.csproj | 2 +- src/Nancy.Rdf/Nancy.Rdf.csproj | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/paket.lock b/paket.lock index 4685778..9d104c6 100644 --- a/paket.lock +++ b/paket.lock @@ -17,8 +17,6 @@ NUGET HtmlAgilityPack (1.4.9) JetBrainsAnnotations.Fody (1.0.4) Fody (>= 1.29.2) - JsonLd.Entities (0.3.1) - json-ld.net json-ld.net (1.0.4) Newtonsoft.Json (>= 4.0.1) Microsoft.Owin (3.0.1) @@ -48,3 +46,7 @@ NUGET StyleCopPlus.MSBuild (4.7.49.5) StyleCop.MSBuild (>= 4.7.49.0) VDS.Common (1.6.0) + remote: https://ci.appveyor.com/nuget/jsonld-entities-aavhsnxi7xjp + specs: + JsonLD.Entities (0.3.3) + json-ld.net diff --git a/src/Example/Nancy.Rdf.Sample/Nancy.Rdf.Sample.csproj b/src/Example/Nancy.Rdf.Sample/Nancy.Rdf.Sample.csproj index acbe4d9..17fefbc 100644 --- a/src/Example/Nancy.Rdf.Sample/Nancy.Rdf.Sample.csproj +++ b/src/Example/Nancy.Rdf.Sample/Nancy.Rdf.Sample.csproj @@ -121,7 +121,7 @@ - ..\..\..\packages\JsonLd.Entities\lib\net40\JsonLD.Entities.dll + ..\..\..\packages\JsonLD.Entities\lib\net40\JsonLD.Entities.dll True True diff --git a/src/Nancy.Rdf.Tests/Nancy.Rdf.Tests.csproj b/src/Nancy.Rdf.Tests/Nancy.Rdf.Tests.csproj index 6d01e9a..5a9a350 100644 --- a/src/Nancy.Rdf.Tests/Nancy.Rdf.Tests.csproj +++ b/src/Nancy.Rdf.Tests/Nancy.Rdf.Tests.csproj @@ -213,7 +213,7 @@ - ..\..\packages\JsonLd.Entities\lib\net40\JsonLD.Entities.dll + ..\..\packages\JsonLD.Entities\lib\net40\JsonLD.Entities.dll True True diff --git a/src/Nancy.Rdf/Nancy.Rdf.csproj b/src/Nancy.Rdf/Nancy.Rdf.csproj index 0ebe85b..70a4d04 100644 --- a/src/Nancy.Rdf/Nancy.Rdf.csproj +++ b/src/Nancy.Rdf/Nancy.Rdf.csproj @@ -134,7 +134,7 @@ - ..\..\packages\JsonLd.Entities\lib\net40\JsonLD.Entities.dll + ..\..\packages\JsonLD.Entities\lib\net40\JsonLD.Entities.dll True True From 5e7b61e183a70d83b24d93280a900252077fe419 Mon Sep 17 00:00:00 2001 From: tpluscode Date: Wed, 25 May 2016 20:27:35 +0200 Subject: [PATCH 2/3] update packages --- paket.lock | 16 ++++++++-------- .../Nancy.Rdf.Sample/Nancy.Rdf.Sample.csproj | 4 ++-- src/Nancy.Rdf.Tests/Nancy.Rdf.Tests.csproj | 8 ++++---- src/Nancy.Rdf/Nancy.Rdf.csproj | 8 ++++---- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/paket.lock b/paket.lock index 9d104c6..7a6e91c 100644 --- a/paket.lock +++ b/paket.lock @@ -9,16 +9,16 @@ NUGET HtmlAgilityPack (>= 1.4.9) Newtonsoft.Json (>= 6.0.8) VDS.Common (1.6.0) - FakeItEasy (1.25.3) - FluentAssertions (4.2.2) + FakeItEasy (2.0.0) + FluentAssertions (4.6.3) Fody (1.29.4) gitlink (2.2.0) - GitVersionTask (3.4.1) + GitVersionTask (3.5.4) HtmlAgilityPack (1.4.9) JetBrainsAnnotations.Fody (1.0.4) Fody (>= 1.29.2) - json-ld.net (1.0.4) - Newtonsoft.Json (>= 4.0.1) + json-ld.net (1.0.5) + Newtonsoft.Json (>= 6.0.4) Microsoft.Owin (3.0.1) Owin (>= 1.0) Microsoft.Owin.Host.SystemWeb (3.0.1) @@ -40,9 +40,9 @@ NUGET NUnit (2.6.4) OpenCover (4.6.519) Owin (1.0) - Rdf.Vocabularies (1.1.0) - SpecFlow (2.0.0) - StyleCop.MSBuild (4.7.50) + Rdf.Vocabularies (1.1.1) + SpecFlow (2.1.0) + StyleCop.MSBuild (4.7.54) StyleCopPlus.MSBuild (4.7.49.5) StyleCop.MSBuild (>= 4.7.49.0) VDS.Common (1.6.0) diff --git a/src/Example/Nancy.Rdf.Sample/Nancy.Rdf.Sample.csproj b/src/Example/Nancy.Rdf.Sample/Nancy.Rdf.Sample.csproj index 17fefbc..b04a84c 100644 --- a/src/Example/Nancy.Rdf.Sample/Nancy.Rdf.Sample.csproj +++ b/src/Example/Nancy.Rdf.Sample/Nancy.Rdf.Sample.csproj @@ -131,8 +131,8 @@ - - ..\..\..\packages\json-ld.net\lib\net40-Client\JsonLD.dll + + ..\..\..\packages\json-ld.net\lib\net40-client\json-ld.net.dll True True diff --git a/src/Nancy.Rdf.Tests/Nancy.Rdf.Tests.csproj b/src/Nancy.Rdf.Tests/Nancy.Rdf.Tests.csproj index 5a9a350..6228cc9 100644 --- a/src/Nancy.Rdf.Tests/Nancy.Rdf.Tests.csproj +++ b/src/Nancy.Rdf.Tests/Nancy.Rdf.Tests.csproj @@ -174,7 +174,7 @@ - <__paket__GitVersionTask_targets>\packages\GitVersionTask\Build\portable-net+sl+win+wpa+wp\GitVersionTask + <__paket__GitVersionTask_targets>portable-net+sl+win+wpa+wp\GitVersionTask @@ -223,8 +223,8 @@ - - ..\..\packages\json-ld.net\lib\net40-Client\JsonLD.dll + + ..\..\packages\json-ld.net\lib\net40-client\json-ld.net.dll True True @@ -333,6 +333,6 @@ - + \ No newline at end of file diff --git a/src/Nancy.Rdf/Nancy.Rdf.csproj b/src/Nancy.Rdf/Nancy.Rdf.csproj index 70a4d04..e057b5d 100644 --- a/src/Nancy.Rdf/Nancy.Rdf.csproj +++ b/src/Nancy.Rdf/Nancy.Rdf.csproj @@ -106,7 +106,7 @@ - <__paket__GitVersionTask_targets>\packages\GitVersionTask\Build\portable-net+sl+win+wpa+wp\GitVersionTask + <__paket__GitVersionTask_targets>portable-net+sl+win+wpa+wp\GitVersionTask @@ -144,8 +144,8 @@ - - ..\..\packages\json-ld.net\lib\net40-Client\JsonLD.dll + + ..\..\packages\json-ld.net\lib\net40-client\json-ld.net.dll True True @@ -232,6 +232,6 @@ - + \ No newline at end of file From 3597ed9acb41887877ce5be0baa987f1baa6dccb Mon Sep 17 00:00:00 2001 From: tpluscode Date: Wed, 25 May 2016 21:04:13 +0200 Subject: [PATCH 3/3] switch to stylecop analyzers and fix issues --- Nancy.Rdf.sln | 3 +- paket.dependencies | 2 +- paket.lock | 14 +- src/Common/Common.props | 5 - src/Nancy.Rdf.Tests/Nancy.Rdf.Tests.csproj | 59 ++--- src/Nancy.Rdf.Tests/paket.references | 2 +- ...nager.cs => DictionaryNamespaceManager.cs} | 0 src/Nancy.Rdf/Nancy.Rdf.csproj | 57 +++-- src/Nancy.Rdf/Nancy.Rdf.ruleset | 238 ++++++++++++++++++ src/Nancy.Rdf/RdfSerialization.cs | 17 +- src/Nancy.Rdf/Responses/RdfSerializer.cs | 28 +-- src/Nancy.Rdf/app.config | 8 +- src/Nancy.Rdf/paket.references | 2 +- 13 files changed, 318 insertions(+), 117 deletions(-) rename src/Nancy.Rdf/{DefaultNamespaceManager.cs => DictionaryNamespaceManager.cs} (100%) create mode 100644 src/Nancy.Rdf/Nancy.Rdf.ruleset diff --git a/Nancy.Rdf.sln b/Nancy.Rdf.sln index 7626d04..9024235 100644 --- a/Nancy.Rdf.sln +++ b/Nancy.Rdf.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 -VisualStudioVersion = 14.0.24720.0 +VisualStudioVersion = 14.0.23107.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nancy.Rdf", "src\Nancy.Rdf\Nancy.Rdf.csproj", "{D789D63C-821B-410B-A953-DFEBCBFC9D40}" EndProject @@ -11,7 +11,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution ProjectSection(SolutionItems) = preProject after.Nancy.Rdf.sln.targets = after.Nancy.Rdf.sln.targets appveyor.yml = appveyor.yml - src\Common\Common.props = src\Common\Common.props GitVersionConfig.yaml = GitVersionConfig.yaml paket.dependencies = paket.dependencies paket.lock = paket.lock diff --git a/paket.dependencies b/paket.dependencies index d493ef8..e4f702e 100644 --- a/paket.dependencies +++ b/paket.dependencies @@ -16,7 +16,7 @@ nuget OpenCover nuget SpecFlow nuget FakeItEasy nuget NUnit < 3 -nuget StyleCopPlus.MSBuild +nuget StyleCop.Analyzers nuget GitLink nuget JsonLd.Entities prerelease nuget Nullguard.Fody diff --git a/paket.lock b/paket.lock index 7a6e91c..d051ecb 100644 --- a/paket.lock +++ b/paket.lock @@ -8,11 +8,11 @@ NUGET dotNetRDF (1.0.9.3683) HtmlAgilityPack (>= 1.4.9) Newtonsoft.Json (>= 6.0.8) - VDS.Common (1.6.0) - FakeItEasy (2.0.0) + VDS.Common (1.6) + FakeItEasy (2.0) FluentAssertions (4.6.3) Fody (1.29.4) - gitlink (2.2.0) + gitlink (2.2) GitVersionTask (3.5.4) HtmlAgilityPack (1.4.9) JetBrainsAnnotations.Fody (1.0.4) @@ -41,11 +41,9 @@ NUGET OpenCover (4.6.519) Owin (1.0) Rdf.Vocabularies (1.1.1) - SpecFlow (2.1.0) - StyleCop.MSBuild (4.7.54) - StyleCopPlus.MSBuild (4.7.49.5) - StyleCop.MSBuild (>= 4.7.49.0) - VDS.Common (1.6.0) + SpecFlow (2.1) + StyleCop.Analyzers (1.0) + VDS.Common (1.6) remote: https://ci.appveyor.com/nuget/jsonld-entities-aavhsnxi7xjp specs: JsonLD.Entities (0.3.3) diff --git a/src/Common/Common.props b/src/Common/Common.props index afe8f37..47e0448 100644 --- a/src/Common/Common.props +++ b/src/Common/Common.props @@ -1,10 +1,5 @@ - - - false - - false true diff --git a/src/Nancy.Rdf.Tests/Nancy.Rdf.Tests.csproj b/src/Nancy.Rdf.Tests/Nancy.Rdf.Tests.csproj index 6228cc9..44f6de3 100644 --- a/src/Nancy.Rdf.Tests/Nancy.Rdf.Tests.csproj +++ b/src/Nancy.Rdf.Tests/Nancy.Rdf.Tests.csproj @@ -98,6 +98,20 @@ + + + + <__paket__GitVersionTask_targets>portable-net+sl+win+wpa+wp\GitVersionTask + + + + + + + <__paket__Fody_targets>portable-net+sl+win+wpa+wp\Fody + + + @@ -164,20 +178,6 @@ - - - - <__paket__Fody_targets>portable-net+sl+win+wpa+wp\Fody - - - - - - - <__paket__GitVersionTask_targets>portable-net+sl+win+wpa+wp\GitVersionTask - - - @@ -306,20 +306,19 @@ - - - - <__paket__StyleCop_MSBuild_Targets>StyleCop.MSBuild - - - - - - - <__paket__StyleCopPlus_MSBuild_props>StyleCopPlus.MSBuild - - - + + + + + True + + + True + + + True + + @@ -331,8 +330,4 @@ - - - - \ No newline at end of file diff --git a/src/Nancy.Rdf.Tests/paket.references b/src/Nancy.Rdf.Tests/paket.references index 65f0fde..a551524 100644 --- a/src/Nancy.Rdf.Tests/paket.references +++ b/src/Nancy.Rdf.Tests/paket.references @@ -9,5 +9,5 @@ JsonLd.Entities Nancy.Testing FluentAssertions JetbrainsAnnotations.Fody -StyleCopPlus.MSBuild +StyleCop.Analyzers Rdf.Vocabularies \ No newline at end of file diff --git a/src/Nancy.Rdf/DefaultNamespaceManager.cs b/src/Nancy.Rdf/DictionaryNamespaceManager.cs similarity index 100% rename from src/Nancy.Rdf/DefaultNamespaceManager.cs rename to src/Nancy.Rdf/DictionaryNamespaceManager.cs diff --git a/src/Nancy.Rdf/Nancy.Rdf.csproj b/src/Nancy.Rdf/Nancy.Rdf.csproj index e057b5d..c198f6a 100644 --- a/src/Nancy.Rdf/Nancy.Rdf.csproj +++ b/src/Nancy.Rdf/Nancy.Rdf.csproj @@ -24,6 +24,7 @@ prompt 4 bin\Debug\Nancy.Rdf.xml + Nancy.Rdf.ruleset pdbonly @@ -33,6 +34,8 @@ prompt 4 bin\Release\Nancy.Rdf.xml + true + Nancy.Rdf.ruleset @@ -50,7 +53,7 @@ - + @@ -81,19 +84,16 @@ + - - - ..\..\packages\dotNetRDF\lib\net40\dotNetRDF.dll - True - True - - + + <__paket__GitVersionTask_targets>portable-net+sl+win+wpa+wp\GitVersionTask + @@ -105,9 +105,13 @@ - - <__paket__GitVersionTask_targets>portable-net+sl+win+wpa+wp\GitVersionTask - + + + ..\..\packages\dotNetRDF\lib\net40\dotNetRDF.dll + True + True + + @@ -205,20 +209,19 @@ - - - - <__paket__StyleCop_MSBuild_Targets>StyleCop.MSBuild - - - - - - - <__paket__StyleCopPlus_MSBuild_props>StyleCopPlus.MSBuild - - - + + + + + True + + + True + + + True + + @@ -230,8 +233,4 @@ - - - - \ No newline at end of file diff --git a/src/Nancy.Rdf/Nancy.Rdf.ruleset b/src/Nancy.Rdf/Nancy.Rdf.ruleset new file mode 100644 index 0000000..0baeacb --- /dev/null +++ b/src/Nancy.Rdf/Nancy.Rdf.ruleset @@ -0,0 +1,238 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Nancy.Rdf/RdfSerialization.cs b/src/Nancy.Rdf/RdfSerialization.cs index f9b88a4..a7e69ce 100644 --- a/src/Nancy.Rdf/RdfSerialization.cs +++ b/src/Nancy.Rdf/RdfSerialization.cs @@ -104,29 +104,25 @@ public string Extension } #pragma warning disable 1591 - [SuppressMessage("Microsoft.StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented", - Justification = "Operator or built-in override")] + [SuppressMessage("Microsoft.StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented", Justification = "Operator or built-in override")] public static bool operator ==(RdfSerialization left, RdfSerialization right) { return left.Equals(right); } - [SuppressMessage("Microsoft.StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented", - Justification = "Operator or built-in override")] + [SuppressMessage("Microsoft.StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented", Justification = "Operator or built-in override")] public static bool operator !=(RdfSerialization left, RdfSerialization right) { return !left.Equals(right); } - [SuppressMessage("Microsoft.StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented", - Justification = "Operator or built-in override")] + [SuppressMessage("Microsoft.StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented", Justification = "Operator or built-in override")] public bool Equals(RdfSerialization other) { return string.Equals(_mediaType, other._mediaType) && string.Equals(_extension, other._extension); } - [SuppressMessage("Microsoft.StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented", - Justification = "Operator or built-in override")] + [SuppressMessage("Microsoft.StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented", Justification = "Operator or built-in override")] public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) @@ -137,8 +133,7 @@ public override bool Equals(object obj) return obj is RdfSerialization && Equals((RdfSerialization)obj); } - [SuppressMessage("Microsoft.StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented", - Justification = "Operator or built-in override")] + [SuppressMessage("Microsoft.StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented", Justification = "Operator or built-in override")] public override int GetHashCode() { unchecked @@ -149,7 +144,7 @@ public override int GetHashCode() #pragma warning restore /// - /// Returns a that represents this instance. + /// Returns a that represents this instance. /// public override string ToString() { diff --git a/src/Nancy.Rdf/Responses/RdfSerializer.cs b/src/Nancy.Rdf/Responses/RdfSerializer.cs index cfdb677..b341337 100644 --- a/src/Nancy.Rdf/Responses/RdfSerializer.cs +++ b/src/Nancy.Rdf/Responses/RdfSerializer.cs @@ -6,7 +6,6 @@ using JsonLD.Entities; using Nancy.IO; using VDS.RDF; -using Vocab; namespace Nancy.Rdf.Responses { @@ -51,8 +50,8 @@ public void Serialize(string contentType, TModel model, Stream outputStr using (var writer = new StreamWriter(new UnclosableStreamWrapper(outputStream))) { - var jsObject = _entitySerializer.Serialize(actualModel); - var rdf = (RDFDataset)JsonLdProcessor.ToRDF(jsObject); + var javascriptObject = _entitySerializer.Serialize(actualModel); + var rdf = (RDFDataset)JsonLdProcessor.ToRDF(javascriptObject); WriteRdf(writer, rdf.GetQuads("@default").Select(ToTriple)); } @@ -63,27 +62,6 @@ public void Serialize(string contentType, TModel model, Stream outputStr /// protected abstract void WriteRdf(StreamWriter writer, IEnumerable triples); - [Obsolete("Remove when json-ld.net is fixed")] - private static string FixSerializedValue(string literal, Uri datatype) - { - switch (datatype.ToString()) - { - case Xsd.boolean: - return literal.ToLower(); - case Xsd.dateTime: - case Xsd.date: - DateTime dateTime; - if (DateTime.TryParse(literal, out dateTime)) - { - return dateTime.ToString("yyyy-MM-ddTHH:mm:ss"); - } - - break; - } - - return literal; - } - private INode CreateNode(RDFDataset.Node node) { if (node.IsIRI()) @@ -99,8 +77,6 @@ private INode CreateNode(RDFDataset.Node node) var literal = node.GetValue(); var datatype = new Uri(node.GetDatatype()); - literal = FixSerializedValue(literal, datatype); - return _nodeFactory.CreateLiteralNode(literal, datatype); } diff --git a/src/Nancy.Rdf/app.config b/src/Nancy.Rdf/app.config index f072f57..326e7f9 100644 --- a/src/Nancy.Rdf/app.config +++ b/src/Nancy.Rdf/app.config @@ -1,3 +1,9 @@  - + + + True + + + + diff --git a/src/Nancy.Rdf/paket.references b/src/Nancy.Rdf/paket.references index 86f8133..866cb25 100644 --- a/src/Nancy.Rdf/paket.references +++ b/src/Nancy.Rdf/paket.references @@ -3,5 +3,5 @@ Nancy GitVersionTask JsonLd.Entities NullGuard.Fody -StyleCopPlus.MSBuild +StyleCop.Analyzers Rdf.Vocabularies \ No newline at end of file