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

constraining multilingual attributes #48

Open
pchampin opened this issue May 20, 2022 · 2 comments
Open

constraining multilingual attributes #48

pchampin opened this issue May 20, 2022 · 2 comments

Comments

@pchampin
Copy link

During a workshop on Distrbuted Knowledge Graph metadata, the need emerged to constrain a property to contain:

  • one-to-many language tagged strings, but
  • at most one value per language tag.

Therefore this would be allowed

<> dct:description "My Knowledge Graph"@en, "Mon graphe de connaissances"@fr.

would be valid, but

<> dct:description "My Knowledge Graph"@en, "My KG"@en.

would not.

Is it possible to express that kind of constraint using ShEx?

@labra
Copy link
Contributor

labra commented May 21, 2022

I think the general constrain is not possible with current ShEx and it may be a nice use case to consider.

ShEx has the possibility to express a language tagged value using:

<LanguageTagged> {
  dct:description [ @~ ] *
}

But that would allow repeated language tagged values.

In case you want a fixed set of languages (for example, es, en and fr) you could use something like:

<LanguageTagged> {
  dct:description [ @en ] ? ;
  dct:description [ @es ] ? ;
  dct:description [ @fr ] ?  
}

But of course, it would better to be able to express the general constraint without having to enumerate all the languages.

I wonder what syntax we could use to express that constraint...maybe something like the following?

<LanguageTagged> {
  dct:description [ @~ ] *  DISTINCT @~
}

@ericprud
Copy link

ShEx.js has the beginnings of this in the accessor branch. The idea is that you create UNIQUE constraints scoped to the particular node/shape pair, or (more expensively), across validations of that shape. Unique language tag is a good example where the uniqueness is scoped to the focus node (e.g. two different entities may both have a Spanish dct:description but no single node may do so).

An example of global uniqueness would be that no two Users may have the same combination of givenName and familyName.

It's been a long time since I worked on this feature but let me know of any use cases to keep in mind, or, ideally, if you want to geek through some uses cases/examples.

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

No branches or pull requests

3 participants