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
fix: removing cardinality of a link property (DEV-90) #1919
Conversation
internalClassDef = internalClassDef, | ||
allBaseClassIris = allBaseClassIris.toSet, | ||
cacheData = cacheData |
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 think this could be simplified:
.checkCardinalitiesBeforeAddingAndIfNecessaryAddLinkValueProperties(
internalClassDef,
allBaseClassIris.toSet,
cacheData,
...
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
cacheData.ontologies(propertyIri.getOntologyFromEntity).properties(propertyIri) | ||
) // turn the propertyIri into a ReadPropertyInfoV2 | ||
.filter(_.isLinkProp) // we are only interested in link properties | ||
.map(_.entityInfoContent.propertyIri) // turn whatever is left back to a propertyIri | ||
) |
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 understand why this has to be done
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.
the data model for links consist of the linked property and a corresponding link property value. This checkCardinalitiesBeforeAddingAndIfNecessaryAddLinkValueProperties
method will complain if there are already link property values defined, because this method should add them. This is why this method has the existingLinkPropsToKeep
parameter. Since this parameter only takes IRIs we first need to convert all property IRIs to ReadPropertyInfoV2 then filter out anything that is not a link property and then turn it back to a property IRI.
webapi/src/test/scala/org/knora/webapi/e2e/v2/OntologyV2R2RSpec.scala
Outdated
Show resolved
Hide resolved
webapi/src/test/scala/org/knora/webapi/e2e/v2/OntologyV2R2RSpec.scala
Outdated
Show resolved
Hide resolved
webapi/src/test/scala/org/knora/webapi/e2e/v2/OntologyV2R2RSpec.scala
Outdated
Show resolved
Hide resolved
…c.scala Co-authored-by: irinaschubert <irina.schubert@dasch.swiss>
…c.scala Co-authored-by: irinaschubert <irina.schubert@dasch.swiss>
…c.scala Co-authored-by: irinaschubert <irina.schubert@dasch.swiss>
resolves DEV-90