/
SparqlTemplateLinkUpdate.scala
60 lines (57 loc) · 3.46 KB
/
SparqlTemplateLinkUpdate.scala
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
/*
* 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/>.
*/
package org.knora.webapi.messages.twirl
import org.knora.webapi.IRI
import org.knora.webapi.messages.SmartIri
/**
* Contains instructions that can be given to a SPARQL template for updating direct links and `knora-base:LinkValue`
* objects representing references to resources.
*
* @param linkPropertyIri the IRI of the direct link property.
* @param directLinkExists `true` if a direct link already exists between the source and target resources.
* @param insertDirectLink `true` if the direct link should be inserted.
* @param deleteDirectLink `true` if the direct link should be deleted (because the reference count is being decremented
* to 0).
* @param linkValueExists `true` if a `LinkValue` already exists describing a direct link between the source
* and target resources.
* @param linkTargetExists `true` if the link target already exists, `false` if is being created in the same
* SPARQL update operation.
* @param newLinkValueIri the IRI of the new `LinkValue` to be created.
* @param linkTargetIri the IRI of the target resource.
* @param currentReferenceCount the current reference count of the existing `LinkValue`, if any. This will be
* 0 if (a) there was previously a direct link but it was deleted (`directLinkExists` is
* `false` and `linkValueExists` is `true`), or (b) there was never a direct link, and
* there is no `LinkValue` (`directLinkExists` and `linkValueExists` will then be `false`).
* @param newReferenceCount the new reference count of the `LinkValue`.
* @param newLinkValueCreator the creator of the new `LinkValue`.
* @param newLinkValuePermissions the literal that should be the object of the `hasPermissions` property of
* the new `LinkValue`.
*/
case class SparqlTemplateLinkUpdate(linkPropertyIri: SmartIri,
directLinkExists: Boolean,
insertDirectLink: Boolean,
deleteDirectLink: Boolean,
linkValueExists: Boolean,
linkTargetExists: Boolean,
newLinkValueIri: IRI,
linkTargetIri: IRI,
currentReferenceCount: Int,
newReferenceCount: Int,
newLinkValueCreator: IRI,
newLinkValuePermissions: String)