<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>factgraph: facts that carry their own proof on factgraph</title><link>http://factgraph.docs.symbolic-intelligence.de/</link><description>Recent content in factgraph: facts that carry their own proof on factgraph</description><generator>Hugo</generator><language>en-us</language><copyright>[© CC BY 4.0](https://creativecommons.org/licenses/by/4.0/legalcode)</copyright><atom:link href="http://factgraph.docs.symbolic-intelligence.de/index.xml" rel="self" type="application/rss+xml"/><item><title>Append-only ledger and provenance</title><link>http://factgraph.docs.symbolic-intelligence.de/docs/explanation/append-only-ledger-and-provenance/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>http://factgraph.docs.symbolic-intelligence.de/docs/explanation/append-only-ledger-and-provenance/</guid><description>&lt;h1 id="about-the-append-only-ledger-and-provenance"&gt;About the append-only ledger and provenance&lt;a class="anchor" href="#about-the-append-only-ledger-and-provenance"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;factgraph never overwrites a fact and never deletes one. Every write you make through the SDK lands as a new row in an append-only ledger, and &amp;ldquo;removing&amp;rdquo; a fact is itself a new row that points back at the one being removed. This page explains why the store is shaped that way, how retraction works as a revocation rather than a delete, and how provenance metadata rides along with each assertion. The mechanism lives in &lt;code&gt;factgraph.core.store.ledger.Ledger&lt;/code&gt; and in the write protocol that drives it.&lt;/p&gt;</description></item><item><title>Define a schema</title><link>http://factgraph.docs.symbolic-intelligence.de/docs/how-to/define-a-schema/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>http://factgraph.docs.symbolic-intelligence.de/docs/how-to/define-a-schema/</guid><description>&lt;h1 id="how-to-define-a-schema"&gt;How to define a schema&lt;a class="anchor" href="#how-to-define-a-schema"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;This guide shows you how to declare entity types with identity and fields in Python and build a &lt;code&gt;FactGraph&lt;/code&gt; from them, which is the first step before you write or read any facts.&lt;/p&gt;
&lt;h2 id="prerequisites"&gt;Prerequisites&lt;a class="anchor" href="#prerequisites"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;factgraph&lt;/code&gt; package installed (v0.2.0).&lt;/li&gt;
&lt;li&gt;The public symbols &lt;code&gt;Entity&lt;/code&gt;, &lt;code&gt;Identity&lt;/code&gt;, &lt;code&gt;Field&lt;/code&gt;, and &lt;code&gt;FactGraph&lt;/code&gt;, all importable from &lt;code&gt;factgraph.sdk&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="steps"&gt;Steps&lt;a class="anchor" href="#steps"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Declare an entity type by subclassing &lt;code&gt;Entity&lt;/code&gt;. Annotate each member with a Python type and assign either an &lt;code&gt;Identity()&lt;/code&gt; or a &lt;code&gt;Field()&lt;/code&gt; descriptor. Every entity must declare at least one &lt;code&gt;Identity()&lt;/code&gt; member; the metaclass raises &lt;code&gt;SDKSchemaError&lt;/code&gt; with the message &lt;code&gt;Entity '&amp;lt;name&amp;gt;' must declare at least one Identity field&lt;/code&gt; otherwise.&lt;/p&gt;</description></item><item><title>factgraph (entry point)</title><link>http://factgraph.docs.symbolic-intelligence.de/docs/reference/factgraph/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>http://factgraph.docs.symbolic-intelligence.de/docs/reference/factgraph/</guid><description>&lt;h1 id="factgraph-entry-point-and-namespace-map"&gt;FactGraph (entry point and namespace map)&lt;a class="anchor" href="#factgraph-entry-point-and-namespace-map"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;The &lt;code&gt;FactGraph&lt;/code&gt; class is the SDK entry point: it owns the compiled schema and the append-only ledger, and exposes every user-facing operation through a set of &lt;code&gt;fg.*&lt;/code&gt; namespaces. &lt;code&gt;FactGraph&lt;/code&gt; is a literal alias of &lt;code&gt;SDKStore&lt;/code&gt; (&lt;code&gt;FactGraph = SDKStore&lt;/code&gt;); both names refer to the same class and are exported from &lt;code&gt;factgraph.sdk&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id="factgraph"&gt;&lt;code&gt;FactGraph&lt;/code&gt;&lt;a class="anchor" href="#factgraph"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The main SDK graph object. It holds the compiled schema (&lt;code&gt;schema_ir&lt;/code&gt;), an append-only &lt;code&gt;Ledger&lt;/code&gt;, an optional workspace path, and the namespace managers reachable as properties. Instances are normally built with the classmethod constructors below rather than by calling the class directly.&lt;/p&gt;</description></item><item><title>Getting started</title><link>http://factgraph.docs.symbolic-intelligence.de/docs/tutorials/getting-started/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>http://factgraph.docs.symbolic-intelligence.de/docs/tutorials/getting-started/</guid><description>&lt;h1 id="getting-started-flag-a-transaction-and-prove-it-aml"&gt;Getting started: flag a transaction and prove it (AML)&lt;a class="anchor" href="#getting-started-flag-a-transaction-and-prove-it-aml"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;In this tutorial we will build a tiny anti money laundering (AML) check from scratch. We will model &lt;code&gt;Customer&lt;/code&gt; and &lt;code&gt;Transaction&lt;/code&gt; entities, record a couple of customers and a few transfers, write one rule that flags any transfer at or above a reporting threshold of 10000, evaluate it, and then read the self explaining proof of the flag condition by condition.&lt;/p&gt;</description></item><item><title>Reasoning, evaluation, and evidence</title><link>http://factgraph.docs.symbolic-intelligence.de/docs/explanation/reasoning-evaluation-and-evidence/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>http://factgraph.docs.symbolic-intelligence.de/docs/explanation/reasoning-evaluation-and-evidence/</guid><description>&lt;h1 id="reasoning-evaluation-and-evidence"&gt;Reasoning, evaluation, and evidence&lt;a class="anchor" href="#reasoning-evaluation-and-evidence"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;When you evaluate a rule against a factgraph, you do not just get back a set of answers. You get back answers that can each explain themselves, condition by condition, in a way that replays to the same result every time. This page discusses how a rule turns into result rows, why each row can carry its own proof, and what makes that proof deterministic. It is the conceptual companion to &lt;a href="http://factgraph.docs.symbolic-intelligence.de/docs/reference/evaluation/"&gt;Evaluation and explanation&lt;/a&gt;, which lists the precise types and signatures.&lt;/p&gt;</description></item><item><title>Schema</title><link>http://factgraph.docs.symbolic-intelligence.de/docs/reference/schema/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>http://factgraph.docs.symbolic-intelligence.de/docs/reference/schema/</guid><description>&lt;h1 id="schema-entity-identity-field"&gt;Schema: Entity, Identity, Field&lt;a class="anchor" href="#schema-entity-identity-field"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;Reference for declaring a factgraph schema with Python classes: the &lt;code&gt;Entity&lt;/code&gt; base class, the &lt;code&gt;Identity&lt;/code&gt; and &lt;code&gt;Field&lt;/code&gt; descriptors, the compile helpers, and the &lt;code&gt;fg.schema&lt;/code&gt; register/extend/apply namespace.&lt;/p&gt;
&lt;p&gt;All symbols on this page are importable from &lt;code&gt;factgraph.sdk&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#e2e4e5;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ff6ac1"&gt;from&lt;/span&gt; factgraph.sdk &lt;span style="color:#ff6ac1"&gt;import&lt;/span&gt; Entity, Field, Identity
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ff6ac1"&gt;from&lt;/span&gt; factgraph.sdk &lt;span style="color:#ff6ac1"&gt;import&lt;/span&gt; (
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; compile_schema_from_classes,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; schema_preflight_from_classes,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; build_authoring_schema_from_classes,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;A schema is declared by subclassing &lt;code&gt;Entity&lt;/code&gt; and assigning annotated &lt;code&gt;Identity&lt;/code&gt; and &lt;code&gt;Field&lt;/code&gt; descriptors. The &lt;code&gt;EntityMeta&lt;/code&gt; metaclass reads the annotations at class-definition time and compiles them into a per-class &lt;code&gt;__sdk_entity_spec__&lt;/code&gt;. &lt;code&gt;FactGraph.create(schema_classes=[...])&lt;/code&gt; consumes those specs to build the graph schema.&lt;/p&gt;</description></item><item><title>Write and read facts</title><link>http://factgraph.docs.symbolic-intelligence.de/docs/how-to/write-and-read-facts/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>http://factgraph.docs.symbolic-intelligence.de/docs/how-to/write-and-read-facts/</guid><description>&lt;h1 id="how-to-write-and-read-facts"&gt;How to write and read facts&lt;a class="anchor" href="#how-to-write-and-read-facts"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;This guide shows you how to create an entity, write single- and multi-valued field facts onto it, and read those values back, either through an entity snapshot or directly by field. Use it once you have a schema and a &lt;code&gt;FactGraph&lt;/code&gt; instance and want to populate and inspect data.&lt;/p&gt;
&lt;h2 id="prerequisites"&gt;Prerequisites&lt;a class="anchor" href="#prerequisites"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;A &lt;code&gt;FactGraph&lt;/code&gt; instance built from your schema classes. See &lt;a href="http://factgraph.docs.symbolic-intelligence.de/docs/how-to/define-a-schema/"&gt;How to define a schema&lt;/a&gt; and the &lt;a href="http://factgraph.docs.symbolic-intelligence.de/docs/reference/factgraph/"&gt;factgraph reference&lt;/a&gt; for constructor options.&lt;/li&gt;
&lt;li&gt;Each schema class declares at least one &lt;code&gt;Identity()&lt;/code&gt; field and zero or more &lt;code&gt;Field()&lt;/code&gt; fields. See the &lt;a href="http://factgraph.docs.symbolic-intelligence.de/docs/reference/schema/"&gt;schema reference&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The examples below use this schema:&lt;/p&gt;</description></item><item><title>Auditability</title><link>http://factgraph.docs.symbolic-intelligence.de/docs/explanation/auditability/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>http://factgraph.docs.symbolic-intelligence.de/docs/explanation/auditability/</guid><description>&lt;h1 id="auditability"&gt;Auditability&lt;a class="anchor" href="#auditability"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;Auditability in factgraph is not a feature you switch on. It is a consequence of how the
graph stores facts and how it explains conclusions. Because the ledger is append-only, every
assertion carries its own provenance, and every evaluated conclusion comes back with an
evidence structure that names the rule and the supporting facts, you can always trace a
conclusion to its inputs. This page discusses why that is structural rather than a logging
mode, and how the three pieces fit together.&lt;/p&gt;</description></item><item><title>Find and match entities</title><link>http://factgraph.docs.symbolic-intelligence.de/docs/how-to/find-and-match-entities/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>http://factgraph.docs.symbolic-intelligence.de/docs/how-to/find-and-match-entities/</guid><description>&lt;h1 id="how-to-find-and-match-entities"&gt;How to find and match entities&lt;a class="anchor" href="#how-to-find-and-match-entities"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;This guide shows you how to read entities back out of a &lt;code&gt;FactGraph&lt;/code&gt;: filter them by exact field values with &lt;code&gt;fg.entities.where&lt;/code&gt;, and select them by a rule or rule-expression pattern (with port constraints) using &lt;code&gt;fg.entities.match&lt;/code&gt;. Both return a tuple/list of read-only &lt;code&gt;EntitySnapshot&lt;/code&gt; objects.&lt;/p&gt;
&lt;h2 id="prerequisites"&gt;Prerequisites&lt;a class="anchor" href="#prerequisites"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;A &lt;code&gt;FactGraph&lt;/code&gt; with a registered schema and some entities written to it. See &lt;a href="http://factgraph.docs.symbolic-intelligence.de/docs/how-to/define-a-schema/"&gt;How to define a schema&lt;/a&gt; and &lt;a href="http://factgraph.docs.symbolic-intelligence.de/docs/how-to/write-and-read-facts/"&gt;How to write and read facts&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;Entity&lt;/code&gt; subclasses you query with must be the same classes you registered.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Both verbs require an &lt;code&gt;Entity&lt;/code&gt; subclass as the first positional argument. Passing a string, a &lt;code&gt;Field&lt;/code&gt; descriptor, or any other type raises &lt;code&gt;SDKStoreError&lt;/code&gt; (the Layer 1 navigation key check, ADR-API §4.1.1).&lt;/p&gt;</description></item><item><title>Three-layer API</title><link>http://factgraph.docs.symbolic-intelligence.de/docs/reference/three-layer-api/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>http://factgraph.docs.symbolic-intelligence.de/docs/reference/three-layer-api/</guid><description>&lt;h1 id="three-layer-api-entities-fields-assertions"&gt;Three-layer API: entities, fields, assertions&lt;a class="anchor" href="#three-layer-api-entities-fields-assertions"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;The write and read surface of a &lt;code&gt;FactGraph&lt;/code&gt; (alias of &lt;code&gt;SDKStore&lt;/code&gt;) is divided into three navigation layers, each exposed as a read-only namespace on the graph instance &lt;code&gt;fg&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Each namespace is selected by a fixed navigation key. Passing the wrong kind of key raises &lt;code&gt;SDKStoreError&lt;/code&gt; with a message that names the correct layer (citing ADR-API §4.1.1). The layers are:&lt;/p&gt;
&lt;table&gt;
 &lt;thead&gt;
 &lt;tr&gt;
 &lt;th&gt;Namespace&lt;/th&gt;
 &lt;th&gt;Layer&lt;/th&gt;
 &lt;th&gt;Navigation key&lt;/th&gt;
 &lt;th&gt;Property&lt;/th&gt;
 &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;code&gt;fg.entities&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;1&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;EntityClass&lt;/code&gt; + identity kwargs, or a managed &lt;code&gt;e_ref&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;entities&lt;/code&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;code&gt;fg.fields&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;2&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;Field&lt;/code&gt; descriptor + &lt;code&gt;e_ref&lt;/code&gt; (+ optional value)&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;fields&lt;/code&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;code&gt;fg.assertions&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;3&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;asrt_id&lt;/code&gt; string&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;assertions&lt;/code&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;All three namespaces reject attribute assignment: &lt;code&gt;fg.entities.x = ...&lt;/code&gt;, &lt;code&gt;fg.fields.x = ...&lt;/code&gt;, and &lt;code&gt;fg.assertions.x = ...&lt;/code&gt; each raise &lt;code&gt;FrozenSnapshotError&lt;/code&gt;.&lt;/p&gt;</description></item><item><title>Evaluate a rule and read the proof</title><link>http://factgraph.docs.symbolic-intelligence.de/docs/how-to/evaluate-a-rule-and-read-the-proof/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>http://factgraph.docs.symbolic-intelligence.de/docs/how-to/evaluate-a-rule-and-read-the-proof/</guid><description>&lt;h1 id="how-to-evaluate-a-rule-and-read-its-proof"&gt;How to evaluate a rule and read its proof&lt;a class="anchor" href="#how-to-evaluate-a-rule-and-read-its-proof"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;This guide shows you how to build a rule with &lt;code&gt;build_application_rule&lt;/code&gt;, run it against a graph, and read the proof behind each result row, for when you need both the answer and a human-readable account of why it holds.&lt;/p&gt;
&lt;h2 id="prerequisites"&gt;Prerequisites&lt;a class="anchor" href="#prerequisites"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;A &lt;code&gt;FactGraph&lt;/code&gt; with the facts your rule body needs. Field atoms such as &lt;code&gt;User(u).status == &amp;quot;active&amp;quot;&lt;/code&gt; match field claims written by &lt;code&gt;fg.fields.set&lt;/code&gt;. See &lt;a href="http://factgraph.docs.symbolic-intelligence.de/docs/how-to/write-and-read-facts/"&gt;How to write and read facts&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Be aware of how existence atoms compile. An existence atom such as &lt;code&gt;User(u)&lt;/code&gt; lowers to the &lt;code&gt;User:exists&lt;/code&gt; predicate, and a field atom like &lt;code&gt;User(u).status == &amp;quot;active&amp;quot;&lt;/code&gt; lowers to &lt;em&gt;both&lt;/em&gt; the &lt;code&gt;User:exists&lt;/code&gt; predicate and the field predicate. So any rule body that mentions an entity variable carries an implicit &lt;code&gt;User:exists&lt;/code&gt; requirement. &lt;code&gt;fg.entities.create(...)&lt;/code&gt; emits only the entity&amp;rsquo;s identity claims; it does not emit a &lt;code&gt;:exists&lt;/code&gt; claim (the &lt;code&gt;:exists&lt;/code&gt; co-emission is transitional and not performed by the current write path, see the guard note in &lt;code&gt;factgraph.sdk.store&lt;/code&gt;). A rule body that relies on existence therefore will not match entities created through the SDK write path until a &lt;code&gt;:exists&lt;/code&gt; claim is present for them.&lt;/li&gt;
&lt;li&gt;The rule-authoring imports come from &lt;code&gt;factgraph.sdk.dsl&lt;/code&gt;. The schema base classes (&lt;code&gt;Entity&lt;/code&gt;, &lt;code&gt;Identity&lt;/code&gt;, &lt;code&gt;Field&lt;/code&gt;) come from &lt;code&gt;factgraph.sdk&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="steps"&gt;Steps&lt;a class="anchor" href="#steps"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Define a schema and create the entities the rule will match. &lt;code&gt;create&lt;/code&gt; emits the identity claims for the entity; &lt;code&gt;fg.fields.set&lt;/code&gt; adds field claims.&lt;/p&gt;</description></item><item><title>Rules</title><link>http://factgraph.docs.symbolic-intelligence.de/docs/reference/rules/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>http://factgraph.docs.symbolic-intelligence.de/docs/reference/rules/</guid><description>&lt;h1 id="rules"&gt;Rules&lt;a class="anchor" href="#rules"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;Reference for the rule-authoring surface: &lt;code&gt;build_application_rule&lt;/code&gt;, the Entity-DSL atom forms, &lt;code&gt;vars&lt;/code&gt;, &lt;code&gt;Not&lt;/code&gt;, the application &lt;code&gt;Rule&lt;/code&gt; value, &lt;code&gt;RuleExpr&lt;/code&gt; composition, and &lt;code&gt;fg.rules.inspect&lt;/code&gt; with its &lt;code&gt;RuleExprInspect&lt;/code&gt; result. Most of these symbols are importable from &lt;code&gt;factgraph.sdk&lt;/code&gt;. The supporting types &lt;code&gt;RuleValidationError&lt;/code&gt;, &lt;code&gt;RuleOccurrence&lt;/code&gt;, and &lt;code&gt;RulePortRef&lt;/code&gt; are not exported from &lt;code&gt;factgraph.sdk&lt;/code&gt;; import them from &lt;code&gt;factgraph.application.protocol&lt;/code&gt; (their defining module is &lt;code&gt;factgraph.application.protocol.rule&lt;/code&gt;). &lt;code&gt;PortType&lt;/code&gt; is importable only from &lt;code&gt;factgraph.application.protocol.rule&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;A &lt;code&gt;Rule&lt;/code&gt; is an AND-only conjunction of conditions over existing facts, with named output &lt;code&gt;ports&lt;/code&gt;. Rules are values: they compose with &lt;code&gt;&amp;amp;&lt;/code&gt; and &lt;code&gt;|&lt;/code&gt; into a &lt;code&gt;RuleExpr&lt;/code&gt;, and are inspected with &lt;code&gt;fg.rules.inspect&lt;/code&gt;.&lt;/p&gt;</description></item><item><title>Choose a reasoning engine</title><link>http://factgraph.docs.symbolic-intelligence.de/docs/how-to/choose-a-reasoning-engine/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>http://factgraph.docs.symbolic-intelligence.de/docs/how-to/choose-a-reasoning-engine/</guid><description>&lt;h1 id="how-to-choose-a-reasoning-engine"&gt;How to choose a reasoning engine&lt;a class="anchor" href="#how-to-choose-a-reasoning-engine"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;This guide shows you how to pick and configure the engine that evaluates a rule, when the default boolean answer is not enough and you need a probabilistic or possibilistic verdict instead.&lt;/p&gt;
&lt;p&gt;You select the engine on the call, not on the graph: every &lt;code&gt;fg.eval.evaluate(...)&lt;/code&gt; and &lt;code&gt;fg.eval.explain(...)&lt;/code&gt; call takes an &lt;code&gt;engine=&lt;/code&gt; keyword, and the probabilistic and possibilistic engines additionally take a &lt;code&gt;config=&lt;/code&gt; wrapper. The same rule and the same facts can be evaluated under any supported engine.&lt;/p&gt;</description></item><item><title>Evaluation and explanation</title><link>http://factgraph.docs.symbolic-intelligence.de/docs/reference/evaluation/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>http://factgraph.docs.symbolic-intelligence.de/docs/reference/evaluation/</guid><description>&lt;h1 id="evaluation-and-explanation"&gt;Evaluation and explanation&lt;a class="anchor" href="#evaluation-and-explanation"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;The &lt;code&gt;fg.eval&lt;/code&gt; namespace, its result envelope (&lt;code&gt;EvaluateResult&lt;/code&gt; / &lt;code&gt;EvaluateRow&lt;/code&gt;), and the explanation surface (&lt;code&gt;Explanation&lt;/code&gt; and the &lt;code&gt;EvidenceGraph&lt;/code&gt; it carries).&lt;/p&gt;
&lt;p&gt;&lt;code&gt;fg.eval&lt;/code&gt; is a read-only namespace on a &lt;code&gt;FactGraph&lt;/code&gt; / &lt;code&gt;SDKStore&lt;/code&gt; instance. Assigning to it raises &lt;code&gt;FrozenSnapshotError&lt;/code&gt;. It never writes to the ledger.&lt;/p&gt;
&lt;h2 id="fgevalevaluaterule_or_expr--head-enginenone-confignone---evaluateresult"&gt;&lt;code&gt;fg.eval.evaluate(rule_or_expr, *, head, engine=None, config=None) -&amp;gt; EvaluateResult&lt;/code&gt;&lt;a class="anchor" href="#fgevalevaluaterule_or_expr--head-enginenone-confignone---evaluateresult"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Evaluates an application &lt;code&gt;Rule&lt;/code&gt; or a &lt;code&gt;RuleExpr&lt;/code&gt; against the current visible view and returns an &lt;code&gt;EvaluateResult&lt;/code&gt; envelope. (The same method also accepts an &lt;code&gt;Inference&lt;/code&gt; object or a structured derivation dict; those legacy derivation inputs are not covered here.)&lt;/p&gt;</description></item><item><title>Engines and semantics</title><link>http://factgraph.docs.symbolic-intelligence.de/docs/reference/engines-and-semantics/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>http://factgraph.docs.symbolic-intelligence.de/docs/reference/engines-and-semantics/</guid><description>&lt;h1 id="engines-and-semantics"&gt;Engines and semantics&lt;a class="anchor" href="#engines-and-semantics"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;The &lt;code&gt;engine=&lt;/code&gt; and &lt;code&gt;config=&lt;/code&gt; options of &lt;code&gt;fg.eval.evaluate(...)&lt;/code&gt; and &lt;code&gt;fg.eval.explain(...)&lt;/code&gt;, the supported engine names, the public semantics wrappers &lt;code&gt;ProbLogConfig&lt;/code&gt; and &lt;code&gt;PyReasonConfig&lt;/code&gt;, the canonical &lt;code&gt;SemanticsProfile&lt;/code&gt;, and how certainty is represented per engine.&lt;/p&gt;
&lt;h2 id="engine-option"&gt;&lt;code&gt;engine=&lt;/code&gt; option&lt;a class="anchor" href="#engine-option"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Selects the runtime adapter that executes a rule, RuleExpr, or inference. Passed as a keyword to &lt;code&gt;fg.eval.evaluate(...)&lt;/code&gt;, &lt;code&gt;fg.eval.evaluate_candidates(...)&lt;/code&gt;, and &lt;code&gt;fg.eval.explain(...)&lt;/code&gt;.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Type:&lt;/strong&gt; string or &lt;code&gt;None&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Default:&lt;/strong&gt; &lt;code&gt;None&lt;/code&gt;, which resolves to &lt;code&gt;&amp;quot;native&amp;quot;&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Accepted values:&lt;/strong&gt; &lt;code&gt;&amp;quot;native&amp;quot;&lt;/code&gt;, &lt;code&gt;&amp;quot;souffle&amp;quot;&lt;/code&gt;, &lt;code&gt;&amp;quot;problog&amp;quot;&lt;/code&gt;, &lt;code&gt;&amp;quot;pyreason&amp;quot;&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The accepted set is fixed by &lt;code&gt;SUPPORTED_ENGINES&lt;/code&gt; in &lt;code&gt;factgraph.core.semantics&lt;/code&gt;:&lt;/p&gt;</description></item><item><title>Persist and reload a workspace</title><link>http://factgraph.docs.symbolic-intelligence.de/docs/how-to/persist-and-reload-a-workspace/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>http://factgraph.docs.symbolic-intelligence.de/docs/how-to/persist-and-reload-a-workspace/</guid><description>&lt;h1 id="how-to-persist-and-reload-a-workspace"&gt;How to persist and reload a workspace&lt;a class="anchor" href="#how-to-persist-and-reload-a-workspace"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;This guide shows you how to save a &lt;code&gt;FactGraph&lt;/code&gt; ledger to disk as a durable workspace and reload it later under the matching schema. Use it when a graph must outlive the process that built it, for example to hand a ledger to a separate read or evaluation step.&lt;/p&gt;
&lt;p&gt;A workspace is a directory holding the ledger (&lt;code&gt;ledger.db&lt;/code&gt;), a schema object under &lt;code&gt;db/&lt;/code&gt;, and a manifest (&lt;code&gt;factgraph_workspace.json&lt;/code&gt;). Reload validates the stored schema digest against the &lt;code&gt;Entity&lt;/code&gt; classes you supply, so the same classes that created the workspace must be available at load time. For the full surface and manifest layout, see &lt;a href="http://factgraph.docs.symbolic-intelligence.de/docs/reference/persistence/"&gt;Persistence: workspaces and attach&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>Audit and capabilities</title><link>http://factgraph.docs.symbolic-intelligence.de/docs/reference/audit/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>http://factgraph.docs.symbolic-intelligence.de/docs/reference/audit/</guid><description>&lt;h1 id="audit-and-capabilities"&gt;Audit and capabilities&lt;a class="anchor" href="#audit-and-capabilities"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;Reference for the &lt;code&gt;fg.audit&lt;/code&gt; namespace (&lt;code&gt;explain&lt;/code&gt;, &lt;code&gt;conflicts&lt;/code&gt;, &lt;code&gt;diff_proof_frames&lt;/code&gt;) and the &lt;code&gt;fg.meta&lt;/code&gt; namespace (&lt;code&gt;capabilities&lt;/code&gt;). Both namespaces are read-only: assigning an attribute on either raises &lt;code&gt;FrozenSnapshotError&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id="fgaudit"&gt;&lt;code&gt;fg.audit&lt;/code&gt;&lt;a class="anchor" href="#fgaudit"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;fg.audit&lt;/code&gt; namespace exposes post-hoc audit queries over the ledger and over recorded round events. The attribute &lt;code&gt;fg.audit&lt;/code&gt; returns the audit namespace manager.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#e2e4e5;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;fg&lt;span style="color:#ff6ac1"&gt;.&lt;/span&gt;audit &lt;span style="color:#78787e"&gt;# read-only namespace; fg.audit.x = ... raises FrozenSnapshotError&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="fgauditexplaintarget"&gt;&lt;code&gt;fg.audit.explain(target)&lt;/code&gt;&lt;a class="anchor" href="#fgauditexplaintarget"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Explain chosen-policy state for the predicate/entity cell of one assertion.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Parameters:&lt;/strong&gt;&lt;/p&gt;</description></item><item><title>Trace and audit a fact</title><link>http://factgraph.docs.symbolic-intelligence.de/docs/how-to/trace-and-audit-a-fact/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>http://factgraph.docs.symbolic-intelligence.de/docs/how-to/trace-and-audit-a-fact/</guid><description>&lt;h1 id="how-to-trace-and-audit-a-fact"&gt;How to trace and audit a fact&lt;a class="anchor" href="#how-to-trace-and-audit-a-fact"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;This guide shows you how to start from a fact you already hold (its assertion id or &lt;code&gt;AssertionRecord&lt;/code&gt;), read the provenance recorded on it, and inspect which value the runtime chose for that entity field cell, including when several active assertions compete.&lt;/p&gt;
&lt;h2 id="prerequisites"&gt;Prerequisites&lt;a class="anchor" href="#prerequisites"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;A &lt;code&gt;FactGraph&lt;/code&gt; (alias &lt;code&gt;SDKStore&lt;/code&gt;) with a registered schema and at least one written field assertion.&lt;/li&gt;
&lt;li&gt;The assertion id of the fact, or an &lt;code&gt;AssertionRecord&lt;/code&gt; for it. Field writes return the assertion id: &lt;code&gt;fg.fields.set(...)&lt;/code&gt; and &lt;code&gt;fg.fields.add(...)&lt;/code&gt; both return a &lt;code&gt;str&lt;/code&gt; asrt_id. If you only have the entity and field, see step 1 for how to recover the id.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The examples use this schema and a single written cell:&lt;/p&gt;</description></item><item><title>Persistence</title><link>http://factgraph.docs.symbolic-intelligence.de/docs/reference/persistence/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>http://factgraph.docs.symbolic-intelligence.de/docs/reference/persistence/</guid><description>&lt;h1 id="persistence-workspaces-and-attach"&gt;Persistence: workspaces and attach&lt;a class="anchor" href="#persistence-workspaces-and-attach"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;The public surface for persisting a &lt;code&gt;FactGraph&lt;/code&gt; to disk and reloading it: the workspace &lt;code&gt;create&lt;/code&gt; / &lt;code&gt;save_workspace&lt;/code&gt; / &lt;code&gt;load_workspace&lt;/code&gt; lifecycle, the &lt;code&gt;FactGraph.attach(db, ...)&lt;/code&gt; Database lifecycle, and the &lt;code&gt;Database&lt;/code&gt;, &lt;code&gt;CommitResult&lt;/code&gt;, &lt;code&gt;AssertionInput&lt;/code&gt;, and &lt;code&gt;MetaEntry&lt;/code&gt; types exported from &lt;code&gt;factgraph.sdk&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;FactGraph&lt;/code&gt; is a literal alias of &lt;code&gt;SDKStore&lt;/code&gt; (&lt;code&gt;FactGraph = SDKStore&lt;/code&gt;). The names are interchangeable; this page uses &lt;code&gt;FactGraph&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id="factgraphcreateschema_classes--ledgernone-ledger_pathnone-pathnone-artifact_store_rootnone-registry_rootnone-registrynone-default_row_formatnone---sdkstore"&gt;&lt;code&gt;FactGraph.create(schema_classes, *, ledger=None, ledger_path=None, path=None, artifact_store_root=None, registry_root=None, registry=None, default_row_format=None) -&amp;gt; SDKStore&lt;/code&gt;&lt;a class="anchor" href="#factgraphcreateschema_classes--ledgernone-ledger_pathnone-pathnone-artifact_store_rootnone-registry_rootnone-registrynone-default_row_formatnone---sdkstore"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Classmethod. Creates a &lt;code&gt;FactGraph&lt;/code&gt; from Python &lt;code&gt;Entity&lt;/code&gt; classes and optionally binds it to a durable workspace directory. This is the constructor that produces a workspace-capable graph.&lt;/p&gt;</description></item><item><title>Errors</title><link>http://factgraph.docs.symbolic-intelligence.de/docs/reference/errors/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>http://factgraph.docs.symbolic-intelligence.de/docs/reference/errors/</guid><description>&lt;h1 id="errors-and-error-codes"&gt;Errors and error codes&lt;a class="anchor" href="#errors-and-error-codes"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;The public exception hierarchy raised by the factgraph SDK, the attributes carried on each error, and the exported error-code string constants.&lt;/p&gt;
&lt;p&gt;Most public error classes and all code constants are re-exported from the top-level &lt;code&gt;factgraph.sdk&lt;/code&gt; package (see &lt;a href="http://factgraph.docs.symbolic-intelligence.de/docs/reference/factgraph/"&gt;&lt;code&gt;reference/factgraph.md&lt;/code&gt;&lt;/a&gt;). The base class &lt;code&gt;SDKError&lt;/code&gt; is not re-exported from &lt;code&gt;factgraph.sdk&lt;/code&gt;; import it from &lt;code&gt;factgraph.sdk.errors&lt;/code&gt;. &lt;code&gt;RuleValidationError&lt;/code&gt; and &lt;code&gt;DetachedRowError&lt;/code&gt; live outside the SDK package; &lt;code&gt;DetachedRowError&lt;/code&gt; is re-exported from &lt;code&gt;factgraph.sdk&lt;/code&gt;, while &lt;code&gt;RuleValidationError&lt;/code&gt; is not.&lt;/p&gt;</description></item></channel></rss>