Skip to content
Permalink
Browse files

feat(sipi): add storing of original and sidecar (DSP-1318) (#1808)

  • Loading branch information
lrosenth committed Feb 5, 2021
1 parent 826e2ea commit 022ed7e977601543eca47b48ab65ea830c04e2f4
Showing with 687 additions and 134 deletions.
  1. +2 −2 knora-ontologies/knora-base.ttl
  2. +65 −5 sipi/scripts/file_info.lua
  3. +185 −35 sipi/scripts/store.lua
  4. +96 −44 sipi/scripts/upload.lua
  5. BIN test_data/test_route/files/minimal.zip
  6. BIN test_data/test_route/files/test.zip
  7. +2 −2 third_party/versions.bzl
  8. +13 −2 webapi/src/main/resources/application.conf
  9. +1 −1 webapi/src/main/scala/org/knora/webapi/messages/util/ConstructResponseUtilV2.scala
  10. +5 −2 webapi/src/main/scala/org/knora/webapi/messages/util/ValueUtilV1.scala
  11. +1 −1 webapi/src/main/scala/org/knora/webapi/messages/v1/responder/valuemessages/ValueMessagesV1.scala
  12. +9 −8 webapi/src/main/scala/org/knora/webapi/messages/v2/responder/valuemessages/ValueMessagesV2.scala
  13. +1 −1 webapi/src/main/scala/org/knora/webapi/package.scala
  14. +12 −3 webapi/src/main/scala/org/knora/webapi/routing/RouteUtilV1.scala
  15. +1 −10 webapi/src/main/scala/org/knora/webapi/store/iiif/SipiConnector.scala
  16. +2 −1 webapi/src/main/scala/org/knora/webapi/store/triplestore/upgrade/RepositoryUpdatePlan.scala
  17. +8 −1 webapi/src/main/twirl/org/knora/webapi/messages/twirl/queries/sparql/v1/addValueVersion.scala.txt
  18. +9 −2 ...rg/knora/webapi/messages/twirl/queries/sparql/v1/generateInsertStatementsForCreateValue.scala.txt
  19. +10 −4 ...g/knora/webapi/messages/twirl/queries/sparql/v2/generateInsertStatementsForValueContent.scala.txt
  20. +98 −0 webapi/src/test/scala/org/knora/webapi/it/v1/KnoraSipiIntegrationV1ITSpec.scala
  21. +167 −10 webapi/src/test/scala/org/knora/webapi/it/v2/KnoraSipiIntegrationV2ITSpec.scala
@@ -33,7 +33,7 @@

:attachedToProject knora-admin:SystemProject ;

:ontologyVersion "knora-base v9" .
:ontologyVersion "knora-base v10" .



@@ -1792,7 +1792,7 @@
rdfs:subClassOf :FileValue ,
[ rdf:type owl:Restriction ;
owl:onProperty :pageCount ;
owl:cardinality "1"^^xsd:nonNegativeInteger
owl:maxCardinality "1"^^xsd:nonNegativeInteger
] ,
[ rdf:type owl:Restriction ;
owl:onProperty :dimX ;
@@ -35,7 +35,21 @@ local IMAGE_JPG = "image/jpeg"
local APPLICATION_XML = "application/xml"
local TEXT_XML = "text/xml"
local TEXT_PLAIN = "text/plain"
local AUDIO_MP3 = "audio/mpeg"
local AUDIO_MP4 = "audio/mp4"
local AUDIO_WAV = "audio/x-wav"
local APPLICATION_PDF = "application/pdf"
local APPLICATION_DOC = "application/msword"
local APPLICATION_DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
local APPLICATION_XLS = "application/vnd.ms-excel"
local APPLICATION_XLSX = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
local APPLICATION_PPT = "application/vnd.ms-powerpoint"
local APPLICATION_PPTX = "application/vnd.openxmlformats-officedocument.presentationml.presentation"
local APPLICATION_ZIP = "application/zip"
local APPLICATION_TAR = "application/x-tar"
local APPLICATION_ISO = "application/x-iso9660-image"
local APPLICATION_GZIP = "application/gzip"


local image_mime_types = {
IMAGE_JP2,
@@ -44,14 +58,36 @@ local image_mime_types = {
IMAGE_JPG
}

local audio_mime_types = {
AUDIO_MP3,
AUDIO_MP4,
AUDIO_WAV
}

local text_mime_types = {
TEXT_PLAIN,
APPLICATION_XML,
TEXT_XML
}

local document_mime_types = {
APPLICATION_PDF
APPLICATION_PDF,
APPLICATION_TAR,
APPLICATION_ZIP,
APPLICATION_ISO,
APPLICATION_GZIP,
APPLICATION_DOC,
APPLICATION_DOCX,
APPLICATION_XLS,
APPLICATION_XLSX,
APPLICATION_PPT,
APPLICATION_PPTX
}

local audio_extensions = {
"mp3",
"mp4",
"wav"
}

local text_extensions = {
@@ -63,16 +99,37 @@ local text_extensions = {
}

local document_extensions = {
"pdf"
"pdf",
"zip",
"tar",
"iso",
"gz",
"doc",
"docx",
"xls",
"xlsx",
"ppt",
"pptx"
}

function make_image_file_info()
function make_image_file_info(extension)
return {
media_type = IMAGE,
extension = "jp2"
extension = extension
}
end

function make_audio_file_info(extension)
if not table.contains(audio_extensions, extension) then
return nil
else
return {
media_type = AUDIO,
extension = extension
}
end
end

function make_text_file_info(extension)
if not table.contains(text_extensions, extension) then
return nil
@@ -105,12 +162,15 @@ end
-- a table containing "media_type" and "extension", or false if no supported media type was found.
-------------------------------------------------------------------------------
function get_file_info(filename, mimetype)

local extension = filename:match("^.+%.([^.]+)$")

if extension == nil then
return nil
elseif table.contains(image_mime_types, mimetype) then
return make_image_file_info()
return make_image_file_info(extension)
elseif table.contains(audio_mime_types, mimetype) then
return make_audio_file_info(extension)
elseif table.contains(text_mime_types, mimetype) then
return make_text_file_info(extension)
elseif table.contains(document_mime_types, mimetype) then

0 comments on commit 022ed7e

Please sign in to comment.