MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / declared_closure

Function declared_closure

atomic-core/tests/kg_view_ancestry.rs:27–46  ·  view source on GitHub ↗

Test-only application of subproperty and transitivity rules. Production KG queries do not run an OWL reasoner; keep that boundary explicit below.

(mut facts: BTreeSet<Fact>)

Source from the content-addressed store, hash-verified

25// Test-only application of subproperty and transitivity rules. Production KG
26// queries do not run an OWL reasoner; keep that boundary explicit below.
27fn declared_closure(mut facts: BTreeSet<Fact>) -> BTreeSet<Fact> {
28 loop {
29 let previous = facts.clone();
30 for &(subject, predicate, object) in &previous {
31 if let Some(parent) = predicate.super_predicate() {
32 facts.insert((subject, parent, object));
33 }
34 if predicate.is_transitive() {
35 for &(next_subject, next_predicate, next_object) in &previous {
36 if object == next_subject && predicate == next_predicate {
37 facts.insert((subject, predicate, next_object));
38 }
39 }
40 }
41 }
42 if facts == previous {
43 return facts;
44 }
45 }
46}
47
48#[test]
49fn turtle_and_registry_link_child_to_ancestor_not_the_reverse() {

Calls 3

is_transitiveMethod · 0.80
cloneMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected