eyeprolog 1.3.97 → 1.3.99
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.
- package/README.md +8 -0
- package/examples/data/README.md +21 -0
- package/examples/data/symbiotic-knowledge-graph-input.nq +59 -0
- package/examples/data/symbiotic-knowledge-graph-output.nq +8 -0
- package/examples/data/symbiotic-knowledge-graph-output.pl +6 -0
- package/examples/data/symbiotic-knowledge-graph-rules.pl +386 -0
- package/examples/deck/README.md +6 -0
- package/examples/deck/symbiotic-knowledge-graphs.md +331 -0
- package/examples/output/symbiotic-knowledge-graph.pl +42 -0
- package/examples/symbiotic-knowledge-graph.pl +449 -0
- package/package.json +1 -1
- package/playground.html +1 -0
- package/the-art-of-eyeprolog.md +6 -1
- package/why-eyeprolog.md +10 -0
package/README.md
CHANGED
|
@@ -64,10 +64,18 @@ printf 'human(socrates).\nmortal(X) :- human(X).\n' |
|
|
|
64
64
|
- [Why EyeProlog?](https://eyereasoner.github.io/eyeprolog/why-eyeprolog) — project scope and design
|
|
65
65
|
- [Playground](https://eyereasoner.github.io/eyeprolog/playground) — run EyeProlog in a browser
|
|
66
66
|
- [Examples](examples) — runnable programs and checked output
|
|
67
|
+
- [Symbiotic Knowledge Graphs](examples/deck/symbiotic-knowledge-graphs.md) — RDF ↔ Prolog heatwave-response demo for human/AI/KG co-evolution
|
|
68
|
+
- [rdf-prolog-roundtrip](https://github.com/eyereasoner/rdf-prolog-roundtrip) — standalone RDF 1.2 ↔ ISO Prolog bridge used by the symbiotic example
|
|
67
69
|
- [ISO conformance audit](test/conformance/ISO-COMPLIANCE.md) — supported Part 1 profile
|
|
68
70
|
- [Conformance report](conformance-report.md) — generated public corpus summary
|
|
69
71
|
- [OpenRuleBench](openrulebench/README.md) — portable benchmark profile
|
|
70
72
|
|
|
73
|
+
## RDF, Prolog, and symbiotic knowledge graphs
|
|
74
|
+
|
|
75
|
+
EyeProlog can sit behind an RDF knowledge graph without inventing a private graph representation. [`rdf-prolog-roundtrip`](https://github.com/eyereasoner/rdf-prolog-roundtrip) converts RDF 1.2 datasets to ordinary `rdf(Subject, Predicate, Object, Graph)` facts, EyeProlog applies portable rules, and ground `rdf/4` results can be converted back to RDF.
|
|
76
|
+
|
|
77
|
+
The checked [Symbiotic Knowledge Graphs example](examples/symbiotic-knowledge-graph.pl) uses named graphs and RDF 1.2 triple terms to distinguish trusted knowledge, AI-proposed statements, and human review. Its [wide-audience companion](examples/deck/symbiotic-knowledge-graphs.md) explains why this is a useful present-day software model for human/AI/KG co-evolution: RDF supplies shared semantic memory, Prolog supplies explicit deliberation, AI supplies new hypotheses, and people remain participants in meaning and judgment.
|
|
78
|
+
|
|
71
79
|
## Development
|
|
72
80
|
|
|
73
81
|
```sh
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Example data and roundtrip support
|
|
2
|
+
|
|
3
|
+
This directory contains source and materialized data that support runnable examples without adding extra root-level `.pl` programs to the example test discovery.
|
|
4
|
+
|
|
5
|
+
## Symbiotic Knowledge Graphs
|
|
6
|
+
|
|
7
|
+
The heatwave-response example uses [`rdf-prolog-roundtrip`](https://github.com/eyereasoner/rdf-prolog-roundtrip) as its RDF boundary:
|
|
8
|
+
|
|
9
|
+
```text
|
|
10
|
+
symbiotic-knowledge-graph-input.nq
|
|
11
|
+
-> rdf-to-prolog + symbiotic-knowledge-graph-rules.pl
|
|
12
|
+
-> ../symbiotic-knowledge-graph.pl
|
|
13
|
+
-> EyeProlog result_rdf/4
|
|
14
|
+
-> symbiotic-knowledge-graph-output.pl
|
|
15
|
+
-> prolog-to-rdf
|
|
16
|
+
-> symbiotic-knowledge-graph-output.nq
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
The input uses named graphs for source boundaries and RDF 1.2 triple terms for AI-proposed statements. A proposed triple is therefore metadata until governance rules accept it; it does not become an operational assertion merely because an AI produced it.
|
|
20
|
+
|
|
21
|
+
See [the wide-audience deck](../deck/symbiotic-knowledge-graphs.md) for the scenario and architecture.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
VERSION "1.2"
|
|
2
|
+
|
|
3
|
+
<https://example.org/city/facility/central-hall> <https://example.org/vocab/kind> <https://example.org/city/class/cooling-center> <https://example.org/graph/city-facilities> .
|
|
4
|
+
<https://example.org/city/facility/central-hall> <https://example.org/vocab/neighbourhood> <https://example.org/city/neighbourhood/central> <https://example.org/graph/city-facilities> .
|
|
5
|
+
<https://example.org/city/facility/central-hall> <https://example.org/vocab/status> <https://example.org/city/state/open> <https://example.org/graph/city-facilities> .
|
|
6
|
+
<https://example.org/city/facility/central-hall> <https://example.org/vocab/cooling> <https://example.org/city/state/available> <https://example.org/graph/city-facilities> .
|
|
7
|
+
<https://example.org/city/facility/central-hall> <https://example.org/vocab/capacity> "140"^^<http://www.w3.org/2001/XMLSchema#integer> <https://example.org/graph/city-facilities> .
|
|
8
|
+
<https://example.org/city/facility/central-hall> <https://example.org/vocab/wheelchairAccess> <https://example.org/city/value/yes> <https://example.org/graph/city-facilities> .
|
|
9
|
+
<https://example.org/city/facility/north-library> <https://example.org/vocab/kind> <https://example.org/city/class/cooling-center> <https://example.org/graph/city-facilities> .
|
|
10
|
+
<https://example.org/city/facility/north-library> <https://example.org/vocab/neighbourhood> <https://example.org/city/neighbourhood/north> <https://example.org/graph/city-facilities> .
|
|
11
|
+
<https://example.org/city/facility/north-library> <https://example.org/vocab/status> <https://example.org/city/state/open> <https://example.org/graph/city-facilities> .
|
|
12
|
+
<https://example.org/city/facility/north-library> <https://example.org/vocab/cooling> <https://example.org/city/state/available> <https://example.org/graph/city-facilities> .
|
|
13
|
+
<https://example.org/city/facility/north-library> <https://example.org/vocab/capacity> "80"^^<http://www.w3.org/2001/XMLSchema#integer> <https://example.org/graph/city-facilities> .
|
|
14
|
+
<https://example.org/city/facility/north-library> <https://example.org/vocab/wheelchairAccess> <https://example.org/city/value/yes> <https://example.org/graph/city-facilities> .
|
|
15
|
+
<https://example.org/city/facility/riverside-school> <https://example.org/vocab/kind> <https://example.org/city/class/school> <https://example.org/graph/city-facilities> .
|
|
16
|
+
<https://example.org/city/facility/riverside-school> <https://example.org/vocab/neighbourhood> <https://example.org/city/neighbourhood/riverside> <https://example.org/graph/city-facilities> .
|
|
17
|
+
<https://example.org/city/facility/riverside-school> <https://example.org/vocab/status> <https://example.org/city/state/open> <https://example.org/graph/city-facilities> .
|
|
18
|
+
<https://example.org/city/facility/riverside-school> <https://example.org/vocab/cooling> <https://example.org/city/state/available> <https://example.org/graph/city-facilities> .
|
|
19
|
+
<https://example.org/city/facility/riverside-school> <https://example.org/vocab/capacity> "90"^^<http://www.w3.org/2001/XMLSchema#integer> <https://example.org/graph/city-facilities> .
|
|
20
|
+
<https://example.org/city/facility/riverside-school> <https://example.org/vocab/wheelchairAccess> <https://example.org/city/value/yes> <https://example.org/graph/city-facilities> .
|
|
21
|
+
<https://example.org/city/neighbourhood/riverside> <https://example.org/vocab/expectedDemand> "70"^^<http://www.w3.org/2001/XMLSchema#integer> <https://example.org/graph/emergency-plan> .
|
|
22
|
+
<https://example.org/city/neighbourhood/riverside> <https://example.org/vocab/mobileUnitAvailable> <https://example.org/city/value/yes> <https://example.org/graph/emergency-plan> .
|
|
23
|
+
<https://example.org/city/route/7> <https://example.org/vocab/connects> <https://example.org/city/facility/north-library> <https://example.org/graph/transit-plan> .
|
|
24
|
+
<https://example.org/city/route/8> <https://example.org/vocab/connects> <https://example.org/city/facility/central-hall> <https://example.org/graph/transit-plan> .
|
|
25
|
+
<https://example.org/city/route/7> <https://example.org/vocab/status> <https://example.org/city/state/running> <https://example.org/graph/transit-plan> .
|
|
26
|
+
<https://example.org/city/route/8> <https://example.org/vocab/status> <https://example.org/city/state/running> <https://example.org/graph/transit-plan> .
|
|
27
|
+
<https://example.org/city/facility/central-hall> <https://example.org/vocab/power> <https://example.org/city/state/unstable> <https://example.org/graph/power-sensors> .
|
|
28
|
+
<https://example.org/city/evidence/transit-api-20260827> <https://example.org/vocab/evidenceKind> <https://example.org/city/evidence-kind/official-feed> <https://example.org/graph/evidence-registry> .
|
|
29
|
+
<https://example.org/city/evidence/transit-api-20260827> <https://example.org/vocab/publisher> <https://example.org/city/publisher/city-transit> <https://example.org/graph/evidence-registry> .
|
|
30
|
+
<https://example.org/city/evidence/facilities-bulletin-20260827> <https://example.org/vocab/evidenceKind> <https://example.org/city/evidence-kind/official-document> <https://example.org/graph/evidence-registry> .
|
|
31
|
+
<https://example.org/city/evidence/facilities-bulletin-20260827> <https://example.org/vocab/publisher> <https://example.org/city/publisher/city-facilities> <https://example.org/graph/evidence-registry> .
|
|
32
|
+
<https://example.org/city/evidence/community-post-4812> <https://example.org/vocab/evidenceKind> <https://example.org/city/evidence-kind/public-report> <https://example.org/graph/evidence-registry> .
|
|
33
|
+
<https://example.org/city/evidence/community-post-4812> <https://example.org/vocab/publisher> <https://example.org/city/publisher/resident-network> <https://example.org/graph/evidence-registry> .
|
|
34
|
+
<https://example.org/city/evidence/volunteer-message-112> <https://example.org/vocab/evidenceKind> <https://example.org/city/evidence-kind/public-report> <https://example.org/graph/evidence-registry> .
|
|
35
|
+
<https://example.org/city/evidence/volunteer-message-112> <https://example.org/vocab/publisher> <https://example.org/city/publisher/volunteer-coordinator> <https://example.org/graph/evidence-registry> .
|
|
36
|
+
<https://example.org/city/proposal/p1> <https://example.org/vocab/statement> <<( <https://example.org/city/route/7> <https://example.org/vocab/status> <https://example.org/city/state/suspended> )>> <https://example.org/graph/ai-proposals> .
|
|
37
|
+
<https://example.org/city/proposal/p1> <https://example.org/vocab/agent> <https://example.org/city/agent/language-agent> <https://example.org/graph/ai-proposals> .
|
|
38
|
+
<https://example.org/city/proposal/p1> <https://example.org/vocab/evidence> <https://example.org/city/evidence/transit-api-20260827> <https://example.org/graph/ai-proposals> .
|
|
39
|
+
<https://example.org/city/proposal/p1> <https://example.org/vocab/confidencePercent> "99"^^<http://www.w3.org/2001/XMLSchema#integer> <https://example.org/graph/ai-proposals> .
|
|
40
|
+
<https://example.org/city/proposal/p2> <https://example.org/vocab/statement> <<( <https://example.org/city/facility/riverside-school> <https://example.org/vocab/emergencyDesignation> <https://example.org/city/class/cooling-center> )>> <https://example.org/graph/ai-proposals> .
|
|
41
|
+
<https://example.org/city/proposal/p2> <https://example.org/vocab/agent> <https://example.org/city/agent/language-agent> <https://example.org/graph/ai-proposals> .
|
|
42
|
+
<https://example.org/city/proposal/p2> <https://example.org/vocab/evidence> <https://example.org/city/evidence/facilities-bulletin-20260827> <https://example.org/graph/ai-proposals> .
|
|
43
|
+
<https://example.org/city/proposal/p2> <https://example.org/vocab/confidencePercent> "93"^^<http://www.w3.org/2001/XMLSchema#integer> <https://example.org/graph/ai-proposals> .
|
|
44
|
+
<https://example.org/city/proposal/p3> <https://example.org/vocab/statement> <<( <https://example.org/city/facility/central-hall> <https://example.org/vocab/status> <https://example.org/city/state/closed> )>> <https://example.org/graph/ai-proposals> .
|
|
45
|
+
<https://example.org/city/proposal/p3> <https://example.org/vocab/agent> <https://example.org/city/agent/language-agent> <https://example.org/graph/ai-proposals> .
|
|
46
|
+
<https://example.org/city/proposal/p3> <https://example.org/vocab/evidence> <https://example.org/city/evidence/community-post-4812> <https://example.org/graph/ai-proposals> .
|
|
47
|
+
<https://example.org/city/proposal/p3> <https://example.org/vocab/confidencePercent> "78"^^<http://www.w3.org/2001/XMLSchema#integer> <https://example.org/graph/ai-proposals> .
|
|
48
|
+
<https://example.org/city/proposal/p4> <https://example.org/vocab/statement> <<( <https://example.org/city/facility/north-library> <https://example.org/vocab/capacity> "40"^^<http://www.w3.org/2001/XMLSchema#integer> )>> <https://example.org/graph/ai-proposals> .
|
|
49
|
+
<https://example.org/city/proposal/p4> <https://example.org/vocab/agent> <https://example.org/city/agent/language-agent> <https://example.org/graph/ai-proposals> .
|
|
50
|
+
<https://example.org/city/proposal/p4> <https://example.org/vocab/evidence> <https://example.org/city/evidence/volunteer-message-112> <https://example.org/graph/ai-proposals> .
|
|
51
|
+
<https://example.org/city/proposal/p4> <https://example.org/vocab/confidencePercent> "66"^^<http://www.w3.org/2001/XMLSchema#integer> <https://example.org/graph/ai-proposals> .
|
|
52
|
+
<https://example.org/city/review/r2> <https://example.org/vocab/aboutProposal> <https://example.org/city/proposal/p2> <https://example.org/graph/human-review> .
|
|
53
|
+
<https://example.org/city/review/r2> <https://example.org/vocab/reviewer> <https://example.org/city/actor/emergency-coordinator> <https://example.org/graph/human-review> .
|
|
54
|
+
<https://example.org/city/review/r2> <https://example.org/vocab/decision> <https://example.org/city/decision/accept> <https://example.org/graph/human-review> .
|
|
55
|
+
<https://example.org/city/review/r2> <https://example.org/vocab/note> "facility bulletin verified by phone"^^<http://www.w3.org/2001/XMLSchema#string> <https://example.org/graph/human-review> .
|
|
56
|
+
<https://example.org/city/review/r3> <https://example.org/vocab/aboutProposal> <https://example.org/city/proposal/p3> <https://example.org/graph/human-review> .
|
|
57
|
+
<https://example.org/city/review/r3> <https://example.org/vocab/reviewer> <https://example.org/city/actor/operations-officer> <https://example.org/graph/human-review> .
|
|
58
|
+
<https://example.org/city/review/r3> <https://example.org/vocab/decision> <https://example.org/city/decision/reject> <https://example.org/graph/human-review> .
|
|
59
|
+
<https://example.org/city/review/r3> <https://example.org/vocab/note> "official operations desk confirms Central Hall is open"^^<http://www.w3.org/2001/XMLSchema#string> <https://example.org/graph/human-review> .
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
VERSION "1.2"
|
|
2
|
+
|
|
3
|
+
<https://example.org/city/facility/riverside-school> <https://example.org/vocab/emergencyDesignation> <https://example.org/city/class/cooling-center> <https://example.org/graph/accepted-knowledge> .
|
|
4
|
+
<https://example.org/city/proposal/p2> <https://example.org/vocab/reviewOutcome> <https://example.org/city/decision/accept> <https://example.org/graph/human-review> .
|
|
5
|
+
<https://example.org/city/proposal/p3> <https://example.org/vocab/reviewOutcome> <https://example.org/city/decision/reject> <https://example.org/graph/human-review> .
|
|
6
|
+
<https://example.org/city/decision/before-review> <https://example.org/vocab/recommendedAction> <https://example.org/city/action/deploy-mobile-unit> <https://example.org/graph/derived-decisions> .
|
|
7
|
+
<https://example.org/city/decision/after-review> <https://example.org/vocab/recommendedAction> <https://example.org/city/action/open-local-center> <https://example.org/graph/derived-decisions> .
|
|
8
|
+
<https://example.org/city/decision/after-review> <https://example.org/vocab/selectedFacility> <https://example.org/city/facility/riverside-school> <https://example.org/graph/derived-decisions> .
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
rdf(iri('https://example.org/city/facility/riverside-school'),iri('https://example.org/vocab/emergencyDesignation'),iri('https://example.org/city/class/cooling-center'),iri('https://example.org/graph/accepted-knowledge')).
|
|
2
|
+
rdf(iri('https://example.org/city/proposal/p2'),iri('https://example.org/vocab/reviewOutcome'),iri('https://example.org/city/decision/accept'),iri('https://example.org/graph/human-review')).
|
|
3
|
+
rdf(iri('https://example.org/city/proposal/p3'),iri('https://example.org/vocab/reviewOutcome'),iri('https://example.org/city/decision/reject'),iri('https://example.org/graph/human-review')).
|
|
4
|
+
rdf(iri('https://example.org/city/decision/before-review'),iri('https://example.org/vocab/recommendedAction'),iri('https://example.org/city/action/deploy-mobile-unit'),iri('https://example.org/graph/derived-decisions')).
|
|
5
|
+
rdf(iri('https://example.org/city/decision/after-review'),iri('https://example.org/vocab/recommendedAction'),iri('https://example.org/city/action/open-local-center'),iri('https://example.org/graph/derived-decisions')).
|
|
6
|
+
rdf(iri('https://example.org/city/decision/after-review'),iri('https://example.org/vocab/selectedFacility'),iri('https://example.org/city/facility/riverside-school'),iri('https://example.org/graph/derived-decisions')).
|
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
% Symbiotic knowledge graph rules for EyeProlog.
|
|
2
|
+
%
|
|
3
|
+
% The source rdf/4 facts above are generated by rdf-prolog-roundtrip from
|
|
4
|
+
% symbiotic-knowledge-graph-input.nq. RDF stays the interchange and storage
|
|
5
|
+
% model; these rules provide the explicit reasoning and governance layer.
|
|
6
|
+
|
|
7
|
+
%% goal: proposal_state(X0, X1)
|
|
8
|
+
%% goal: conflict(X0, X1, X2, X3)
|
|
9
|
+
%% goal: knowledge_gain(X0, X1, X2)
|
|
10
|
+
%% goal: recommended_action(X0, X1, X2)
|
|
11
|
+
%% goal: decision_reason(X0, X1, X2)
|
|
12
|
+
%% goal: audit(X0, X1, X2, X3, X4)
|
|
13
|
+
%% goal: feedback_signal(X0, X1, X2)
|
|
14
|
+
%% goal: symbiosis_gain(X0, X1)
|
|
15
|
+
%% goal: knowledge_exchange(X0, X1)
|
|
16
|
+
%% goal: pipeline_step(X0, X1)
|
|
17
|
+
%% goal: cognitive_parallel(X0, X1)
|
|
18
|
+
|
|
19
|
+
% --- RDF vocabulary ----------------------------------------------------------
|
|
20
|
+
|
|
21
|
+
v(statement, iri('https://example.org/vocab/statement')).
|
|
22
|
+
v(agent, iri('https://example.org/vocab/agent')).
|
|
23
|
+
v(evidence, iri('https://example.org/vocab/evidence')).
|
|
24
|
+
v(confidence_percent, iri('https://example.org/vocab/confidencePercent')).
|
|
25
|
+
v(evidence_kind, iri('https://example.org/vocab/evidenceKind')).
|
|
26
|
+
v(about_proposal, iri('https://example.org/vocab/aboutProposal')).
|
|
27
|
+
v(reviewer, iri('https://example.org/vocab/reviewer')).
|
|
28
|
+
v(decision, iri('https://example.org/vocab/decision')).
|
|
29
|
+
v(note, iri('https://example.org/vocab/note')).
|
|
30
|
+
v(kind, iri('https://example.org/vocab/kind')).
|
|
31
|
+
v(neighbourhood, iri('https://example.org/vocab/neighbourhood')).
|
|
32
|
+
v(status, iri('https://example.org/vocab/status')).
|
|
33
|
+
v(cooling, iri('https://example.org/vocab/cooling')).
|
|
34
|
+
v(capacity, iri('https://example.org/vocab/capacity')).
|
|
35
|
+
v(wheelchair_access, iri('https://example.org/vocab/wheelchairAccess')).
|
|
36
|
+
v(expected_demand, iri('https://example.org/vocab/expectedDemand')).
|
|
37
|
+
v(mobile_unit_available, iri('https://example.org/vocab/mobileUnitAvailable')).
|
|
38
|
+
v(connects, iri('https://example.org/vocab/connects')).
|
|
39
|
+
v(power, iri('https://example.org/vocab/power')).
|
|
40
|
+
v(emergency_designation, iri('https://example.org/vocab/emergencyDesignation')).
|
|
41
|
+
|
|
42
|
+
graph(ai_proposals, iri('https://example.org/graph/ai-proposals')).
|
|
43
|
+
graph(human_review, iri('https://example.org/graph/human-review')).
|
|
44
|
+
graph(evidence_registry, iri('https://example.org/graph/evidence-registry')).
|
|
45
|
+
graph(accepted_knowledge, iri('https://example.org/graph/accepted-knowledge')).
|
|
46
|
+
graph(derived_decisions, iri('https://example.org/graph/derived-decisions')).
|
|
47
|
+
|
|
48
|
+
curated_graph(iri('https://example.org/graph/city-facilities')).
|
|
49
|
+
curated_graph(iri('https://example.org/graph/emergency-plan')).
|
|
50
|
+
curated_graph(iri('https://example.org/graph/transit-plan')).
|
|
51
|
+
curated_graph(iri('https://example.org/graph/power-sensors')).
|
|
52
|
+
|
|
53
|
+
curated(S, P, O) :- rdf(S, P, O, G), curated_graph(G).
|
|
54
|
+
|
|
55
|
+
integer_literal(literal(Text, datatype('http://www.w3.org/2001/XMLSchema#integer')), Number) :-
|
|
56
|
+
atom_chars(Text, Chars),
|
|
57
|
+
number_chars(Number, Chars).
|
|
58
|
+
|
|
59
|
+
% --- Candidate knowledge carried as RDF 1.2 triple terms --------------------
|
|
60
|
+
|
|
61
|
+
proposal(Id, Agent, Evidence, S, P, O, Confidence) :-
|
|
62
|
+
graph(ai_proposals, G),
|
|
63
|
+
v(statement, StatementP),
|
|
64
|
+
v(agent, AgentP),
|
|
65
|
+
v(evidence, EvidenceP),
|
|
66
|
+
v(confidence_percent, ConfidenceP),
|
|
67
|
+
rdf(Id, StatementP, triple(S, P, O), G),
|
|
68
|
+
rdf(Id, AgentP, Agent, G),
|
|
69
|
+
rdf(Id, EvidenceP, Evidence, G),
|
|
70
|
+
rdf(Id, ConfidenceP, ConfidenceLiteral, G),
|
|
71
|
+
integer_literal(ConfidenceLiteral, Confidence).
|
|
72
|
+
|
|
73
|
+
evidence_kind(Evidence, Kind) :-
|
|
74
|
+
graph(evidence_registry, G),
|
|
75
|
+
v(evidence_kind, Predicate),
|
|
76
|
+
rdf(Evidence, Predicate, Kind, G).
|
|
77
|
+
|
|
78
|
+
human_review(Id, Reviewer, Decision, Note) :-
|
|
79
|
+
graph(human_review, G),
|
|
80
|
+
v(about_proposal, AboutP),
|
|
81
|
+
v(reviewer, ReviewerP),
|
|
82
|
+
v(decision, DecisionP),
|
|
83
|
+
v(note, NoteP),
|
|
84
|
+
rdf(Review, AboutP, Id, G),
|
|
85
|
+
rdf(Review, ReviewerP, Reviewer, G),
|
|
86
|
+
rdf(Review, DecisionP, DecisionIri, G),
|
|
87
|
+
rdf(Review, NoteP, literal(Note, datatype('http://www.w3.org/2001/XMLSchema#string')), G),
|
|
88
|
+
decision_atom(DecisionIri, Decision).
|
|
89
|
+
|
|
90
|
+
decision_atom(iri('https://example.org/city/decision/accept'), accept).
|
|
91
|
+
decision_atom(iri('https://example.org/city/decision/reject'), reject).
|
|
92
|
+
|
|
93
|
+
% --- Trust, conflict, and review policy --------------------------------------
|
|
94
|
+
|
|
95
|
+
auto_eligible(iri('https://example.org/city/evidence-kind/official-feed')).
|
|
96
|
+
replaceable(P) :- v(status, P).
|
|
97
|
+
|
|
98
|
+
authoritative_override(Evidence, Predicate) :-
|
|
99
|
+
evidence_kind(Evidence, Kind),
|
|
100
|
+
auto_eligible(Kind),
|
|
101
|
+
replaceable(Predicate).
|
|
102
|
+
|
|
103
|
+
opposite(iri('https://example.org/city/state/open'), iri('https://example.org/city/state/closed')).
|
|
104
|
+
opposite(iri('https://example.org/city/state/closed'), iri('https://example.org/city/state/open')).
|
|
105
|
+
opposite(iri('https://example.org/city/state/running'), iri('https://example.org/city/state/suspended')).
|
|
106
|
+
opposite(iri('https://example.org/city/state/suspended'), iri('https://example.org/city/state/running')).
|
|
107
|
+
|
|
108
|
+
conflict_iri(Id, Subject, Predicate, Existing) :-
|
|
109
|
+
proposal(Id, _Agent, _Evidence, Subject, Predicate, Proposed, _Confidence),
|
|
110
|
+
curated(Subject, Predicate, Existing),
|
|
111
|
+
opposite(Proposed, Existing).
|
|
112
|
+
|
|
113
|
+
proposal_state_iri(Id, auto_accepted) :-
|
|
114
|
+
proposal(Id, _Agent, Evidence, Subject, Predicate, _Object, Confidence),
|
|
115
|
+
evidence_kind(Evidence, Kind),
|
|
116
|
+
auto_eligible(Kind),
|
|
117
|
+
Confidence >= 95,
|
|
118
|
+
( \+ conflict_iri(Id, Subject, Predicate, _Existing)
|
|
119
|
+
; authoritative_override(Evidence, Predicate)
|
|
120
|
+
).
|
|
121
|
+
|
|
122
|
+
proposal_state_iri(Id, human_accepted) :-
|
|
123
|
+
proposal(Id, _Agent, _Evidence, _S, _P, _O, _Confidence),
|
|
124
|
+
human_review(Id, _Reviewer, accept, _Note).
|
|
125
|
+
|
|
126
|
+
proposal_state_iri(Id, human_rejected) :-
|
|
127
|
+
proposal(Id, _Agent, _Evidence, _S, _P, _O, _Confidence),
|
|
128
|
+
human_review(Id, _Reviewer, reject, _Note).
|
|
129
|
+
|
|
130
|
+
proposal_state_iri(Id, needs_review) :-
|
|
131
|
+
proposal(Id, _Agent, _Evidence, _S, _P, _O, _Confidence),
|
|
132
|
+
\+ proposal_state_iri(Id, auto_accepted),
|
|
133
|
+
\+ human_review(Id, _Reviewer, _Decision, _Note).
|
|
134
|
+
|
|
135
|
+
% --- Stage-aware operational graph ------------------------------------------
|
|
136
|
+
|
|
137
|
+
stage(before_review).
|
|
138
|
+
stage(after_review).
|
|
139
|
+
|
|
140
|
+
accepted(before_review, Id) :- proposal_state_iri(Id, auto_accepted).
|
|
141
|
+
accepted(after_review, Id) :- proposal_state_iri(Id, auto_accepted).
|
|
142
|
+
accepted(after_review, Id) :- proposal_state_iri(Id, human_accepted).
|
|
143
|
+
|
|
144
|
+
has_accepted_override(Stage, S, P) :-
|
|
145
|
+
replaceable(P),
|
|
146
|
+
proposal(Id, _Agent, _Evidence, S, P, _O, _Confidence),
|
|
147
|
+
accepted(Stage, Id).
|
|
148
|
+
|
|
149
|
+
known(Stage, S, P, O) :-
|
|
150
|
+
curated(S, P, O),
|
|
151
|
+
\+ has_accepted_override(Stage, S, P).
|
|
152
|
+
|
|
153
|
+
known(Stage, S, P, O) :-
|
|
154
|
+
proposal(Id, _Agent, _Evidence, S, P, O, _Confidence),
|
|
155
|
+
accepted(Stage, Id).
|
|
156
|
+
|
|
157
|
+
knowledge_gain_iri(S, P, O) :-
|
|
158
|
+
known(after_review, S, P, O),
|
|
159
|
+
\+ known(before_review, S, P, O).
|
|
160
|
+
|
|
161
|
+
% --- Operational reasoning ---------------------------------------------------
|
|
162
|
+
|
|
163
|
+
cooling_center(Stage, Center) :-
|
|
164
|
+
v(kind, P),
|
|
165
|
+
known(Stage, Center, P, iri('https://example.org/city/class/cooling-center')).
|
|
166
|
+
cooling_center(Stage, Center) :-
|
|
167
|
+
v(emergency_designation, P),
|
|
168
|
+
known(Stage, Center, P, iri('https://example.org/city/class/cooling-center')).
|
|
169
|
+
|
|
170
|
+
numeric_value(Stage, S, Predicate, Number) :-
|
|
171
|
+
known(Stage, S, Predicate, Literal),
|
|
172
|
+
integer_literal(Literal, Number).
|
|
173
|
+
|
|
174
|
+
sufficient_capacity(Stage, Center, Neighbourhood) :-
|
|
175
|
+
v(capacity, CapacityP),
|
|
176
|
+
v(expected_demand, DemandP),
|
|
177
|
+
numeric_value(Stage, Center, CapacityP, Capacity),
|
|
178
|
+
numeric_value(Stage, Neighbourhood, DemandP, Demand),
|
|
179
|
+
Capacity >= Demand.
|
|
180
|
+
|
|
181
|
+
operational_center(Stage, Center, Neighbourhood) :-
|
|
182
|
+
cooling_center(Stage, Center),
|
|
183
|
+
v(status, StatusP),
|
|
184
|
+
v(cooling, CoolingP),
|
|
185
|
+
v(wheelchair_access, AccessP),
|
|
186
|
+
v(power, PowerP),
|
|
187
|
+
known(Stage, Center, StatusP, iri('https://example.org/city/state/open')),
|
|
188
|
+
known(Stage, Center, CoolingP, iri('https://example.org/city/state/available')),
|
|
189
|
+
known(Stage, Center, AccessP, iri('https://example.org/city/value/yes')),
|
|
190
|
+
sufficient_capacity(Stage, Center, Neighbourhood),
|
|
191
|
+
\+ known(Stage, Center, PowerP, iri('https://example.org/city/state/unstable')).
|
|
192
|
+
|
|
193
|
+
local_center(Stage, Neighbourhood, Center) :-
|
|
194
|
+
operational_center(Stage, Center, Neighbourhood),
|
|
195
|
+
v(neighbourhood, NeighbourhoodP),
|
|
196
|
+
known(Stage, Center, NeighbourhoodP, Neighbourhood).
|
|
197
|
+
|
|
198
|
+
reachable_center(Stage, Neighbourhood, Center) :-
|
|
199
|
+
operational_center(Stage, Center, Neighbourhood),
|
|
200
|
+
v(connects, ConnectsP),
|
|
201
|
+
v(status, StatusP),
|
|
202
|
+
known(Stage, Route, ConnectsP, Center),
|
|
203
|
+
known(Stage, Route, StatusP, iri('https://example.org/city/state/running')).
|
|
204
|
+
|
|
205
|
+
recommended_action_iri(Stage, Neighbourhood, open_local_center(Center)) :-
|
|
206
|
+
stage(Stage),
|
|
207
|
+
local_center(Stage, Neighbourhood, Center).
|
|
208
|
+
|
|
209
|
+
recommended_action_iri(Stage, Neighbourhood, use_transit_to(Center)) :-
|
|
210
|
+
stage(Stage),
|
|
211
|
+
\+ local_center(Stage, Neighbourhood, _Local),
|
|
212
|
+
reachable_center(Stage, Neighbourhood, Center).
|
|
213
|
+
|
|
214
|
+
recommended_action_iri(Stage, Neighbourhood, deploy_mobile_unit) :-
|
|
215
|
+
stage(Stage),
|
|
216
|
+
\+ local_center(Stage, Neighbourhood, _Local),
|
|
217
|
+
\+ reachable_center(Stage, Neighbourhood, _Remote),
|
|
218
|
+
v(mobile_unit_available, MobileP),
|
|
219
|
+
known(Stage, Neighbourhood, MobileP, iri('https://example.org/city/value/yes')).
|
|
220
|
+
|
|
221
|
+
% --- Friendly checked output -------------------------------------------------
|
|
222
|
+
|
|
223
|
+
short(iri('https://example.org/city/proposal/p1'), p1).
|
|
224
|
+
short(iri('https://example.org/city/proposal/p2'), p2).
|
|
225
|
+
short(iri('https://example.org/city/proposal/p3'), p3).
|
|
226
|
+
short(iri('https://example.org/city/proposal/p4'), p4).
|
|
227
|
+
short(iri('https://example.org/city/agent/language-agent'), language_agent).
|
|
228
|
+
short(iri('https://example.org/city/evidence/transit-api-20260827'), transit_api_20260827).
|
|
229
|
+
short(iri('https://example.org/city/evidence/facilities-bulletin-20260827'), facilities_bulletin_20260827).
|
|
230
|
+
short(iri('https://example.org/city/evidence/community-post-4812'), community_post_4812).
|
|
231
|
+
short(iri('https://example.org/city/evidence/volunteer-message-112'), volunteer_message_112).
|
|
232
|
+
short(iri('https://example.org/city/actor/emergency-coordinator'), emergency_coordinator).
|
|
233
|
+
short(iri('https://example.org/city/actor/operations-officer'), operations_officer).
|
|
234
|
+
short(iri('https://example.org/city/facility/central-hall'), central_hall).
|
|
235
|
+
short(iri('https://example.org/city/facility/north-library'), north_library).
|
|
236
|
+
short(iri('https://example.org/city/facility/riverside-school'), riverside_school).
|
|
237
|
+
short(iri('https://example.org/city/neighbourhood/riverside'), riverside).
|
|
238
|
+
short(iri('https://example.org/city/route/7'), route_7).
|
|
239
|
+
short(iri('https://example.org/vocab/status'), status).
|
|
240
|
+
short(iri('https://example.org/vocab/emergencyDesignation'), emergency_designation).
|
|
241
|
+
short(iri('https://example.org/city/state/running'), running).
|
|
242
|
+
short(iri('https://example.org/city/state/open'), open).
|
|
243
|
+
short(iri('https://example.org/city/class/cooling-center'), cooling_center).
|
|
244
|
+
|
|
245
|
+
proposal_state(Id, State) :-
|
|
246
|
+
proposal_state_iri(IdIri, State),
|
|
247
|
+
short(IdIri, Id).
|
|
248
|
+
|
|
249
|
+
conflict(Id, Subject, Predicate, Existing) :-
|
|
250
|
+
conflict_iri(IdIri, SubjectIri, PredicateIri, ExistingIri),
|
|
251
|
+
short(IdIri, Id),
|
|
252
|
+
short(SubjectIri, Subject),
|
|
253
|
+
short(PredicateIri, Predicate),
|
|
254
|
+
short(ExistingIri, Existing).
|
|
255
|
+
|
|
256
|
+
knowledge_gain(Subject, Predicate, Object) :-
|
|
257
|
+
knowledge_gain_iri(SubjectIri, PredicateIri, ObjectIri),
|
|
258
|
+
short(SubjectIri, Subject),
|
|
259
|
+
short(PredicateIri, Predicate),
|
|
260
|
+
short(ObjectIri, Object).
|
|
261
|
+
|
|
262
|
+
friendly_action(deploy_mobile_unit, deploy_mobile_unit).
|
|
263
|
+
friendly_action(open_local_center(CenterIri), open_local_center(Center)) :- short(CenterIri, Center).
|
|
264
|
+
friendly_action(use_transit_to(CenterIri), use_transit_to(Center)) :- short(CenterIri, Center).
|
|
265
|
+
|
|
266
|
+
recommended_action(Stage, Neighbourhood, Action) :-
|
|
267
|
+
recommended_action_iri(Stage, NeighbourhoodIri, ActionIri),
|
|
268
|
+
short(NeighbourhoodIri, Neighbourhood),
|
|
269
|
+
friendly_action(ActionIri, Action).
|
|
270
|
+
|
|
271
|
+
decision_reason(before_review, riverside,
|
|
272
|
+
"Route 7 is suspended, Central Hall has unstable power, and Riverside School is not yet an approved cooling centre; deploy the mobile unit.") :-
|
|
273
|
+
recommended_action(before_review, riverside, deploy_mobile_unit).
|
|
274
|
+
|
|
275
|
+
decision_reason(after_review, riverside,
|
|
276
|
+
"Human review confirms Riverside School as an emergency cooling centre; its verified capacity and accessibility satisfy Riverside demand locally.") :-
|
|
277
|
+
recommended_action(after_review, riverside, open_local_center(riverside_school)).
|
|
278
|
+
|
|
279
|
+
review_summary(Id, human(Reviewer, Decision)) :-
|
|
280
|
+
human_review(Id, ReviewerIri, Decision, _Note),
|
|
281
|
+
short(ReviewerIri, Reviewer).
|
|
282
|
+
review_summary(Id, automatic) :- proposal_state_iri(Id, auto_accepted).
|
|
283
|
+
review_summary(Id, pending) :- proposal_state_iri(Id, needs_review).
|
|
284
|
+
|
|
285
|
+
audit(Id, Agent, Evidence, State, Review) :-
|
|
286
|
+
proposal(IdIri, AgentIri, EvidenceIri, _S, _P, _O, _Confidence),
|
|
287
|
+
proposal_state_iri(IdIri, State),
|
|
288
|
+
review_summary(IdIri, Review),
|
|
289
|
+
short(IdIri, Id),
|
|
290
|
+
short(AgentIri, Agent),
|
|
291
|
+
short(EvidenceIri, Evidence).
|
|
292
|
+
|
|
293
|
+
feedback_signal(language_agent, Id, accepted_by_human) :-
|
|
294
|
+
proposal_state_iri(IdIri, human_accepted), short(IdIri, Id).
|
|
295
|
+
feedback_signal(language_agent, Id, rejected_by_human) :-
|
|
296
|
+
proposal_state_iri(IdIri, human_rejected), short(IdIri, Id).
|
|
297
|
+
feedback_signal(language_agent, Id, unresolved) :-
|
|
298
|
+
proposal_state_iri(IdIri, needs_review), short(IdIri, Id).
|
|
299
|
+
|
|
300
|
+
symbiosis_gain(graph, accepted_machine_knowledge) :- proposal_state(p2, human_accepted).
|
|
301
|
+
symbiosis_gain(agent, better_operational_answer) :-
|
|
302
|
+
recommended_action(after_review, riverside, open_local_center(riverside_school)).
|
|
303
|
+
symbiosis_gain(human, inspectable_reason) :- decision_reason(after_review, riverside, _Reason).
|
|
304
|
+
symbiosis_gain(governance, rejected_claim_remains_outside_operational_graph) :-
|
|
305
|
+
proposal_state(p3, human_rejected).
|
|
306
|
+
symbiosis_gain(rdf, accepted_and_derived_knowledge_can_be_published_back) :-
|
|
307
|
+
result_rdf(_, _, _, _).
|
|
308
|
+
|
|
309
|
+
knowledge_exchange(X, Y) :- knowledge_exchange_fact(X, Y).
|
|
310
|
+
knowledge_exchange_fact(machine_to_graph, candidate(p2, riverside_school, emergency_designation, cooling_center)).
|
|
311
|
+
knowledge_exchange_fact(graph_to_machine, constraint(central_hall, power, unstable)).
|
|
312
|
+
knowledge_exchange_fact(human_to_machine, review(p2, accept)).
|
|
313
|
+
knowledge_exchange_fact(human_to_machine, review(p3, reject)).
|
|
314
|
+
knowledge_exchange_fact(machine_to_human, recommendation(after_review, riverside, open_local_center(riverside_school))).
|
|
315
|
+
knowledge_exchange_fact(rdf_to_prolog, ordinary_rdf4_facts).
|
|
316
|
+
knowledge_exchange_fact(prolog_to_rdf, materialized_ground_rdf4).
|
|
317
|
+
|
|
318
|
+
pipeline_step(N, Description) :- pipeline_step_fact(N, Description).
|
|
319
|
+
pipeline_step_fact(1, 'RDF 1.2 N-Quads: named graphs keep source and governance boundaries explicit').
|
|
320
|
+
pipeline_step_fact(2, 'rdf-prolog-roundtrip: RDF becomes ordinary rdf/4 Prolog facts without a solver').
|
|
321
|
+
pipeline_step_fact(3, 'EyeProlog: ISO Prolog rules validate candidates, apply review policy, and derive actions').
|
|
322
|
+
pipeline_step_fact(4, 'EyeProlog: result_rdf/4 materializes accepted knowledge and decisions as ground RDF-shaped facts').
|
|
323
|
+
pipeline_step_fact(5, 'rdf-prolog-roundtrip: ground rdf/4 facts become RDF again for publication or federation').
|
|
324
|
+
|
|
325
|
+
cognitive_parallel(Prolog, Human) :- cognitive_parallel_fact(Prolog, Human).
|
|
326
|
+
cognitive_parallel_fact(fact, remembered_assertion).
|
|
327
|
+
cognitive_parallel_fact(rule, reusable_generalization).
|
|
328
|
+
cognitive_parallel_fact(query, explicit_question).
|
|
329
|
+
cognitive_parallel_fact(variable_binding, filling_in_an_answer).
|
|
330
|
+
cognitive_parallel_fact(backtracking, considering_alternatives).
|
|
331
|
+
cognitive_parallel_fact(proof, giving_reasons).
|
|
332
|
+
cognitive_parallel_fact(review, correcting_shared_knowledge).
|
|
333
|
+
|
|
334
|
+
% --- Materialization boundary back to RDF -----------------------------------
|
|
335
|
+
|
|
336
|
+
result_rdf(
|
|
337
|
+
iri('https://example.org/city/facility/riverside-school'),
|
|
338
|
+
iri('https://example.org/vocab/emergencyDesignation'),
|
|
339
|
+
iri('https://example.org/city/class/cooling-center'),
|
|
340
|
+
iri('https://example.org/graph/accepted-knowledge')) :-
|
|
341
|
+
proposal_state(p2, human_accepted).
|
|
342
|
+
|
|
343
|
+
result_rdf(
|
|
344
|
+
iri('https://example.org/city/proposal/p2'),
|
|
345
|
+
iri('https://example.org/vocab/reviewOutcome'),
|
|
346
|
+
iri('https://example.org/city/decision/accept'),
|
|
347
|
+
iri('https://example.org/graph/human-review')) :-
|
|
348
|
+
proposal_state(p2, human_accepted).
|
|
349
|
+
|
|
350
|
+
result_rdf(
|
|
351
|
+
iri('https://example.org/city/proposal/p3'),
|
|
352
|
+
iri('https://example.org/vocab/reviewOutcome'),
|
|
353
|
+
iri('https://example.org/city/decision/reject'),
|
|
354
|
+
iri('https://example.org/graph/human-review')) :-
|
|
355
|
+
proposal_state(p3, human_rejected).
|
|
356
|
+
|
|
357
|
+
result_rdf(
|
|
358
|
+
iri('https://example.org/city/decision/before-review'),
|
|
359
|
+
iri('https://example.org/vocab/recommendedAction'),
|
|
360
|
+
iri('https://example.org/city/action/deploy-mobile-unit'),
|
|
361
|
+
iri('https://example.org/graph/derived-decisions')) :-
|
|
362
|
+
recommended_action(before_review, riverside, deploy_mobile_unit).
|
|
363
|
+
|
|
364
|
+
result_rdf(
|
|
365
|
+
iri('https://example.org/city/decision/after-review'),
|
|
366
|
+
iri('https://example.org/vocab/recommendedAction'),
|
|
367
|
+
iri('https://example.org/city/action/open-local-center'),
|
|
368
|
+
iri('https://example.org/graph/derived-decisions')) :-
|
|
369
|
+
recommended_action(after_review, riverside, open_local_center(riverside_school)).
|
|
370
|
+
|
|
371
|
+
result_rdf(
|
|
372
|
+
iri('https://example.org/city/decision/after-review'),
|
|
373
|
+
iri('https://example.org/vocab/selectedFacility'),
|
|
374
|
+
iri('https://example.org/city/facility/riverside-school'),
|
|
375
|
+
iri('https://example.org/graph/derived-decisions')) :-
|
|
376
|
+
recommended_action(after_review, riverside, open_local_center(riverside_school)).
|
|
377
|
+
|
|
378
|
+
write_results :-
|
|
379
|
+
result_rdf(S, P, O, G),
|
|
380
|
+
write_term(rdf(S, P, O, G), [quoted(true)]),
|
|
381
|
+
write('.'),
|
|
382
|
+
nl,
|
|
383
|
+
fail.
|
|
384
|
+
write_results.
|
|
385
|
+
|
|
386
|
+
:- set_prolog_flag(unknown, fail).
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Example decks
|
|
2
|
+
|
|
3
|
+
Wide-audience companion explanations for selected runnable examples.
|
|
4
|
+
|
|
5
|
+
- [ODRL policy reasoning](odrl-policy-reasoning.md) — permissions, prohibitions, duties, conflicts, and defaults.
|
|
6
|
+
- [Symbiotic Knowledge Graphs](symbiotic-knowledge-graphs.md) — a real-world RDF → Prolog → RDF heatwave-response loop in which AI proposes, explicit rules govern, people review, and accepted knowledge improves later decisions.
|