/
getRegionsStandard.scala.txt
58 lines (50 loc) · 1.87 KB
/
getRegionsStandard.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
@*
* 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 the regions that point to this resource, using standard SPARQL, without
* inference.
*
* This template is used only by getRegions.scala.txt.
*
* @param triplestore the name of the triplestore being used.
* @param resourceIri the IRI of the resource.
*@
@(triplestore: String,
resourceIri: IRI)
PREFIX knora-base: <http://www.knora.org/ontology/knora-base#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?region ?resclass ?regionObjectPermissions ?owner ?project
WHERE {
BIND(IRI("@resourceIri") as ?resource)
?linkingProp rdfs:subPropertyOf* knora-base:isRegionOf .
?region ?linkingProp ?resource .
?resclass rdfs:subClassOf* knora-base:Region .
?region a ?resclass .
?region knora-base:attachedToUser ?owner ;
knora-base:attachedToProject ?project ;
knora-base:hasPermissions ?regionObjectPermissions .
FILTER NOT EXISTS {
?resource knora-base:isDeleted true .
}
FILTER NOT EXISTS {
?region knora-base:isDeleted true .
}
}