sdml_core/stdlib/
rdfs.rs

1/*!
2This Rust module contains the SDML model of the SDML library module `rdfs` for RDF Schema.
3*/
4
5use crate::model::{
6    annotations::{AnnotationOnlyBody, HasAnnotations},
7    modules::Module,
8    HasBody,
9};
10use std::str::FromStr;
11
12// ------------------------------------------------------------------------------------------------
13// Public Types
14// ------------------------------------------------------------------------------------------------
15
16pub const MODULE_PATH: &str = "::org::w3";
17pub const MODULE_NAME: &str = "rdfs";
18pub const MODULE_URL: &str = "http://www.w3.org/2000/01/rdf-schema#";
19
20pub const CLASS: &str = "Class";
21pub const CONTAINER: &str = "Container";
22pub const CONTAINER_MEMBERSHIP_PROPERTY: &str = "ContainerMembershipProperty";
23pub const DATATYPE: &str = "Datatype";
24pub const LITERAL: &str = "Literal";
25pub const RESOURCE: &str = "Resource";
26
27pub const COMMENT: &str = "comment";
28pub const DOMAIN: &str = "domain";
29pub const IS_DEFINED_BY: &str = "isDefinedBy";
30pub const LABEL: &str = "label";
31pub const MEMBER: &str = "member";
32pub const RANGE: &str = "range";
33pub const SEE_ALSO: &str = "seeAlso";
34pub const SUB_CLASS_OF: &str = "subClassOf";
35pub const SUB_PROPERTY_OF: &str = "subPropertyOf";
36
37// ------------------------------------------------------------------------------------------------
38// Public Functions
39// ------------------------------------------------------------------------------------------------
40
41module_function!(|| {
42    let module_uri: url::Url = url::Url::parse(MODULE_URL).unwrap();
43
44    module!(
45        id!(unchecked rdfs), module_uri ; call |module: Module|
46        module.with_imports([import_statement!(
47            id!(unchecked rdf),
48        )])
49            .with_definitions([
50                // ---------------------------------------------------------------------------------
51                // Classes
52                // ---------------------------------------------------------------------------------
53                rdf!(id!(unchecked Class) ; class ;
54                    call |body: AnnotationOnlyBody|
55                    body.with_annotations([
56                        annotation!(id!(unchecked rdfs:isDefinedBy), id!(unchecked rdfs)),
57                        annotation!(id!(unchecked skos:prefLabel), rdf_str!(Class@en)),
58                    ])).into(),
59                rdf!(id!(unchecked Container) ; class ;
60                    call |body: AnnotationOnlyBody|
61                    body.with_annotations([
62                        annotation!(id!(unchecked rdfs:isDefinedBy), id!(unchecked rdfs)),
63                        annotation!(id!(unchecked skos:prefLabel), rdf_str!(Container@en)),
64                    ])).into(),
65                rdf!(id!(unchecked Datatype) ; class id!(unchecked Class) ;
66                    call |body: AnnotationOnlyBody|
67                    body.with_annotations([
68                        annotation!(id!(unchecked rdfs:isDefinedBy), id!(unchecked rdfs)),
69                        annotation!(id!(unchecked skos:prefLabel), rdf_str!(Datatype@en)),
70                    ])).into(),
71                rdf!(id!(unchecked Literal) ; class ;
72                    call |body: AnnotationOnlyBody|
73                    body.with_annotations([
74                        annotation!(id!(unchecked rdfs:isDefinedBy), id!(unchecked rdfs)),
75                        annotation!(id!(unchecked skos:prefLabel), rdf_str!(Literal@en)),
76                    ])).into(),
77                rdf!(id!(unchecked Resource) ; class ;
78                    call |body: AnnotationOnlyBody|
79                    body.with_annotations([
80                        annotation!(id!(unchecked rdfs:isDefinedBy), id!(unchecked rdfs)),
81                        annotation!(id!(unchecked skos:prefLabel), rdf_str!(Resource@en)),
82                    ])).into(),
83                // ---------------------------------------------------------------------------------
84                // Properties
85                // ---------------------------------------------------------------------------------
86                rdf!(id!(unchecked comment) ; property id!(unchecked Property) ;
87                    call |body: AnnotationOnlyBody|
88                    body.with_annotations([
89                        annotation!(id!(unchecked rdfs:isDefinedBy), id!(unchecked rdfs)),
90                        annotation!(id!(unchecked skos:prefLabel), rdf_str!(comment@en)),
91                        annotation!(id!(unchecked rdfs:domain), id!(unchecked Resource)),
92                        annotation!(id!(unchecked rdfs:range), id!(unchecked Literal)),
93                    ])).into(),
94                rdf!(id!(unchecked domain) ; property id!(unchecked Property) ;
95                    call |body: AnnotationOnlyBody|
96                    body.with_annotations([
97                        annotation!(id!(unchecked rdfs:isDefinedBy), id!(unchecked rdfs)),
98                        annotation!(id!(unchecked skos:prefLabel), rdf_str!(domain@en)),
99                        annotation!(id!(unchecked rdfs:domain), id!(unchecked rdf:Property)),
100                        annotation!(id!(unchecked rdfs:range), id!(unchecked Class)),
101                    ])).into(),
102                rdf!(id!(unchecked isDefinedBy) ; property id!(unchecked Property) ;
103                    call |body: AnnotationOnlyBody|
104                    body.with_annotations([
105                        annotation!(id!(unchecked rdfs:isDefinedBy), id!(unchecked rdfs)),
106                        annotation!(id!(unchecked skos:prefLabel), rdf_str!(isDefinedBy@en)),
107                        annotation!(id!(unchecked rdfs:domain), id!(unchecked Resource)),
108                        annotation!(id!(unchecked rdfs:range), id!(unchecked Resource)),
109                    ])).into(),
110                rdf!(id!(unchecked label) ; property id!(unchecked Property) ;
111                    call |body: AnnotationOnlyBody|
112                    body.with_annotations([
113                        annotation!(id!(unchecked rdfs:isDefinedBy), id!(unchecked rdfs)),
114                        annotation!(id!(unchecked skos:prefLabel), rdf_str!(label@en)),
115                        annotation!(id!(unchecked rdfs:domain), id!(unchecked Resource)),
116                        annotation!(id!(unchecked rdfs:range), id!(unchecked Literal)),
117                    ])).into(),
118                rdf!(id!(unchecked range) ; property id!(unchecked Property) ;
119                    call |body: AnnotationOnlyBody|
120                    body.with_annotations([
121                        annotation!(id!(unchecked rdfs:isDefinedBy), id!(unchecked rdfs)),
122                        annotation!(id!(unchecked skos:prefLabel), rdf_str!(range@en)),
123                        annotation!(id!(unchecked rdfs:domain), id!(unchecked rdf:Property)),
124                        annotation!(id!(unchecked rdfs:range), id!(unchecked Class)),
125                    ])).into(),
126                rdf!(id!(unchecked member) ; property id!(unchecked Property) ;
127                    call |body: AnnotationOnlyBody|
128                    body.with_annotations([
129                        annotation!(id!(unchecked rdfs:isDefinedBy), id!(unchecked rdfs)),
130                        annotation!(id!(unchecked skos:prefLabel), rdf_str!(member@en)),
131                        annotation!(id!(unchecked rdfs:domain), id!(unchecked Resource)),
132                        annotation!(id!(unchecked rdfs:range), id!(unchecked Resource)),
133                    ])).into(),
134                rdf!(id!(unchecked seeAlso) ; property id!(unchecked Property) ;
135                    call |body: AnnotationOnlyBody|
136                    body.with_annotations([
137                        annotation!(id!(unchecked rdfs:isDefinedBy), id!(unchecked rdfs)),
138                        annotation!(id!(unchecked skos:prefLabel), rdf_str!(seeAlso@en)),
139                        annotation!(id!(unchecked rdfs:domain), id!(unchecked Resource)),
140                        annotation!(id!(unchecked rdfs:range), id!(unchecked Resource)),
141                    ])).into(),
142                rdf!(id!(unchecked subPropertyOf) ; property id!(unchecked Property) ;
143                    call |body: AnnotationOnlyBody|
144                    body.with_annotations([
145                        annotation!(id!(unchecked rdfs:isDefinedBy), id!(unchecked rdfs)),
146                        annotation!(id!(unchecked skos:prefLabel), rdf_str!(subPropertyOf@en)),
147                        annotation!(id!(unchecked rdfs:domain), id!(unchecked rdf:Property)),
148                        annotation!(id!(unchecked rdfs:range), id!(unchecked rdf:Property)),
149                    ])).into(),
150                rdf!(id!(unchecked ContainerMembershipProperty) ; class id!(unchecked Property) ;
151                    call |body: AnnotationOnlyBody|
152                    body.with_annotations([
153                        annotation!(id!(unchecked rdfs:isDefinedBy), id!(unchecked rdfs)),
154                        annotation!(id!(unchecked skos:prefLabel), rdf_str!(subPropertyOfContainerMembershipProperty@en)),
155                    ])).into(),
156            ])
157    )
158});