1 | ;;+----------------------------------------------------------------------------- |
---|
2 | ;;+ Isidorus |
---|
3 | ;;+ (c) 2008-2009 Marc Kuester, Christoph Ludwig, Lukas Giessmann |
---|
4 | ;;+ |
---|
5 | ;;+ Isidorus is freely distributable under the LGPL license. |
---|
6 | ;;+ You can find a detailed description in trunk/docs/LGPL-LICENSE.txt. |
---|
7 | ;;+----------------------------------------------------------------------------- |
---|
8 | |
---|
9 | |
---|
10 | (defpackage :json-test |
---|
11 | (:use |
---|
12 | :common-lisp |
---|
13 | :xml-importer |
---|
14 | :json-exporter |
---|
15 | :json-importer |
---|
16 | :datamodel |
---|
17 | :it.bese.FiveAM |
---|
18 | :unittests-constants |
---|
19 | :fixtures) |
---|
20 | (:export :test-to-json-string-topics |
---|
21 | :test-to-json-string-associations |
---|
22 | :test-to-json-string-fragments |
---|
23 | :test-get-fragment-values-from-json-list-general |
---|
24 | :test-get-fragment-values-from-json-list-names |
---|
25 | :test-get-fragment-values-from-json-list-occurrences |
---|
26 | :test-get-fragment-values-from-json-list-topicStubs |
---|
27 | :test-get-fragment-values-from-json-list-associations |
---|
28 | :run-json-tests |
---|
29 | :test-json-importer-general-1 |
---|
30 | :test-json-importer-general-2 |
---|
31 | :test-json-importer-general-3 |
---|
32 | :test-json-importer-topics-1 |
---|
33 | :test-json-importer-topics-2 |
---|
34 | :test-json-importer-topics-3 |
---|
35 | :test-json-importer-topics-4 |
---|
36 | :test-json-importer-associations |
---|
37 | :test-json-importer-merge-1 |
---|
38 | :test-json-importer-merge-2 |
---|
39 | :test-json-importer-merge-3 |
---|
40 | :test-get-all-topic-psis)) |
---|
41 | |
---|
42 | |
---|
43 | (in-package :json-test) |
---|
44 | |
---|
45 | |
---|
46 | (def-suite json-tests |
---|
47 | :description "tests various functions of the json module") |
---|
48 | |
---|
49 | (in-suite json-tests) |
---|
50 | |
---|
51 | |
---|
52 | (defvar *t100-1* "{\"topic\":{\"id\":\"t970\",\"itemIdentities\":[\"http://www.egovpt.org/itemIdentifiers#t100\"],\"subjectLocators\":null,\"subjectIdentifiers\":[\"http://psi.egovpt.org/standard/Common+Lisp\"],\"instanceOfs\":[[\"http://psi.egovpt.org/types/standard\"]],\"names\":[{\"itemIdentities\":[\"http://www.egovpt.org/itemIdentifiers#t100_n1\",\"http://www.egovpt.org/itemIdentifiers#t100_n1a\"],\"type\":null,\"scopes\":null,\"value\":\"Common Lisp\",\"variants\":[{\"itemIdentities\":[\"http://www.egovpt.org/itemIdentifiers#t100_n_v1\"],\"scopes\":[[\"http://www.topicmaps.org/xtm/1.0/core.xtm#sort\"],[\"http://psi.egovpt.org/types/long-name\"]],\"resourceRef\":null,\"resourceData\":{\"datatype\":\"http://www.w3.org/2001/XMLSchema#string\",\"value\":\"Common-Lisp\"}}]}],\"occurrences\":[{\"itemIdentities\":[\"http://www.egovpt.org/itemIdentifiers#t100_o1\"],\"type\":[\"http://psi.egovpt.org/types/links\"],\"scopes\":null,\"resourceRef\":\"http://www.common-lisp.net/\",\"resourceData\":null}]},\"topicStubs\":[{\"id\":\"t220\",\"itemIdentities\":[\"http://psi.egovpt.org/itemIdentifiers#t3\",\"http://www.egovpt.org/itemIdentifiers#t3\"],\"subjectLocators\":null,\"subjectIdentifiers\":[\"http://psi.egovpt.org/types/standard\"]},{\"id\":\"t68\",\"itemIdentities\":null,\"subjectLocators\":null,\"subjectIdentifiers\":[\"http://www.topicmaps.org/xtm/1.0/core.xtm#sort\"]},{\"id\":\"t284\",\"itemIdentities\":[\"http://psi.egovpt.org/itemIdentifiers#t50a\"],\"subjectLocators\":null,\"subjectIdentifiers\":[\"http://psi.egovpt.org/types/long-name\"]},{\"id\":\"t324\",\"itemIdentities\":[\"http://psi.egovpt.org/itemIdentifiers#t55\",\"http://psi.egovpt.org/itemIdentifiers#t55_1\"],\"subjectLocators\":null,\"subjectIdentifiers\":[\"http://psi.egovpt.org/types/links\"]}],\"associations\":null,\"tmIds\":[\"http://www.isidor.us/unittests/testtm\"]}") |
---|
53 | |
---|
54 | (defvar *t100-2* "{\"topic\":{\"id\":\"t945\",\"itemIdentities\":[\"http://www.egovpt.org/itemIdentifiers#t100\",\"http://www.egovpt.org/itemIdentifiers#t100_new\"],\"subjectLocators\":null,\"subjectIdentifiers\":[\"http://psi.egovpt.org/standard/Common+Lisp\"],\"instanceOfs\":[[\"http://psi.egovpt.org/types/standard\"]],\"names\":[{\"itemIdentities\":[\"http://www.egovpt.org/itemIdentifiers#t100_n1\"],\"type\":null,\"scopes\":null,\"value\":\"Common Lisp\",\"variants\":[{\"itemIdentities\":[\"http://www.egovpt.org/itemIdentifiers#t100_n_v1\"],\"scopes\":[[\"http://www.topicmaps.org/xtm/1.0/core.xtm#sort\"],[\"http://psi.egovpt.org/types/long-name\"]],\"resourceRef\":null,\"resourceData\":{\"datatype\":\"http://www.w3.org/2001/XMLSchema#string\",\"value\":\"Common-Lisp\"}},{\"itemIdentities\":[\"http://www.egovpt.org/itemIdentifiers#t100_n_v2\"],\"scopes\":[[\"http://www.topicmaps.org/xtm/1.0/core.xtm#display\"]],\"resourceRef\":null,\"resourceData\":{\"datatype\":\"http://www.w3.org/2001/XMLSchema#string\",\"value\":\"CL\"}}]}],\"occurrences\":[{\"itemIdentities\":[\"http://www.egovpt.org/itemIdentifiers#t100_o2\"],\"type\":[\"http://psi.egovpt.org/types/links\"],\"scopes\":null,\"resourceRef\":\"http://www.cliki.net/\",\"resourceData\":null}]},\"topicStubs\":[{\"id\":\"t220\",\"itemIdentities\":[\"http://psi.egovpt.org/itemIdentifiers#t3\",\"http://www.egovpt.org/itemIdentifiers#t3\"],\"subjectLocators\":null,\"subjectIdentifiers\":[\"http://psi.egovpt.org/types/standard\"]},{\"id\":\"t68\",\"itemIdentities\":null,\"subjectLocators\":null,\"subjectIdentifiers\":[\"http://www.topicmaps.org/xtm/1.0/core.xtm#sort\"]},{\"id\":\"t284\",\"itemIdentities\":[\"http://psi.egovpt.org/itemIdentifiers#t50a\"],\"subjectLocators\":null,\"subjectIdentifiers\":[\"http://psi.egovpt.org/types/long-name\"]},{\"id\":\"t74\",\"itemIdentities\":null,\"subjectLocators\":null,\"subjectIdentifiers\":[\"http://www.topicmaps.org/xtm/1.0/core.xtm#display\"]},{\"id\":\"t324\",\"itemIdentities\":[\"http://psi.egovpt.org/itemIdentifiers#t55\"],\"subjectLocators\":null,\"subjectIdentifiers\":[\"http://psi.egovpt.org/types/links\"]}],\"associations\":null,\"tmIds\":[\"http://www.isidor.us/unittests/testtm\"]}") |
---|
55 | |
---|
56 | (defvar *t100-3* "{\"topic\":{\"id\":\"t404\",\"itemIdentities\":[\"http://psi.egovpt.org/itemIdentifiers#t100\"],\"subjectLocators\":null,\"subjectIdentifiers\":[\"http://psi.egovpt.org/standard/ISO+19115%3A+Geographic+Information+-+Metadata\"],\"instanceOfs\":[[\"http://psi.egovpt.org/types/semanticstandard\"]],\"names\":[{\"itemIdentities\":[\"http://psi.egovpt.org/itemIdentifiers#t100_n1\"],\"type\":null,\"scopes\":null,\"value\":\"ISO 19115\",\"variants\":[{\"itemIdentities\":[\"http://psi.egovpt.org/itemIdentifiers#t100_n1_v1\"],\"scopes\":[[\"http://www.topicmaps.org/xtm/1.0/core.xtm#display\"]],\"resourceRef\":null,\"resourceData\":{\"datatype\":\"http://www.w3.org/2001/XMLSchema#string\",\"value\":\"Geographic Information - Metadata\"}},{\"itemIdentities\":[\"http://psi.egovpt.org/itemIdentifiers#t100_n1_v2\"],\"scopes\":[[\"http://www.topicmaps.org/xtm/1.0/core.xtm#sort\"]],\"resourceRef\":null,\"resourceData\":{\"datatype\":\"http://www.w3.org/2001/XMLSchema#string\",\"value\":\"ISO-19115\"}}]}],\"occurrences\":[{\"itemIdentities\":[\"http://psi.egovpt.org/itemIdentifiers#t100_o1\"],\"type\":[\"http://psi.egovpt.org/types/standardHasStatus\"],\"scopes\":null,\"resourceRef\":\"http://www.budabe.de/\",\"resourceData\":null},{\"itemIdentities\":[\"http://psi.egovpt.org/itemIdentifiers#t100_o2\"],\"type\":[\"http://psi.egovpt.org/types/description\"],\"scopes\":null,\"resourceRef\":null,\"resourceData\":{\"datatype\":\"http://www.w3.org/2001/XMLSchema#string\",\"value\":\"The ISO 19115 standard ...\"}},{\"itemIdentities\":[\"http://psi.egovpt.org/itemIdentifiers#t100_o3\"],\"type\":[\"http://psi.egovpt.org/types/standardValidFromDate\"],\"scopes\":null,\"resourceRef\":null,\"resourceData\":{\"datatype\":\"http://www.w3.org/2001/XMLSchema#date\",\"value\":\"2003-01-01\"}},{\"itemIdentities\":[\"http://psi.egovpt.org/itemIdentifiers#t100_o4\"],\"type\":[\"http://psi.egovpt.org/types/links\"],\"scopes\":null,\"resourceRef\":\"http://www.editeur.org/standards/ISO19115.pdf\",\"resourceData\":null}]},\"topicStubs\":[{\"id\":\"t228\",\"itemIdentities\":[\"http://psi.egovpt.org/itemIdentifiers#t3a\"],\"subjectLocators\":null,\"subjectIdentifiers\":[\"http://psi.egovpt.org/types/semanticstandard\"]},{\"id\":\"t74\",\"itemIdentities\":null,\"subjectLocators\":null,\"subjectIdentifiers\":[\"http://www.topicmaps.org/xtm/1.0/core.xtm#display\"]},{\"id\":\"t68\",\"itemIdentities\":null,\"subjectLocators\":null,\"subjectIdentifiers\":[\"http://www.topicmaps.org/xtm/1.0/core.xtm#sort\"]},{\"id\":\"t292\",\"itemIdentities\":[\"http://psi.egovpt.org/itemIdentifiers#t51\"],\"subjectLocators\":null,\"subjectIdentifiers\":[\"http://psi.egovpt.org/types/standardHasStatus\"]},{\"id\":\"t308\",\"itemIdentities\":[\"http://psi.egovpt.org/itemIdentifiers#t53\"],\"subjectLocators\":null,\"subjectIdentifiers\":[\"http://psi.egovpt.org/types/description\"]},{\"id\":\"t316\",\"itemIdentities\":[\"http://psi.egovpt.org/itemIdentifiers#t54\"],\"subjectLocators\":null,\"subjectIdentifiers\":[\"http://psi.egovpt.org/types/standardValidFromDate\"]},{\"id\":\"t324\",\"itemIdentities\":[\"http://psi.egovpt.org/itemIdentifiers#t55\"],\"subjectLocators\":null,\"subjectIdentifiers\":[\"http://psi.egovpt.org/types/links\"]},{\"id\":\"t434\",\"itemIdentities\":null,\"subjectLocators\":null,\"subjectIdentifiers\":[\"http://psi.egovpt.org/subject/GeoData\"]},{\"id\":\"t364\",\"itemIdentities\":[\"http://psi.egovpt.org/itemIdentifiers#t60\"],\"subjectLocators\":null,\"subjectIdentifiers\":[\"http://psi.egovpt.org/types/standardIsAboutSubject\"]},{\"id\":\"t372\",\"itemIdentities\":[\"http://psi.egovpt.org/itemIdentifiers#t61\"],\"subjectLocators\":null,\"subjectIdentifiers\":[\"http://psi.egovpt.org/types/SubjectRoleType\"]},{\"id\":\"t422\",\"itemIdentities\":null,\"subjectLocators\":null,\"subjectIdentifiers\":[\"http://psi.egovpt.org/subject/Semantic+Description\"]},{\"id\":\"t396\",\"itemIdentities\":[\"http://psi.egovpt.org/itemIdentifiers#t64\"],\"subjectLocators\":null,\"subjectIdentifiers\":[\"http://psi.egovpt.org/types/serviceUsesStandard\"]},{\"id\":\"t388\",\"itemIdentities\":[\"http://psi.egovpt.org/itemIdentifiers#t63\"],\"subjectLocators\":null,\"subjectIdentifiers\":[\"http://psi.egovpt.org/types/ServiceRoleType\"]},{\"id\":\"t452\",\"itemIdentities\":null,\"subjectLocators\":null,\"subjectIdentifiers\":[\"http://psi.egovpt.org/service/Google+Maps\",\"http://maps.google.com\"]},{\"id\":\"t380\",\"itemIdentities\":[\"http://psi.egovpt.org/itemIdentifiers#t62\"],\"subjectLocators\":null,\"subjectIdentifiers\":[\"http://psi.egovpt.org/types/StandardRoleType\"]}],\"associations\":[{\"itemIdentities\":null,\"type\":[\"http://psi.egovpt.org/types/standardIsAboutSubject\"],\"scopes\":null,\"roles\":[{\"itemIdentities\":null,\"type\":[\"http://psi.egovpt.org/types/StandardRoleType\"],\"topicRef\":[\"http://psi.egovpt.org/standard/ISO+19115%3A+Geographic+Information+-+Metadata\"]},{\"itemIdentities\":null,\"type\":[\"http://psi.egovpt.org/types/SubjectRoleType\"],\"topicRef\":[\"http://psi.egovpt.org/subject/GeoData\"]}]},{\"itemIdentities\":null,\"type\":[\"http://psi.egovpt.org/types/standardIsAboutSubject\"],\"scopes\":null,\"roles\":[{\"itemIdentities\":null,\"type\":[\"http://psi.egovpt.org/types/StandardRoleType\"],\"topicRef\":[\"http://psi.egovpt.org/standard/ISO+19115%3A+Geographic+Information+-+Metadata\"]},{\"itemIdentities\":null,\"type\":[\"http://psi.egovpt.org/types/SubjectRoleType\"],\"topicRef\":[\"http://psi.egovpt.org/subject/Semantic+Description\"]}]},{\"itemIdentities\":[\"http://psi.egovpt.org/itemIdentifiers#assoc_7\"],\"type\":[\"http://psi.egovpt.org/types/serviceUsesStandard\"],\"scopes\":null,\"roles\":[{\"itemIdentities\":null,\"type\":[\"http://psi.egovpt.org/types/ServiceRoleType\"],\"topicRef\":[\"http://psi.egovpt.org/service/Google+Maps\",\"http://maps.google.com\"]},{\"itemIdentities\":null,\"type\":[\"http://psi.egovpt.org/types/StandardRoleType\"],\"topicRef\":[\"http://psi.egovpt.org/standard/ISO+19115%3A+Geographic+Information+-+Metadata\"]}]}],\"tmIds\":[\"http://www.isidor.us/unittests/testtm\"]}") |
---|
57 | |
---|
58 | (defvar *t64* "{\"topic\":{\"id\":\"t396\",\"itemIdentities\":[\"http://psi.egovpt.org/itemIdentifiers#t64\"],\"subjectLocators\":null,\"subjectIdentifiers\":[\"http://psi.egovpt.org/types/serviceUsesStandard\"],\"instanceOfs\":[[\"http://www.networkedplanet.com/psi/npcl/meta-types/association-type\"]],\"names\":[{\"itemIdentities\":null,\"type\":null,\"scopes\":null,\"value\":\"service uses standard\",\"variants\":null}],\"occurrences\":null},\"topicStubs\":[{\"id\":\"t260\",\"itemIdentities\":[\"http://psi.egovpt.org/itemIdentifiers#t7\"],\"subjectLocators\":null,\"subjectIdentifiers\":[\"http://www.networkedplanet.com/psi/npcl/meta-types/association-type\"]}],\"associations\":null,\"tmIds\":[\"http://www.isidor.us/unittests/testtm\"]}") |
---|
59 | |
---|
60 | |
---|
61 | (test test-to-json-string-topics |
---|
62 | (let ((dir "data_base") |
---|
63 | (rev-0 0)) |
---|
64 | (with-fixture initialize-destination-db (dir) |
---|
65 | (xml-importer:setup-repository |
---|
66 | *notificationbase.xtm* dir :tm-id "http://www.isidor.us/unittests/testtm" |
---|
67 | :xtm-id *TEST-TM*) |
---|
68 | (elephant:open-store (xml-importer:get-store-spec dir)) |
---|
69 | (let ((t50a (get-item-by-id "t50a" :xtm-id *TEST-TM* :revision rev-0))) |
---|
70 | (let ((t50a-string (to-json-string t50a :revision 0)) |
---|
71 | (json-string |
---|
72 | (concatenate 'string "{\"id\":\"" (topic-id t50a) "\",\"itemIdentities\":[\"http:\\/\\/psi.egovpt.org\\/itemIdentifiers#t50a\"],\"subjectLocators\":null,\"subjectIdentifiers\":[\"http:\\/\\/psi.egovpt.org\\/types\\/long-name\"],\"instanceOfs\":[[\"http:\\/\\/www.networkedplanet.com\\/psi\\/npcl\\/meta-types\\/occurrence-type\"]],\"names\":[{\"itemIdentities\":null,\"type\":null,\"scopes\":null,\"value\":\"long version of a name\",\"variants\":[{\"itemIdentities\":null,\"scopes\":[[\"http:\\/\\/www.topicmaps.org\\/xtm\\/1.0\\/core.xtm#sort\"]],\"resourceRef\":null,\"resourceData\":{\"datatype\":\"http:\\/\\/www.w3.org\\/2001\\/XMLSchema#string\",\"value\":\"Long-Version\"}}]}],\"occurrences\":null}" ))) |
---|
73 | (is (string= t50a-string json-string))) |
---|
74 | (let ((t8 (get-item-by-id "t8" :revision rev-0 :xtm-id *TEST-TM*))) |
---|
75 | (let ((t8-string (to-json-string t8 :revision rev-0 :xtm-id *TEST-TM*)) |
---|
76 | (json-string |
---|
77 | (concatenate 'string "{\"id\":\"" (topic-id t8) "\",\"itemIdentities\":[\"http:\\/\\/psi.egovpt.org\\/itemIdentifiers#t8\"],\"subjectLocators\":null,\"subjectIdentifiers\":[\"http:\\/\\/www.networkedplanet.com\\/psi\\/npcl\\/meta-types\\/association-role-type\"],\"instanceOfs\":[[\"http:\\/\\/www.networkedplanet.com\\/psi\\/npcl\\/meta-types\\/topic-type\"]],\"names\":[{\"itemIdentities\":null,\"type\":null,\"scopes\":null,\"value\":\"Association Role Type\",\"variants\":null}],\"occurrences\":null}"))) |
---|
78 | (is (string= t8-string json-string)))) |
---|
79 | (let ((t-topic (get-item-by-id "topic" :xtm-id "core.xtm" :revision rev-0))) |
---|
80 | (let ((t-topic-string (to-json-string t-topic :xtm-id "core.xtm" |
---|
81 | :revision rev-0)) |
---|
82 | (json-string |
---|
83 | (concatenate 'string "{\"id\":\"" (topic-id t-topic) "\",\"itemIdentities\":null,\"subjectLocators\":null,\"subjectIdentifiers\":[\"http:\\/\\/www.topicmaps.org\\/xtm\\/1.0\\/core.xtm#topic\"],\"instanceOfs\":null,\"names\":null,\"occurrences\":null}"))) |
---|
84 | (is (string= t-topic-string json-string)))) |
---|
85 | (let ((t301 (get-item-by-id "t301" :xtm-id *TEST-TM* :revision rev-0))) |
---|
86 | (let ((t301-string (to-json-string t301 :xtm-id *TEST-TM* :revision rev-0)) |
---|
87 | (json-string |
---|
88 | (concatenate 'string "{\"id\":\"" (topic-id t301) "\",\"itemIdentities\":null,\"subjectLocators\":null,\"subjectIdentifiers\":[\"http:\\/\\/psi.egovpt.org\\/service\\/Google+Maps\",\"http:\\/\\/maps.google.com\"],\"instanceOfs\":[[\"http:\\/\\/psi.egovpt.org\\/types\\/service\"]],\"names\":[{\"itemIdentities\":[\"http:\\/\\/psi.egovpt.org\\/topic\\/t301a_n1\"],\"type\":null,\"scopes\":[[\"http:\\/\\/psi.egovpt.org\\/types\\/long-name\"]],\"value\":\"Google Maps\",\"variants\":null},{\"itemIdentities\":null,\"type\":null,\"scopes\":[[\"http:\\/\\/psi.egovpt.org\\/types\\/long-name\"]],\"value\":\"Google Maps Application\",\"variants\":null}],\"occurrences\":[{\"itemIdentities\":null,\"type\":[\"http:\\/\\/psi.egovpt.org\\/types\\/description\"],\"scopes\":null,\"resourceRef\":null,\"resourceData\":{\"datatype\":\"http:\\/\\/www.w3.org\\/2001\\/XMLSchema#string\",\"value\":\"a popular geodata service that is widely used for mashups with geodataProbably not really conformant to ISO 19115, but who cares in this context.\"}},{\"itemIdentities\":null,\"type\":[\"http:\\/\\/psi.egovpt.org\\/types\\/links\"],\"scopes\":null,\"resourceRef\":\"http:\\/\\/maps.google.com\",\"resourceData\":null},{\"itemIdentities\":null,\"type\":[\"http:\\/\\/psi.egovpt.org\\/types\\/links\"],\"scopes\":null,\"resourceRef\":\"http:\\/\\/maps.google.de\",\"resourceData\":null}]}"))) |
---|
89 | (is (string= t301-string json-string)))) |
---|
90 | (let ((t100 (get-item-by-id "t100" :revision rev-0 :xtm-id *TEST-TM*))) |
---|
91 | (let ((t100-string (to-json-string t100 :revision rev-0 :xtm-id *TEST-TM*)) |
---|
92 | (json-string |
---|
93 | (concatenate 'string "{\"id\":\"" (topic-id t100) "\",\"itemIdentities\":[\"http:\\/\\/psi.egovpt.org\\/itemIdentifiers#t100\"],\"subjectLocators\":null,\"subjectIdentifiers\":[\"http:\\/\\/psi.egovpt.org\\/standard\\/ISO+19115%3A+Geographic+Information+-+Metadata\"],\"instanceOfs\":[[\"http:\\/\\/psi.egovpt.org\\/types\\/semanticstandard\"]],\"names\":[{\"itemIdentities\":[\"http:\\/\\/psi.egovpt.org\\/itemIdentifiers#t100_n1\"],\"type\":null,\"scopes\":null,\"value\":\"ISO 19115\",\"variants\":[{\"itemIdentities\":[\"http:\\/\\/psi.egovpt.org\\/itemIdentifiers#t100_n1_v1\"],\"scopes\":[[\"http:\\/\\/www.topicmaps.org\\/xtm\\/1.0\\/core.xtm#display\"]],\"resourceRef\":null,\"resourceData\":{\"datatype\":\"http:\\/\\/www.w3.org\\/2001\\/XMLSchema#string\",\"value\":\"Geographic Information - Metadata\"}},{\"itemIdentities\":[\"http:\\/\\/psi.egovpt.org\\/itemIdentifiers#t100_n1_v2\"],\"scopes\":[[\"http:\\/\\/www.topicmaps.org\\/xtm\\/1.0\\/core.xtm#sort\"]],\"resourceRef\":null,\"resourceData\":{\"datatype\":\"http:\\/\\/www.w3.org\\/2001\\/XMLSchema#string\",\"value\":\"ISO-19115\"}}]}],\"occurrences\":[{\"itemIdentities\":[\"http:\\/\\/psi.egovpt.org\\/itemIdentifiers#t100_o1\"],\"type\":[\"http:\\/\\/psi.egovpt.org\\/types\\/standardHasStatus\"],\"scopes\":null,\"resourceRef\":\"http:\\/\\/www.budabe.de\\/\",\"resourceData\":null},{\"itemIdentities\":[\"http:\\/\\/psi.egovpt.org\\/itemIdentifiers#t100_o2\"],\"type\":[\"http:\\/\\/psi.egovpt.org\\/types\\/description\"],\"scopes\":null,\"resourceRef\":null,\"resourceData\":{\"datatype\":\"http:\\/\\/www.w3.org\\/2001\\/XMLSchema#string\",\"value\":\"The ISO 19115 standard ...\"}},{\"itemIdentities\":[\"http:\\/\\/psi.egovpt.org\\/itemIdentifiers#t100_o3\"],\"type\":[\"http:\\/\\/psi.egovpt.org\\/types\\/standardValidFromDate\"],\"scopes\":null,\"resourceRef\":null,\"resourceData\":{\"datatype\":\"http:\\/\\/www.w3.org\\/2001\\/XMLSchema#date\",\"value\":\"2003-01-01\"}},{\"itemIdentities\":[\"http:\\/\\/psi.egovpt.org\\/itemIdentifiers#t100_o4\"],\"type\":[\"http:\\/\\/psi.egovpt.org\\/types\\/links\"],\"scopes\":null,\"resourceRef\":\"http:\\/\\/www.editeur.org\\/standards\\/ISO19115.pdf\",\"resourceData\":null}]}"))) |
---|
94 | (is (string= t100-string json-string)))))))) |
---|
95 | |
---|
96 | |
---|
97 | (test test-to-json-string-associations |
---|
98 | (let ((dir "data_base") |
---|
99 | (rev-0 0)) |
---|
100 | (with-fixture initialize-destination-db (dir) |
---|
101 | (xml-importer:setup-repository |
---|
102 | *notificationbase.xtm* dir :tm-id "http://www.isidor.us/unittests/testtm" |
---|
103 | :xtm-id *TEST-TM*) |
---|
104 | (elephant:open-store (xml-importer:get-store-spec dir)) |
---|
105 | (let ((t57 (get-item-by-id "t57" :revision rev-0 :xtm-id *TEST-TM*)) |
---|
106 | (t59 (get-item-by-id "t59" :revision rev-0 :xtm-id *TEST-TM*)) |
---|
107 | (t202 (get-item-by-id "t202" :revision rev-0 :xtm-id *TEST-TM*)) |
---|
108 | (t58 (get-item-by-id "t58" :revision rev-0 :xtm-id *TEST-TM*)) |
---|
109 | (t203 (get-item-by-id "t203" :revision rev-0 :xtm-id *TEST-TM*)) |
---|
110 | (t64 (get-item-by-id "t64" :revision rev-0 :xtm-id *TEST-TM*)) |
---|
111 | (t62 (get-item-by-id "t62" :revision rev-0 :xtm-id *TEST-TM*))) |
---|
112 | (let ((association-1 |
---|
113 | (loop for association in |
---|
114 | (elephant:get-instances-by-class 'AssociationC) |
---|
115 | when (and (eq t57 (instance-of association :revision rev-0)) |
---|
116 | (eq t59 (instance-of |
---|
117 | (first (roles association :revision rev-0)) |
---|
118 | :revision rev-0)) |
---|
119 | (eq t202 (player |
---|
120 | (first (roles association :revision rev-0)) |
---|
121 | :revision rev-0)) |
---|
122 | (eq t58 (instance-of |
---|
123 | (second (roles association :revision rev-0)) |
---|
124 | :revision rev-0)) |
---|
125 | (eq t203 (player |
---|
126 | (second (roles association :revision rev-0)) |
---|
127 | :revision rev-0))) |
---|
128 | return association)) |
---|
129 | (association-7 |
---|
130 | (identified-construct |
---|
131 | (elephant:get-instance-by-value |
---|
132 | 'ItemIdentifierC 'uri |
---|
133 | "http://psi.egovpt.org/itemIdentifiers#assoc_7") |
---|
134 | :revision rev-0))) |
---|
135 | (let ((association-1-string |
---|
136 | (to-json-string association-1 :revision rev-0 :xtm-id *TEST-TM*)) |
---|
137 | (json-string |
---|
138 | (concatenate 'string "{\"itemIdentities\":null,\"type\":[\"http:\\/\\/psi.egovpt.org\\/types\\/isNarrowerSubject\"],\"scopes\":null,\"roles\":[{\"itemIdentities\":null,\"type\":[\"http:\\/\\/psi.egovpt.org\\/types\\/broaderSubject\"],\"topicRef\":[\"http:\\/\\/psi.egovpt.org\\/subject\\/Data\"]},{\"itemIdentities\":null,\"type\":[\"http:\\/\\/psi.egovpt.org\\/types\\/narrowerSubject\"],\"topicRef\":[\"http:\\/\\/psi.egovpt.org\\/subject\\/GeoData\"]}]}"))) |
---|
139 | (is (string= association-1-string json-string))) |
---|
140 | (let ((association-7-string |
---|
141 | (to-json-string association-7 :revision rev-0 :xtm-id *TEST-TM*)) |
---|
142 | (json-string |
---|
143 | (concatenate 'string "{\"itemIdentities\":[\"http:\\/\\/psi.egovpt.org\\/itemIdentifiers#assoc_7\"],\"type\":[\"http:\\/\\/psi.egovpt.org\\/types\\/serviceUsesStandard\"],\"scopes\":null,\"roles\":[{\"itemIdentities\":null,\"type\":[\"http:\\/\\/psi.egovpt.org\\/types\\/ServiceRoleType\"],\"topicRef\":[\"http:\\/\\/psi.egovpt.org\\/service\\/Google+Maps\",\"http:\\/\\/maps.google.com\"]},{\"itemIdentities\":null,\"type\":[\"http:\\/\\/psi.egovpt.org\\/types\\/StandardRoleType\"],\"topicRef\":[\"http:\\/\\/psi.egovpt.org\\/standard\\/ISO+19115%3A+Geographic+Information+-+Metadata\"]}]}"))) |
---|
144 | (is (string= association-7-string json-string))) |
---|
145 | (let ((rev-1 (get-revision))) |
---|
146 | (delete-role association-7 (first (roles association-7 :revision 0)) |
---|
147 | :revision rev-1) |
---|
148 | (delete-role association-7 (first (roles association-7 :revision 0)) |
---|
149 | :revision rev-1) |
---|
150 | (delete-type association-7 (instance-of association-7 :revision 0) |
---|
151 | :revision rev-1) |
---|
152 | (add-theme association-7 t62 :revision rev-1) |
---|
153 | (add-theme association-7 t64 :revision rev-1)) |
---|
154 | (let ((association-7-string |
---|
155 | (to-json-string association-7 :revision rev-0 :xtm-id *TEST-TM*)) |
---|
156 | (json-string |
---|
157 | (concatenate 'string "{\"itemIdentities\":[\"http:\\/\\/psi.egovpt.org\\/itemIdentifiers#assoc_7\"],\"type\":null,\"scopes\":[[\"http:\\/\\/psi.egovpt.org\\/types\\/StandardRoleType\"],[\"http:\\/\\/psi.egovpt.org\\/types\\/serviceUsesStandard\"]],\"roles\":null}"))) |
---|
158 | (is (string= association-7-string json-string)))))))) |
---|
159 | |
---|
160 | |
---|
161 | (test test-to-json-string-fragments |
---|
162 | (let ((dir "data_base") |
---|
163 | (rev-0 0)) |
---|
164 | (with-fixture initialize-destination-db (dir) |
---|
165 | (xml-importer:setup-repository |
---|
166 | *notificationbase.xtm* dir :tm-id "http://www.isidor.us/unittests/testtm" |
---|
167 | :xtm-id *TEST-TM*) |
---|
168 | (elephant:open-store (xml-importer:get-store-spec dir)) |
---|
169 | (let ((frag-t100 |
---|
170 | (create-latest-fragment-of-topic |
---|
171 | "http://psi.egovpt.org/standard/ISO+19115%3A+Geographic+Information+-+Metadata")) |
---|
172 | (frag-topic |
---|
173 | (create-latest-fragment-of-topic "http://www.topicmaps.org/xtm/1.0/core.xtm#topic"))) |
---|
174 | (let ((frag-t100-string |
---|
175 | (concatenate 'string "{\"topic\":{\"id\":\"" (d:topic-id (d:topic frag-t100)) "\",\"itemIdentities\":[\"http:\\/\\/psi.egovpt.org\\/itemIdentifiers#t100\"],\"subjectLocators\":null,\"subjectIdentifiers\":[\"http:\\/\\/psi.egovpt.org\\/standard\\/ISO+19115%3A+Geographic+Information+-+Metadata\"],\"instanceOfs\":[[\"http:\\/\\/psi.egovpt.org\\/types\\/semanticstandard\"]],\"names\":[{\"itemIdentities\":[\"http:\\/\\/psi.egovpt.org\\/itemIdentifiers#t100_n1\"],\"type\":null,\"scopes\":null,\"value\":\"ISO 19115\",\"variants\":[{\"itemIdentities\":[\"http:\\/\\/psi.egovpt.org\\/itemIdentifiers#t100_n1_v1\"],\"scopes\":[[\"http:\\/\\/www.topicmaps.org\\/xtm\\/1.0\\/core.xtm#display\"]],\"resourceRef\":null,\"resourceData\":{\"datatype\":\"http:\\/\\/www.w3.org\\/2001\\/XMLSchema#string\",\"value\":\"Geographic Information - Metadata\"}},{\"itemIdentities\":[\"http:\\/\\/psi.egovpt.org\\/itemIdentifiers#t100_n1_v2\"],\"scopes\":[[\"http:\\/\\/www.topicmaps.org\\/xtm\\/1.0\\/core.xtm#sort\"]],\"resourceRef\":null,\"resourceData\":{\"datatype\":\"http:\\/\\/www.w3.org\\/2001\\/XMLSchema#string\",\"value\":\"ISO-19115\"}}]}],\"occurrences\":[{\"itemIdentities\":[\"http:\\/\\/psi.egovpt.org\\/itemIdentifiers#t100_o1\"],\"type\":[\"http:\\/\\/psi.egovpt.org\\/types\\/standardHasStatus\"],\"scopes\":null,\"resourceRef\":\"http:\\/\\/www.budabe.de\\/\",\"resourceData\":null},{\"itemIdentities\":[\"http:\\/\\/psi.egovpt.org\\/itemIdentifiers#t100_o2\"],\"type\":[\"http:\\/\\/psi.egovpt.org\\/types\\/description\"],\"scopes\":null,\"resourceRef\":null,\"resourceData\":{\"datatype\":\"http:\\/\\/www.w3.org\\/2001\\/XMLSchema#string\",\"value\":\"The ISO 19115 standard ...\"}},{\"itemIdentities\":[\"http:\\/\\/psi.egovpt.org\\/itemIdentifiers#t100_o3\"],\"type\":[\"http:\\/\\/psi.egovpt.org\\/types\\/standardValidFromDate\"],\"scopes\":null,\"resourceRef\":null,\"resourceData\":{\"datatype\":\"http:\\/\\/www.w3.org\\/2001\\/XMLSchema#date\",\"value\":\"2003-01-01\"}},{\"itemIdentities\":[\"http:\\/\\/psi.egovpt.org\\/itemIdentifiers#t100_o4\"],\"type\":[\"http:\\/\\/psi.egovpt.org\\/types\\/links\"],\"scopes\":null,\"resourceRef\":\"http:\\/\\/www.editeur.org\\/standards\\/ISO19115.pdf\",\"resourceData\":null}]},\"topicStubs\":[{\"id\":\"" (topic-id (elt (referenced-topics frag-t100) 0)) "\",\"itemIdentities\":[\"http:\\/\\/psi.egovpt.org\\/itemIdentifiers#t3a\"],\"subjectLocators\":null,\"subjectIdentifiers\":[\"http:\\/\\/psi.egovpt.org\\/types\\/semanticstandard\"]},{\"id\":\"" (topic-id (elt (referenced-topics frag-t100) 1)) "\",\"itemIdentities\":null,\"subjectLocators\":null,\"subjectIdentifiers\":[\"http:\\/\\/www.topicmaps.org\\/xtm\\/1.0\\/core.xtm#display\"]},{\"id\":\"" (topic-id (elt (referenced-topics frag-t100) 2)) "\",\"itemIdentities\":null,\"subjectLocators\":null,\"subjectIdentifiers\":[\"http:\\/\\/www.topicmaps.org\\/xtm\\/1.0\\/core.xtm#sort\"]},{\"id\":\"" (topic-id (elt (referenced-topics frag-t100) 3)) "\",\"itemIdentities\":[\"http:\\/\\/psi.egovpt.org\\/itemIdentifiers#t51\"],\"subjectLocators\":null,\"subjectIdentifiers\":[\"http:\\/\\/psi.egovpt.org\\/types\\/standardHasStatus\"]},{\"id\":\"" (topic-id (elt (referenced-topics frag-t100) 4)) "\",\"itemIdentities\":[\"http:\\/\\/psi.egovpt.org\\/itemIdentifiers#t53\"],\"subjectLocators\":null,\"subjectIdentifiers\":[\"http:\\/\\/psi.egovpt.org\\/types\\/description\"]},{\"id\":\"" (topic-id (elt (referenced-topics frag-t100) 5)) "\",\"itemIdentities\":[\"http:\\/\\/psi.egovpt.org\\/itemIdentifiers#t54\"],\"subjectLocators\":null,\"subjectIdentifiers\":[\"http:\\/\\/psi.egovpt.org\\/types\\/standardValidFromDate\"]},{\"id\":\"" (topic-id (elt (referenced-topics frag-t100) 6)) "\",\"itemIdentities\":[\"http:\\/\\/psi.egovpt.org\\/itemIdentifiers#t55\"],\"subjectLocators\":null,\"subjectIdentifiers\":[\"http:\\/\\/psi.egovpt.org\\/types\\/links\"]},{\"id\":\"" (topic-id (elt (referenced-topics frag-t100) 7)) "\",\"itemIdentities\":null,\"subjectLocators\":null,\"subjectIdentifiers\":[\"http:\\/\\/psi.egovpt.org\\/subject\\/GeoData\"]},{\"id\":\"" (topic-id (elt (referenced-topics frag-t100) 8)) "\",\"itemIdentities\":[\"http:\\/\\/psi.egovpt.org\\/itemIdentifiers#t60\"],\"subjectLocators\":null,\"subjectIdentifiers\":[\"http:\\/\\/psi.egovpt.org\\/types\\/standardIsAboutSubject\"]},{\"id\":\"" (topic-id (elt (referenced-topics frag-t100) 9)) "\",\"itemIdentities\":[\"http:\\/\\/psi.egovpt.org\\/itemIdentifiers#t61\"],\"subjectLocators\":null,\"subjectIdentifiers\":[\"http:\\/\\/psi.egovpt.org\\/types\\/SubjectRoleType\"]},{\"id\":\"" (topic-id (elt (referenced-topics frag-t100) 10)) "\",\"itemIdentities\":null,\"subjectLocators\":null,\"subjectIdentifiers\":[\"http:\\/\\/psi.egovpt.org\\/subject\\/Semantic+Description\"]},{\"id\":\"" (topic-id (elt (referenced-topics frag-t100) 11)) "\",\"itemIdentities\":[\"http:\\/\\/psi.egovpt.org\\/itemIdentifiers#t64\"],\"subjectLocators\":null,\"subjectIdentifiers\":[\"http:\\/\\/psi.egovpt.org\\/types\\/serviceUsesStandard\"]},{\"id\":\"" (topic-id (elt (referenced-topics frag-t100) 12)) "\",\"itemIdentities\":[\"http:\\/\\/psi.egovpt.org\\/itemIdentifiers#t63\"],\"subjectLocators\":null,\"subjectIdentifiers\":[\"http:\\/\\/psi.egovpt.org\\/types\\/ServiceRoleType\"]},{\"id\":\"" (topic-id (elt (referenced-topics frag-t100) 13)) "\",\"itemIdentities\":null,\"subjectLocators\":null,\"subjectIdentifiers\":[\"http:\\/\\/psi.egovpt.org\\/service\\/Google+Maps\",\"http:\\/\\/maps.google.com\"]},{\"id\":\"" (topic-id (elt (referenced-topics frag-t100) 14)) "\",\"itemIdentities\":[\"http:\\/\\/psi.egovpt.org\\/itemIdentifiers#t62\"],\"subjectLocators\":null,\"subjectIdentifiers\":[\"http:\\/\\/psi.egovpt.org\\/types\\/StandardRoleType\"]}],\"associations\":[{\"itemIdentities\":null,\"type\":[\"http:\\/\\/psi.egovpt.org\\/types\\/standardIsAboutSubject\"],\"scopes\":null,\"roles\":[{\"itemIdentities\":null,\"type\":[\"http:\\/\\/psi.egovpt.org\\/types\\/StandardRoleType\"],\"topicRef\":[\"http:\\/\\/psi.egovpt.org\\/standard\\/ISO+19115%3A+Geographic+Information+-+Metadata\"]},{\"itemIdentities\":null,\"type\":[\"http:\\/\\/psi.egovpt.org\\/types\\/SubjectRoleType\"],\"topicRef\":[\"http:\\/\\/psi.egovpt.org\\/subject\\/GeoData\"]}]},{\"itemIdentities\":null,\"type\":[\"http:\\/\\/psi.egovpt.org\\/types\\/standardIsAboutSubject\"],\"scopes\":null,\"roles\":[{\"itemIdentities\":null,\"type\":[\"http:\\/\\/psi.egovpt.org\\/types\\/StandardRoleType\"],\"topicRef\":[\"http:\\/\\/psi.egovpt.org\\/standard\\/ISO+19115%3A+Geographic+Information+-+Metadata\"]},{\"itemIdentities\":null,\"type\":[\"http:\\/\\/psi.egovpt.org\\/types\\/SubjectRoleType\"],\"topicRef\":[\"http:\\/\\/psi.egovpt.org\\/subject\\/Semantic+Description\"]}]},{\"itemIdentities\":[\"http:\\/\\/psi.egovpt.org\\/itemIdentifiers#assoc_7\"],\"type\":[\"http:\\/\\/psi.egovpt.org\\/types\\/serviceUsesStandard\"],\"scopes\":null,\"roles\":[{\"itemIdentities\":null,\"type\":[\"http:\\/\\/psi.egovpt.org\\/types\\/ServiceRoleType\"],\"topicRef\":[\"http:\\/\\/psi.egovpt.org\\/service\\/Google+Maps\",\"http:\\/\\/maps.google.com\"]},{\"itemIdentities\":null,\"type\":[\"http:\\/\\/psi.egovpt.org\\/types\\/StandardRoleType\"],\"topicRef\":[\"http:\\/\\/psi.egovpt.org\\/standard\\/ISO+19115%3A+Geographic+Information+-+Metadata\"]}]}],\"tmIds\":[\"http:\\/\\/www.isidor.us\\/unittests\\/testtm\"]}")) |
---|
176 | (frag-topic-string |
---|
177 | (concatenate 'string "{\"topic\":{\"id\":\"" (topic-id (topic frag-topic)) "\",\"itemIdentities\":null,\"subjectLocators\":null,\"subjectIdentifiers\":[\"http:\\/\\/www.topicmaps.org\\/xtm\\/1.0\\/core.xtm#topic\"],\"instanceOfs\":null,\"names\":null,\"occurrences\":null},\"topicStubs\":null,\"associations\":null,\"tmIds\":[\"http:\\/\\/www.topicmaps.org\\/xtm\\/1.0\\/core.xtm\"]}"))) |
---|
178 | (is (string= |
---|
179 | frag-t100-string |
---|
180 | (to-json-string frag-t100 :xtm-id *TEST-TM* :revision rev-0))) |
---|
181 | (is (string= |
---|
182 | frag-topic-string |
---|
183 | (to-json-string frag-topic :xtm-id *TEST-TM* :revision rev-0)))))))) |
---|
184 | |
---|
185 | |
---|
186 | (test test-get-fragment-values-from-json-list-general |
---|
187 | (let ((dir "data_base") |
---|
188 | (rev-0 0)) |
---|
189 | (with-fixture initialize-destination-db (dir) |
---|
190 | (xml-importer:setup-repository |
---|
191 | *notificationbase.xtm* dir :tm-id "http://www.isidor.us/unittests/testtm" |
---|
192 | :xtm-id *TEST-TM*) |
---|
193 | (elephant:open-store (xml-importer:get-store-spec dir)) |
---|
194 | (let ((json-fragment |
---|
195 | (let ((fragment-obj |
---|
196 | (create-latest-fragment-of-topic "http://psi.egovpt.org/standard/Topic+Maps+2002"))) |
---|
197 | (to-json-string fragment-obj :revision rev-0 :xtm-id *TEST-TM*)))) |
---|
198 | (let ((fragment-list |
---|
199 | (json-importer::get-fragment-values-from-json-list |
---|
200 | (json:decode-json-from-string json-fragment)))) |
---|
201 | (let ((topic (getf fragment-list :topic))) |
---|
202 | (is (string= (getf topic :ID) |
---|
203 | (d:topic-id |
---|
204 | (d:identified-construct |
---|
205 | (elephant:get-instance-by-value |
---|
206 | 'd:PersistentIdC 'd:uri |
---|
207 | "http://psi.egovpt.org/standard/Topic+Maps+2002") |
---|
208 | :revision rev-0)))) |
---|
209 | (is-false (getf topic :itemIdentities)) |
---|
210 | (is-false (getf topic :subjectLocators)) |
---|
211 | (is (= (length (getf topic :subjectIdentifiers)) 1)) |
---|
212 | (is (string= (first (getf topic :subjectIdentifiers)) |
---|
213 | "http://psi.egovpt.org/standard/Topic+Maps+2002")) |
---|
214 | (is (= (length (getf topic :instanceOfs)) 1)) |
---|
215 | (is (= (length (first (getf topic :instanceOfs))) 1)) |
---|
216 | (is (string= (first (first (getf topic :instanceOfs))) |
---|
217 | "http://psi.egovpt.org/types/semanticstandard")))))))) |
---|
218 | |
---|
219 | |
---|
220 | (test test-get-fragment-values-from-json-list-names |
---|
221 | (let ((dir "data_base") |
---|
222 | (rev-0 0)) |
---|
223 | (with-fixture initialize-destination-db (dir) |
---|
224 | (xml-importer:setup-repository |
---|
225 | *notificationbase.xtm* dir :tm-id "http://www.isidor.us/unittests/testtm" |
---|
226 | :xtm-id *TEST-TM*) |
---|
227 | (elephant:open-store (xml-importer:get-store-spec dir)) |
---|
228 | (let ((json-fragment |
---|
229 | (let ((fragment-obj |
---|
230 | (create-latest-fragment-of-topic "http://psi.egovpt.org/standard/Topic+Maps+2002"))) |
---|
231 | (to-json-string fragment-obj :revision rev-0 :xtm-id *TEST-TM*)))) |
---|
232 | (let ((fragment-list |
---|
233 | (json-importer::get-fragment-values-from-json-list |
---|
234 | (json:decode-json-from-string json-fragment)))) |
---|
235 | (let ((topic (getf fragment-list :topic))) |
---|
236 | (is (= (length (getf topic :names)) 2)) |
---|
237 | (let ((name-1 (first (getf topic :names))) |
---|
238 | (name-2 (second (getf topic :names)))) |
---|
239 | (is-false (getf name-1 :itemIdentities)) |
---|
240 | (is-false (getf name-1 :type)) |
---|
241 | (is-false (getf name-1 :scopes)) |
---|
242 | (is (string= (getf name-1 :value) |
---|
243 | "Topic Maps 2002")) |
---|
244 | (is-false (getf name-1 :variants)) |
---|
245 | (is (= (length (getf name-2 :itemIdentities)) 1)) |
---|
246 | (is (string= (first (getf name-2 :itemIdentities)) |
---|
247 | "http://psi.egovpt.org/itemIdentifiers#t101_n2")) |
---|
248 | (is (= (length (getf name-2 :type)) 1)) |
---|
249 | (is (string= (first (getf name-2 :type)) |
---|
250 | "http://psi.egovpt.org/types/long-name")) |
---|
251 | (is (= (length (getf name-2 :scopes)) 1)) |
---|
252 | (is (= (length (first (getf name-2 :scopes))) 1)) |
---|
253 | (is (string= (first (first (getf name-2 :scopes))) |
---|
254 | "http://psi.egovpt.org/types/long-name")) |
---|
255 | (is (string= (getf name-2 :value) |
---|
256 | "ISO/IEC 13250:2002: Topic Maps")) |
---|
257 | (is (= (length (getf name-2 :variants)) 1)) |
---|
258 | (let ((variant (first (getf name-2 :variants)))) |
---|
259 | (is (= (length (getf variant :itemIdentities)) 2)) |
---|
260 | (is (or (string= (first (getf variant :itemIdentities)) |
---|
261 | "http://psi.egovpt.org/itemIdentifiers#t101_n2_v1") |
---|
262 | (string= (first (getf variant :itemIdentities)) |
---|
263 | "http://psi.egovpt.org/itemIdentifiers#t101_n2_v2"))) |
---|
264 | (is (or (string= (second (getf variant :itemIdentities)) |
---|
265 | "http://psi.egovpt.org/itemIdentifiers#t101_n2_v1") |
---|
266 | (string= (second (getf variant :itemIdentities)) |
---|
267 | "http://psi.egovpt.org/itemIdentifiers#t101_n2_v2"))) |
---|
268 | (is (= (length (getf variant :scopes)) 2)) |
---|
269 | (is (= (length (first (getf variant :scopes))) 1)) |
---|
270 | (is (= (length (second (getf variant :scopes))) 1)) |
---|
271 | (is (or (string= (first (first (getf variant :scopes))) |
---|
272 | "http://www.topicmaps.org/xtm/1.0/core.xtm#sort") |
---|
273 | (string= (first (first (getf variant :scopes))) |
---|
274 | "http://psi.egovpt.org/types/long-name"))) |
---|
275 | (is (or (string= (first (second (getf variant :scopes))) |
---|
276 | "http://www.topicmaps.org/xtm/1.0/core.xtm#sort") |
---|
277 | (string= (first (second (getf variant :scopes))) |
---|
278 | "http://psi.egovpt.org/types/long-name"))) |
---|
279 | (is-false (getf variant :resourceRef)) |
---|
280 | (is (string= (getf (getf variant :resourceData) :datatype) |
---|
281 | "http://www.w3.org/2001/XMLSchema#string")) |
---|
282 | (is (string= (getf (getf variant :resourceData) :value) |
---|
283 | "ISO/IEC-13250:2002")))))))))) |
---|
284 | |
---|
285 | |
---|
286 | (test test-get-fragment-values-from-json-list-occurrences |
---|
287 | (let ((dir "data_base") |
---|
288 | (rev-0 0)) |
---|
289 | (with-fixture initialize-destination-db (dir) |
---|
290 | (xml-importer:setup-repository |
---|
291 | *notificationbase.xtm* dir :tm-id "http://www.isidor.us/unittests/testtm" |
---|
292 | :xtm-id *TEST-TM*) |
---|
293 | (elephant:open-store (xml-importer:get-store-spec dir)) |
---|
294 | (let ((json-fragment |
---|
295 | (let ((fragment-obj |
---|
296 | (create-latest-fragment-of-topic "http://psi.egovpt.org/standard/Topic+Maps+2002"))) |
---|
297 | (to-json-string fragment-obj :revision rev-0 :xtm-id *TEST-TM*)))) |
---|
298 | (let ((fragment-list |
---|
299 | (json-importer::get-fragment-values-from-json-list |
---|
300 | (json:decode-json-from-string json-fragment)))) |
---|
301 | (let ((topic (getf fragment-list :topic))) |
---|
302 | (is (= (length (getf topic :occurrences)) 4)) |
---|
303 | (let ((occurrence-1 (first (getf topic :occurrences))) |
---|
304 | (occurrence-2 (second (getf topic :occurrences))) |
---|
305 | (occurrence-3 (third (getf topic :occurrences))) |
---|
306 | (occurrence-4 (fourth (getf topic :occurrences))) |
---|
307 | (ref-topic |
---|
308 | (d:identified-construct |
---|
309 | (elephant:get-instance-by-value 'd:PersistentIdC 'd:uri |
---|
310 | "http://psi.egovpt.org/status/InternationalStandard")))) |
---|
311 | (is-false (getf occurrence-1 :itemIdentities)) |
---|
312 | (is (= (length (getf occurrence-1 :type)) 1)) |
---|
313 | (is (string= (first (getf occurrence-1 :type)) |
---|
314 | "http://psi.egovpt.org/types/standardHasStatus")) |
---|
315 | (is-false (getf occurrence-1 :scopes)) |
---|
316 | (is (string= (getf occurrence-1 :resourceRef) |
---|
317 | (concatenate 'string "#" (d:topic-id ref-topic)))) |
---|
318 | (is-false (getf occurrence-1 :resourceData)) |
---|
319 | (is-false (getf occurrence-2 :itemIdentities)) |
---|
320 | (is (= (length (getf occurrence-2 :type)) 1)) |
---|
321 | (is (string= (first (getf occurrence-2 :type)) |
---|
322 | "http://psi.egovpt.org/types/description")) |
---|
323 | (is-false (getf occurrence-2 :scopes)) |
---|
324 | (is-false (getf occurrence-2 :resourceRef)) |
---|
325 | (is (string= (getf (getf occurrence-2 :resourceData) :datatype) |
---|
326 | "http://www.w3.org/2001/XMLSchema#string")) |
---|
327 | (is-true (getf (getf occurrence-2 :resourceData) :value)) |
---|
328 | (is-false (getf occurrence-3 :itemIdentities)) |
---|
329 | (is (= (length (getf occurrence-3 :type)) 1)) |
---|
330 | (is (string= (first (getf occurrence-3 :type)) |
---|
331 | "http://psi.egovpt.org/types/standardValidFromDate")) |
---|
332 | (is-false (getf occurrence-3 :scopes)) |
---|
333 | (is-false (getf occurrence-3 :resourceRef)) |
---|
334 | (is (string= (getf (getf occurrence-3 :resourceData) :datatype) |
---|
335 | "//www.w3.org/2001/XMLSchema#date")) |
---|
336 | (is (string= (getf (getf occurrence-3 :resourceData) :value) |
---|
337 | "2002-05-19")) |
---|
338 | (is-false (getf occurrence-4 :itemIdentities)) |
---|
339 | (is (= (length (getf occurrence-4 :type)) 1)) |
---|
340 | (is (string= (first (getf occurrence-4 :type)) |
---|
341 | "http://psi.egovpt.org/types/links")) |
---|
342 | (is-false (getf occurrence-4 :scopes)) |
---|
343 | (is (string= (getf occurrence-4 :resourceRef) |
---|
344 | "http://www1.y12.doe.gov/capabilities/sgml/sc34/document/0322_files/iso13250-2nd-ed-v2.pdf")) |
---|
345 | (is-false (getf occurrence-4 :resourceData))))))))) |
---|
346 | |
---|
347 | |
---|
348 | (test test-get-fragment-values-from-json-list-topicStubs |
---|
349 | (let ((dir "data_base") |
---|
350 | (rev-0 0)) |
---|
351 | (with-fixture initialize-destination-db (dir) |
---|
352 | (xml-importer:setup-repository |
---|
353 | *notificationbase.xtm* dir :tm-id "http://www.isidor.us/unittests/testtm" |
---|
354 | :xtm-id *TEST-TM*) |
---|
355 | (elephant:open-store (xml-importer:get-store-spec dir)) |
---|
356 | (let ((json-fragment |
---|
357 | (let ((fragment-obj |
---|
358 | (create-latest-fragment-of-topic "http://psi.egovpt.org/standard/Topic+Maps+2002"))) |
---|
359 | (to-json-string fragment-obj :revision rev-0 :xtm-id *TEST-TM*)))) |
---|
360 | (let ((fragment-list |
---|
361 | (json-importer::get-fragment-values-from-json-list |
---|
362 | (json:decode-json-from-string json-fragment)))) |
---|
363 | (let ((topicStubs (getf fragment-list :topicStubs))) |
---|
364 | (is (= (length topicStubs) 15)) |
---|
365 | (loop for topicStub in topicStubs |
---|
366 | do (let ((id (getf topicStub :ID)) |
---|
367 | (itemIdentities (getf topicStub :itemIdentities)) |
---|
368 | (subjectLocators (getf topicStub :subjectLocators)) |
---|
369 | (subjectIdentifiers (getf topicStub :subjectIdentifiers))) |
---|
370 | (is (= (length subjectIdentifiers) 1)) |
---|
371 | (let ((subjectIdentifier |
---|
372 | (first subjectIdentifiers))) |
---|
373 | (let ((topic |
---|
374 | (d:identified-construct |
---|
375 | (elephant:get-instance-by-value 'd:PersistentIdC 'd:uri |
---|
376 | subjectIdentifier)))) |
---|
377 | (is-true topic) |
---|
378 | (is-false subjectLocators) |
---|
379 | (is (string= (d:topic-id topic) id)) |
---|
380 | (cond |
---|
381 | ((string= subjectIdentifier |
---|
382 | "http://psi.egovpt.org/types/semanticstandard") |
---|
383 | (is (= (length itemIdentities) 1)) |
---|
384 | (is (string= (first itemIdentities) |
---|
385 | "http://psi.egovpt.org/itemIdentifiers#t3a"))) |
---|
386 | ((string= subjectIdentifier |
---|
387 | "http://www.topicmaps.org/xtm/1.0/core.xtm#sort") |
---|
388 | (is-false itemIdentities)) |
---|
389 | ((string= subjectIdentifier |
---|
390 | "http://psi.egovpt.org/types/long-name") |
---|
391 | (is (= (length itemIdentities) 1)) |
---|
392 | (is (string= (first itemIdentities) |
---|
393 | "http://psi.egovpt.org/itemIdentifiers#t50a"))) |
---|
394 | ((string= subjectIdentifier |
---|
395 | "http://psi.egovpt.org/types/standardHasStatus") |
---|
396 | (is (= (length itemIdentities) 1)) |
---|
397 | (is (string= (first itemIdentities) |
---|
398 | "http://psi.egovpt.org/itemIdentifiers#t51"))) |
---|
399 | ((string= subjectIdentifier |
---|
400 | "http://psi.egovpt.org/types/description") |
---|
401 | (is (= (length itemIdentities) 1)) |
---|
402 | (is (string= (first itemIdentities) |
---|
403 | "http://psi.egovpt.org/itemIdentifiers#t53"))) |
---|
404 | ((string= subjectIdentifier |
---|
405 | "http://psi.egovpt.org/types/standardValidFromDate") |
---|
406 | (is (= (length itemIdentities) 1)) |
---|
407 | (is (string= (first itemIdentities) |
---|
408 | "http://psi.egovpt.org/itemIdentifiers#t54"))) |
---|
409 | ((string= subjectIdentifier |
---|
410 | "http://psi.egovpt.org/types/links") |
---|
411 | (is (= (length itemIdentities) 1)) |
---|
412 | (is (string= (first itemIdentities) |
---|
413 | "http://psi.egovpt.org/itemIdentifiers#t55"))) |
---|
414 | ((string= subjectIdentifier |
---|
415 | "http://psi.egovpt.org/types/standardIsAboutSubject") |
---|
416 | (is (= (length itemIdentities) 1)) |
---|
417 | (is (string= (first itemIdentities) |
---|
418 | "http://psi.egovpt.org/itemIdentifiers#t60"))) |
---|
419 | ((string= subjectIdentifier "http://psi.egovpt.org/types/SubjectRoleType") |
---|
420 | (is (= (length itemIdentities) 1)) |
---|
421 | (is (string= (first itemIdentities) |
---|
422 | "http://psi.egovpt.org/itemIdentifiers#t61"))) |
---|
423 | ((string= subjectIdentifier |
---|
424 | "http://psi.egovpt.org/subject/Semantic+Description") |
---|
425 | (is-false itemIdentities)) |
---|
426 | ((string= subjectIdentifier |
---|
427 | "http://psi.egovpt.org/types/serviceUsesStandard") |
---|
428 | (is (= (length itemIdentities) 1)) |
---|
429 | (is (string= (first itemIdentities) |
---|
430 | "http://psi.egovpt.org/itemIdentifiers#t64"))) |
---|
431 | ((string= subjectIdentifier |
---|
432 | "http://psi.egovpt.org/types/ServiceRoleType") |
---|
433 | (is (= (length itemIdentities) 1)) |
---|
434 | (is (string= (first itemIdentities) |
---|
435 | "http://psi.egovpt.org/itemIdentifiers#t63"))) |
---|
436 | ((string= subjectIdentifier |
---|
437 | "http://psi.egovpt.org/service/Norwegian+National+Curriculum") |
---|
438 | (is-false itemIdentities)) |
---|
439 | ((string= subjectIdentifier |
---|
440 | "http://psi.egovpt.org/types/StandardRoleType") |
---|
441 | (is (= (length itemIdentities) 1)) |
---|
442 | (is (string= (first itemIdentities) |
---|
443 | "http://psi.egovpt.org/itemIdentifiers#t62"))) |
---|
444 | ((string= subjectIdentifier |
---|
445 | "http://psi.egovpt.org/status/InternationalStandard") |
---|
446 | (is (= (length itemIdentities) 1)) |
---|
447 | (is (string= (first itemIdentities) |
---|
448 | "http://psi.egovpt.org/itemIdentifiers#t52"))) |
---|
449 | (t |
---|
450 | (is-true (format t "bad subjectIdentifier found in topicStubs")))))))))))))) |
---|
451 | |
---|
452 | |
---|
453 | |
---|
454 | (test test-get-fragment-values-from-json-list-associations |
---|
455 | (let ((dir "data_base") |
---|
456 | (rev-0 0)) |
---|
457 | (with-fixture initialize-destination-db (dir) |
---|
458 | (xml-importer:setup-repository |
---|
459 | *notificationbase.xtm* dir :tm-id "http://www.isidor.us/unittests/testtm" |
---|
460 | :xtm-id *TEST-TM*) |
---|
461 | (elephant:open-store (xml-importer:get-store-spec dir)) |
---|
462 | (let ((json-fragment |
---|
463 | (let ((fragment-obj |
---|
464 | (create-latest-fragment-of-topic "http://psi.egovpt.org/standard/Topic+Maps+2002"))) |
---|
465 | (to-json-string fragment-obj :revision rev-0 :xtm-id *TEST-TM*)))) |
---|
466 | (let ((fragment-list |
---|
467 | (json-importer::get-fragment-values-from-json-list |
---|
468 | (json:decode-json-from-string json-fragment)))) |
---|
469 | (let ((f-associations (getf fragment-list :associations))) |
---|
470 | (is (= (length f-associations) 2)) |
---|
471 | (is (= (length (getf (first f-associations) :type)) 1)) |
---|
472 | (is (= (length (getf (second f-associations) :type)) 1)) |
---|
473 | (let ((association-1 |
---|
474 | (if (string= (first (getf (first f-associations) :type)) |
---|
475 | "http://psi.egovpt.org/types/standardIsAboutSubject") |
---|
476 | (first f-associations) |
---|
477 | (second f-associations))) |
---|
478 | (association-2 |
---|
479 | (if (string= (first (getf (first f-associations) :type)) |
---|
480 | "http://psi.egovpt.org/types/serviceUsesStandard") |
---|
481 | (first f-associations) |
---|
482 | (second f-associations)))) |
---|
483 | (is-true association-1) |
---|
484 | (is-true association-2) |
---|
485 | (is-false (getf association-1 :itemIdentities)) |
---|
486 | (is-false (getf association-1 :scopes)) |
---|
487 | (is (= (length (getf association-1 :roles)) 2)) |
---|
488 | (let ((role-1 (first (getf association-1 :roles))) |
---|
489 | (role-2 (second (getf association-1 :roles)))) |
---|
490 | (is-false (getf role-1 :itemIdentities)) |
---|
491 | (is (= (length (getf role-1 :type)))) |
---|
492 | (is (string= (first (getf role-1 :type)) |
---|
493 | "http://psi.egovpt.org/types/StandardRoleType")) |
---|
494 | (is (= (length (getf role-1 :topicRef)) 1)) |
---|
495 | (is (string= (first (getf role-1 :topicRef)) |
---|
496 | "http://psi.egovpt.org/standard/Topic+Maps+2002")) |
---|
497 | (is-false (getf role-2 :itemIdentities)) |
---|
498 | (is (= (length (getf role-2 :itemIdentities)))) |
---|
499 | (is (string= (first (getf role-2 :type)) |
---|
500 | "http://psi.egovpt.org/types/SubjectRoleType")) |
---|
501 | (is (= (length (getf role-2 :topicRef)) 1)) |
---|
502 | (is (string= (first (getf role-2 :topicRef)) |
---|
503 | "http://psi.egovpt.org/subject/Semantic+Description"))) |
---|
504 | (is-false (getf association-2 :itemIdentities)) |
---|
505 | (is-false (getf association-2 :scopes)) |
---|
506 | (is (= (length (getf association-2 :roles)) 2)) |
---|
507 | (let ((role-1 (first (getf association-2 :roles))) |
---|
508 | (role-2 (second (getf association-2 :roles)))) |
---|
509 | (is-false (getf role-1 :itemIdentities)) |
---|
510 | (is (= (length (getf role-1 :type)))) |
---|
511 | (is (string= (first (getf role-1 :type)) |
---|
512 | "http://psi.egovpt.org/types/ServiceRoleType")) |
---|
513 | (is (= (length (getf role-1 :topicRef)) 1)) |
---|
514 | (is (string= (first (getf role-1 :topicRef)) |
---|
515 | "http://psi.egovpt.org/service/Norwegian+National+Curriculum")) |
---|
516 | (is-false (getf role-2 :itemIdentities)) |
---|
517 | (is (= (length (getf role-2 :itemIdentities)))) |
---|
518 | (is (string= (first (getf role-2 :type)) |
---|
519 | "http://psi.egovpt.org/types/StandardRoleType")) |
---|
520 | (is (= (length (getf role-2 :topicRef)) 1)) |
---|
521 | (is (string= (first (getf role-2 :topicRef)) |
---|
522 | "http://psi.egovpt.org/standard/Topic+Maps+2002")))))))))) |
---|
523 | |
---|
524 | |
---|
525 | (test test-json-importer-general-1 |
---|
526 | (let ((dir "data_base")) |
---|
527 | (with-fixture initialize-destination-db (dir) |
---|
528 | (elephant:open-store (xml-importer:get-store-spec dir)) |
---|
529 | (xml-importer:init-isidorus) |
---|
530 | (is (= (length (elephant:get-instances-by-class 'TopicC)) 13)) |
---|
531 | (is (= (length (elephant:get-instances-by-class 'AssociationC)) 0)) |
---|
532 | (is (= (length (elephant:get-instances-by-class 'TopicMapC)) 1)) |
---|
533 | (json-importer:json-to-elem *t64*) |
---|
534 | (is (= (length (elephant:get-instances-by-class 'TopicC)) 15)) |
---|
535 | (is (= (length (elephant:get-instances-by-class 'AssociationC)) 1)) |
---|
536 | (is (= (length (elephant:get-instances-by-class 'TopicMapC)) 2)) |
---|
537 | (let ((core-tm |
---|
538 | (loop for tm in (elephant:get-instances-by-class 'TopicMapC) |
---|
539 | when (string= (uri (first (item-identifiers tm))) |
---|
540 | "http://www.topicmaps.org/xtm/1.0/core.xtm") |
---|
541 | return tm)) |
---|
542 | (test-tm |
---|
543 | (loop for tm in (elephant:get-instances-by-class 'TopicMapC) |
---|
544 | when (string= (uri (first (item-identifiers tm))) |
---|
545 | "http://www.isidor.us/unittests/testtm") |
---|
546 | return tm))) |
---|
547 | (is-true (and core-tm test-tm)) |
---|
548 | (is (= (length (topics core-tm)) 13)) |
---|
549 | (is (= (length (associations core-tm)) 0)) |
---|
550 | (is (= (length (topics test-tm)) 2)) |
---|
551 | (is (= (length (associations test-tm)) 1)))))) |
---|
552 | |
---|
553 | |
---|
554 | (test test-json-importer-general-2 |
---|
555 | (let ((dir "data_base")) |
---|
556 | (with-fixture initialize-destination-db (dir) |
---|
557 | (elephant:open-store (xml-importer:get-store-spec dir)) |
---|
558 | (xml-importer:init-isidorus) |
---|
559 | (json-importer:json-to-elem *t64*) |
---|
560 | (let ((test-tm |
---|
561 | (loop for tm in (elephant:get-instances-by-class 'TopicMapC) |
---|
562 | when (string= (uri (first (item-identifiers tm))) |
---|
563 | "http://www.isidor.us/unittests/testtm") |
---|
564 | return tm))) |
---|
565 | (let ((main-topic |
---|
566 | (loop for topic in (topics test-tm) |
---|
567 | when (string= (uri (first (psis topic))) |
---|
568 | "http://psi.egovpt.org/types/serviceUsesStandard") |
---|
569 | return topic)) |
---|
570 | (sub-topic |
---|
571 | (loop for topic in (topics test-tm) |
---|
572 | when (string= (uri (first (psis topic))) |
---|
573 | "http://www.networkedplanet.com/psi/npcl/meta-types/association-type") |
---|
574 | return topic))) |
---|
575 | (is-true (and main-topic sub-topic)) |
---|
576 | (let ((instanceOf-assoc |
---|
577 | (first (associations test-tm)))) |
---|
578 | (is (string= (uri (first (psis (instance-of instanceOf-assoc)))) |
---|
579 | constants::*type-instance-psi*)) |
---|
580 | (is-false (d:themes instanceOf-assoc)) |
---|
581 | (is (string= (d:uri (first (d:item-identifiers (first (d:in-topicmaps instanceOf-assoc))))) |
---|
582 | "http://www.isidor.us/unittests/testtm")) |
---|
583 | (is-false (d:item-identifiers instanceOf-assoc)) |
---|
584 | (let ((super-type-role |
---|
585 | (loop for role in (roles instanceOf-assoc) |
---|
586 | when (string= (uri (first (psis (instance-of role)))) |
---|
587 | constants:*type-psi*) |
---|
588 | return role)) |
---|
589 | (sub-type-role |
---|
590 | (loop for role in (roles instanceOf-assoc) |
---|
591 | when (string= (uri (first (psis (instance-of role)))) |
---|
592 | constants:*instance-psi*) |
---|
593 | return role))) |
---|
594 | (is-true (and super-type-role sub-type-role)) |
---|
595 | (is (string= (uri (first (psis (player super-type-role)))) |
---|
596 | "http://www.networkedplanet.com/psi/npcl/meta-types/association-type")) |
---|
597 | (is (string= (uri (first (psis (player sub-type-role)))) |
---|
598 | "http://psi.egovpt.org/types/serviceUsesStandard")))) |
---|
599 | (is-true (= (length (item-identifiers main-topic)) 1)) |
---|
600 | (is-true (= (length (item-identifiers sub-topic)) 1)) |
---|
601 | (is-true (string= (uri (first (item-identifiers main-topic))) |
---|
602 | "http://psi.egovpt.org/itemIdentifiers#t64")) |
---|
603 | (is-true (string= (uri (first (item-identifiers sub-topic))) |
---|
604 | "http://psi.egovpt.org/itemIdentifiers#t7")) |
---|
605 | (is-true (= (length (names main-topic)) 1)) |
---|
606 | (is-true (string= (charvalue (first (names main-topic))) |
---|
607 | "service uses standard"))))))) |
---|
608 | |
---|
609 | |
---|
610 | (test test-json-importer-general-3 |
---|
611 | (let ((dir "data_base")) |
---|
612 | (with-fixture initialize-destination-db (dir) |
---|
613 | (elephant:open-store (xml-importer:get-store-spec dir)) |
---|
614 | (xml-importer:init-isidorus) |
---|
615 | (json-importer:json-to-elem *t64*) |
---|
616 | (json-importer:json-to-elem *t100-3*) |
---|
617 | (is (= (length (elephant:get-instances-by-class 'd:TopicC)) 28)) ;13 new topics |
---|
618 | (is (= (length (elephant:get-instances-by-class 'd:AssociationC)) 5)) ;4 new associations |
---|
619 | (is (= (length (elephant:get-instances-by-class 'TopicMapC)) 2)) |
---|
620 | (let ((core-tm |
---|
621 | (loop for tm in (elephant:get-instances-by-class 'TopicMapC) |
---|
622 | when (string= (uri (first (item-identifiers tm))) |
---|
623 | "http://www.topicmaps.org/xtm/1.0/core.xtm") |
---|
624 | return tm)) |
---|
625 | (test-tm |
---|
626 | (loop for tm in (elephant:get-instances-by-class 'TopicMapC) |
---|
627 | when (string= (uri (first (item-identifiers tm))) |
---|
628 | "http://www.isidor.us/unittests/testtm") |
---|
629 | return tm))) |
---|
630 | (is-true (and core-tm test-tm)) |
---|
631 | (is (= (length (topics core-tm)) 13)) |
---|
632 | (is (= (length (associations core-tm)) 0)) |
---|
633 | (is (= (length (topics test-tm)) 17)) |
---|
634 | (is (= (length (associations test-tm)) 5)))))) |
---|
635 | |
---|
636 | |
---|
637 | (test test-json-importer-topics-1 |
---|
638 | (let ((dir "data_base") |
---|
639 | (rev-0 0)) |
---|
640 | (with-fixture initialize-destination-db (dir) |
---|
641 | (elephant:open-store (xml-importer:get-store-spec dir)) |
---|
642 | (xml-importer:init-isidorus) |
---|
643 | (json-importer:json-to-elem *t64*) |
---|
644 | (json-importer:json-to-elem *t100-3*) |
---|
645 | (let ((topics (elephant:get-instances-by-class 'TopicC))) |
---|
646 | (loop for topic in topics |
---|
647 | do (let ((psi (uri (first (psis topic :revision rev-0))))) |
---|
648 | (cond |
---|
649 | ((string= psi "http://psi.egovpt.org/types/semanticstandard") ;t3a |
---|
650 | (is-false (names topic :revision rev-0)) |
---|
651 | (is-false (occurrences topic :revision rev-0)) |
---|
652 | (is-false (locators topic :revision rev-0)) |
---|
653 | (is (= (length (psis topic :revision rev-0)) 1)) |
---|
654 | (is (= (length (item-identifiers topic :revision rev-0)) 1)) |
---|
655 | (is (string= (uri (first (item-identifiers topic :revision rev-0))) |
---|
656 | "http://psi.egovpt.org/itemIdentifiers#t3a"))) |
---|
657 | ((string= psi |
---|
658 | "http://www.networkedplanet.com/psi/npcl/meta-types/association-type") ;t7 |
---|
659 | (is-false (names topic :revision rev-0)) |
---|
660 | (is-false (occurrences topic :revision rev-0)) |
---|
661 | (is-false (locators topic :revision rev-0)) |
---|
662 | (is (= (length (psis topic :revision rev-0)) 1)) |
---|
663 | (is (= (length (item-identifiers topic :revision rev-0)) 1)) |
---|
664 | (is (string= (uri (first (item-identifiers topic :revision rev-0))) |
---|
665 | "http://psi.egovpt.org/itemIdentifiers#t7"))) |
---|
666 | ((string= psi "http://psi.egovpt.org/types/standardHasStatus") ;t51 |
---|
667 | (is-false (names topic :revision rev-0)) |
---|
668 | (is-false (occurrences topic :revision rev-0)) |
---|
669 | (is-false (locators topic :revision rev-0)) |
---|
670 | (is (= (length (psis topic :revision rev-0)) 1)) |
---|
671 | (is (= (length (item-identifiers topic :revision rev-0)) 1)) |
---|
672 | (is (string= (uri (first (item-identifiers topic :revision rev-0))) |
---|
673 | "http://psi.egovpt.org/itemIdentifiers#t51"))) |
---|
674 | ((string= psi "http://psi.egovpt.org/types/description") ;t53 |
---|
675 | (is-false (names topic :revision rev-0)) |
---|
676 | (is-false (occurrences topic :revision rev-0)) |
---|
677 | (is-false (locators topic :revision rev-0)) |
---|
678 | (is (= (length (psis topic :revision rev-0)) 1)) |
---|
679 | (is (= (length (item-identifiers topic :revision rev-0)) 1)) |
---|
680 | (is (string= (uri (first (item-identifiers topic :revision rev-0))) |
---|
681 | "http://psi.egovpt.org/itemIdentifiers#t53"))) |
---|
682 | ((string= psi "http://psi.egovpt.org/types/standardValidFromDate") ;t54 |
---|
683 | (is-false (names topic :revision rev-0)) |
---|
684 | (is-false (occurrences topic :revision rev-0)) |
---|
685 | (is-false (locators topic :revision rev-0)) |
---|
686 | (is (= (length (psis topic :revision rev-0)) 1)) |
---|
687 | (is (= (length (item-identifiers topic :revision rev-0)) 1)) |
---|
688 | (is (string= |
---|
689 | (uri (first (item-identifiers topic :revision rev-0))) |
---|
690 | "http://psi.egovpt.org/itemIdentifiers#t54")))))))))) |
---|
691 | |
---|
692 | |
---|
693 | (test test-json-importer-topics-2 |
---|
694 | (let ((dir "data_base") |
---|
695 | (rev-0 0)) |
---|
696 | (with-fixture initialize-destination-db (dir) |
---|
697 | (elephant:open-store (xml-importer:get-store-spec dir)) |
---|
698 | (xml-importer:init-isidorus) |
---|
699 | (json-importer:json-to-elem *t64*) |
---|
700 | (json-importer:json-to-elem *t100-3*) |
---|
701 | (let ((topics (elephant:get-instances-by-class 'TopicC))) |
---|
702 | (loop for topic in topics |
---|
703 | do (let ((psi (uri (first (psis topic :revision rev-0))))) |
---|
704 | (cond ((string= psi "http://psi.egovpt.org/types/links") ;t55 |
---|
705 | (is-false (names topic :revision rev-0)) |
---|
706 | (is-false (occurrences topic :revision rev-0)) |
---|
707 | (is-false (locators topic :revision rev-0)) |
---|
708 | (is (= (length (psis topic :revision rev-0)) 1)) |
---|
709 | (is (= (length (item-identifiers topic :revision rev-0)) 1)) |
---|
710 | (is (string= |
---|
711 | (uri (first (item-identifiers topic :revision rev-0))) |
---|
712 | "http://psi.egovpt.org/itemIdentifiers#t55"))) |
---|
713 | ((string= psi "http://psi.egovpt.org/types/standardIsAboutSubject") ;t60 |
---|
714 | (is-false (names topic :revision rev-0)) |
---|
715 | (is-false (occurrences topic :revision rev-0)) |
---|
716 | (is-false (locators topic :revision rev-0)) |
---|
717 | (is (= (length (psis topic :revision rev-0)) 1)) |
---|
718 | (is (= (length (item-identifiers topic :revision rev-0)) 1)) |
---|
719 | (is (string= |
---|
720 | (uri (first (item-identifiers topic :revision rev-0))) |
---|
721 | "http://psi.egovpt.org/itemIdentifiers#t60"))) |
---|
722 | ((string= psi "http://psi.egovpt.org/types/SubjectRoleType") ;t61 |
---|
723 | (is-false (names topic :revision rev-0)) |
---|
724 | (is-false (occurrences topic :revision rev-0)) |
---|
725 | (is-false (locators topic :revision rev-0)) |
---|
726 | (is (= (length (psis topic :revision rev-0)) 1)) |
---|
727 | (is (= (length (item-identifiers topic :revision rev-0)) 1)) |
---|
728 | (is (string= |
---|
729 | (uri (first (item-identifiers topic :revision rev-0))) |
---|
730 | "http://psi.egovpt.org/itemIdentifiers#t61"))) |
---|
731 | ((string= psi |
---|
732 | "http://psi.egovpt.org/types/StandardRoleType") ;t62 |
---|
733 | (is-false (names topic :revision rev-0)) |
---|
734 | (is-false (occurrences topic :revision rev-0)) |
---|
735 | (is-false (locators topic :revision rev-0)) |
---|
736 | (is (= (length (psis topic :revision rev-0)) 1)) |
---|
737 | (is (= (length (item-identifiers topic :revision rev-0)) 1)) |
---|
738 | (is (string= |
---|
739 | (uri (first (item-identifiers topic :revision rev-0))) |
---|
740 | "http://psi.egovpt.org/itemIdentifiers#t62"))) |
---|
741 | ((string= psi "http://psi.egovpt.org/types/ServiceRoleType") ;t63 |
---|
742 | (is-false (names topic :revision rev-0)) |
---|
743 | (is-false (occurrences topic :revision rev-0)) |
---|
744 | (is-false (locators topic :revision rev-0)) |
---|
745 | (is (= (length (psis topic :revision rev-0)) 1)) |
---|
746 | (is (= (length (item-identifiers topic :revision rev-0)) 1)) |
---|
747 | (is (string= |
---|
748 | (uri (first (item-identifiers topic :revision rev-0))) |
---|
749 | "http://psi.egovpt.org/itemIdentifiers#t63"))) |
---|
750 | ((string= psi |
---|
751 | "http://psi.egovpt.org/types/serviceUsesStandard") ;t64 |
---|
752 | (is (= (length (names topic :revision rev-0)) 1)) |
---|
753 | (is (string= (charvalue (first (names topic :revision rev-0))) |
---|
754 | "service uses standard")) |
---|
755 | (is-false (occurrences topic :revision rev-0)) |
---|
756 | (is-false (locators topic :revision rev-0)) |
---|
757 | (is (= (length (psis topic :revision rev-0)) 1)) |
---|
758 | (is (= (length (item-identifiers topic :revision rev-0)) 1)) |
---|
759 | (is (string= |
---|
760 | (uri (first (item-identifiers topic :revision rev-0))) |
---|
761 | "http://psi.egovpt.org/itemIdentifiers#t64")))))))))) |
---|
762 | |
---|
763 | |
---|
764 | (test test-json-importer-topics-3 |
---|
765 | (let ((dir "data_base") |
---|
766 | (rev-0 0)) |
---|
767 | (with-fixture initialize-destination-db (dir) |
---|
768 | (elephant:open-store (xml-importer:get-store-spec dir)) |
---|
769 | (xml-importer:init-isidorus) |
---|
770 | (json-importer:json-to-elem *t64*) |
---|
771 | (json-importer:json-to-elem *t100-3*) |
---|
772 | (let ((topics (elephant:get-instances-by-class 'TopicC))) |
---|
773 | (loop for topic in topics |
---|
774 | do (let ((psi (uri (first (psis topic :revision rev-0))))) |
---|
775 | (cond ((string= psi "http://psi.egovpt.org/standard/ISO+19115%3A+Geographic+Information+-+Metadata") ;t100 |
---|
776 | (is (= (length (psis topic :revision rev-0)) 1)) |
---|
777 | (is (= (length (item-identifiers topic :revision rev-0)) 1)) |
---|
778 | (is (string= |
---|
779 | (uri (first (item-identifiers topic :revision rev-0))) |
---|
780 | "http://psi.egovpt.org/itemIdentifiers#t100")) |
---|
781 | (is (= (length (names topic :revision rev-0)) 1)) |
---|
782 | (is (string= (charvalue (first (names topic :revision rev-0))) |
---|
783 | "ISO 19115")) |
---|
784 | (is (= (length (item-identifiers |
---|
785 | (first (names topic :revision rev-0)) |
---|
786 | :revision rev-0)))) |
---|
787 | (is (string= (uri (first |
---|
788 | (item-identifiers |
---|
789 | (first (names topic :revision rev-0)) |
---|
790 | :revision rev-0))) |
---|
791 | "http://psi.egovpt.org/itemIdentifiers#t100_n1")) |
---|
792 | (is (= (length (variants |
---|
793 | (first (names topic :revision rev-0)) |
---|
794 | :revision rev-0)) 2)) |
---|
795 | (let ((variant-1 (first |
---|
796 | (variants |
---|
797 | (first (names topic :revision rev-0)) |
---|
798 | :revision rev-0))) |
---|
799 | (variant-2 (second |
---|
800 | (variants |
---|
801 | (first (names topic :revision rev-0)) |
---|
802 | :revision rev-0)))) |
---|
803 | (is (= (length |
---|
804 | (item-identifiers variant-1 :revision rev-0)) 1)) |
---|
805 | (is (string= |
---|
806 | (uri (first (item-identifiers variant-1 |
---|
807 | :revision rev-0))) |
---|
808 | "http://psi.egovpt.org/itemIdentifiers#t100_n1_v1")) |
---|
809 | (is (= (length |
---|
810 | (item-identifiers variant-2 :revision rev-0)) 1)) |
---|
811 | (is (string= |
---|
812 | (uri (first (item-identifiers |
---|
813 | variant-2 :revision rev-0))) |
---|
814 | "http://psi.egovpt.org/itemIdentifiers#t100_n1_v2")) |
---|
815 | (is (= (length (themes variant-1 :revision rev-0)) 1)) |
---|
816 | (is (string= |
---|
817 | (uri (first (psis (first (themes variant-1 |
---|
818 | :revision rev-0))))) |
---|
819 | "http://www.topicmaps.org/xtm/1.0/core.xtm#display")) |
---|
820 | (is (= (length (themes variant-2 :revision rev-0)) 1)) |
---|
821 | (is (string= |
---|
822 | (uri (first |
---|
823 | (psis (first (themes variant-2 |
---|
824 | :revision rev-0)) |
---|
825 | :revision rev-0))) |
---|
826 | "http://www.topicmaps.org/xtm/1.0/core.xtm#sort")) |
---|
827 | (is (string= (charvalue variant-1) |
---|
828 | "Geographic Information - Metadata")) |
---|
829 | (is (string= (datatype variant-1) |
---|
830 | "http://www.w3.org/2001/XMLSchema#string")) |
---|
831 | (is (string= (charvalue variant-2) |
---|
832 | "ISO-19115")) |
---|
833 | (is (string= (datatype variant-2) |
---|
834 | "http://www.w3.org/2001/XMLSchema#string"))) |
---|
835 | (is (= (length (occurrences topic :revision rev-0)) 4)) |
---|
836 | (let ((occ-1 (first (occurrences topic :revision rev-0))) |
---|
837 | (occ-2 (second (occurrences topic :revision rev-0))) |
---|
838 | (occ-3 (third (occurrences topic :revision rev-0))) |
---|
839 | (occ-4 (fourth (occurrences topic :revision rev-0)))) |
---|
840 | (is (= (length (item-identifiers occ-1 :revision rev-0)) 1)) |
---|
841 | (is (string= |
---|
842 | (uri (first (item-identifiers occ-1 :revision rev-0))) |
---|
843 | "http://psi.egovpt.org/itemIdentifiers#t100_o1")) |
---|
844 | (is (= (length (item-identifiers occ-2 :revision rev-0)) 1)) |
---|
845 | (is (string= |
---|
846 | (uri (first (item-identifiers occ-2 :revision rev-0))) |
---|
847 | "http://psi.egovpt.org/itemIdentifiers#t100_o2")) |
---|
848 | (is (= (length (item-identifiers occ-3 :revision rev-0)) 1)) |
---|
849 | (is (string= |
---|
850 | (uri (first (item-identifiers occ-3 :revision rev-0))) |
---|
851 | "http://psi.egovpt.org/itemIdentifiers#t100_o3")) |
---|
852 | (is (= (length (item-identifiers occ-4 :revision rev-0)) 1)) |
---|
853 | (is (string= |
---|
854 | (uri (first (item-identifiers occ-4 :revision rev-0))) |
---|
855 | "http://psi.egovpt.org/itemIdentifiers#t100_o4")) |
---|
856 | (is (string= |
---|
857 | (uri (first (psis (instance-of occ-1 :revision rev-0)))) |
---|
858 | "http://psi.egovpt.org/types/standardHasStatus")) |
---|
859 | (is (string= |
---|
860 | (uri (first (psis (instance-of occ-2 :revision rev-0)))) |
---|
861 | "http://psi.egovpt.org/types/description")) |
---|
862 | (is (string= |
---|
863 | (uri (first (psis (instance-of occ-3 :revision rev-0)))) |
---|
864 | "http://psi.egovpt.org/types/standardValidFromDate")) |
---|
865 | (is (string= |
---|
866 | (uri (first (psis (instance-of occ-4 :revision rev-0)))) |
---|
867 | "http://psi.egovpt.org/types/links")) |
---|
868 | (is (string= (datatype occ-1) |
---|
869 | "http://www.w3.org/2001/XMLSchema#anyURI")) |
---|
870 | (is (string= (charvalue occ-1) |
---|
871 | "http://www.budabe.de/")) |
---|
872 | (is (string= (datatype occ-2) |
---|
873 | "http://www.w3.org/2001/XMLSchema#string")) |
---|
874 | (is (string= (charvalue occ-2) |
---|
875 | "The ISO 19115 standard ...")) |
---|
876 | (is (string= (datatype occ-3) |
---|
877 | "http://www.w3.org/2001/XMLSchema#date")) |
---|
878 | (is (string= (charvalue occ-3) |
---|
879 | "2003-01-01")) |
---|
880 | (is (string= (datatype occ-4) |
---|
881 | "http://www.w3.org/2001/XMLSchema#anyURI")) |
---|
882 | (is (string= (charvalue occ-4) |
---|
883 | "http://www.editeur.org/standards/ISO19115.pdf"))))))))))) |
---|
884 | |
---|
885 | |
---|
886 | (test test-json-importer-topics-4 |
---|
887 | (let ((dir "data_base") |
---|
888 | (rev-0 0)) |
---|
889 | (with-fixture initialize-destination-db (dir) |
---|
890 | (elephant:open-store (xml-importer:get-store-spec dir)) |
---|
891 | (xml-importer:init-isidorus) |
---|
892 | (json-importer:json-to-elem *t64*) |
---|
893 | (json-importer:json-to-elem *t100-3*) |
---|
894 | (let ((topics (elephant:get-instances-by-class 'TopicC))) |
---|
895 | (loop for topic in topics |
---|
896 | do (let ((psi (uri (first (psis topic :revision rev-0))))) |
---|
897 | (cond ((string= |
---|
898 | psi |
---|
899 | "http://psi.egovpt.org/subject/Semantic+Description") ;t201 |
---|
900 | (is-false (names topic :revision rev-0)) |
---|
901 | (is-false (occurrences topic :revision rev-0)) |
---|
902 | (is-false (locators topic :revision rev-0)) |
---|
903 | (is (= (length (psis topic :revision rev-0)) 1)) |
---|
904 | (is-false (item-identifiers topic :revision rev-0))) |
---|
905 | ((string= psi "http://psi.egovpt.org/subject/GeoData") ;t203 |
---|
906 | (is-false (names topic :revision rev-0)) |
---|
907 | (is-false (occurrences topic :revision rev-0)) |
---|
908 | (is-false (locators topic :revision rev-0)) |
---|
909 | (is (= (length (psis topic :revision rev-0)) 1)) |
---|
910 | (is-false (item-identifiers topic :revision rev-0))) |
---|
911 | ((or (string= psi |
---|
912 | "http://psi.egovpt.org/service/Google+Maps") ;t301a |
---|
913 | (string= psi "http://maps.google.com")) |
---|
914 | (is-false (names topic :revision rev-0)) |
---|
915 | (is-false (occurrences topic :revision rev-0)) |
---|
916 | (is-false (locators topic :revision rev-0)) |
---|
917 | (is (= (length (psis topic :revision rev-0)) 2)) |
---|
918 | (is (or (string= (uri (first (psis topic :revision rev-0))) |
---|
919 | "http://psi.egovpt.org/service/Google+Maps") |
---|
920 | (string= (uri (first (psis topic :revision rev-0))) |
---|
921 | "http://maps.google.com"))) |
---|
922 | (is (or (string= (uri (second (psis topic :revision rev-0))) |
---|
923 | "http://psi.egovpt.org/service/Google+Maps") |
---|
924 | (string= (uri (second (psis topic :revision rev-0))) |
---|
925 | "http://maps.google.com"))) |
---|
926 | (is-false (item-identifiers topic :revision rev-0)))))))))) |
---|
927 | |
---|
928 | |
---|
929 | (test test-json-importer-associations |
---|
930 | (let ((dir "data_base") |
---|
931 | (rev-0 0)) |
---|
932 | (with-fixture initialize-destination-db (dir) |
---|
933 | (elephant:open-store (xml-importer:get-store-spec dir)) |
---|
934 | (xml-importer:init-isidorus) |
---|
935 | (json-importer:json-to-elem *t64*) |
---|
936 | (json-importer:json-to-elem *t100-3*) |
---|
937 | (let ((assoc-7 |
---|
938 | (identified-construct |
---|
939 | (elephant:get-instance-by-value |
---|
940 | 'ItemidentifierC 'uri |
---|
941 | "http://psi.egovpt.org/itemIdentifiers#assoc_7") |
---|
942 | :revision rev-0))) |
---|
943 | (is (= (length (item-identifiers assoc-7 :revision rev-0)))) |
---|
944 | (is (string= (uri (first (item-identifiers assoc-7 :revision rev-0))) |
---|
945 | "http://psi.egovpt.org/itemIdentifiers#assoc_7")) |
---|
946 | (is (= (length (roles assoc-7 :revision rev-0)) 2)) |
---|
947 | (is (string= (uri (first (psis (instance-of assoc-7 :revision rev-0) |
---|
948 | :revision rev-0))) |
---|
949 | "http://psi.egovpt.org/types/serviceUsesStandard")) |
---|
950 | (let ((role-1 (first (roles assoc-7 :revision rev-0))) |
---|
951 | (role-2 (second (roles assoc-7 :revision rev-0)))) |
---|
952 | (is (string= (uri (first (psis (instance-of role-1 :revision rev-0) |
---|
953 | :revision rev-0))) |
---|
954 | "http://psi.egovpt.org/types/ServiceRoleType")) |
---|
955 | (is (or (string= (uri (first (psis (player role-1 :revision rev-0) |
---|
956 | :revision rev-0))) |
---|
957 | "http://psi.egovpt.org/service/Google+Maps") |
---|
958 | (string= (uri (first (psis (player role-1 :revision rev-0) |
---|
959 | :revision rev-0))) |
---|
960 | "http://maps.google.com"))) |
---|
961 | (is (string= (uri (first (psis (instance-of role-2 :revision rev-0) |
---|
962 | :revision rev-0))) |
---|
963 | "http://psi.egovpt.org/types/StandardRoleType")) |
---|
964 | (is (string= (uri (first (psis (player role-2 :revision rev-0) |
---|
965 | :revision rev-0))) |
---|
966 | "http://psi.egovpt.org/standard/ISO+19115%3A+Geographic+Information+-+Metadata"))))))) |
---|
967 | |
---|
968 | |
---|
969 | (test test-json-importer-merge-1 |
---|
970 | (let ((dir "data_base") |
---|
971 | (rev-0 0)) |
---|
972 | (with-fixture initialize-destination-db (dir) |
---|
973 | (elephant:open-store (xml-importer:get-store-spec dir)) |
---|
974 | (xml-importer:init-isidorus) |
---|
975 | (is (= (length (elephant:get-instances-by-class 'TopicC)) 13)) |
---|
976 | (is (= (length (elephant:get-instances-by-class 'AssociationC)) 0)) |
---|
977 | (is (= (length (elephant:get-instances-by-class 'TopicMapC)) 1)) |
---|
978 | (json-importer:json-to-elem *t100-1*) |
---|
979 | (is (= (length (elephant:get-instances-by-class 'TopicC)) 17)) |
---|
980 | (is (= (length (elephant:get-instances-by-class 'AssociationC)) 1)) |
---|
981 | (is (= (length (elephant:get-instances-by-class 'TopicMapC)) 2)) |
---|
982 | (let ((core-tm |
---|
983 | (loop for tm in (elephant:get-instances-by-class 'TopicMapC) |
---|
984 | when (string= (uri (first (item-identifiers tm :revision rev-0))) |
---|
985 | "http://www.topicmaps.org/xtm/1.0/core.xtm") |
---|
986 | return tm)) |
---|
987 | (test-tm |
---|
988 | (loop for tm in (elephant:get-instances-by-class 'TopicMapC) |
---|
989 | when (string= (uri (first (item-identifiers tm :revision rev-0))) |
---|
990 | "http://www.isidor.us/unittests/testtm") |
---|
991 | return tm))) |
---|
992 | (is-true (and core-tm test-tm))) |
---|
993 | (json-importer:json-to-elem *t100-2*) |
---|
994 | (is (= (length (elephant:get-instances-by-class 'TopicC)) 17)) |
---|
995 | (is (= (length (elephant:get-instances-by-class 'AssociationC)) 1)) |
---|
996 | (is (= (length (elephant:get-instances-by-class 'TopicMapC)) 2)) |
---|
997 | (let ((core-tm |
---|
998 | (loop for tm in (elephant:get-instances-by-class 'TopicMapC) |
---|
999 | when (string= (uri (first (item-identifiers tm :revision rev-0))) |
---|
1000 | "http://www.topicmaps.org/xtm/1.0/core.xtm") |
---|
1001 | return tm)) |
---|
1002 | (test-tm |
---|
1003 | (loop for tm in (elephant:get-instances-by-class 'TopicMapC) |
---|
1004 | when (string= (uri (first (item-identifiers tm :revision rev-0))) |
---|
1005 | "http://www.isidor.us/unittests/testtm") |
---|
1006 | return tm))) |
---|
1007 | (is-true (and core-tm test-tm))) |
---|
1008 | (let ((topics (elephant:get-instances-by-class 'TopicC))) |
---|
1009 | (loop for topic in topics |
---|
1010 | do (let ((psi (uri (first (psis topic :revision rev-0))))) |
---|
1011 | (cond |
---|
1012 | ((string= psi "http://psi.egovpt.org/types/standard") ;t3 |
---|
1013 | (is (= (length (in-topicmaps topic :revision rev-0)) 1)) |
---|
1014 | (is (string= |
---|
1015 | (uri (first (item-identifiers |
---|
1016 | (first (in-topicmaps topic :revision rev-0)) |
---|
1017 | :revision rev-0))) |
---|
1018 | "http://www.isidor.us/unittests/testtm")) |
---|
1019 | (is-false (names topic :revision rev-0)) |
---|
1020 | (is-false (occurrences topic :revision rev-0)) |
---|
1021 | (is-false (locators topic :revision rev-0)) |
---|
1022 | (is (= (length (psis topic :revision rev-0)) 1)) |
---|
1023 | (is (= (length (item-identifiers topic :revision rev-0)) 2)) |
---|
1024 | (is (or (string= |
---|
1025 | (uri (first (item-identifiers topic :revision rev-0))) |
---|
1026 | "http://www.egovpt.org/itemIdentifiers#t3") |
---|
1027 | (string= |
---|
1028 | (uri (second (item-identifiers topic :revision rev-0))) |
---|
1029 | "http://www.egovpt.org/itemIdentifiers#t3"))) |
---|
1030 | (is (or (string= |
---|
1031 | (uri (first (item-identifiers topic :revision rev-0))) |
---|
1032 | "http://psi.egovpt.org/itemIdentifiers#t3") |
---|
1033 | (string= |
---|
1034 | (uri (second (item-identifiers topic :revision rev-0))) |
---|
1035 | "http://psi.egovpt.org/itemIdentifiers#t3")))) |
---|
1036 | ((string= psi "http://psi.egovpt.org/types/long-name") ;t50a |
---|
1037 | (is (= (length (in-topicmaps topic :revision rev-0)) 1)) |
---|
1038 | (is (string= |
---|
1039 | (uri (first (item-identifiers |
---|
1040 | (first (in-topicmaps topic :revision rev-0)) |
---|
1041 | :revision rev-0))) |
---|
1042 | "http://www.isidor.us/unittests/testtm")) |
---|
1043 | (is-false (names topic :revision rev-0)) |
---|
1044 | (is-false (occurrences topic :revision rev-0)) |
---|
1045 | (is-false (locators topic :revision rev-0)) |
---|
1046 | (is (= (length (psis topic :revision rev-0)) 1)) |
---|
1047 | (is (= (length (item-identifiers topic :revision rev-0)) 1)) |
---|
1048 | (is (string= (uri (first (item-identifiers topic :revision rev-0))) |
---|
1049 | "http://psi.egovpt.org/itemIdentifiers#t50a"))) |
---|
1050 | ((string= psi "http://psi.egovpt.org/types/links") ;t50 |
---|
1051 | (is (= (length (in-topicmaps topic :revision rev-0)) 1)) |
---|
1052 | (is (string= |
---|
1053 | (uri (first (item-identifiers |
---|
1054 | (first (in-topicmaps topic :revision rev-0)) |
---|
1055 | :revision rev-0))) |
---|
1056 | "http://www.isidor.us/unittests/testtm")) |
---|
1057 | (is-false (names topic :revision rev-0)) |
---|
1058 | (is-false (occurrences topic :revision rev-0)) |
---|
1059 | (is-false (locators topic :revision rev-0)) |
---|
1060 | (is (= (length (psis topic :revision rev-0)) 1)) |
---|
1061 | (is (= (length (item-identifiers topic :revision rev-0)) 2)) |
---|
1062 | (is (or (string= |
---|
1063 | (uri (first (item-identifiers topic :revision rev-0))) |
---|
1064 | "http://psi.egovpt.org/itemIdentifiers#t55") |
---|
1065 | (string= |
---|
1066 | (uri (second (item-identifiers topic :revision rev-0))) |
---|
1067 | "http://psi.egovpt.org/itemIdentifiers#t55"))) |
---|
1068 | (is (or (string= |
---|
1069 | (uri (first (item-identifiers topic :revision rev-0))) |
---|
1070 | "http://psi.egovpt.org/itemIdentifiers#t55_1") |
---|
1071 | (string= |
---|
1072 | (uri (second (item-identifiers topic :revision rev-0))) |
---|
1073 | "http://psi.egovpt.org/itemIdentifiers#t55_1"))))))))))) |
---|
1074 | |
---|
1075 | |
---|
1076 | (test test-json-importer-merge-2 |
---|
1077 | (let ((dir "data_base") |
---|
1078 | (rev-0 0)) |
---|
1079 | (with-fixture initialize-destination-db (dir) |
---|
1080 | (elephant:open-store (xml-importer:get-store-spec dir)) |
---|
1081 | (xml-importer:init-isidorus) |
---|
1082 | (json-importer:json-to-elem *t100-1*) |
---|
1083 | (let ((core-tm |
---|
1084 | (loop for tm in (elephant:get-instances-by-class 'TopicMapC) |
---|
1085 | when (string= (uri (first (item-identifiers tm :revision rev-0))) |
---|
1086 | "http://www.topicmaps.org/xtm/1.0/core.xtm") |
---|
1087 | return tm)) |
---|
1088 | (test-tm |
---|
1089 | (loop for tm in (elephant:get-instances-by-class 'TopicMapC) |
---|
1090 | when (string= (uri (first (item-identifiers tm :revision rev-0))) |
---|
1091 | "http://www.isidor.us/unittests/testtm") |
---|
1092 | return tm))) |
---|
1093 | (is-true (and core-tm test-tm))) |
---|
1094 | (json-importer:json-to-elem *t100-2*) |
---|
1095 | (let ((topics (elephant:get-instances-by-class 'TopicC))) |
---|
1096 | (loop for topic in topics |
---|
1097 | do (let ((psi (uri (first (psis topic :revision rev-0))))) |
---|
1098 | (cond |
---|
1099 | ((string= psi "http://psi.egovpt.org/types/standard") |
---|
1100 | t) ;was already checked |
---|
1101 | ((string= psi "http://psi.egovpt.org/types/long-name") |
---|
1102 | t) ;was already checked |
---|
1103 | ((string= psi "http://psi.egovpt.org/types/links") |
---|
1104 | t) ;was already checked |
---|
1105 | ((string= psi "http://psi.egovpt.org/standard/Common+Lisp") ;t100 |
---|
1106 | (is (= (length (in-topicmaps topic :revision rev-0)) 1)) |
---|
1107 | (is (string= |
---|
1108 | (uri (first (item-identifiers |
---|
1109 | (first (in-topicmaps topic :revision rev-0)) |
---|
1110 | :revision rev-0))) |
---|
1111 | "http://www.isidor.us/unittests/testtm")) |
---|
1112 | (is (= (length (psis topic :revision rev-0)) 1)) |
---|
1113 | (is (= (length (item-identifiers topic :revision rev-0)) 2)) |
---|
1114 | (is (or (string= |
---|
1115 | (uri (first (item-identifiers topic :revision rev-0))) |
---|
1116 | "http://www.egovpt.org/itemIdentifiers#t100") |
---|
1117 | (string= |
---|
1118 | (uri (second (item-identifiers topic :revision rev-0))) |
---|
1119 | "http://www.egovpt.org/itemIdentifiers#t100"))) |
---|
1120 | (is (or (string= |
---|
1121 | (uri (first (item-identifiers topic :revision rev-0))) |
---|
1122 | "http://www.egovpt.org/itemIdentifiers#t100_new") |
---|
1123 | (string= |
---|
1124 | (uri (second (item-identifiers topic :revision rev-0))) |
---|
1125 | "http://www.egovpt.org/itemIdentifiers#t100_new"))) |
---|
1126 | (is (= (length (names topic :revision rev-0)))) |
---|
1127 | (let ((name (first (names topic :revision rev-0)))) |
---|
1128 | (is (= (length (item-identifiers name :revision rev-0)) 2)) |
---|
1129 | (is (or (string= |
---|
1130 | (uri (first (item-identifiers name :revision rev-0))) |
---|
1131 | "http://www.egovpt.org/itemIdentifiers#t100_n1") |
---|
1132 | (string= |
---|
1133 | (uri (second (item-identifiers name :revision rev-0))) |
---|
1134 | "http://www.egovpt.org/itemIdentifiers#t100_n1"))) |
---|
1135 | (is (or (string= |
---|
1136 | (uri (first (item-identifiers name :revision rev-0))) |
---|
1137 | "http://www.egovpt.org/itemIdentifiers#t100_n1a") |
---|
1138 | (string= |
---|
1139 | (uri (second (item-identifiers name :revision rev-0))) |
---|
1140 | "http://www.egovpt.org/itemIdentifiers#t100_n1a"))) |
---|
1141 | (is (string= (charvalue name) |
---|
1142 | "Common Lisp")) |
---|
1143 | (is (= (length (variants name :revision rev-0)) 2)) |
---|
1144 | (let ((variant-1 (first (variants name :revision rev-0))) |
---|
1145 | (variant-2 (second (variants name :revision rev-0)))) |
---|
1146 | (is (= (length (item-identifiers variant-1 :revision rev-0)) 1)) |
---|
1147 | (is (string= |
---|
1148 | (uri (first (item-identifiers variant-1 :revision rev-0))) |
---|
1149 | "http://www.egovpt.org/itemIdentifiers#t100_n_v1")) |
---|
1150 | (is (= (length (item-identifiers variant-2 :revision rev-0)) 1)) |
---|
1151 | (is (string= |
---|
1152 | (uri (first (item-identifiers variant-2 :revision rev-0))) |
---|
1153 | "http://www.egovpt.org/itemIdentifiers#t100_n_v2")) |
---|
1154 | (is (= (length (themes variant-1 :revision rev-0)) 2)) |
---|
1155 | (is (or (string= |
---|
1156 | (uri |
---|
1157 | (first |
---|
1158 | (psis |
---|
1159 | (first (themes variant-1 :revision rev-0)) |
---|
1160 | :revision rev-0))) |
---|
1161 | "http://www.topicmaps.org/xtm/1.0/core.xtm#sort") |
---|
1162 | (string= |
---|
1163 | (uri |
---|
1164 | (first |
---|
1165 | (psis (second (themes variant-1 :revision rev-0)) |
---|
1166 | :revision rev-0))) |
---|
1167 | "http://www.topicmaps.org/xtm/1.0/core.xtm#sort"))) |
---|
1168 | (is (or (string= |
---|
1169 | (uri |
---|
1170 | (first |
---|
1171 | (psis (first (themes variant-1 :revision rev-0)) |
---|
1172 | :revision rev-0))) |
---|
1173 | "http://psi.egovpt.org/types/long-name") |
---|
1174 | (string= |
---|
1175 | (uri |
---|
1176 | (first |
---|
1177 | (psis (second (themes variant-1 :revision rev-0)) |
---|
1178 | :revision rev-0))) |
---|
1179 | "http://psi.egovpt.org/types/long-name"))) |
---|
1180 | (is (= (length (themes variant-2 :revision rev-0)) 1)) |
---|
1181 | (is (string= |
---|
1182 | (uri |
---|
1183 | (first |
---|
1184 | (psis (first (themes variant-2 :revision rev-0)) |
---|
1185 | :revision rev-0))) |
---|
1186 | "http://www.topicmaps.org/xtm/1.0/core.xtm#display")) |
---|
1187 | (is (string= (datatype variant-1) |
---|
1188 | "http://www.w3.org/2001/XMLSchema#string")) |
---|
1189 | (is (string= (charvalue variant-1) |
---|
1190 | "Common-Lisp")) |
---|
1191 | (is (string= (datatype variant-2) |
---|
1192 | "http://www.w3.org/2001/XMLSchema#string")) |
---|
1193 | (is (string= (charvalue variant-2) |
---|
1194 | "CL")))) |
---|
1195 | (is (= (length (occurrences topic :revision rev-0)) 2)) |
---|
1196 | (let ((occ-1 (first (occurrences topic :revision rev-0))) |
---|
1197 | (occ-2 (second (occurrences topic :revision rev-0)))) |
---|
1198 | (is (= (length (item-identifiers occ-1 :revision rev-0)) 1)) |
---|
1199 | (is (string= |
---|
1200 | (uri (first (item-identifiers occ-1 :revision rev-0))) |
---|
1201 | "http://www.egovpt.org/itemIdentifiers#t100_o1")) |
---|
1202 | (is (= (length (item-identifiers occ-2 :revision rev-0)) 1)) |
---|
1203 | (is (string= |
---|
1204 | (uri (first (item-identifiers occ-2 :revision rev-0))) |
---|
1205 | "http://www.egovpt.org/itemIdentifiers#t100_o2")) |
---|
1206 | (is (string= |
---|
1207 | (uri (first (psis (instance-of occ-1 :revision rev-0) |
---|
1208 | :revision rev-0))) |
---|
1209 | "http://psi.egovpt.org/types/links")) |
---|
1210 | (is (string= |
---|
1211 | (uri (first (psis (instance-of occ-2 :revision rev-0) |
---|
1212 | :revision rev-0))) |
---|
1213 | "http://psi.egovpt.org/types/links")) |
---|
1214 | (is (string= (datatype occ-1) |
---|
1215 | "http://www.w3.org/2001/XMLSchema#anyURI")) |
---|
1216 | (is (string= (charvalue occ-1) |
---|
1217 | "http://www.common-lisp.net/")) |
---|
1218 | (is (string= (datatype occ-2) |
---|
1219 | "http://www.w3.org/2001/XMLSchema#anyURI")) |
---|
1220 | (is (string= (charvalue occ-2) |
---|
1221 | "http://www.cliki.net/")))) |
---|
1222 | (t |
---|
1223 | (if (or (string= |
---|
1224 | psi |
---|
1225 | "http://www.topicmaps.org/xtm/1.0/core.xtm#sort") |
---|
1226 | (string= |
---|
1227 | psi |
---|
1228 | "http://www.topicmaps.org/xtm/1.0/core.xtm#display")) |
---|
1229 | (progn |
---|
1230 | (is (= (length (in-topicmaps topic :revision rev-0)) 2)) |
---|
1231 | (is (or (string= |
---|
1232 | (uri |
---|
1233 | (first |
---|
1234 | (item-identifiers |
---|
1235 | (first (in-topicmaps topic :revision rev-0)) |
---|
1236 | :revision rev-0))) |
---|
1237 | "http://www.topicmaps.org/xtm/1.0/core.xtm") |
---|
1238 | (string= |
---|
1239 | (uri |
---|
1240 | (first |
---|
1241 | (item-identifiers |
---|
1242 | (second (in-topicmaps topic :revision rev-0)) |
---|
1243 | :revision rev-0))) |
---|
1244 | "http://www.topicmaps.org/xtm/1.0/core.xtm"))) |
---|
1245 | (is (or (string= |
---|
1246 | (uri |
---|
1247 | (first |
---|
1248 | (item-identifiers |
---|
1249 | (first (in-topicmaps topic :revision rev-0)) |
---|
1250 | :revision rev-0))) |
---|
1251 | "http://www.isidor.us/unittests/testtm") |
---|
1252 | (string= |
---|
1253 | (uri |
---|
1254 | (first |
---|
1255 | (item-identifiers |
---|
1256 | (second (in-topicmaps topic :revision rev-0)) |
---|
1257 | :revision rev-0))) |
---|
1258 | "http://www.isidor.us/unittests/testtm")))) |
---|
1259 | (progn |
---|
1260 | (is (= (length (in-topicmaps topic :revision rev-0)) 1)) |
---|
1261 | (is (string= |
---|
1262 | (uri |
---|
1263 | (first |
---|
1264 | (item-identifiers |
---|
1265 | (first (in-topicmaps topic :revision rev-0)) |
---|
1266 | :revision rev-0))) |
---|
1267 | "http://www.topicmaps.org/xtm/1.0/core.xtm")))))))))))) |
---|
1268 | |
---|
1269 | |
---|
1270 | (test test-json-importer-merge-3 |
---|
1271 | (let ((dir "data_base") |
---|
1272 | (rev-0 0)) |
---|
1273 | (with-fixture initialize-destination-db (dir) |
---|
1274 | (elephant:open-store (xml-importer:get-store-spec dir)) |
---|
1275 | (xml-importer:init-isidorus) |
---|
1276 | (json-importer:json-to-elem *t100-1*) |
---|
1277 | (let ((core-tm |
---|
1278 | (loop for tm in (elephant:get-instances-by-class 'TopicMapC) |
---|
1279 | when (string= (uri (first (item-identifiers tm :revision rev-0))) |
---|
1280 | "http://www.topicmaps.org/xtm/1.0/core.xtm") |
---|
1281 | return tm)) |
---|
1282 | (test-tm |
---|
1283 | (loop for tm in (elephant:get-instances-by-class 'TopicMapC) |
---|
1284 | when (string= (uri (first (item-identifiers tm :revision rev-0))) |
---|
1285 | "http://www.isidor.us/unittests/testtm") |
---|
1286 | return tm))) |
---|
1287 | (is-true (and core-tm test-tm))) |
---|
1288 | (json-importer:json-to-elem *t100-2*) |
---|
1289 | (let ((instanceOf-assoc |
---|
1290 | (first (elephant:get-instances-by-class 'AssociationC)))) |
---|
1291 | (is (string= |
---|
1292 | (uri (first (psis (instance-of instanceOf-assoc :revision rev-0) |
---|
1293 | :revision rev-0))) |
---|
1294 | constants::*type-instance-psi*)) |
---|
1295 | (is-false (d:themes instanceOf-assoc :revision rev-0)) |
---|
1296 | (is (string= |
---|
1297 | (d:uri |
---|
1298 | (first |
---|
1299 | (d:item-identifiers |
---|
1300 | (first (d:in-topicmaps instanceOf-assoc :revision rev-0)) |
---|
1301 | :revision rev-0))) |
---|
1302 | "http://www.isidor.us/unittests/testtm")) |
---|
1303 | (is-false (d:item-identifiers instanceOf-assoc :revision rev-0)) |
---|
1304 | (let ((super-type-role |
---|
1305 | (loop for role in (roles instanceOf-assoc :revision rev-0) |
---|
1306 | when (string= |
---|
1307 | (uri (first (psis (instance-of role :revision rev-0) |
---|
1308 | :revision rev-0))) |
---|
1309 | constants:*type-psi*) |
---|
1310 | return role)) |
---|
1311 | (sub-type-role |
---|
1312 | (loop for role in (roles instanceOf-assoc :revision rev-0) |
---|
1313 | when (string= (uri (first (psis (instance-of role :revision rev-0) |
---|
1314 | :revision rev-0))) |
---|
1315 | constants:*instance-psi*) |
---|
1316 | return role))) |
---|
1317 | (is-true (and super-type-role sub-type-role)) |
---|
1318 | (is (string= (uri (first (psis (player super-type-role :revision rev-0) |
---|
1319 | :revision rev-0))) |
---|
1320 | "http://psi.egovpt.org/types/standard")) |
---|
1321 | (is (string= (uri (first (psis (player sub-type-role :revision rev-0) |
---|
1322 | :revision rev-0))) |
---|
1323 | "http://psi.egovpt.org/standard/Common+Lisp"))))))) |
---|
1324 | |
---|
1325 | |
---|
1326 | (test test-get-all-topic-psis |
---|
1327 | (let ((dir "data_base") |
---|
1328 | (rev-0 0)) |
---|
1329 | (with-fixture initialize-destination-db (dir) |
---|
1330 | (xml-importer:setup-repository |
---|
1331 | *notificationbase.xtm* dir :tm-id "http://www.isidor.us/unittests/testtm" |
---|
1332 | :xtm-id *TEST-TM*) |
---|
1333 | (elephant:open-store (xml-importer:get-store-spec dir)) |
---|
1334 | (let ((json-psis |
---|
1335 | (json:decode-json-from-string (get-all-topic-psis :revision rev-0)))) |
---|
1336 | (is (= (length json-psis) |
---|
1337 | (length (elephant:get-instances-by-class 'd:TopicC)))) |
---|
1338 | (loop for topic-psis in json-psis |
---|
1339 | do (cond |
---|
1340 | ((string= (first topic-psis) |
---|
1341 | "http://www.topicmaps.org/xtm/1.0/core.xtm#topic") |
---|
1342 | (is (= (length topic-psis) 1))) |
---|
1343 | ((string= (first topic-psis) |
---|
1344 | "http://www.topicmaps.org/xtm/1.0/core.xtm#association") |
---|
1345 | (is (= (length topic-psis) 1))) |
---|
1346 | ((string= (first topic-psis) |
---|
1347 | "http://www.topicmaps.org/xtm/1.0/core.xtm#occurrence") |
---|
1348 | (is (= (length topic-psis) 1))) |
---|
1349 | ((string= (first topic-psis) |
---|
1350 | "http://www.topicmaps.org/xtm/1.0/core.xtm#class-instance") |
---|
1351 | (is (= (length topic-psis) 1))) |
---|
1352 | ((string= (first topic-psis) |
---|
1353 | "http://www.topicmaps.org/xtm/1.0/core.xtm#class") |
---|
1354 | (is (= (length topic-psis) 1))) |
---|
1355 | ((string= |
---|
1356 | (first topic-psis) |
---|
1357 | "http://www.topicmaps.org/xtm/1.0/core.xtm#supertype-subtype") |
---|
1358 | (is (= (length topic-psis) 1))) |
---|
1359 | ((string= (first topic-psis) |
---|
1360 | "http://www.topicmaps.org/xtm/1.0/core.xtm#supertype") |
---|
1361 | (is (= (length topic-psis) 1))) |
---|
1362 | ((string= (first topic-psis) |
---|
1363 | "http://www.topicmaps.org/xtm/1.0/core.xtm#subtype") |
---|
1364 | (is (= (length topic-psis) 1))) |
---|
1365 | ((string= (first topic-psis) |
---|
1366 | "http://www.topicmaps.org/xtm/1.0/core.xtm#sort") |
---|
1367 | (is (= (length topic-psis) 1))) |
---|
1368 | ((string= (first topic-psis) |
---|
1369 | "http://www.topicmaps.org/xtm/1.0/core.xtm#display") |
---|
1370 | (is (= (length topic-psis) 1))) |
---|
1371 | ((string= (first topic-psis) |
---|
1372 | "http://psi.topicmaps.org/iso13250/model/type-instance") |
---|
1373 | (is (= (length topic-psis) 1))) |
---|
1374 | ((string= (first topic-psis) |
---|
1375 | "http://psi.topicmaps.org/iso13250/model/type") |
---|
1376 | (is (= (length topic-psis) 1))) |
---|
1377 | ((string= (first topic-psis) |
---|
1378 | "http://psi.topicmaps.org/iso13250/model/instance") |
---|
1379 | (is (= (length topic-psis) 1))) |
---|
1380 | ((string= |
---|
1381 | (first topic-psis) |
---|
1382 | "http://www.networkedplanet.com/psi/npcl/meta-types/topic-type") |
---|
1383 | (is (= (length topic-psis) 1))) |
---|
1384 | ((string= (first topic-psis) |
---|
1385 | "http://psi.egovpt.org/types/service") |
---|
1386 | (is (= (length topic-psis) 1))) |
---|
1387 | ((string= (first topic-psis) |
---|
1388 | "http://psi.egovpt.org/types/standard") |
---|
1389 | (is (= (length topic-psis) 1))) |
---|
1390 | ((string= (first topic-psis) |
---|
1391 | "http://psi.egovpt.org/types/semanticstandard") |
---|
1392 | (is (= (length topic-psis) 1))) |
---|
1393 | ((string= (first topic-psis) |
---|
1394 | "http://psi.egovpt.org/types/technicalstandard") |
---|
1395 | (is (= (length topic-psis) 1))) |
---|
1396 | ((string= (first topic-psis) |
---|
1397 | "http://psi.egovpt.org/types/subject") |
---|
1398 | (is (= (length topic-psis) 1))) |
---|
1399 | ((string= |
---|
1400 | (first topic-psis) |
---|
1401 | "http://www.networkedplanet.com/psi/npcl/meta-types/occurrence-type") |
---|
1402 | (is (= (length topic-psis) 1))) |
---|
1403 | ((string= |
---|
1404 | (first topic-psis) |
---|
1405 | "http://www.networkedplanet.com/psi/npcl/meta-types/association-type") |
---|
1406 | (is (= (length topic-psis) 1))) |
---|
1407 | ((string= |
---|
1408 | (first topic-psis) |
---|
1409 | "http://www.networkedplanet.com/psi/npcl/meta-types/association-role-type") |
---|
1410 | (is (= (length topic-psis) 1))) |
---|
1411 | ((string= (first topic-psis) |
---|
1412 | "http://psi.egovpt.org/types/topicInTaxonomy") |
---|
1413 | (is (= (length topic-psis) 1))) |
---|
1414 | ((string= (first topic-psis) |
---|
1415 | "http://psi.egovpt.org/types/long-name") |
---|
1416 | (is (= (length topic-psis) 1))) |
---|
1417 | ((string= (first topic-psis) |
---|
1418 | "http://psi.egovpt.org/types/standardHasStatus") |
---|
1419 | (is (= (length topic-psis) 1))) |
---|
1420 | ((string= (first topic-psis) |
---|
1421 | "http://psi.egovpt.org/status/InternationalStandard") |
---|
1422 | (is (= (length topic-psis) 1))) |
---|
1423 | ((string= (first topic-psis) |
---|
1424 | "http://psi.egovpt.org/types/description") |
---|
1425 | (is (= (length topic-psis) 1))) |
---|
1426 | ((string= (first topic-psis) |
---|
1427 | "http://psi.egovpt.org/types/standardValidFromDate") |
---|
1428 | (is (= (length topic-psis) 1))) |
---|
1429 | ((string= (first topic-psis) |
---|
1430 | "http://psi.egovpt.org/types/links") |
---|
1431 | (is (= (length topic-psis) 1))) |
---|
1432 | ((string= (first topic-psis) |
---|
1433 | "http://psi.egovpt.org/types/topicIsAboutSubject") |
---|
1434 | (is (= (length topic-psis) 1))) |
---|
1435 | ((string= (first topic-psis) |
---|
1436 | "http://psi.egovpt.org/types/isNarrowerSubject") |
---|
1437 | (is (= (length topic-psis) 1))) |
---|
1438 | ((string= (first topic-psis) |
---|
1439 | "http://psi.egovpt.org/types/narrowerSubject") |
---|
1440 | (is (= (length topic-psis) 1))) |
---|
1441 | ((string= (first topic-psis) |
---|
1442 | "http://psi.egovpt.org/types/broaderSubject") |
---|
1443 | (is (= (length topic-psis) 1))) |
---|
1444 | ((string= (first topic-psis) |
---|
1445 | "http://psi.egovpt.org/types/standardIsAboutSubject") |
---|
1446 | (is (= (length topic-psis) 1))) |
---|
1447 | ((string= (first topic-psis) |
---|
1448 | "http://psi.egovpt.org/types/SubjectRoleType") |
---|
1449 | (is (= (length topic-psis) 1))) |
---|
1450 | ((string= (first topic-psis) |
---|
1451 | "http://psi.egovpt.org/types/StandardRoleType") |
---|
1452 | (is (= (length topic-psis) 1))) |
---|
1453 | ((string= (first topic-psis) |
---|
1454 | "http://psi.egovpt.org/types/ServiceRoleType") |
---|
1455 | (is (= (length topic-psis) 1))) |
---|
1456 | ((string= (first topic-psis) |
---|
1457 | "http://psi.egovpt.org/types/serviceUsesStandard") |
---|
1458 | (is (= (length topic-psis) 1))) |
---|
1459 | ((string= |
---|
1460 | (first topic-psis) |
---|
1461 | "http://psi.egovpt.org/standard/ISO+19115%3A+Geographic+Information+-+Metadata") |
---|
1462 | (is (= (length topic-psis) 1))) |
---|
1463 | ((string= (first topic-psis) |
---|
1464 | "http://psi.egovpt.org/standard/Topic+Maps+2002") |
---|
1465 | (is (= (length topic-psis) 1))) |
---|
1466 | ((string= (first topic-psis) |
---|
1467 | "http://psi.egovpt.org/subject/Web+Services") |
---|
1468 | (is (= (length topic-psis) 1))) |
---|
1469 | ((string= (first topic-psis) |
---|
1470 | "http://psi.egovpt.org/subject/Semantic+Description") |
---|
1471 | (is (= (length topic-psis) 1))) |
---|
1472 | ((string= (first topic-psis) |
---|
1473 | "http://psi.egovpt.org/subject/Data") |
---|
1474 | (is (= (length topic-psis) 1))) |
---|
1475 | ((string= (first topic-psis) |
---|
1476 | "http://psi.egovpt.org/subject/GeoData") |
---|
1477 | (is (= (length topic-psis) 1))) |
---|
1478 | ((string= (first topic-psis) |
---|
1479 | "http://psi.egovpt.org/subject/Legal+Data") |
---|
1480 | (is (= (length topic-psis) 1))) |
---|
1481 | ((string= |
---|
1482 | (first topic-psis) |
---|
1483 | "http://psi.egovpt.org/service/Norwegian+National+Curriculum") |
---|
1484 | (is (= (length topic-psis) 1))) |
---|
1485 | ((or (string= (first topic-psis) |
---|
1486 | "http://psi.egovpt.org/service/Google+Maps") |
---|
1487 | (string= (first topic-psis) |
---|
1488 | "http://maps.google.com")) |
---|
1489 | (is (= (length topic-psis) 2)) |
---|
1490 | (is (or (string= (second topic-psis) |
---|
1491 | "http://psi.egovpt.org/service/Google+Maps") |
---|
1492 | (string= (second topic-psis) |
---|
1493 | "http://maps.google.com")))) |
---|
1494 | (t |
---|
1495 | (is-true (format t "found bad topic-psis: ~a" topic-psis))))))))) |
---|
1496 | |
---|
1497 | |
---|
1498 | (defun run-json-tests() |
---|
1499 | (tear-down-test-db) |
---|
1500 | (it.bese.fiveam:run! 'test-get-fragment-values-from-json-list-general) |
---|
1501 | (it.bese.fiveam:run! 'test-get-fragment-values-from-json-list-names) |
---|
1502 | (it.bese.fiveam:run! 'test-get-fragment-values-from-json-list-occurrences) |
---|
1503 | (it.bese.fiveam:run! 'test-get-fragment-values-from-json-list-topicStubs) |
---|
1504 | (it.bese.fiveam:run! 'test-get-fragment-values-from-json-list-associations) |
---|
1505 | (it.bese.fiveam:run! 'test-json-importer-general-1) |
---|
1506 | (it.bese.fiveam:run! 'test-json-importer-general-2) |
---|
1507 | (it.bese.fiveam:run! 'test-json-importer-general-3) |
---|
1508 | (it.bese.fiveam:run! 'test-json-importer-topics-1) |
---|
1509 | (it.bese.fiveam:run! 'test-json-importer-topics-2) |
---|
1510 | (it.bese.fiveam:run! 'test-json-importer-topics-3) |
---|
1511 | (it.bese.fiveam:run! 'test-json-importer-topics-4) |
---|
1512 | (it.bese.fiveam:run! 'test-json-importer-associations) |
---|
1513 | (it.bese.fiveam:run! 'test-json-importer-merge-1) |
---|
1514 | (it.bese.fiveam:run! 'test-json-importer-merge-2) |
---|
1515 | (it.bese.fiveam:run! 'test-json-importer-merge-3) |
---|
1516 | (it.bese.fiveam:run! 'test-to-json-string-associations) |
---|
1517 | (it.bese.fiveam:run! 'test-to-json-string-fragments) |
---|
1518 | (it.bese.fiveam:run! 'test-to-json-string-topics) |
---|
1519 | (it.bese.fiveam:run! 'test-get-all-topic-psis)) |
---|