Open topic with navigation

# Create a Question Equivalence Class and Add an Answer

A question equivalence class is a group of equivalent questions. When you have multiple questions with different wording that request the same information, you can combine these questions in a question equivalence class. You also use the question equivalence class to add an answer.

The question equivalence class contains the following information:

- the reference question (a standard question that is the most representative question for the answer).
- the answer to the reference question.
- a list of real, sample questions that are equivalent to the reference question. These questions are stored by adding a question. See Add a Question.
- a question equivalence rule that matches the equivalence question. When a user asks a question, Answer Server uses the question equivalence rule to find a relevant question equivalence class to match. See Question Equivalence Rules.

To create question equivalence classes, you use a `ManageResources` action, with the information about the questions provided in the `Data` parameter as a JSON object.

NOTE:

When you add a question to a question equivalence class, Answer Server automatically updates the question state to `answered`. You cannot delete a question in this state, and you cannot manually move the question out of this state. You must remove the question from the question equivalence class. See Update a Question Equivalence Class.

You must include the `question_id` values for the questions that you want to include in the question equivalence class. You can retrieve the `question_id` values by sending a `GetResources` action. For example:

    http://localhost:12000?Action=GetResources&SystemName=Answerbank&Type=question

You can add multiple question equivalence classes in the same operation, where each question equivalence class is an object in an array.

You can also add a context to a question equivalence class. This information will be returned in the ask response to be used with a future ask action using the same managed context. See Use Context in the Ask Action

The following example adds a single question equivalence class that combines two questions, adds a reference question and an answer, and adds a context. You can also add optional metadata for the answer, such as author information.

    Action=ManageResources&SystemName=AnswerBank
    data={
       "operation":"add",
       "type":"question_equivalence_class",
       "question_equivalence_classes":[
          {
             "question_ids":[
                "9706856188043740111",
                "8129920660480699726"
             ],
             "rule":{"text":"how AND (regular NEAR2 updates) AND MyCompany"},
             "answer":{
                "text":"Send an email to subscribe@example.com, and we'll add you to our monthly newsletter.",
                "metadata":[
                   {"key":"author", "value":"Alex"},
                   {"key":"modified_date", "value":"2017-05-05"}
                ]
             },
             "reference_question":"How do I get regular updates about MyCompany?",
             "context": ["MyCompany"]
          }
       ]
    }

NOTE:

Metadata key names can contain alphanumeric characters (a-z, 0-9), period (.), underscore (_) and hyphen (-). They cannot start with a number. It is also best practice to use field names that conform to XML specifications.

You can retrieve the full schema for the JSON object to use by using the `GetResources` action. See Find the JSON Schema for Your Update.

NOTE:

The `ManageResources` action fails if you attempt to use request JSON that contains properties that are not contained in the appropriate schema.

TIP:

Typically, Micro Focus recommends that you send `ManageResources` as a POST request. For testing, you can use a GET request, in which case you must base64 encode the JSON data.

You can also use the `GetResources` action to generate a rule for your question equivalence class. See Generate a Question Equivalence Rule.

© Copyright 2015-2019 Micro Focus or one of its affiliates | Send documentation feedback Close Send documentation feedback To open the configured email client on this computer, open an email window. Otherwise, copy the information below to a web mail client, and send this email to swpdl.idoldocsfeedback@microfocus.com. We appreciate your feedback! Product: Topic Title: Help Topic: Feedback:

_FT_HTML5_bannerTitle.htm