Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
fix(ontology): cardinality of one can be added to classes as long as …
…not used in data (#1958) * allow adding cardinalities of 1 if class not used in data * Adjust e2e test * Update ontology-information.md * fix indentations ins ScalaDoc Co-authored-by: Ivan Subotic <400790+subotic@users.noreply.github.com>
- Loading branch information
Showing
5 changed files
with
111 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
.../main/twirl/org/knora/webapi/messages/twirl/queries/sparql/v2/isClassUsedInData.scala.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
@* | ||
* Copyright © 2021 Data and Service Center for the Humanities and/or DaSCH Service Platform contributors. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*@ | ||
|
||
@import org.knora.webapi.messages.SmartIri | ||
|
||
@* | ||
* Checks if an instance of a class exists (if yes, that means the class is used in data) | ||
* | ||
* @param triplestore the name of the triplestore being used. | ||
* @param classIri the IRI of the class. | ||
*@ | ||
@(triplestore: String, | ||
classIri: SmartIri) | ||
|
||
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | ||
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
|
||
SELECT DISTINCT ?isUsed | ||
|
||
WHERE { | ||
BIND(IRI("@classIri") AS ?class) | ||
BIND(true AS ?isUsed) | ||
|
||
{ | ||
?resourceInstance rdf:type ?class | ||
} | ||
UNION{ | ||
?subClass rdfs:subClassOf* ?class . | ||
?resourceInstance rdf:type ?subClass | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters