Skip to content

Commit

Permalink
Merge pull request #480 from dbmdz/add-normalized-headword-label
Browse files Browse the repository at this point in the history
Normalized label field to headword
  • Loading branch information
datazuul authored Jul 31, 2023
2 parents 772655d + 0eb01aa commit 883f231
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added

- Add field `labelNormalized` to `Headword` to allow language independent sorting and searching in a normalized version of `label`.

## [12.0.1](https://github.com/dbmdz/digitalcollections-model/releases/tag/12.0.1) - 2023-07-06

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion dc-model-jackson/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>de.digitalcollections.model</groupId>
<artifactId>dc-model-parent</artifactId>
<version>12.0.1</version>
<version>12.1.0-SNAPSHOT</version>
</parent>

<name>DigitalCollections: Model (Jackson)</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,11 @@ public void testSerializeDeserialize() throws Exception {
Headword headword = createObject();
checkSerializeDeserialize(headword, "serializedTestObjects/semantic/Headword.json");
}

@Test
public void testLabelNormalizedSerializeDeserialize() throws Exception {
Headword headword = new Headword("État", Locale.FRENCH);
headword.setLabelNormalized("Etat");
checkSerializeDeserialize(headword, "serializedTestObjects/semantic/Headword_normalized.json");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"objectType" : "HEADWORD",
"label" : "État",
"labelNormalized" : "Etat",
"locale" : "fr"
}
2 changes: 1 addition & 1 deletion dc-model-mappings/dc-model-html-mapping/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>de.digitalcollections.model</groupId>
<artifactId>dc-model-mappings</artifactId>
<version>12.0.1</version>
<version>12.1.0-SNAPSHOT</version>
</parent>

<name>DigitalCollections: Model (Mappings: HTML)</name>
Expand Down
2 changes: 1 addition & 1 deletion dc-model-mappings/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>de.digitalcollections.model</groupId>
<artifactId>dc-model-parent</artifactId>
<version>12.0.1</version>
<version>12.1.0-SNAPSHOT</version>
</parent>

<name>DigitalCollections: Model (Mappings)</name>
Expand Down
2 changes: 1 addition & 1 deletion dc-model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>de.digitalcollections.model</groupId>
<artifactId>dc-model-parent</artifactId>
<version>12.0.1</version>
<version>12.1.0-SNAPSHOT</version>
</parent>

<name>DigitalCollections: Model (Model)</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
public class Headword extends UniqueObject {

private String label;
private String labelNormalized;
private Locale locale;

public Headword() {}
Expand All @@ -31,10 +32,19 @@ public Headword(String label, Locale locale) {
this.locale = locale;
}

public Headword(String label, String labelNormalized, Locale locale) {
this(label, locale);
this.labelNormalized = labelNormalized;
}

public String getLabel() {
return label;
}

public String getLabelNormalized() {
return labelNormalized;
}

public Locale getLocale() {
return locale;
}
Expand All @@ -43,6 +53,15 @@ public void setLabel(String label) {
this.label = label;
}

/**
* to allow project specific/language independent sorting/searching a normalized version of label
* should be put here. e.g. project specific replacing of characters with diacritics with basic
* form, like "É" normalized to "E" or "Č" to "C".
*/
public void setLabelNormalized(String labelNormalized) {
this.labelNormalized = labelNormalized;
}

public void setLocale(Locale locale) {
this.locale = locale;
}
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>de.digitalcollections.model</groupId>
<artifactId>dc-model-parent</artifactId>
<version>12.0.1</version>
<version>12.1.0-SNAPSHOT</version>
<packaging>pom</packaging>

<modules>
Expand Down

0 comments on commit 883f231

Please sign in to comment.