From d5e8656fa451096094a4872237861395d38ebcd2 Mon Sep 17 00:00:00 2001 From: duncdrum Date: Sat, 10 Apr 2021 04:33:14 +0200 Subject: [PATCH] feat(v4): upgrade corenlp to v4 --- pom.xml | 4 ++-- src/main/polymer/package-lock.json | 4 ++-- src/main/polymer/package.json | 2 +- src/main/xar-resources/modules/load-language.xqm | 1 + src/main/xar-resources/modules/load-languages.xq | 15 ++++++++------- .../xar-resources/modules/schedule-language.xq | 3 ++- src/main/xar-resources/modules/schedule-load.xq | 3 ++- src/main/xquery/config.xqm | 5 ++++- xar-assembly.xml | 8 ++++---- 9 files changed, 26 insertions(+), 19 deletions(-) diff --git a/pom.xml b/pom.xml index caa7966..416463c 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ org.exist-db stanford-nlp - 0.6.0-SNAPSHOT + 0.7.0-SNAPSHOT Stanford Natural Language Processing Integrates the Stanford CoreNLP annotation pipeline library into eXist-db. @@ -64,7 +64,7 @@ 5.0.0 v12.22.1 7.9.0 - 3.9.2 + 4.2.0 es5-bundled diff --git a/src/main/polymer/package-lock.json b/src/main/polymer/package-lock.json index a256753..1650f89 100644 --- a/src/main/polymer/package-lock.json +++ b/src/main/polymer/package-lock.json @@ -1,12 +1,12 @@ { "name": "polymer-starter-kit", - "version": "0.6.0-SNAPSHOT", + "version": "0.7.0-SNAPSHOT", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "polymer-starter-kit", - "version": "0.6.0-SNAPSHOT", + "version": "0.7.0-SNAPSHOT", "license": "BSD-3-Clause", "dependencies": { "@polymer/app-layout": "^3.1.0", diff --git a/src/main/polymer/package.json b/src/main/polymer/package.json index c16531d..a61a2b9 100644 --- a/src/main/polymer/package.json +++ b/src/main/polymer/package.json @@ -1,6 +1,6 @@ { "name": "polymer-starter-kit", - "version": "0.6.0-SNAPSHOT", + "version": "0.7.0-SNAPSHOT", "description": "A starting point for Polymer apps", "author": "The Polymer Authors", "license": "BSD-3-Clause", diff --git a/src/main/xar-resources/modules/load-language.xqm b/src/main/xar-resources/modules/load-language.xqm index 95fb1b2..a98c319 100644 --- a/src/main/xar-resources/modules/load-language.xqm +++ b/src/main/xar-resources/modules/load-language.xqm @@ -8,6 +8,7 @@ import module namespace console = "http://exist-db.org/xquery/console"; import module namespace functx = "http://www.functx.com"; import module namespace util = "http://exist-db.org/xquery/util"; import module namespace map = "http://www.w3.org/2005/xpath-functions/map"; +import module namespace xmldb = "http://exist-db.org/xquery/xmldb"; declare function ll:mkcol-recursive($collection, $components) { if (exists($components)) then diff --git a/src/main/xar-resources/modules/load-languages.xq b/src/main/xar-resources/modules/load-languages.xq index 1dcb765..9c570b9 100644 --- a/src/main/xar-resources/modules/load-languages.xq +++ b/src/main/xar-resources/modules/load-languages.xq @@ -1,16 +1,17 @@ xquery version "3.1"; import module namespace ll = "http://exist-db.org/xquery/stanford-nlp/load-language" at "load-language.xqm"; +import module namespace config = "http://exist-db.org/apps/stanford-nlp/config"; let $paths := ( - "http://nlp.stanford.edu/software/stanford-english-corenlp-2018-10-05-models.jar", - "http://nlp.stanford.edu/software/stanford-english-kbp-corenlp-2018-10-05-models.jar", - "http://nlp.stanford.edu/software/stanford-arabic-corenlp-2018-10-05-models.jar", - "http://nlp.stanford.edu/software/stanford-chinese-corenlp-2018-10-05-models.jar", - "http://nlp.stanford.edu/software/stanford-french-corenlp-2018-10-05-models.jar", - "http://nlp.stanford.edu/software/stanford-german-corenlp-2018-10-05-models.jar", - "http://nlp.stanford.edu/software/stanford-spanish-corenlp-2018-10-05-models.jar", + $config:corenlp-model-url || "arabic.jar", + $config:corenlp-model-url || "chinese.jar", + $config:corenlp-model-url || "english.jar", + $config:corenlp-model-url || "english-kbp.jar", + $config:corenlp-model-url || "french.jar", + $config:corenlp-model-url || "german.jar", + $config:corenlp-model-url || "spanish.jar", () ) diff --git a/src/main/xar-resources/modules/schedule-language.xq b/src/main/xar-resources/modules/schedule-language.xq index f19e9af..a15b7a5 100644 --- a/src/main/xar-resources/modules/schedule-language.xq +++ b/src/main/xar-resources/modules/schedule-language.xq @@ -1,7 +1,8 @@ xquery version "3.1"; import module namespace scheduler = "http://exist-db.org/xquery/scheduler"; +import module namespace config = "http://exist-db.org/apps/stanford-nlp/config"; -let $param := +let $param := return scheduler:schedule-xquery-periodic-job("/db/apps/stanford-nlp/module/schedule-load.xq", 500, "load chinese", $param, 500, 0) \ No newline at end of file diff --git a/src/main/xar-resources/modules/schedule-load.xq b/src/main/xar-resources/modules/schedule-load.xq index a88eb10..2b27e06 100644 --- a/src/main/xar-resources/modules/schedule-load.xq +++ b/src/main/xar-resources/modules/schedule-load.xq @@ -1,7 +1,8 @@ xquery version "3.1"; import module namespace ll = "http://exist-db.org/xquery/stanford-nlp/load-language" at "load-language.xqm"; +import module namespace config = "http://exist-db.org/apps/stanford-nlp/config"; -declare variable $local:path external := "http://nlp.stanford.edu/software/stanford-english-corenlp-2018-10-05-models.jar"; +declare variable $local:path external := $config:corenlp-model-url || 'english.jar'; ll:process($local:path) diff --git a/src/main/xquery/config.xqm b/src/main/xquery/config.xqm index 7de2dba..26fa276 100755 --- a/src/main/xquery/config.xqm +++ b/src/main/xquery/config.xqm @@ -33,9 +33,12 @@ declare variable $config:repo-descriptor := doc(concat($config:app-root, "/repo. declare variable $config:expath-descriptor := doc(concat($config:app-root, "/expath-pkg.xml"))/expath:package; - declare variable $config:data-root := concat($config:app-root, "/data"); +(: TODO(DP): use maven templating to construct version here :) +declare variable $config:corenlp-version := '4.2.0'; +declare variable $config:corenlp-model-url := 'http://nlp.stanford.edu/software/stanford-corenlp-' || $config:corenlp-version ||'-models-'; + (:~ : Resolve the given path using the current application context. : If the app resides in the file system, diff --git a/xar-assembly.xml b/xar-assembly.xml index f6f320b..e80b90c 100644 --- a/xar-assembly.xml +++ b/xar-assembly.xml @@ -69,24 +69,24 @@ edu.stanford.nlp stanford-corenlp - 3.9.2 + ${corenlp.version} edu.stanford.nlp stanford-corenlp - 3.9.2 + ${corenlp.version} models - + - +