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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/*!
Standard library module for namespace `rdf`.

*/

use crate::model::{identifiers::Identifier, modules::Module, definitions::{RdfDef, RdfDefBody}};
use url::Url;
use crate::model::HasBody;

// ------------------------------------------------------------------------------------------------
// Public Macros
// ------------------------------------------------------------------------------------------------

// ------------------------------------------------------------------------------------------------
// Public Types
// ------------------------------------------------------------------------------------------------

pub const MODULE_NAME: &str = "rdf";
pub const MODULE_URL: &str = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";

pub const CLASS_ALT_NAME: &str = "Alt";
pub const CLASS_BAG_NAME: &str = "Bag";
pub const CLASS_HTML_NAME: &str = "HTML";
pub const CLASS_LANG_STRING_NAME: &str = "langString";
pub const CLASS_LIST_NAME: &str = "List";
pub const CLASS_PROPERTY_NAME: &str = "Property";
pub const CLASS_SEQ_NAME: &str = "Seq";
pub const CLASS_STATEMENT_NAME: &str = "Statement";
pub const CLASS_XML_LITERAL_NAME: &str = "XMLLiteral";

pub const PROP_FIRST_NAME: &str = "first";
pub const PROP_NIL_NAME: &str = "nil";
pub const PROP_OBJECT_NAME: &str = "object";
pub const PROP_PREDICATE_NAME: &str = "predicate";
pub const PROP_REST_NAME: &str = "rest";
pub const PROP_SUBJECT_NAME: &str = "subject";
pub const PROP_TYPE_NAME: &str = "type";

// ------------------------------------------------------------------------------------------------
// Public Functions
// ------------------------------------------------------------------------------------------------

pub fn module() -> Module {
    let mut module = Module::empty(Identifier::new_unchecked(MODULE_NAME))
        .with_base_uri(Url::parse(MODULE_URL).unwrap());

    module.body_mut().extend_definitions(vec![
        // Classes
        RdfDef::Class(
            RdfDefBody::new(Identifier::new_unchecked(CLASS_LANG_STRING_NAME))
        ).into(),
        RdfDef::Class(
            RdfDefBody::new(Identifier::new_unchecked(CLASS_HTML_NAME))
        ).into(),
        RdfDef::Class(
            RdfDefBody::new(Identifier::new_unchecked(CLASS_XML_LITERAL_NAME))
        ).into(),
        RdfDef::Class(
            RdfDefBody::new(Identifier::new_unchecked(CLASS_PROPERTY_NAME))
        ).into(),
        // Properties
        RdfDef::Property(
            RdfDefBody::new(Identifier::new_unchecked(PROP_TYPE_NAME))
        ).into(),
        // Container Classes and Properties
        RdfDef::Class(
            RdfDefBody::new(Identifier::new_unchecked(CLASS_ALT_NAME))
        ).into(),
        RdfDef::Class(
            RdfDefBody::new(Identifier::new_unchecked(CLASS_BAG_NAME))
        ).into(),
        RdfDef::Class(
            RdfDefBody::new(Identifier::new_unchecked(CLASS_SEQ_NAME))
        ).into(),
        // RDF Collections
         RdfDef::Class(
            RdfDefBody::new(Identifier::new_unchecked(CLASS_LIST_NAME))
        ).into(),
        RdfDef::Property(
            RdfDefBody::new(Identifier::new_unchecked(PROP_FIRST_NAME))
        ).into(),
        RdfDef::Property(
            RdfDefBody::new(Identifier::new_unchecked(PROP_REST_NAME))
        ).into(),
        RdfDef::Property(
            RdfDefBody::new(Identifier::new_unchecked(PROP_NIL_NAME))
        ).into(),
        // Reification Vocabulary
        RdfDef::Class(
            RdfDefBody::new(Identifier::new_unchecked(CLASS_STATEMENT_NAME))
        ).into(),
        RdfDef::Property(
            RdfDefBody::new(Identifier::new_unchecked(PROP_SUBJECT_NAME))
        ).into(),
        RdfDef::Property(
            RdfDefBody::new(Identifier::new_unchecked(PROP_PREDICATE_NAME))
        ).into(),
        RdfDef::Property(
            RdfDefBody::new(Identifier::new_unchecked(PROP_OBJECT_NAME))
        ).into(),
    ]);

    module
}

// ------------------------------------------------------------------------------------------------
// Private Macros
// ------------------------------------------------------------------------------------------------

// ------------------------------------------------------------------------------------------------
// Private Types
// ------------------------------------------------------------------------------------------------

// ------------------------------------------------------------------------------------------------
// Implementations
// ------------------------------------------------------------------------------------------------

// ------------------------------------------------------------------------------------------------
// Private Functions
// ------------------------------------------------------------------------------------------------

// ------------------------------------------------------------------------------------------------
// Modules
// ------------------------------------------------------------------------------------------------