open-kgo 0.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. open_kgo-0.2.1/LICENSE +201 -0
  2. open_kgo-0.2.1/PKG-INFO +264 -0
  3. open_kgo-0.2.1/README.md +203 -0
  4. open_kgo-0.2.1/open_kgo/__init__.py +0 -0
  5. open_kgo-0.2.1/open_kgo/compute_frameworks/__init__.py +16 -0
  6. open_kgo-0.2.1/open_kgo/compute_frameworks/python_dict_kg_framework.py +93 -0
  7. open_kgo-0.2.1/open_kgo/compute_frameworks/tests/__init__.py +0 -0
  8. open_kgo-0.2.1/open_kgo/compute_frameworks/tests/test_python_dict_kg_framework.py +111 -0
  9. open_kgo-0.2.1/open_kgo/extenders/__init__.py +1 -0
  10. open_kgo-0.2.1/open_kgo/feature_groups/__init__.py +1 -0
  11. open_kgo-0.2.1/open_kgo/feature_groups/kg/__init__.py +7 -0
  12. open_kgo-0.2.1/open_kgo/feature_groups/kg/agent_memory/__init__.py +33 -0
  13. open_kgo-0.2.1/open_kgo/feature_groups/kg/agent_memory/base.py +102 -0
  14. open_kgo-0.2.1/open_kgo/feature_groups/kg/agent_memory/graph_walk_memory.py +111 -0
  15. open_kgo-0.2.1/open_kgo/feature_groups/kg/agent_memory/networkx_memory.py +106 -0
  16. open_kgo-0.2.1/open_kgo/feature_groups/kg/agent_memory/shared.py +97 -0
  17. open_kgo-0.2.1/open_kgo/feature_groups/kg/agent_memory/tests/__init__.py +0 -0
  18. open_kgo-0.2.1/open_kgo/feature_groups/kg/agent_memory/tests/kg_agent_memory_contract.py +21 -0
  19. open_kgo-0.2.1/open_kgo/feature_groups/kg/agent_memory/tests/test_graph_walk_memory.py +262 -0
  20. open_kgo-0.2.1/open_kgo/feature_groups/kg/agent_memory/tests/test_networkx_memory.py +125 -0
  21. open_kgo-0.2.1/open_kgo/feature_groups/kg/base.py +40 -0
  22. open_kgo-0.2.1/open_kgo/feature_groups/kg/citation_rest/__init__.py +21 -0
  23. open_kgo-0.2.1/open_kgo/feature_groups/kg/citation_rest/base.py +47 -0
  24. open_kgo-0.2.1/open_kgo/feature_groups/kg/citation_rest/file_fixture_citation.py +82 -0
  25. open_kgo-0.2.1/open_kgo/feature_groups/kg/citation_rest/paginated_citation.py +104 -0
  26. open_kgo-0.2.1/open_kgo/feature_groups/kg/citation_rest/tests/__init__.py +0 -0
  27. open_kgo-0.2.1/open_kgo/feature_groups/kg/citation_rest/tests/kg_citation_rest_contract.py +15 -0
  28. open_kgo-0.2.1/open_kgo/feature_groups/kg/citation_rest/tests/test_file_fixture_citation.py +110 -0
  29. open_kgo-0.2.1/open_kgo/feature_groups/kg/citation_rest/tests/test_paginated_citation.py +250 -0
  30. open_kgo-0.2.1/open_kgo/feature_groups/kg/class_guards.py +196 -0
  31. open_kgo-0.2.1/open_kgo/feature_groups/kg/code_build/__init__.py +36 -0
  32. open_kgo-0.2.1/open_kgo/feature_groups/kg/code_build/base.py +52 -0
  33. open_kgo-0.2.1/open_kgo/feature_groups/kg/code_build/cyclonedx_sbom.py +60 -0
  34. open_kgo-0.2.1/open_kgo/feature_groups/kg/code_build/spdx_sbom.py +195 -0
  35. open_kgo-0.2.1/open_kgo/feature_groups/kg/code_build/tests/__init__.py +0 -0
  36. open_kgo-0.2.1/open_kgo/feature_groups/kg/code_build/tests/kg_code_build_contract.py +15 -0
  37. open_kgo-0.2.1/open_kgo/feature_groups/kg/code_build/tests/test_cyclonedx_sbom.py +57 -0
  38. open_kgo-0.2.1/open_kgo/feature_groups/kg/code_build/tests/test_spdx_sbom.py +391 -0
  39. open_kgo-0.2.1/open_kgo/feature_groups/kg/conftest.py +52 -0
  40. open_kgo-0.2.1/open_kgo/feature_groups/kg/credentials.py +257 -0
  41. open_kgo-0.2.1/open_kgo/feature_groups/kg/embedded/__init__.py +15 -0
  42. open_kgo-0.2.1/open_kgo/feature_groups/kg/embedded/base.py +100 -0
  43. open_kgo-0.2.1/open_kgo/feature_groups/kg/embedded/igraph_embedded.py +145 -0
  44. open_kgo-0.2.1/open_kgo/feature_groups/kg/embedded/networkx_embedded.py +104 -0
  45. open_kgo-0.2.1/open_kgo/feature_groups/kg/embedded/tests/__init__.py +0 -0
  46. open_kgo-0.2.1/open_kgo/feature_groups/kg/embedded/tests/kg_embedded_contract.py +71 -0
  47. open_kgo-0.2.1/open_kgo/feature_groups/kg/embedded/tests/test_igraph_embedded.py +149 -0
  48. open_kgo-0.2.1/open_kgo/feature_groups/kg/embedded/tests/test_networkx_embedded.py +60 -0
  49. open_kgo-0.2.1/open_kgo/feature_groups/kg/errors.py +164 -0
  50. open_kgo-0.2.1/open_kgo/feature_groups/kg/feature_group.py +54 -0
  51. open_kgo-0.2.1/open_kgo/feature_groups/kg/fixtures.py +371 -0
  52. open_kgo-0.2.1/open_kgo/feature_groups/kg/lineage/__init__.py +18 -0
  53. open_kgo-0.2.1/open_kgo/feature_groups/kg/lineage/base.py +35 -0
  54. open_kgo-0.2.1/open_kgo/feature_groups/kg/lineage/dbt_manifest.py +116 -0
  55. open_kgo-0.2.1/open_kgo/feature_groups/kg/lineage/openlineage_events.py +195 -0
  56. open_kgo-0.2.1/open_kgo/feature_groups/kg/lineage/tests/__init__.py +0 -0
  57. open_kgo-0.2.1/open_kgo/feature_groups/kg/lineage/tests/kg_lineage_contract.py +21 -0
  58. open_kgo-0.2.1/open_kgo/feature_groups/kg/lineage/tests/test_dbt_manifest.py +151 -0
  59. open_kgo-0.2.1/open_kgo/feature_groups/kg/lineage/tests/test_openlineage_events.py +415 -0
  60. open_kgo-0.2.1/open_kgo/feature_groups/kg/mixins.py +301 -0
  61. open_kgo-0.2.1/open_kgo/feature_groups/kg/network_pg/__init__.py +13 -0
  62. open_kgo-0.2.1/open_kgo/feature_groups/kg/network_pg/base.py +51 -0
  63. open_kgo-0.2.1/open_kgo/feature_groups/kg/network_pg/grand_cypher.py +170 -0
  64. open_kgo-0.2.1/open_kgo/feature_groups/kg/network_pg/kuzu_cypher.py +81 -0
  65. open_kgo-0.2.1/open_kgo/feature_groups/kg/network_pg/tests/__init__.py +0 -0
  66. open_kgo-0.2.1/open_kgo/feature_groups/kg/network_pg/tests/kg_network_pg_contract.py +14 -0
  67. open_kgo-0.2.1/open_kgo/feature_groups/kg/network_pg/tests/test_grand_cypher.py +237 -0
  68. open_kgo-0.2.1/open_kgo/feature_groups/kg/network_pg/tests/test_kuzu_cypher.py +113 -0
  69. open_kgo-0.2.1/open_kgo/feature_groups/kg/ontology/__init__.py +4 -0
  70. open_kgo-0.2.1/open_kgo/feature_groups/kg/ontology/registry.py +195 -0
  71. open_kgo-0.2.1/open_kgo/feature_groups/kg/ontology/semantic_field.py +373 -0
  72. open_kgo-0.2.1/open_kgo/feature_groups/kg/ontology/tests/__init__.py +0 -0
  73. open_kgo-0.2.1/open_kgo/feature_groups/kg/ontology/tests/test_ontology_integration.py +273 -0
  74. open_kgo-0.2.1/open_kgo/feature_groups/kg/ontology/tests/test_registry.py +176 -0
  75. open_kgo-0.2.1/open_kgo/feature_groups/kg/ontology/tests/test_semantic_field.py +194 -0
  76. open_kgo-0.2.1/open_kgo/feature_groups/kg/ontology/tests/test_semantic_field_scale.py +209 -0
  77. open_kgo-0.2.1/open_kgo/feature_groups/kg/rdf/__init__.py +17 -0
  78. open_kgo-0.2.1/open_kgo/feature_groups/kg/rdf/base.py +64 -0
  79. open_kgo-0.2.1/open_kgo/feature_groups/kg/rdf/oxigraph_sparql.py +141 -0
  80. open_kgo-0.2.1/open_kgo/feature_groups/kg/rdf/rdflib_sparql.py +102 -0
  81. open_kgo-0.2.1/open_kgo/feature_groups/kg/rdf/tests/__init__.py +0 -0
  82. open_kgo-0.2.1/open_kgo/feature_groups/kg/rdf/tests/kg_rdf_contract.py +39 -0
  83. open_kgo-0.2.1/open_kgo/feature_groups/kg/rdf/tests/test_oxigraph_sparql.py +260 -0
  84. open_kgo-0.2.1/open_kgo/feature_groups/kg/rdf/tests/test_rdflib_sparql.py +121 -0
  85. open_kgo-0.2.1/open_kgo/feature_groups/kg/reader_base.py +792 -0
  86. open_kgo-0.2.1/open_kgo/feature_groups/kg/readers.py +252 -0
  87. open_kgo-0.2.1/open_kgo/feature_groups/kg/rest_public/__init__.py +26 -0
  88. open_kgo-0.2.1/open_kgo/feature_groups/kg/rest_public/base.py +42 -0
  89. open_kgo-0.2.1/open_kgo/feature_groups/kg/rest_public/file_fixture_paged_rest.py +127 -0
  90. open_kgo-0.2.1/open_kgo/feature_groups/kg/rest_public/file_fixture_rest.py +112 -0
  91. open_kgo-0.2.1/open_kgo/feature_groups/kg/rest_public/tests/__init__.py +0 -0
  92. open_kgo-0.2.1/open_kgo/feature_groups/kg/rest_public/tests/kg_rest_public_contract.py +15 -0
  93. open_kgo-0.2.1/open_kgo/feature_groups/kg/rest_public/tests/test_file_fixture_paged_rest.py +203 -0
  94. open_kgo-0.2.1/open_kgo/feature_groups/kg/rest_public/tests/test_file_fixture_rest.py +120 -0
  95. open_kgo-0.2.1/open_kgo/feature_groups/kg/saas_authz/__init__.py +20 -0
  96. open_kgo-0.2.1/open_kgo/feature_groups/kg/saas_authz/base.py +62 -0
  97. open_kgo-0.2.1/open_kgo/feature_groups/kg/saas_authz/in_process_tuple_store.py +191 -0
  98. open_kgo-0.2.1/open_kgo/feature_groups/kg/saas_authz/paginated_tuple_store.py +201 -0
  99. open_kgo-0.2.1/open_kgo/feature_groups/kg/saas_authz/shared.py +37 -0
  100. open_kgo-0.2.1/open_kgo/feature_groups/kg/saas_authz/tests/__init__.py +0 -0
  101. open_kgo-0.2.1/open_kgo/feature_groups/kg/saas_authz/tests/kg_saas_authz_contract.py +10 -0
  102. open_kgo-0.2.1/open_kgo/feature_groups/kg/saas_authz/tests/test_in_process_tuple_store.py +94 -0
  103. open_kgo-0.2.1/open_kgo/feature_groups/kg/saas_authz/tests/test_paginated_tuple_store.py +347 -0
  104. open_kgo-0.2.1/open_kgo/feature_groups/kg/spec.py +103 -0
  105. open_kgo-0.2.1/open_kgo/feature_groups/kg/tests/__init__.py +0 -0
  106. open_kgo-0.2.1/open_kgo/feature_groups/kg/tests/_discovery.py +252 -0
  107. open_kgo-0.2.1/open_kgo/feature_groups/kg/tests/_family_cases.py +474 -0
  108. open_kgo-0.2.1/open_kgo/feature_groups/kg/tests/_helpers.py +211 -0
  109. open_kgo-0.2.1/open_kgo/feature_groups/kg/tests/contract_adapters.py +67 -0
  110. open_kgo-0.2.1/open_kgo/feature_groups/kg/tests/contract_credentials.py +419 -0
  111. open_kgo-0.2.1/open_kgo/feature_groups/kg/tests/contract_load.py +160 -0
  112. open_kgo-0.2.1/open_kgo/feature_groups/kg/tests/contract_params.py +185 -0
  113. open_kgo-0.2.1/open_kgo/feature_groups/kg/tests/contract_surface.py +98 -0
  114. open_kgo-0.2.1/open_kgo/feature_groups/kg/tests/kg_contract.py +67 -0
  115. open_kgo-0.2.1/open_kgo/feature_groups/kg/tests/test_abstract_base_and_result_limit_bounds.py +269 -0
  116. open_kgo-0.2.1/open_kgo/feature_groups/kg/tests/test_base_validation.py +313 -0
  117. open_kgo-0.2.1/open_kgo/feature_groups/kg/tests/test_cross_group_contract.py +96 -0
  118. open_kgo-0.2.1/open_kgo/feature_groups/kg/tests/test_cross_layer_pagination.py +231 -0
  119. open_kgo-0.2.1/open_kgo/feature_groups/kg/tests/test_discovery_helpers.py +354 -0
  120. open_kgo-0.2.1/open_kgo/feature_groups/kg/tests/test_helpers.py +321 -0
  121. open_kgo-0.2.1/open_kgo/feature_groups/kg/tests/test_kg_catalog_declarations.py +131 -0
  122. open_kgo-0.2.1/open_kgo/feature_groups/kg/tests/test_kg_registry_integrity.py +76 -0
  123. open_kgo-0.2.1/open_kgo/feature_groups/kg/tests/test_kg_usage_smoke.py +34 -0
  124. open_kgo-0.2.1/open_kgo/feature_groups/kg/tests/test_property_mapping_integrity.py +732 -0
  125. open_kgo-0.2.1/open_kgo/feature_groups/kg/tests/test_resource_cache.py +417 -0
  126. open_kgo-0.2.1/open_kgo/feature_groups/kg/tests/test_spec.py +88 -0
  127. open_kgo-0.2.1/open_kgo/feature_groups/kg/tests/test_validate_params_collect_all.py +113 -0
  128. open_kgo-0.2.1/open_kgo/feature_groups/kg/tests/test_validation_contract.py +225 -0
  129. open_kgo-0.2.1/open_kgo/feature_groups/kg/traversal.py +125 -0
  130. open_kgo-0.2.1/open_kgo/feature_groups/kg/validation.py +60 -0
  131. open_kgo-0.2.1/open_kgo/py.typed +0 -0
  132. open_kgo-0.2.1/open_kgo.egg-info/PKG-INFO +264 -0
  133. open_kgo-0.2.1/open_kgo.egg-info/SOURCES.txt +140 -0
  134. open_kgo-0.2.1/open_kgo.egg-info/dependency_links.txt +1 -0
  135. open_kgo-0.2.1/open_kgo.egg-info/requires.txt +50 -0
  136. open_kgo-0.2.1/open_kgo.egg-info/top_level.txt +1 -0
  137. open_kgo-0.2.1/pyproject.toml +104 -0
  138. open_kgo-0.2.1/setup.cfg +4 -0
  139. open_kgo-0.2.1/tests/test_demo_data.py +124 -0
  140. open_kgo-0.2.1/tests/test_demo_notebooks.py +57 -0
  141. open_kgo-0.2.1/tests/test_metaqa_build_sample.py +71 -0
  142. open_kgo-0.2.1/tests/test_mloda_imports.py +23 -0
open_kgo-0.2.1/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,264 @@
1
+ Metadata-Version: 2.4
2
+ Name: open-kgo
3
+ Version: 0.2.1
4
+ Summary: Open Knowledge Graphs and Ontologies plugin for mloda.
5
+ Author-email: Tom Kaltofen <tomkaltofen@mloda.ai>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/mloda-ai/open-kgo
8
+ Project-URL: Repository, https://github.com/mloda-ai/open-kgo
9
+ Project-URL: Issues, https://github.com/mloda-ai/open-kgo/issues
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Topic :: Scientific/Engineering
20
+ Classifier: Typing :: Typed
21
+ Requires-Python: >=3.10
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: mloda>=0.8.0
25
+ Requires-Dist: mloda-testing>=0.3.1
26
+ Provides-Extra: dev
27
+ Requires-Dist: tox; extra == "dev"
28
+ Requires-Dist: tox-uv; extra == "dev"
29
+ Requires-Dist: uv>=0.11.6; extra == "dev"
30
+ Requires-Dist: pytest; extra == "dev"
31
+ Requires-Dist: ruff; extra == "dev"
32
+ Requires-Dist: mypy; extra == "dev"
33
+ Requires-Dist: bandit; extra == "dev"
34
+ Provides-Extra: kg-rdf
35
+ Requires-Dist: rdflib>=7.0; extra == "kg-rdf"
36
+ Requires-Dist: pyoxigraph>=0.5.9; extra == "kg-rdf"
37
+ Provides-Extra: kg-embedded
38
+ Requires-Dist: networkx>=3.2; extra == "kg-embedded"
39
+ Requires-Dist: igraph>=0.11; extra == "kg-embedded"
40
+ Provides-Extra: kg-network-pg
41
+ Requires-Dist: kuzu>=0.4; extra == "kg-network-pg"
42
+ Requires-Dist: networkx>=3.2; extra == "kg-network-pg"
43
+ Requires-Dist: grand-cypher>=0.12; extra == "kg-network-pg"
44
+ Provides-Extra: kg-memory
45
+ Requires-Dist: networkx>=3.2; extra == "kg-memory"
46
+ Provides-Extra: kg-ontology
47
+ Requires-Dist: pyyaml>=6.0; extra == "kg-ontology"
48
+ Provides-Extra: kg-semantic-field
49
+ Requires-Dist: pyyaml>=6.0; extra == "kg-semantic-field"
50
+ Provides-Extra: kg-rest
51
+ Provides-Extra: kg-lineage
52
+ Provides-Extra: kg-codebuild
53
+ Provides-Extra: kg-saas
54
+ Provides-Extra: kg-citation
55
+ Provides-Extra: kg-all
56
+ Requires-Dist: open-kgo[kg-citation,kg-codebuild,kg-embedded,kg-lineage,kg-memory,kg-network-pg,kg-ontology,kg-rdf,kg-rest,kg-saas,kg-semantic-field]; extra == "kg-all"
57
+ Provides-Extra: demo
58
+ Requires-Dist: marimo; extra == "demo"
59
+ Requires-Dist: open-kgo[kg-all]; extra == "demo"
60
+ Dynamic: license-file
61
+
62
+ [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
63
+ [![mloda](https://img.shields.io/badge/built%20with-mloda-blue.svg)](https://github.com/mloda-ai/mloda)
64
+ [![Python](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/)
65
+
66
+ # open-kgo
67
+
68
+ Open Knowledge Graphs and Ontologies plugin for [mloda](https://github.com/mloda-ai/mloda): nine connector families covering the knowledge-graph landscape, from SPARQL endpoints to SBOMs to agent memory, all behind one declarative `Feature` interface. Every connector and demo runs offline against in-memory libraries or committed fixtures. No Docker, no network.
69
+
70
+ ## At a glance
71
+
72
+ | Section | What you'll find |
73
+ |---|---|
74
+ | [Quickstart](#quickstart) | Run a SPARQL query against a shipped sample file in under a minute |
75
+ | [The nine connector families](#the-nine-connector-families) | The core of this repo: a 9-family KG connector taxonomy with two plugins each |
76
+ | [Semantic Fields — Layer 2](#semantic-fields--layer-2) | Continuous, schema-grounded entity scoring via DC circuit model |
77
+ | [Demos](#demos) | Marimo notebooks and evaluation harnesses, all offline |
78
+ | [Data and acknowledgments](#data-and-acknowledgments) | Where the sample data comes from |
79
+ | [Development setup](#development-setup) | uv, tox, and the individual checks |
80
+ | [Related repositories and documentation](#related-repositories-and-documentation) | mloda core, the plugin registry, and development guides |
81
+
82
+ ## Quickstart
83
+
84
+ Install the connectors and run a SPARQL query against the Turtle sample shipped in this repo:
85
+
86
+ ```bash
87
+ uv sync --extra kg-all
88
+ ```
89
+
90
+ ```python
91
+ from pathlib import Path
92
+
93
+ from mloda.user import DataAccessCollection, Feature, Options, mloda
94
+
95
+ import open_kgo.feature_groups.kg.rdf.rdflib_sparql as rdf_mod
96
+ from open_kgo.compute_frameworks.python_dict_kg_framework import KgPythonDictFramework
97
+
98
+ # Point at any RDF file. Here: the Turtle sample shipped in this repo.
99
+ ttl = Path(rdf_mod.__file__).parent / "tests" / "fixtures" / "sample.ttl"
100
+
101
+ feature = Feature(
102
+ "rdflib_sparql__knows",
103
+ options=Options(context={
104
+ "query_text": "PREFIX foaf: <http://xmlns.com/foaf/0.1/> "
105
+ "SELECT ?s ?o WHERE { ?s foaf:knows ?o }",
106
+ }),
107
+ )
108
+
109
+ partitions = mloda.run_all(
110
+ [feature],
111
+ compute_frameworks={KgPythonDictFramework},
112
+ data_access_collection=DataAccessCollection(
113
+ credentials=[{"rdflib_sparql": {"locator": str(ttl), "result_limit": 100}}],
114
+ ),
115
+ )
116
+
117
+ for partition in partitions:
118
+ for row in partition:
119
+ print(row[feature.name])
120
+ ```
121
+
122
+ Swap `rdflib_sparql` for any of the nine connector families below: same `Feature` to `mloda.run_all` shape, different reader.
123
+
124
+ ## The nine connector families
125
+
126
+ `open_kgo/feature_groups/kg/` ships a connector taxonomy derived from a 103-system survey. Each family is a shared reader and feature-group base plus **two** concrete plugins running against in-memory libraries or local file fixtures:
127
+
128
+ | Family | What it connects to | Concrete plugins |
129
+ |---|---|---|
130
+ | `network_pg` | Property-graph databases with a vendor query language (Neo4j, Memgraph, Neptune, ...) | `KuzuCypherReader`, `GrandCypherReader` |
131
+ | `rdf` | RDF triple stores queried with SPARQL | `RdfLibSparqlReader`, `OxigraphSparqlReader` |
132
+ | `embedded` | In-process graph libraries with no network endpoint | `NetworkxEmbeddedReader`, `IGraphEmbeddedReader` |
133
+ | `rest_public` | Public REST (non-SPARQL) KG APIs (OpenAlex, ConceptNet, STRING, ...) | `FileFixtureRestReader`, `FileFixturePagedRestReader` |
134
+ | `lineage` | Metadata and data-lineage graphs (dbt, OpenLineage, DataHub, ...) | `DbtManifestReader`, `OpenLineageReader` |
135
+ | `code_build` | Code, build, and SBOM dependency graphs (CycloneDX, SPDX, ...) | `CycloneDxSbomReader`, `SpdxSbomReader` |
136
+ | `saas_authz` | SaaS and authorization tuple stores (OpenFGA, SpiceDB, Microsoft Graph, ...) | `InProcessTupleStoreReader`, `PaginatedTupleStoreReader` |
137
+ | `agent_memory` | LLM agent memory and GraphRAG graphs (Letta, Zep, Mem0, ...) | `NetworkxMemoryReader`, `GraphWalkMemoryReader` |
138
+ | `citation_rest` | Citation and scientific REST APIs (Reactome, OpenAlex citations, ...) | `FileFixtureCitationReader`, `PaginatedCitationReader` |
139
+
140
+ See [`open_kgo/feature_groups/kg/README.md`](open_kgo/feature_groups/kg/README.md) for the full family map, the plugin anatomy, and what the prototype does and does not validate.
141
+
142
+ Install all KG extras with: `uv sync --extra kg-all`.
143
+
144
+ > **One feature per call.** KG readers dispatch a single feature per load: every
145
+ > reader rejects a multi-feature `FeatureSet` rather than silently labelling all
146
+ > rows with one feature name. Request features individually (one `Feature` per
147
+ > `mloda.run_all` slot) rather than batching `N` of them into a single reader call.
148
+
149
+ > **No-Docker testing policy.** Every connector test runs against rdflib, networkx, kuzu (embedded), or file fixtures. No Docker, no external services, no network calls.
150
+
151
+ ## Semantic Fields — Layer 2
152
+
153
+ The connector families (Layer 1 validation) answer: *"is this traversal valid?"* — binary yes/no.
154
+
155
+ **SemanticField** (Layer 2) answers: *"how relevant is this entity to my query?"* — a continuous score, grounded in DC electrical circuit theory.
156
+
157
+ The knowledge graph is modelled as a resistor network. Ontology-declared relationship weights become conductances. A query is expressed as two anchor nodes — a **source** (high voltage) and a **sink** (low voltage, ground). The solver finds the electric potential at every entity via the conductance-weighted graph Laplacian, then scores each entity by the current it carries between source and sink.
158
+
159
+ **Why current?** Current only flows through entities that bridge *both* anchors. An entity connected to only one side floats to that side's extreme voltage — zero potential difference, zero current, automatically excluded. No relation-type filtering needed; the circuit topology enforces the AND constraint.
160
+
161
+ ```python
162
+ from open_kgo.feature_groups.kg.ontology import SemanticField
163
+
164
+ # AND query: Sci-Fi films by Nolan
165
+ scores = SemanticField.compute_and(
166
+ namespace="metaqa",
167
+ edges=subgraph_edges, # 2-hop neighbourhood of both anchors
168
+ source={"Nolan": 1.0}, # high-voltage anchor
169
+ sink={"Sci-Fi": 0.0}, # ground
170
+ )
171
+ # → {"Interstellar": 0.394, "Inception": 0.312, "Dark Knight": 0.0, ...}
172
+ ```
173
+
174
+ Relationship weights are declared in the ontology YAML and flow directly into the solver as conductances:
175
+
176
+ ```yaml
177
+ relationships:
178
+ directed_by: { domain: Movie, range: Person, weight: 0.9 }
179
+ has_genre: { domain: Movie, range: Genre, weight: 0.7 }
180
+ has_tags: { domain: Movie, range: Tag, weight: 0.2 }
181
+ ```
182
+
183
+ The solver is pure Python (no numpy) with an optional numba JIT kernel that gives a **70× speedup** at ~5 000-node subgraphs; it falls back silently when numba is absent.
184
+
185
+ | Layer | What it does | Status |
186
+ |---|---|---|
187
+ | L1 — OntologyRegistry | Binary valid/invalid edge checks, YAML-declared | Built |
188
+ | L2 — SemanticField | Continuous entity scoring via DC circuit model | Built |
189
+ | L3 — Discovery Engine | Guided multi-hop traversal by field strength | Planned |
190
+
191
+ Install: `uv sync --extra kg-semantic-field`
192
+
193
+ Full visual explainer: [`demo/semantic_field_explainer.html`](demo/semantic_field_explainer.html) — open in any browser, no server needed.
194
+
195
+ ## Demos
196
+
197
+ Three marimo notebooks plus two evaluation harnesses live under `demo/`:
198
+
199
+ - `demo/demo_kg_connectors.py`: surface tour of all 9 families against the shipped fixtures.
200
+ - `demo/demo_kg_build_repo.py`: builds an RDF graph from this repo (filesystem `repo:contains` + Python `repo:imports`), serializes to Turtle, and runs five SPARQL queries through `RdfLibSparqlReader` via `mloda.run_all`.
201
+ - `demo/demo_kg_ontology.py`: walks the ontology layer end to end.
202
+ - `demo/demo_semantic_field.py`: SemanticField Layer 2 — interactive director + genre query against MetaQA, with live scoring.
203
+ - `demo/semantic_field_explainer.html`: full visual explainer for SemanticField — circuit diagram, layer stack, why EM, 1/2/multi-hop examples, test results. Open in any browser.
204
+ - `demo/eval_arch1_vs_arch2.py` and `demo/eval_qa_accuracy.py`: evaluation harnesses comparing plain traversal vs. ontology-guided traversal.
205
+
206
+ Install the demo extras and open any notebook:
207
+
208
+ ```bash
209
+ uv sync --extra demo
210
+ marimo edit demo/demo_kg_connectors.py
211
+ ```
212
+
213
+ Every demo runs offline against a small committed sample graph: no download,
214
+ no network, no external services.
215
+
216
+ ## Data and acknowledgments
217
+
218
+ The ontology demo and the two evaluation harnesses run against a small
219
+ hand-authored sample of public movie facts (`demo/data/sample_kb.txt`) written
220
+ in the triple format of the MetaQA dataset (Zhang, Yuyu et al., "Variational
221
+ Reasoning for Question Answering with Knowledge Graph", AAAI 2018,
222
+ https://github.com/yuyuz/MetaQA). The sample is committed in this repo and is
223
+ not derived from the MetaQA dataset files. The notebooks call
224
+ `demo.data.ensure_data()` at startup, which builds the sample subgraph offline.
225
+ To run against the full MetaQA benchmark (licensed under
226
+ [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/legalcode), not
227
+ redistributed here), see [`demo/data/README.md`](demo/data/README.md).
228
+
229
+ ## Development setup
230
+
231
+ **Install uv** (if not already installed):
232
+ ```bash
233
+ curl -LsSf https://astral.sh/uv/install.sh | sh
234
+ ```
235
+
236
+ **Create virtual environment and install dependencies:**
237
+ ```bash
238
+ uv venv
239
+ source .venv/bin/activate
240
+ uv sync --all-extras
241
+ ```
242
+
243
+ **Run all checks with tox:**
244
+ ```bash
245
+ uv tool install tox --with tox-uv
246
+ tox
247
+ ```
248
+
249
+ ### Run individual checks
250
+
251
+ ```bash
252
+ pytest
253
+ ruff format --check --line-length 120 .
254
+ ruff check .
255
+ mypy --strict --ignore-missing-imports .
256
+ bandit -c pyproject.toml -r -q .
257
+ ```
258
+
259
+ ## Related repositories and documentation
260
+
261
+ - **[mloda](https://github.com/mloda-ai/mloda)**: The core library for open data access. Declaratively define what data you need, not how to get it. See [mloda.ai](https://mloda.ai) for an overview and business context and the [documentation](https://mloda-ai.github.io/mloda/) for detailed guides.
262
+ - **[mloda-registry](https://github.com/mloda-ai/mloda-registry)**: The central hub for discovering and sharing mloda plugins.
263
+ - **[Plugin development guides](https://github.com/mloda-ai/mloda-registry/tree/main/docs/guides/)**: How to build FeatureGroups, ComputeFrameworks, and Extenders.
264
+ - **[Claude Code skills](https://github.com/mloda-ai/mloda-registry/tree/main/.claude/skills/)**: Assisted plugin development for Claude Code users.
@@ -0,0 +1,203 @@
1
+ [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
2
+ [![mloda](https://img.shields.io/badge/built%20with-mloda-blue.svg)](https://github.com/mloda-ai/mloda)
3
+ [![Python](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/)
4
+
5
+ # open-kgo
6
+
7
+ Open Knowledge Graphs and Ontologies plugin for [mloda](https://github.com/mloda-ai/mloda): nine connector families covering the knowledge-graph landscape, from SPARQL endpoints to SBOMs to agent memory, all behind one declarative `Feature` interface. Every connector and demo runs offline against in-memory libraries or committed fixtures. No Docker, no network.
8
+
9
+ ## At a glance
10
+
11
+ | Section | What you'll find |
12
+ |---|---|
13
+ | [Quickstart](#quickstart) | Run a SPARQL query against a shipped sample file in under a minute |
14
+ | [The nine connector families](#the-nine-connector-families) | The core of this repo: a 9-family KG connector taxonomy with two plugins each |
15
+ | [Semantic Fields — Layer 2](#semantic-fields--layer-2) | Continuous, schema-grounded entity scoring via DC circuit model |
16
+ | [Demos](#demos) | Marimo notebooks and evaluation harnesses, all offline |
17
+ | [Data and acknowledgments](#data-and-acknowledgments) | Where the sample data comes from |
18
+ | [Development setup](#development-setup) | uv, tox, and the individual checks |
19
+ | [Related repositories and documentation](#related-repositories-and-documentation) | mloda core, the plugin registry, and development guides |
20
+
21
+ ## Quickstart
22
+
23
+ Install the connectors and run a SPARQL query against the Turtle sample shipped in this repo:
24
+
25
+ ```bash
26
+ uv sync --extra kg-all
27
+ ```
28
+
29
+ ```python
30
+ from pathlib import Path
31
+
32
+ from mloda.user import DataAccessCollection, Feature, Options, mloda
33
+
34
+ import open_kgo.feature_groups.kg.rdf.rdflib_sparql as rdf_mod
35
+ from open_kgo.compute_frameworks.python_dict_kg_framework import KgPythonDictFramework
36
+
37
+ # Point at any RDF file. Here: the Turtle sample shipped in this repo.
38
+ ttl = Path(rdf_mod.__file__).parent / "tests" / "fixtures" / "sample.ttl"
39
+
40
+ feature = Feature(
41
+ "rdflib_sparql__knows",
42
+ options=Options(context={
43
+ "query_text": "PREFIX foaf: <http://xmlns.com/foaf/0.1/> "
44
+ "SELECT ?s ?o WHERE { ?s foaf:knows ?o }",
45
+ }),
46
+ )
47
+
48
+ partitions = mloda.run_all(
49
+ [feature],
50
+ compute_frameworks={KgPythonDictFramework},
51
+ data_access_collection=DataAccessCollection(
52
+ credentials=[{"rdflib_sparql": {"locator": str(ttl), "result_limit": 100}}],
53
+ ),
54
+ )
55
+
56
+ for partition in partitions:
57
+ for row in partition:
58
+ print(row[feature.name])
59
+ ```
60
+
61
+ Swap `rdflib_sparql` for any of the nine connector families below: same `Feature` to `mloda.run_all` shape, different reader.
62
+
63
+ ## The nine connector families
64
+
65
+ `open_kgo/feature_groups/kg/` ships a connector taxonomy derived from a 103-system survey. Each family is a shared reader and feature-group base plus **two** concrete plugins running against in-memory libraries or local file fixtures:
66
+
67
+ | Family | What it connects to | Concrete plugins |
68
+ |---|---|---|
69
+ | `network_pg` | Property-graph databases with a vendor query language (Neo4j, Memgraph, Neptune, ...) | `KuzuCypherReader`, `GrandCypherReader` |
70
+ | `rdf` | RDF triple stores queried with SPARQL | `RdfLibSparqlReader`, `OxigraphSparqlReader` |
71
+ | `embedded` | In-process graph libraries with no network endpoint | `NetworkxEmbeddedReader`, `IGraphEmbeddedReader` |
72
+ | `rest_public` | Public REST (non-SPARQL) KG APIs (OpenAlex, ConceptNet, STRING, ...) | `FileFixtureRestReader`, `FileFixturePagedRestReader` |
73
+ | `lineage` | Metadata and data-lineage graphs (dbt, OpenLineage, DataHub, ...) | `DbtManifestReader`, `OpenLineageReader` |
74
+ | `code_build` | Code, build, and SBOM dependency graphs (CycloneDX, SPDX, ...) | `CycloneDxSbomReader`, `SpdxSbomReader` |
75
+ | `saas_authz` | SaaS and authorization tuple stores (OpenFGA, SpiceDB, Microsoft Graph, ...) | `InProcessTupleStoreReader`, `PaginatedTupleStoreReader` |
76
+ | `agent_memory` | LLM agent memory and GraphRAG graphs (Letta, Zep, Mem0, ...) | `NetworkxMemoryReader`, `GraphWalkMemoryReader` |
77
+ | `citation_rest` | Citation and scientific REST APIs (Reactome, OpenAlex citations, ...) | `FileFixtureCitationReader`, `PaginatedCitationReader` |
78
+
79
+ See [`open_kgo/feature_groups/kg/README.md`](open_kgo/feature_groups/kg/README.md) for the full family map, the plugin anatomy, and what the prototype does and does not validate.
80
+
81
+ Install all KG extras with: `uv sync --extra kg-all`.
82
+
83
+ > **One feature per call.** KG readers dispatch a single feature per load: every
84
+ > reader rejects a multi-feature `FeatureSet` rather than silently labelling all
85
+ > rows with one feature name. Request features individually (one `Feature` per
86
+ > `mloda.run_all` slot) rather than batching `N` of them into a single reader call.
87
+
88
+ > **No-Docker testing policy.** Every connector test runs against rdflib, networkx, kuzu (embedded), or file fixtures. No Docker, no external services, no network calls.
89
+
90
+ ## Semantic Fields — Layer 2
91
+
92
+ The connector families (Layer 1 validation) answer: *"is this traversal valid?"* — binary yes/no.
93
+
94
+ **SemanticField** (Layer 2) answers: *"how relevant is this entity to my query?"* — a continuous score, grounded in DC electrical circuit theory.
95
+
96
+ The knowledge graph is modelled as a resistor network. Ontology-declared relationship weights become conductances. A query is expressed as two anchor nodes — a **source** (high voltage) and a **sink** (low voltage, ground). The solver finds the electric potential at every entity via the conductance-weighted graph Laplacian, then scores each entity by the current it carries between source and sink.
97
+
98
+ **Why current?** Current only flows through entities that bridge *both* anchors. An entity connected to only one side floats to that side's extreme voltage — zero potential difference, zero current, automatically excluded. No relation-type filtering needed; the circuit topology enforces the AND constraint.
99
+
100
+ ```python
101
+ from open_kgo.feature_groups.kg.ontology import SemanticField
102
+
103
+ # AND query: Sci-Fi films by Nolan
104
+ scores = SemanticField.compute_and(
105
+ namespace="metaqa",
106
+ edges=subgraph_edges, # 2-hop neighbourhood of both anchors
107
+ source={"Nolan": 1.0}, # high-voltage anchor
108
+ sink={"Sci-Fi": 0.0}, # ground
109
+ )
110
+ # → {"Interstellar": 0.394, "Inception": 0.312, "Dark Knight": 0.0, ...}
111
+ ```
112
+
113
+ Relationship weights are declared in the ontology YAML and flow directly into the solver as conductances:
114
+
115
+ ```yaml
116
+ relationships:
117
+ directed_by: { domain: Movie, range: Person, weight: 0.9 }
118
+ has_genre: { domain: Movie, range: Genre, weight: 0.7 }
119
+ has_tags: { domain: Movie, range: Tag, weight: 0.2 }
120
+ ```
121
+
122
+ The solver is pure Python (no numpy) with an optional numba JIT kernel that gives a **70× speedup** at ~5 000-node subgraphs; it falls back silently when numba is absent.
123
+
124
+ | Layer | What it does | Status |
125
+ |---|---|---|
126
+ | L1 — OntologyRegistry | Binary valid/invalid edge checks, YAML-declared | Built |
127
+ | L2 — SemanticField | Continuous entity scoring via DC circuit model | Built |
128
+ | L3 — Discovery Engine | Guided multi-hop traversal by field strength | Planned |
129
+
130
+ Install: `uv sync --extra kg-semantic-field`
131
+
132
+ Full visual explainer: [`demo/semantic_field_explainer.html`](demo/semantic_field_explainer.html) — open in any browser, no server needed.
133
+
134
+ ## Demos
135
+
136
+ Three marimo notebooks plus two evaluation harnesses live under `demo/`:
137
+
138
+ - `demo/demo_kg_connectors.py`: surface tour of all 9 families against the shipped fixtures.
139
+ - `demo/demo_kg_build_repo.py`: builds an RDF graph from this repo (filesystem `repo:contains` + Python `repo:imports`), serializes to Turtle, and runs five SPARQL queries through `RdfLibSparqlReader` via `mloda.run_all`.
140
+ - `demo/demo_kg_ontology.py`: walks the ontology layer end to end.
141
+ - `demo/demo_semantic_field.py`: SemanticField Layer 2 — interactive director + genre query against MetaQA, with live scoring.
142
+ - `demo/semantic_field_explainer.html`: full visual explainer for SemanticField — circuit diagram, layer stack, why EM, 1/2/multi-hop examples, test results. Open in any browser.
143
+ - `demo/eval_arch1_vs_arch2.py` and `demo/eval_qa_accuracy.py`: evaluation harnesses comparing plain traversal vs. ontology-guided traversal.
144
+
145
+ Install the demo extras and open any notebook:
146
+
147
+ ```bash
148
+ uv sync --extra demo
149
+ marimo edit demo/demo_kg_connectors.py
150
+ ```
151
+
152
+ Every demo runs offline against a small committed sample graph: no download,
153
+ no network, no external services.
154
+
155
+ ## Data and acknowledgments
156
+
157
+ The ontology demo and the two evaluation harnesses run against a small
158
+ hand-authored sample of public movie facts (`demo/data/sample_kb.txt`) written
159
+ in the triple format of the MetaQA dataset (Zhang, Yuyu et al., "Variational
160
+ Reasoning for Question Answering with Knowledge Graph", AAAI 2018,
161
+ https://github.com/yuyuz/MetaQA). The sample is committed in this repo and is
162
+ not derived from the MetaQA dataset files. The notebooks call
163
+ `demo.data.ensure_data()` at startup, which builds the sample subgraph offline.
164
+ To run against the full MetaQA benchmark (licensed under
165
+ [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/legalcode), not
166
+ redistributed here), see [`demo/data/README.md`](demo/data/README.md).
167
+
168
+ ## Development setup
169
+
170
+ **Install uv** (if not already installed):
171
+ ```bash
172
+ curl -LsSf https://astral.sh/uv/install.sh | sh
173
+ ```
174
+
175
+ **Create virtual environment and install dependencies:**
176
+ ```bash
177
+ uv venv
178
+ source .venv/bin/activate
179
+ uv sync --all-extras
180
+ ```
181
+
182
+ **Run all checks with tox:**
183
+ ```bash
184
+ uv tool install tox --with tox-uv
185
+ tox
186
+ ```
187
+
188
+ ### Run individual checks
189
+
190
+ ```bash
191
+ pytest
192
+ ruff format --check --line-length 120 .
193
+ ruff check .
194
+ mypy --strict --ignore-missing-imports .
195
+ bandit -c pyproject.toml -r -q .
196
+ ```
197
+
198
+ ## Related repositories and documentation
199
+
200
+ - **[mloda](https://github.com/mloda-ai/mloda)**: The core library for open data access. Declaratively define what data you need, not how to get it. See [mloda.ai](https://mloda.ai) for an overview and business context and the [documentation](https://mloda-ai.github.io/mloda/) for detailed guides.
201
+ - **[mloda-registry](https://github.com/mloda-ai/mloda-registry)**: The central hub for discovering and sharing mloda plugins.
202
+ - **[Plugin development guides](https://github.com/mloda-ai/mloda-registry/tree/main/docs/guides/)**: How to build FeatureGroups, ComputeFrameworks, and Extenders.
203
+ - **[Claude Code skills](https://github.com/mloda-ai/mloda-registry/tree/main/.claude/skills/)**: Assisted plugin development for Claude Code users.
File without changes