Skip to content

Commit

Permalink
#148 #146 - dns:supersense -> wn:lexfile
Browse files Browse the repository at this point in the history
  • Loading branch information
simongray committed Nov 29, 2024
1 parent e203b0d commit 388b430
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
16 changes: 16 additions & 0 deletions src/main/dk/cst/dannet/db/bootstrap.clj
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,22 @@
(println "... adding" (count triples-to-add) "supersenses")
(db/safe-add! g triples-to-add))))

(defn rename-supersense->lexfile!
[dataset]
(let [g (db/get-graph dataset prefix/dn-uri)
model (db/get-model dataset prefix/dn-uri)
ms (q/run g '[:bgp
[?synset :dns/supersense ?supersense]])
triples-to-add (map (fn [{:syms [?synset ?supersense]}]
[?synset :wn/lexfile ?supersense])
ms)]
(txn/transact-exec model
(println "... removing" (count ms) "supersense rels")
(db/remove! model '[_ :dns/supersense _]))
(txn/transact-exec g
(println "... adding" (count triples-to-add) "lexfile rels")
(db/safe-add! g triples-to-add))))

(defn fix-verb-creation-supersenses!
[dataset]
(let [g (db/get-graph dataset prefix/dn-uri)
Expand Down
5 changes: 3 additions & 2 deletions src/main/dk/cst/dannet/web/resources.clj
Original file line number Diff line number Diff line change
Expand Up @@ -633,8 +633,7 @@

;; Test for existence of duplicate ontotypes
(->> (q/run (:graph @db) '[:bgp
[?s1 :dns/ontologicalType ?o1]
[?s1 :dns/ontologicalType ?o2]])
[?synset :dns/supersense ?supersense]])
(filter (fn [{:syms [?o1 ?o2]}] (not= ?o1 ?o2))))

;; 51 cases of true duplicates
Expand Down Expand Up @@ -664,6 +663,8 @@
;; Find unlabeled senses (count: 0)
(count (q/run (:graph @db) op/unlabeled-senses))

(dk.cst.dannet.db.bootstrap/rename-supersense->lexfile! (:dataset @db))

;; Testing autocompletion
(autocomplete* "sar")
(autocomplete* "spo")
Expand Down
4 changes: 3 additions & 1 deletion src/main/dk/cst/dannet/web/section.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
:lexinfo/partOfSpeech
:wn/partOfSpeech
:dns/sentiment
:dns/ontologicalType
:skos/definition
:wn/lexfile
:dns/ontologicalType
:wn/definition
:rdfs/comment
:lexinfo/senseExample
Expand All @@ -33,6 +34,7 @@
[semantic-title
(some-fn (prefix/with-prefix 'wn :except #{:wn/partOfSpeech
:wn/definition
:wn/lexfile
:wn/example})
(comp #{:dns/usedFor
:dns/usedForObject
Expand Down

0 comments on commit 388b430

Please sign in to comment.