Ignore:
Timestamp:
10/06/10 21:30:04 (15 years ago)
Author:
lgiessmann
Message:

new-datamodel: adapted the rdf-importer unit-tests to the new datamodel; adapted the rdf-importer and the rdf-importer-mapping-tools to the new datamodel; fixed a bug in elephant where all subclasses of PointerC are returned when requesting one particular subctype

Location:
branches/new-datamodel/src/unit_tests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified branches/new-datamodel/src/unit_tests/fixtures.lisp

    r298 r320  
    191191    (rdf-importer:setup-rdf-module *poems_light.rdf* db-dir :tm-id tm-id
    192192                                   :document-id document-id)
    193     (elephant:open-store (xml-importer:get-store-spec db-dir))
     193   
     194    ;(elephant:open-store (xml-importer:get-store-spec db-dir))
    194195    (&body)
    195196    (tear-down-test-db)))
  • TabularUnified branches/new-datamodel/src/unit_tests/rdf_importer_test.lisp

    r154 r320  
    10551055          (is (= (length (elephant:get-instances-by-class 'd:TopicC)) 20))
    10561056          (let ((first-node (get-item-by-id "http://test-tm/first-node"
    1057                                             :xtm-id document-id))
     1057                                            :xtm-id document-id
     1058                                            :revision 0))
    10581059                (first-type (get-item-by-id "http://test-tm/first-type"
    1059                                             :xtm-id document-id)))
     1060                                            :xtm-id document-id
     1061                                            :revision 0)))
    10601062            (is-true first-node)
    10611063            (is (= (length (d::versions first-node)) 1))
     
    10671069            (is (= (length (d:player-in-roles first-type)) 1))
    10681070            (let ((instance-role
    1069                    (first (d:player-in-roles first-node)))
     1071                   (first (d:player-in-roles first-node :revision 0)))
    10701072                  (type-role
    1071                    (first (d:player-in-roles first-type)))
     1073                   (first (d:player-in-roles first-type :revision 0)))
    10721074                  (type-assoc
    1073                    (d:parent (first (d:player-in-roles first-node)))))
     1075                   (d:parent (first (d:player-in-roles first-node :revision 0))
     1076                             :revision 0)))
    10741077              (is (= (length (d::versions type-assoc)) 1))
    10751078              (is (= (d::start-revision (first (d::versions type-assoc)))
     
    10811084              (is (eql (d:instance-of type-assoc)
    10821085                       (d:get-item-by-psi *type-instance-psi*)))
    1083               (is (= (length (d:roles type-assoc)) 2))
     1086              (is (= (length (d:roles type-assoc :revision 0)) 2))
    10841087              (is (= (length (d:psis first-node)) 1))
    10851088              (is (= (length (d:psis first-type)) 1))
     
    10961099                                         :document-id document-id))
    10971100            (let ((first-node (get-item-by-id "http://test-tm/first-node"
    1098                                               :xtm-id document-id))
     1101                                              :xtm-id document-id
     1102                                              :revision 0))
    10991103                  (first-type (get-item-by-id "http://test-tm/first-type"
    1100                                               :xtm-id document-id))
     1104                                              :xtm-id document-id
     1105                                              :revision 0))
    11011106                  (second-node (get-item-by-id "second-node"
    1102                                                :xtm-id document-id))
     1107                                               :xtm-id document-id
     1108                                               :revision 0))
    11031109                  (second-type (get-item-by-id "http://test-tm/second-type"
    1104                                                :xtm-id document-id))
     1110                                               :xtm-id document-id
     1111                                               :revision 0))
    11051112                  (third-node (get-item-by-id "http://test-tm#third-node"
    1106                                               :xtm-id document-id)))
     1113                                              :xtm-id document-id
     1114                                              :revision 0)))
    11071115              (is-true second-node)
    1108               (is-false (d:psis second-node))
    1109               (is-false (d:occurrences second-node))
    1110               (is-false (d:names second-node))
     1116              (is-false (d:psis second-node :revision 0))
     1117              (is-false (d:occurrences second-node :revision 0))
     1118              (is-false (d:names second-node :revision 0))
    11111119              (is-true first-node)
    11121120              (is (= (length (d::versions first-node)) 2))
     
    11201128                                (d::versions first-node)))
    11211129              (let ((instance-role
    1122                      (first (d:player-in-roles first-node)))
     1130                     (first (d:player-in-roles first-node :revision 0)))
    11231131                    (type-role
    1124                      (first (d:player-in-roles first-type)))
     1132                     (first (d:player-in-roles first-type :revision 0)))
    11251133                    (type-assoc
    1126                      (d:parent (first (d:player-in-roles first-node))))
    1127                     (type-topic (get-item-by-psi *type-psi*))
    1128                     (instance-topic (get-item-by-psi *instance-psi*))
    1129                     (type-instance-topic (get-item-by-psi *type-instance-psi*))
    1130                     (supertype-topic (get-item-by-psi *supertype-psi*))
    1131                     (subtype-topic (get-item-by-psi *subtype-psi*))
     1134                     (d:parent (first (d:player-in-roles first-node
     1135                                                         :revision 0))))
     1136                    (type-topic (get-item-by-psi *type-psi* :revision 0))
     1137                    (instance-topic (get-item-by-psi *instance-psi* :revision 0))
     1138                    (type-instance-topic (get-item-by-psi *type-instance-psi*
     1139                                                          :revision 0))
     1140                    (supertype-topic (get-item-by-psi *supertype-psi*
     1141                                                      :revision 0))
     1142                    (subtype-topic (get-item-by-psi *subtype-psi*
     1143                                                    :revision 0))
    11321144                    (supertype-subtype-topic
    1133                      (get-item-by-psi *supertype-subtype-psi*))
     1145                     (get-item-by-psi *supertype-subtype-psi* :revision 0))
    11341146                    (arc2-occurrence (elephant:get-instance-by-value
    11351147                                      'd:OccurrenceC 'd:charvalue "arc-2"))
     
    11391151                      "<root><content type=\"anyContent\">content</content></root>"))
    11401152                    (fifth-node (d:get-item-by-id "http://test-tm#fifth-node"
    1141                                                   :xtm-id document-id)))
    1142                 (is (eql (d:instance-of instance-role)
    1143                          (d:get-item-by-psi *instance-psi*)))
    1144                 (is (eql (d:instance-of type-role)
    1145                          (d:get-item-by-psi *type-psi*)))
    1146                 (is (eql (d:instance-of type-assoc)
    1147                          (d:get-item-by-psi *type-instance-psi*)))
    1148                 (is (= (length (d:roles type-assoc)) 2))
    1149                 (is (= (length (d:psis first-node)) 1))
    1150                 (is (= (length (d:psis first-type)) 1))
    1151                 (is (= (length (d::versions type-assoc)) 1))
    1152                 (is (= (length (d:player-in-roles second-node)) 2))
     1153                                                  :xtm-id document-id
     1154                                                  :revision 0)))
     1155                (is (eql (d:instance-of instance-role :revision 0)
     1156                         (d:get-item-by-psi *instance-psi* :revision 0)))
     1157                (is (eql (d:instance-of type-role :revision 0)
     1158                         (d:get-item-by-psi *type-psi* :revision 0)))
     1159                (is (eql (d:instance-of type-assoc :revision 0)
     1160                         (d:get-item-by-psi *type-instance-psi* :revision 0)))
     1161                (is (= (length (d:roles type-assoc :revision 0)) 2))
     1162                (is (= (length (d:psis first-node :revision 0)) 1))
     1163                (is (= (length (d:psis first-type :revision 0)) 1))
     1164                (is (= (length (d::versions type-assoc)) 2))
     1165                (is (= (length (d:player-in-roles second-node :revision 0)) 2))
    11531166                (is-true (find-if
    11541167                          #'(lambda(x)
     
    11771190                (is-true arc2-occurrence)
    11781191                (is (string= (d:datatype arc2-occurrence) "http://test-tm/dt"))
    1179                 (is-false (d:psis (d:topic arc2-occurrence)))
    1180                 (is (= (length (d::versions (d:topic arc2-occurrence))) 1))
     1192                (is-false (d:psis (d:parent arc2-occurrence)))
     1193                (is (= (length (d::versions (d:parent arc2-occurrence))) 1))
    11811194                (is (= (d::start-revision
    1182                         (first (d::versions (d:topic arc2-occurrence))))
     1195                        (first (d::versions (d:parent arc2-occurrence))))
    11831196                       revision-3))
    11841197                (is (= (d::end-revision
    1185                         (first (d::versions (d:topic arc2-occurrence)))) 0))
     1198                        (first (d::versions (d:parent arc2-occurrence)))) 0))
    11861199                (is-true arc3-occurrence)
    1187                 (is (= (length (d:psis (d:topic arc3-occurrence)))))
    1188                 (is (string= (d:uri (first (d:psis (d:topic arc3-occurrence))))
     1200                (is (= (length (d:psis (d:parent arc3-occurrence)))))
     1201                (is (string= (d:uri (first (d:psis (d:parent arc3-occurrence))))
    11891202                             "http://test-tm/fourth-node"))
    11901203                (is (string= (d:datatype arc3-occurrence)
     
    15931606                       (string= *xml-string* (d:datatype x))
    15941607                       (= (length (d:themes x)) 0)
    1595                        (= (length (d:psis (d:topic x))) 1)
    1596                        (string= (d:uri (first (d:psis (d:topic x))))
     1608                       (= (length (d:psis (d:parent x))) 1)
     1609                       (string= (d:uri (first (d:psis (d:parent x))))
    15971610                                goethe)))
    15981611              occs)
     
    16051618                       (string= *xml-string* (d:datatype x))
    16061619                       (= (length (d:themes x)) 0)
    1607                        (= (length (d:psis (d:topic x))) 1)
    1608                        (string= (d:uri (first (d:psis (d:topic x))))
     1620                       (= (length (d:psis (d:parent x))) 1)
     1621                       (string= (d:uri (first (d:psis (d:parent x))))
    16091622                                goethe)))
    16101623              occs)
     
    16171630                       (string= *xml-string* (d:datatype x))
    16181631                       (= (length (d:themes x)) 0)
    1619                        (= (length (d:psis (d:topic x))) 1)
    1620                        (string= (d:uri (first (d:psis (d:topic x))))
     1632                       (= (length (d:psis (d:parent x))) 1)
     1633                       (string= (d:uri (first (d:psis (d:parent x))))
    16211634                                weimar)))
    16221635              occs)
     
    16291642                       (string= *xml-string* (d:datatype x))
    16301643                       (= (length (d:themes x)) 0)
    1631                        (= (length (d:psis (d:topic x))) 1)
    1632                        (string= (d:uri (first (d:psis (d:topic x))))
     1644                       (= (length (d:psis (d:parent x))) 1)
     1645                       (string= (d:uri (first (d:psis (d:parent x))))
    16331646                                frankfurt)))
    16341647              occs)
     
    16421655                       (= 1 (length (d:themes x)))
    16431656                       (eql (first (d:themes x)) de)
    1644                        (= (length (d:psis (d:topic x))) 1)
    1645                        (string= (d:uri (first (d:psis (d:topic x))))
     1657                       (= (length (d:psis (d:parent x))) 1)
     1658                       (string= (d:uri (first (d:psis (d:parent x))))
    16461659                                germany)))
    16471660              occs)
     
    16561669                       (= 1 (length (d:themes x)))
    16571670                       (eql (first (d:themes x)) de)
    1658                        (= (length (d:psis (d:topic x))) 1)
    1659                        (string= (d:uri (first (d:psis (d:topic x))))
     1671                       (= (length (d:psis (d:parent x))) 1)
     1672                       (string= (d:uri (first (d:psis (d:parent x))))
    16601673                                zauberlehrling)))
    16611674              occs)
     
    16691682                       (string= (d:charvalue x) "Prometheus")
    16701683                       (string= *xml-string* (d:datatype x))
    1671                        (= (length (d:psis (d:topic x))) 1)
    1672                        (string= (d:uri (first (d:psis (d:topic x))))
     1684                       (= (length (d:psis (d:parent x))) 1)
     1685                       (string= (d:uri (first (d:psis (d:parent x))))
    16731686                                prometheus)))
    16741687              occs)
     
    16831696                       (= 1 (length (d:themes x)))
    16841697                       (eql (first (d:themes x)) de)
    1685                        (= (length (d:psis (d:topic x))) 1)
    1686                        (string= (d:uri (first (d:psis (d:topic x))))
     1698                       (= (length (d:psis (d:parent x))) 1)
     1699                       (string= (d:uri (first (d:psis (d:parent x))))
    16871700                                erlkoenig)))
    16881701              occs)
     
    16971710                       (= 1 (length (d:themes x)))
    16981711                       (eql (first (d:themes x)) de)
    1699                        (= (length (d:psis (d:topic x))) 1)
    1700                        (string= (d:uri (first (d:psis (d:topic x))))
     1712                       (= (length (d:psis (d:parent x))) 1)
     1713                       (string= (d:uri (first (d:psis (d:parent x))))
    17011714                                zauberlehrling)))
    17021715              occs)
     
    17121725                       (= 1 (length (d:themes x)))
    17131726                       (eql (first (d:themes x)) de)
    1714                        (= (length (d:psis (d:topic x))) 1)
    1715                        (string= (d:uri (first (d:psis (d:topic x))))
     1727                       (= (length (d:psis (d:parent x))) 1)
     1728                       (string= (d:uri (first (d:psis (d:parent x))))
    17161729                                prometheus)))
    17171730              occs)
     
    17271740                       (= 1 (length (d:themes x)))
    17281741                       (eql (first (d:themes x)) de)
    1729                        (= (length (d:psis (d:topic x))) 1)
    1730                        (string= (d:uri (first (d:psis (d:topic x))))
     1742                       (= (length (d:psis (d:parent x))) 1)
     1743                       (string= (d:uri (first (d:psis (d:parent x))))
    17311744                                erlkoenig)))
    17321745              occs)
     
    17391752                       (string= long (d:datatype x))
    17401753                       (= 0 (length (d:themes x)))
    1741                        (= (length (d:psis (d:topic x))) 1)
    1742                        (string= (d:uri (first (d:psis (d:topic x))))
     1754                       (= (length (d:psis (d:parent x))) 1)
     1755                       (string= (d:uri (first (d:psis (d:parent x))))
    17431756                                weimar)))
    17441757              occs)
     
    17511764                       (string= long (d:datatype x))
    17521765                       (= 0 (length (d:themes x)))
    1753                        (= (length (d:psis (d:topic x))) 1)
    1754                        (string= (d:uri (first (d:psis (d:topic x))))
     1766                       (= (length (d:psis (d:parent x))) 1)
     1767                       (string= (d:uri (first (d:psis (d:parent x))))
    17551768                                frankfurt)))
    17561769              occs)
     
    17631776                       (string= long (d:datatype x))
    17641777                       (= 0 (length (d:themes x)))
    1765                        (= (length (d:psis (d:topic x))) 1)
    1766                        (string= (d:uri (first (d:psis (d:topic x))))
     1778                       (= (length (d:psis (d:parent x))) 1)
     1779                       (string= (d:uri (first (d:psis (d:parent x))))
    17671780                                berlin)))
    17681781              occs)
     
    17751788                       (string= long (d:datatype x))
    17761789                       (= 0 (length (d:themes x)))
    1777                        (= (length (d:psis (d:topic x))) 1)
    1778                        (string= (d:uri (first (d:psis (d:topic x))))
     1790                       (= (length (d:psis (d:parent x))) 1)
     1791                       (string= (d:uri (first (d:psis (d:parent x))))
    17791792                                germany)))
    17801793              occs)
     
    17871800                       (string= date (d:datatype x))
    17881801                       (= 0 (length (d:themes x)))
    1789                        (= (length (d:psis (d:topic x))) 0)))
     1802                       (= (length (d:psis (d:parent x))) 0)))
    17901803              occs)
    17911804             2))
     
    17981811                       (= 1 (length (d:themes x)))
    17991812                       (eql (first (d:themes x)) de)
    1800                        (= (length (d:psis (d:topic x))) 0)))
     1813                       (= (length (d:psis (d:parent x))) 0)))
    18011814             
    18021815              occs)
     
    18091822                       (string= date (d:datatype x))
    18101823                       (= 0 (length (d:themes x)))
    1811                        (= (length (d:psis (d:topic x))) 0)))
     1824                       (= (length (d:psis (d:parent x))) 0)))
    18121825             
    18131826              occs)
     
    18211834                       (= 1 (length (d:themes x)))
    18221835                       (eql (first (d:themes x)) de)
    1823                        (= (length (d:psis (d:topic x))) 0)))
     1836                       (= (length (d:psis (d:parent x))) 0)))
    18241837              occs)
    18251838             1))
     
    18311844                       (string= date (d:datatype x))
    18321845                       (= 0 (length (d:themes x)))
    1833                        (= (length (d:psis (d:topic x))) 0)))
     1846                       (= (length (d:psis (d:parent x))) 0)))
    18341847              occs)
    18351848             2)))))
     
    28542867                               :tm-id tm-id
    28552868                               :document-id document-id)
    2856     (elephant:open-store (xml-importer:get-store-spec dir))
     2869    ;(elephant:open-store (xml-importer:get-store-spec dir))
    28572870    (is (= (length (elephant:get-instances-by-class 'd:TopicC)) 15))
    28582871    (is (= (length (elephant:get-instances-by-class 'd:AssociationC)) 1))
     
    29382951        (is (string= (d:charvalue marge-fn) "Marjorie"))
    29392952        (is (string= (d:charvalue marge-ln) "Simpson"))
    2940         (is (= (length (d:variants marge-fn)) 1))
    2941         (is (= (length (d:themes (first (d:variants marge-fn)))) 1))
    2942         (is (eql (first (d:themes (first (d:variants marge-fn)))) display))
    2943         (is (string= (d:charvalue (first (d:variants marge-fn))) "Marge"))
    2944         (is (string= (d:datatype (first (d:variants marge-fn))) *xml-string*))
     2953        (is (= (length (d:variants marge-fn :revision 0)) 1))
     2954        (is (= (length (d:themes (first (d:variants marge-fn :revision 0))
     2955                                 :revision 0)) 1))
     2956        (is (eql (first (d:themes (first (d:variants marge-fn :revision 0))
     2957                                  :revision 0)) display))
     2958        (is (string= (d:charvalue (first (d:variants marge-fn :revision 0))) "Marge"))
     2959        (is (string= (d:datatype (first (d:variants marge-fn :revision 0))) *xml-string*))
    29452960        (is-true marge-occ)
    29462961        (is (string= (d:charvalue marge-occ) "Housewife"))
    29472962        (is (string= (d:datatype marge-occ) *xml-string*))
    2948         (is (= (length (d:themes marge-occ)) 0))
    2949         (is (= (length (d:psis marge)) 2))))))
     2963        (is (= (length (d:themes marge-occ :revision 0)) 0))
     2964        (is (= (length (d:psis marge :revision 0)) 2))))))
    29502965
    29512966
Note: See TracChangeset for help on using the changeset viewer.