Skip to main content

vibe/metamodel/
fields.rs

1//! Field / property descriptors for the Vibe metamodel.
2
3use super::namespace::term;
4
5#[derive(Debug, Clone, Copy, PartialEq, Eq)]
6pub struct FieldDescriptor {
7    pub local_name: &'static str,
8    pub rdfs_property_local: &'static str,
9    pub domain_class: &'static str,
10    pub range_hint: &'static str,
11}
12
13pub const FIELD_DESCRIPTORS: &[FieldDescriptor] = &[
14    FieldDescriptor {
15        local_name: "languageVersion",
16        rdfs_property_local: "languageVersion",
17        domain_class: "Program",
18        range_hint: "xsd:string",
19    },
20    FieldDescriptor {
21        local_name: "nodeKind",
22        rdfs_property_local: "nodeKind",
23        domain_class: "AstNode",
24        range_hint: "xsd:string",
25    },
26    FieldDescriptor {
27        local_name: "contains",
28        rdfs_property_local: "contains",
29        domain_class: "Program",
30        range_hint: "AstNode",
31    },
32    FieldDescriptor {
33        local_name: "declares",
34        rdfs_property_local: "declares",
35        domain_class: "Module",
36        range_hint: "Declaration",
37    },
38    FieldDescriptor {
39        local_name: "hasExpression",
40        rdfs_property_local: "hasExpression",
41        domain_class: "Statement",
42        range_hint: "Expression",
43    },
44    FieldDescriptor {
45        local_name: "hasStatement",
46        rdfs_property_local: "hasStatement",
47        domain_class: "Block",
48        range_hint: "Statement",
49    },
50    FieldDescriptor {
51        local_name: "hasType",
52        rdfs_property_local: "hasType",
53        domain_class: "Declaration",
54        range_hint: "Type",
55    },
56    FieldDescriptor {
57        local_name: "hasEffect",
58        rdfs_property_local: "hasEffect",
59        domain_class: "FunctionDeclaration",
60        range_hint: "EffectClass",
61    },
62    FieldDescriptor {
63        local_name: "requiresCapability",
64        rdfs_property_local: "requiresCapability",
65        domain_class: "Program",
66        range_hint: "Capability",
67    },
68    FieldDescriptor {
69        local_name: "invokeId",
70        rdfs_property_local: "invokeId",
71        domain_class: "Capability",
72        range_hint: "InvokeId",
73    },
74    FieldDescriptor {
75        local_name: "hasArgument",
76        rdfs_property_local: "hasArgument",
77        domain_class: "CapabilityArgument",
78        range_hint: "xsd:string",
79    },
80    FieldDescriptor {
81        local_name: "hasBudget",
82        rdfs_property_local: "hasBudget",
83        domain_class: "FunctionDeclaration",
84        range_hint: "Budget",
85    },
86    FieldDescriptor {
87        local_name: "sourceStart",
88        rdfs_property_local: "sourceStart",
89        domain_class: "SourceSpan",
90        range_hint: "xsd:integer",
91    },
92    FieldDescriptor {
93        local_name: "sourceEnd",
94        rdfs_property_local: "sourceEnd",
95        domain_class: "SourceSpan",
96        range_hint: "xsd:integer",
97    },
98    FieldDescriptor {
99        local_name: "diagnosticCode",
100        rdfs_property_local: "diagnosticCode",
101        domain_class: "Diagnostic",
102        range_hint: "xsd:string",
103    },
104];
105
106/// Property IRI.
107pub fn property_iri(f: &FieldDescriptor) -> String {
108    term(f.rdfs_property_local)
109}