diff --git a/pom.xml b/pom.xml
index f10fdfb..e61d183 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
fr.insee.pogues
pogues-model
- 1.13.1
+ 1.14.0
jar
Pogues Model
diff --git a/src/main/resources/xsd/Questionnaire.xsd b/src/main/resources/xsd/Questionnaire.xsd
index b3a4632..565411d 100644
--- a/src/main/resources/xsd/Questionnaire.xsd
+++ b/src/main/resources/xsd/Questionnaire.xsd
@@ -6,6 +6,7 @@
+
@@ -220,6 +221,12 @@
+
+
+ References of variables used by pairwise
+ questions to define the indivisuals.
+
+
codeFilters is list of CodeFilter, indicate in this question,
diff --git a/src/main/resources/xsd/multimode/Multimode.xsd b/src/main/resources/xsd/multimode/Multimode.xsd
index 5467145..696f309 100644
--- a/src/main/resources/xsd/multimode/Multimode.xsd
+++ b/src/main/resources/xsd/multimode/Multimode.xsd
@@ -23,7 +23,6 @@
-
diff --git a/src/main/resources/xsd/pairwise/Pairwise.xsd b/src/main/resources/xsd/pairwise/Pairwise.xsd
new file mode 100644
index 0000000..353b931
--- /dev/null
+++ b/src/main/resources/xsd/pairwise/Pairwise.xsd
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+ A pairwise question is defined from source variables
+ which allow to know the individuals we are specifying the links of.
+
+ The name source variable allow to ask the question
+ "what is he nature of the relationship between A and B?".
+
+ The gender and age source variable allow to compute
+ additional information about the indivisuals (to display a recap or to
+ generate complex variables to create filters from).
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/java/fr/insee/pogues/test/JSONDeserializerTest.java b/src/test/java/fr/insee/pogues/test/JSONDeserializerTest.java
index a723c1d..1d6c851 100644
--- a/src/test/java/fr/insee/pogues/test/JSONDeserializerTest.java
+++ b/src/test/java/fr/insee/pogues/test/JSONDeserializerTest.java
@@ -377,4 +377,35 @@ void testExternalVariableIsDeletedOnReset() throws JAXBException {
assertEquals("NUMERO_MENAGE", externalVariableType.getName());
assertTrue(externalVariableType.isDeletedOnReset());
}
+
+ @Test
+ void testPairwiseSourceVariableReferences() throws JAXBException {
+ // Given the JSON of a question with sourceVariableReferences
+ String json = """
+ {
+ "Child": [
+ {
+ "type": "QuestionType",
+ "sourceVariableReferences": {
+ "name": "var-name-id",
+ "gender": "var-gender-id",
+ "age": "var-age-id"
+ }
+ }
+ ]
+ }
+ """;
+
+ // When it is deserialized
+ JSONDeserializer deserializer = new JSONDeserializer();
+ Questionnaire questionnaire = deserializer.deserializeString(json);
+
+ // Then the sourceVariableReferences are correctly deserialized
+ QuestionType pairwiseQuestion = (QuestionType) questionnaire.getChild().getFirst();
+
+ assertNotNull(pairwiseQuestion);
+ assertEquals("var-name-id", pairwiseQuestion.getSourceVariableReferences().getName());
+ assertEquals("var-gender-id", pairwiseQuestion.getSourceVariableReferences().getGender());
+ assertEquals("var-age-id", pairwiseQuestion.getSourceVariableReferences().getAge());
+ }
}
diff --git a/src/test/java/fr/insee/pogues/test/JSONSerializerTest.java b/src/test/java/fr/insee/pogues/test/JSONSerializerTest.java
index c4c969b..bc49cb4 100644
--- a/src/test/java/fr/insee/pogues/test/JSONSerializerTest.java
+++ b/src/test/java/fr/insee/pogues/test/JSONSerializerTest.java
@@ -4,6 +4,7 @@
import fr.insee.pogues.mock.*;
import fr.insee.pogues.model.*;
import org.apache.commons.io.FileUtils;
+import org.apache.logging.log4j.core.util.Source;
import org.json.JSONException;
import org.junit.jupiter.api.Test;
import org.skyscreamer.jsonassert.JSONAssert;
@@ -638,4 +639,41 @@ void serializeExternalVariableIsDeletedOnReset() throws JAXBException, Unsupport
JSONAssert.assertEquals(expectedJson, result, JSONCompareMode.STRICT);
}
+
+ @Test
+ void serializePairwiseSourceVariableReferences() throws JAXBException, UnsupportedEncodingException, JSONException {
+ // Given a questionnaire with a question with sourceVariableReferences
+ Questionnaire questionnaire = new Questionnaire();
+
+ QuestionType pairwiseQuestion = new QuestionType();
+ SourceVariableReferences sourceVariableReferences = new SourceVariableReferences();
+ sourceVariableReferences.setName("var-name-id");
+ sourceVariableReferences.setGender("var-gender-id");
+ sourceVariableReferences.setAge("var-age-id");
+ pairwiseQuestion.setSourceVariableReferences(sourceVariableReferences);
+
+ questionnaire.getChild().add(pairwiseQuestion);
+
+ // When it is serialized
+ JSONSerializer serializer = new JSONSerializer(true);
+ String result = serializer.serialize(questionnaire);
+
+ String expectedJson = """
+ {
+ "Child": [
+ {
+ "type": "QuestionType",
+ "sourceVariableReferences": {
+ "name": "var-name-id",
+ "gender": "var-gender-id",
+ "age": "var-age-id"
+ }
+ }
+ ]
+ }
+ """;
+
+ // Then the sourceVariableReferences are correctly serialized
+ JSONAssert.assertEquals(expectedJson, result, JSONCompareMode.STRICT);
+ }
}