Changeset 161 for trunk/src/unit_tests


Ignore:
Timestamp:
12/04/09 16:06:21 (15 years ago)
Author:
lgiessmann
Message:

added some unit-tests for the rdf-module

Location:
trunk/src/unit_tests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/src/unit_tests/reification.rdf

    r160 r161  
    3333  <!-- reification in Topic-Maps-mapped-RDF -->
    3434  <rdf:Description rdf:about="http://simpsons.tv/lisa">
     35    <rdf:type rdf:resource="http://isidorus/tm2rdf_mapping/types/Topic"/>
    3536    <isi:name>
    3637      <rdf:Description>
  • TabularUnified trunk/src/unit_tests/reification_test.lisp

    r160 r161  
    3939   :test-xtm2.0-reification-exporter
    4040   :test-rdf-importer-reification
    41    :test-rdf-importer-reification-2))
     41   :test-rdf-importer-reification-2
     42   :test-rdf-importer-reification-3))
    4243
    4344
     
    551552                      "</rdf:Description>"
    552553                      "</rdf:RDF>")))
     554    (clean-out-db db-dir)
    553555    (let ((dom-1 (cxml:parse doc-1 (cxml-dom:make-dom-builder))))
    554556      (is-true dom-1)
     
    635637        (revision-1 100)
    636638        (document-id "doc-id"))
     639    (clean-out-db db-dir)
    637640    (rdf-importer:rdf-importer
    638641     *reification.rdf* db-dir :tm-id tm-id
    639642     :document-id document-id :start-revision revision-1)
    640 
    641     ))
     643    (elephant:open-store (xml-importer:get-store-spec db-dir))
     644    (let ((homer (get-item-by-id "http://simpsons.tv/homer" :xtm-id document-id))
     645          (bart (get-item-by-id "http://simpsons.tv/bart" :xtm-id document-id))
     646          (married (get-item-by-id "http://simpsons.tv/arcs/married" :xtm-id document-id)))
     647      (is-true homer)
     648      (is-true bart)
     649      (is-true married)
     650      (is (= (length (used-as-type married)) 1))
     651      (is-true (reifier (first (used-as-type married))))
     652      (is-true (reified (reifier (first (used-as-type married)))))
     653      (is (= (length (psis (reifier (first (used-as-type married))))) 1))
     654      (is (string= (uri (first (psis (reifier (first (used-as-type married))))))
     655                   "http://test-tm#married-arc"))
     656      (is (= (length (occurrences bart)) 1))
     657      (is-true (reifier (first (occurrences bart))))
     658      (is-true (reified (reifier (first (occurrences bart)))))
     659      (is (string= (uri (first (psis (reifier (first (occurrences bart))))))
     660                   "http://test-tm#lastName-arc"))))
     661  (elephant:close-store))
     662
     663
     664(test test-rdf-importer-reification-3
     665  "Tests the rdf-importer, especially some reification cases of
     666   the tm2rdf mapping."
     667  (let ((db-dir "data_base")
     668        (tm-id "http://test-tm/")
     669        (revision-1 100)
     670        (document-id "doc-id"))
     671    (clean-out-db db-dir)
     672    (rdf-importer:rdf-importer
     673     *reification.rdf* db-dir :tm-id tm-id
     674     :document-id document-id :start-revision revision-1)
     675    (elephant:open-store (xml-importer:get-store-spec db-dir))
     676    (let ((lisa (get-item-by-id "http://simpsons.tv/lisa" :xtm-id document-id)))
     677      (is-true lisa)
     678      (is (= (length (names lisa)) 1))
     679      (is (= (length (occurrences lisa)) 1))
     680      (let ((name (first (names lisa)))
     681            (occurrence (first (occurrences lisa))))
     682        (is (= (length (variants name)) 1))
     683        (let ((variant (first (variants name))))
     684          (is-true (reifier name))
     685          (is-true (reified (reifier name)))
     686          (is (= (length (psis (reifier name))) 1))
     687          (is (string= (uri (first (psis (reifier name))))
     688                       (concatenate 'string tm-id "lisa-name")))
     689          (is-true (reifier variant))
     690          (is-true (reified (reifier variant)))
     691          (is (= (length (psis (reifier variant))) 1))
     692          (is (string= (uri (first (psis (reifier variant))))
     693                       (concatenate 'string tm-id "lisa-name-variant")))
     694          (is-true (reifier occurrence))
     695          (is-true (reified (reifier occurrence)))
     696          (is (= (length (psis (reifier occurrence))) 1))
     697          (is (string= (uri (first (psis (reifier occurrence))))
     698                       (concatenate 'string tm-id "lisa-occurrence")))))))
     699  (elephant:close-store))
    642700
    643701
     
    648706;;TODO: check fragment exporter
    649707;;TODO: extend the fragment-importer in the RESTful-interface
     708;;TODO: Delete the tm2rdf-mapping-constructs --> maybe there is a bug in the map-to-tm-file???
    650709;;TODO: DOKU
    651710
     
    658717  (it.bese.fiveam:run! 'test-xtm2.0-reification-exporter)
    659718  (it.bese.fiveam:run! 'test-rdf-importer-reification)
    660   (it.bese.fiveam:run! 'test-rdf-importer-reification-2))
     719  (it.bese.fiveam:run! 'test-rdf-importer-reification-2)
     720  (it.bese.fiveam:run! 'test-rdf-importer-reification-3))
Note: See TracChangeset for help on using the changeset viewer.