/
getFileValueGraphDB.scala.txt
56 lines (49 loc) · 1.97 KB
/
getFileValueGraphDB.scala.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
@*
* Copyright © 2015-2019 the contributors (see Contributors.md).
*
* This file is part of Knora.
*
* Knora is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Knora is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with Knora. If not, see <http://www.gnu.org/licenses/>.
*@
@import org.knora.webapi.IRI
@**
* Given a knora:base:internalFilename, retrieves the file value and information attached to it, using GraphDB.
*
* This template is used only by getFileValue.scala.txt.
*
* Since the triplestore type is GraphDB, we turn off inference in this query because it is not needed.
*
* @param fileValueIri the IRI of the file value.
*@
@(filename: String)
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX knora-base: <http://www.knora.org/ontology/knora-base#>
CONSTRUCT {
?fileValue ?objPred ?objObj .
?fileValue knora-base:attachedToProject ?resourceProject .
?fileValue knora-base:hasPermissions ?currentFileValuePermissions .
}
FROM <http://www.ontotext.com/explicit>
WHERE {
?fileValue knora-base:internalFilename "@filename" .
?currentFileValue knora-base:previousValue* ?fileValue ;
knora-base:hasPermissions ?currentFileValuePermissions .
?resource ?prop ?currentFileValue ;
knora-base:attachedToProject ?resourceProject .
?fileValue ?objPred ?objObj .
?currentFileValue knora-base:isDeleted false .
?resource knora-base:isDeleted false .
}