1use crate::model::annotations::AnnotationBuilder;
6use crate::model::modules::Module;
7use crate::model::HasBody;
8use crate::stdlib::rdfs;
9pub const MODULE_NAME: &str = "rdf";
18pub const MODULE_URL: &str = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
19
20pub const HTML: &str = "HTML";
21pub const JSON: &str = "JSON";
22pub const LANG_STRING: &str = "langString";
23pub const PLAIN_LITERAL: &str = "PlainLiteral";
24pub const XML_LITERAL: &str = "XMLLiteral";
25
26pub const ALT: &str = "Alt";
27pub const BAG: &str = "Bag";
28pub const LIST: &str = "List";
29pub const PROPERTY: &str = "Property";
30pub const SEQ: &str = "Seq";
31pub const STATEMENT: &str = "Statement";
32
33pub const FIRST: &str = "first";
34pub const NIL: &str = "nil";
35pub const OBJECT: &str = "object";
36pub const PREDICATE: &str = "predicate";
37pub const REST: &str = "rest";
38pub const SUBJECT: &str = "subject";
39pub const TYPE: &str = "type";
40pub const VALUE: &str = "value";
41
42pub const COMPOUND: &str = "CompoundLiteral";
43pub const LANGUAGE: &str = "language";
44pub const DIRECTION: &str = "direction";
45
46pub fn module() -> Module {
51 #[allow(non_snake_case)]
52 let MODULE_IRI: url::Url = url::Url::parse(MODULE_URL).unwrap();
53 let mut module = Module::empty(id!(MODULE_NAME)).with_base_uri(MODULE_IRI.clone());
54
55 module
56 .body_mut()
57 .add_to_imports(import!(id!(rdfs::MODULE_NAME)));
58
59 module.body_mut().extend_definitions(vec![
60 rdf!(datatype HTML, MODULE_IRI; rdfs::LITERAL)
62 .with_comment("The datatype of RDF literals storing fragments of HTML content")
63 .with_see_also_str("http://www.w3.org/TR/rdf11-concepts/#section-html")
64 .into(),
65 rdf!(datatype JSON, MODULE_IRI; rdfs::LITERAL)
66 .with_comment("The datatype of RDF literals storing JSON content")
67 .with_see_also_str("https://www.w3.org/TR/json-ld11/#the-rdf-json-datatype")
68 .into(),
69 rdf!(datatype LANG_STRING, MODULE_IRI; rdfs::LITERAL)
70 .with_comment("The datatype of language-tagged string values")
71 .with_see_also_str("http://www.w3.org/TR/rdf11-concepts/#section-Graph-Literal")
72 .into(),
73 rdf!(datatype PLAIN_LITERAL, MODULE_IRI; rdfs::LITERAL)
74 .with_comment("The class of plain (i.e. untyped) literal values, as used in RIF and OWL 2")
75 .with_see_also_str("http://www.w3.org/TR/rdf-plain-literal/")
76 .into(),
77 rdf!(datatype XML_LITERAL, MODULE_IRI; rdfs::LITERAL)
78 .with_comment("The datatype of XML literal values")
79 .into(),
80
81 rdf!(class PROPERTY, MODULE_IRI; (rdfs::MODULE_NAME, rdfs::RESOURCE))
83 .with_comment("The class of RDF properties.")
84 .into(),
85
86 rdf!(property TYPE, MODULE_IRI;
88 (rdfs::MODULE_NAME, rdfs::RESOURCE) =>
89 (rdfs::MODULE_NAME, rdfs::CLASS))
90 .into(),
91
92 rdf!(class ALT, MODULE_IRI;
94 (rdfs::MODULE_NAME, rdfs::CONTAINER))
95 .with_comment("The class of containers of alternatives.")
96 .into(),
97 rdf!(class BAG, MODULE_IRI;
98 (rdfs::MODULE_NAME, rdfs::CONTAINER))
99 .with_comment("The class of unordered containers.")
100 .into(),
101 rdf!(class SEQ, MODULE_IRI;
102 (rdfs::MODULE_NAME, rdfs::CONTAINER))
103 .with_comment("The class of ordered containers.")
104 .into(),
105
106 rdf!(class LIST, MODULE_IRI;
108 (rdfs::MODULE_NAME, rdfs::RESOURCE))
109 .with_comment("The class of RDF Lists.")
110 .into(),
111 rdf!(property FIRST, MODULE_IRI;
112 LIST => (rdfs::MODULE_NAME, rdfs::RESOURCE))
113 .with_comment("The first item in the subject RDF list.")
114 .into(),
115 rdf!(property REST, MODULE_IRI; LIST => LIST)
116 .with_comment("The rest of the subject RDF list after the first item.")
117 .into(),
118 rdf!(thing NIL, MODULE_IRI, LIST)
119 .with_comment("The empty list, with no items in it. If the rest of a list is nil then the list has no more items in it.")
120 .into(),
121
122 rdf!(class STATEMENT, MODULE_IRI; (rdfs::MODULE_NAME, rdfs::RESOURCE))
124 .with_comment("The class of RDF statements.")
125 .into(),
126 rdf!(property SUBJECT, MODULE_IRI;
127 STATEMENT => (rdfs::MODULE_NAME, rdfs::RESOURCE))
128 .with_comment("The subject of the subject RDF statement.")
129 .into(),
130 rdf!(property PREDICATE, MODULE_IRI;
131 STATEMENT => (rdfs::MODULE_NAME, rdfs::RESOURCE))
132 .with_comment("The predicate of the subject RDF statement.")
133 .into(),
134 rdf!(property OBJECT, MODULE_IRI;
135 STATEMENT => (rdfs::MODULE_NAME, rdfs::RESOURCE))
136 .with_comment("The object of the subject RDF statement.")
137 .into(),
138
139 rdf!(property VALUE, MODULE_IRI;
140 (rdfs::MODULE_NAME, rdfs::RESOURCE) =>
141 (rdfs::MODULE_NAME, rdfs::RESOURCE))
142 .with_comment("Idiomatic property used for structured values.")
143 .into(),
144
145 rdf!(class COMPOUND, MODULE_IRI; (rdfs::MODULE_NAME, rdfs::RESOURCE))
147 .with_comment("A class representing a compound literal.")
148 .with_see_also_str("https://www.w3.org/TR/json-ld11/#the-rdf-compoundliteral-class-and-the-rdf-language-and-rdf-direction-properties")
149 .into(),
150 rdf!(property DIRECTION, MODULE_IRI; COMPOUND)
151 .with_comment("The language component of a CompoundLiteral.")
152 .with_see_also_str("https://www.w3.org/TR/json-ld11/#the-rdf-compoundliteral-class-and-the-rdf-language-and-rdf-direction-properties")
153 .into(),
154 rdf!(property LANGUAGE, MODULE_IRI; COMPOUND)
155 .with_comment("The base direction component of a CompoundLiteral.")
156 .with_see_also_str("https://www.w3.org/TR/json-ld11/#the-rdf-compoundliteral-class-and-the-rdf-language-and-rdf-direction-properties")
157 .into(),
158 ]).unwrap();
159
160 module
161}