Skip to content

Commit

Permalink
Fix remaining broken normalize cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
sblom committed Mar 17, 2014
1 parent 7dc9bec commit 143cbf3
Show file tree
Hide file tree
Showing 5 changed files with 173 additions and 4 deletions.
135 changes: 135 additions & 0 deletions JsonLD.Portable/JsonLD.Portable.csproj
@@ -0,0 +1,135 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{F119722F-5E6A-4479-A4CF-0CE00FF29737}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>JsonLD.Portable</RootNamespace>
<AssemblyName>JsonLD.Portable</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkProfile>Profile78</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;PORTABLE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;PORTABLE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\src\JsonLD\Core\Context.cs">
<Link>Context.cs</Link>
</Compile>
<Compile Include="..\src\JsonLD\Core\DocumentLoader.cs">
<Link>DocumentLoader.cs</Link>
</Compile>
<Compile Include="..\src\JsonLD\Core\IJSONLDTripleCallback.cs">
<Link>IJSONLDTripleCallback.cs</Link>
</Compile>
<Compile Include="..\src\JsonLD\Core\IRDFParser.cs">
<Link>IRDFParser.cs</Link>
</Compile>
<Compile Include="..\src\JsonLD\Core\JsonLdApi.cs">
<Link>JsonLdApi.cs</Link>
</Compile>
<Compile Include="..\src\JsonLD\Core\JSONLDConsts.cs">
<Link>JSONLDConsts.cs</Link>
</Compile>
<Compile Include="..\src\JsonLD\Core\JsonLdError.cs">
<Link>JsonLdError.cs</Link>
</Compile>
<Compile Include="..\src\JsonLD\Core\JsonLdOptions.cs">
<Link>JsonLdOptions.cs</Link>
</Compile>
<Compile Include="..\src\JsonLD\Core\JsonLdProcessor.cs">
<Link>JsonLdProcessor.cs</Link>
</Compile>
<Compile Include="..\src\JsonLD\Core\JsonLdUtils.cs">
<Link>JsonLdUtils.cs</Link>
</Compile>
<Compile Include="..\src\JsonLD\Core\NormalizeUtils.cs">
<Link>NormalizeUtils.cs</Link>
</Compile>
<Compile Include="..\src\JsonLD\Core\RDFDataset.cs">
<Link>RDFDataset.cs</Link>
</Compile>
<Compile Include="..\src\JsonLD\Core\RDFDatasetUtils.cs">
<Link>RDFDatasetUtils.cs</Link>
</Compile>
<Compile Include="..\src\JsonLD\Core\Regex.cs">
<Link>Regex.cs</Link>
</Compile>
<Compile Include="..\src\JsonLD\Core\RemoteDocument.cs">
<Link>RemoteDocument.cs</Link>
</Compile>
<Compile Include="..\src\JsonLD\Core\UniqueNamer.cs">
<Link>UniqueNamer.cs</Link>
</Compile>
<Compile Include="..\src\JsonLD\Impl\NQuadRDFParser.cs">
<Link>NQuadRDFParser.cs</Link>
</Compile>
<Compile Include="..\src\JsonLD\Impl\NQuadTripleCallback.cs">
<Link>NQuadTripleCallback.cs</Link>
</Compile>
<Compile Include="..\src\JsonLD\Impl\TurtleRDFParser.cs">
<Link>TurtleRDFParser.cs</Link>
</Compile>
<Compile Include="..\src\JsonLD\Impl\TurtleTripleCallback.cs">
<Link>TurtleTripleCallback.cs</Link>
</Compile>
<Compile Include="..\src\JsonLD\Util\JavaCompat.cs">
<Link>JavaCompat.cs</Link>
</Compile>
<Compile Include="..\src\JsonLD\Util\JSONUtils.cs">
<Link>JSONUtils.cs</Link>
</Compile>
<Compile Include="..\src\JsonLD\Util\Obj.cs">
<Link>Obj.cs</Link>
</Compile>
<Compile Include="..\src\JsonLD\Util\URL.cs">
<Link>URL.cs</Link>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json">
<HintPath>..\packages\Newtonsoft.Json.6.0.1\lib\portable-net45+wp80+win8\Newtonsoft.Json.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
30 changes: 30 additions & 0 deletions JsonLD.Portable/Properties/AssemblyInfo.cs
@@ -0,0 +1,30 @@
using System.Resources;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("JsonLD.Portable")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("JsonLD.Portable")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
4 changes: 4 additions & 0 deletions JsonLD.Portable/packages.config
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="6.0.1" targetFramework="portable-net45+wp80+win+MonoAndroid10+MonoTouch10" />
</packages>
4 changes: 2 additions & 2 deletions src/JsonLD/Core/NormalizeUtils.cs
Expand Up @@ -472,7 +472,7 @@ private static NormalizeUtils.HashResult HashPaths(string id, IDictionary<string
nquads.Add(RDFDatasetUtils.ToNQuad((RDFDataset.Quad)quads[i], quads[i].TryGetValue("name", out name) ? (string)((IDictionary<string,object>)name)["value"] : null, id));
}
// sort serialized quads
nquads.SortInPlace();
nquads.SortInPlace(StringComparer.Ordinal);
// return hashed quads
string hash = Sha1hash(nquads);
((IDictionary<string,object>)bnodes[id])["hash"] = hash;
Expand Down Expand Up @@ -529,7 +529,7 @@ private static string EncodeHex(byte[] data)
/// <returns>the adjacent blank node name or null if none was found.</returns>
private static string GetAdjacentBlankNodeName(IDictionary<string,object> node, string id)
{
return (string)node["type"] == "blank node" && (!node.ContainsKey("value") || (string)node["value"] == id) ? (string)node["value"] : null;
return (string)node["type"] == "blank node" && (!node.ContainsKey("value") || (string)node["value"] != id) ? (string)node["value"] : null;
}

private class Permutator
Expand Down
4 changes: 2 additions & 2 deletions src/JsonLD/Util/JavaCompat.cs
Expand Up @@ -356,7 +356,7 @@ public bool Find()
#if !PORTABLE
internal class MessageDigest
{
HMACSHA1 md;
SHA1 md;
Stream stream;

public static MessageDigest GetInstance(string algorithm)
Expand All @@ -367,7 +367,7 @@ public static MessageDigest GetInstance(string algorithm)

public MessageDigest()
{
md = new HMACSHA1();
md = new SHA1Managed();
stream = new MemoryStream();
}

Expand Down

0 comments on commit 143cbf3

Please sign in to comment.