Beispiel #1
0
        public void HashTwoBlankNodes()
        {
            var loggerMock     = new Mock <ILogger <InterwovenHashingService> >();
            var hashCalculator = new Sha256HashCalculator();
            var hashingService = new InterwovenHashingService(loggerMock.Object, hashCalculator);
            var triples1       = new HashSet <Triple>
            {
                new Triple(
                    new BlankNode("AAA"),
                    new Iri("http://ex.com/prop"),
                    new Iri("http://ex.com/E1")),
                new Triple(
                    new BlankNode("AAA"),
                    new Iri("http://ex.com/prop"),
                    new Iri("http://ex.com/E2"))
            };
            var triples2 = new HashSet <Triple>
            {
                new Triple(
                    new BlankNode("AAA"),
                    new Iri("http://ex.com/prop"),
                    new Iri("http://ex.com/E1")),
                new Triple(
                    new BlankNode("BBB"),
                    new Iri("http://ex.com/prop"),
                    new Iri("http://ex.com/E2"))
            };
            var hash1 = hashingService.CalculateHash(triples1);
            var hash2 = hashingService.CalculateHash(triples2);

            Assert.AreNotEqual(hash1, hash2);
        }
Beispiel #2
0
        public void HashingTriple()
        {
            var loggerMock1    = new Mock <ILogger <CircleDotHashingService> >();
            var loggerMock2    = new Mock <ILogger <InterwovenHashingService> >();
            var hashCalculator = new Sha256HashCalculator();
            var triples        = new HashSet <Triple>
            {
                new Triple(
                    new Iri("http://ontologies.makolab.com/gc/"),
                    new Iri("http://ontologies.makolab.com/gc/name"),
                    new Literal("Ontology"))
            };
            var hashingService    = new CircleDotHashingService(loggerMock1.Object, hashCalculator);
            var interwovenService = new InterwovenHashingService(loggerMock2.Object, hashCalculator);
            var hashTriple        = hashingService.CalculateHash(triples);
            var interwovenHash    = interwovenService.CalculateHash(triples);

            Assert.AreEqual("9ca7f0185c00422b045dc8256a4872ef713ac57b059f49d1ad78808d4aca3c6a", hashTriple);
            Assert.AreEqual("9ca7f0185c00422b045dc8256a4872ef713ac57b059f49d1ad78808d4aca3c6a", interwovenHash);
        }