@@ -512,3 +512,29 @@ def test_creating_new_graphs_error(self):
512512_:c14n4 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Person> _:c14n1 ."""
513513
514514 assert exc .value .message .strip () == expected_message
515+
516+
517+ class TestCalculateMerkleRoot :
518+ def test_calculate_merkle_root_with_example_data (self ):
519+ """Test calculate_merkle_root function with real-world example data."""
520+ quads = [
521+ '<urn:us-cities:info:new-york> <http://schema.org/area> "468.9 sq mi" .' ,
522+ '<urn:us-cities:info:new-york> <http://schema.org/name> "New York" .' ,
523+ '<urn:us-cities:info:new-york> <http://schema.org/population> "8,336,817" .' ,
524+ '<urn:us-cities:info:new-york> <http://schema.org/state> "New York" .' ,
525+ "<urn:us-cities:info:new-york> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/City> ." ,
526+ '<uuid:6fd70e74-369d-4398-bdf3-1f25bfbf551c> <https://ontology.origintrail.io/dkg/1.0#privateMerkleRoot> "0xaac2a420672a1eb77506c544ff01beed2be58c0ee3576fe037c846f97481cefd" .' ,
527+ "<https://ontology.origintrail.io/dkg/1.0#metadata-hash:0x5cb6421dd41c7a62a84c223779303919e7293753d8a1f6f49da2e598013fe652> <https://ontology.origintrail.io/dkg/1.0#representsPrivateResource> <uuid:e0367b5c-a594-4131-8870-746f5551fa36> ." ,
528+ "<https://ontology.origintrail.io/dkg/1.0#metadata-hash:0x6a2292b30c844d2f8f2910bf11770496a3a79d5a6726d1b2fd3ddd18e09b5850> <https://ontology.origintrail.io/dkg/1.0#representsPrivateResource> <uuid:4ccd8930-90d4-4d6d-9aba-150fca68e18d> ." ,
529+ "<https://ontology.origintrail.io/dkg/1.0#metadata-hash:0xc1f682b783b1b93c9d5386eb1730c9647cf4b55925ec24f5e949e7457ba7bfac> <https://ontology.origintrail.io/dkg/1.0#representsPrivateResource> <uuid:0bb24334-91b8-431c-917a-c6c868325277> ." ,
530+ ]
531+
532+ merkle_root = kc_tools .calculate_merkle_root (quads )
533+
534+ # Expected merkle root for this dataset
535+ expected_merkle_root = (
536+ "0x897442f7db61619b9f272c69d787975f169d0624d7f08c216017c3218c8ea5da"
537+ )
538+
539+ # Verify the result matches the expected value
540+ assert merkle_root == expected_merkle_root
0 commit comments