1 | (asdf:operate 'asdf:load-op 'elephant) |
---|
2 | (use-package :elephant) |
---|
3 | |
---|
4 | (defpclass VersionInfoC() |
---|
5 | ((start-revision :initarg :start-revision |
---|
6 | :accessor start-revision |
---|
7 | :type integer |
---|
8 | :initform 0) |
---|
9 | (end-revision :initarg :end-revision |
---|
10 | :accessor end-revision |
---|
11 | :type integer |
---|
12 | :initform 0) |
---|
13 | (versioned-construct :initarg :versioned-construct |
---|
14 | :accessor versioned-construct |
---|
15 | :associate VersionedConstructC))) |
---|
16 | |
---|
17 | (defpclass VersionedConstructC() |
---|
18 | ((versions :initarg :versions |
---|
19 | :accessor versions |
---|
20 | :inherit t |
---|
21 | :associate (VersionInfoC versioned-construct)))) |
---|
22 | |
---|
23 | |
---|
24 | (defpclass VersionedAssociationC(VersionedConstructC) |
---|
25 | ()) |
---|
26 | |
---|
27 | |
---|
28 | (defpclass PointerAssociationC (VersionedAssociationC) |
---|
29 | ((identifier :initarg :identifier |
---|
30 | :accessor identifier |
---|
31 | :inherit t |
---|
32 | :initform (error "From PointerAssociationC(): identifier must be set") |
---|
33 | :associate PointerC))) |
---|
34 | |
---|
35 | |
---|
36 | (defpclass ItemIdAssociationC(PointerAssociationC) |
---|
37 | ((parent-construct :initarg :parent-construct |
---|
38 | :accessor parent-construct |
---|
39 | :initform (error "From ItemIdAssociationC(): parent-construct must be set") |
---|
40 | :associate ReifiableConstructC))) |
---|
41 | |
---|
42 | |
---|
43 | (defpclass TopicMapConstructC() |
---|
44 | ()) |
---|
45 | |
---|
46 | |
---|
47 | (defpclass ReifiableConstructC(TopicMapConstructC) |
---|
48 | ((item-identifiers :associate (ItemIdAssociationC parent-construct) |
---|
49 | :inherit t))) |
---|
50 | |
---|
51 | |
---|
52 | (defpclass PointerC(TopicMapConstructC) |
---|
53 | ((uri :initarg :uri |
---|
54 | :accessor uri |
---|
55 | :inherit t |
---|
56 | :type string |
---|
57 | :initform (error "From PointerC(): uri must be set for a pointer") |
---|
58 | :index t) |
---|
59 | (identified-construct :associate (PointerAssociationC identifier) |
---|
60 | :inherit t))) |
---|
61 | |
---|
62 | |
---|
63 | (defpclass IdentifierC(PointerC) |
---|
64 | ()) |
---|
65 | |
---|
66 | |
---|
67 | (defpclass ItemIdentifierC(IdentifierC) |
---|
68 | () |
---|
69 | (:index t)) |
---|
70 | |
---|
71 | |
---|
72 | (open-store '(:BDB "data_base")) |
---|
73 | (defvar *p* (make-instance 'PointerC |
---|
74 | :uri "anyUri")) |
---|
75 | (defvar *pa* (make-instance 'PointerAssociationC |
---|
76 | :identifier *p*)) |
---|
77 | |
---|
78 | (defvar *ii* (make-instance 'ItemIdentifierC |
---|
79 | :uri "anyUri")) |
---|
80 | |
---|
81 | (defvar *pa-ii* (make-instance 'PointerAssociationC |
---|
82 | :identifier *ii*)) |
---|
83 | |
---|
84 | (defvar *ii-2* (make-instance 'ItemIdentifierC |
---|
85 | :uri "anyUri")) |
---|
86 | |
---|
87 | (defvar *rc* (make-instance 'ReifiableConstructC)) |
---|
88 | |
---|
89 | |
---|
90 | (defvar *ia* (make-instance 'ItemIdAssociationC |
---|
91 | :identifier *ii-2* |
---|
92 | :parent-construct *rc*)) |
---|
93 | |
---|
94 | |
---|
95 | (when (not (slot-value *p* 'identified-construct)) |
---|
96 | (error ">> 1")) |
---|
97 | |
---|
98 | (when (not (slot-value *pa* 'identifier)) |
---|
99 | (error ">> 2")) |
---|
100 | |
---|
101 | (when (not (slot-value *ii* 'identified-construct)) |
---|
102 | (error ">> 3")) |
---|
103 | |
---|
104 | (when (not (slot-value *pa-ii* 'identifier)) |
---|
105 | (error ">> 4")) |
---|
106 | |
---|
107 | (when (not (slot-value *ii-2* 'identified-construct)) |
---|
108 | (error ">> 5")) |
---|
109 | |
---|
110 | (when (not (slot-value *rc* 'item-identifiers)) |
---|
111 | (error ">> 6")) |
---|
112 | |
---|
113 | (when (not (slot-value *ia* 'parent-construct)) |
---|
114 | (error ">> 7")) |
---|
115 | |
---|
116 | (when (not (slot-value *ia* 'identifier)) |
---|
117 | (error ">> 8")) |
---|