Skip to content

fix: removing cardinality of a link property (DEV-90) - #1919

Merged
subotic merged 7 commits into
mainfrom
wip/DEV-90-canDeleteCardinalities
Oct 13, 2021
Merged

subotic merged 7 commits into
mainfrom
wip/DEV-90-canDeleteCardinalities

Conversation

@subotic

@subotic subotic commented Oct 8, 2021

Copy link
Copy Markdown
Collaborator

resolves DEV-90

@subotic subotic self-assigned this Oct 8, 2021
@subotic
subotic requested review from irinaschubert and mpro7 October 8, 2021 16:05
Comment on lines 958 to 960
internalClassDef = internalClassDef,
allBaseClassIris = allBaseClassIris.toSet,
cacheData = cacheData

Copy link
Copy Markdown
Contributor

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,
...

@irinaschubert irinaschubert left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

) // 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
)

Copy link
Copy Markdown

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

Copy link
Copy Markdown
Collaborator Author

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.

Comment thread webapi/src/test/scala/org/knora/webapi/e2e/v2/OntologyV2R2RSpec.scala Outdated
Comment thread webapi/src/test/scala/org/knora/webapi/e2e/v2/OntologyV2R2RSpec.scala Outdated
Comment thread webapi/src/test/scala/org/knora/webapi/e2e/v2/OntologyV2R2RSpec.scala Outdated
subotic and others added 4 commits October 12, 2021 08:31
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants