code wiki / (root) / nx_ontology.nx

nx_ontology.nx

buildroot/runtime/nx_ontology.nx

7662 B239 linesdepth 4pulls 5 transitivereach 3 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_ontology.nx -- substrate-native ontology over RDF-style triples. Per user directive 2026-05-14: "ontology needs to be recognized as a part of what we are doing as we build this math layer" (Wikipedia: Ontology (information science)). Reads nxc2/specs/nx_ontology.txt (TSV: subject, predicate, object, optional notes) and exposes count + lookup queries. Predicates are free-form strings; consumers compare directly. Composes with patent_check, provenance, emit_journal: substrate now has a typed knowledge graph linking algorithm -> category -> source -> license -> patent_status. genealogy_id: substrate_ontology_2026_05_14 lineage_id: substrate_self_description

dependencies 4 imports · 3 importers

nx_syscalls.nx nx_runtime.nx nx_tier.nx nx_str.nx nx_ontology.nx nx_ontology_test.nx nx_self_audit.nx nx_sovereign_qed_audit.nx

imports: nx_syscalls.nxnx_runtime.nxnx_tier.nxnx_str.nx

imported by: nx_ontology_test.nxnx_self_audit.nxnx_sovereign_qed_audit.nx

structs

34struct NxOntologyTriple
42struct NxOntology

consts

29const NX_ONT_MAX_TRIPLES: nx_int = 4096
30const NX_ONT_FIELD_CAP: nx_size = 96
40const NX_ONT_TRIPLE_BYTES: nx_size = 24

functions

51func nx_ont_parse_line(buf: *u8, lo: nx_int, hi: nx_int,
called by 1: nx_ontology_load calls 2: sys_mmapnx_str_cpy
150func nx_ontology_load(path: *u8) -> *NxOntology
189func nx_ontology_n_triples(o: *NxOntology) -> nx_int { return o.n }
called by 1: main
192func nx_ontology_count_by_predicate(o: *NxOntology, pred: *u8) -> nx_int
called by 1: main calls 1: nx_str_eq
206func nx_ontology_count_with_po(o: *NxOntology, pred: *u8, obj: *u8) -> nx_int
called by 2: mainmain calls 1: nx_str_eq
221func nx_ontology_has_triple(o: *NxOntology, subj: *u8, pred: *u8, obj: *u8) -> nx_int
called by 2: nx_ontology_in_domainmain calls 1: nx_str_eq
237func nx_ontology_in_domain(o: *NxOntology, subj: *u8, domain: *u8) -> nx_int
called by 1: main calls 1: nx_ontology_has_triple