Compare commits

...
Sign in to create a new pull request.

507 commits

Author SHA1 Message Date
f2cd58d841 Split search services 2023-09-23 16:02:04 +02:00
6838f16d60 fix: for prev commit 2023-09-23 16:02:04 +02:00
ab3236c270 leave internal bibliography and sources collapsed by default 2023-09-23 16:02:04 +02:00
4d25106578 fix: remove individuals from robots.txt disallowed 2023-09-23 16:02:04 +02:00
cf4f4db62e fix: do not encode uri # in queiries for POST 2023-09-23 16:02:04 +02:00
027875eaae fix: always save current search settings 2023-09-23 16:02:04 +02:00
5bc468389b fix: use attribute for excerpts names 2023-09-23 16:02:04 +02:00
e7b80d1b39 Revert "fix: new compilation creation path should be relative to current url"
This reverts commit 9c5ea6f39774d9c50737fe5d3c17b92dcb464c53.
2023-09-23 16:02:04 +02:00
74f64101b5 fix: new compilation creation path should be relative to current url 2023-09-23 16:02:04 +02:00
1bf47854f4 Added buttons to remove document from search results 2023-09-23 16:02:04 +02:00
8f9e85532a fix: for prev commits 2023-09-23 16:02:04 +02:00
9d8c668f32 fix: don't hide articles by default 2023-09-23 16:02:04 +02:00
238e87af4d fix: don't hide articles by default 2023-09-23 16:02:04 +02:00
42ea752e41 Added script to exclude uri from search 2023-09-23 16:02:04 +02:00
f71300f77e Moved shortconfig from Vitro branch 2023-09-23 16:02:04 +02:00
5bbd9b2471 Improved iph theme localization 2023-09-23 16:02:04 +02:00
51a1868d08 Moved localizations to properties 2023-09-23 16:02:04 +02:00
d76072d691 Move alphabetical classifier to VIVO branch 2023-09-23 16:02:04 +02:00
2b46a23a4b Moved templates from Vitro branch 2023-09-23 16:02:04 +02:00
ded7f4fa6a Added empty template for statistic counters 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
9551d52aad Added settings icon image 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
19bfd91182 Modified style modal window and added close button. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
22cb7f3bfb Fixed metadata font size. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
c9681dc98e Modified favicon icon image. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
565c062789 Modified favicon icon image. 2023-09-23 16:02:04 +02:00
dffc1ae402 Added user modal settings 2023-09-23 16:02:04 +02:00
f2a86d43ac Differentiated sources and literature lists for excerpts and complex texts 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
0959aa3047 Added favicon ico image. 2023-09-23 16:02:04 +02:00
76143f127f Autoselect hits per page from query 2023-09-23 16:02:04 +02:00
8ef16fcb48 Fix for prev commit 2023-09-23 16:02:04 +02:00
1de9ac8f6e Fix top background 2023-09-23 16:02:04 +02:00
88e31fc4c7 Revert "Fix bad background"
This reverts commit 8f543d1e68ce699ec94bd12dd7398d15e2a3c8bd.
2023-09-23 16:02:04 +02:00
6b9f00082e Fix bad background 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
606701cd8c Modified style on no page result. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
81682b34cc Added image for literature and source items on right content panel. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
a864eff490 Fixed literature and source lists on search results page. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
5fd05cd5be Fixed title rubric class. 2023-09-23 16:02:04 +02:00
022b108b21 Added delete button to article page 2023-09-23 16:02:04 +02:00
51735086bd Fix article delete query 2023-09-23 16:02:04 +02:00
f1d40b7e4b Fix compilation creation 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
40af78211a Fixed copyright information. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
8e114f68e3 Added follow button to rubrics page. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
e040fb0da5 Fixed expand content on Exerpt page. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
588552eecd Added metadata switch button on compilation page. 2023-09-23 16:02:04 +02:00
e04cbce072 Fix for collapsible metadata and doc parts js 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
fc0b2f0f8f Added metadata switch button. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
aef2d1af55 Fixed sitch metadata image. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
1c5c81f4d9 Fixed metadata name. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
aaca013484 Added metadata switcher. 2023-09-23 16:02:04 +02:00
792eb29b5a Added collapsible metadata scripts 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
c5faaf61e4 Modified custom style check button on search page result. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
6004d28d06 Fixed entity page width size on all resolutions. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
ae9c177d10 Fixed margin bottom p. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
832052bb9a Fixed padding top text exerpts. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
279464afae Removed double quote. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
b39a930982 Fixed metadata information on Exerpt page. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
7370700ec3 Modified metadata styles on Exerpt page. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
c5d250fbc3 Modified page result styles. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
144c60d857 Modified collupsible button paddings on search result page. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
cb2f60f8e6 Modified collupsible button paddings. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
1913853859 Removed double quotes. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
9debab83c1 Modified authors affilation style. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
06062a82e3 Fixed title article font-size. 2023-09-23 16:02:04 +02:00
945ef7a166 Add standard container for search results 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
0663d5bc02 Modified save button style. 2023-09-23 16:02:04 +02:00
a89315c6ae Collapsible authors in elenph excerpts 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
7cf2df54a6 Deleted empty raw. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
d0fcf59032 Added new class for tool shelf on compilation page. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
2feee507ac Fixed title break on article page. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
f7929dca37 Fixed shelf tools width for article page. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
9b7fedc748 Fixed shelf tools for article page. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
6889db0d4f Fixed main navigation link font size. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
b61471ce63 Added download-icon. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
b21826d1b1 Fixed search result headline and download icon. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
787f64ab94 Fixed padding for switch document button. 2023-09-23 16:02:04 +02:00
7f106d949b Remove sequential duplicates in literature and sources lists 2023-09-23 16:02:04 +02:00
eee56d606f Workaround for broken documents 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
a9885a9e7e Changed title font size on page rezult. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
84617f9684 Fixed search button outline style. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
9e104fbeed Modified first publication style. 2023-09-23 16:02:04 +02:00
931be4cadc Switch text and image on collpase/expand document 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
6402180623 Added new image. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
2414124be3 Added print button to compilation page. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
1f9c3aab41 Fixed title style. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
93d8c28327 Fixed authors page width. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
424867f682 Fixed expand article button. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
4e62a1c9c2 Modified print button position. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
ac54608713 Modified affilations style. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
9567522060 Hid right top buttons.Modified result page style. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
2c46c1c6b3 Removed online css styles. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
edc5094a71 Fixed metadata styles. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
647c939272 Fixed expand button style and metadata content style. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
49d62fcfba Added page result pagination border. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
78083c6c5b Fixed page result pagination styles. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
e604d6714c Modified collapse/expande button style and hided right block on result search page. 2023-09-23 16:02:04 +02:00
f93abed8be Improved collapsible element 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
2ebaafb072 Added images for buttons. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
cdcdc82be1 Fixed padding top on article title. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
77de9870cf Added print function in right panel. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
d5d943e663 Modified page pagination style. 2023-09-23 16:02:04 +02:00
a03aca3b66 Made rubric list collapsible 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
d878f9c59a Added expand and collapse buttons. 2023-09-23 16:02:04 +02:00
6a0b31a2d3 Added TOC collapse/expand scripts 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
532f33f313 Added expand button for articles metadata. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
0858581788 Modified right menu styles. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
0ee79ef41f Added new styles for affilations and metadata. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
3a9a1821ee Modified a hover style.Fixed icons padding. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
4e83632bfc Added right search panel on Compilations page.Modified title block. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
aefa7b486f Fixed right icons padding. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
a2a8493a16 Added print,save,export PDF buttons. 2023-09-23 16:02:04 +02:00
7832acd50c Open parent document parts when go to part from TOC 2023-09-23 16:02:04 +02:00
2c6a138503 Added table of contents js functions 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
6b2761d1e7 Added button To top. 2023-09-23 16:02:04 +02:00
10b4ed63eb Improved document structure 2023-09-23 16:02:04 +02:00
54809ee8c2 Fix for sources and literature output for document parts 2023-09-23 16:02:04 +02:00
8a5c3f40b0 Move authors metadata to macro 2023-09-23 16:02:04 +02:00
428bd78152 Get level of excerpts in document 2023-09-23 16:02:04 +02:00
70c7f7c11b Refactoring document structure 2023-09-23 16:02:04 +02:00
661871cd7e Add closing tag to sep directive 2023-09-23 16:02:04 +02:00
dfaec1c1c4 Renamed expand switch settings function 2023-09-23 16:02:04 +02:00
875a639db5 Fix underline authors' list 2023-09-23 16:02:04 +02:00
19cfa546a3 Improved article delete query 2023-09-23 16:02:04 +02:00
20e8f32100 Split expand switch into two: setttings switch and one-time switch 2023-09-23 16:02:04 +02:00
00330d288b Moved freemarker templates into theme 2023-09-23 16:02:04 +02:00
793ff14bdc Fix authors sign 2023-09-23 16:02:04 +02:00
0cbaa14d94 Refactoring rubric and rubrics templates 2023-09-23 16:02:04 +02:00
0b945ae851 Fixing expand switch 2023-09-23 16:02:04 +02:00
91bb723cbe Refactoring expand scripts 2023-09-23 16:02:04 +02:00
e9597bc1c0 Refactoring expand scripts 2023-09-23 16:02:04 +02:00
05f26298f6 Cleaning up elenph excerpt template 2023-09-23 16:02:04 +02:00
cc6c590df6 Fixed text excerpt delete query 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
2ae90346e6 Fixed literature lists image url. 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
050c7eaf18 Fixed literature lists margins. 2023-09-23 16:02:04 +02:00
8227d1c493 Temporary hack 2023-09-23 16:02:04 +02:00
4ff772a817 Rewrite indexing rules for more generic cases 2023-09-23 16:02:04 +02:00
e88ae61bbc Add excerpts of any complex publication to ALLTEXT field 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
2033013a35 Fixed margin top lists on search result page.
Rename prefix
2023-09-23 16:02:04 +02:00
Svetlana Rastegina
55f925de2e Fixed literature lists on search result page. 2023-09-23 16:02:04 +02:00
1aa245c6e1 Reindex complex publications on excerpt change 2023-09-23 16:02:04 +02:00
Svetlana Rastegina
73c51fc45b Fixed literature lists on exerpts page. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
67ea71c529 Fixed fonts size. 2023-09-23 16:02:03 +02:00
1ef72a2b60 Hide duplicate search panel on search results page 2023-09-23 16:02:03 +02:00
3d0a44099b Fixed buttons ids 2023-09-23 16:02:03 +02:00
94b11d9448 Renamed Работы to Источники 2023-09-23 16:02:03 +02:00
2ab9621b2f Show delete button only if it is usable 2023-09-23 16:02:03 +02:00
5c1685b5bb Fix compilation template 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
e37fac51d8 Fixed blocks width on article page. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
ecf84c8ae2 Fixed request right search panel on article page. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
2cd2546812 Hid statistic information. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
00113b28be Hid select option in search panel on main page . 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
08cb60c3a8 Fixed wrapper-content width on all pages. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
a572304e67 Fixed expand search buttons. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
7a90475bd1 Fixed accounts loggedin page. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
1ee523d007 Fixed articles page and rubrics page. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
1b6fad2dd7 Fixed main page styles on various screen resolutions. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
83aa4a1491 Fixed right search panel and home search region. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
1cca929387 Added font files on site. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
7e587b6c2d Changed log in page styles. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
4d47f3014b Changed right search styles for all screen resolutions. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
f4eb098267 Fixed right search panel. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
03dc422757 Added list style for literature lists. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
a093574bb8 Added list style for article literature. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
73c6a2710b Modified article page styles and added new images. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
c2b37bd425 Modified alphabetical index page styles. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
761293e361 Modified alphabetical index page styles. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
ee522896ae Added image for search button on main page. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
1432c31ec9 Fixed select input orange arrow. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
970d6e9d08 Added new images. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
0274bda0e2 Fixed custom search button (background and width on various resolutions). 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
430ee0356b Fixed fonts size in search block on various screen resolutions. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
f805398137 Fixed search block borders. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
fb39595b45 Fixed top and bootom margins in search rows. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
4a445600c0 Changed search block structure. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
154ecb115e Changed css styles on main page. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
50148af0d2 Fixed width statistic block on all screen resolutions. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
87ae2f67d5 Added dot image for Title on main page. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
54b63d883d Added settings for adaptive designe. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
9fa7579a0d Fixed hesder block for 720px screen size. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
44efb25082 Changed extand search styles. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
ede7c88701 Modified search block structure. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
43a379cd88 Modified extenden search form. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
9f1d510026 Added shadow properties to right button block. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
6dc4488df4 Fixed paddings on top right menu. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
fbd8a6d08d Reterned Index link on top right menu. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
3785b56264 Modified expanded search block and fix width properties custom search block on main page. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
727553b487 Modified text styles on main page. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
2ff171beb7 Fixed statistic block appearance on main and others pages. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
c9da564b7c Fixed footer wrapper. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
dbd570374a Modified statistic block styles. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
bfafc4dcb8 Transfered statistic block from Intro section to Footer section. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
046a7ead71 Changed text style on main page. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
fec449fb6e Removed Search title and modified search form style. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
47780b70ad Changed custom search properties on main page. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
1622955d09 Fixed search position and properties. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
26c6212f6e Modified footer styles. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
ea5259708f Modified header menu (Login button) styles. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
9cec6af276 Modified header images and main menu styles. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
26330623ea Added title name image and refined header-image background. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
cd60e69797 Added settings for header image proportionally scaling. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
e2aa46474f Hidden Index link in top right menu. 2023-09-23 16:02:03 +02:00
Svetlana Rastegina
77ff105915 Added header image. Changed header width and height. Commented Index link in top right menu. Changed background colour in navigation menu and Log in menu. 2023-09-23 16:02:03 +02:00
0c3fd560aa Run saved query from compilation page 2023-09-23 16:02:03 +02:00
0aa7aba071 Save query and rules at compilation creation 2023-09-23 16:02:03 +02:00
509e0d2a7e Custom template for compilation 2023-09-23 16:02:03 +02:00
b36ec03b04 Added elenph delete queries 2023-09-23 16:02:03 +02:00
272a3514db Added modification time to compilation generator 2023-09-23 16:02:03 +02:00
c4a168f31b Fix broken js on empty search configuration 2023-09-23 16:02:03 +02:00
2c57765929 Removed mistakenly added spaces from uri 2023-09-23 16:02:03 +02:00
2e0733a97b Added code to create compilation from search results 2023-09-23 16:02:03 +02:00
f10e333eb5 Added template to display compilation 2023-09-23 16:02:03 +02:00
e8bd83b2ee Added compilation to text structures ontology 2023-09-23 16:02:03 +02:00
551b7c8ef8 Added compilation generator 2023-09-23 16:02:03 +02:00
45f9b3c04e Added to print script 2023-09-23 16:02:02 +02:00
5912aa2fb6 Hide login on main page 2023-09-23 16:02:02 +02:00
1f61878d94 Removed double quotes for input fields in extended search 2023-09-23 16:02:02 +02:00
6ad6fc8bd9 Revert "Try to fix queries"
This reverts commit 6498d194cd78923ee5121679f5d25e5e0ce6c4d7.
2023-09-23 16:02:02 +02:00
c7cddaa0cd Fixed field values sorting for extended search 2023-09-23 16:02:02 +02:00
de384d1b70 Save extended search var in browser local storage 2023-09-23 16:02:02 +02:00
02e6c4f050 Try to fix queries 2023-09-23 16:02:02 +02:00
ee3c3404c0 Remove publication participant and organization from search 2023-09-23 16:02:02 +02:00
da8fa22987 Modifications for correct affiliation display 2023-09-23 16:02:02 +02:00
150342f410 Set white background for works and biblio in elenph article excerpts 2023-09-23 16:02:02 +02:00
db915745c5 Remove checked attribute from checkbox 2023-09-23 16:02:02 +02:00
dc8333a646 Hide VIVO logo temporary 2023-09-23 16:02:02 +02:00
c3ce008bd2 Fixed url path in issues 2023-09-23 16:02:02 +02:00
bc5a723c04 Print info about first article publication 2023-09-23 16:02:02 +02:00
3ee1fc83bc Added home info 2023-09-23 16:02:02 +02:00
2a25fc9c08 Added margin between collapsible elements 2023-09-23 16:02:02 +02:00
92e83a81d1 Added expand button to article page 2023-09-23 16:02:02 +02:00
4f56846beb Output biblio and works for each excerpt 2023-09-23 16:02:02 +02:00
3d34bddd1b Added values of allowed properties in ALLTEXT Elenph article 2023-09-23 16:02:02 +02:00
68b3bd145b Remove entity name from indexed field. 2023-09-23 16:02:02 +02:00
cd5c0951b8 Remove property name from indexed field 2023-09-23 16:02:02 +02:00
11c02b90d4 Buttons to add Bibliography and Works 2023-09-23 16:02:02 +02:00
8db230eb73 Remove width 2023-09-23 16:02:02 +02:00
2b8b3f2ded Hits per page option 2023-09-23 16:02:02 +02:00
e709b1482e Fix for previous commit 2023-09-23 16:02:02 +02:00
ee99d7ed16 Added formGenerator for excerpts and articles 2023-09-23 16:02:02 +02:00
8dee96fba6 Update for article page 2023-09-23 16:02:02 +02:00
da710cf741 Updates for ontologies 2023-09-23 16:02:02 +02:00
ddcc5031da Remove classes from search index 2023-09-23 16:02:02 +02:00
1890162548 Added left margin to search form 2023-09-23 16:02:02 +02:00
f637b89876 Fix for previous commit 2023-09-23 16:02:02 +02:00
135bd7bb50 New search form 2023-09-23 16:02:02 +02:00
14e3ab6379 Made search notes smaller 2023-09-23 16:02:02 +02:00
6636885337 Fix search form 2023-09-23 16:02:02 +02:00
821752efee Escape search query string 2023-09-23 16:02:02 +02:00
d4a5f3dcb8 Populated text field 2023-09-23 16:02:02 +02:00
dd30f56ae4 New example 2023-09-23 16:02:02 +02:00
3392665f83 Changed example 2023-09-23 16:02:02 +02:00
addb9b1a25 Fixed styles 2023-09-23 16:02:02 +02:00
5c8c3d25f8 New example query 2023-09-23 16:02:02 +02:00
9c70731c53 Save to local storage at search 2023-09-23 16:02:02 +02:00
0fa487721e add css rule 2023-09-23 16:02:02 +02:00
c5ce4ae7dd Modified logical search query 2023-09-23 16:02:02 +02:00
01c227f652 Escape search value 2023-09-23 16:02:02 +02:00
894b51ee23 Changed quotes in search form 2023-09-23 16:02:02 +02:00
2d55e44575 query builder first try 2023-09-23 16:02:02 +02:00
2871ab815f Removed link to js 2023-09-23 16:02:02 +02:00
721bc12900 Added search ontology 2023-09-23 16:02:02 +02:00
23c9f7de1c Fill queryBuiler with fields and filters 2023-09-23 16:02:02 +02:00
1756065597 Added buttons 2023-09-23 16:02:02 +02:00
2ab80c74cb Added example rules and values 2023-09-23 16:02:02 +02:00
e45db04fcc Fixed query builder configuration 2023-09-23 16:02:02 +02:00
38d7801a3d Loading dummy query builder 2023-09-23 16:02:02 +02:00
3b85e83182 Article's rubrics 2023-09-23 16:02:02 +02:00
e5fa511391 Sum all rubrics of article while indexing 2023-09-23 16:02:02 +02:00
1f8318ab97 Use custom search service 2023-09-23 16:02:02 +02:00
51ccf370c1 Styles modifications 2023-09-23 16:02:02 +02:00
d33b2d0a3a Fix article page 2023-09-23 16:02:02 +02:00
0a374558ad Added issue template 2023-09-23 16:02:02 +02:00
4d0922a448 Copied wilma 2023-09-23 16:02:02 +02:00
c869f45b74 Issue template added 2023-09-23 16:02:02 +02:00
84c975637f Added ontologies 2023-09-23 16:02:02 +02:00
7cff47c46b Modified ontology 2023-09-23 16:02:02 +02:00
f41f50fad3 Modifications for fixed ontology 2023-09-23 16:02:02 +02:00
69edaf1f8d Fixed mistake in query 2023-09-23 16:02:02 +02:00
4f553c963e Added custom fields 2023-09-23 16:02:02 +02:00
bbf3242a03 Fix for previous commit 2023-09-23 16:02:02 +02:00
d7e36b6f6b Added articles info to excerpt 2023-09-23 16:02:02 +02:00
b7b9f23509 templates update 2023-09-23 16:02:02 +02:00
a768cbf0d2 Updates for templates 2023-09-23 16:02:02 +02:00
63a187fea3 Templates and SPARQL requests for rubrics, elenph excerpts and articles 2023-09-23 16:02:02 +02:00
6b7092a4d5 Added custom search controller
Cleaned custom search controller

Autoselect hits per page from query.

Moved template change to VIVO branch

Split search services
2023-09-23 16:02:02 +02:00
bc10e79f92 Antisamy policy fixes
Allow table tags in TinyMCE
2023-09-23 16:02:02 +02:00
a5f0734c43 base alignment 2023-09-23 16:01:52 +02:00
Dragan Ivanovic
2e4458e160
Codestyle (#372)
* Adding code style

* Small correction of code style

* Putting under comments checkstyle rules

* include checks and suppressions (excluding files)

* Added checkstyle suppressions.

* suppression defined at the level of a Java file

* adding JFactTBoxReasonerTest in the suppression

* replacement of tabs with spaces in a property file

* increasing the max line length to 120

* Adding java and javax packages at the beggining of imports

---------

Co-authored-by: Ivan Mrsulja <mrsuljaivancic@gmail.com>
2023-09-14 13:34:06 +02:00
Dragan Ivanovic
3f95108b26
Fix broken links in the README.md file (#416) 2023-09-14 13:53:15 +03:00
chenejac
df81457ea4 [maven-scm-plugin] prepare release vitro-1.14.1-SNAPSHOT 2023-06-23 16:37:09 +02:00
chenejac
0359082ad9 [maven-scm-plugin] prepare release vitro-1.14.0 2023-06-23 16:36:52 +02:00
Dragan Ivanovic
4728027865
Merge pull request #409 from litvinovg/revert_check
reverted check to fix default autocompletion type
2023-06-22 16:11:01 +02:00
Georgy Litvinov
77d63f2c5f reverted check to fix default autocompletion type 2023-06-22 09:49:04 +02:00
Dragan Ivanovic
5ff98823ca
Merge pull request #408 from litvinovg/autocomplete_form_fix
Autocomplete object property form fixes
2023-06-21 16:12:50 +02:00
dc72cd0b62
added locale selection data getter n3 configuration (#407)
Co-authored-by: Georgy Litvinov <georgy.litvinov@tib.eu>
2023-06-21 16:07:06 +02:00
Georgy Litvinov
1536842020 added missing autocomplete.css 2023-06-21 13:08:05 +02:00
Georgy Litvinov
64b0d9b9ab revert escaping 2023-06-21 13:02:56 +02:00
0e984ebb74
Avoid lock on graph uri update (VIVO-3885) (#395)
* Avoid lock on graph uri update

* Run in VitroBackground named thread. Avoid creating threads if a thread to update graph uris has been already created.

---------

Co-authored-by: Georgy Litvinov <georgy.litvinov@tib.eu>
2023-06-16 13:53:04 +02:00
58e479a08a
Updated owlapi dependency (#401) 2023-06-16 09:13:00 +02:00
Brian Lowe
fb9d86a57d
Use same logic to remove blank nodes from reasoner's internal model as used in RDFService (#397)
* Refactor blank-nodes-as-variables behavior from RDFServiceJena to JenaModelUtils; use this logic when removing triples from the TBox reasoner's internal assertions model.  Add unit test.

* Remove complication of datasets and remove blank nodes directly from models

* Remove temporary debugging logging

* Simplify original blank node tree logic

* Remove unneeded imports
2023-06-15 12:55:23 +02:00
Dragan Ivanovic
3a88c451ab
Adding missing labels (#394)
* Adding missing labels

* improvement of a Serbian label translation

* Update home/src/main/resources/rdf/i18n/ru_RU/interface-i18n/firsttime/vitro_UiLabel.ttl

Co-authored-by: Georgy Litvinov <git@litvinovg.pro>

* Update home/src/main/resources/rdf/i18n/ru_RU/interface-i18n/firsttime/vitro_UiLabel.ttl

Co-authored-by: Georgy Litvinov <git@litvinovg.pro>

---------

Co-authored-by: Georgy Litvinov <git@litvinovg.pro>
2023-06-15 12:49:59 +02:00
a5a7e640d2
Fix for VIVO-3871 (#393)
* Fallback to default graph in bulk ontology model update

* test added

---------

Co-authored-by: Georgy Litvinov <georgy.litvinov@tib.eu>
2023-06-06 15:07:19 +03:00
Dragan Ivanovic
f19d0a08c2
Revert "don't create add url if neither of 'select from existing' nor 'provide selection' options set (#385)" (#389)
This reverts commit 6c9e21544a.
2023-05-23 10:49:57 +02:00
329b8e4100
Escape html (#388)
* Escape value in delete property form

* escape labels

* Revert "escape labels"

This reverts commit cd825d7587d629bc44c7fece31eb1bfa5cb6f241.
2023-05-09 13:04:21 +02:00
Brian Lowe
a22aa37394
Change PropertyKey class name and namespace (#386)
* Change PropertyKey class name and namespace

* Fix prefix/namespace error found in code review.
2023-05-08 14:25:46 +02:00
Brian Lowe
c527de5ad8
Handle preferred language when creating new class and property groups (#383)
* Handle preferred language when creating new class and property groups

* Convert tabs to spaces in affected lines.
2023-05-01 09:52:11 +02:00
Brian Lowe
dec725a022
Propagate selectFromExisting and offerCreateNew settings from base ob… (#384)
* Propagate selectFromExisting and offerCreateNew settings from base object property to new faux property.

* Match tab usage of existing file.
2023-04-27 16:41:02 +02:00
6c9e21544a
don't create add url if neither of 'select from existing' nor 'provide selection' options set (#385)
Co-authored-by: Georgy Litvinov <georgy.litvinov@tib.eu>
2023-04-27 16:40:43 +02:00
2535750cfa
fix: Escape data property value (#387)
Co-authored-by: Georgy Litvinov <georgy.litvinov@tib.eu>
2023-04-27 16:21:31 +02:00
Dragan Ivanovic
c0b48511e2
Merge pull request #375 from litvinovg/translation_converter_fix
Check if provided path is directory in translation converter
2023-03-06 14:42:56 +01:00
Dragan Ivanovic
4e452573f2
Merge pull request #376 from litvinovg/avoid_write_models_into_log
Avoid writing the whole model into debug log
2023-03-03 18:04:52 +01:00
b9e4e792d3
removed tab 2023-03-03 17:39:33 +01:00
Georgy Litvinov
67c0421bea Avoid writing the whole model into debug log 2023-03-03 17:28:33 +01:00
Georgy Litvinov
dae6a808b6 Added check if provided path is directory 2023-03-03 14:48:35 +01:00
Dragan Ivanovic
0c8b02a630
Merge pull request #371 from litvinovg/vclass_browsing_error_fix
Remove old hack that leads to 500 error
2023-02-28 15:28:37 +01:00
Dragan Ivanovic
98f2de3c04
Merge pull request #373 from TAMULib/3821-map_of_science_properties
VIVO 3821: Add configuration to disable or enable Map of Science visualization.
2023-02-28 15:13:14 +01:00
Kevin Day
b50f3b16c5
VIVO 3821: Map of Science configuration isn't needed in Vitro.
The IndividualResponseBuilder will hopefully be updated by a separate issue to move the visualization code entirely out of Vitro and into Vivo.
2023-02-28 08:08:49 -06:00
Kevin Day
97f9685d1f
Enable visualization.mapOfScience by default. 2023-02-27 10:13:40 -06:00
Kevin Day
774bbacc36
VIVO 3821: Add configuration to disable or enable Map of Science visualization. 2023-02-27 09:21:48 -06:00
Dragan Ivanovic
4d60cd9de1
Merge pull request #367 from TAMULib/3751-remove_icu
VIVO-3751: Remove ICU4J dependency.
2023-02-27 15:28:55 +01:00
Dragan Ivanovic
9b6e362480
Merge pull request #366 from litvinovg/password_limit
raised password length limit to 64 characters
2023-02-27 15:27:25 +01:00
Georgy Litvinov
27846ecbdb Remove old hack that produces 500 error 2023-02-24 09:37:56 +01:00
Kevin Day
5ec99a2204
Issue 3751: Remove ICU4J dependency.
This is only used in a handful of places.
The core java libraries provide the same functionality but with a less exchaustive locale database.

The IBM ICU is more up to date than the Java version but is otherwise identical.

see: https://unicode-org.github.io/icu/userguide/icu4j/#introduction-to-icu4j
2023-02-22 10:17:20 -06:00
Georgy Litvinov
99cbda4727 raised password length limit to 64 characters 2023-02-22 08:31:36 +01:00
Dragan Ivanovic
15cb4d7467
Merge pull request #365 from TAMULib/issue-3767
[Issue 3767] Replacement of language comparisons using '=' by the 'langMatches' (without whitespace changes)
2023-02-17 14:01:45 +01:00
William Welling
a1de03f2f5 Use SPARQL template and context map to substitute langCtx 2023-02-14 11:34:59 -06:00
Dragan Ivanovic
48c88d3d3e
Merge pull request #355 from vivo-project/i18n-redesign
I18n redesign
2023-02-13 14:08:01 +01:00
William Welling
108fdbf66b Undo whitespace changes 2023-02-09 11:19:01 -06:00
4ce6dc2f8c
fix creation of faux property with xml literal range value (#363)
Co-authored-by: Georgy Litvinov <georgy.litvinov@tib.eu>
2023-02-09 16:25:36 +01:00
1976185a91
Fix for Russian translation of email temlate (#362)
* fix, i18n: added link to instance in Russian translations

* fixed text style

* one more fix
2023-02-06 09:36:42 +01:00
509e9cf22b
Custom forms fixes (#361)
* added safety check

* Prevent failing autocomplete field with type selectors in case more than one pair of type selectors and autocomplete field used

---------

Co-authored-by: Georgy Litvinov <georgy.litvinov@tib.eu>
2023-02-02 14:24:47 +01:00
8b2e150e32
use qualified by root in faux property to provide into FauxObjectPropertyWrapper (#360)
Co-authored-by: Georgy Litvinov <georgy.litvinov@tib.eu>
2023-02-02 14:24:10 +01:00
2873bba81d
fixed faux property display order (#359)
Co-authored-by: Georgy Litvinov <georgy.litvinov@tib.eu>
2023-01-24 14:21:46 +02:00
7dabc6b2ab
fixed check for redundant possible object properties (#358)
Co-authored-by: Georgy Litvinov <georgy.litvinov@tib.eu>
2023-01-24 14:09:57 +02:00
a7215cc932
fix for faux data property ranges (#357)
Co-authored-by: Georgy Litvinov <georgy.litvinov@tib.eu>
2023-01-24 13:54:31 +02:00
7d84e61003
Merge pull request #356 from chenejac/3393_parametersWithApostrophie
support for combining parameters and apostrophe
2022-12-22 13:49:00 +01:00
a0a1a6664b
Faux data properties and fixes for current faux properties view (#352)
* Faux data properties

* Use not disjointed classes for faux properties domain and range options

* Fix faux object property shadowing real property
List faux data properties
List faux properties which base properties domain don't match current subject

* Write exception to log in VClassDaoJena

* filter faux properties returned in possiblePropInstForIndividual

* safety checks added

* extracted getBaseLabel method, fixed base labels for data properties

* fix for prev commit

* Formatting fixes

* More formatting fixes

* More formatting fixes

* More formatting fixes

* More formatting fixes

* More formatting fixes

Co-authored-by: Georgy Litvinov <georgy.litvinov@tib.eu>
2022-12-16 11:40:49 +01:00
Dragan Ivanovic
fce6dc6f78 reorganization of the code - extraction of a method for preprocessing input strings for MethodFormat.format method 2022-12-16 11:40:10 +01:00
Dragan Ivanovic
311744ef64 support for combining parameters and apostrophe 2022-12-16 10:16:34 +01:00
c885162d8d
Merge pull request #354 from chenejac/renamingi18nFiles
[3801 i18n] Renaming files, removing language suffixes for rdf files
2022-12-13 16:50:35 +01:00
f548908b32
Merge pull request #351 from chenejac/supportingPrivateTags
[3800 i18n redesign] Supporting private tags
2022-12-13 16:50:02 +01:00
Dragan Ivanovic
ae2509837e adding curly braces for all if statements 2022-12-13 14:37:23 +01:00
Dragan Ivanovic
6312b966f2 adding support for private subtags in the language tags, replacement of toString() method with toLanguageTag() method, adding checks for locale.stripExtensions() where it was neccessary, adding information about private tag in the drop down selection of a UI language 2022-12-13 11:37:56 +01:00
Dragan Ivanovic
62cbcca8dc support for private subtag (x) 2022-12-13 11:37:56 +01:00
63567b9c30
Merge pull request #353 from chenejac/defaultLanguage
adding English as default language
2022-12-12 15:31:11 +01:00
Dragan Ivanovic
3b08832ebc renaming files, removing language suffixes for rdf files 2022-12-09 11:11:00 +01:00
81e12cc492
fixes for language filtering to support private-use subtags (#330) 2022-12-08 11:18:08 +01:00
Dragan Ivanovic
3f03ddfd1f adding English as default language 2022-12-06 11:26:35 +01:00
8bbc751f0b
Merge pull request #350 from chenejac/movingUILabelsTranslationsIntoVitro
[i18n-3762] Moving UI labels translations into vitro
2022-12-06 11:16:11 +01:00
chenejac
a1d1f7fc12 adding new line at the end of UILabelsVocabulary.ttl 2022-11-29 15:58:45 +01:00
chenejac
026d316c20 adding new line at the end of UILabelsVocabulary.ttl 2022-11-29 15:57:17 +01:00
chenejac
bc359588e7 correction - changing of format of the vocabulary (from n3 to ttl) 2022-11-29 15:55:40 +01:00
chenejac
1cab6cf10f changing of format of the vocabulary (from n3 to ttl) 2022-11-29 15:52:25 +01:00
Dragan Ivanovic
1608079320 fixing an issue with '\n' in the label translations 2022-11-29 13:45:49 +01:00
Dragan Ivanovic
61feb77908 fix of build git action 2022-11-28 09:55:04 +01:00
Dragan Ivanovic
4863f4c520 Cleaning up dependency on languages repository 2022-11-28 09:04:19 +01:00
Dragan Ivanovic
7340b7ff3f fix in the startup_listeners.txt 2022-11-28 08:43:56 +01:00
Dragan Ivanovic
b8ddb05937 property files not mandatory anymore, message kept as info instead of warning 2022-11-28 08:43:56 +01:00
Dragan Ivanovic
d27560b7fe correction of a typo 2022-11-28 08:43:56 +01:00
Dragan Ivanovic
242f851a8e adding the UI labels ontology 2022-11-28 08:43:56 +01:00
Dragan Ivanovic
1b3df6839e adding one ttl file 2022-11-28 08:43:56 +01:00
Dragan Ivanovic
5a48b7da59 moving UI labels translations from Vitro-languages into the Vitro repository 2022-11-28 08:43:56 +01:00
020b9385f8
Model operations performance improvements (#347)
* created RDFServiceBulkUnionUpdater

* fix and indents

* use bulk updater for RDFServiceGraph in blankNodeFilteringGraph

* use removeAll to optimize removal all triples from TDB modeles

* avoid additional serialization/deserialization cycle of removing model chunk

* fixed VitroModelFactory tests

* fixes for BulkUpdating models

* Created custom ModelCom, OntModelImpl, BulkGraphMem to avoid triple by triple transactions on add/remove model
Load n3 files from home directory into in-memory model to use bulk
loading.

* refact: simplified BulkGraphMem checks

* removed unused import
2022-11-25 19:47:21 +02:00
9e3a3f7451
[i18b sprint] 3760 translations loading (#341)
* renamed I18nBundle

* added I18nBundle interface

* Added translation provider

* prototype of TranslationConverter

* convert all properties

* fixes

* added caching

* Removed obsolete code

* Improved logging

* fixed getting already existing label

* Fix to get RDF Service for configuration models

* fix translation request query

* added INTERFACE_I18N_FIRSTTIME_BACKUP model

* converter test added

* formatting fixes

* Translation provider tests added

* cleanups, added cache test for translation provider

* fix: get theme info from web app dao factory as sparql queries on both content and configuration models not supported
2022-11-25 16:25:58 +02:00
Dragan Ivanovic
8ddbc8fc00
merging language specific home artifacts from Vitro-languages into the Vitro repository (#348) 2022-11-24 14:34:28 +01:00
4acb10fc3f
remove only langtag literals (#349) 2022-11-23 09:38:27 +01:00
57d93285ff
fix: removed 'other' hack from forms (#328) 2022-11-15 20:33:01 +01:00
0b99cab654
[ i18n sprint ] autoCompleteObjectPropForm and lib-properties fixes from fr_CA (#336)
* Apply fixes from french lib properties

* Apply fixes from fr_CA autoCompleteObjectPropForm

* fixed for fr_CA and other languages

* fixes from fr_CA

* fix for  autoCompleteObjectPropForm.ftl

* fixed wrong call for i18n bundle
2022-11-15 10:05:25 +01:00
Dragan Ivanovic
a6a480986f
[ i18n sprint ] Move search help page translations to properties (#333)
* making generic searh-help by using translation properties' keys and i18n bean

* Adding new line at the end of the file

* Adding translation for title of an anchor
2022-11-08 11:59:29 +01:00
403cd6507a
[ i18n sprint ] Decouple email templates and translations (#334)
* Decouple email templates and translations

* provide siteName variable to error templates
2022-11-08 11:35:41 +01:00
michel-heon
542d1c30ef Replacement of language comparisons using '=' by the 'langMatches'
function
2022-10-28 15:53:25 +00:00
Dragan Ivanovic
7bb3fb9f74
Merge pull request #335 from litvinovg/terms_of_use
[ i18n sprint] remove terms of use controller
2022-10-27 15:27:29 +02:00
Dragan Ivanovic
1511e00c61
Merge pull request #338 from litvinovg/autocomplete_form
[i18n sprint] Language-neutral help text in autocomplete forms
2022-10-27 15:08:05 +02:00
Dragan Ivanovic
f1a730dd0d
Merge pull request #332 from litvinovg/ftl_fixes
[ i18n sprint ] Fixes for new individual form
2022-10-27 15:05:51 +02:00
874409d959
Use language-neutral selectAnExistingOrCreateNewOne translation key 2022-10-19 14:02:34 +02:00
7857968f2c
remove terms of use controller 2022-10-12 13:02:12 +02:00
c79f381f15
fixed new individual form 2022-10-06 15:33:22 +02:00
chenejac
2e682e6f38 Merge branch 'rel-1.13.0-RC' of https://github.com/vivo-project/Vitro into rel-1.13.0-RC 2022-08-26 16:19:07 +02:00
chenejac
95467b2818 [maven-scm-plugin] prepare development vitro-1.13.1-SNAPSHOT 2022-08-26 16:17:21 +02:00
chenejac
4b24a11a6c [maven-scm-plugin] prepare release vitro-1.13.0 2022-08-26 16:14:52 +02:00
chenejac
7a94922d48 [maven-scm-plugin] prepare development vitro-1.13.1-SNAPSHOT 2022-08-26 16:10:01 +02:00
chenejac
85dad20927 [maven-scm-plugin] prepare release vitro-1.13.0 2022-08-26 16:10:01 +02:00
chenejac
27c8b16290 [maven-scm-plugin] prepare development vitro-1.13.1-SNAPSHOT 2022-08-26 16:10:01 +02:00
chenejac
afe45a99db [maven-scm-plugin] prepare release vitro-1.13.0 2022-08-26 16:10:01 +02:00
chenejac
a8a5c5a5e8 [maven-scm-plugin] prepare development vitro-1.13.1-SNAPSHOT 2022-08-26 16:06:41 +02:00
chenejac
2e029ee9fb [maven-scm-plugin] prepare release vitro-1.13.0 2022-08-26 16:06:41 +02:00
chenejac
b802e2eb82 rebasing for new release candidate 2022-08-26 16:06:40 +02:00
chenejac
f0c4d27268 [maven-scm-plugin] prepare development vitro-1.13.1-SNAPSHOT 2022-08-26 16:06:40 +02:00
chenejac
34ab29a08e [maven-scm-plugin] prepare release vitro-1.13.0 2022-08-26 16:06:40 +02:00
chenejac
aa8124df17 [maven-scm-plugin] prepare development vitro-1.13.1-SNAPSHOT 2022-08-26 16:06:40 +02:00
chenejac
7bf136fdbe [maven-scm-plugin] prepare release vitro-1.13.0 2022-08-26 16:06:40 +02:00
chenejac
325b9a3fe9 [maven-scm-plugin] prepare development vitro-1.13.1-SNAPSHOT 2022-08-26 16:06:40 +02:00
chenejac
228dda822f [maven-scm-plugin] prepare release vitro-1.13.0 2022-08-26 16:06:40 +02:00
chenejac
3c2eb97104 Merge branch 'main' of https://github.com/vivo-project/Vitro 2022-08-26 16:05:42 +02:00
6ea9510222
fixed email settings example (#326) 2022-08-26 10:26:54 +03:00
Dragan Ivanovic
3df2fbe5fc
fixing the issue with type of match property (changed from string to boolean) (#325) 2022-08-25 16:32:11 +02:00
chenejac
92cd208104 Merge branch 'rel-1.13.0-RC' of https://github.com/vivo-project/Vitro into rel-1.13.0-RC 2022-08-24 22:15:26 +02:00
chenejac
807d1c229e [maven-scm-plugin] prepare development vitro-1.13.1-SNAPSHOT 2022-08-24 18:16:37 +02:00
chenejac
893472f302 [maven-scm-plugin] prepare release vitro-1.13.0 2022-08-24 18:14:02 +02:00
chenejac
cce6d41150 rebasing for new release candidate 2022-08-24 18:08:28 +02:00
chenejac
06f0b28bdc [maven-scm-plugin] prepare development vitro-1.13.1-SNAPSHOT 2022-08-24 18:03:44 +02:00
chenejac
8b2b9fb540 [maven-scm-plugin] prepare release vitro-1.13.0 2022-08-24 18:03:44 +02:00
chenejac
5735368e6b [maven-scm-plugin] prepare development vitro-1.13.1-SNAPSHOT 2022-08-24 18:03:44 +02:00
chenejac
ee6ba140b9 [maven-scm-plugin] prepare release vitro-1.13.0 2022-08-24 18:03:44 +02:00
chenejac
c64ce0a7c5 [maven-scm-plugin] prepare development vitro-1.13.1-SNAPSHOT 2022-08-24 18:03:44 +02:00
chenejac
71caf440a6 [maven-scm-plugin] prepare release vitro-1.13.0 2022-08-24 18:03:43 +02:00
chenejac
c6b9524b74 Merge branch 'main' of https://github.com/vivo-project/Vitro 2022-08-24 17:51:25 +02:00
df3c4a88ae
Issue/vivo 3606 : add language-specific sorting and label fields to search index (#321)
* Add select query document modifier with dynamic target field; use locale-specific sort fields when available.

* Add i18nized labels to index for autocomplete

* Remove lowercasing from label query

* Improved document modifier for multilingual field with defined suffix name

* Improved document modifier for multilingual field with defined suffix name

* refact: reverted access modifier changes

* Lowercase label in documentModifierI18nSort in case old solr schema is used which doesn't have lowercase filter

* fix: fixed queries and locale names

* fix: renamed new document modifier

* fix: use linkedHashMap to retain map sort fields order

* refact: extracted buildAndExecuteVClassQuery(List<String> classUris, int page, int pageSize, String alpha, VitroRequest vreq)

* fix: removed unused import

* fix: constant name aligned with other suffix

Co-authored-by: Brian Lowe <brian@ontocale.com>
2022-08-23 16:23:43 +02:00
6ad364f9ee
fix: VIVO-3738 use language specific webapp dao factory (#324)
Co-authored-by: Georgy Litvinov <georgy.litvinov@tib.eu>
2022-08-19 15:13:45 +03:00
f8c38b8233
Issue/VIVO 3739 : fix for data property editing form (#323)
* fix: compare blank node id with uri safely
2022-08-19 15:13:06 +03:00
ce680d9cd7
fix: use public description in data property template model (#322)
Co-authored-by: Georgy Litvinov <georgy.litvinov@tib.eu>
2022-08-17 16:57:00 +03:00
3a14872c7c
fix: float validation regex (#318)
Co-authored-by: Georgy Litvinov <georgy.litvinov@tib.eu>
2022-07-25 14:56:20 +03:00
chenejac
c1f578478c Merge branch 'rel-1.13.0-RC' of https://github.com/vivo-project/Vitro into rel-1.13.0-RC 2022-07-12 11:29:48 +02:00
chenejac
dfd64a9d83 [maven-scm-plugin] prepare development vitro-1.13.1-SNAPSHOT 2022-07-12 10:06:41 +02:00
chenejac
70badb792a [maven-scm-plugin] prepare release vitro-1.13.0 2022-07-12 10:03:48 +02:00
chenejac
247df43925 [maven-scm-plugin] prepare development vitro-1.13.1-SNAPSHOT 2022-07-12 09:57:51 +02:00
chenejac
ae77bf9f8f [maven-scm-plugin] prepare release vitro-1.13.0 2022-07-12 09:57:51 +02:00
chenejac
476fe6392a [maven-scm-plugin] prepare development vitro-1.13.1-SNAPSHOT 2022-07-12 09:57:51 +02:00
chenejac
eddfdf2c98 [maven-scm-plugin] prepare release vitro-1.13.0 2022-07-12 09:57:30 +02:00
chenejac
b4196e2013 Merge branch 'main' of https://github.com/vivo-project/Vitro 2022-07-12 09:52:50 +02:00
1168d1961a
fix: allow self editors to create individuals in faux property forms (#317) 2022-07-12 09:52:18 +02:00
chenejac
9436eb8434 updating of rc_script.sh 2022-07-07 19:09:10 +02:00
chenejac
c5a6638de9 [maven-scm-plugin] prepare development vitro-1.13.1-SNAPSHOT 2022-07-07 18:53:42 +02:00
chenejac
eeac504027 [maven-scm-plugin] prepare release vitro-1.13.0 2022-07-07 18:53:42 +02:00
b6d3b60530
proper fix to have the same substitutions as in RDFServiceTDB (#316) 2022-07-07 17:37:34 +02:00
6c95f5ab38
fix: retain language tags on editing data properties with backend editor (#315)
* fix: retain language tags on editing data properties with backend editor

* fix: replace label in backend editor in default language. Avoid side effect of removing all other labels.
2022-07-07 13:25:27 +02:00
acd2bf6a59
fix: workaround for jena bug. Treat integer and int equally while creating hash (#314) 2022-07-06 13:13:28 +02:00
ceebd3e422
fix: process string and untyped literals differently (#296)
* fix: process string and untyped literals differently

* fix for prev commit

* review fixes

* fix: generators fixes

* chore: removed unused imports
2022-07-04 22:10:20 +02:00
Dragan Ivanovic
a4bf5030da
Merge pull request #295 from litvinovg/individual_list_fix
Individual list calculation fix
2022-06-08 14:28:17 +02:00
Georgy Litvinov
c2dffb52b6 fix calculation of pages in individual list 2022-06-01 10:15:22 +02:00
Dragan Ivanovic
fb4594ed3e
Merge pull request #292 from brianjlowe/issue/VIVO-3713
VIVO-3713 Avoid excessive use of resources when ABox firsttime data are changed
2022-05-28 08:44:33 +02:00
Brian Lowe
ce82c237a3 address review comments and add additional cleanup 2022-05-27 17:55:08 +03:00
Brian Lowe
530ad7d39c Rename all portal blank nodes with the same URI 2022-05-27 17:41:50 +03:00
Brian Lowe
fc4d618be5 Add test using empty backup 2022-05-27 12:03:31 +03:00
Brian Lowe
f1ef775d95 Use limited diff when checking for local overrides of firsttime data. Add unit test for firsttime update behavior. 2022-05-26 20:22:07 +03:00
Dragan Ivanovic
06c2afa301
Merge pull request #288 from litvinovg/vitro-languages-core-home-fix
Prevent copying pom file to home directory
2022-05-21 11:18:06 +02:00
ff285fb80d
Added code for deleting individuals (#213)
* Added code for deleting individuals

* Allow admins delete individuals

* Fixed delete individual url params

* Improved query safety

* refact: fixed constants' names, fixed mistakes, removed useless code

* refact: refactored sparql queries

* fix: fixed error logging mistakes

* fix: use CONSTRUCT instead of DESCRIBE as less potentionally problematic, lookup for mostSpecificTypes

* feat: add delete link in vitro individual profile if individual is editable

* fix: renamed individualURI to individualUri and added safety check

* fix: use ABox model to construct triples to delete
2022-05-20 21:28:29 +02:00
c41853440f
I18n regression fix (#289)
* fix: get back language filtering for sparql construct query

* feat: LanguageFilteringRDFService sparqlConstructQuery tests added
2022-05-20 15:29:59 +03:00
Dragan Ivanovic
0d704f3eb8
Merge pull request #291 from vivo-project/feature/VIVO-3696
[3696] Timestamped filename for named graph output
2022-05-19 16:28:29 +02:00
Benjamin Gross
3cd323bfb1 Timestamped filename for named graph output 2022-05-06 10:16:37 -06:00
1b978b914b fix: fixed artifact assembly vitro-languages-core-home 2022-04-21 14:24:35 +02:00
ebc9237cc6
Upload documents in Vitro|VIVO (#251)
* feat: introduced file upload

* fix: added file upload config settings

* fix: reverted auto formatting of upload file helper

* fix: replaced missed condition

* Improved naming, internationalization, removed file extensions as misleading information

* Fixed wrong bytes number representing 10Mb

* fix: show no media types allowed if no media types defined in runtime.properties

* fix: Add vitro-languages-home-core as installer dependency to have Vitro RDF internationalization files

* fix: change vitro-languages-core-home dependency type from tar.gz to pom
2022-04-14 16:16:50 +02:00
eff04e0979
Add password authentification on external smtp servers (#240)
* Add SMTP Authentification

* refactor: restrict access to getEmailSession()

* fix: FreemarkerEmailFactory test, defined protocols if TLS port is used to send email

* fix: add check for TLSv1.3 support
2022-04-14 16:14:38 +02:00
03624e5d1b
fix: revert vitro installer packaging to war (#269)
* fix: revert vitro installer packaging to war

* chore: fix for github action
2022-04-13 19:03:26 +03:00
Ben
733a88ddcb
Add POST body support to update api (#252) 2022-04-07 16:34:34 +02:00
Veljko Maksimovic
b8944fb3bf
Creating Locale with specified Language script (#250)
* Creating a util function to convert Locale string to Locale, but take language script into consideration

* emptz commit to trigger auto build
2022-04-07 16:23:19 +02:00
bbd714ceb9
Online translation (#241)
* Online translation added to Developer panel settings

* Added special characters conversion on file import and export for online translations

* fix: Parse text nodes separately

* fix: broken js on page prevents working developer panel

* fix: workaround for online translations using freemarker template models

* fix: safe way to convert array of objects to array of strings

* fix: convert char codes on read/write property files

* refact: corrected constant names
2022-04-07 16:21:49 +02:00
Dragan Ivanovic
67b4df3c0b
Merge pull request #270 from litvinovg/fix-changelisteners-regression
Move stream reset inside loop so that every listener gets the same state
2022-02-25 16:41:50 +01:00
4ec81b3466
fix: move stream reset inside loop so that every listener gets the same state until a better approach is implemented (copy of c3aa9c5) 2022-02-24 19:36:29 +01:00
Ralph O'Flinn
39e1eed20d [maven-scm-plugin] prepare development vitro-1.12.3-SNAPSHOT 2022-02-15 04:26:25 -06:00
Ralph O'Flinn
ec13d83faa [maven-scm-plugin] prepare release vitro-1.12.2 2022-02-15 04:25:38 -06:00
Dragan Ivanovic
29c9f7ca76
Update PULL_REQUEST_TEMPLATE.md 2021-12-29 11:45:07 +01:00
Ralph O'Flinn
4d24a63a20 Merge branch 'heads/rel-1.12.1-RC' into main 2021-12-16 05:11:28 -06:00
Ralph O'Flinn
b1f66ea933 Merge tag 'rel-1.12.1-RC' into main 2021-12-16 05:07:13 -06:00
Ralph O'Flinn
c88626dffc [maven-scm-plugin] prepare development vitro-1.12.2-SNAPSHOT-SNAPSHOT 2021-12-16 01:25:32 -06:00
Ralph O'Flinn
420971464a [maven-scm-plugin] prepare release vitro-1.12.1 2021-12-16 01:24:47 -06:00
Ralph O'Flinn
685d0897a6 update gitignore 2021-12-10 03:10:11 -06:00
Ralph O'Flinn
e011fc72fc
Update pom.xml
updating packaging to pom from war
2021-10-18 00:35:08 -05:00
Ralph O'Flinn
fc8b92fcf6
Rel 1.12.1 alpha (#249)
* Update issue templates

* Run unit tests in alphabetical order (#244)

* fix: unit tests VIVO-2003 (#245)

* updates to outdated urls

Co-authored-by: Dragan Ivanovic <chenejac@uns.ac.rs>
Co-authored-by: Brian Lowe <brian@ontocale.com>
Co-authored-by: Georgy Litvinov <git@litvinovg.pro>
2021-10-12 10:40:25 -05:00
Dragan Ivanovic
bf7c6ffaf7 Update issue templates 2021-10-06 12:56:43 +02:00
Ralph O'Flinn
028af518f9
1.12.0-maint to main (#246)
* [maven-scm-plugin] prepare release vitro-1.12.0

* [maven-scm-plugin] prepare development vitro-1.12.1-SNAPSHOT-SNAPSHOT
2021-08-17 10:53:15 -05:00
Ralph O'Flinn
5a4648554a Merge branch 'rel-1.12.0-RC' into main 2021-07-21 07:20:21 -05:00
dependabot[bot]
b123f3bd9b
Bump junit from 4.11 to 4.13.1 in /api (#191)
Bumps [junit](https://github.com/junit-team/junit4) from 4.11 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.11.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.11...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-06-25 00:14:23 -05:00
Brian Lowe
a7e1e60c7e
Update version numbers in pom.xmls (#239)
* Update version numbers in pom.xmls

* Restore -SNAPSHOT
2021-06-21 04:10:08 -05:00
9565fbd925
Merge pull request #232 from brianjlowe/issue/VIVO-1983
[VIVO-1983] Limit label management values to current locale
2021-06-17 23:33:44 +02:00
Brian Lowe
762388e88b Retrieve locales used in label statements instead of only selectable locales 2021-06-16 22:02:48 +03:00
1e7cc745bc
Merge pull request #236 from brianjlowe/issue/VIVO-1985
[VIVO-1985] Compare locales of equal rank alphabetically to provide consistent fallback
2021-06-16 20:16:39 +02:00
Brian Lowe
93fd5a5f39 Retrieve locales used in label statements instead of only selectable locales 2021-06-16 21:16:24 +03:00
Brian Lowe
33ae07dcbf Use language-neutral model to match data property statements to literal hashes. 2021-06-10 13:05:02 +03:00
Brian Lowe
20507a75fb Remove erroneous addition of language-awareness to request OntModels that failed to respect the specified language option. 2021-06-10 13:04:18 +03:00
Brian Lowe
1d89cbc908
Log ConfigurationProperties bean at DEBUG level. (#237) 2021-06-09 08:10:57 -06:00
Brian Lowe
1720272155
[VIVO-1997] Log blank node deletion messages at DEBUG instead of WARN (#238)
* Log blank node deletion messages at debug level instead of warn.

* Switch to more informative debug message about blank node deletion.
2021-06-09 08:10:12 -06:00
Brian Lowe
27353bfb91 Count labels and distinct languages using same query; revert changes to lib-properties.ftl. 2021-06-04 16:59:27 +03:00
d21dc92b0b
Use unique key in account activation link and reset password link (#234)
* Use unique key for email activation and password reset

* Renamed old variable from hash to key

* Check for null before setting email key for backward compatibility. Removed comment about old behaviour.

* Send password_change_invalid_key message instead of password_change_not_pending on key mismatch.
2021-06-03 15:59:29 +03:00
Brian Lowe
3c04cc0f80
Abort TDB write transaction before ending if not successfully committed (#230) 2021-06-02 09:55:23 -06:00
Ben
1819fa1dd4
Merge pull request #235 from brianjlowe/issue/VIVO-1989
[VIVO-1989] URL-encode vCard-related resource URIs appended to edit links
2021-06-02 09:30:30 -06:00
Brian Lowe
7a24e259e8 URL-encode vCard-related resource URIs appended to edit links 2021-06-01 15:45:48 +03:00
Brian Lowe
e7993668b6 Sort locales of the same priority level alphabetically for consistent selection of fallback language 2021-06-01 15:10:56 +03:00
Brian Lowe
63639fc852 Update view labels servlet to use current language filtering 2021-05-28 17:12:02 +03:00
Brian Lowe
c07af3d794 Count labels with language filtering 2021-05-28 15:51:06 +03:00
Ben
5075d78537
Update example config files to current best practices (#229) 2021-05-06 12:33:37 +03:00
Ben
bbead68e88
Merge pull request #220 from brianjlowe/issue/VIVO-1974
Add usePreciseSubqueries property to example.runtime.properties.  Hav…
2021-05-05 10:36:54 -06:00
Ben
71ca39d597
[VIVO-1736] - Bugfix for redirecting user to home page after login (#227)
* Add trailing slash to home page redirect if contextPath empty

* Add redirect path to debug log

* Remove outdated code comment
2021-05-03 20:03:17 +03:00
Ben
cd437a503e
Merge pull request #222 from brianjlowe/issue/VIVO-1615
Fix errors preventing TPF server from working with TDB. Resolve https…
2021-04-27 10:43:48 -06:00
Brian Lowe
0b9919c55d
Replace hardcoded en locale with current locale in lang and xml:lang attributes (#228) 2021-04-21 11:53:41 -05:00
Brian Lowe
3984203552
Implement nextBinding() method in FIlteredResultSet. (#215) 2021-04-21 10:14:31 -05:00
Ben
bc12d2037c
Merge pull request #224 from brianjlowe/issue/VIVO-1976
Move event listening to RDFServiceGraph level to avoid adding a new r…
2021-04-12 08:28:20 -06:00
Brian Lowe
b6062fe4a0 Add note to example.runtime.properties that TPF should not be used if Vitro contains restricted data. 2021-04-09 18:15:57 +03:00
Ben
b283a8342a
Add subject to reindex in AdditionalURIsForObjectProperties (#225)
Co-authored-by: Georgy Litvinov <git@litvinovg.pro>
2021-04-09 17:39:15 +03:00
Ben
ebca021bc4
Merge pull request #223 from brianjlowe/issues/VIVO-1973
Allow site admins to edit pages in page management. Resolve https://j
2021-04-09 07:47:57 -06:00
Ben
c5a716e90e
Merge pull request #226 from vivo-project/revert-221-bugfix/VIVO-1736
Revert "[VIVO-1736] - Bugfix for redirecting user to home page after login"
2021-04-06 11:25:11 -06:00
Brian Lowe
def81c9013 Revert "Bugfix for redirecting user to home page after login (#221)"
This reverts commit 2ad521e9da.
2021-04-06 20:21:51 +03:00
Brian Lowe
93bd5183e2 Move event listening to RDFServiceGraph level to avoid adding a new redundant listener each time a model is made for an existing RDFServiceGraph. Resolve https://jira.lyrasis.org/browse/VIVO-1976 2021-04-06 17:15:50 +03:00
Brian Lowe
70aefebedf Allow site admins to edit pages in page management. Resolve https://jira.lyrasis.org/browse/VIVO-1973 2021-04-06 14:36:30 +03:00
4ed88b81e3
Add subject to reindex in AdditionalURIsForObjectProperties (#216)
Resolve https://jira.lyrasis.org/browse/VIVO-1966
2021-04-06 13:23:21 +03:00
Brian Lowe
cdfb18a455 Fix errors preventing TPF server from working with TDB. Resolve https://jira.lyrasis.org/browse/VIVO-1615 2021-04-06 12:53:26 +03:00
Ben
2ad521e9da
Bugfix for redirecting user to home page after login (#221)
https://jira.lyrasis.org/browse/VIVO-1736
2021-04-06 11:44:53 +03:00
Brian Lowe
ff8ba8adcc Add usePreciseSubqueries property to example.runtime.properties. Have RDFServiceTDB report a preference for precise optionals as does SDB. 2021-03-29 16:17:37 +03:00
Ralph O'Flinn
eb61192d11
Revert "revert deployment changes (#217)" (#218)
This reverts commit e4e0a7d061.
2021-03-24 07:12:31 -05:00
Ralph O'Flinn
193b38159a
revert deployment changes (#219)
Co-authored-by: William Welling <wwelling@library.tamu.edu>
2021-03-24 01:47:08 -05:00
William Welling
e4e0a7d061
revert deployment changes (#217) 2021-03-22 20:42:45 +02:00
Brian Lowe
6b612316ee
Use same fallback locale used by RDFFilesLoader when setting locale on request. Resolves https://jira.lyrasis.org/browse/VIVO-1959 (#212) 2021-02-18 08:50:32 -06:00
Andrew Woods
eb949919b5
Sprint i18n with main (#209)
* Layer uqam updates onto master (minus trailing whitespace)

* Update RDFServiceFactorySingle.java

* Sprint i18n whitespace (#143)

* Removed extraneous whitespace
   - modified:   api/src/main/java/edu/cornell/mannlib/vitro/webapp/edit/n3editing/VTwo/BaseEditElementVTwo.java

* move RootUserPolicy.java from VIVO to Vitro repo.

* Remove blank line

* Fixed indentations

* Update whitespace for: TemplateProcessingHelper.java

* Update whitespace for: RDFServiceModel.java

* Removed extraneous whitespaces.

* Tagging UQAM Comments with following tags

-Add-Feature
-Optimization
-Linguistic-Management
-Bug-Correction

* Resolve compilation failures in Vitro tests

* Remove whitespace changes from SelectListGeneratorVTwo.java

* Add null check on field values of RDF Form (#158)

Resolves: https://jira.lyrasis.org/browse/VIVO-1800

Co-authored-by: Andrew Woods <awoods@duraspace.org>

* Fix incorrect tool-tip in language selection dropdown (#156)

Resolves: https://jira.lyrasis.org/browse/VIVO-1783

Co-authored-by: Andrew Woods <awoods@duraspace.org>

* Sprint i18n/lang filtering model (#159)

* Add language-aware graph filtering instead of layering on additional RDFService

Resolves: https://jira.lyrasis.org/browse/VIVO-1771

* Remove hardcoded link label (#161)

Resolves: https://jira.lyrasis.org/browse/VIVO-1779

* Enable filtering of non-enabled i18n language files from being loaded into triple store (#160)

Define name of available language listing file (found in Vitro-languages)
Update RDFFilesLoader method interfaces to include ServletContext

Part of resolution to: https://jira.lyrasis.org/browse/VIVO-1836

Co-authored-by: Andrew Woods <awoods@duraspace.org>

* Add i18n version of Edit page title (#157)

Related to: https://jira.lyrasis.org/browse/VIVO-1779

Co-authored-by: Andrew Woods <awoods@duraspace.org>

* Changing ontology extensions for n3 & assigning a base IRI to each (#163)

ontology

Co-authored-by: michelheon <heon@videotorn.ca>
Co-authored-by: Andrew Woods <awoods@duraspace.org>

https://jira.lyrasis.org/browse/VIVO-1862

* Update sprint-i18n with master branch (#166)

* Make data property richtext editor option selectable from UI

* [VIVO-1755] - Better error handling when reasoner disabled (#137)

* Better error handling when reasoner disabled

* Change reasoner error log message to debug

* Extend reasoner status error handling

* Improve reasoner error log message and extend to JenaAdminActions

* Bump up log level for admin action to 'warn' and edit admin panel error message

* Change Model writer lang from "N3-PP" to "N3" (#149)

Resolves: https://jira.lyrasis.org/browse/VIVO-1761

Co-authored-by: Andrew Woods <awoods@duraspace.org>

* [VIVO-1851] - Add 'remove' option to named graph management page (#162)

* Add 'remove' option to named graph management page

Resolves: https://jira.lyrasis.org/browse/VIVO-1851

* [VIVO-1872] - Add download option to SPARQL Query page (#164)

* Add download option to SPARQL Query page

* Set SPARQL query results content type even if downloading

* Address pull request comments

Co-authored-by: gneissone <mbgross@wustl.edu>
Co-authored-by: Ralph O'Flinn <roflinn@users.noreply.github.com>
Co-authored-by: Andrew Woods <awoods@duraspace.org>

* [VIVO-1839] - Use language name for selector instead of flags (#165)

* Use language name for selector instead of flags
* Add country name to language selector
* Increase min-width of language dropdown
* Update data tree comment in languageSelector.ftl
* Min-width for language dropdown
* Language dropdown css adjustment
* Capitalize locale label
* Indent on languageSelector.ftl

Resolves: https://jira.lyrasis.org/browse/VIVO-1839

* Adds internationalization to the admin/sparql-query page (#167)

* Adds internationalization to the admin/sparql-query page

Partial resolution of: https://jira.lyrasis.org/browse/VIVO-1873

* Add i18n for 'save query result'

Related to: https://jira.lyrasis.org/browse/VIVO-1873

* code review

Co-authored-by: Andrew Woods <awoods@duraspace.org>

* removed redundat files which are now available via Vitro- and VIVO-languages

* Making UQAM-optimization aware of https://

* Add parent reference to installer/pom.xml (#174)

Resolves: https://jira.lyrasis.org/browse/VIVO-1903

Co-authored-by: Andrew Woods <awoods@duraspace.org>

* Revert non-function RDF changes (#177)

Related to: https://jira.lyrasis.org/browse/VIVO-1905

Co-authored-by: Andrew Woods <awoods@duraspace.org>

* Ensure 'other' in Individual->Teaching->advisees->type is translated

Partial resolution to: https://jira.lyrasis.org/browse/VIVO-1881

* Re-add logic from commit 7420957

* [VIVO-1812] use i18n translation for validation messages (#179)

* replace constants with i18n text in BasicValidationVTwo
* use constants for i18n template key

Partial resolution of: https://jira.lyrasis.org/browse/VIVO-1812

* added js_string at i18n strings to handle quotes properly, ticket vivo-1842 (#180)

Partial resolution for: https://jira.lyrasis.org/browse/VIVO-1842

* [VIVO-1870] simplify and concat translation for browse by vclass (#182)

* simplify and concat translation for browse by vclass

Partial resolution of: https://jira.lyrasis.org/browse/VIVO-1870

* [VIVO-1900] i18n: added empty check for getCountry, fixing bug with spanish label (es) (#181)

* added empty check for getCountry, fixing bug with spanish label (es), ticket vivo-1900

Partial resolution to: https://jira.lyrasis.org/browse/VIVO-1900

* [VIVO 1870] update i18n key to JavaScript mapping (#183)

* update menupage-script i18n key to JavaScript mapping

Follow-on to resolution of: https://jira.lyrasis.org/browse/VIVO-1870

* [VIVO-1837] get i18n bundle from WebappDaoFactoryConfig preferred locales (#178)

* apply i18n text to VClassDaoJena.getLabelForClass
* expose i18n bundle through webapp dao factory interface
* use whole messages for i18n
* if request available use request bundle else use context bundle
* clear cache when context theme directory changes
* make getOverridingLocale from context private
* select locale based on preferred locale from webapp dao factory
* use first preferred local even when no selectable locales available on context
* build default preferred locales from default preferred languages

Resolves: https://jira.lyrasis.org/browse/VIVO-1837

* Ensure that "available langs" include base langs (#185)

Resolves: https://jira.lyrasis.org/browse/VIVO-1922

Co-authored-by: Andrew Woods <awoods@duraspace.org>

* Ensure I18nStub is initialized before pertinent tests (#186)

Resolves: https://jira.lyrasis.org/browse/VIVO-1923

Co-authored-by: Andrew Woods <awoods@duraspace.org>

* add additional null checks to ensure context is ready for theme change (#187)

* [VIVO-1915] i18n - Adding a label with language tag through the "new" manageLabelsForindividualAddForm.ftl does not take the setting for language tag (#184)

* Fixed bug when addng a label with language tag through managLabelsForindividualAddForm, re ticket VIVO-1915

* removed the language select for managing multi language labels, ticket vivo-1915

* readded the fix for language selection because of the fr-CA version of the manageLabelsForIndividualftl, ticket vivo-1915

* removed earlier fix, removed comments, modified ManageLabelGenrator, ticket vivo-1915

Partial resolution to: https://jira.lyrasis.org/browse/VIVO-1915

* - replaced hard coded "or"s with i18n().or

* [VIVO-1925] i18n: Editing labels results in new label (#188)

* fixed bug: Editing language labels results in new label, ticket vivo-1925

Resolves: https://jira.lyrasis.org/browse/VIVO-1925

* Enable lang selection without need for 'available-langs.properties' (#169)

* Enable lang selection without need for 'available-langs.properties'
Co-authored-by: Andrew Woods <awoods@duraspace.org>

* Reduce number of times QuerySolutions are looped in LanguageFilteringRDFService (#194)

- No functional change in this update

Resolves: https://jira.lyrasis.org/browse/VIVO-1931

Co-authored-by: Andrew Woods <awoods@duraspace.org>

* Prevent 'ProcessRdfForm.parseN3ToRDF' from using null linguisticContext (#197)

Resolves: https://jira.lyrasis.org/browse/VIVO-1944

Co-authored-by: Andrew Woods <awoods@duraspace.org>

* [Vivo 1918] i18n: Reload firsttime files on start-up if changed (#195)

Co-authored-by: Andrew Woods <awoods@lyrasis.org>

* [VIVO-1936] i18n: updated the language comment in runtime.properties

* ftl function to capitalize group name affording override

* Further i18n for BasicValidationVTwo.java

* Fixed DeletePropertyController.java - getting localname of property properly (#200)

* Fixed DeletePropertyController.java - getting localname of property properly

Resolves: https://jira.lyrasis.org/browse/VIVO-1816

* Removed hardcoded time units by properties calls in dateTimeWithPrecision.ftl

* Use i18n values for date time form (#204)

Resolves: https://jira.lyrasis.org/browse/VIVO-1953

* VIVO-1929: patch authorizing create individual form (#206)

* patch authorizing create individual form

Resolves: https://jira.lyrasis.org/browse/VIVO-1929

* Issue/vivo 1947 (#205)

* Make data property richtext editor option selectable from UI
* Better error handling when reasoner disabled
* Change reasoner error log message to debug
* Extend reasoner status error handling
* Improve reasoner error log message and extend to JenaAdminActions
* Bump up log level for admin action to 'warn' and edit admin panel error message
* Change Model writer lang from "N3-PP" to "N3" (#149)
* Prevent ontology editor and N3 editing from deleting property values in languages other than the one associated with the editing request. [https://jira.lyrasis.org/browse/VIVO-1947]

Resolves: https://jira.lyrasis.org/browse/VIVO-1947

Co-authored-by: gneissone <mbgross@wustl.edu>
Co-authored-by: Ralph O'Flinn <roflinn@users.noreply.github.com>
Co-authored-by: Andrew Woods <awoods@lyrasis.org>
Co-authored-by: Andrew Woods <awoods@duraspace.org>

* Remove comments

Co-authored-by: Andrew Woods <awoods@duraspace.org>
Co-authored-by: Nicolas D <46490666+nicalico@users.noreply.github.com>
Co-authored-by: VIVO UQAM <62542918+UQAM-VIVO@users.noreply.github.com>
Co-authored-by: Matthias Luehr <luehr@hs-mittweida.de>
Co-authored-by: michelheonuqam <heon.michel@uqam.ca>
Co-authored-by: Brian Lowe <brianjlowe@gmail.com>
Co-authored-by: j-dornbusch <joachim.dornbusch@ehess.fr>
Co-authored-by: Michel Heon <heon@videotron.ca>
Co-authored-by: gneissone <mbgross@wustl.edu>
Co-authored-by: Ralph O'Flinn <roflinn@users.noreply.github.com>
Co-authored-by: dofeldsc <dofeldsc@uos.de>
Co-authored-by: root <root@vivo-development.hs-mittweida.de>
Co-authored-by: gneissone <mbgross@unavco.org>
Co-authored-by: William Welling <wwelling@library.tamu.edu>
Co-authored-by: Kampe <Benjamin.Kampe@tib.eu>
Co-authored-by: Gross, Benjamin <benjamin.gross@clarivate.com>
Co-authored-by: matthiasluehr <60263380+matthiasluehr@users.noreply.github.com>
Co-authored-by: nicolasdickner <dickner.nicolas@uqam.ca>
2021-02-10 11:04:01 -06:00
William Welling
28188e9719
VIVO-1960: GitHub Actions Continued (#211)
* run tests during CI build
* build CI use java 11

Follow-on to: https://jira.lyrasis.org/browse/VIVO-1960
2021-02-09 17:45:53 -05:00
William Welling
06d9f5d333
VIVO-1960: GitHub Build Action (#210)
* add build workflow
* remove travis
* update readme badge

Partially resolves: https://jira.lyrasis.org/browse/VIVO-1960
2021-02-09 15:01:47 -05:00
Andrew Woods
8b9a7484b3
Create vivo/home on application start-up (#192)
* Create vivo/home on application start-up

- Add logic for untarring vivo-home

Related to: https://jira.lyrasis.org/browse/VIVO-1443

* Require runtime.properties and applicationSetup.n3 be in 'config/' dir

Related to: https://jira.lyrasis.org/browse/VIVO-1443

* Support loading config files with or without 'default' prefix
* Prioritize without the prefix

Related to: https://jira.lyrasis.org/browse/VIVO-1443

* Add leading slash to location of vivo-home.tar resource path
* This allows for deployment in both Tomcat and Jetty

Related to: https://jira.lyrasis.org/browse/VIVO-1443

* Ensure VIVO_HOME is populated whether it is empty or not

Related to: https://jira.lyrasis.org/browse/VIVO-1443

* Require common properties to be in JNDI

Properties include:
- vitro/home
- vitro/appName
- vitro/rootUserAddress
- vitro/defaultNamespace

Related to: https://jira.lyrasis.org/browse/VIVO-1443

* VIVO-1443: non destructive vivo home untarring (#2)

* Upgrade Jena version to 3.16.0 (#196)

Related to: https://jira.lyrasis.org/browse/VIVO-1943

* remove example-settings.xml
* update home directory untar non-destructive
* checksum digest to retain modified files
* compare checksum from digest with existing file
* overwrite files that have not changed
* add command to manually generate checksum digest
* simplify parsing checksum digest using pattern

Co-authored-by: Andrew Woods <awoods@lyrasis.org>
Co-authored-by: Andrew Woods <awoods@duraspace.org>

* not overwrite existing file if same as tar entry (#3)

* Upgrade Jena version to 3.16.0 (#196)

Related to: https://jira.lyrasis.org/browse/VIVO-1943

* remove example-settings.xml
* update home directory untar non-destructive
* checksum digest to retain modified files
* compare checksum from digest with existing file
* overwrite files that have not changed
* add command to manually generate checksum digest
* simplify parsing checksum digest using pattern
* do not overwrite file if same as already exists

Co-authored-by: Andrew Woods <awoods@lyrasis.org>
Co-authored-by: Andrew Woods <awoods@duraspace.org>

* Update log messages for clarity

Co-authored-by: Andrew Woods <awoods@duraspace.org>
Co-authored-by: William Welling <wwelling@library.tamu.edu>
Co-authored-by: Gross, Benjamin <benjamin.gross@clarivate.com>
2021-02-05 10:58:37 -06:00
Andrew Woods
936305be2a
Upgrade Jena version to 3.16.0 (#196)
Related to: https://jira.lyrasis.org/browse/VIVO-1943

Co-authored-by: Andrew Woods <awoods@duraspace.org>
2020-12-03 07:56:29 -06:00
Ben
119413413a
Adjust SPARQL node logic to add datatypes to literals only if lacking a language tag (#175) 2020-07-21 17:01:39 +03:00
590 changed files with 79988 additions and 4612 deletions

34
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View file

@ -0,0 +1,34 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. Windows, Linux]
- Browser [e.g. chrome, safari]
- Tomcat version [e.g. 8, 9]
- VIVO version [e.g. 1.11.0, 1.12.0]
- Apache Solr or ElasticSearch version
**Additional context**
Add any other context about the problem here.

View file

@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

View file

@ -1,7 +1,7 @@
**Thank you for submitting a pull request! Title this pull request with a brief description of what the pull request fixes/improves/changes. Please describe the pull request in detail using the template below.**
* * *
**[JIRA Issue](https://jira.duraspace.org/projects/VIVO)**: (please link to issue)
**[VIVO GitHub issue](https://github.com/vivo-project/VIVO/issues)**: (please link to issue)
* Other Relevant Links (Mailing list discussion, related pull requests, etc.)
@ -29,6 +29,7 @@ Example:
* Does this change add any new dependencies?
* Does this change require any other modifications to be made to the repository?
* Could this change impact execution of existing code?
* Large pull requests should be avoided. If this PR is large (more than 1,000 lines of codes), please provide short explanation why your contribution can't be decoupled in smaller PRs.
# Interested parties
Tag (@ mention) interested parties or, if unsure, @VIVO-project/vivo-committers

32
.github/workflows/build.yml vendored Normal file
View file

@ -0,0 +1,32 @@
name: Build
on: [ push, pull_request, workflow_dispatch ]
jobs:
build:
runs-on: ubuntu-latest
env:
MAVEN_OPTS: -Xmx1024M
steps:
- uses: actions/checkout@v3
with:
path: Vitro
- name: Maven Cache
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-cache-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-cache-m2-
- name: Setup Java
uses: actions/setup-java@v1
with:
java-version: 11
- name: Maven Build
run: |
cd ./Vitro
mvn clean install

5
.gitignore vendored
View file

@ -24,3 +24,8 @@ utilities/sdb_to_tdb/.work
**/.classpath
**/.project
**/bin/
.fake
.ionide
.vscode

View file

@ -1,22 +0,0 @@
language: java
dist: trusty
sudo: false
jdk:
- openjdk8
- oraclejdk8
env:
# Give Maven 1GB of memory to work with
- MAVEN_OPTS=-Xmx1024M
cache:
directories:
- .autoconf
- $HOME/.m2
install:
- "echo 'Skipping install stage, dependencies will be downloaded during build and test stages.'"
script:
- "mvn clean package -Dmaven.test.skip=false"

View file

@ -1,6 +1,6 @@
# What is Vitro?
[![Build Status](https://travis-ci.org/vivo-project/Vitro.png?branch=develop)](https://travis-ci.org/vivo-project/Vitro)
[![Build](https://github.com/vivo-project/Vitro/workflows/Build/badge.svg)](https://github.com/vivo-project/Vitro/actions?query=workflow%3ABuild)
Vitro is a general-purpose web-based ontology and instance editor with customizable public browsing.
@ -16,7 +16,6 @@ With Vitro, you can:
* Search your data with Apache Solr
Vitro was originally developed at Cornell University, and is used as the core of the popular
research and scholarship portal, [VIVO](https://duraspace.org/vivo/).
For more information, contact the [VIVO community](https://duraspace.org/vivo/resources/contact/).
research and scholarship portal, [VIVO](https://vivo.lyrasis.org/).
For more information, contact the [VIVO community](https://vivo.lyrasis.org/contact/).

View file

@ -7,13 +7,13 @@
<groupId>org.vivoweb</groupId>
<artifactId>vitro-api</artifactId>
<version>1.11.2-SNAPSHOT</version>
<version>1.14.1-SNAPSHOT</version>
<packaging>jar</packaging>
<parent>
<groupId>org.vivoweb</groupId>
<artifactId>vitro-project</artifactId>
<version>1.11.2-SNAPSHOT</version>
<version>1.14.1-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
@ -21,6 +21,13 @@
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<runOrder>alphabetical</runOrder>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
@ -66,7 +73,7 @@
<dependency>
<groupId>org.vivoweb</groupId>
<artifactId>vitro-dependencies</artifactId>
<version>1.11.2-SNAPSHOT</version>
<version>1.14.1-SNAPSHOT</version>
<type>pom</type>
</dependency>
<dependency>
@ -85,7 +92,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<version>4.13.1</version>
<scope>test</scope>
</dependency>
<dependency>

View file

@ -8,6 +8,7 @@ public class DynamicFieldRow {
private int id = -1;
private String value = null;
private String language = "";
private Map parameterMap = null;
public int getId() {
@ -34,4 +35,13 @@ public class DynamicFieldRow {
this.parameterMap = parameterMap;
}
public String getLanguage() {
return language;
}
public void setLanguage(String language) {
if (language != null) {
this.language = language;
}
}
}

View file

@ -23,10 +23,14 @@ import edu.cornell.mannlib.vedit.beans.FormObject;
import edu.cornell.mannlib.vedit.beans.DynamicField;
import edu.cornell.mannlib.vedit.beans.DynamicFieldRow;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.StringUtils;
import edu.cornell.mannlib.vedit.tags.EditTag;
public class DynamicFieldsTag extends EditTag {
private static final String LANGUAGE = "language";
private char PATH_SEP = File.separatorChar;
public final String MARKUP_FILE_PATH = "templates"+PATH_SEP+"edit"+PATH_SEP+"specific"+PATH_SEP;
@ -175,7 +179,12 @@ public class DynamicFieldsTag extends EditTag {
String key = (String) paramIt.next();
String value = (String) row.getParameterMap().get(key);
byte[] valueInBase64 = Base64.encodeBase64(value.getBytes());
taName.append(key).append(":").append(new String(valueInBase64)).append(";");
taName.append(key).append(":").append(new String(valueInBase64));
if (StringUtils.isNotBlank(row.getLanguage())) {
byte[] encodedLang = Base64.encodeBase64(row.getLanguage().getBytes());
taName.append(":").append(LANGUAGE).append(":").append(new String(encodedLang));
}
taName.append(";");
}
if (row.getValue().length() > 0) {
String templateWithVars = templateMarkup;

View file

@ -6,8 +6,6 @@ import java.lang.reflect.Method;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
@ -17,6 +15,7 @@ import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.logging.Log;
@ -272,6 +271,37 @@ public class FormUtils {
return options;
}
public static List<Option> makeOptionListOfNotDisjointClasses(WebappDaoFactory wadf, String baseVclassUri, String selectedUri) {
VClassDao vClassDao = wadf.getVClassDao();
Set<String> uris = getNotDisjointClassUris(wadf, baseVclassUri, vClassDao);
uris.add(baseVclassUri);
List<Option> options = new LinkedList<>();
for (String vclassUri : uris) {
VClass vclass = vClassDao.getVClassByURI(vclassUri);
Option option = new Option();
option.setValue(vclass.getURI());
option.setBody(vclass.getPickListName());
options.add(option);
if (Objects.equals(selectedUri, vclass.getURI())) {
option.setSelected(true);
}
}
options.sort((o1, o2) -> o1.getBody().compareTo(o2.getBody()));
return options;
}
private static Set<String> getNotDisjointClassUris(WebappDaoFactory wadf, String classUri, VClassDao vClassDao) {
Set<String> allClasses = wadf.getVClassDao()
.getAllVclasses()
.stream()
.map(vclass -> vclass.getURI())
.collect(Collectors.toSet());
Set<String> disjointClasses = new HashSet<>(vClassDao.getDisjointWithClassURIs(classUri));
allClasses.removeAll(disjointClasses);
return allClasses;
}
public static void beanSet(Object newObj, String field, String value) {
beanSet (newObj, field, value, null);
}
@ -369,6 +399,9 @@ public class FormUtils {
for (String aParam : param) {
String[] p = aParam.split(":");
beanParamMap.put(p[0], new String(Base64.decodeBase64(p[1].getBytes())));
if (p.length > 3) {
beanParamMap.put(p[2], new String(Base64.decodeBase64(p[3].getBytes())));
}
}
return beanParamMap;
}

View file

@ -62,6 +62,7 @@ public class ApplicationSetup implements ServletContextListener {
private void locateApplicationConfigFile() {
Path path = this.vitroHomeDir.getPath().resolve(APPLICATION_SETUP_PATH);
if (!Files.exists(path)) {
throw new IllegalStateException("'" + path + "' does not exist.");
}

View file

@ -37,7 +37,14 @@ public class RootUserPolicy implements PolicyIface {
private static final Log log = LogFactory.getLog(RootUserPolicy.class);
private static final String PROPERTY_ROOT_USER_EMAIL = "rootUser.emailAddress";
/*
* UQAM Add-Feature For parameterization of rootUser
*/
private static final String PROPERTY_ROOT_USER_PASSWORD = "rootUser.password";
private static final String PROPERTY_ROOT_USER_PASSWORD_CHANGE_REQUIRED = "rootUser.passwordChangeRequired";
private static final String ROOT_USER_INITIAL_PASSWORD = "rootPassword";
private static final String ROOT_USER_INITIAL_PASSWORD_CHANGE_REQUIRED = "true";
/**
* This is the entire policy. If you are a root user, you are authorized.
@ -150,10 +157,12 @@ public class RootUserPolicy implements PolicyIface {
ua.setEmailAddress(configuredRootUser);
ua.setFirstName("root");
ua.setLastName("user");
// UQAM Add-Feature using getRootPasswordFromConfig()
ua.setArgon2Password(Authenticator.applyArgon2iEncoding(
ROOT_USER_INITIAL_PASSWORD));
getRootPasswordFromConfig()));
ua.setMd5Password("");
ua.setPasswordChangeRequired(true);
// UQAM Add-Feature using getRootPasswdChangeRequiredFromConfig()
ua.setPasswordChangeRequired(getRootPasswdChangeRequiredFromConfig().booleanValue());
ua.setStatus(Status.ACTIVE);
ua.setRootUser(true);
@ -191,7 +200,31 @@ public class RootUserPolicy implements PolicyIface {
ss.warning(this, "For security, "
+ "it is best to delete unneeded root user accounts.");
}
/*
* UQAM Add-Feature
* Add for getting rootUser.password property value from runtime.properties
*/
private String getRootPasswordFromConfig() {
String passwd = ConfigurationProperties.getBean(ctx).getProperty(
PROPERTY_ROOT_USER_PASSWORD);
if (passwd == null) {
passwd = ROOT_USER_INITIAL_PASSWORD;
}
return passwd;
}
/*
* UQAM Add-Feature
* Add for getting rootUser.passwordChangeRequired property value from runtime.properties
*/
private Boolean getRootPasswdChangeRequiredFromConfig() {
String passwdCR = ConfigurationProperties.getBean(ctx).getProperty(
PROPERTY_ROOT_USER_PASSWORD_CHANGE_REQUIRED);
if (passwdCR == null) {
passwdCR = ROOT_USER_INITIAL_PASSWORD_CHANGE_REQUIRED;
}
return new Boolean(passwdCR);
}
@Override
public void contextDestroyed(ServletContextEvent sce) {
// Nothing to destroy

View file

@ -20,6 +20,7 @@ public class ApplicationBean {
public final static int VIVO_SEARCHBOX_SIZE = 20;
private final static String DEFAULT_APPLICATION_NAME = "Vitro";
private final static String DEFAULT_APPLICATION_AVAILABLE_LANGS_FILE = "available-langs";
private final static String DEFAULT_ROOT_LOGOTYPE_IMAGE = "";
private final static int DEFAULT_ROOT_LOGOTYPE_WIDTH = 0;
private final static int DEFAULT_ROOT_LOGOTYPE_HEIGHT = 0;
@ -33,6 +34,7 @@ public class ApplicationBean {
private boolean initialized = false;
private String sessionIdStr = null;
private String applicationName = DEFAULT_APPLICATION_NAME;
private String availableLangsFile = DEFAULT_APPLICATION_AVAILABLE_LANGS_FILE;
private String rootLogotypeImage = DEFAULT_ROOT_LOGOTYPE_IMAGE;
private int rootLogotypeWidth = DEFAULT_ROOT_LOGOTYPE_WIDTH;
@ -52,6 +54,7 @@ public class ApplicationBean {
output += " initialized from DB: [" + initialized + "]\n";
output += " session id: [" + sessionIdStr + "]\n";
output += " application name: [" + applicationName + "]\n";
output += " available langs file: [" + availableLangsFile + "]\n";
output += " root logotype image: [" + rootLogotypeImage + "]\n";
output += " root logotype width: [" + rootLogotypeWidth + "]\n";
output += " root logotype height: [" + rootLogotypeHeight + "]\n";
@ -177,6 +180,10 @@ public class ApplicationBean {
return "";
}
public String getAvailableLangsFile() {
return availableLangsFile;
}
/**
* Directory to find the images. Subdirectories include css, jsp and site_icons.
* Example: "themes/enhanced/"

View file

@ -87,6 +87,11 @@ public class DataProperty extends Property implements Comparable<DataProperty>,
public String getRangeDatatypeURI() {
return rangeDatatypeURI;
}
@Override
public String getRangeVClassURI() {
return rangeDatatypeURI;
}
public void setRangeDatatypeURI(String rangeDatatypeURI) {
this.rangeDatatypeURI = rangeDatatypeURI;

View file

@ -6,6 +6,8 @@ import static org.apache.jena.rdf.model.ResourceFactory.createResource;
import java.util.Objects;
import org.apache.commons.lang3.StringUtils;
import edu.cornell.mannlib.vitro.webapp.auth.policy.bean.RoleRestrictedProperty;
/**
@ -20,7 +22,9 @@ public class FauxProperty extends BaseResourceBean implements ResourceBean,
private String configUri;
// Must not be null on insert or update. Partial identifier on delete.
private String rangeURI;
private String rangeURI = "";
private String rootRangeURI;
// May be null. Partial identifier on delete.
private String domainURI;
@ -55,7 +59,7 @@ public class FauxProperty extends BaseResourceBean implements ResourceBean,
*/
public FauxProperty(String domainURI, String baseURI, String rangeURI) {
super(Objects.requireNonNull(baseURI, "baseURI may not be null"));
this.rangeURI = rangeURI;
this.setRangeURI(rangeURI);
this.domainURI = domainURI;
}
@ -93,7 +97,11 @@ public class FauxProperty extends BaseResourceBean implements ResourceBean,
}
public void setRangeURI(String rangeURI) {
this.rangeURI = rangeURI;
if (StringUtils.isEmpty(rangeURI)) {
this.rangeURI = "";
} else {
this.rangeURI = rangeURI;
}
}
public String getBaseLabel() {
@ -105,7 +113,14 @@ public class FauxProperty extends BaseResourceBean implements ResourceBean,
}
public String getRangeLabel() {
return (rangeLabel == null) ? localName(rangeURI) : rangeLabel;
if (StringUtils.isEmpty(rangeLabel)) {
if (StringUtils.isEmpty(rangeURI)) {
return "untyped";
}
return localName(rangeURI);
} else {
return rangeLabel;
}
}
public void setRangeLabel(String rangeLabel) {
@ -247,4 +262,12 @@ public class FauxProperty extends BaseResourceBean implements ResourceBean,
public String getRangeVClassURI() {
return getRangeURI();
}
public void setRootRangeUri(String rootRangeUri) {
this.rootRangeURI = rootRangeUri;
}
public String getRootRangeUri() {
return rootRangeURI;
}
}

View file

@ -4,7 +4,6 @@ package edu.cornell.mannlib.vitro.webapp.beans;
import java.beans.XMLEncoder;
import java.text.Collator;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.Iterator;

View file

@ -7,21 +7,15 @@ import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import edu.cornell.mannlib.vitro.webapp.controller.authenticate.Authenticator;
import org.apache.commons.lang3.RandomStringUtils;
/**
* Information about the account of a user. URI, email, password, etc.
*
* The "password link expires hash" is just a string that is derived from the
* value in the passwordLinkExpires field. It doesn't have to be a hash, and
* there is no need for it to be cryptographic, but it seems embarrassing to
* just send the value as a clear string. There is no real need for security
* here, except that a brute force attack would allow someone to change the
* password on an account that they know has a password change pending.
*/
public class UserAccount {
public static final int MIN_PASSWORD_LENGTH = 6;
public static final int MAX_PASSWORD_LENGTH = 12;
public static final int MAX_PASSWORD_LENGTH = 64;
public enum Status {
ACTIVE, INACTIVE;
@ -52,6 +46,7 @@ public class UserAccount {
private String md5Password = ""; // Never null.
private String oldPassword = ""; // Never null.
private long passwordLinkExpires = 0L; // Never negative.
private String emailKey = "";
private boolean passwordChangeRequired = false;
private int loginCount = 0; // Never negative.
@ -133,15 +128,27 @@ public class UserAccount {
return passwordLinkExpires;
}
public String getPasswordLinkExpiresHash() {
return limitStringLength(8, Authenticator.applyArgon2iEncoding(String
.valueOf(passwordLinkExpires)));
}
public void setPasswordLinkExpires(long passwordLinkExpires) {
this.passwordLinkExpires = Math.max(0, passwordLinkExpires);
}
public void generateEmailKey() {
boolean useLetters = true;
boolean useNumbers = true;
int length = 64;
emailKey = RandomStringUtils.random(length, useLetters, useNumbers);
}
public void setEmailKey(String emailKey) {
if (emailKey != null) {
this.emailKey = emailKey;
}
}
public String getEmailKey() {
return emailKey;
}
public boolean isPasswordChangeRequired() {
return passwordChangeRequired;
}
@ -247,6 +254,7 @@ public class UserAccount {
+ (", oldPassword=" + oldPassword)
+ (", argon2password=" + argon2Password)
+ (", passwordLinkExpires=" + passwordLinkExpires)
+ (", emailKey =" + emailKey)
+ (", passwordChangeRequired=" + passwordChangeRequired)
+ (", externalAuthOnly=" + externalAuthOnly)
+ (", loginCount=" + loginCount) + (", status=" + status)

View file

@ -109,7 +109,7 @@ public abstract class ConfigurationProperties {
throw new NullPointerException("bean may not be null.");
}
context.setAttribute(ATTRIBUTE_NAME, bean);
log.info(bean);
log.debug(bean);
}
/** Package access, so unit tests can call it. */

View file

@ -73,7 +73,7 @@ public class ConfigurationPropertiesSetup implements ServletContextListener {
vitroHomeDir, vitroHomeDirConfig);
File runtimePropertiesFile = locateRuntimePropertiesFile(
vitroHomeDir, vitroHomeDirConfig, ss);
vitroHomeDir, vitroHomeDirConfig, ss);
stream = new FileInputStream(runtimePropertiesFile);
Map<String, String> preempts = createPreemptiveProperties(
@ -118,7 +118,6 @@ public class ConfigurationPropertiesSetup implements ServletContextListener {
}
}
private File locateRuntimePropertiesFile(File vitroHomeDir,
File vitroHomeDirConfig, StartupStatus ss) {

View file

@ -160,7 +160,7 @@ public class ConfigurationPropertiesSmokeTests implements
String vivoBundle = VIVO_BUNDLE_PREFIX + language + ".properties";
String vitroBundle = VITRO_BUNDLE_PREFIX + language + ".properties";
if (!i18nNames.contains(vivoBundle) && !i18nNames.contains(vitroBundle)) {
ss.warning(this, language + " was found in the value for "
ss.info(this, language + " was found in the value for "
+ PROPERTY_LANGUAGE_SELECTABLE + " but no corresponding "
+ "language file was found.");
}

View file

@ -2,6 +2,7 @@
package edu.cornell.mannlib.vitro.webapp.config;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.ArrayList;
import java.util.Collection;
@ -14,8 +15,6 @@ import javax.servlet.http.HttpSession;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.ibm.icu.text.SimpleDateFormat;
/**
* Information about the provenance of this application: release, revision
* level, build date, etc.
@ -41,7 +40,7 @@ public class RevisionInfoBean {
new Date(0), Collections.singleton(LevelRevisionInfo.DUMMY_LEVEL));
/** The bean is attached to the session by this name. */
static final String ATTRIBUTE_NAME = RevisionInfoBean.class.getName();
public static final String ATTRIBUTE_NAME = RevisionInfoBean.class.getName();
// ----------------------------------------------------------------------
// static methods

View file

@ -21,7 +21,6 @@ public class Controllers {
public static final String ABOUT = "/about";
public static final String CONTACT_URL = "/comments";
public static final String TERMS_OF_USE_URL = "/termsOfUse";
public static final String SEARCH_URL = "/search";
public static final String ENTITY = "/entity";

View file

@ -249,6 +249,7 @@ public class UserAccountsSelector {
user.setMd5Password(ifLiteralPresent(solution, "md5pwd", ""));
user.setArgon2Password(ifLiteralPresent(solution, "a2pwd", ""));
user.setPasswordLinkExpires(ifLongPresent(solution, "expire", 0L));
user.setEmailKey(ifLiteralPresent(solution, "emailKey", ""));
user.setLoginCount(ifIntPresent(solution, "count", 0));
user.setLastLoginTime(ifLongPresent(solution, "lastLogin", 0));
user.setStatus(parseStatus(solution, "status", null));

View file

@ -156,6 +156,7 @@ public class UserAccountsAddPage extends UserAccountsPage {
u.setOldPassword("");
u.setPasswordChangeRequired(false);
u.setPasswordLinkExpires(0);
u.setEmailKey("");
u.setLoginCount(0);
u.setLastLoginTime(0L);
u.setStatus(Status.INACTIVE);

View file

@ -57,8 +57,6 @@ public abstract class UserAccountsAddPageStrategy extends UserAccountsPage {
private static class EmailStrategy extends UserAccountsAddPageStrategy {
public static final String CREATE_PASSWORD_URL = "/accounts/createPassword";
private static final String EMAIL_TEMPLATE_WITH_PASSWORD = "userAccounts-acctCreatedEmail.ftl";
private static final String EMAIL_TEMPLATE_NO_PASSWORD = "userAccounts-acctCreatedExternalOnlyEmail.ftl";
private boolean sentEmail;
@ -84,6 +82,7 @@ public abstract class UserAccountsAddPageStrategy extends UserAccountsPage {
u.setStatus(Status.ACTIVE);
} else {
u.setPasswordLinkExpires(figureExpirationDate().getTime());
u.generateEmailKey();
u.setStatus(Status.INACTIVE);
}
}
@ -99,15 +98,19 @@ public abstract class UserAccountsAddPageStrategy extends UserAccountsPage {
body.put("userAccount", page.getAddedAccount());
body.put("passwordLink", buildCreatePasswordLink());
body.put("siteName", getSiteName());
FreemarkerEmailMessage email = FreemarkerEmailFactory
.createNewMessage(vreq);
email.addRecipient(TO, page.getAddedAccount().getEmailAddress());
email.setSubject(i18n.text("account_created_subject", getSiteName()));
String subject = i18n.text("account_created_subject", getSiteName());
email.setSubject(subject);
if (page.isExternalAuthOnly()) {
email.setTemplate(EMAIL_TEMPLATE_NO_PASSWORD);
body.put("subject", subject);
body.put("textMessage", i18n.text("acct_created_external_only_email_plain_text"));
body.put("htmlMessage", i18n.text("acct_created_external_only_email_html_text"));
} else {
email.setTemplate(EMAIL_TEMPLATE_WITH_PASSWORD);
body.put("subject", subject);
body.put("textMessage", i18n.text("acct_created_email_plain_text"));
body.put("htmlMessage", i18n.text("acct_created_email_html_text"));
}
email.setBodyMap(body);
email.processTemplate();
@ -119,10 +122,8 @@ public abstract class UserAccountsAddPageStrategy extends UserAccountsPage {
private String buildCreatePasswordLink() {
try {
String email = page.getAddedAccount().getEmailAddress();
String hash = page.getAddedAccount()
.getPasswordLinkExpiresHash();
String relativeUrl = UrlBuilder.getUrl(CREATE_PASSWORD_URL,
"user", email, "key", hash);
String key = page.getAddedAccount().getEmailKey();
String relativeUrl = UrlBuilder.getUrl(CREATE_PASSWORD_URL, "user", email, "key", key);
URL context = new URL(vreq.getRequestURL().toString());
URL url = new URL(context, relativeUrl);

View file

@ -274,6 +274,7 @@ public class UserAccountsEditPage extends UserAccountsPage {
userAccount.setOldPassword("");
userAccount.setPasswordChangeRequired(false);
userAccount.setPasswordLinkExpires(0L);
userAccount.setEmailKey("");
}
if (isRootUser()) {

View file

@ -56,8 +56,6 @@ public abstract class UserAccountsEditPageStrategy extends UserAccountsPage {
private static class EmailStrategy extends UserAccountsEditPageStrategy {
private static final String PARAMETER_RESET_PASSWORD = "resetPassword";
private static final String EMAIL_TEMPLATE = "userAccounts-passwordResetPendingEmail.ftl";
public static final String RESET_PASSWORD_URL = "/accounts/resetPassword";
private boolean resetPassword;
@ -82,6 +80,7 @@ public abstract class UserAccountsEditPageStrategy extends UserAccountsPage {
protected void setAdditionalProperties(UserAccount u) {
if (resetPassword && !page.isExternalAuthOnly()) {
u.setPasswordLinkExpires(figureExpirationDate().getTime());
u.generateEmailKey();
}
}
@ -106,11 +105,13 @@ public abstract class UserAccountsEditPageStrategy extends UserAccountsPage {
body.put("userAccount", page.getUpdatedAccount());
body.put("passwordLink", buildResetPasswordLink());
body.put("siteName", getSiteName());
body.put("subject", i18n.text("password_reset_pending_email_subject"));
body.put("textMessage",i18n.text("password_reset_pending_email_plain_text"));
body.put("htmlMessage", i18n.text("password_reset_pending_email_html_text"));
FreemarkerEmailMessage email = FreemarkerEmailFactory
.createNewMessage(vreq);
email.addRecipient(TO, page.getUpdatedAccount().getEmailAddress());
email.setTemplate(EMAIL_TEMPLATE);
email.setBodyMap(body);
email.processTemplate();
email.send();
@ -121,10 +122,8 @@ public abstract class UserAccountsEditPageStrategy extends UserAccountsPage {
private String buildResetPasswordLink() {
try {
String email = page.getUpdatedAccount().getEmailAddress();
String hash = page.getUpdatedAccount()
.getPasswordLinkExpiresHash();
String relativeUrl = UrlBuilder.getUrl(RESET_PASSWORD_URL,
"user", email, "key", hash);
String key = page.getUpdatedAccount().getEmailKey();
String relativeUrl = UrlBuilder.getUrl(RESET_PASSWORD_URL, "user", email, "key", key);
URL context = new URL(vreq.getRequestURL().toString());
URL url = new URL(context, relativeUrl);

View file

@ -26,8 +26,6 @@ public class UserAccountsCreatePasswordPage extends
.getLog(UserAccountsCreatePasswordPage.class);
private static final String TEMPLATE_NAME = "userAccounts-createPassword.ftl";
private static final String EMAIL_TEMPLATE = "userAccounts-passwordCreatedEmail.ftl";
public UserAccountsCreatePasswordPage(VitroRequest vreq) {
super(vreq);
}
@ -36,6 +34,7 @@ public class UserAccountsCreatePasswordPage extends
userAccount.setArgon2Password(Authenticator.applyArgon2iEncoding(newPassword));
userAccount.setMd5Password("");
userAccount.setPasswordLinkExpires(0L);
userAccount.setEmailKey("");
userAccount.setPasswordChangeRequired(false);
userAccount.setStatus(Status.ACTIVE);
userAccountsDao.updateUserAccount(userAccount);
@ -53,6 +52,11 @@ public class UserAccountsCreatePasswordPage extends
protected String passwordChangeNotPendingMessage() {
return i18n.text("account_already_activated", userEmail);
}
@Override
protected String passwordChangeInavlidKeyMessage() {
return i18n.text("password_change_invalid_key", userEmail);
}
@Override
protected String templateName() {
@ -67,8 +71,11 @@ public class UserAccountsCreatePasswordPage extends
FreemarkerEmailMessage email = FreemarkerEmailFactory
.createNewMessage(vreq);
email.addRecipient(TO, userAccount.getEmailAddress());
email.setSubject(i18n.text("password_created_subject", getSiteName()));
email.setTemplate(EMAIL_TEMPLATE);
final String subject = i18n.text("password_created_subject", getSiteName());
email.setSubject(subject);
body.put("subject", subject);
body.put("textMessage", i18n.text("password_created_email_plain_text"));
body.put("htmlMessage", i18n.text("password_created_email_html_text"));
email.setBodyMap(body);
email.processTemplate();
email.send();

View file

@ -195,6 +195,7 @@ public class UserAccountsFirstTimeExternalPage extends UserAccountsPage {
u.setExternalAuthId(externalAuthId);
u.setPasswordChangeRequired(false);
u.setPasswordLinkExpires(0);
u.setEmailKey("");
u.setExternalAuthOnly(true);
u.setLoginCount(0);
u.setStatus(Status.ACTIVE);

View file

@ -52,8 +52,6 @@ public abstract class UserAccountsFirstTimeExternalPageStrategy extends
public static class EmailStrategy extends
UserAccountsFirstTimeExternalPageStrategy {
private static final String EMAIL_TEMPLATE = "userAccounts-firstTimeExternalEmail.ftl";
public EmailStrategy(VitroRequest vreq,
UserAccountsFirstTimeExternalPage page) {
super(vreq, page);
@ -73,8 +71,11 @@ public abstract class UserAccountsFirstTimeExternalPageStrategy extends
FreemarkerEmailMessage email = FreemarkerEmailFactory
.createNewMessage(vreq);
email.addRecipient(TO, ua.getEmailAddress());
email.setSubject(i18n.text("account_created_subject", getSiteName()));
email.setTemplate(EMAIL_TEMPLATE);
final String subject = i18n.text("account_created_subject", getSiteName());
email.setSubject(subject);
body.put("subject", subject);
body.put("textMessage", i18n.text("first_time_external_email_plain_text"));
body.put("htmlMessage", i18n.text("first_time_external_email_html_text"));
email.setBodyMap(body);
email.processTemplate();
email.send();

View file

@ -108,8 +108,6 @@ public abstract class UserAccountsMyAccountPageStrategy extends
private static final String ERROR_WRONG_PASSWORD_LENGTH = "errorPasswordIsWrongLength";
private static final String ERROR_PASSWORDS_DONT_MATCH = "errorPasswordsDontMatch";
private static final String EMAIL_TEMPLATE = "userAccounts-confirmEmailChangedEmail.ftl";
private final String originalEmail;
private String newPassword;
@ -159,6 +157,7 @@ public abstract class UserAccountsMyAccountPageStrategy extends
userAccount.setMd5Password("");
userAccount.setPasswordChangeRequired(false);
userAccount.setPasswordLinkExpires(0L);
userAccount.setEmailKey("");
}
}
@ -178,8 +177,11 @@ public abstract class UserAccountsMyAccountPageStrategy extends
FreemarkerEmailMessage email = FreemarkerEmailFactory
.createNewMessage(vreq);
email.addRecipient(TO, page.getUserAccount().getEmailAddress());
email.setSubject(i18n.text("email_changed_subject", getSiteName()));
email.setTemplate(EMAIL_TEMPLATE);
final String subject = i18n.text("email_changed_subject", getSiteName());
email.setSubject(subject);
body.put("subject", subject);
body.put("textMessage", i18n.text("confirm_email_changed_email_plain_text"));
body.put("htmlMessage", i18n.text("confirm_email_changed_email_html_text"));
email.setBodyMap(body);
email.processTemplate();
email.send();

View file

@ -103,12 +103,12 @@ public abstract class UserAccountsPasswordBasePage extends UserAccountsPage {
return;
}
String expectedKey = userAccount.getPasswordLinkExpiresHash();
if (!key.equals(expectedKey)) {
String expectedKey = userAccount.getEmailKey();
if (key.isEmpty() || !key.equals(expectedKey)) {
log.warn("Password request for '" + userEmail + "' is bogus: key ("
+ key + ") doesn't match expected key (" + expectedKey
+ ")");
bogusMessage = passwordChangeNotPendingMessage();
bogusMessage = passwordChangeInavlidKeyMessage();
return;
}
@ -153,7 +153,7 @@ public abstract class UserAccountsPasswordBasePage extends UserAccountsPage {
body.put("minimumLength", UserAccount.MIN_PASSWORD_LENGTH);
body.put("maximumLength", UserAccount.MAX_PASSWORD_LENGTH);
body.put("userAccount", userAccount);
body.put("key", userAccount.getPasswordLinkExpiresHash());
body.put("key", userAccount.getEmailKey());
body.put("newPassword", newPassword);
body.put("confirmPassword", confirmPassword);
body.put("formUrls", buildUrlsMap());
@ -176,6 +176,8 @@ public abstract class UserAccountsPasswordBasePage extends UserAccountsPage {
protected abstract String alreadyLoggedInMessage(String currentUserEmail);
protected abstract String passwordChangeNotPendingMessage();
protected abstract String passwordChangeInavlidKeyMessage();
protected abstract String templateName();
}

View file

@ -26,8 +26,6 @@ public class UserAccountsResetPasswordPage extends UserAccountsPasswordBasePage
private static final String TEMPLATE_NAME = "userAccounts-resetPassword.ftl";
private static final String EMAIL_TEMPLATE = "userAccounts-passwordResetCompleteEmail.ftl";
protected UserAccountsResetPasswordPage(VitroRequest vreq) {
super(vreq);
}
@ -55,6 +53,11 @@ public class UserAccountsResetPasswordPage extends UserAccountsPasswordBasePage
protected String passwordChangeNotPendingMessage() {
return i18n.text("password_change_not_pending", userEmail);
}
@Override
protected String passwordChangeInavlidKeyMessage() {
return i18n.text("password_change_invalid_key", userEmail);
}
@Override
protected String templateName() {
@ -63,14 +66,16 @@ public class UserAccountsResetPasswordPage extends UserAccountsPasswordBasePage
private void notifyUser() {
Map<String, Object> body = new HashMap<String, Object>();
FreemarkerEmailMessage email = FreemarkerEmailFactory.createNewMessage(vreq);
final String subject = i18n.text("password_changed_subject");
email.setSubject(subject);
body.put("userAccount", userAccount);
body.put("siteName", getSiteName());
FreemarkerEmailMessage email = FreemarkerEmailFactory
.createNewMessage(vreq);
body.put("subject", subject);
body.put("textMessage", i18n.text("password_reset_complete_email_plain_text"));
body.put("htmlMessage", i18n.text("password_reset_complete_email_html_text"));
email.addRecipient(TO, userAccount.getEmailAddress());
email.setSubject(i18n.text("password_changed_subject"));
email.setTemplate(EMAIL_TEMPLATE);
email.setBodyMap(body);
email.processTemplate();
email.send();

View file

@ -2,6 +2,7 @@
package edu.cornell.mannlib.vitro.webapp.controller.admin;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
@ -9,8 +10,6 @@ import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;
import com.ibm.icu.text.SimpleDateFormat;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerHttpServlet;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;

View file

@ -17,6 +17,8 @@ import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import edu.cornell.mannlib.vitro.webapp.i18n.I18n;
import edu.cornell.mannlib.vitro.webapp.i18n.I18nBundle;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@ -75,8 +77,8 @@ public class SparqlQueryController extends FreemarkerHttpServlet {
private static final String[] SAMPLE_QUERY = { //
"", //
"#", //
"# This example query gets 20 geographic locations", //
"# and (if available) their labels", //
"i18n:sparql_query_description_0", //
"i18n:sparql_query_description_1", //
"#", //
"SELECT ?geoLocation ?label", //
"WHERE", //
@ -193,9 +195,11 @@ public class SparqlQueryController extends FreemarkerHttpServlet {
@Override
protected ResponseValues processRequest(VitroRequest vreq) throws Exception {
I18nBundle i18n = I18n.bundle(vreq);
Map<String, Object> bodyMap = new HashMap<>();
bodyMap.put("sampleQuery", buildSampleQuery(buildPrefixList(vreq)));
bodyMap.put("title", "SPARQL Query");
bodyMap.put("sampleQuery", buildSampleQuery(i18n, buildPrefixList(vreq)));
bodyMap.put("title", i18n.text("sparql_query_title"));
bodyMap.put("submitUrl", UrlBuilder.getUrl("admin/sparqlquery"));
return new TemplateResponseValues(TEMPLATE_NAME, bodyMap);
}
@ -222,7 +226,7 @@ public class SparqlQueryController extends FreemarkerHttpServlet {
return prefixList;
}
private String buildSampleQuery(List<Prefix> prefixList) {
private String buildSampleQuery(I18nBundle i18n, List<Prefix> prefixList) {
StringWriter sw = new StringWriter();
PrintWriter writer = new PrintWriter(sw);
@ -230,6 +234,10 @@ public class SparqlQueryController extends FreemarkerHttpServlet {
writer.println(p);
}
for (String line : SAMPLE_QUERY) {
if (line.startsWith("i18n:")) {
// Get i18n translation
line = i18n.text(line.substring("i18n:".length()));
}
writer.println(line);
}

View file

@ -8,6 +8,7 @@ import static javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
import static javax.servlet.http.HttpServletResponse.SC_OK;
import java.io.IOException;
import java.io.InputStream;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
@ -18,6 +19,8 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import static org.apache.jena.riot.web.HttpNames.paramUsingGraphURI;
import static org.apache.jena.riot.web.HttpNames.paramUsingNamedGraphURI;
import org.apache.jena.query.Dataset;
import org.apache.jena.query.ReadWrite;
import org.apache.jena.update.GraphStore;
@ -25,6 +28,9 @@ import org.apache.jena.update.GraphStoreFactory;
import org.apache.jena.update.UpdateAction;
import org.apache.jena.update.UpdateFactory;
import org.apache.jena.update.UpdateRequest;
import org.apache.jena.graph.Node;
import org.apache.jena.graph.NodeFactory;
import org.apache.jena.sparql.modify.UsingList;
import edu.cornell.mannlib.vitro.webapp.application.ApplicationUtils;
import edu.cornell.mannlib.vitro.webapp.auth.permissions.SimplePermission;
@ -76,26 +82,47 @@ public class SparqlUpdateApiController extends VitroApiServlet {
private UpdateRequest parseUpdateString(HttpServletRequest req)
throws ParseException {
String update = req.getParameter("update");
if (StringUtils.isBlank(update)) {
log.debug("No update parameter.");
throw new ParseException("No 'update' parameter.");
}
InputStream update;
String reqtype = req.getContentType();
UsingList usingList = processProtocol(req);
if (!StringUtils.containsIgnoreCase(update, "GRAPH") && !StringUtils.containsIgnoreCase(update, "WITH")) {
if (log.isDebugEnabled()) {
log.debug("No GRAPH or WITH uri in '" + update + "'");
// Support update via both POST body and an 'update' parameter
if (reqtype.equalsIgnoreCase("application/sparql-update")) {
try {
update = req.getInputStream();
} catch (IOException e) {
log.debug("Error parsing POST body.");
throw new ParseException("Error parsing POST body.");
}
}
else {
String updateString = req.getParameter("update");
if (StringUtils.isBlank(updateString)) {
log.debug("No update parameter.");
throw new ParseException("No 'update' parameter.");
}
if (!StringUtils.containsIgnoreCase(updateString, "GRAPH") && !StringUtils.containsIgnoreCase(updateString, "WITH")) {
if (log.isDebugEnabled()) {
log.debug("No GRAPH or WITH uri in '" + updateString + "'");
}
throw new ParseException("SPARQL update must specify a GRAPH ( or WITH) URI.");
}
try {
update = org.apache.commons.io.IOUtils.toInputStream(updateString, "UTF-8");
} catch (IOException e) {
log.debug("Error parsing POST body.");
throw new ParseException("Error parsing POST body.");
}
throw new ParseException("SPARQL update must specify a GRAPH ( or WITH) URI.");
}
try {
return UpdateFactory.create(update);
return UpdateFactory.read(usingList, update);
} catch (Exception e) {
log.debug("Problem parsing", e);
throw new ParseException("Failed to parse SPARQL update", e);
}
}
private void executeUpdate(HttpServletRequest req, UpdateRequest parsed) {
VitroRequest vreq = new VitroRequest(req);
@ -121,6 +148,35 @@ public class SparqlUpdateApiController extends VitroApiServlet {
}
}
/*
* The method below and the 'createNode' helper were
* adapted from the Fuseki source code
*/
private UsingList processProtocol(HttpServletRequest request) {
UsingList toReturn = new UsingList();
String[] usingArgs = request.getParameterValues(paramUsingGraphURI);
String[] usingNamedArgs = request.getParameterValues(paramUsingNamedGraphURI);
if ( usingArgs == null && usingNamedArgs == null )
return toReturn;
if ( usingArgs == null )
usingArgs = new String[0];
if ( usingNamedArgs == null )
usingNamedArgs = new String[0];
// Impossible.
// if ( usingArgs.length == 0 && usingNamedArgs.length == 0 )
// return;
for ( String nodeUri : usingArgs ) {
toReturn.addUsing(createNode(nodeUri));
}
for ( String nodeUri : usingNamedArgs ) {
toReturn.addUsingNamed(createNode(nodeUri));
}
return toReturn;
}
private void do200response(HttpServletResponse resp) throws IOException {
sendShortResponse(SC_OK, "SPARQL update accepted.", resp);
}
@ -158,4 +214,14 @@ public class SparqlUpdateApiController extends VitroApiServlet {
}
}
private static Node createNode(String x) {
try {
return NodeFactory.createURI(x);
} catch (Exception ex) {
log.debug("SPARQL Update: bad IRI: "+x);
return null;
}
}
}

View file

@ -134,6 +134,7 @@ public class BasicAuthenticator extends Authenticator {
userAccount.setMd5Password("");
userAccount.setPasswordChangeRequired(false);
userAccount.setPasswordLinkExpires(0L);
userAccount.setEmailKey("");
getUserAccountsDao().updateUserAccount(userAccount);
}

View file

@ -108,7 +108,9 @@ public class LoginRedirector {
throws IOException {
try {
DisplayMessage.setMessage(request, assembleWelcomeMessage());
response.sendRedirect(getRedirectionUriForLoggedInUser());
String redirectUrl = getRedirectionUriForLoggedInUser();
log.debug("Sending redirect to path: " + redirectUrl);
response.sendRedirect(redirectUrl);
} catch (IOException e) {
log.debug("Problem with re-direction", e);
response.sendRedirect(getApplicationHomePageUrl());
@ -175,21 +177,13 @@ public class LoginRedirector {
}
}
/**
* The application home page can be overridden by an attribute in the
* ServletContext. Further, it can either be an absolute URL, or it can be
* relative to the application. Weird.
*/
private String getApplicationHomePageUrl() {
String contextRedirect = (String) session.getServletContext()
.getAttribute("postLoginRequest");
if (contextRedirect != null) {
if (contextRedirect.indexOf(":") == -1) {
return request.getContextPath() + contextRedirect;
} else {
return contextRedirect;
}
String contextPath = request.getContextPath();
if (contextPath.equals("")) {
return "/";
}
else {
return contextPath;
}
return request.getContextPath();
}
}

View file

@ -43,7 +43,7 @@ public class Classes2ClassesRetryController extends BaseEditController {
action = epo.getAction();
}
VClassDao vcDao = ModelAccess.on(getServletContext()).getWebappDaoFactory().getVClassDao();
VClassDao vcDao = ModelAccess.on(request).getWebappDaoFactory().getVClassDao();
epo.setDataAccessObject(vcDao);
Classes2Classes objectForEditing = new Classes2Classes();

View file

@ -51,8 +51,7 @@ public class ClassgroupRetryController extends BaseEditController {
action = epo.getAction();
}
VClassGroupDao cgDao = ModelAccess.on(
getServletContext()).getWebappDaoFactory().getVClassGroupDao();
VClassGroupDao cgDao = ModelAccess.on(request).getWebappDaoFactory().getVClassGroupDao();
epo.setDataAccessObject(cgDao);

View file

@ -22,6 +22,7 @@ import edu.cornell.mannlib.vedit.controller.BaseEditController;
import edu.cornell.mannlib.vitro.webapp.auth.permissions.SimplePermission;
import edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean;
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
import edu.cornell.mannlib.vitro.webapp.beans.FauxProperty;
import edu.cornell.mannlib.vitro.webapp.beans.Ontology;
import edu.cornell.mannlib.vitro.webapp.beans.PropertyGroup;
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
@ -176,6 +177,11 @@ public class DatapropEditController extends BaseEditController {
assertionsDpDao.getEquivalentPropertyURIs(dp.getURI()), assertionsDpDao);
sortForPickList(eqProps, vreq);
request.setAttribute("equivalentProperties", eqProps);
List<FauxProperty> fauxProps = vreq.getUnfilteredAssertionsWebappDaoFactory().getFauxPropertyDao().
getFauxPropertiesForBaseUri(dp.getURI());
sortForPickList(fauxProps, vreq);
request.setAttribute("fauxproperties", fauxProps);
ApplicationBean appBean = vreq.getAppBean();

View file

@ -50,11 +50,12 @@ public class DatapropRetryController extends BaseEditController {
//create an EditProcessObject for this and put it in the session
EditProcessObject epo = super.createEpo(request);
epo.setImplementationClass(DataProperty.class);
epo.setBeanClass(DataProperty.class);
VitroRequest vreq = new VitroRequest(request);
WebappDaoFactory wadf = ModelAccess.on(getServletContext()).getWebappDaoFactory();
WebappDaoFactory wadf = ModelAccess.on(vreq).getWebappDaoFactory();
DatatypeDao dDao = wadf.getDatatypeDao();
DataPropertyDao dpDao = wadf.getDataPropertyDao();

View file

@ -20,9 +20,12 @@ import javax.servlet.http.HttpServletResponse;
import edu.cornell.mannlib.vitro.webapp.utils.JSPPageHandler;
import org.apache.commons.collections4.map.ListOrderedMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.ctc.wstx.util.StringUtil;
import edu.cornell.mannlib.vedit.beans.DynamicField;
import edu.cornell.mannlib.vedit.beans.DynamicFieldRow;
import edu.cornell.mannlib.vedit.beans.EditProcessObject;
@ -250,7 +253,12 @@ public class EntityRetryController extends BaseEditController {
//TODO: UGH
//row.setId(existingValue.getId());
row.setParameterMap(parameterMap);
row.setValue(existingValue.getData());
String value = existingValue.getData();
row.setValue(value);
String language = existingValue.getLanguage();
if (!StringUtils.isBlank(language)) {
row.setLanguage(language);
}
if (dynamo.getRowList() == null)
dynamo.setRowList(new ArrayList());
dynamo.getRowList().add(row);

View file

@ -32,12 +32,14 @@ import edu.cornell.mannlib.vedit.validator.Validator;
import edu.cornell.mannlib.vedit.validator.impl.RequiredFieldValidator;
import edu.cornell.mannlib.vitro.webapp.auth.permissions.SimplePermission;
import edu.cornell.mannlib.vitro.webapp.auth.policy.bean.PropertyRestrictionListener;
import edu.cornell.mannlib.vitro.webapp.beans.Datatype;
import edu.cornell.mannlib.vitro.webapp.beans.FauxProperty;
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
import edu.cornell.mannlib.vitro.webapp.beans.Property;
import edu.cornell.mannlib.vitro.webapp.beans.PropertyGroup;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.controller.edit.utils.RoleLevelOptionsSetup;
import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyDao;
import edu.cornell.mannlib.vitro.webapp.dao.FauxPropertyDao;
import edu.cornell.mannlib.vitro.webapp.dao.ObjectPropertyDao;
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
@ -88,6 +90,8 @@ public class FauxPropertyRetryController extends BaseEditController {
}
private static class EpoPopulator {
private static final String LITERAL = "http://www.w3.org/2000/01/rdf-schema#Literal";
private static final String XML_LITERAL = "http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral";
private final VitroRequest req;
private final ServletContext ctx;
private final WebappDaoFactory wadf;
@ -98,6 +102,8 @@ public class FauxPropertyRetryController extends BaseEditController {
private FauxProperty beanForEditing;
private Property baseProperty;
private boolean isFauxDataProperty = false;
EpoPopulator(HttpServletRequest req, EditProcessObject epo) {
this.req = new VitroRequest(req);
@ -106,7 +112,7 @@ public class FauxPropertyRetryController extends BaseEditController {
this.epo = epo;
this.fpDao = ModelAccess.on(ctx).getWebappDaoFactory()
this.fpDao = ModelAccess.on(req).getWebappDaoFactory()
.getFauxPropertyDao();
}
@ -114,6 +120,8 @@ public class FauxPropertyRetryController extends BaseEditController {
void populate() {
epo.setDataAccessObject(fpDao);
epo.setAction(determineAction());
epo.setImplementationClass(FauxProperty.class);
epo.setBeanClass(FauxProperty.class);
if (epo.getUseRecycledBean()) {
beanForEditing = (FauxProperty) epo.getNewBean();
@ -125,10 +133,19 @@ public class FauxPropertyRetryController extends BaseEditController {
this.baseProperty = req.getUnfilteredWebappDaoFactory()
.getObjectPropertyDao()
.getObjectPropertyByURI(beanForEditing.getURI());
if (this.baseProperty == null) {
this.baseProperty = req.getUnfilteredWebappDaoFactory()
.getDataPropertyDao()
.getDataPropertyByURI(beanForEditing.getURI());
isFauxDataProperty = true;
}
addCheckboxValuesToTheRequest();
setFieldValidators();
if (!isFauxDataProperty) {
setFieldValidators();
}
setListeners();
setForwarders();
@ -148,8 +165,7 @@ public class FauxPropertyRetryController extends BaseEditController {
return newFauxProperty(baseUri);
}
FauxProperty bean = fpDao.getFauxPropertyByUris(domainUri, baseUri,
rangeUri);
FauxProperty bean = fpDao.getFauxPropertyByUris(domainUri, baseUri, rangeUri);
if (bean == null) {
throw new IllegalArgumentException(
"FauxProperty does not exist for <" + domainUri
@ -166,7 +182,16 @@ public class FauxPropertyRetryController extends BaseEditController {
private FauxProperty newFauxProperty(String baseUri) {
FauxProperty fp = new FauxProperty(null, baseUri, null);
ObjectPropertyDao opDao = wadf.getObjectPropertyDao();
ObjectProperty base = opDao.getObjectPropertyByURI(baseUri);
DataPropertyDao dpDao = wadf.getDataPropertyDao();
ObjectProperty objBase = opDao.getObjectPropertyByURI(baseUri);
Property base;
if (objBase != null) {
fp.setSelectFromExisting(objBase.getSelectFromExisting());
fp.setOfferCreateNewOption(objBase.getOfferCreateNewOption());
base = objBase;
} else {
base = dpDao.getDataPropertyByURI(baseUri);
}
fp.setGroupURI(base.getGroupURI());
fp.setRangeURI(base.getRangeVClassURI());
fp.setDomainURI(base.getDomainVClassURI());
@ -268,7 +293,7 @@ public class FauxPropertyRetryController extends BaseEditController {
list.addAll(FormUtils.makeVClassOptionList(wadf,
beanForEditing.getDomainURI()));
} else {
list.addAll(FormUtils.makeOptionListOfSubVClasses(wadf,
list.addAll(FormUtils.makeOptionListOfNotDisjointClasses(wadf,
baseProperty.getDomainVClassURI(),
beanForEditing.getDomainURI()));
}
@ -277,12 +302,20 @@ public class FauxPropertyRetryController extends BaseEditController {
}
private List<Option> buildRangeOptionList() {
if (isFauxDataProperty) {
return buildDataPropOptionList();
} else {
return buildObjectPropOptionList();
}
}
private List<Option> buildObjectPropOptionList() {
List<Option> list = new ArrayList<>();
if (baseProperty.getRangeVClassURI() == null) {
list.addAll(FormUtils.makeVClassOptionList(wadf,
beanForEditing.getRangeURI()));
} else {
list.addAll(FormUtils.makeOptionListOfSubVClasses(wadf,
list.addAll(FormUtils.makeOptionListOfNotDisjointClasses(wadf,
baseProperty.getRangeVClassURI(),
beanForEditing.getRangeURI()));
if (containsVCardKind(list)) {
@ -293,6 +326,43 @@ public class FauxPropertyRetryController extends BaseEditController {
return list;
}
private List<Option> buildDataPropOptionList() {
List<Option> list = new ArrayList<>();
String rangeUri = baseProperty.getRangeVClassURI();
if (rangeUri == null) {
Option option = new Option();
option.setValue("");
option.setBody("Untyped");
option.setSelected(true);
list.add(option);
} else if (rangeUri.equals(LITERAL)) {
Option option = new Option();
option.setValue(rangeUri);
option.setBody("Literal");
option.setSelected(true);
list.add(option);
} else if (rangeUri.equals(XML_LITERAL)) {
Option option = new Option();
option.setValue(rangeUri);
option.setBody("XML Literal");
option.setSelected(true);
list.add(option);
} else {
Datatype dataType = wadf.getDatatypeDao().getDatatypeByURI(rangeUri);
Option option = new Option();
if (dataType != null) {
option.setValue(dataType.getUri());
option.setBody(dataType.getName());
} else {
option.setValue(rangeUri);
option.setBody(rangeUri);
}
option.setSelected(true);
list.add(option);
}
return list;
}
private static final String VCARD_KIND_URI = "http://www.w3.org/2006/vcard/ns#Kind";
private static final String VCARD_NAMESPACE = "http://www.w3.org/2006/vcard/ns#";

View file

@ -71,7 +71,7 @@ public class NamespacePrefixOperationController extends BaseEditController {
if (request.getParameter("_cancel") == null) {
OntModel ontModel = ModelAccess.on(getServletContext()).getOntModel();
OntModel ontModel = ModelAccess.on(req).getOntModel();
String namespaceStr = request.getParameter("namespace");
String prefixStr = request.getParameter("prefix");

View file

@ -51,7 +51,7 @@ public class PropertyGroupRetryController extends BaseEditController {
}
PropertyGroupDao pgDao = ModelAccess.on(
getServletContext()).getWebappDaoFactory().getPropertyGroupDao();
req).getWebappDaoFactory().getPropertyGroupDao();
epo.setDataAccessObject(pgDao);

View file

@ -53,6 +53,7 @@ public class PropertyRetryController extends BaseEditController {
/*for testing*/
ObjectProperty testMask = new ObjectProperty();
epo.setImplementationClass(ObjectProperty.class);
epo.setBeanClass(ObjectProperty.class);
epo.setBeanMask(testMask);
@ -64,7 +65,7 @@ public class PropertyRetryController extends BaseEditController {
action = epo.getAction();
}
ObjectPropertyDao propDao = ModelAccess.on(getServletContext()).getWebappDaoFactory().getObjectPropertyDao();
ObjectPropertyDao propDao = ModelAccess.on(req).getWebappDaoFactory().getObjectPropertyDao();
epo.setDataAccessObject(propDao);
OntologyDao ontDao = request.getUnfilteredWebappDaoFactory().getOntologyDao();

View file

@ -48,7 +48,7 @@ public class RestrictionOperationController extends BaseEditController {
String defaultLandingPage = getDefaultLandingPage(request);
try {
OntModel ontModel = ModelAccess.on(getServletContext())
OntModel ontModel = ModelAccess.on(req)
.getOntModel(TBOX_ASSERTIONS);
HashMap epoHash = null;

View file

@ -48,7 +48,7 @@ public class VclassEditController extends BaseEditController {
EditProcessObject epo = super.createEpo(request, FORCE_NEW);
request.setAttribute("epoKey", epo.getKey());
VClassDao vcwDao = ModelAccess.on(getServletContext()).getWebappDaoFactory(ASSERTIONS_ONLY).getVClassDao();
VClassDao vcwDao = ModelAccess.on(req).getWebappDaoFactory(ASSERTIONS_ONLY).getVClassDao();
VClass vcl = (VClass)vcwDao.getVClassByURI(request.getParameter("uri"));
if (vcl == null) {
@ -152,8 +152,8 @@ public class VclassEditController extends BaseEditController {
request.setAttribute("formSelect",formSelect);
// if supported, we want to show only the asserted superclasses and subclasses.
VClassDao vcDao = ModelAccess.on(getServletContext()).getWebappDaoFactory(ASSERTIONS_ONLY).getVClassDao();
VClassDao displayVcDao = ModelAccess.on(getServletContext()).getWebappDaoFactory().getVClassDao();
VClassDao vcDao = ModelAccess.on(req).getWebappDaoFactory(ASSERTIONS_ONLY).getVClassDao();
VClassDao displayVcDao = ModelAccess.on(req).getWebappDaoFactory().getVClassDao();
List<VClass> superVClasses = getVClassesForURIList(
vcDao.getSuperClassURIs(vcl.getURI(),false), displayVcDao);

View file

@ -66,11 +66,10 @@ public class VclassRetryController extends BaseEditController {
action = epo.getAction();
}
WebappDaoFactory wadf = ModelAccess.on(getServletContext()).getWebappDaoFactory();
WebappDaoFactory wadf = ModelAccess.on(req).getWebappDaoFactory();
VClassDao vcwDao = wadf.getVClassDao();
epo.setDataAccessObject(vcwDao);
VClassGroupDao cgDao = wadf.getVClassGroupDao();
OntologyDao oDao = wadf.getOntologyDao();
VClass vclassForEditing = null;

View file

@ -37,7 +37,7 @@ public class NamespacesListingController extends BaseEditController {
VitroRequest vrequest = new VitroRequest(request);
OntModel ontModel = ModelAccess.on(getServletContext()).getOntModel();
OntModel ontModel = ModelAccess.on(vrequest).getOntModel();
ArrayList results = new ArrayList();
request.setAttribute("results",results);

View file

@ -54,7 +54,7 @@ public class RestrictionsListingController extends BaseEditController {
epo = super.createEpo(request);
OntModel ontModel = ModelAccess.on(getServletContext()).getOntModel();
OntModel ontModel = ModelAccess.on(vrequest).getOntModel();
ObjectPropertyDao opDao = vrequest.getUnfilteredWebappDaoFactory().getObjectPropertyDao();
VClassDao vcDao = vrequest.getUnfilteredWebappDaoFactory().getVClassDao();

View file

@ -3,6 +3,8 @@
package edu.cornell.mannlib.vitro.webapp.controller.freemarker;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -42,6 +44,8 @@ public class BrowseController extends FreemarkerHttpServlet {
List<VClassGroup> groups = null;
VClassGroupsForRequest vcgc = VClassGroupCache.getVClassGroups(vreq);
groups =vcgc.getGroups();
Collections.sort(groups, publicNameComparator);
// sortGroupListByPublicName(groups);
List<VClassGroupTemplateModel> vcgroups = new ArrayList<VClassGroupTemplateModel>(groups.size());
for (VClassGroup group : groups) {
vcgroups.add(new VClassGroupTemplateModel(group));
@ -50,4 +54,35 @@ public class BrowseController extends FreemarkerHttpServlet {
return new TemplateResponseValues(templateName, body);
}
public Comparator<VClassGroup> publicNameComparator = new Comparator<VClassGroup>() {
public int compare(VClassGroup s1, VClassGroup s2) {
String groupName1 = s1.getPublicName().toUpperCase();
String groupName2 = s2.getPublicName().toUpperCase();
//ascending order
return groupName1.compareTo(groupName2);
//descending order
//return groupName2.compareTo(groupName1);
}};
//
// public void sortGroupListByPublicName(List<VClassGroup> groupList) {
// groupList.sort(new Comparator<VClassGroup>() {
// public int compare(VClassGroup first, VClassGroup second) {
// if (first != null) {
// if (second != null) {
// return (first.getDisplayRank() - second.getDisplayRank());
// } else {
// log.error("error--2nd VClassGroup is null in VClassGroupDao.getGroupList().compare()");
// }
// } else {
// log.error("error--1st VClassGroup is null in VClassGroupDao.getGroupList().compare()");
// }
// return 0;
// }
// });
// }
}

View file

@ -0,0 +1,211 @@
package edu.cornell.mannlib.vitro.webapp.controller.freemarker;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.StringWriter;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.stream.Collectors;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.jena.query.Query;
import org.apache.jena.query.QueryExecution;
import org.apache.jena.query.QueryExecutionFactory;
import org.apache.jena.query.QueryFactory;
import org.apache.jena.query.QuerySolution;
import org.apache.jena.query.QuerySolutionMap;
import org.apache.jena.query.ResultSet;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.ModelFactory;
import org.apache.jena.rdf.model.ResourceFactory;
import org.apache.jena.shared.Lock;
import edu.cornell.mannlib.vitro.webapp.auth.permissions.SimplePermission;
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.AuthorizationRequest;
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.RedirectResponseValues;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
import static edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary.HAS_DELETE_QUERY;
import edu.cornell.mannlib.vitro.webapp.dao.jena.event.BulkUpdateEvent;
import edu.cornell.mannlib.vitro.webapp.modelaccess.ModelAccess;
import edu.cornell.mannlib.vitro.webapp.modelaccess.ModelNames;
import edu.cornell.mannlib.vitro.webapp.rdfservice.ChangeSet;
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService;
import edu.cornell.mannlib.vitro.webapp.rdfservice.impl.RDFServiceUtils;
@WebServlet(name = "DeleteIndividualController", urlPatterns = "/deleteIndividualController")
public class DeleteIndividualController extends FreemarkerHttpServlet {
private static final String INDIVIDUAL_URI = "individualUri";
private static final long serialVersionUID = 1L;
private static final Log log = LogFactory.getLog(DeleteIndividualController.class);
private static final boolean BEGIN = true;
private static final boolean END = !BEGIN;
private static String queryForDeleteQuery = ""
+ "SELECT ?deleteQueryText WHERE { "
+ "?associatedUri <" + HAS_DELETE_QUERY + "> ?deleteQueryText ."
+ "}";
private static final String DEFAULT_DELETE_QUERY_TEXT = ""
+ "CONSTRUCT { ?individualUri ?p1 ?o1 . ?s2 ?p2 ?individualUri . } "
+ "WHERE {"
+ " { ?individualUri ?p1 ?o1 . } UNION { ?s2 ?p2 ?individualUri. } "
+ "}";
@Override
protected AuthorizationRequest requiredActions(VitroRequest vreq) {
return SimplePermission.DO_FRONT_END_EDITING.ACTION;
}
protected ResponseValues processRequest(VitroRequest vreq) {
String errorMessage = handleErrors(vreq);
if (!errorMessage.isEmpty()) {
return prepareErrorMessage(errorMessage);
}
String individualUri = vreq.getParameter(INDIVIDUAL_URI);
List<String> types = getObjectMostSpecificTypes(individualUri, vreq);
Model displayModel = vreq.getDisplayModel();
String deleteQueryText = getDeleteQueryForTypes(types, displayModel);
Model toRemove = getIndividualsToDelete(individualUri, deleteQueryText, vreq);
if (toRemove.size() > 0) {
deleteIndividuals(toRemove, vreq);
}
String redirectUrl = getRedirectUrl(vreq);
return new RedirectResponseValues(redirectUrl, HttpServletResponse.SC_SEE_OTHER);
}
private String getRedirectUrl(VitroRequest vreq) {
String redirectUrl = vreq.getParameter("redirectUrl");
if (redirectUrl != null) {
return redirectUrl;
}
return "/";
}
private TemplateResponseValues prepareErrorMessage(String errorMessage) {
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("errorMessage", errorMessage);
return new TemplateResponseValues("error-message.ftl", map);
}
private String handleErrors(VitroRequest vreq) {
String uri = vreq.getParameter(INDIVIDUAL_URI);
if (uri == null) {
return "Individual uri is null. No object to delete.";
}
if (uri.contains("<") || uri.contains(">")) {
return "Individual IRI shouldn't contain '<' or '>";
}
return "";
}
private static String getDeleteQueryForTypes(List<String> types, Model displayModel) {
String deleteQueryText = DEFAULT_DELETE_QUERY_TEXT;
String foundType = "";
for ( String type: types) {
Query queryForTypeSpecificDeleteQuery = QueryFactory.create(queryForDeleteQuery);
QuerySolutionMap initialBindings = new QuerySolutionMap();
initialBindings.add("associatedURI", ResourceFactory.createResource(type));
displayModel.enterCriticalSection(Lock.READ);
try {
QueryExecution qexec = QueryExecutionFactory.create(queryForTypeSpecificDeleteQuery, displayModel,
initialBindings);
try {
ResultSet results = qexec.execSelect();
if (results.hasNext()) {
QuerySolution solution = results.nextSolution();
deleteQueryText = solution.get("deleteQueryText").toString();
foundType = type;
}
} finally {
qexec.close();
}
} finally {
displayModel.leaveCriticalSection();
}
if (!foundType.isEmpty()) {
break;
}
}
if (!foundType.isEmpty()) {
log.debug("For " + foundType + " found delete query \n" + deleteQueryText);
if (!deleteQueryText.contains(INDIVIDUAL_URI)){
log.error("Safety check failed. Delete query text should contain " + INDIVIDUAL_URI + ", "
+ "but it didn't. To prevent bad consequences query was rejected.");
log.error("Delete query which caused the error: \n" + deleteQueryText);
deleteQueryText = DEFAULT_DELETE_QUERY_TEXT;
}
} else {
log.debug("For most specific types: " + types.stream().collect(Collectors.joining(",")) + " no delete query was found. Using default query \n" + deleteQueryText);
}
return deleteQueryText;
}
private List<String> getObjectMostSpecificTypes(String individualUri, VitroRequest vreq) {
List<String> types = new LinkedList<String>();
Individual individual = vreq.getWebappDaoFactory().getIndividualDao().getIndividualByURI(individualUri);
if (individual != null) {
types = individual.getMostSpecificTypeURIs();
}
if (types.isEmpty()) {
log.error("Failed to get most specific type for individual Uri " + individualUri);
}
return types;
}
private Model getIndividualsToDelete(String targetIndividual, String deleteQuery, VitroRequest vreq) {
try {
Query queryForTypeSpecificDeleteQuery = QueryFactory.create(deleteQuery);
QuerySolutionMap bindings = new QuerySolutionMap();
bindings.add(INDIVIDUAL_URI, ResourceFactory.createResource(targetIndividual));
Model ontModel = ModelAccess.on(vreq).getOntModelSelector().getABoxModel();
QueryExecution qexec = QueryExecutionFactory.create(queryForTypeSpecificDeleteQuery, ontModel, bindings);
Model results = qexec.execConstruct();
return results;
} catch (Exception e) {
log.error("Query raised an error \n" + deleteQuery);
log.error(e, e);
}
return ModelFactory.createDefaultModel();
}
private void deleteIndividuals(Model model, VitroRequest vreq) {
RDFService rdfService = vreq.getRDFService();
ChangeSet cs = makeChangeSet(rdfService);
try {
ByteArrayOutputStream out = new ByteArrayOutputStream();
model.write(out, "N3");
InputStream in = new ByteArrayInputStream(out.toByteArray());
cs.addRemoval(in, RDFServiceUtils.getSerializationFormatFromJenaString("N3"), ModelNames.ABOX_ASSERTIONS);
rdfService.changeSetUpdate(cs);
} catch (Exception e) {
StringWriter sw = new StringWriter();
model.write(sw, "N3");
log.error("Got " + e.getClass().getSimpleName() + " while removing\n" + sw.toString());
log.error(e,e);
throw new RuntimeException(e);
}
}
private ChangeSet makeChangeSet(RDFService rdfService) {
ChangeSet cs = rdfService.manufactureChangeSet();
cs.addPreChangeEvent(new BulkUpdateEvent(null, BEGIN));
cs.addPostChangeEvent(new BulkUpdateEvent(null, END));
return cs;
}
}

View file

@ -10,6 +10,9 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.jena.rdf.model.Property;
import org.apache.jena.rdf.model.ResourceFactory;
import edu.cornell.mannlib.vitro.webapp.auth.permissions.SimplePermission;
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.AuthorizationRequest;
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
@ -25,6 +28,8 @@ import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUti
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.N3EditUtils;
import edu.cornell.mannlib.vitro.webapp.modelaccess.ModelAccess;
import edu.cornell.mannlib.vitro.webapp.web.URLEncoder;
/*
* Custom deletion controller to which deletion requests from default property form are sent. May be replaced
* later with additional features in process rdf form controller or alternative location.
@ -61,14 +66,14 @@ public class DeletePropertyController extends FreemarkerHttpServlet {
private String getRedirectUrl(VitroRequest vreq) {
// TODO Auto-generated method stub
// TODO Auto-generated method stub
String subjectUri = EditConfigurationUtils.getSubjectUri(vreq);
String predicateUri = EditConfigurationUtils.getPredicateUri(vreq);
int hashIndex = predicateUri.lastIndexOf("#");
String localName = predicateUri.substring(hashIndex + 1);
Property prop = ResourceFactory.createProperty(predicateUri);
String localName = prop.getLocalName();
String redirectUrl = "/entity?uri=" + URLEncoder.encode(subjectUri);
return redirectUrl + "#" + URLEncoder.encode(localName);
}
return redirectUrl + "#" + URLEncoder.encode(localName);
}
private String handleErrors(VitroRequest vreq) {

View file

@ -0,0 +1,417 @@
package edu.cornell.mannlib.vitro.webapp.controller.freemarker;
import static edu.cornell.mannlib.vitro.webapp.auth.requestedAction.AuthorizationRequest.UNAUTHORIZED;
import static edu.cornell.mannlib.vitro.webapp.controller.freemarker.ImageUploadController.PARAMETER_UPLOADED_FILE;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.jena.ontology.OntModel;
import org.apache.tika.Tika;
import org.apache.tika.mime.MimeType;
import org.apache.tika.mime.MimeTypeException;
import org.apache.tika.mime.MimeTypes;
import edu.cornell.mannlib.vitro.webapp.application.ApplicationUtils;
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.AuthorizationRequest;
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.RequestedAction;
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.propstmt.AddObjectPropertyStatement;
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.propstmt.DropObjectPropertyStatement;
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
import edu.cornell.mannlib.vitro.webapp.beans.Property;
import edu.cornell.mannlib.vitro.webapp.config.ConfigurationProperties;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.RedirectResponseValues;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
import edu.cornell.mannlib.vitro.webapp.filestorage.UploadedFileHelper;
import edu.cornell.mannlib.vitro.webapp.filestorage.model.FileInfo;
import edu.cornell.mannlib.vitro.webapp.i18n.I18n;
import edu.cornell.mannlib.vitro.webapp.i18n.I18nBundle;
import edu.cornell.mannlib.vitro.webapp.modules.fileStorage.FileStorage;
@WebServlet(name = "FileUploadController", urlPatterns = { "/uploadFile" })
public class FileUploadController extends FreemarkerHttpServlet {
private static final String REFERER_HEADER = "Referer";
private static final String TEMPLATE_VAR_FORM_ACTION = "formAction";
private static final String TEMPLATE_VAR_MAX_FILE_SIZE = "maxFileSize";
private static final String PARAM_REFERRER = "referrer";
private static final String TEMPLATE_VAR_SUPPORTED_MEDIA_TYPES = "supportedMediaTypes";
private static final String TEMPLATE_VAR_ERROR_MESSAGE = "errorMessage";
private static final String DEFAULT_FILE_NAME = "fileName";
/**
*
*/
private static final Log log = LogFactory.getLog(FileUploadController.class);
private static final long serialVersionUID = 1L;
private static final String PARAMETER_ACTION = "action";
private static final String ACTION_DELETE = "delete";
private static final String ACTION_UPLOAD = "upload";
private static final String PARAMETER_FILE_URI = "fileUri";
private static final String PARAMETER_SUBJECT_URI = "subjectUri";
private static final String CONFIG_MAX_FILE_SIZE = "fileUpload.maxFileSize";
private static final String ALLOWED_MEDIA_TYPES = "fileUpload.allowedMIMETypes";
private static final Long DEFAULT_FILE_SIZE = (long) (10 * 1024 * 1024);
private static final String PARAMETER_PREDICATE_URI = "predicateUri";
private static final String DEFAULT_TEMPLATE = "fileUpload-default.ftl";
private static Long maxFileSize = DEFAULT_FILE_SIZE;
private FileStorage fileStorage;
private Set<String> allowedMediaTypes;
@Override
public void init() throws ServletException {
super.init();
fileStorage = ApplicationUtils.instance().getFileStorage();
setMaxFileSize();
setAllowedMediaTypes();
}
@Override
protected AuthorizationRequest requiredActions(VitroRequest vreq) {
RequestedAction ra;
try {
Property predicate = new Property(getPredicateUri(vreq));
final OntModel jenaOntModel = vreq.getJenaOntModel();
final String subject = getSubjectUri(vreq);
if (isUpload(vreq)) {
ra = new AddObjectPropertyStatement(jenaOntModel, subject, predicate,RequestedAction.SOME_URI);
} else { // delete
ra = new DropObjectPropertyStatement(jenaOntModel, subject, predicate, getFileUri(vreq));
}
return ra;
} catch (Exception e) {
return UNAUTHORIZED;
}
}
private String getFileUri(VitroRequest vreq) {
return vreq.getParameter(PARAMETER_FILE_URI);
}
@Override
protected ResponseValues processRequest(VitroRequest vreq) {
try {
getReferrer(vreq);
validateRequest(vreq);
if (isUpload(vreq)) {
uploadFile(vreq);
} else if (isDelete(vreq)) {
deleteFile(vreq);
}
} catch (Exception e) {
return pageResponse(vreq, e.getMessage());
}
return new RedirectResponseValues(getNextPageUrl(vreq), HttpServletResponse.SC_SEE_OTHER);
}
private String getNextPageUrl(VitroRequest vreq) {
return getReferrer(vreq);
}
private TemplateResponseValues pageResponse(VitroRequest vreq, String error) {
TemplateResponseValues rv = new TemplateResponseValues(DEFAULT_TEMPLATE);
rv.put(PARAMETER_ACTION, vreq.getParameter(PARAMETER_ACTION));
rv.put(TEMPLATE_VAR_FORM_ACTION, formatRequestUrl(vreq));
if (!error.isEmpty()) {
rv.put(TEMPLATE_VAR_ERROR_MESSAGE, error);
}
rv.put(PARAM_REFERRER,getReferrer(vreq));
rv.put(TEMPLATE_VAR_SUPPORTED_MEDIA_TYPES, printAllowedMediaTypes());
rv.put(TEMPLATE_VAR_MAX_FILE_SIZE, maxFileSizeInMegabytes());
return rv;
}
private String formatRequestUrl(VitroRequest vreq) {
String result = vreq.getRequestURL().toString() + "?";
String query = vreq.getQueryString();
if (query != null) {
result += query;
}
String referrer = vreq.getParameter(PARAM_REFERRER);
if (referrer == null || referrer.isEmpty()) {
result += "&" + PARAM_REFERRER + "=" + getReferrer(vreq);
}
return result;
}
private Double maxFileSizeInMegabytes() {
if (maxFileSize > 0) {
return ((double) maxFileSize/1048576);
} else {
return 0.0;
}
}
private void validateRequest(VitroRequest vreq) throws FileUploadException {
I18nBundle i18nBundle = I18n.bundle(vreq);
if (isUpload(vreq)) {
validateUploadRequest(vreq,i18nBundle);
} else if (isDelete(vreq)) {
validateDeleteRequest(vreq,i18nBundle);
} else if (hasAction(vreq)) {
throw new FileUploadException(i18nBundle.text("file_upload_error_supported_actions"));
} else {
throw new FileUploadException(i18nBundle.text("file_upload_error_no_action"));
}
}
private void validateDeleteRequest(VitroRequest vreq, I18nBundle i18nBundle) throws FileUploadException {
validateSubjectUri(vreq, i18nBundle);
validatePredicateUri(vreq, i18nBundle);
validateFileUri(vreq,i18nBundle);
}
private void validateUploadRequest(VitroRequest vreq, I18nBundle i18nBundle) throws FileUploadException {
validateSubjectUri(vreq ,i18nBundle);
validatePredicateUri(vreq , i18nBundle);
validateFile(vreq, i18nBundle);
}
private void validateFile(VitroRequest vreq, I18nBundle i18nBundle) throws FileUploadException {
Map<String, List<FileItem>> map = vreq.getFiles();
if (map == null) {
throw new FileUploadException(i18nBundle.text("file_upload_error_file_not_found"));
}
List<FileItem> list = map.get(PARAMETER_UPLOADED_FILE);
if ((list == null) || list.isEmpty()) {
throw new FileUploadException(i18nBundle.text("file_upload_error_file_not_found"));
}
FileItem file = list.get(0);
if (file.getSize() == 0) {
throw new FileUploadException(i18nBundle.text("file_upload_error_file_size_is_zero"));
}
if (file.getSize() > maxFileSize) {
throw new FileUploadException(i18nBundle.text("file_upload_error_file_is_too_big", maxFileSize, file.getSize()));
}
validateMediaType(file, i18nBundle);
}
private void validateMediaType(FileItem file, I18nBundle i18nBundle) throws FileUploadException {
String mediaType = getMediaType(file);
if (mediaType.isEmpty()) {
throw new FileUploadException(i18nBundle.text("file_upload_error_file_type_not_recognized"));
}
if (!allowedMediaTypes.contains(mediaType.toLowerCase())) {
String errorMessage = i18nBundle.text("file_upload_error_media_type_not_allowed", mediaType);
log.error(errorMessage);
throw new FileUploadException(errorMessage);
}
}
private String printAllowedMediaTypes() {
StringBuilder sb = new StringBuilder();
if (allowedMediaTypes.isEmpty()) {
return sb.toString();
}
for (Iterator<String> it = allowedMediaTypes.iterator(); it.hasNext();) {
String mediaType = (String) it.next();
sb.append(mediaType);
if (it.hasNext()) {
sb.append(", ");
} else {
sb.append(".");
}
}
return sb.toString();
}
private boolean hasAction(VitroRequest vreq) {
return vreq.getParameter(PARAMETER_ACTION) != null;
}
private void deleteFile(VitroRequest vreq) {
String subjectUri = getSubjectUri(vreq);
String predicateUri = getPredicateUri(vreq);
String fileUri = getFileUri(vreq);
WebappDaoFactory webAppDaoFactory = vreq.getUnfilteredWebappDaoFactory();
UploadedFileHelper fileHelper = new UploadedFileHelper(fileStorage, webAppDaoFactory, getServletContext());
fileHelper.removeUploadedFile(subjectUri, predicateUri, fileUri);
}
private void uploadFile(VitroRequest vreq) throws FileUploadException {
String subjectUri = getSubjectUri(vreq);
String predicateUri = getPredicateUri(vreq);
FileItem file = getUploadedFile(vreq);
String uploadedFileName = getUploadedFileName(file);
String storedFileName = createStoredFileName(file);
WebappDaoFactory webAppDaoFactory = vreq.getUnfilteredWebappDaoFactory();
UploadedFileHelper fileHelper = new UploadedFileHelper(fileStorage, webAppDaoFactory, getServletContext());
FileInfo fileInfo = createFile(file, storedFileName, fileHelper);
fileHelper.attachFileToSubject(fileInfo, subjectUri, predicateUri);
fileHelper.setPublicFileName(fileInfo, uploadedFileName);
}
private FileInfo createFile(FileItem file, String storedFileName, UploadedFileHelper fileHelper)
throws FileUploadException {
FileInfo fileInfo = null;
try {
fileInfo = fileHelper.createFile(storedFileName, getMediaType(file), file.getInputStream());
} catch (Exception e) {
log.error(e.getLocalizedMessage());
throw new FileUploadException(e.getLocalizedMessage());
}
return fileInfo;
}
private String createStoredFileName(FileItem file) {
String mediaType = getMediaType(file);
int length = 64;
boolean useLetters = true;
boolean useNumbers = true;
String storedFileName = RandomStringUtils.random(length, useLetters, useNumbers) + getExtension(mediaType);
return storedFileName;
}
private String getExtension(String mediaType) {
String extension = "";
MimeTypes types = MimeTypes.getDefaultMimeTypes();
try {
MimeType mimeType = types.forName(mediaType);
extension = mimeType.getExtension();
} catch (MimeTypeException e) {
log.error(e.getLocalizedMessage());
}
return extension;
}
private String getUploadedFileName(FileItem file) {
String fileName = file.getName();
if (fileName == null) {
return DEFAULT_FILE_NAME;
} else {
return FilenameUtils.getName(fileName);
}
}
private String getMediaType(FileItem file) {
Tika tika = new Tika();
InputStream is;
String mediaType = "";
try {
is = file.getInputStream();
mediaType = tika.detect(is);
} catch (IOException e) {
log.error(e.getLocalizedMessage());
}
return mediaType;
}
private void validateFileUri(VitroRequest vreq, I18nBundle i18nBundle) throws FileUploadException {
String fileUri = getFileUri(vreq);
validateUriNotEmpty(fileUri, i18nBundle.text("file_upload_file"), i18nBundle);
validateIndividual(vreq, fileUri, i18nBundle);
}
private void validateSubjectUri(VitroRequest vreq, I18nBundle i18nBundle) throws FileUploadException {
String subjectUri = getSubjectUri(vreq);
validateUriNotEmpty(subjectUri, i18nBundle.text("file_upload_subject"), i18nBundle);
validateIndividual(vreq, subjectUri, i18nBundle);
}
private void validatePredicateUri(VitroRequest vreq, I18nBundle i18nBundle) throws FileUploadException {
String predicateUri = getPredicateUri(vreq);
validateUriNotEmpty(predicateUri, i18nBundle.text("file_upload_predicate"), i18nBundle);
validateIndividual(vreq, predicateUri, i18nBundle);
}
private void validateIndividual(VitroRequest vreq, String name, I18nBundle i18nBundle) throws FileUploadException {
Individual subject = vreq.getUnfilteredWebappDaoFactory().getIndividualDao()
.getIndividualByURI(name);
if (subject == null) {
throw new FileUploadException(i18nBundle.text("file_upload_error_uri_not_exists", name));
}
}
private void validateUriNotEmpty(String predicateUri, String name, I18nBundle i18nBundle) throws FileUploadException {
if (predicateUri == null || predicateUri.trim().isEmpty()) {
throw new FileUploadException(i18nBundle.text("file_upload_error_uri_not_given", name));
}
}
private String getPredicateUri(VitroRequest vreq) {
return vreq.getParameter(PARAMETER_PREDICATE_URI);
}
private String getSubjectUri(VitroRequest vreq) {
return vreq.getParameter(PARAMETER_SUBJECT_URI);
}
private FileItem getUploadedFile(VitroRequest vreq) {
return vreq.getFiles().get(PARAMETER_UPLOADED_FILE).get(0);
}
private boolean isUpload(VitroRequest vreq) {
String action = vreq.getParameter(PARAMETER_ACTION);
return ACTION_UPLOAD.equals(action);
}
private boolean isDelete(VitroRequest vreq) {
String action = vreq.getParameter(PARAMETER_ACTION);
return ACTION_DELETE.equals(action);
}
private void setAllowedMediaTypes() {
ConfigurationProperties config = ConfigurationProperties.getBean(getServletContext());
String allowedTypes = config.getProperty(ALLOWED_MEDIA_TYPES, "");
if (allowedTypes.isEmpty()) {
allowedMediaTypes = new HashSet<String>();
} else {
allowedMediaTypes = new HashSet<String>(Arrays.asList(allowedTypes.toLowerCase().trim().split("\\s*,\\s*")));
}
}
private String getReferrer(VitroRequest vreq) {
String referrer = vreq.getParameter(PARAM_REFERRER);
if (referrer == null) {
referrer = vreq.getHeader(REFERER_HEADER);
}
if (referrer == null) {
referrer = "/";
}
return referrer;
}
private void setMaxFileSize() {
ConfigurationProperties config = ConfigurationProperties.getBean(getServletContext());
String configFileSize = config.getProperty(CONFIG_MAX_FILE_SIZE, DEFAULT_FILE_SIZE.toString());
try {
maxFileSize = Long.parseLong(configFileSize);
} catch (NumberFormatException e) {
log.error("maxFileSize parsing failed");
log.error(e);
}
}
static class FileUploadException extends Exception {
private static final long serialVersionUID = 1L;
private final Object[] parameters;
FileUploadException(String message, Object... parameters) {
super(message);
this.parameters = parameters;
}
public String formatMessage(HttpServletRequest req) {
return I18n.text(req, getMessage(), parameters);
}
}
}

View file

@ -8,6 +8,7 @@ import static javax.mail.Message.RecipientType.TO;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
@ -17,7 +18,6 @@ import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import edu.cornell.mannlib.vitro.webapp.dao.jena.MenuDaoJena;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@ -41,6 +41,8 @@ import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.Tem
import edu.cornell.mannlib.vitro.webapp.email.FreemarkerEmailFactory;
import edu.cornell.mannlib.vitro.webapp.email.FreemarkerEmailMessage;
import edu.cornell.mannlib.vitro.webapp.freemarker.config.FreemarkerConfiguration;
import edu.cornell.mannlib.vitro.webapp.i18n.I18n;
import edu.cornell.mannlib.vitro.webapp.i18n.I18nBundle;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.Tags;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.User;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.menu.MainMenu;
@ -67,7 +69,6 @@ public class FreemarkerHttpServlet extends VitroHttpServlet {
// error templates
ERROR_DISPLAY("error-display.ftl"),
ERROR_EMAIL("error-email.ftl"),
ERROR_MESSAGE("error-message.ftl"),
STANDARD_ERROR("error-standard.ftl"),
TITLED_ERROR_MESSAGE("error-titled.ftl"),
@ -93,6 +94,8 @@ public class FreemarkerHttpServlet extends VitroHttpServlet {
throws IOException, ServletException {
super.doGet(request,response);
//UQAM-Optimization set for UTF-8
response.setCharacterEncoding("UTF-8");
VitroRequest vreq = new VitroRequest(request);
ResponseValues responseValues = null;
@ -103,8 +106,8 @@ public class FreemarkerHttpServlet extends VitroHttpServlet {
if (!isAuthorizedToDisplayPage(request, response, requiredActions(vreq))) {
return;
}
responseValues = processRequest(vreq);
doResponse(vreq, response, responseValues);
} catch (Throwable e) {
@ -159,7 +162,8 @@ public class FreemarkerHttpServlet extends VitroHttpServlet {
}
adminErrorData.put("cause", cause);
adminErrorData.put("datetime", new Date());
SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss SSS");
adminErrorData.put("datetime", dateformat.format(new Date()));
templateMap.put("errorOnHomePage", this instanceof HomePageController);
@ -173,7 +177,11 @@ public class FreemarkerHttpServlet extends VitroHttpServlet {
} else if (FreemarkerEmailFactory.isConfigured(vreq)) {
FreemarkerEmailMessage email = FreemarkerEmailFactory.createNewMessage(vreq);
email.addRecipient(TO, email.getReplyToAddress());
email.setTemplate(Template.ERROR_EMAIL.toString());
I18nBundle i18n = I18n.bundle(vreq);
addSiteName(vreq, adminErrorData);
adminErrorData.put("subject", i18n.text("application_error_email_subject"));
adminErrorData.put("textMessage", i18n.text("application_error_email_plain_text"));
adminErrorData.put("htmlMessage", i18n.text("application_error_email_html_text"));
email.setBodyMap(adminErrorData);
email.processTemplate();
sentEmail = email.send();
@ -191,6 +199,16 @@ public class FreemarkerHttpServlet extends VitroHttpServlet {
}
}
private void addSiteName(VitroRequest vreq, Map<String, Object> adminErrorData) {
try {
ApplicationBean appBean = vreq.getAppBean();
String appName = appBean.getApplicationName();
adminErrorData.put("siteName", appName);
} catch (Exception e) {
log.error(e,e);
}
}
@Override
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
@ -256,7 +274,7 @@ public class FreemarkerHttpServlet extends VitroHttpServlet {
protected void doTemplate(VitroRequest vreq, HttpServletResponse response,
ResponseValues values) throws TemplateProcessingException {
Map<String, Object> templateDataModel = new HashMap<String, Object>();
Map<String, Object> templateDataModel = new HashMap<String, Object>();
templateDataModel.putAll(getPageTemplateValues(vreq));
// Add the values that we got from the subcontroller processRequest() method, and merge to the template.
@ -276,8 +294,15 @@ public class FreemarkerHttpServlet extends VitroHttpServlet {
// is specified in the main page template.
bodyString = "";
}
templateDataModel.put("body", bodyString);
String lang = vreq.getLocale().getLanguage();
if (!vreq.getLocale().getCountry().isEmpty()) {
lang += "-" + vreq.getLocale().getCountry();
}
templateDataModel.put("country", lang);
// Tell the template and any directives it uses that we're processing a page template.
templateDataModel.put("templateType", PAGE_TEMPLATE_TYPE);
@ -462,7 +487,7 @@ public class FreemarkerHttpServlet extends VitroHttpServlet {
protected MainMenu getDisplayModelMenu(VitroRequest vreq){
String url = vreq.getRequestURI().substring(vreq.getContextPath().length());
return vreq.getWebappDaoFactory().getMenuDao().getMainMenu(vreq, url);
return vreq.getWebappDaoFactory().getMenuDao().getMainMenu(url);
}
// NIHVIVO-3307: we need this here instead of FreemarkerConfiguration.java so that updates to

View file

@ -6,9 +6,11 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individuallist.ListedIndividualBuilder;
import javax.servlet.annotation.WebServlet;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@ -16,6 +18,7 @@ import org.apache.commons.logging.LogFactory;
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
import edu.cornell.mannlib.vitro.webapp.beans.VClassGroup;
import edu.cornell.mannlib.vitro.webapp.config.ConfigurationProperties;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ExceptionResponseValues;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
@ -27,8 +30,7 @@ import edu.cornell.mannlib.vitro.webapp.modules.searchEngine.SearchEngineExcepti
import edu.cornell.mannlib.vitro.webapp.modules.searchEngine.SearchQuery;
import edu.cornell.mannlib.vitro.webapp.utils.searchengine.SearchQueryUtils;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individuallist.ListedIndividual;
import javax.servlet.annotation.WebServlet;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individuallist.ListedIndividualBuilder;
/**
* Generates a list of individuals for display in a template
@ -43,6 +45,7 @@ public class IndividualListController extends FreemarkerHttpServlet {
private static final int MAX_PAGES = 40; // must be even
private static final String TEMPLATE_DEFAULT = "individualList.ftl";
private static final String LANGUAGE_FILTER_PROPERTY = "RDFService.languageFilter";
@Override
protected ResponseValues processRequest(VitroRequest vreq) {
@ -152,12 +155,12 @@ public class IndividualListController extends FreemarkerHttpServlet {
return SearchQueryUtils.getPageParameter(request);
}
public static IndividualListResults getResultsForVClass(String vclassURI, int page, String alpha, VitroRequest vreq)
public static IndividualListResults getResultsForVClass(String vclassURI,
int page, String alpha, VitroRequest vreq)
throws SearchException{
try{
List<String> classUris = Collections.singletonList(vclassURI);
IndividualListQueryResults results = buildAndExecuteVClassQuery(classUris, alpha, page, INDIVIDUALS_PER_PAGE, vreq.getWebappDaoFactory().getIndividualDao());
return getResultsForVClassQuery(results, page, INDIVIDUALS_PER_PAGE, alpha, vreq);
List<String> classUris = Collections.singletonList(vclassURI);
return buildAndExecuteVClassQuery(classUris, page, INDIVIDUALS_PER_PAGE, alpha, vreq);
} catch (SearchEngineException e) {
String msg = "An error occurred retrieving results for vclass query";
log.error(msg, e);
@ -169,16 +172,27 @@ public class IndividualListController extends FreemarkerHttpServlet {
}
}
public static IndividualListResults getResultsForVClassIntersections(List<String> vclassURIs, int page, int pageSize, String alpha, VitroRequest vreq) {
public static IndividualListResults getResultsForVClassIntersections(
List<String> classUris, int page, int pageSize, String alpha, VitroRequest vreq) {
try{
IndividualListQueryResults results = buildAndExecuteVClassQuery(vclassURIs, alpha, page, pageSize, vreq.getWebappDaoFactory().getIndividualDao());
return getResultsForVClassQuery(results, page, pageSize, alpha, vreq);
return buildAndExecuteVClassQuery(classUris, page, pageSize, alpha, vreq);
} catch(Throwable th) {
log.error("Error retrieving individuals corresponding to intersection multiple classes." + vclassURIs.toString(), th);
log.error("Error retrieving individuals corresponding to intersection multiple classes." + classUris.toString(), th);
return IndividualListResults.EMPTY;
}
}
private static IndividualListResults buildAndExecuteVClassQuery(List<String> classUris, int page, int pageSize,
String alpha, VitroRequest vreq) throws SearchEngineException {
ConfigurationProperties props = ConfigurationProperties.getBean(vreq);
boolean languageFilter = Boolean.valueOf(props.getProperty(LANGUAGE_FILTER_PROPERTY, "false"));
IndividualListQueryResults results = buildAndExecuteVClassQuery(classUris, alpha,
((languageFilter) ? vreq.getLocale() : null), page, pageSize,
vreq.getWebappDaoFactory().getIndividualDao());
IndividualListResults indListResults = getResultsForVClassQuery(results, page, pageSize, alpha, vreq);
return indListResults;
}
public static IndividualListResults getRandomResultsForVClass(String vclassURI, int page, int pageSize, VitroRequest vreq) {
try{
List<String> classUris = Collections.singletonList(vclassURI);
@ -201,9 +215,10 @@ public class IndividualListController extends FreemarkerHttpServlet {
private static IndividualListQueryResults buildAndExecuteVClassQuery(
List<String> vclassURIs, String alpha, int page, int pageSize, IndividualDao indDao)
List<String> vclassURIs, String alpha, Locale locale, int page,
int pageSize, IndividualDao indDao)
throws SearchEngineException {
SearchQuery query = SearchQueryUtils.getQuery(vclassURIs, alpha, page, pageSize);
SearchQuery query = SearchQueryUtils.getQuery(vclassURIs, alpha, locale, page, pageSize);
IndividualListQueryResults results = IndividualListQueryResults.runQuery(query, indDao);
log.debug("Executed search query for " + vclassURIs);
if (results.getIndividuals().isEmpty()) {
@ -250,8 +265,7 @@ public class IndividualListController extends FreemarkerHttpServlet {
}else if ( requiredPages > MAX_PAGES && selectedPage > requiredPages - MAX_PAGES ){
//the selected page is in the end of the list
int startPage = requiredPages - MAX_PAGES;
double max = Math.ceil(size/pageSize);
for(int page = startPage; page <= max; page++ ){
for(int page = startPage; page <= requiredPages; page++ ){
records.add( new PageRecord( "page=" + page, Integer.toString(page), Integer.toString(page), selectedPage == page ) );
}
}else{

View file

@ -8,39 +8,40 @@ import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import edu.cornell.mannlib.vitro.webapp.auth.permissions.SimplePermission;
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.AuthorizationRequest;
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
import edu.cornell.mannlib.vitro.webapp.beans.FauxProperty;
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
import edu.cornell.mannlib.vitro.webapp.beans.Property;
import edu.cornell.mannlib.vitro.webapp.beans.PropertyGroup;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyDao;
import edu.cornell.mannlib.vitro.webapp.dao.FauxPropertyDao;
import edu.cornell.mannlib.vitro.webapp.dao.ObjectPropertyDao;
import edu.cornell.mannlib.vitro.webapp.dao.PropertyGroupDao;
import javax.servlet.annotation.WebServlet;
@WebServlet(name = "ListFauxPropertiesController", urlPatterns = {"/listFauxProperties"} )
@WebServlet(name = "ListFauxPropertiesController", urlPatterns = { "/listFauxProperties" })
public class ListFauxPropertiesController extends FreemarkerHttpServlet {
private static final Log log = LogFactory.getLog(ListFauxPropertiesController.class.getName());
private static final Log log = LogFactory.getLog(ListFauxPropertiesController.class.getName());
private static final String TEMPLATE_NAME = "siteAdmin-fauxPropertiesList.ftl";
private ObjectPropertyDao opDao = null;
private PropertyGroupDao pgDao = null;
private FauxPropertyDao fpDao = null;
private String notFoundMessage = "";
private String notFoundMessage = "";
@Override
protected AuthorizationRequest requiredActions(VitroRequest vreq) {
return SimplePermission.EDIT_ONTOLOGY.ACTION;
}
protected AuthorizationRequest requiredActions(VitroRequest vreq) {
return SimplePermission.EDIT_ONTOLOGY.ACTION;
}
@Override
protected ResponseValues processRequest(VitroRequest vreq) {
@ -50,176 +51,303 @@ public class ListFauxPropertiesController extends FreemarkerHttpServlet {
String displayOption = "";
if ( vreq.getParameter("displayOption") != null ) {
if (vreq.getParameter("displayOption") != null) {
displayOption = vreq.getParameter("displayOption");
}
else {
} else {
displayOption = "listing";
}
body.put("displayOption", displayOption);
if ( displayOption.equals("listing") ) {
if (displayOption.equals("listing")) {
body.put("pageTitle", "Faux Property Listing");
}
else {
} else {
body.put("pageTitle", "Faux Properties by Base Property");
}
List<ObjectProperty> objectProps = getOPDao(vreq).getRootObjectProperties();
List<DataProperty> dataProps = getDPDao(vreq).getRootDataProperties();
Map<String, Object> allFauxProps = new TreeMap<String, Object>();
opDao = vreq.getUnfilteredAssertionsWebappDaoFactory().getObjectPropertyDao();
fpDao = vreq.getUnfilteredAssertionsWebappDaoFactory().getFauxPropertyDao();
pgDao = vreq.getUnfilteredAssertionsWebappDaoFactory().getPropertyGroupDao();
List<ObjectProperty> objectProps = null;
objectProps = opDao.getRootObjectProperties();
Map<String, Object> allFauxProps = new TreeMap<String, Object>();
// get the faux depending on the display option
if ( displayOption.equals("listing") ) {
allFauxProps = getFauxPropertyList(objectProps);
// get the faux depending on the display option
if (displayOption.equals("listing")) {
allFauxProps.putAll(getFauxPropertyList(objectProps, vreq));
allFauxProps.putAll(getFauxDataPropertyList(dataProps, vreq));
} else {
allFauxProps.putAll(getFauxByBaseList(objectProps, vreq));
allFauxProps.putAll(getFauxDataPropsByBaseList(dataProps, vreq));
}
else {
allFauxProps = getFauxByBaseList(objectProps);
}
log.debug(allFauxProps.toString());
log.debug(allFauxProps.toString());
if ( notFoundMessage.length() == 0 ) {
body.put("message", notFoundMessage);
}
else {
body.put("fauxProps", allFauxProps);
}
if (notFoundMessage.length() == 0) {
body.put("message", notFoundMessage);
} else {
body.put("fauxProps", allFauxProps);
}
} catch (Throwable t) {
t.printStackTrace();
log.error(t, t);
}
return new TemplateResponseValues(TEMPLATE_NAME, body);
}
private TreeMap<String, Object> getFauxPropertyList(List<ObjectProperty> objectProps) {
List<FauxProperty> fauxProps = null;
TreeMap<String, Object> theFauxProps = new TreeMap<String, Object>();
if ( objectProps != null ) {
private PropertyGroupDao getPGDao(VitroRequest vreq) {
return vreq.getUnfilteredAssertionsWebappDaoFactory().getPropertyGroupDao();
}
private FauxPropertyDao getFPDao(VitroRequest vreq) {
return vreq.getUnfilteredAssertionsWebappDaoFactory().getFauxPropertyDao();
}
private DataPropertyDao getDPDao(VitroRequest vreq) {
return vreq.getUnfilteredAssertionsWebappDaoFactory().getDataPropertyDao();
}
private ObjectPropertyDao getOPDao(VitroRequest vreq) {
return vreq.getUnfilteredAssertionsWebappDaoFactory().getObjectPropertyDao();
}
private TreeMap<String, Object> getFauxPropertyList(List<ObjectProperty> objectProps, VitroRequest vreq) {
List<FauxProperty> fauxProps = null;
TreeMap<String, Object> theFauxProps = new TreeMap<String, Object>();
if (objectProps != null) {
Iterator<ObjectProperty> opIt = objectProps.iterator();
if ( !opIt.hasNext()) {
if (!opIt.hasNext()) {
notFoundMessage = "No object properties found.";
}
else {
} else {
while (opIt.hasNext()) {
ObjectProperty op = opIt.next();
String baseURI = op.getURI();
fauxProps = fpDao.getFauxPropertiesForBaseUri(baseURI);
if ( fauxProps != null ) {
Iterator<FauxProperty> fpIt = fauxProps.iterator();
if ( !fpIt.hasNext()) {
notFoundMessage = "No faux properties found.";
}
else {
while (fpIt.hasNext()) {
// No point in getting these unless we have a faux property
String baseLabel = getDisplayLabel(op) == null ? "(no name)" : getDisplayLabel(op);
String baseLocalName = op.getLocalNameWithPrefix();
baseLabel = baseLabel.substring(0,baseLabel.indexOf("("));
baseLabel += "(" + baseLocalName + ")";
// get the info we need from the faux property
FauxProperty fp = fpIt.next();
String fauxLabel = fp.getDisplayName();
String rangeLabel = fp.getRangeLabel();
String rangeURI = fp.getRangeURI();
String domainLabel = fp.getDomainLabel();
String domainURI = fp.getDomainURI();
String groupURI = fp.getGroupURI();
// FauxProperty only gets groupURI but we want the label
PropertyGroup pGroup = pgDao.getGroupByURI(groupURI);
String groupLabel = ( pGroup == null ) ? "unspecified" : pGroup.getName();
// store all the strings in a hash with the faux property label as the key
Map<String, Object> tmpHash = new HashMap<String, Object>();
tmpHash.put("base", baseLabel);
tmpHash.put("baseURI", baseURI);
tmpHash.put("group", groupLabel);
tmpHash.put("range", rangeLabel);
tmpHash.put("rangeURI", rangeURI);
tmpHash.put("domain", domainLabel);
tmpHash.put("domainURI", domainURI);
// add the faux and its details to the treemap
theFauxProps.put(fauxLabel + "@@" + domainLabel, tmpHash);
}
}
}
}
String baseURI = op.getURI();
fauxProps = getFPDao(vreq).getFauxPropertiesForBaseUri(baseURI);
if (fauxProps != null) {
Iterator<FauxProperty> fpIt = fauxProps.iterator();
if (!fpIt.hasNext()) {
notFoundMessage = "No faux properties found.";
} else {
while (fpIt.hasNext()) {
// No point in getting these unless we have a
// faux property
String baseLabel = getBaseLabel(op, false);
// get the info we need from the faux property
FauxProperty fp = fpIt.next();
String fauxLabel = fp.getDisplayName();
String rangeLabel = fp.getRangeLabel();
String rangeURI = fp.getRangeURI();
String domainLabel = fp.getDomainLabel();
String domainURI = fp.getDomainURI();
String groupURI = fp.getGroupURI();
// FauxProperty only gets groupURI but we want
// the label
PropertyGroup pGroup = getPGDao(vreq).getGroupByURI(groupURI);
String groupLabel = (pGroup == null) ? "unspecified" : pGroup.getName();
// store all the strings in a hash with the faux
// property label as the key
Map<String, Object> tmpHash = new HashMap<String, Object>();
tmpHash.put("base", baseLabel);
tmpHash.put("baseURI", baseURI);
tmpHash.put("group", groupLabel);
tmpHash.put("range", rangeLabel);
tmpHash.put("rangeURI", rangeURI);
tmpHash.put("domain", domainLabel);
tmpHash.put("domainURI", domainURI);
tmpHash.put("editUrl", "propertyEdit");
// add the faux and its details to the treemap
theFauxProps.put(fauxLabel + "@@" + domainLabel, tmpHash);
}
}
}
}
}
}
return theFauxProps;
}
}
private TreeMap<String, Object> getFauxByBaseList(List<ObjectProperty> objectProps) {
List<FauxProperty> fauxProps = null;
TreeMap<String, Object> fauxByBaseProps = new TreeMap<String, Object>();
if ( objectProps != null ) {
private TreeMap<String, Object> getFauxByBaseList(List<ObjectProperty> objectProps, VitroRequest vreq) {
List<FauxProperty> fauxProps = null;
TreeMap<String, Object> fauxByBaseProps = new TreeMap<String, Object>();
if (objectProps != null) {
Iterator<ObjectProperty> opIt = objectProps.iterator();
if ( !opIt.hasNext()) {
if (!opIt.hasNext()) {
notFoundMessage = "No object properties found.";
}
else {
} else {
while (opIt.hasNext()) {
TreeMap<String, Object> fauxForGivenBase = new TreeMap<String, Object>();
TreeMap<String, Object> fauxForGivenBase = new TreeMap<String, Object>();
ObjectProperty op = opIt.next();
String baseURI = op.getURI();
fauxProps = fpDao.getFauxPropertiesForBaseUri(baseURI);
String baseURI = op.getURI();
fauxProps = getFPDao(vreq).getFauxPropertiesForBaseUri(baseURI);
if ( fauxProps != null ) {
Iterator<FauxProperty> fpIt = fauxProps.iterator();
if ( !fpIt.hasNext()) {
notFoundMessage = "No faux properties found.";
}
else {
String baseLabel = getDisplayLabel(op) == null ? "(no name)" : getDisplayLabel(op);
String baseLocalName = op.getLocalNameWithPrefix();
baseLabel = baseLabel.substring(0,baseLabel.indexOf("("));
baseLabel += "(" + baseLocalName + ")" + "|" + baseURI;
while (fpIt.hasNext()) {
// get the info we need from the faux property
FauxProperty fp = fpIt.next();
String fauxLabel = fp.getDisplayName();
String rangeLabel = fp.getRangeLabel();
String rangeURI = fp.getRangeURI();
String domainLabel = fp.getDomainLabel();
String domainURI = fp.getDomainURI();
String groupURI = fp.getGroupURI();
// FauxProperty only gets groupURI but we want the label
PropertyGroup pGroup = pgDao.getGroupByURI(groupURI);
String groupLabel = ( pGroup == null ) ? "unspecified" : pGroup.getName();
// store all the strings in a hash with the faux property label as the key
Map<String, Object> tmpHash = new HashMap<String, Object>();
tmpHash.put("baseURI", baseURI);
tmpHash.put("group", groupLabel);
tmpHash.put("range", rangeLabel);
tmpHash.put("rangeURI", rangeURI);
tmpHash.put("domain", domainLabel);
tmpHash.put("domainURI", domainURI);
// add the faux and its details to the treemap
fauxForGivenBase.put(fauxLabel + "@@" + domainLabel, tmpHash);
}
fauxByBaseProps.put(baseLabel, fauxForGivenBase);
}
}
}
if (fauxProps != null) {
Iterator<FauxProperty> fpIt = fauxProps.iterator();
if (!fpIt.hasNext()) {
notFoundMessage = "No faux properties found.";
} else {
String baseLabel = getBaseLabel(op, true);
while (fpIt.hasNext()) {
// get the info we need from the faux property
FauxProperty fp = fpIt.next();
String fauxLabel = fp.getDisplayName();
String rangeLabel = fp.getRangeLabel();
String rangeURI = fp.getRangeURI();
String domainLabel = fp.getDomainLabel();
String domainURI = fp.getDomainURI();
String groupURI = fp.getGroupURI();
// FauxProperty only gets groupURI but we want
// the label
PropertyGroup pGroup = getPGDao(vreq).getGroupByURI(groupURI);
String groupLabel = (pGroup == null) ? "unspecified" : pGroup.getName();
// store all the strings in a hash with the faux
// property label as the key
Map<String, Object> tmpHash = new HashMap<String, Object>();
tmpHash.put("baseURI", baseURI);
tmpHash.put("group", groupLabel);
tmpHash.put("range", rangeLabel);
tmpHash.put("rangeURI", rangeURI);
tmpHash.put("domain", domainLabel);
tmpHash.put("domainURI", domainURI);
// add the faux and its details to the treemap
fauxForGivenBase.put(fauxLabel + "@@" + domainLabel, tmpHash);
fauxForGivenBase.put("editUrl", "propertyEdit");
}
fauxByBaseProps.put(baseLabel, fauxForGivenBase);
}
}
}
}
}
return fauxByBaseProps;
}
}
/*
* should never be null
*/
public static String getDisplayLabel(ObjectProperty op) {
String displayLabel = op.getPickListName();
displayLabel = (displayLabel != null && displayLabel.length() > 0)
? displayLabel
: op.getLocalName();
return (displayLabel != null) ? displayLabel : "[object property]" ;
private TreeMap<String, Object> getFauxDataPropertyList(List<DataProperty> dataProps, VitroRequest vreq) {
List<FauxProperty> fauxProps = null;
TreeMap<String, Object> theFauxProps = new TreeMap<String, Object>();
if (dataProps != null) {
Iterator<DataProperty> opIt = dataProps.iterator();
if (!opIt.hasNext()) {
notFoundMessage = "No data properties found.";
} else {
while (opIt.hasNext()) {
DataProperty dp = opIt.next();
String baseURI = dp.getURI();
fauxProps = getFPDao(vreq).getFauxPropertiesForBaseUri(baseURI);
if (fauxProps != null) {
Iterator<FauxProperty> fpIt = fauxProps.iterator();
if (!fpIt.hasNext()) {
notFoundMessage = "No faux properties found.";
} else {
while (fpIt.hasNext()) {
// No point in getting these unless we have a
// faux property
String baseLabel = getBaseLabel(dp, false);
// get the info we need from the faux property
FauxProperty fp = fpIt.next();
String fauxLabel = fp.getDisplayName();
String rangeLabel = fp.getRangeLabel();
String rangeURI = fp.getRangeURI();
String domainLabel = fp.getDomainLabel();
String domainURI = fp.getDomainURI();
String groupURI = fp.getGroupURI();
// FauxProperty only gets groupURI but we want
// the label
PropertyGroup pGroup = getPGDao(vreq).getGroupByURI(groupURI);
String groupLabel = (pGroup == null) ? "unspecified" : pGroup.getName();
// store all the strings in a hash with the faux
// property label as the key
Map<String, Object> tmpHash = new HashMap<String, Object>();
tmpHash.put("base", baseLabel);
tmpHash.put("baseURI", baseURI);
tmpHash.put("group", groupLabel);
tmpHash.put("range", rangeLabel);
tmpHash.put("rangeURI", rangeURI);
tmpHash.put("domain", domainLabel);
tmpHash.put("domainURI", domainURI);
tmpHash.put("editUrl", "datapropEdit");
// add the faux and its details to the treemap
theFauxProps.put(fauxLabel + "@@" + domainLabel, tmpHash);
}
}
}
}
}
}
return theFauxProps;
}
private TreeMap<String, Object> getFauxDataPropsByBaseList(List<DataProperty> dataProps, VitroRequest vreq) {
List<FauxProperty> fauxProps = null;
TreeMap<String, Object> fauxByBaseProps = new TreeMap<String, Object>();
if (dataProps != null) {
Iterator<DataProperty> opIt = dataProps.iterator();
if (!opIt.hasNext()) {
notFoundMessage = "No data properties found.";
} else {
while (opIt.hasNext()) {
TreeMap<String, Object> fauxForGivenBase = new TreeMap<String, Object>();
DataProperty dp = opIt.next();
String baseURI = dp.getURI();
fauxProps = getFPDao(vreq).getFauxPropertiesForBaseUri(baseURI);
if (fauxProps != null) {
Iterator<FauxProperty> fpIt = fauxProps.iterator();
if (!fpIt.hasNext()) {
notFoundMessage = "No faux properties found.";
} else {
String baseLabel = getBaseLabel(dp, true);
while (fpIt.hasNext()) {
// get the info we need from the faux property
FauxProperty fp = fpIt.next();
String fauxLabel = fp.getDisplayName();
String rangeLabel = fp.getRangeLabel();
String rangeURI = fp.getRangeURI();
String domainLabel = fp.getDomainLabel();
String domainURI = fp.getDomainURI();
String groupURI = fp.getGroupURI();
// FauxProperty only gets groupURI but we want
// the label
PropertyGroup pGroup = getPGDao(vreq).getGroupByURI(groupURI);
String groupLabel = (pGroup == null) ? "unspecified" : pGroup.getName();
// store all the strings in a hash with the faux
// property label as the key
Map<String, Object> tmpHash = new HashMap<String, Object>();
tmpHash.put("baseURI", baseURI);
tmpHash.put("group", groupLabel);
tmpHash.put("range", rangeLabel);
tmpHash.put("rangeURI", rangeURI);
tmpHash.put("domain", domainLabel);
tmpHash.put("domainURI", domainURI);
// add the faux and its details to the treemap
fauxForGivenBase.put(fauxLabel + "@@" + domainLabel, tmpHash);
fauxForGivenBase.put("editUrl", "datapropEdit");
}
fauxByBaseProps.put(baseLabel, fauxForGivenBase);
}
}
}
}
}
return fauxByBaseProps;
}
private String getBaseLabel(Property property, boolean addUri) {
String baseLabel = property.getPickListName();
if (StringUtils.isEmpty(baseLabel)) {
baseLabel = property.getLocalName();
}
if (StringUtils.isEmpty(baseLabel)) {
baseLabel = "[property]";
}
String baseLocalName = property.getLocalNameWithPrefix();
int indexOf = baseLabel.indexOf("(");
if (indexOf > 0) {
baseLabel = baseLabel.substring(0, indexOf);
}
baseLabel += "(" + baseLocalName + ")";
if (addUri) {
baseLabel += "|" + property.getURI();
}
return baseLabel;
}
}

View file

@ -42,7 +42,7 @@ public class TemplateProcessingHelper {
try {
Environment env = template.createProcessingEnvironment(map, writer);
// Define a setup template to be included by every page template
String templateType = (String) map.get("templateType");
if (FreemarkerHttpServlet.PAGE_TEMPLATE_TYPE.equals(templateType)) {

View file

@ -1,49 +0,0 @@
/* $This file is distributed under the terms of the license in LICENSE$ */
package edu.cornell.mannlib.vitro.webapp.controller.freemarker;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
import javax.servlet.annotation.WebServlet;
@WebServlet(name = "TermsOfUseController", urlPatterns = {"/termsOfUse"} )
public class TermsOfUseController extends FreemarkerHttpServlet {
private static final long serialVersionUID = 1L;
private static final Log log = LogFactory.getLog(TermsOfUseController.class);
private static final String TEMPLATE_DEFAULT = "termsOfUse.ftl";
@Override
protected ResponseValues processRequest(VitroRequest vreq) {
Map<String, Object> map = new HashMap<String, Object>();
Map<String, String> termsOfUse = new HashMap<String, String>();
ApplicationBean appBean = vreq.getAppBean();
termsOfUse.put("siteName", appBean.getApplicationName());
String siteHost = appBean.getCopyrightAnchor();
if (siteHost == null) {
siteHost = "the hosting institution";
}
termsOfUse.put("siteHost", siteHost);
map.put("termsOfUse", termsOfUse);
return new TemplateResponseValues(TEMPLATE_DEFAULT, map);
}
@Override
protected String getTitle(String siteName, VitroRequest vreq) {
return siteName + " Terms of Use";
}
}

View file

@ -37,6 +37,7 @@ public class UrlBuilder {
LOGIN("/login"),
LOGOUT("/logout"),
OBJECT_PROPERTY_EDIT("/propertyEdit"),
EXTENDED_SEARCH("/extendedsearch"),
SEARCH("/search"),
SITE_ADMIN("/siteAdmin"),
TERMS_OF_USE("/termsOfUse"),

View file

@ -11,28 +11,29 @@ import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.LocaleUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.jena.query.QuerySolution;
import org.apache.jena.query.ResultSet;
import org.apache.jena.rdf.model.Literal;
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerHttpServlet;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ExceptionResponseValues;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
import edu.cornell.mannlib.vitro.webapp.dao.jena.QueryUtils;
import edu.cornell.mannlib.vitro.webapp.i18n.selection.SelectedLocale;
import edu.cornell.mannlib.vitro.webapp.rdfservice.filter.LanguageFilteringUtils;
/*Servlet to view all labels in various languages for individual*/
@ -47,12 +48,13 @@ public class ViewLabelsServlet extends FreemarkerHttpServlet{
String subjectUri = vreq.getParameter("subjectUri");
body.put("subjectUri", subjectUri);
try {
//Get all language codes/labels in the system, and this list is sorted by language name
List<HashMap<String, String>> locales = this.getLocales(vreq);
//the labels already added by the user
ArrayList<Literal> existingLabels = this.getExistingLabels(subjectUri, vreq);
//Get all language codes/labels used in the list of existing labels
List<HashMap<String, String>> locales = this.getLocales(vreq, existingLabels);
//Get code to label hashmap - we use this to get the language name for the language code returned in the rdf literal
HashMap<String, String> localeCodeToNameMap = this.getFullCodeToLanguageNameMap(locales);
//the labels already added by the user
ArrayList<Literal> existingLabels = this.getExistingLabels(subjectUri, vreq);
//existing labels keyed by language name and each of the list of labels is sorted by language name
HashMap<String, List<LabelInformation>> existingLabelsByLanguageName = this.getLabelsSortedByLanguageName(existingLabels, localeCodeToNameMap, vreq, subjectUri);
//Get available locales for the drop down for adding a new label, also sorted by language name
@ -137,20 +139,26 @@ public class ViewLabelsServlet extends FreemarkerHttpServlet{
doGet(request, response);
}
//get locales
public List<HashMap<String, String>> getLocales(VitroRequest vreq) {
List<Locale> selectables = SelectedLocale.getSelectableLocales(vreq);
if (selectables.isEmpty()) {
//get locales present in list of literals
public List<HashMap<String, String>> getLocales(VitroRequest vreq,
List<Literal> existingLiterals) {
Set<Locale> locales = new HashSet<Locale>();
for(Literal literal : existingLiterals) {
String language = literal.getLanguage();
if(!StringUtils.isEmpty(language)) {
locales.add(LanguageFilteringUtils.languageToLocale(language));
}
}
if (locales.isEmpty()) {
return Collections.emptyList();
}
List<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>();
Locale currentLocale = SelectedLocale.getCurrentLocale(vreq);
for (Locale locale : selectables) {
for (Locale locale : locales) {
try {
list.add(buildLocaleMap(locale, currentLocale));
} catch (FileNotFoundException e) {
log.warn("Can't show the Locale selector for '" + locale
+ "': " + e);
log.warn("Can't show locale '" + locale + "': " + e);
}
}
@ -162,7 +170,7 @@ public class ViewLabelsServlet extends FreemarkerHttpServlet{
Locale currentLocale) throws FileNotFoundException {
HashMap<String, String> map = new HashMap<String, String>();
//Replacing the underscore with a hyphen because that is what is represented in the actual literals
map.put("code", locale.toString().replace("_", "-"));
map.put("code", locale.toLanguageTag().replace("_", "-"));
map.put("label", locale.getDisplayName(currentLocale));
return map;
}
@ -188,8 +196,8 @@ public class ViewLabelsServlet extends FreemarkerHttpServlet{
ArrayList<Literal> labels = new ArrayList<Literal>();
try {
//We want to get the labels for all the languages, not just the display language
ResultSet results = QueryUtils.getLanguageNeutralQueryResults(queryStr, vreq);
// Show only labels with current language filtering
ResultSet results = QueryUtils.getQueryResults(queryStr, vreq);
while (results.hasNext()) {
QuerySolution soln = results.nextSolution();
Literal nodeLiteral = soln.get("label").asLiteral();

View file

@ -338,7 +338,7 @@ public class JSONReconcileServlet extends VitroHttpServlet {
}
resultJson.put("type", typesJsonArr);
resultJson.put("match", "false");
resultJson.put("match", false);
resultJsonArr.add(resultJson);
} catch (Exception e) {

View file

@ -6,14 +6,13 @@ import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.jena.rdf.model.RDFNode;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.IndividualTemplateModelBuilder;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.jena.query.QuerySolution;
import org.apache.jena.query.ResultSet;
@ -36,6 +35,7 @@ import edu.cornell.mannlib.vitro.webapp.i18n.selection.SelectedLocale;
import edu.cornell.mannlib.vitro.webapp.utils.dataGetter.ExecuteDataRetrieval;
import edu.cornell.mannlib.vitro.webapp.web.beanswrappers.ReadOnlyBeansWrapper;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.IndividualTemplateModel;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.IndividualTemplateModelBuilder;
import edu.ucsf.vitro.opensocial.OpenSocialManager;
import freemarker.ext.beans.BeansWrapper;
import freemarker.template.TemplateModel;
@ -94,6 +94,7 @@ class IndividualResponseBuilder {
body.put("relatedSubject", getRelatedSubject());
body.put("namespaces", namespaces);
body.put("temporalVisualizationEnabled", getTemporalVisualizationFlag());
body.put("mapOfScienceVisualizationEnabled", getMapOfScienceVisualizationFlag());
body.put("profilePageTypesEnabled", getprofilePageTypesFlag());
body.put("verbosePropertySwitch", getVerbosePropertyValues());
@ -123,8 +124,10 @@ class IndividualResponseBuilder {
* into the data model: no real data can be modified.
*/
// body.put("individual", wrap(itm, BeansWrapper.EXPOSE_SAFE));
body.put("labelCount", getLabelCount(itm.getUri(), vreq));
body.put("languageCount", getLanguagesRepresentedCount(itm.getUri(), vreq));
LabelAndLanguageCount labelAndLanguageCount = getLabelAndLanguageCount(
itm.getUri(), vreq);
body.put("labelCount", labelAndLanguageCount.getLabelCount());
body.put("languageCount", labelAndLanguageCount.getLanguageCount());
//We also need to know the number of available locales
body.put("localesCount", SelectedLocale.getSelectableLocales(vreq).size());
body.put("profileType", getProfileType(itm.getUri(), vreq));
@ -193,6 +196,12 @@ class IndividualResponseBuilder {
return "enabled".equals(property);
}
private boolean getMapOfScienceVisualizationFlag() {
String property = ConfigurationProperties.getBean(vreq).getProperty(
"visualization.mapOfScience");
return "enabled".equals(property);
}
private boolean getprofilePageTypesFlag() {
String property = ConfigurationProperties.getBean(vreq).getProperty(
"multiViews.profilePageTypes");
@ -282,61 +291,103 @@ class IndividualResponseBuilder {
return map;
}
private static String LABEL_COUNT_QUERY = ""
+ "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n"
+ "SELECT ( str(COUNT(?label)) AS ?labelCount ) WHERE { \n"
+ " ?subject rdfs:label ?label \n"
+ " FILTER isLiteral(?label) \n"
+ "}" ;
private static String DISTINCT_LANGUAGE_QUERY = ""
private static String LABEL_QUERY = ""
+ "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n"
+ "SELECT ( str(COUNT(DISTINCT lang(?label))) AS ?languageCount ) WHERE { \n"
+ "SELECT ?label WHERE { \n"
+ " ?subject rdfs:label ?label \n"
+ " FILTER isLiteral(?label) \n"
+ "}" ;
// Queries that were previously used for counts via RDFService that didn't
// filter results by language. With language filtering, aggregate
// functions like COUNT() cannot be used.
// private static String LABEL_COUNT_QUERY = ""
// + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n"
// + "SELECT ( str(COUNT(?label)) AS ?labelCount ) WHERE { \n"
// + " ?subject rdfs:label ?label \n"
// + " FILTER isLiteral(?label) \n"
// + "}" ;
private static Integer getLabelCount(String subjectUri, VitroRequest vreq) {
String queryStr = QueryUtils.subUriForQueryVar(LABEL_COUNT_QUERY, "subject", subjectUri);
// private static String DISTINCT_LANGUAGE_QUERY = ""
// + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n"
// + "SELECT ( str(COUNT(DISTINCT lang(?label))) AS ?languageCount ) WHERE { \n"
// + " ?subject rdfs:label ?label \n"
// + " FILTER isLiteral(?label) \n"
// + "}" ;
private static LabelAndLanguageCount getLabelAndLanguageCount(
String subjectUri, VitroRequest vreq) {
// 1.12.0 Now filtering to only the labels for the current locale so as
// to be consistent with other editing forms. Because the language
// filter can only act on a result set containing actual literals,
// we can't do the counting with a COUNT() in the query itself. So
// we will now use the LABEL_QUERY instead of LABEL_COUNT_QUERY and
// count the rows and the number of distinct languages represented.
Set<String> distinctLanguages = new HashSet<String>();
String queryStr = QueryUtils.subUriForQueryVar(LABEL_QUERY, "subject", subjectUri);
log.debug("queryStr = " + queryStr);
int theCount = 0;
try {
//ResultSet results = QueryUtils.getQueryResults(queryStr, vreq);
//Get query results across all languages in order for template to show manage labels link correctly
ResultSet results = QueryUtils.getLanguageNeutralQueryResults(queryStr, vreq);
if (results.hasNext()) {
QuerySolution soln = results.nextSolution();
RDFNode labelCount = soln.get("labelCount");
if (labelCount != null && labelCount.isLiteral()) {
theCount = labelCount.asLiteral().getInt();
int labelCount = 0;
try {
ResultSet results = QueryUtils.getQueryResults(queryStr, vreq);
while(results.hasNext()) {
QuerySolution qsoln = results.next();
labelCount++;
String lang = qsoln.getLiteral("label").getLanguage();
if(lang == null) {
lang = "";
}
distinctLanguages.add(lang);
}
} catch (Exception e) {
log.error(e, e);
}
return theCount;
return new LabelAndLanguageCount(labelCount, distinctLanguages.size());
}
private static class LabelAndLanguageCount {
private Integer labelCount;
private Integer languageCount;
public LabelAndLanguageCount(Integer labelCount, Integer languageCount) {
this.labelCount = labelCount;
this.languageCount = languageCount;
}
public Integer getLabelCount() {
return this.labelCount;
}
public Integer getLanguageCount() {
return this.languageCount;
}
}
//what is the number of languages represented across the labels
private static Integer getLanguagesRepresentedCount(String subjectUri, VitroRequest vreq) {
String queryStr = QueryUtils.subUriForQueryVar(DISTINCT_LANGUAGE_QUERY, "subject", subjectUri);
log.debug("queryStr = " + queryStr);
int theCount = 0;
try {
ResultSet results = QueryUtils.getLanguageNeutralQueryResults(queryStr, vreq);
if (results.hasNext()) {
QuerySolution soln = results.nextSolution();
RDFNode languageCount = soln.get("languageCount");
if (languageCount != null && languageCount.isLiteral()) {
theCount = languageCount.asLiteral().getInt();
}
}
} catch (Exception e) {
log.error(e, e);
}
return theCount;
}
// This version not compatible with language-filtering RDF services
// private static Integer getLanguagesRepresentedCount(String subjectUri, VitroRequest vreq) {
// String queryStr = QueryUtils.subUriForQueryVar(DISTINCT_LANGUAGE_QUERY, "subject", subjectUri);
// log.debug("queryStr = " + queryStr);
// int theCount = 0;
// try {
//
// ResultSet results = QueryUtils.getLanguageNeutralQueryResults(queryStr, vreq);
// if (results.hasNext()) {
// QuerySolution soln = results.nextSolution();
// RDFNode languageCount = soln.get("languageCount");
// if (languageCount != null && languageCount.isLiteral()) {
// theCount = languageCount.asLiteral().getInt();
// log.info("Language count is " + theCount);
// }
// }
// } catch (Exception e) {
// log.error(e, e);
// }
// log.info("Returning language count " + theCount);
// return theCount;
// }
private static String PROFILE_TYPE_QUERY = ""
+ "PREFIX display: <http://vitro.mannlib.cornell.edu/ontologies/display/1.1#> \n"

View file

@ -17,6 +17,7 @@ import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URI;
import java.net.URISyntaxException;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@ -34,6 +35,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import edu.cornell.mannlib.vitro.webapp.utils.JSPPageHandler;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@ -290,13 +292,16 @@ public class JenaIngestController extends BaseEditController {
private void processOutputModelRequest(VitroRequest vreq,
HttpServletResponse response) {
String modelNameStr = vreq.getParameter("modelName");
DateTimeFormatter timeStampPattern = DateTimeFormatter.ofPattern("yyyy-MM-dd-HHmmss");
String fileName = FilenameUtils.getName(modelNameStr) + "-" + timeStampPattern.format(java.time.LocalDateTime.now());
Model model = getModel(modelNameStr,vreq);
JenaOutputUtils.setNameSpacePrefixes(model,vreq.getWebappDaoFactory());
model.enterCriticalSection(Lock.READ);
try {
OutputStream out = response.getOutputStream();
response.setContentType("application/x-turtle");
//out.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n".getBytes());
response.setHeader("Content-Transfer-Encoding", "binary");
response.setHeader("Content-disposition", "attachment; filename=" + fileName + ".ttl");
model.write(out, "TTL");
out.flush();
out.close();

View file

@ -4,6 +4,7 @@ package edu.cornell.mannlib.vitro.webapp.controller.json;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import com.fasterxml.jackson.databind.node.ArrayNode;
@ -15,6 +16,7 @@ import org.apache.commons.logging.LogFactory;
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao;
import edu.cornell.mannlib.vitro.webapp.i18n.selection.SelectedLocale;
import edu.cornell.mannlib.vitro.webapp.services.shortview.ShortViewService;
import edu.cornell.mannlib.vitro.webapp.services.shortview.ShortViewService.ShortViewContext;
import edu.cornell.mannlib.vitro.webapp.services.shortview.ShortViewServiceSetup;
@ -73,7 +75,11 @@ public class GetRandomSearchIndividualsByVClass extends GetSearchIndividualsByVC
modelMap.put("individual",
IndividualTemplateModelBuilder.build(individual, vreq));
modelMap.put("vclass", vclassName);
String langCtx = vreq.getLocale().getLanguage(); //UQAM-Linguistic-Management build the linguistic context
if (!vreq.getLocale().getCountry().isEmpty()) {
langCtx += "-" + vreq.getLocale().getCountry();
}
modelMap.put("langCtx", langCtx); // UQAM-Linguistic-Management add the linguistic context to map
ShortViewService svs = ShortViewServiceSetup.getService(ctx);
return svs.renderShortView(individual, ShortViewContext.BROWSE,
modelMap, vreq);

View file

@ -53,6 +53,8 @@ public class DisplayVocabulary {
//specific case for internal class, value is true or false
public static final String RESTRICT_RESULTS_BY_INTERNAL = NS + "restrictResultsByInternalClass";
public static final String HAS_DELETE_QUERY = NS + "hasDeleteQuery";
/* Data Properties */
public static final DatatypeProperty URL_MAPPING = m_model.createDatatypeProperty(NS + "urlMapping");

View file

@ -155,6 +155,7 @@ public class VitroVocabulary {
public static final String USERACCOUNT_LAST_LOGIN_TIME = VITRO_AUTH + "lastLoginTime";
public static final String USERACCOUNT_STATUS = VITRO_AUTH + "status";
public static final String USERACCOUNT_PASSWORD_LINK_EXPIRES = VITRO_AUTH + "passwordLinkExpires";
public static final String USERACCOUNT_EMAIL_KEY = VITRO_AUTH + "emailKey";
public static final String USERACCOUNT_PASSWORD_CHANGE_REQUIRED = VITRO_AUTH + "passwordChangeRequired";
public static final String USERACCOUNT_EXTERNAL_AUTH_ID = VITRO_AUTH + "externalAuthId";
public static final String USERACCOUNT_EXTERNAL_AUTH_ONLY = VITRO_AUTH + "externalAuthOnly";
@ -233,6 +234,9 @@ public class VitroVocabulary {
public static final String IND_MAIN_IMAGE = VITRO_PUBLIC + "mainImage";
public static final String IND_IMAGE = VITRO_PUBLIC + "image";
public static final String STORED_FILE = VITRO_PUBLIC + "storedFile";
public static final String PUBLIC_FILENAME = VITRO_PUBLIC + "publicFilename";
// =============== Date Time with Precision vocabulary ===============
private static final String DATETIME_NS = "http://vivoweb.org/ontology/core#";

View file

@ -5,6 +5,8 @@ package edu.cornell.mannlib.vitro.webapp.dao;
import java.util.List;
import java.util.Set;
import edu.cornell.mannlib.vitro.webapp.i18n.I18nBundle;
public interface WebappDaoFactory {
/**
@ -132,4 +134,6 @@ public interface WebappDaoFactory {
public MenuDao getMenuDao();
public I18nBundle getI18nBundle();
}

View file

@ -5,21 +5,25 @@ package edu.cornell.mannlib.vitro.webapp.dao;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import edu.cornell.mannlib.vitro.webapp.dao.PropertyDao.FullPropertyKey;
import edu.cornell.mannlib.vitro.webapp.rdfservice.filter.LanguageFilteringUtils;
public class WebappDaoFactoryConfig {
private List<String> preferredLanguages;
private List<Locale> preferredLocales;
private String defaultNamespace;
private Set<String> nonUserNamespaces;
private boolean isUnderlyingStoreReasoned = false;
public Map<FullPropertyKey, String> customListViewConfigFileMap;
public WebappDaoFactoryConfig() {
preferredLanguages = Arrays.asList("en-US", "en", "EN");
preferredLanguages = Arrays.asList("en-US", "en", "EN");
preferredLocales = LanguageFilteringUtils.languagesToLocales(preferredLanguages);
defaultNamespace = "http://vitro.mannlib.cornell.edu/ns/default#";
nonUserNamespaces = new HashSet<String>();
nonUserNamespaces.add(VitroVocabulary.vitroURI);
@ -33,6 +37,14 @@ public class WebappDaoFactoryConfig {
this.preferredLanguages = pl;
}
public List<Locale> getPreferredLocales() {
return this.preferredLocales;
}
public void setPreferredLocales(List<Locale> pl) {
this.preferredLocales = pl;
}
public String getDefaultNamespace() {
return defaultNamespace;
}

View file

@ -17,7 +17,7 @@ import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyDao;
import edu.cornell.mannlib.vitro.webapp.dao.InsertException;
import edu.cornell.mannlib.vitro.webapp.dao.filtering.filters.VitroFilters;
class DataPropertyDaoFiltering extends BaseFiltering implements DataPropertyDao{
public class DataPropertyDaoFiltering extends BaseFiltering implements DataPropertyDao{
final DataPropertyDao innerDataPropertyDao;
final VitroFilters filters;

View file

@ -18,7 +18,7 @@ import edu.cornell.mannlib.vitro.webapp.beans.Individual;
import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyStatementDao;
import edu.cornell.mannlib.vitro.webapp.dao.filtering.filters.VitroFilters;
class DataPropertyStatementDaoFiltering extends BaseFiltering implements DataPropertyStatementDao{
public class DataPropertyStatementDaoFiltering extends BaseFiltering implements DataPropertyStatementDao{
final DataPropertyStatementDao innerDataPropertyStatementDao;
final VitroFilters filters;

View file

@ -26,47 +26,34 @@ public class FauxPropertyDaoFiltering extends BaseFiltering implements FauxPrope
@Override
public List<FauxProperty> getFauxPropertiesForBaseUri(String uri) {
// TODO Auto-generated method stub
throw new RuntimeException(
"FauxPropertyDao.getFauxPropertiesForBaseUri() not implemented.");
return innerFauxPropertyDao.getFauxPropertiesForBaseUri(uri);
}
@Override
public FauxProperty getFauxPropertyFromContextUri(String contextUri) {
// TODO Auto-generated method stub
throw new RuntimeException(
"FauxPropertyDaoFiltering.getFauxPropertyFromConfigContextUri() not implemented.");
return innerFauxPropertyDao.getFauxPropertyFromContextUri(contextUri);
}
@Override
public FauxProperty getFauxPropertyByUris(String domainUri, String baseUri,
String rangeUri) {
// TODO Auto-generated method stub
throw new RuntimeException(
"FauxPropertyDaoFiltering.getFauxPropertyByUris() not implemented.");
return innerFauxPropertyDao.getFauxPropertyByUris(domainUri, baseUri,
rangeUri);
}
@Override
public void updateFauxProperty(FauxProperty fp) {
// TODO Auto-generated method stub
throw new RuntimeException("FauxPropertyDaoFiltering.updateFauxProperty() not implemented.");
innerFauxPropertyDao.updateFauxProperty(fp);
}
@Override
public void deleteFauxProperty(FauxProperty fp) {
// TODO Auto-generated method stub
throw new RuntimeException("FauxPropertyDao.deleteFauxProperty() not implemented.");
innerFauxPropertyDao.deleteFauxProperty(fp);
}
@Override
public void insertFauxProperty(FauxProperty fp) {
// TODO Auto-generated method stub
throw new RuntimeException("FauxPropertyDao.insertFauxProperty() not implemented.");
innerFauxPropertyDao.insertFauxProperty(fp);
}
}

View file

@ -20,7 +20,7 @@ import edu.cornell.mannlib.vitro.webapp.dao.filtering.filters.VitroFilters;
import edu.cornell.mannlib.vitro.webapp.edit.EditLiteral;
class IndividualDaoFiltering extends BaseFiltering implements IndividualDao{
public class IndividualDaoFiltering extends BaseFiltering implements IndividualDao{
IndividualDao innerIndividualDao;
VitroFilters filters;

View file

@ -17,7 +17,7 @@ import edu.cornell.mannlib.vitro.webapp.dao.InsertException;
import edu.cornell.mannlib.vitro.webapp.dao.ObjectPropertyDao;
import edu.cornell.mannlib.vitro.webapp.dao.filtering.filters.VitroFilters;
class ObjectPropertyDaoFiltering extends BaseFiltering implements ObjectPropertyDao{
public class ObjectPropertyDaoFiltering extends BaseFiltering implements ObjectPropertyDao{
final ObjectPropertyDao innerObjectPropertyDao;
final VitroFilters filters;

View file

@ -16,7 +16,7 @@ import edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatementImpl;
import edu.cornell.mannlib.vitro.webapp.dao.ObjectPropertyStatementDao;
import edu.cornell.mannlib.vitro.webapp.dao.filtering.filters.VitroFilters;
class ObjectPropertyStatementDaoFiltering extends BaseFiltering implements ObjectPropertyStatementDao{
public class ObjectPropertyStatementDaoFiltering extends BaseFiltering implements ObjectPropertyStatementDao{
final ObjectPropertyStatementDao innerObjectPropertyStatementDao;
final VitroFilters filters;

View file

@ -24,6 +24,7 @@ import edu.cornell.mannlib.vitro.webapp.dao.VClassDao;
import edu.cornell.mannlib.vitro.webapp.dao.VClassGroupDao;
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
import edu.cornell.mannlib.vitro.webapp.dao.filtering.filters.VitroFilters;
import edu.cornell.mannlib.vitro.webapp.i18n.I18nBundle;
/**
* This wraps a WebappDaoFactory and applies filtering.
@ -67,7 +68,7 @@ public class WebappDaoFactoryFiltering implements WebappDaoFactory {
transient private PropertyGroupDao filteringPropertyGroupDao=null;
transient private PropertyInstanceDao filteringPropertyInstanceDao=null;
public WebappDaoFactoryFiltering( WebappDaoFactory innerDao, VitroFilters filters){
public WebappDaoFactoryFiltering(WebappDaoFactory innerDao, VitroFilters filters){
if( innerDao == null )
throw new Error("innerWebappDaoFactory must be non-null");
this.filters = filters;
@ -276,4 +277,9 @@ public class WebappDaoFactoryFiltering implements WebappDaoFactory {
public void close() {
innerWebappDaoFactory.close();
}
@Override
public I18nBundle getI18nBundle() {
return innerWebappDaoFactory.getI18nBundle();
}
}

View file

@ -83,22 +83,21 @@ public class ApplicationDaoJena extends JenaBaseDao implements ApplicationDao {
}
ontModel.enterCriticalSection(Lock.WRITE);
try {
appInd.setLabel(application.getApplicationName(), null);
updatePropertyStringValue(
appInd, APPLICATION_ABOUTTEXT, application.getAboutText(),
ontModel);
updatePropertyStringValue(
updateRDFSLabel(appInd, application.getApplicationName());
updatePlainLiteralValue(
appInd, APPLICATION_ABOUTTEXT, application.getAboutText());
updatePlainLiteralValue(
appInd, APPLICATION_ACKNOWLEGETEXT,
application.getAcknowledgeText(), ontModel);
application.getAcknowledgeText());
updatePropertyStringValue(
appInd, APPLICATION_CONTACTMAIL,
application.getContactMail(), ontModel);
updatePropertyStringValue(
appInd, APPLICATION_CORRECTIONMAIL,
application.getCorrectionMail(), ontModel);
updatePropertyStringValue(
updatePlainLiteralValue(
appInd, APPLICATION_COPYRIGHTANCHOR,
application.getCopyrightAnchor(), ontModel);
application.getCopyrightAnchor());
updatePropertyStringValue(
appInd, APPLICATION_COPYRIGHTURL,
application.getCopyrightURL(), ontModel);

View file

@ -24,6 +24,10 @@ public class BlankNodeFilteringGraph implements Graph {
private Graph graph;
public Graph getInnerGraph() {
return graph;
}
public BlankNodeFilteringGraph(Graph graph) {
this.graph = graph;
}

View file

@ -516,9 +516,9 @@ public class DataPropertyDaoJena extends PropertyDaoJena implements
if (dtp.getFunctional()) {
ontModel.add(jDataprop,RDF.type,OWL.FunctionalProperty);
}
addPropertyStringValue(jDataprop, EXAMPLE, dtp.getExample(), ontModel);
addPropertyStringValue(jDataprop, DESCRIPTION_ANNOT, dtp.getDescription(), ontModel);
addPropertyStringValue(jDataprop, PUBLIC_DESCRIPTION_ANNOT, dtp.getPublicDescription(), ontModel);
updatePlainLiteralValue(jDataprop, EXAMPLE, dtp.getExample());
updatePlainLiteralValue(jDataprop, DESCRIPTION_ANNOT, dtp.getDescription());
updatePlainLiteralValue(jDataprop, PUBLIC_DESCRIPTION_ANNOT, dtp.getPublicDescription());
addPropertyStringValue(jDataprop, EDITING, dtp.getEditing(), ontModel);
addPropertyNonNegativeIntValue(jDataprop, DISPLAY_RANK_ANNOT, dtp.getDisplayTier(), ontModel);
addPropertyNonNegativeIntValue(jDataprop, DISPLAY_LIMIT, dtp.getDisplayLimit(), ontModel);
@ -587,9 +587,9 @@ public class DataPropertyDaoJena extends PropertyDaoJena implements
}
}
updatePropertyStringValue(jDataprop, EXAMPLE, dtp.getExample(), ontModel);
updatePropertyStringValue(jDataprop, DESCRIPTION_ANNOT, dtp.getDescription(), ontModel);
updatePropertyStringValue(jDataprop, PUBLIC_DESCRIPTION_ANNOT, dtp.getPublicDescription(), ontModel);
updatePlainLiteralValue(jDataprop, EXAMPLE, dtp.getExample());
updatePlainLiteralValue(jDataprop, DESCRIPTION_ANNOT, dtp.getDescription());
updatePlainLiteralValue(jDataprop, PUBLIC_DESCRIPTION_ANNOT, dtp.getPublicDescription());
updatePropertyStringValue(jDataprop, EDITING, dtp.getEditing(), ontModel);
updatePropertyNonNegativeIntValue(jDataprop, DISPLAY_RANK_ANNOT, dtp.getDisplayTier(), ontModel);
updatePropertyNonNegativeIntValue(jDataprop, DISPLAY_LIMIT, dtp.getDisplayLimit(), ontModel);

View file

@ -14,6 +14,7 @@ import java.util.List;
import java.util.Random;
import java.util.Set;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.jena.ontology.ObjectProperty;
@ -152,20 +153,22 @@ public class FauxPropertyDaoJena extends JenaBaseDao implements FauxPropertyDao
Collection<String> rangeUris = getPropertyResourceURIValues(
context, QUALIFIED_BY_RANGE);
if (rangeUris.isEmpty()) {
log.debug("'" + contextUri + "' has no value for '"
+ QUALIFIED_BY_RANGE + "'");
return null;
String rangeUri = null;
if (!rangeUris.isEmpty()) {
rangeUri = rangeUris.iterator().next();
}
String rangeUri = rangeUris.iterator().next();
// domainURI is optional.
Collection<String> domainUris = getPropertyResourceURIValues(
context, QUALIFIED_BY_DOMAIN);
String domainUri = domainUris.isEmpty() ? null : domainUris
.iterator().next();
Collection<String> rootRangeUris = getPropertyResourceURIValues(context, QUALIFIED_BY_ROOT);
FauxProperty fp = new FauxProperty(domainUri, baseUri, rangeUri);
if (!rootRangeUris.isEmpty()) {
fp.setRootRangeUri(rootRangeUris.iterator().next());
}
fp.setContextUri(contextUri);
populateInstance(fp);
log.debug("Loaded FauxProperty: " + fp);
@ -214,7 +217,7 @@ public class FauxPropertyDaoJena extends JenaBaseDao implements FauxPropertyDao
addPropertyResourceValue(context, RDF.type, CONFIG_CONTEXT);
addPropertyResourceURIValue(context, CONFIG_CONTEXT_FOR,
fp.getBaseURI());
addPropertyResourceURIValue(context, QUALIFIED_BY_RANGE,
addPropertyResourceURINotEmpty(context, QUALIFIED_BY_RANGE,
fp.getRangeURI());
addPropertyResourceURINotEmpty(context, QUALIFIED_BY_DOMAIN,
fp.getDomainURI());
@ -230,10 +233,9 @@ public class FauxPropertyDaoJena extends JenaBaseDao implements FauxPropertyDao
OBJECT_PROPERTY_DISPLAY_CONFIG);
addPropertyResourceURINotEmpty(config, PROPERTY_GROUP,
fp.getGroupURI());
addPropertyStringValue(config, DISPLAY_NAME, fp.getDisplayName(),
displayModel);
addPropertyStringValue(config, PUBLIC_DESCRIPTION_ANNOT,
fp.getPublicDescription(), displayModel);
updatePlainLiteralValue(config, DISPLAY_NAME, fp.getDisplayName());
updatePlainLiteralValue(config, PUBLIC_DESCRIPTION_ANNOT,
fp.getPublicDescription());
addPropertyIntValue(config, DISPLAY_RANK_ANNOT,
fp.getDisplayTier(), displayModel);
addPropertyIntValue(config, DISPLAY_LIMIT, fp.getDisplayLimit(),
@ -328,10 +330,10 @@ public class FauxPropertyDaoJena extends JenaBaseDao implements FauxPropertyDao
.getConfigUri());
updatePropertyResourceURIValue(config, PROPERTY_GROUP,
fp.getGroupURI());
updatePropertyStringValue(config, DISPLAY_NAME,
fp.getDisplayName(), displayModel);
updatePropertyStringValue(config, PUBLIC_DESCRIPTION_ANNOT,
fp.getPublicDescription(), displayModel);
updatePlainLiteralValue(config, DISPLAY_NAME,
fp.getDisplayName());
updatePlainLiteralValue(config, PUBLIC_DESCRIPTION_ANNOT,
fp.getPublicDescription());
updatePropertyIntValue(config, DISPLAY_RANK_ANNOT,
fp.getDisplayTier(), displayModel);
updatePropertyIntValue(config, DISPLAY_LIMIT, fp.getDisplayLimit(),
@ -494,31 +496,22 @@ public class FauxPropertyDaoJena extends JenaBaseDao implements FauxPropertyDao
// ConfigContext
// ----------------------------------------------------------------------
private static final String QUERY_LOCATE_CONFIG_CONTEXT_WITH_DOMAIN = "" //
+ "PREFIX : <http://vitro.mannlib.cornell.edu/ns/vitro/ApplicationConfiguration#> \n" //
+ "\n" //
+ "SELECT DISTINCT ?context ?config \n" //
+ "WHERE { \n" //
+ " ?context a :ConfigContext ; \n" //
+ " :configContextFor ?baseUri ; \n" //
+ " :qualifiedByDomain ?domainUri ; \n" //
+ " :qualifiedBy ?rangeUri ; \n" //
+ " :hasConfiguration ?config . \n" //
+ "} \n"; //
private static String queryLocateConfigContext(boolean hasDomain, boolean hasRange) {
return "PREFIX : <http://vitro.mannlib.cornell.edu/ns/vitro/ApplicationConfiguration#> \n"
+ "SELECT DISTINCT ?context ?config \n"
+ "WHERE { \n"
+ " ?context a :ConfigContext . \n"
+ " ?context :configContextFor ?baseUri . \n"
+ ( hasDomain ? "" : " FILTER NOT EXISTS { \n " )
+ " ?context :qualifiedByDomain ?domainUri . \n"
+ ( hasDomain ? "" : "} \n" )
+ ( hasRange ? "" : " FILTER NOT EXISTS { \n " )
+ " ?context :qualifiedBy ?rangeUri . \n"
+ ( hasRange ? "" : "} \n" )
+ " ?context :hasConfiguration ?config . \n"
+ "} \n";
private static final String QUERY_LOCATE_CONFIG_CONTEXT_WITH_NO_DOMAIN = "" //
+ "PREFIX : <http://vitro.mannlib.cornell.edu/ns/vitro/ApplicationConfiguration#> \n" //
+ "\n" //
+ "SELECT DISTINCT ?context ?config \n" //
+ "WHERE { \n" //
+ " ?context a :ConfigContext ; \n" //
+ " :configContextFor ?baseUri ; \n" //
+ " :qualifiedBy ?rangeUri ; \n" //
+ " :hasConfiguration ?config . \n" //
+ " FILTER NOT EXISTS { \n" //
+ " ?context :qualifiedByDomain ?domainUri \n" //
+ " } \n" //
+ "} \n"; //
}
private static class ParserLocateConfigContext extends
ResultSetParser<Set<ConfigContext>> {
@ -557,22 +550,16 @@ public class FauxPropertyDaoJena extends JenaBaseDao implements FauxPropertyDao
private static class ConfigContext {
public static Set<ConfigContext> findByQualifiers(
LockableOntModel lockableDisplayModel, String domainUri,
String baseUri, String rangeUri) {
LockableOntModel lockableDisplayModel, String domainUri, String baseUri, String rangeUri) {
try (LockedOntModel displayModel = lockableDisplayModel.read()) {
QueryHolder qHolder;
if (domainUri == null || domainUri.trim().isEmpty()
|| domainUri.equals(OWL.Thing.getURI())) {
qHolder = queryHolder(
QUERY_LOCATE_CONFIG_CONTEXT_WITH_NO_DOMAIN)
.bindToUri("baseUri", baseUri).bindToUri(
"rangeUri", rangeUri);
} else {
qHolder = queryHolder(
QUERY_LOCATE_CONFIG_CONTEXT_WITH_DOMAIN)
.bindToUri("baseUri", baseUri)
.bindToUri("rangeUri", rangeUri)
.bindToUri("domainUri", domainUri);
boolean hasDomain = !StringUtils.isEmpty(domainUri) && !domainUri.equals(OWL.Thing.getURI());
boolean hasRange = !StringUtils.isEmpty(rangeUri);
QueryHolder qHolder = queryHolder(queryLocateConfigContext(hasDomain, hasRange)).bindToUri("baseUri", baseUri);
if (hasDomain) {
qHolder = qHolder.bindToUri("domainUri", domainUri);
}
if (hasRange) {
qHolder = qHolder.bindToUri("rangeUri", rangeUri);
}
if (log.isDebugEnabled()) {
log.debug("domainUri=" + domainUri + ", baseUri=" + baseUri

View file

@ -14,6 +14,7 @@ import java.util.Random;
import java.util.Set;
import org.apache.commons.lang3.NotImplementedException;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@ -286,15 +287,14 @@ public class IndividualDaoJena extends JenaBaseDao implements IndividualDao {
ontModel.getBaseModel().notifyEvent(new IndividualUpdateEvent(getWebappDaoFactory().getUserURI(),true,ent.getURI()));
org.apache.jena.ontology.Individual ind = ontModel.getIndividual(ent.getURI());
if (ind != null) {
if (ent.getName() != null && ( (ind.getLabel(getDefaultLanguage())==null) || (ind.getLabel(getDefaultLanguage())!=null && ent.getName()!=null && !ent.getName().equals(ind.getLabel(getDefaultLanguage())) ) ) ) {
// removal of existing values done this odd way to trigger
// the change listeners
Model temp = ModelFactory.createDefaultModel();
temp.add(ontModel.listStatements(ind, RDFS.label, (RDFNode) null));
ontModel.remove(temp);
ind.setLabel(ent.getName(), getDefaultLanguage());
String newLabel = ent.getName();
String oldLabel = ind.getLabel(getDefaultLanguage());
if ( newLabel != null && !newLabel.equals(oldLabel) ) {
if (oldLabel == null) {
oldLabel = "";
}
replaceOldLabelWithNewInDefaultLanguage(ontModel, ind, newLabel, oldLabel);
}
Set<String> oldTypeURIsSet = new HashSet<String>();
for (Iterator<Resource> typeIt = ind.listRDFTypes(true); typeIt.hasNext();) {
@ -347,6 +347,23 @@ public class IndividualDaoJena extends JenaBaseDao implements IndividualDao {
}
}
private void replaceOldLabelWithNewInDefaultLanguage(OntModel ontModel, org.apache.jena.ontology.Individual ind,
final String newLabel, final String oldLabel) {
Model temp = ModelFactory.createDefaultModel();
StmtIterator statements = ontModel.listStatements(ind, RDFS.label, (RDFNode) null);
while (statements.hasNext()) {
Statement statement = (Statement) statements.next();
Literal object = statement.getLiteral();
String lexicalForm = object.getLexicalForm();
String language = object.getLanguage();
if (oldLabel.equals(lexicalForm) && language.equals(getDefaultLanguage()) ) {
temp.add(statement);
}
}
ontModel.remove(temp);
ind.addLabel(newLabel, getDefaultLanguage());
}
public void markModified(Individual ind) {
markModified(ind,getOntModel());
}

View file

@ -5,8 +5,8 @@ package edu.cornell.mannlib.vitro.webapp.dao.jena;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashSet;
@ -14,14 +14,14 @@ import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.jena.iri.IRI;
import org.apache.jena.iri.IRIFactory;
import org.apache.jena.datatypes.xsd.XSDDatatype;
import org.apache.jena.graph.Node;
import org.apache.jena.graph.NodeFactory;
import org.apache.jena.iri.IRI;
import org.apache.jena.iri.IRIFactory;
import org.apache.jena.ontology.DatatypeProperty;
import org.apache.jena.ontology.ObjectProperty;
import org.apache.jena.ontology.OntClass;
@ -39,6 +39,7 @@ import org.apache.jena.rdf.model.NodeIterator;
import org.apache.jena.rdf.model.Property;
import org.apache.jena.rdf.model.RDFNode;
import org.apache.jena.rdf.model.Resource;
import org.apache.jena.rdf.model.ResourceFactory;
import org.apache.jena.rdf.model.Statement;
import org.apache.jena.rdf.model.StmtIterator;
import org.apache.jena.shared.Lock;
@ -642,7 +643,7 @@ public class JenaBaseDao extends JenaBaseDaoCon {
if (existingValue == null ) {
model.add(res, prop, model.createResource(uri));
} else if (!(existingValue.getURI()).equals(uri)) {
} else if (!isEqual(uri, existingValue)) {
model.removeAll(res, prop, null);
model.add(res, prop, model.createResource(uri));
}
@ -650,6 +651,15 @@ public class JenaBaseDao extends JenaBaseDaoCon {
}
}
private boolean isEqual(String uri, Resource existingValue) {
if (existingValue.asNode().isBlank()) {
final String blankNodeId = existingValue.asNode().getBlankNodeId().toString();
return uri.endsWith(blankNodeId);
} else {
return existingValue.getURI().equals(uri);
}
}
/**
* convenience method for use with functional object properties
*/
@ -752,22 +762,111 @@ public class JenaBaseDao extends JenaBaseDaoCon {
}
}
}
/**
* Add to an OntResource an rdfs:label value with lexical form and default
* language tag. Remove any other existing values in default language.
* If lexicalForm parameter is null, remove all plain literal values of
* Property in default language.
* @param ontRes may not be null
* @param lexicalForm may be null. If null, existing values will be deleted
* but none will be added.
*/
protected void updateRDFSLabel(OntResource ontRes, String lexicalForm) {
updatePlainLiteralValue(ontRes, RDFS.label, lexicalForm);
}
/**
* Add to an OntResource an rdfs:label value with lexical form and optional
* language tag. Remove any other existing plain literal values that match
* specified language or lack language tags if no language is supplied.
* If lexicalForm parameter is null, remove all plain literal labels in
* specified language, or all existing language-less labels
* if no language is specified.
* @param ontRes may not be null
* @param lexicalForm may be null. If null, existing values will be deleted
* but none will be added.
* @param lang may be null. If null, method acts on language-less plain
* literal labels and ignores those with language tags.
*/
protected void updateRDFSLabel(OntResource ontRes, String lexicalForm, String lang) {
updatePlainLiteralValue(ontRes, RDFS.label, lexicalForm, lang);
}
/**
* convenience method for updating the RDFS label
* Add to an OntResource a Property value with lexical form and default
* language tag. Remove any other existing values in default language.
* If lexicalForm parameter is null, remove all plain literal values of
* Property in default language.
* @param ontRes may not be null
* @param lexicalForm may be null. If null, existing values will be deleted
* but none will be added.
*/
protected void updateRDFSLabel(OntResource ontRes, String label) {
if (label != null && label.length() > 0) {
String existingValue = ontRes.getLabel(getDefaultLanguage());
if (existingValue == null || !existingValue.equals(label)) {
ontRes.setLabel(label, getDefaultLanguage());
}
} else {
ontRes.removeAll(RDFS.label);
}
protected void updatePlainLiteralValue(OntResource ontRes, Property property,
String lexicalForm) {
updatePlainLiteralValue(ontRes, property, lexicalForm, getDefaultLanguage());
}
/**
* Add to an OntResource a Property value with lexical form and optional
* language tag. Remove any other existing plain literal values that match
* specified language or lack language tags if no language is supplied.
* If lexicalForm parameter is null, remove all plain literal values of
* Property in specified language, or all existing language-less literals
* if no language is specified.
* @param ontRes may not be null
* @param lexicalForm may be null. If null, existing values will be deleted
* but none will be added.
* @param lang may be null. If null, method acts on language-less
* plain literal values and ignores those with language tags.
*/
protected void updatePlainLiteralValue(OntResource ontRes, Property property,
String lexicalForm, String lang) {
if(ontRes == null) {
throw new IllegalArgumentException("ontRes may not be null.");
}
boolean addNew = true;
List<Statement> toRemove = new ArrayList<Statement>();
StmtIterator existingStmts = ontRes.listProperties(property);
while(existingStmts.hasNext()) {
Statement stmt = existingStmts.next();
if(stmt.getObject().isLiteral()) {
Literal lit = stmt.getObject().asLiteral();
if( (lang == null && isLanguageLessPlainLiteral(lit))
|| (lang != null && lang.equals(lit.getLanguage())) ) {
if(!lit.getLexicalForm().equals(lexicalForm)) {
toRemove.add(stmt);
} else {
// New literal already exists in the model.
// Do not add it again.
addNew = false;
}
}
}
}
if(!toRemove.isEmpty()) {
ontRes.getModel().remove(toRemove);
}
if (addNew && (lexicalForm != null)) {
if(!StringUtils.isEmpty(lang)) {
ontRes.addProperty(property, ResourceFactory.createLangLiteral(
lexicalForm, lang));
} else {
ontRes.addProperty(property, ResourceFactory.createPlainLiteral(
lexicalForm));
}
}
}
private boolean isLanguageLessPlainLiteral(Literal lit) {
// In RDF 1.1 all the language-less literals get datatype xsd:string.
// The null datatype check is here just in case this gets run on an older
// version of Jena. rdf:PlainLiteral is also a datatype, but doesn't
// (yet) seem to be used by Jena.
return StringUtils.isEmpty(lit.getLanguage())
&& ((lit.getDatatype() == null)
|| XSDDatatype.XSDstring.equals(lit.getDatatype()) ||
(RDF.getURI() + "PlainLiteral").equals(lit.getDatatypeURI()));
}
private Literal getLabel(String lang, List<RDFNode>labelList) {
@ -780,6 +879,13 @@ public class JenaBaseDao extends JenaBaseDaoCon {
}
if ((lang != null) && (lang.equals(labelLanguage))) {
return labelLit;
} else
/*
* UQAM-Linguistic-Management
* Check for country-part of lang (ex: 'en' for default consideration of labelLanguage in english but not encoded by 'en-US' most case of labels in vivo.owl)
*/
if ((lang != null) && (Arrays.asList(lang.split("-")).get(0).equals(labelLanguage))) {
return labelLit;
}
}
}

View file

@ -121,6 +121,7 @@ public class JenaBaseDaoCon {
protected DatatypeProperty USERACCOUNT_LAST_LOGIN_TIME = _constModel.createDatatypeProperty(VitroVocabulary.USERACCOUNT_LAST_LOGIN_TIME);
protected DatatypeProperty USERACCOUNT_STATUS = _constModel.createDatatypeProperty(VitroVocabulary.USERACCOUNT_STATUS);
protected DatatypeProperty USERACCOUNT_PASSWORD_LINK_EXPIRES = _constModel.createDatatypeProperty(VitroVocabulary.USERACCOUNT_PASSWORD_LINK_EXPIRES);
protected DatatypeProperty USERACCOUNT_EMAIL_KEY = _constModel.createDatatypeProperty(VitroVocabulary.USERACCOUNT_EMAIL_KEY);
protected DatatypeProperty USERACCOUNT_PASSWORD_CHANGE_REQUIRED = _constModel.createDatatypeProperty(VitroVocabulary.USERACCOUNT_PASSWORD_CHANGE_REQUIRED);
protected DatatypeProperty USERACCOUNT_EXTERNAL_AUTH_ID = _constModel.createDatatypeProperty(VitroVocabulary.USERACCOUNT_EXTERNAL_AUTH_ID);
protected DatatypeProperty USERACCOUNT_EXTERNAL_AUTH_ONLY = _constModel.createDatatypeProperty(VitroVocabulary.USERACCOUNT_EXTERNAL_AUTH_ONLY);

View file

@ -2,15 +2,17 @@
package edu.cornell.mannlib.vitro.webapp.dao.jena;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ConcurrentLinkedQueue;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.jena.graph.Triple;
import org.apache.jena.ontology.Individual;
import org.apache.jena.ontology.OntClass;
import org.apache.jena.ontology.OntModel;
@ -21,12 +23,16 @@ import org.apache.jena.query.Query;
import org.apache.jena.query.QueryExecution;
import org.apache.jena.query.QueryExecutionFactory;
import org.apache.jena.query.QueryFactory;
import org.apache.jena.query.QuerySolution;
import org.apache.jena.query.ResultSet;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.ModelFactory;
import org.apache.jena.rdf.model.Property;
import org.apache.jena.rdf.model.RDFNode;
import org.apache.jena.rdf.model.Resource;
import org.apache.jena.rdf.model.ResourceFactory;
import org.apache.jena.rdf.model.Statement;
import org.apache.jena.rdf.model.StmtIterator;
import org.apache.jena.shared.Lock;
import org.apache.jena.vocabulary.OWL;
import org.apache.jena.vocabulary.RDF;
@ -39,6 +45,8 @@ import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactoryConfig;
public class JenaModelUtils {
public static final String BNODE_ROOT_QUERY =
"SELECT DISTINCT ?s WHERE { ?s ?p ?o OPTIONAL { ?ss ?pp ?s } FILTER (!isBlank(?s) || !bound(?ss)) }";
private static final Log log = LogFactory.getLog(JenaModelUtils.class.getName());
private static final Set<String> nonIndividualTypeURIs ;
@ -398,5 +406,190 @@ public class JenaModelUtils {
return aboxModel;
}
/**
* Remove statements from a model by separating statements
* containing blank nodes from those that have no blank nodes.
* The blank node statements are removed by treating blank nodes as variables and
* constructing the matching subgraphs for deletion.
* The other statements are removed normally.
* @param toRemove containing statements to be removed
* @param removeFrom from which statements should be removed
*/
public static void removeWithBlankNodesAsVariables(Model toRemove, Model removeFrom) {
List<Statement> blankNodeStatements = new ArrayList<Statement>();
List<Statement> nonBlankNodeStatements = new ArrayList<Statement>();
StmtIterator stmtIt = toRemove.listStatements();
while (stmtIt.hasNext()) {
Statement stmt = stmtIt.nextStatement();
if (stmt.getSubject().isAnon() || stmt.getObject().isAnon()) {
blankNodeStatements.add(stmt);
} else {
nonBlankNodeStatements.add(stmt);
}
}
if(!blankNodeStatements.isEmpty()) {
Model blankNodeModel = ModelFactory.createDefaultModel();
blankNodeModel.add(blankNodeStatements);
removeBlankNodesUsingSparqlConstruct(blankNodeModel, removeFrom);
}
if(!nonBlankNodeStatements.isEmpty()) {
try {
removeFrom.enterCriticalSection(Lock.WRITE);
removeFrom.remove(nonBlankNodeStatements);
} finally {
removeFrom.leaveCriticalSection();
}
}
}
private static void removeBlankNodesUsingSparqlConstruct(Model blankNodeModel,
Model removeFrom) {
log.debug("blank node model size " + blankNodeModel.size());
if (blankNodeModel.size() == 1) {
log.debug("Deleting single triple with blank node: " + blankNodeModel);
log.debug("This could result in the deletion of multiple triples"
+ " if multiple blank nodes match the same triple pattern.");
}
Query rootFinderQuery = QueryFactory.create(BNODE_ROOT_QUERY);
QueryExecution qe = QueryExecutionFactory.create(rootFinderQuery, blankNodeModel);
try {
ResultSet rs = qe.execSelect();
while (rs.hasNext()) {
QuerySolution qs = rs.next();
Resource s = qs.getResource("s");
String treeFinder = makeDescribe(s);
Query treeFinderQuery = QueryFactory.create(treeFinder);
QueryExecution qee = QueryExecutionFactory.create(treeFinderQuery, blankNodeModel);
try {
Model tree = qee.execDescribe();
JenaModelUtils.removeUsingSparqlConstruct(tree, removeFrom);
} finally {
qee.close();
}
}
} finally {
qe.close();
}
}
private static String makeDescribe(Resource s) {
StringBuilder query = new StringBuilder("DESCRIBE <") ;
if (s.isAnon()) {
query.append("_:").append(s.getId().toString());
} else {
query.append(s.getURI());
}
query.append(">");
return query.toString();
}
private static final boolean WHERE_CLAUSE = true;
/**
* Remove statements from a model by first constructing
* the statements to be removed with a SPARQL query that treats
* each blank node ID as a variable.
* This allows matching blank node structures to be removed even though
* the internal blank node IDs are different.
* @param toRemove containing statements to be removed
* @param removeFrom from which statements should be removed
*/
public static void removeUsingSparqlConstruct(Model toRemove, Model removeFrom) {
if(toRemove.isEmpty()) {
return;
}
List<Statement> stmts = toRemove.listStatements().toList();
stmts = sort(stmts);
StringBuffer queryBuff = new StringBuffer();
queryBuff.append("CONSTRUCT { \n");
addStatementPatterns(stmts, queryBuff, !WHERE_CLAUSE);
queryBuff.append("} WHERE { \n");
addStatementPatterns(stmts, queryBuff, WHERE_CLAUSE);
queryBuff.append("} \n");
String queryStr = queryBuff.toString();
log.debug(queryBuff.toString());
Query construct = QueryFactory.create(queryStr);
QueryExecution qe = QueryExecutionFactory.create(construct, removeFrom);
try {
Model constructedRemovals = qe.execConstruct();
try {
removeFrom.enterCriticalSection(Lock.WRITE);
removeFrom.remove(constructedRemovals);
} finally {
removeFrom.leaveCriticalSection();
}
} finally {
qe.close();
}
}
private static List<Statement> sort(List<Statement> stmts) {
List<Statement> output = new ArrayList<Statement>();
int originalSize = stmts.size();
if(originalSize == 1) {
return stmts;
}
List <Statement> remaining = stmts;
ConcurrentLinkedQueue<Resource> subjQueue = new ConcurrentLinkedQueue<Resource>();
for(Statement stmt : remaining) {
if(stmt.getSubject().isURIResource()) {
subjQueue.add(stmt.getSubject());
break;
}
}
if (subjQueue.isEmpty()) {
log.warn("No named subject in statement patterns");
return stmts;
}
while(remaining.size() > 0) {
if(subjQueue.isEmpty()) {
subjQueue.add(remaining.get(0).getSubject());
}
while(!subjQueue.isEmpty()) {
Resource subj = subjQueue.poll();
List<Statement> temp = new ArrayList<Statement>();
for (Statement stmt : remaining) {
if(stmt.getSubject().equals(subj)) {
output.add(stmt);
if (stmt.getObject().isResource()) {
subjQueue.add((Resource) stmt.getObject());
}
} else {
temp.add(stmt);
}
}
remaining = temp;
}
}
if(output.size() != originalSize) {
throw new RuntimeException("original list size was " + originalSize +
" but sorted size is " + output.size());
}
return output;
}
private static void addStatementPatterns(List<Statement> stmts,
StringBuffer patternBuff, boolean whereClause) {
for(Statement stmt : stmts) {
Triple t = stmt.asTriple();
patternBuff.append(SparqlGraph.sparqlNodeDelete(t.getSubject(), null));
patternBuff.append(" ");
patternBuff.append(SparqlGraph.sparqlNodeDelete(t.getPredicate(), null));
patternBuff.append(" ");
patternBuff.append(SparqlGraph.sparqlNodeDelete(t.getObject(), null));
patternBuff.append(" .\n");
if (whereClause) {
if (t.getSubject().isBlank()) {
patternBuff.append(" FILTER(isBlank(").append(
SparqlGraph.sparqlNodeDelete(t.getSubject(), null)).append(")) \n");
}
if (t.getObject().isBlank()) {
patternBuff.append(" FILTER(isBlank(").append(
SparqlGraph.sparqlNodeDelete(t.getObject(), null)).append(")) \n");
}
}
}
}
}

View file

@ -72,6 +72,7 @@ public class MenuDaoJena extends JenaBaseDao implements MenuDao {
return getMenu( getOntModelSelector().getDisplayModel(), url );
}
@Override
public MainMenu getMainMenu( ServletRequest req, String url ) {
OntModel displayModel = LanguageFilteringUtils.wrapOntModelInALanguageFilter(getOntModelSelector().getDisplayModel(), req );
return getMenu(displayModel, url) ;

View file

@ -714,14 +714,14 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp
}
}
updatePropertyStringValue(p,EXAMPLE_ANNOT,prop.getExample(),getOntModel());
updatePropertyStringValue(p,DESCRIPTION_ANNOT,prop.getDescription(),getOntModel());
updatePropertyStringValue(p,PUBLIC_DESCRIPTION_ANNOT,prop.getPublicDescription(),getOntModel());
updatePlainLiteralValue(p, EXAMPLE_ANNOT, prop.getExample());
updatePlainLiteralValue(p, DESCRIPTION_ANNOT, prop.getDescription());
updatePlainLiteralValue(p, PUBLIC_DESCRIPTION_ANNOT, prop.getPublicDescription());
updatePropertyNonNegativeIntegerValue(p,DISPLAY_LIMIT,prop.getDomainDisplayLimitInteger(),getOntModel());
updatePropertyStringValue(p,PROPERTY_ENTITYSORTDIRECTION,prop.getDomainEntitySortDirection(),getOntModel());
if (inv != null) {
updatePropertyStringValue(inv,EXAMPLE_ANNOT,prop.getExample(),getOntModel());
updatePropertyStringValue(inv,DESCRIPTION_ANNOT,prop.getDescription(),getOntModel());
updatePlainLiteralValue(inv, EXAMPLE_ANNOT, prop.getExample());
updatePlainLiteralValue(inv, DESCRIPTION_ANNOT, prop.getDescription());
updatePropertyNonNegativeIntegerValue(inv,DISPLAY_LIMIT,prop.getRangeDisplayLimitInteger(),getOntModel());
updatePropertyStringValue(inv,PROPERTY_ENTITYSORTDIRECTION,prop.getRangeEntitySortDirection(),getOntModel());
}

View file

@ -813,7 +813,9 @@ public class PropertyDaoJena extends JenaBaseDao implements PropertyDao {
List<ObjectProperty> stragglers = getAdditionalFauxSubpropertiesForVClasses(
vclasses, propInsts);
for (ObjectProperty op : stragglers) {
propInsts.add(makePropInst(op));
if (op != null) {
propInsts.add(makePropInst(op));
}
}
return propInsts;

View file

@ -31,6 +31,7 @@ import edu.cornell.mannlib.vitro.webapp.dao.InsertException;
import edu.cornell.mannlib.vitro.webapp.dao.ObjectPropertyDao;
import edu.cornell.mannlib.vitro.webapp.dao.PropertyGroupDao;
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactoryConfig;
public class PropertyGroupDaoJena extends JenaBaseDao implements PropertyGroupDao {
@ -142,7 +143,7 @@ public class PropertyGroupDaoJena extends JenaBaseDao implements PropertyGroupDa
edu.cornell.mannlib.vitro.webapp.beans.Individual groupInd =
new IndividualImpl(); // We should make a factory for these
groupInd.setNamespace(DEFAULT_NAMESPACE+"vitroPropertyGroup");
groupInd.setNamespace(DEFAULT_NAMESPACE + "vitroPropertyGroup");
groupInd.setName(group.getName());
groupInd.setVClassURI(PROPERTYGROUP.getURI());
groupInd.setURI(group.getURI());
@ -156,8 +157,12 @@ public class PropertyGroupDaoJena extends JenaBaseDao implements PropertyGroupDa
WebappDaoFactory wadfForURIGeneration = null;
try {
wadfForURIGeneration = new WebappDaoFactoryJena(
unionForURIGeneration);
// Ensure that the temporary WebappDaoFactory has the same
// preferred languages as the main one for this DAO.
WebappDaoFactoryConfig wadfConfig = new WebappDaoFactoryConfig();
wadfConfig.setPreferredLanguages(getWebappDaoFactory().getPreferredLanguages());
wadfForURIGeneration = new WebappDaoFactoryJena(new SimpleOntModelSelector(
unionForURIGeneration), wadfConfig, null);
groupURI = wadfForURIGeneration
.getIndividualDao().insertNewIndividual(groupInd);
} catch (InsertException ie) {
@ -183,11 +188,9 @@ public class PropertyGroupDaoJena extends JenaBaseDao implements PropertyGroupDa
if (group.getPublicDescription() != null
&& group.getPublicDescription().length()>0) {
try {
groupJenaInd.addProperty(
PUBLIC_DESCRIPTION_ANNOT,
group.getPublicDescription(),
XSDDatatype.XSDstring);
} catch (Exception ex) {
updatePlainLiteralValue(groupJenaInd, PUBLIC_DESCRIPTION_ANNOT,
group.getPublicDescription(), getDefaultLanguage());
} catch (Exception ex) {
log.error(
"error setting public description for "
+ groupInd.getURI());
@ -225,15 +228,13 @@ public class PropertyGroupDaoJena extends JenaBaseDao implements PropertyGroupDa
try {
Individual groupInd = ontModel.getIndividual(group.getURI());
try {
groupInd.setLabel(group.getName(), getDefaultLanguage());
updateRDFSLabel(groupInd, group.getName(), getDefaultLanguage());
} catch (Exception e) {
log.error("error updating name for "+groupInd.getURI());
}
try {
groupInd.removeAll(PUBLIC_DESCRIPTION_ANNOT);
if (group.getPublicDescription()!=null && group.getPublicDescription().length()>0) {
groupInd.addProperty(PUBLIC_DESCRIPTION_ANNOT, group.getPublicDescription(), XSDDatatype.XSDstring);
}
updatePlainLiteralValue(groupInd, PUBLIC_DESCRIPTION_ANNOT,
group.getPublicDescription(), getDefaultLanguage());
} catch (Exception e) {
log.error("Error updating public description for "+groupInd.getURI());
}

View file

@ -12,10 +12,10 @@ import java.util.function.Supplier;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.jena.graph.Capabilities;
import org.apache.jena.graph.Graph;
import org.apache.jena.graph.GraphEventManager;
import org.apache.jena.graph.GraphListener;
import org.apache.jena.graph.GraphStatisticsHandler;
import org.apache.jena.graph.Node;
import org.apache.jena.graph.TransactionHandler;
@ -23,7 +23,6 @@ import org.apache.jena.graph.Triple;
import org.apache.jena.graph.impl.GraphWithPerform;
import org.apache.jena.graph.impl.SimpleEventManager;
import org.apache.jena.query.QuerySolution;
import org.apache.jena.rdf.listeners.StatementListener;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.ModelFactory;
import org.apache.jena.rdf.model.StmtIterator;
@ -290,10 +289,15 @@ public class RDFServiceGraph implements GraphWithPerform {
literalBuff.append("\"");
pyString(literalBuff, node.getLiteralLexicalForm());
literalBuff.append("\"");
if (node.getLiteralDatatypeURI() != null) {
literalBuff.append("^^<").append(node.getLiteralDatatypeURI()).append(">");
} else if (!StringUtils.isEmpty(node.getLiteralLanguage())) {
/*
* UQAM-Bug-Correction
* reversing the condition tests.
* It is important to prioritize the language typology test in order to exploit the linguistic context in testing the type of data
*/
if (!StringUtils.isEmpty(node.getLiteralLanguage())) {
literalBuff.append("@").append(node.getLiteralLanguage());
} else if (node.getLiteralDatatypeURI() != null) {
literalBuff.append("^^<").append(node.getLiteralDatatypeURI()).append(">");
}
return literalBuff.toString();
} else {
@ -404,7 +408,18 @@ public class RDFServiceGraph implements GraphWithPerform {
@Override
public GraphEventManager getEventManager() {
if (eventManager == null) {
eventManager = new SimpleEventManager(this);
eventManager = new SimpleEventManager() {
@Override
public void notifyEvent(Graph g, Object event) {
ChangeSet changeSet = rdfService.manufactureChangeSet();
changeSet.addPreChangeEvent(event);
try {
rdfService.changeSetUpdate(changeSet);
} catch (RDFServiceException e) {
throw new RuntimeException(e);
}
}
};
}
return eventManager;
}
@ -590,21 +605,7 @@ public class RDFServiceGraph implements GraphWithPerform {
}
public static Model createRDFServiceModel(final RDFServiceGraph g) {
Model m = VitroModelFactory.createModelForGraph(g);
m.register(new StatementListener() {
@Override
public void notifyEvent(Model m, Object event) {
ChangeSet changeSet = g.getRDFService().manufactureChangeSet();
changeSet.addPreChangeEvent(event);
try {
g.getRDFService().changeSetUpdate(changeSet);
} catch (RDFServiceException e) {
throw new RuntimeException(e);
}
}
});
return m;
return VitroModelFactory.createModelForGraph(g);
}
@Override

View file

@ -2,6 +2,7 @@
package edu.cornell.mannlib.vitro.webapp.dao.jena;
import java.text.Collator;
import java.util.Set;
import java.util.TreeSet;
@ -17,7 +18,6 @@ import org.apache.jena.shared.CannotCreateException;
import org.apache.jena.shared.DoesNotExistException;
import org.apache.jena.util.iterator.ExtendedIterator;
import org.apache.jena.util.iterator.WrappedIterator;
import com.ibm.icu.text.Collator;
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService;
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFServiceException;
@ -103,7 +103,7 @@ public class RDFServiceModelMaker implements ModelMaker {
@Override
public void removeModel(String name) {
Model m = getModel(name);
m.removeAll(null, null, null);
m.removeAll();
}
@Override

View file

@ -232,10 +232,10 @@ public class SparqlGraph implements GraphWithPerform {
literalBuff.append("\"");
pyString(literalBuff, node.getLiteralLexicalForm());
literalBuff.append("\"");
if (node.getLiteralDatatypeURI() != null) {
literalBuff.append("^^<").append(node.getLiteralDatatypeURI()).append(">");
} else if (!StringUtils.isEmpty(node.getLiteralLanguage())) {
if (!StringUtils.isEmpty(node.getLiteralLanguage())) {
literalBuff.append("@").append(node.getLiteralLanguage());
} else if (node.getLiteralDatatypeURI() != null) {
literalBuff.append("^^<").append(node.getLiteralDatatypeURI()).append(">");
}
return literalBuff.toString();
} else {

View file

@ -4,7 +4,6 @@ package edu.cornell.mannlib.vitro.webapp.dao.jena;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Random;
@ -98,6 +97,8 @@ public class UserAccountsDaoJena extends JenaBaseDao implements UserAccountsDao
u.setOldPassword(getPropertyStringValue(r, USERACCOUNT_OLD_PASSWORD));
u.setPasswordLinkExpires(getPropertyLongValue(r,
USERACCOUNT_PASSWORD_LINK_EXPIRES));
u.setEmailKey(getPropertyStringValue(r,USERACCOUNT_EMAIL_KEY));
u.setPasswordChangeRequired(getPropertyBooleanValue(r,
USERACCOUNT_PASSWORD_CHANGE_REQUIRED));
u.setExternalAuthOnly(getPropertyBooleanValue(r,
@ -240,6 +241,8 @@ public class UserAccountsDaoJena extends JenaBaseDao implements UserAccountsDao
userAccount.getLoginCount(), model);
addPropertyLongValue(res, USERACCOUNT_LAST_LOGIN_TIME,
userAccount.getLastLoginTime(), model);
addPropertyStringValue(res, USERACCOUNT_EMAIL_KEY,
userAccount.getEmailKey(), model);
if (userAccount.getStatus() != null) {
addPropertyStringValue(res, USERACCOUNT_STATUS, userAccount
.getStatus().toString(), model);
@ -306,6 +309,8 @@ public class UserAccountsDaoJena extends JenaBaseDao implements UserAccountsDao
userAccount.getLoginCount(), model);
updatePropertyLongValue(res, USERACCOUNT_LAST_LOGIN_TIME,
userAccount.getLastLoginTime(), model);
updatePropertyStringValue(res, USERACCOUNT_EMAIL_KEY,
userAccount.getEmailKey(), model);
if (userAccount.getStatus() == null) {
updatePropertyStringValue(res, USERACCOUNT_STATUS, null, model);
} else {

View file

@ -2,6 +2,8 @@
package edu.cornell.mannlib.vitro.webapp.dao.jena;
import static java.lang.String.format;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
@ -60,15 +62,18 @@ import edu.cornell.mannlib.vitro.webapp.dao.OntologyDao;
import edu.cornell.mannlib.vitro.webapp.dao.VClassDao;
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
import edu.cornell.mannlib.vitro.webapp.dao.jena.event.EditEvent;
import edu.cornell.mannlib.vitro.webapp.i18n.I18nBundle;
import edu.cornell.mannlib.vitro.webapp.web.URLEncoder;
public class VClassDaoJena extends JenaBaseDao implements VClassDao {
protected static final Log log = LogFactory.getLog(VClassDaoJena.class);
private final I18nBundle i18n;
private boolean isUnderlyingStoreReasoned = false;
public VClassDaoJena(WebappDaoFactoryJena wadf, boolean isUnderlyingStoreReasoned) {
super(wadf);
this.i18n = wadf.getI18nBundle();
this.isUnderlyingStoreReasoned = isUnderlyingStoreReasoned;
}
@ -91,17 +96,19 @@ public class VClassDaoJena extends JenaBaseDao implements VClassDao {
Restriction rest = cls.asRestriction();
OntProperty onProperty = rest.getOnProperty();
StringBuilder labelStr = new StringBuilder();
labelStr.append("restriction on ").append(getLabelOrId(onProperty)).append(": ");
labelStr.append(format("%s ", i18n.text("restriction_on")))
.append(getLabelOrId(onProperty))
.append(": ");
if (rest.isAllValuesFromRestriction() || rest.isSomeValuesFromRestriction()) {
Resource fillerRes = null;
if (rest.isAllValuesFromRestriction()) {
AllValuesFromRestriction avfRest = rest.asAllValuesFromRestriction();
fillerRes = avfRest.getAllValuesFrom();
labelStr.append("all values from ");
labelStr.append(format("%s ", i18n.text("all_values_from")));
} else {
SomeValuesFromRestriction svfRest = rest.asSomeValuesFromRestriction();
fillerRes = svfRest.getSomeValuesFrom();
labelStr.append("some values from ");
labelStr.append(format("%s ", i18n.text("some_values_from")));
}
if (fillerRes.canAs(OntClass.class)) {
OntClass avf = fillerRes.as(OntClass.class);
@ -115,7 +122,7 @@ public class VClassDaoJena extends JenaBaseDao implements VClassDao {
}
} else if (rest.isHasValueRestriction()) {
HasValueRestriction hvRest = rest.asHasValueRestriction();
labelStr.append("has value ");
labelStr.append(format("%s ", i18n.text("has_value")));
RDFNode fillerNode = hvRest.getHasValue();
try {
if (fillerNode.isResource()) {
@ -128,22 +135,22 @@ public class VClassDaoJena extends JenaBaseDao implements VClassDao {
}
} else if (rest.isMinCardinalityRestriction()) {
MinCardinalityRestriction mcRest = rest.asMinCardinalityRestriction();
labelStr.append("minimum cardinality ");
labelStr.append(format("%s ", i18n.text("minimum_cardinality")));
labelStr.append(mcRest.getMinCardinality());
} else if (rest.isMaxCardinalityRestriction()) {
MaxCardinalityRestriction mcRest = rest.asMaxCardinalityRestriction();
labelStr.append("maximum cardinality ");
labelStr.append(format("%s ", i18n.text("maximum_cardinality")));
labelStr.append(mcRest.getMaxCardinality());
} else if (rest.isCardinalityRestriction()) {
CardinalityRestriction cRest = rest.asCardinalityRestriction();
labelStr.append("cardinality ");
labelStr.append(format("%s ", i18n.text("cardinality")));
labelStr.append(cRest.getCardinality());
}
return labelStr.toString();
} else if (isBooleanClassExpression(cls)) {
StringBuilder labelStr = new StringBuilder("(");
if (cls.isComplementClass()) {
labelStr.append("not ");
labelStr.append(format("%s ", i18n.text("not")));
ComplementClass ccls = cls.as(ComplementClass.class);
labelStr.append(getLabelForClass(ccls.getOperand(), withPrefix, forPickList));
} else if (cls.isIntersectionClass()) {
@ -153,7 +160,7 @@ public class VClassDaoJena extends JenaBaseDao implements VClassDao {
OntClass operand = operandIt.next();
labelStr.append(getLabelForClass(operand, withPrefix, forPickList));
if (operandIt.hasNext()) {
labelStr.append(" and ");
labelStr.append(format(" %s ", i18n.text("and")));
}
}
} else if (cls.isUnionClass()) {
@ -163,7 +170,7 @@ public class VClassDaoJena extends JenaBaseDao implements VClassDao {
OntClass operand = operandIt.next();
labelStr.append(getLabelForClass(operand, withPrefix, forPickList));
if (operandIt.hasNext()) {
labelStr.append(" or ");
labelStr.append(format(" %s ", i18n.text("or")));
}
}
}
@ -257,6 +264,7 @@ public class VClassDaoJena extends JenaBaseDao implements VClassDao {
} catch (ProfileException pe) {
// Current language profile does not support disjointWith axioms.
// We'd prefer to return an empty list instead of throwing an exception.
log.error(pe, pe);
} finally {
getOntModel().leaveCriticalSection();
}
@ -952,9 +960,9 @@ public class VClassDaoJena extends JenaBaseDao implements VClassDao {
} catch (Exception e) {
log.error("error linking class "+cls.getURI()+" to class group");
}
addPropertyStringValue(ontCls,SHORTDEF,cls.getShortDef(),ontModel);
addPropertyStringValue(ontCls,EXAMPLE_ANNOT,cls.getExample(),ontModel);
addPropertyStringValue(ontCls,DESCRIPTION_ANNOT,cls.getDescription(),ontModel);
updatePlainLiteralValue(ontCls, SHORTDEF, cls.getShortDef());
updatePlainLiteralValue(ontCls, EXAMPLE_ANNOT, cls.getExample());
updatePlainLiteralValue(ontCls, DESCRIPTION_ANNOT, cls.getDescription());
addPropertyIntValue(ontCls,DISPLAY_LIMIT,cls.getDisplayLimit(),ontModel);
addPropertyIntValue(ontCls,DISPLAY_RANK_ANNOT,cls.getDisplayRank(),ontModel);
@ -1011,9 +1019,9 @@ public class VClassDaoJena extends JenaBaseDao implements VClassDao {
if (ontCls != null) {
updateRDFSLabel(ontCls, cls.getName());
updatePropertyResourceURIValue(ontCls,IN_CLASSGROUP,cls.getGroupURI(),ontModel);
updatePropertyStringValue(ontCls,SHORTDEF,cls.getShortDef(),ontModel);
updatePropertyStringValue(ontCls,EXAMPLE_ANNOT,cls.getExample(),ontModel);
updatePropertyStringValue(ontCls,DESCRIPTION_ANNOT,cls.getDescription(),ontModel);
updatePlainLiteralValue(ontCls, SHORTDEF, cls.getShortDef());
updatePlainLiteralValue(ontCls, EXAMPLE_ANNOT, cls.getExample());
updatePlainLiteralValue(ontCls, DESCRIPTION_ANNOT, cls.getDescription());
updatePropertyNonNegativeIntValue(ontCls,DISPLAY_LIMIT,cls.getDisplayLimit(),ontModel);
updatePropertyNonNegativeIntValue(ontCls,DISPLAY_RANK_ANNOT,cls.getDisplayRank(),ontModel);
updatePropertyFloatValue(ontCls, SEARCH_BOOST_ANNOT, cls.getSearchBoost(), ontModel);

View file

@ -5,14 +5,12 @@ package edu.cornell.mannlib.vitro.webapp.dao.jena;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.ListIterator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.jena.datatypes.xsd.XSDDatatype;
import org.apache.jena.ontology.Individual;
import org.apache.jena.ontology.OntModel;
@ -30,6 +28,7 @@ import edu.cornell.mannlib.vitro.webapp.dao.InsertException;
import edu.cornell.mannlib.vitro.webapp.dao.VClassDao;
import edu.cornell.mannlib.vitro.webapp.dao.VClassGroupDao;
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactoryConfig;
public class VClassGroupDaoJena extends JenaBaseDao implements VClassGroupDao {
@ -191,9 +190,9 @@ public class VClassGroupDaoJena extends JenaBaseDao implements VClassGroupDao {
edu.cornell.mannlib.vitro.webapp.beans.Individual groupInd =
new IndividualImpl(); // We should make a factory for these
groupInd.setURI(vcg.getURI());
groupInd.setNamespace(DEFAULT_NAMESPACE+"vitroClassGroup");
groupInd.setName(vcg.getPublicName());
groupInd.setNamespace(DEFAULT_NAMESPACE + "vitroClassGroup");
groupInd.setVClassURI(CLASSGROUP.getURI());
groupInd.setName(vcg.getPublicName());
String groupURI = null;
@ -204,8 +203,12 @@ public class VClassGroupDaoJena extends JenaBaseDao implements VClassGroupDao {
WebappDaoFactory wadfForURIGeneration = null;
try {
wadfForURIGeneration = new WebappDaoFactoryJena(
unionForURIGeneration);
// Ensure that the temporary WebappDaoFactory has the same
// preferred languages as the main one for this DAO.
WebappDaoFactoryConfig wadfConfig = new WebappDaoFactoryConfig();
wadfConfig.setPreferredLanguages(getWebappDaoFactory().getPreferredLanguages());
wadfForURIGeneration = new WebappDaoFactoryJena(new SimpleOntModelSelector(
unionForURIGeneration), wadfConfig, null);
groupURI = wadfForURIGeneration
.getIndividualDao().insertNewIndividual(groupInd);
} catch (InsertException ie) {
@ -276,7 +279,7 @@ public class VClassGroupDaoJena extends JenaBaseDao implements VClassGroupDao {
try {
Individual groupInd = ontModel.getIndividual(vcg.getURI());
try {
groupInd.setLabel(vcg.getPublicName(), getDefaultLanguage());
updateRDFSLabel(groupInd, vcg.getPublicName(), getDefaultLanguage());
} catch (Exception e) {
log.error("error updating name for "+groupInd.getURI());
}

View file

@ -50,6 +50,8 @@ import edu.cornell.mannlib.vitro.webapp.dao.VClassGroupDao;
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactoryConfig;
import edu.cornell.mannlib.vitro.webapp.i18n.I18n;
import edu.cornell.mannlib.vitro.webapp.i18n.I18nBundle;
import edu.cornell.mannlib.vitro.webapp.modelaccess.ModelNames;
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService;
import edu.cornell.mannlib.vitro.webapp.rdfservice.impl.jena.model.RDFServiceModel;
@ -611,5 +613,10 @@ public class WebappDaoFactoryJena implements WebappDaoFactory {
}
}
@Override
public I18nBundle getI18nBundle() {
// return context based bundle for preferred locales
return I18n.bundle(config.getPreferredLocales());
}
}

View file

@ -132,6 +132,11 @@ public class EditLiteral implements Literal {
throw new UnsupportedOperationException();
}
@Override
public boolean isStmtResource() {
throw new UnsupportedOperationException();
}
public Literal inModel(Model model) {
throw new UnsupportedOperationException();
}

View file

@ -4,7 +4,6 @@ package edu.cornell.mannlib.vitro.webapp.edit.listener.impl;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import org.apache.commons.logging.Log;
@ -23,7 +22,8 @@ import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.BasicValidationVTwo;
public class IndividualDataPropertyStatementProcessor implements ChangeListener {
private static final Log log = LogFactory.getLog(IndividualDataPropertyStatementProcessor.class.getName());
private static final String LANGUAGE = "language";
private static final Log log = LogFactory.getLog(IndividualDataPropertyStatementProcessor.class.getName());
public void doInserted(Object newObj, EditProcessObject epo) {
processDataprops(epo);
@ -54,6 +54,9 @@ public class IndividualDataPropertyStatementProcessor implements ChangeListener
try {
Map beanParamMap = FormUtils.beanParamMapFromString(keyArg[3]);
String dataPropertyURI = (String) beanParamMap.get("DatatypePropertyURI");
if (beanParamMap.containsKey(LANGUAGE)) {
dataPropertyStmt.setLanguage((String) beanParamMap.get(LANGUAGE));
}
if (!deletedDataPropertyURIs.contains(dataPropertyURI)) {
deletedDataPropertyURIs.add(dataPropertyURI);
dataPropertyStatementDao.deleteDataPropertyStatementsForIndividualByDataProperty(((Individual) epo.getNewBean()).getURI(), dataPropertyURI);

Some files were not shown because too many files have changed in this diff Show more