Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Type hints added to all namespaces.
All namespaces now load without reflection warnings.
Tests added to ensure this does not revert.
  • Loading branch information
phillord-ncl committed Dec 12, 2013
1 parent d8d0cc6 commit 0978906
Show file tree
Hide file tree
Showing 17 changed files with 561 additions and 257 deletions.
7 changes: 7 additions & 0 deletions docs/releases.md
Expand Up @@ -21,10 +21,17 @@ Release Notes
- Unqualified cardinality is now supported without using of `owl-thing` - Unqualified cardinality is now supported without using of `owl-thing`
- The JFact reasoner is now supported. - The JFact reasoner is now supported.
- New aliases have been added to `tawny.english`. - New aliases have been added to `tawny.english`.
- All namespaces now load without reflection warnings, having been heavily
type-hinted. This should introduce no changes but many namespaces run much
faster; `tawny.owl` about 2x, `tawny.render` perhaps 5x for very
approximate benchmarks.


## Breaking Changes ## Breaking Changes
- `disjoint-classes` list has been removed, and `disjoint-classes-list` has - `disjoint-classes` list has been removed, and `disjoint-classes-list` has
been renamed to `disjoint-classes`! been renamed to `disjoint-classes`!
- `tawny.protege-nrepl` has now been removed; its had dependencies that were
not explicitly specified as it ran inside protege. It is now in a project
of its own, called `tawny.protege`.


## Bug Fixes ## Bug Fixes
- `datatype` equivalents were limited to other datatypes. Now any datarange - `datatype` equivalents were limited to other datatypes. Now any datarange
Expand Down
2 changes: 1 addition & 1 deletion src/tawny/debug.clj
Expand Up @@ -23,7 +23,7 @@
] ]
(println "Default ontology used") (println "Default ontology used")
(doseq (doseq
[l (take 30 st) [^StackTraceElement l (take 30 st)
:when (every? :when (every?
#(not #(not
(.contains (.contains
Expand Down
2 changes: 1 addition & 1 deletion src/tawny/emacs.clj
Expand Up @@ -79,7 +79,7 @@ NAMESPACE"
(clojure.string/join (clojure.string/join
"\n" "\n"
(map (map
#(.toString %) #(.toString ^Object %)
classes))) classes)))


(defn get-unsatisfiable [namespace] (defn get-unsatisfiable [namespace]
Expand Down
1 change: 1 addition & 0 deletions src/tawny/lookup.clj
Expand Up @@ -74,6 +74,7 @@ space, if it the var is not in the current namespace."
"Given an OWLNamedObject, return the IRI." "Given an OWLNamedObject, return the IRI."
[entity] [entity]
(-> entity (-> entity
tawny.owl/as-named-object
(.getIRI) (.getIRI)
(.toString))) (.toString)))


Expand Down
12 changes: 6 additions & 6 deletions src/tawny/obo.clj
Expand Up @@ -25,7 +25,8 @@




(def (def
^{:doc "Root of IRI that is used for temporary IRIs"} ^{:doc "Root of IRI that is used for temporary IRIs"
:tag 'String}
obo-pre-iri obo-pre-iri
"http://purl.org/ontolink/preiri/") "http://purl.org/ontolink/preiri/")


Expand Down Expand Up @@ -58,7 +59,7 @@ in :name-to-iri-current, while IDs loaded from file are stored in
assoc assoc
:name-to-iri-current :name-to-iri-current
(assoc current name iri))) (assoc current name iri)))
(IRI/create iri))) (tawny.owl/iri iri)))


(defn obo-read-map (defn obo-read-map
"Read a properties file, and return a hashmap of Clojure identifier to IRI." "Read a properties file, and return a hashmap of Clojure identifier to IRI."
Expand All @@ -81,7 +82,7 @@ in :name-to-iri-current, while IDs loaded from file are stored in


(defn preiri? (defn preiri?
"Return true if the (string) IRI is a auto-generated 'pre' IRI." "Return true if the (string) IRI is a auto-generated 'pre' IRI."
[iri] [^String iri]
(.startsWith iri obo-pre-iri)) (.startsWith iri obo-pre-iri))


(defn obo-sort (defn obo-sort
Expand Down Expand Up @@ -163,11 +164,10 @@ longer exist in the ontology. There are, effectively, obsolete terms."
"Assigns new permanent identifiers to map. In detail, this expects an map "Assigns new permanent identifiers to map. In detail, this expects an map
between identifiers and IRI. For all those IRIs which return true for preiri?, between identifiers and IRI. For all those IRIs which return true for preiri?,
a new numeric identifier is created, incrementing from the current largest." a new numeric identifier is created, incrementing from the current largest."

[name-to-iri ^String prefix]
[name-to-iri prefix]
(let ;; fetch the numeric part of IDs beginning with the prefix. (let ;; fetch the numeric part of IDs beginning with the prefix.
[ids [ids
(map (fn [[name iri]] (map (fn [[name ^String iri]]
(if (.startsWith iri prefix) (if (.startsWith iri prefix)
(Integer/parseInt (.substring iri (.length prefix))) (Integer/parseInt (.substring iri (.length prefix)))
0)) 0))
Expand Down

0 comments on commit 0978906

Please sign in to comment.