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

Function undefined_terms

atomic-canonical/src/context.rs:45–53  ·  view source on GitHub ↗

The keys in `value` that the context must define: bare terms only — JSON-LD keywords (`@id`, `@type`, …) need no term, and CURIEs (`prov:Activity`) resolve through their namespace prefix.

(value: &Value)

Source from the content-addressed store, hash-verified

43/// JSON-LD keywords (`@id`, `@type`, …) need no term, and CURIEs (`prov:Activity`)
44/// resolve through their namespace prefix.
45pub fn undefined_terms(value: &Value) -> BTreeSet<String> {
46 let defined = defined_terms();
47 let mut keys = BTreeSet::new();
48 collect_keys(value, &mut keys);
49 keys.into_iter()
50 .filter(|k| !k.starts_with('@') && !k.contains(':'))
51 .filter(|k| !defined.contains(k))
52 .collect()
53}
54
55#[cfg(test)]
56mod tests {

Calls 5

defined_termsFunction · 0.85
collect_keysFunction · 0.85
collectMethod · 0.45
into_iterMethod · 0.45
containsMethod · 0.45