1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
//! Schema.org vocabulary lookup -- generated at compile time from the official definitions.
//!
//! This module provides zero-cost lookup functions for Schema.org types, properties,
//! and enumeration members. All data is compiled into static match statements by
//! `build.rs`, meaning **zero heap allocation and zero runtime parsing**.
//!
//! # Architecture
//!
//! ```text
//! schemaorg-all-https.jsonld -> build.rs -> generated.rs (in $OUT_DIR)
//! |
//! lookup_type("Product")
//! lookup_property("price")
//! lookup_enum_member("InStock")
//! ```
//!
//! # Examples
//!
//! ```no_run
//! # #[cfg(feature = "validation")]
//! # {
//! use schemaorg_rs::vocabulary;
//!
//! // Type lookup
//! let product = vocabulary::lookup_type("Product").unwrap();
//! assert!(product.has_property("name"));
//!
//! // Property lookup
//! let price = vocabulary::lookup_property("price").unwrap();
//! assert!(price.expected_types.contains(&"Number"));
//!
//! // Schema version
//! let version = vocabulary::schema_version();
//! println!("Using Schema.org v{version}");
//! # }
//! ```
pub use ;
pub use ;
/// Returns a list of all known Schema.org type names.
///
/// Useful for "did you mean?" suggestions and autocomplete.
/// Returns a list of all known Schema.org property names.
///
/// Useful for "did you mean?" suggestions and autocomplete.
/// Checks if `child_type` is a subtype of `ancestor_type` by walking
/// the Schema.org type hierarchy via BFS.
///
/// Uses `&str` references from the static vocabulary data to avoid
/// heap allocations during the traversal.
///
/// # Examples
///
/// ```no_run
/// # #[cfg(feature = "validation")]
/// # {
/// use schemaorg_rs::vocabulary;
///
/// assert!(vocabulary::is_subtype("NewsArticle", "Article"));
/// assert!(vocabulary::is_subtype("Product", "Thing"));
/// assert!(!vocabulary::is_subtype("Product", "Person"));
/// # }
/// ```