phillord / tawny-owl

Build OWL Ontologies in a Programmatic Environment
GNU Lesser General Public License v3.0
251 stars 54 forks source link

missing tawny-name annotation #14

Closed jaydchan closed 10 years ago

jaydchan commented 10 years ago

Test to ensure that all classes - including those not pre-defined (i.e. j2) have a tawny-name annotation.

(deftest tawny-name [](let [j1 %28o/owl-class to) j2 (first (o/superclasses to j1))] (is (not (empty? (.getAnnotations j1 to)))) (is (not (empty? (.getAnnotations j2 to))))))

phillord commented 10 years ago

The test case doesn't actually work am afraid. Can you provide a complete test case.

jaydchan commented 10 years ago

My understanding of tawny-name annotations is:

Due to the design of Tawny-OWL, only entities that are explicitly defined are given a tawny-name annotation.

As A and C classes are explicity defined using defclass and owl-class functions, A and C have tawny-name annotations.

However B and D classes are entities that were created by 'side-effect', therefore they do not have tawny-name annotations.

The corrected (and complete) test is:

(deftest tawny-name
  (o/defontology ont
    :iri "http://test")
  (o/defclass A :super "B")
  (let [B (first (o/superclasses ont A))
        C (o/owl-class "C" :super "D")
        D (first (o/superclasses ont C))]
    (is
     (= tawny.tawny/name
        (.getProperty
         (first
          (.getAnnotations A ont)))))
    (is
     (empty?
      (.getAnnotations B ont)))
    (is
     (= tawny.tawny/name
        (.getProperty
         (first
          (.getAnnotations C ont)))))
    (is
     (empty?
      (.getAnnotations D ont)))))

Thus this 'issue' is not actually an issue, and should be closed.