Graph-Native Infrastructure for Context and Accountable AI Systems
Python agent-memoryaiai-governanceai-infrastructureartificial-intelligencecontext-engineeringcontext-graphsdata-engineeringdecision-intelligencedeveloper-toolsexplainable-aigenerative-aigraph-ragknowledge-graphllmontologyprovenancepythonreasoningsemantic-search
docs(cookbook): record relationship endpoints explicitly in metadata
KaifAhmad11ce76055f5e8
diff --git a/cookbook/introduction/22_Provenance_Tracking.ipynb b/cookbook/introduction/22_Provenance_Tracking.ipynbindex 7df9ab1d..de54ddf1 100644--- a/cookbook/introduction/22_Provenance_Tracking.ipynb+++ b/cookbook/introduction/22_Provenance_Tracking.ipynb@@ -91,7 +91,9 @@"source": ["## Step 2: Track the Relationship Between Facts\n","\n",- "Facts rarely stand alone. The claim about biomass increase is *about* the marine reserve — that relationship is a first-class provenance-tracked object too."+ "Facts rarely stand alone. The claim about biomass increase is *about* the marine reserve — that relationship is a first-class provenance-tracked object too.\n",+ "\n",+ "`track_relationship()` has no dedicated subject/object fields, so by convention we record which two entities it connects inside `metadata`."]},{@@ -103,10 +105,16 @@"rel = prov.track_relationship(\n"," relationship_id=\"rel_biomass_about_reserve\",\n"," source=\"DOI:10.1371/journal.pone.0023601\",\n",- " metadata={\"type\": \"measured_at\"},\n",+ " metadata={\n",+ " \"type\": \"measured_at\",\n",+ " # No dedicated endpoint fields on track_relationship() yet -- record\n",+ " # which entities this relationship connects here by convention.\n",+ " \"subject_entity_id\": \"claim_biomass_increase\",\n",+ " \"object_entity_id\": \"marine_reserve_1\",\n",+ " },\n",")\n","\n",- "print(\"Relationship tracked:\", rel.entity_id)"+ "print(\"Relationship tracked:\", rel.entity_id, \"|\", rel.metadata[\"subject_entity_id\"], \"->\", rel.metadata[\"object_entity_id\"])"]},{