Skip to content
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

Merged
merged 7 commits into from Oct 13, 2021

Conversation

subotic
Copy link
Collaborator

@subotic subotic commented Oct 8, 2021

resolves DEV-90

@subotic subotic self-assigned this Oct 8, 2021
Comment on lines 958 to 960
internalClassDef = internalClassDef,
allBaseClassIris = allBaseClassIris.toSet,
cacheData = cacheData
Copy link
Collaborator

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

Copy link

@irinaschubert irinaschubert left a 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
)

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

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.

None yet

3 participants