/
getContextStandard.scala.txt
122 lines (101 loc) · 3.83 KB
/
getContextStandard.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
@*
* Copyright © 2015-2021 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 the IRI of a resource, gets information about the resources that are part of that resource, using standard
* SPARQL, without inference.
*
* This template is used only by getContext.scala.txt.
*
* @param triplestore the name of the triplestore being used.
* @param resourceIri the IRI of the resource.
*@
@(triplestore: String,
resourceIri: IRI)
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#>
prefix xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ?sourceObject
?sourceObjectAttachedToUser
?sourceObjectAttachedToProject
?sourceObjectPermissions
?seqnum
?linkValue
?linkValueCreator
?linkValuePermissions
?firstprop
?fileValue
?internalFilename
?internalMimeType
?originalFilename
?dimX
?dimY
?fileValuePermissions
?fileValueAttachedToUser
WHERE {
BIND(IRI("@resourceIri") as ?resource)
?resource rdf:type ?resourceClass .
?resourceClass rdfs:subClassOf* knora-base:Resource .
# Find something that relates to this resource via knora-base:isPartOf.
?linkingProp rdfs:subPropertyOf* knora-base:isPartOf .
?sourceObject ?linkingProp ?resource .
OPTIONAL {
?seqProp rdfs:subPropertyOf* knora-base:seqnum .
?sourceObject ?seqProp ?seqnumVal .
?seqnumVal knora-base:valueHasInteger ?seqnum .
}
?sourceObject rdfs:label ?firstprop ;
knora-base:attachedToUser ?sourceObjectAttachedToUser ;
knora-base:attachedToProject ?sourceObjectAttachedToProject ;
knora-base:hasPermissions ?sourceObjectPermissions .
BIND(IRI(CONCAT(STR(?linkingProp), "Value")) AS ?linkValueProp)
?sourceObject ?linkValueProp ?linkValue .
?linkValue rdf:type knora-base:LinkValue ;
rdf:subject ?sourceObject ;
rdf:predicate ?linkingProp ;
rdf:object ?resource ;
knora-base:attachedToUser ?linkValueCreator ;
knora-base:hasPermissions ?linkValuePermissions .
FILTER NOT EXISTS {
?resource knora-base:isDeleted true .
}
FILTER NOT EXISTS {
?sourceObject knora-base:isDeleted true .
}
FILTER NOT EXISTS {
?linkValue knora-base:isDeleted true .
}
OPTIONAL {
?fileValueProp rdfs:subPropertyOf* knora-base:hasFileValue .
?sourceObject ?fileValueProp ?fileValue .
?fileValue a knora-base:StillImageFileValue .
FILTER NOT EXISTS {
?fileValue knora-base:isDeleted true .
}
?fileValue knora-base:internalMimeType ?internalMimeType ;
knora-base:originalFilename ?originalFilename ;
knora-base:internalFilename ?internalFilename ;
knora-base:dimX ?dimX ;
knora-base:dimY ?dimY ;
knora-base:attachedToUser ?fileValueAttachedToUser ;
knora-base:hasPermissions ?fileValuePermissions .
}
}
ORDER BY ?seqnum ?sourceObject ?isPreview