A service for "stamping" PDF files with the name of their associated document.
A job-like approach is used to run these operations on the PDF files. See The job datamodel below for more info.
document-stamping:
image: kanselarij/document-stamping-service
volumes:
- ./data/files:/share
dispatcher.ex
:
post "/documents/:id/stamp", @any do
Proxy.forward conn, [], "http://document-stamping-service/documents/" <> id <> "/stamp"
end
post "/agendas/:id/agendaitems/documents/stamp", @any do
Proxy.forward conn, [], "http://document-stamping-service/agendas/" <> id <> "/agendaitems/documents/stamp"
end
Users of this service should have :read
, :write
and :read-for-write
access to following rdf types.
"http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#FileDataObject"
"http://vocab.deri.ie/cogs#Job"
"http://mu.semte.ch/vocabularies/ext/FileStampingJob"
domain.lisp
:
(define-resource file-stamping-job ()
:class (s-prefix "ext:FileStampingJob") ; "cogs:Job"
:properties `((:created :datetime ,(s-prefix "dct:created"))
(:status :uri ,(s-prefix "ext:status"))
(:time-started :datetime ,(s-prefix "prov:startedAtTime"))
(:time-ended :datetime ,(s-prefix "prov:endedAtTime"))
)
:has-many `((file :via ,(s-prefix "prov:used")
:as "generated")
(file :via ,(s-prefix "prov:used")
:as "generated"))
; :resource-base (s-url "http://example.com/id/file-stamping-jobs/")
:features '(include-uri)
:on-path "file-stamping-jobs"
)
repository.lisp
:
(add-prefix "ext" "http://mu.semte.ch/vocabularies/ext/")
(add-prefix "dct" "http://purl.org/dc/terms/")
(add-prefix "prov" "http://www.w3.org/ns/prov#")
(add-prefix "cogs" "http://vocab.deri.ie/cogs#")
dispatcher.ex
:
match "/file-stamping-jobs/*path", @any do
Proxy.forward conn, path, "http://cache/file-stamping-jobs/"
end
Request the creation of a stamping job for one specific document
On successful creation of a job.
{
"data": {
"type": "file-stamping-jobs",
"id": "5f680870-5984-11ea-98be-11315490e00b",
"attributes": {
"uri": "http://mu.semte.ch/services/file-stamping-service/file-stamping-jobs/5f680870-5984-11ea-98be-11315490e00b",
"status": "http://vocab.deri.ie/cogs#Running",
"created": "2020-02-27T17:12:45.943Z"
}
}
}
When the user requesting the stamping job doesn't have adequate rights.
When the document requested for stamping doesn't exist.
Stamp all documents related to a specific agenda.
See above.
For modeling the jobs that create the archive files, this service makes use of the COGS vocabulary, which in its turn is based on the PROV-O vocabulary