-
Notifications
You must be signed in to change notification settings - Fork 28
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
feature: ConstrainedLangStringSet
s
#113
Merged
s-heppner
merged 7 commits into
eclipse-basyx:improve/V30
from
rwth-iat:feature/constrained_lang_string_sets
Aug 31, 2023
Merged
feature: ConstrainedLangStringSet
s
#113
s-heppner
merged 7 commits into
eclipse-basyx:improve/V30
from
rwth-iat:feature/constrained_lang_string_sets
Aug 31, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This will be used for the constrained `MultiLanguageNameType` constrained `LangStringSet`.
This function returns a new constraint-check function for strings that aren't of a specific type. This will be used by the constrained lang string sets `MultiLanguageTextType`, `DefinitionTypeIEC61360`, `PreferredNameTypeIEC61360` and `ShortNameTypeIEC61360`, where values aren't of a basic constrained string type, but are still constrained in minimum and maximum length.
This adds the abstract base class `ConstrainedLangStringSet` and the following subclasses: - `MultiLanguageNameType` - `MultiLanguageTextType` - `DefinitionTypeIEC61360` - `PreferredNameTypeIEC61360` - `ShortNameTypeIEC61360` `ConstrainedLangStringSet` is implemented as an abstract subclass of `LangStringSet`, which uses a given function to check the constraints of all stored values, similar to `ConstrainedList`. This function is called for every key-value pair on initialization and whenever a new key-value pair is added. Additionally, functions such as `__init__()` and `__setitem__()` of the base class `LangStringSet` are called where appropriate, such that all constraints for language tags are also checked here. Each of the concrete subclasses consist of just an `__init__()` function, that passes a constraint-check function to `ConstrainedLangStringSet.__init__()`.
This adds a few basic tests for `LangStringSet` and its subclasses, e.g. whether language-tag constraints are checked correctly, whether `LangStringSet` checks for emptiness and whether basic functionality such as string-representation, length-calculation and key-values iteration works as expected. Additionally, a basic test for value-constraints in `ConstrainedLangStringSet`s is added.
`LangStringSet` still remains concrete but may be made abstract in the future.
This commit changes the XML/JSON (de-)serialization adapter and corresponding schemata such that they are compatible with the new `ConstrainedLangStringSet` types.
jkhsjdhjs
force-pushed
the
feature/constrained_lang_string_sets
branch
from
August 24, 2023 15:53
42d0ef2
to
c4f5178
Compare
Looks good to me. I'd rebase this, if you have nothing against that? |
s-heppner
added
BlockingRelease
This issue needs to be solved before the pending release
v3.0
and removed
BlockingRelease
This issue needs to be solved before the pending release
labels
Nov 21, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds the abstract base class
ConstrainedLangStringSet
and thefollowing subclasses:
MultiLanguageNameType
MultiLanguageTextType
DefinitionTypeIEC61360
PreferredNameTypeIEC61360
ShortNameTypeIEC61360
ConstrainedLangStringSet
is implemented as an abstract subclass ofLangStringSet
, which uses a given function to check the constraintsof all stored values, similar to
ConstrainedList
. This function iscalled for every key-value pair on initialization and whenever a new
key-value pair is added. Additionally, functions such as
__init__()
and
__setitem__()
of the base classLangStringSet
are called whereappropriate, such that all constraints for language tags are also
checked here.
Each of the concrete subclasses consist of just an
__init__()
function, that passes a constraint-check function to
ConstrainedLangStringSet.__init__()
.Furthermore, a few basic tests for
LangStringSet
and its subclassesare added, e.g. whether language-tag constraints are checked correctly,
whether
LangStringSet
checks for emptiness and whether basic functionalitysuch as string-representation, length-calculation and key-values
iteration works as expected.
Additionally, a basic test for value-constraints in
ConstrainedLangStringSet
s is added.Close #77 #89