New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add check for can a cardinality be set for specific class and property #2382
Conversation
f231f43
to
12e6c64
Compare
Codecov ReportBase: 86.48% // Head: 8.49% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #2382 +/- ##
==========================================
- Coverage 86.48% 8.49% -77.99%
==========================================
Files 271 278 +7
Lines 28336 28395 +59
==========================================
- Hits 24506 2412 -22094
- Misses 3830 25983 +22153
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
12e6c64
to
3d662a0
Compare
…link to folder in project root Remove unused parameter `appConfig` from org.knora.webapi.util.ActorUtil#zio2Message cleanup code: remove unused code, simplify Revert "Move knora-ontologies to webapi/src/main/resources and keep symbolic link to folder in project root" This reverts commit 48f5e93b7e443a6867baa257db2a076e1df202b6. fmt Fix warnings in CardinalityHandler Overload case class constructor and simplify SparqlAskRequest construction Use SmartIri type in query fix scaladoc use InternalIri as parameter use InternalIri in CardinalitiesSpec wip // add isPropertyUsedInResources to CardinalityService wip // add TriplestoreServiceFake wip // add CardinalityService wip // add CardinalityService wip // add CardinalityService wip // add canWidenCardinality method to CardinalityService wip // add canWidenCardinality method to CardinalityService wip // add canWidenCardinality method to CardinalityService fmt reorganize TestDatasetBuilder add headers cleanup cleanup cleanup wip // Cardinality model fmt reorganize packages fix compile error and turn Cardinality into sealed trait wip add test wip add failing tests wip add failing tests add OntologyCache and fake implementation add methods to IriConverter add methods to IriConverter add check and tests add check and tests Add headers Update webapi/src/it/scala/org/knora/webapi/slice/resourceinfo/api/IriConverterLiveSpec.scala remove file simplify remove unused code fix test labels fmt fix compile warnings and add type annotation to public field Replace if else with "pattern matching" Replace if else with "pattern matching" Rename isStricterThan method cleanup, remove unused code Remove Option.get by more elaborate pattern matching extract explanation method prevent knora-admin and knora-base ontologies to be change Introduce CanSetCardinalityCheckResult in order to distinguish why setting is not possible Introduce CanSetCardinalityCheckResult in order to distinguish why setting is not possible Introduce CanSetCardinalityCheckResult in order to distinguish why setting is not possible Introduce CanSetCardinalityCheckResult in order to distinguish why setting is not possible fix type in trait Add RestCardinalityService Use RestCardinalityService in OntologiesRouteV2 and assemble layers fmt add headers extend response with optional reason of failure fix test setup fmt Introduce common ReadOnlyRepository and CrudRe traits header && fmt Re-add old behaviour fmt fixup R2R spec Introduce canUpdateCardinality Introduce requestcontext completion with run unsafe zio fmt fix error message make private move getStringQueryParam to RouteUtilV2 move request params checking into RestCardinalityService fmt finetuning fmt
3d662a0
to
06068eb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
webapi/src/it/scala/org/knora/webapi/responders/v2/ResourcesResponderV2Spec.scala
Show resolved
Hide resolved
webapi/src/main/scala/org/knora/webapi/messages/StringFormatter.scala
Outdated
Show resolved
Hide resolved
webapi/src/main/scala/org/knora/webapi/messages/StringFormatter.scala
Outdated
Show resolved
Hide resolved
webapi/src/main/scala/org/knora/webapi/routing/Authenticator.scala
Outdated
Show resolved
Hide resolved
webapi/src/main/scala/org/knora/webapi/slice/ontology/domain/model/Cardinality.scala
Show resolved
Hide resolved
webapi/src/main/scala/org/knora/webapi/slice/ontology/domain/service/CardinalityService.scala
Outdated
Show resolved
Hide resolved
webapi/src/main/scala/org/knora/webapi/slice/ontology/domain/service/CardinalityService.scala
Show resolved
Hide resolved
webapi/src/main/twirl/org/knora/webapi/queries/sparql/v2/isPropertyUsed.scala.txt
Outdated
Show resolved
Hide resolved
webapi/src/test/scala/org/knora/webapi/store/triplestore/api/TriplestoreServiceFake.scala
Show resolved
Hide resolved
…r.scala Co-authored-by: irinaschubert <irina.schubert@dasch.swiss>
…ervice/CardinalityService.scala Co-authored-by: irinaschubert <irina.schubert@dasch.swiss>
Co-authored-by: irinaschubert <irina.schubert@dasch.swiss>
webapi/src/main/scala/org/knora/webapi/routing/Authenticator.scala
Outdated
Show resolved
Hide resolved
webapi/src/main/scala/org/knora/webapi/slice/ontology/domain/service/CardinalityService.scala
Outdated
Show resolved
Hide resolved
webapi/src/main/scala/org/knora/webapi/slice/ontology/domain/service/CardinalityService.scala
Outdated
Show resolved
Hide resolved
webapi/src/main/scala/org/knora/webapi/slice/ontology/domain/service/CardinalityService.scala
Outdated
Show resolved
Hide resolved
…cala Co-authored-by: Marcin Procyk <marcin.procyk@dasch.swiss>
…ervice/CardinalityService.scala Co-authored-by: Marcin Procyk <marcin.procyk@dasch.swiss>
…ervice/CardinalityService.scala Co-authored-by: Marcin Procyk <marcin.procyk@dasch.swiss>
…ervice/CardinalityService.scala Co-authored-by: Marcin Procyk <marcin.procyk@dasch.swiss>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think I grasped everything (big PR and I went through it too quickly), but looks good
webapi/src/main/scala/org/knora/webapi/messages/OntologyConstants.scala
Outdated
Show resolved
Hide resolved
webapi/src/main/scala/org/knora/webapi/messages/v2/responder/KnoraResponseV2.scala
Show resolved
Hide resolved
webapi/src/main/scala/org/knora/webapi/responders/v2/ontology/CardinalityHandler.scala
Show resolved
Hide resolved
webapi/src/main/scala/org/knora/webapi/routing/v2/OntologiesRouteV2.scala
Show resolved
Hide resolved
webapi/src/test/scala/org/knora/webapi/slice/ontology/domain/CardinalityServiceLiveSpec.scala
Show resolved
Hide resolved
…pository.scala Co-authored-by: irinaschubert <irina.schubert@dasch.swiss>
Pull Request Checklist
Task Description/Number
Issue Number: DEV-1563
Extend existing route
(1)
GET v2/ontologies/canreplacecardinalities/{classIri}
with
(2)
GET v2/ontologies/canreplacecardinalities/{classIri}?propertyIri={iriEncode}&newCardinality=[0-1|1|1-n|0-n]
In the (1) case the check is done as previously, i.e. checks if the
classIri
is in use.In the (2) case the api now checks whether for the the
classIri
/propertyIri
combination it is save to set thenewCardinality
. It is safe only if no super class exists with a stricter cardinality on this property.Basic Requirements
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
Does this PR introduce a breaking change?
Does this PR change client-test-data?