org.universAAL.ontology.questionnaire
Class Question

Package class diagram package Question
java.lang.Object
  extended by org.universAAL.middleware.rdf.Resource
      extended by org.universAAL.middleware.rdf.FinalizedResource
          extended by org.universAAL.middleware.owl.ManagedIndividual
              extended by org.universAAL.ontology.questionnaire.Question
Direct Known Subclasses:
ConditionalQuestion, MultiChoiceQuestion, QuestionWithMedia, SingleChoiceQuestion

public abstract class Question
extends ManagedIndividual

This class describes the concept of Question, its properties and its associated methods.

Author:
mdelafuente

Field Summary
static String MY_URI
           
static String PROP_ANSWER_TYPE_U_R_I
           
static String PROP_CORRECT_ANSWER
           
static String PROP_HAS_CHOICE_LABEL
           
static String PROP_HAS_CORRECT_ANSWER
           
static String PROP_QUESTION_WORDING
           
 
Fields inherited from class org.universAAL.middleware.owl.ManagedIndividual
OWL_NAMESPACE, TYPE_OWL_INDIVIDUAL, TYPE_OWL_THING
 
Fields inherited from class org.universAAL.middleware.rdf.Resource
ANON_URI_PREFIX, blockAddingTypes, isXMLLiteral, ns_delim_index, PROP_RDF_FIRST, PROP_RDF_REST, PROP_RDF_TYPE, PROP_RDFS_COMMENT, PROP_RDFS_LABEL, PROP_SERIALIZATION_FULL, PROP_SERIALIZATION_OPTIONAL, PROP_SERIALIZATION_REDUCED, PROP_SERIALIZATION_UNDEFINED, PROP_uAAL_INVOLVED_HUMAN_USER, props, RDF_EMPTY_LIST, RDF_NAMESPACE, RDFS_NAMESPACE, TYPE_RDF_LIST, TYPE_RDFS_CLASS, uAAL_NAMESPACE_PREFIX, uAAL_SERVICE_NAMESPACE, uAAL_VOCABULARY_NAMESPACE, uri
 
Constructor Summary
Question()
           
Question(String uri)
           
Question(String qWording, Object[] correctAnswer, String[] answerType, ChoiceLabel[] choices)
          A Question can be implemented with the question wording, the answer type, and the possible choices, when a set of correct answers is given.
Question(String qWording, Object correctAnswer, String answerType, ChoiceLabel[] choices)
          A Question can be implemented with the question wording, the answer type, and the possible choices, when a correct answer is given.
Question(String qWording, String answerType)
          A Question can be implemented with the question wording and the answer type if there is not a correct answer for the question.
Question(String qWording, String answerType, ChoiceLabel[] choices)
          A Question can be implemented with the question wording, the answer type and the possible choices, when a correct answer is not specified
 
Method Summary
 void addAnswerTypeURI(String answerType)
          The following method sets the answer type associated to a question.
 void addCorrectAnswer(Object correctAnswer)
          The following method sets the correct answer associated to a question.
 String[] getAnswerTypeURI()
          The following method gets the answer type associated to a question.
 ChoiceLabel[] getChoiceLabel()
          The following method returns the choices of a question
 String getClassURI()
          Get the class URI for this ManagedIndividual.
 Object[] getCorrectAnswers()
          The following method gets the correct answer associated to a question.
 String getLabel(Object choice)
          The following method gets the label associated to a choice.
 int getNumberOfChoices()
          The following method returns the number of questions associated to a question
 int getPropSerializationType(String arg0)
          Answers if the given property has to be considered when serializing this individual in a minimized way, and if not ignore-able, whether its value should be presented in its full form or can be reduced.
 String getQuestionWording()
          The following method gets the question wording
 boolean isHasCorrectAnswer()
          The following method checks whether a question has or not a correct answer.
 boolean isWellFormed()
          Returns true, if the state of the resource is valid, otherwise false.
 void setAnswerTypeURI(String[] answerType)
           
 void setChoices(ChoiceLabel[] choices)
          The following method set the choices of a question
 void setCorrectAnswer(Object[] correctAnswers)
          The following method sets the correct answers associated to a question.
 void setHasCorrectAnswer(boolean correctAnswer)
          The following method sets whether a question has or not a correct answer.
 void setQuestionWording(String qWording)
          The following method sets the question wording
 
Methods inherited from class org.universAAL.middleware.owl.ManagedIndividual
checkCompatibility, checkMembership, copy, deepCopy, getClassRestrictionsOnProperty, getInstance, getNonAbstractSuperClasses, getNonabstractSuperClasses, getOntClassInfo, getTypeURI, isRegisteredClassURI, setProperty, setPropertyPathFromOffset, toManagedIndividual
 
Methods inherited from class org.universAAL.middleware.rdf.FinalizedResource
addType, getLocalName, getNamespace, getProperty, getPropertyURIs, getType, getTypes, getURI, hasQualifiedName, isAnon, numberOfProperties
 
Methods inherited from class org.universAAL.middleware.rdf.Resource
addMultiLangProp, asList, asList, asRDFList, changeProperty, equals, generateAnonURI, getDefaultLang, getFilename, getMultiLangProp, getOrConstructLabel, getResource, getResourceComment, getResourceLabel, getStaticFieldValue, hashCode, hasProperty, isAnon, isBlockingAddingTypes, isClosedCollection, isQualifiedName, literal, representsQualifiedURI, serializesAsXMLLiteral, setPropertyPath, setPropertyPath, setResourceComment, setResourceLabel, toString, toStringRecursive, toStringRecursive, unliteral
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

MY_URI

public static final String MY_URI
See Also:
Constant Field Values

PROP_CORRECT_ANSWER

public static final String PROP_CORRECT_ANSWER
See Also:
Constant Field Values

PROP_HAS_CORRECT_ANSWER

public static final String PROP_HAS_CORRECT_ANSWER
See Also:
Constant Field Values

PROP_HAS_CHOICE_LABEL

public static final String PROP_HAS_CHOICE_LABEL
See Also:
Constant Field Values

PROP_ANSWER_TYPE_U_R_I

public static final String PROP_ANSWER_TYPE_U_R_I
See Also:
Constant Field Values

PROP_QUESTION_WORDING

public static final String PROP_QUESTION_WORDING
See Also:
Constant Field Values
Constructor Detail

Question

public Question()

Question

public Question(String uri)

Question

public Question(String qWording,
                String answerType)
A Question can be implemented with the question wording and the answer type if there is not a correct answer for the question.

Parameters:
qWording -
hasCorrectAnswer -
answerType -

Question

public Question(String qWording,
                String answerType,
                ChoiceLabel[] choices)
A Question can be implemented with the question wording, the answer type and the possible choices, when a correct answer is not specified

Parameters:
qWording -
answerType -
choices -

Question

public Question(String qWording,
                Object correctAnswer,
                String answerType,
                ChoiceLabel[] choices)
A Question can be implemented with the question wording, the answer type, and the possible choices, when a correct answer is given.

Parameters:
qWording -
hasCorrectAnswer -
correctAnswer -
answerType -
choices -

Question

public Question(String qWording,
                Object[] correctAnswer,
                String[] answerType,
                ChoiceLabel[] choices)
A Question can be implemented with the question wording, the answer type, and the possible choices, when a set of correct answers is given.

Parameters:
qWording -
correctAnswer -
answerType -
choices -
Method Detail

getClassURI

public String getClassURI()
Description copied from class: ManagedIndividual
Get the class URI for this ManagedIndividual. All non-abstract subclasses MUST overwrite this method!

Overrides:
getClassURI in class ManagedIndividual
Returns:
The class URI.

getPropSerializationType

public int getPropSerializationType(String arg0)
Description copied from class: ManagedIndividual
Answers if the given property has to be considered when serializing this individual in a minimized way, and if not ignore-able, whether its value should be presented in its full form or can be reduced. The return value must be one of Resource.PROP_SERIALIZATION_OPTIONAL, Resource.PROP_SERIALIZATION_REDUCED, or Resource.PROP_SERIALIZATION_FULL. It can be assumed that the given property is one of those returned by FinalizedResource.getPropertyURIs(). Decision criterion should be if the value of this property is absolutely necessary when this resource is being sent to a remote node. If the subclass rates it as unlikely that the receiver side would need this info, the answer should be PROP_SERIALIZATION_OPTIONAL in favor of lower communication traffic and higher performance even at risk of a possible additional query on the receiver side for fetching this info. With the same rationale, if a property should be included in the process of serialization, it is preferable to include it in a reduced form; in this case the return value should be PROP_SERIALIZATION_REDUCED, otherwise PROP_SERIALIZATION_FULL can be returned.

Specified by:
getPropSerializationType in class ManagedIndividual

isWellFormed

public boolean isWellFormed()
Description copied from class: Resource
Returns true, if the state of the resource is valid, otherwise false.

Subclasses should overwrite this methods as the default implementation returns always true.

Overrides:
isWellFormed in class ManagedIndividual
See Also:
Resource.isWellFormed()

getQuestionWording

public String getQuestionWording()
The following method gets the question wording

Returns:
question wording (String)

setQuestionWording

public void setQuestionWording(String qWording)
The following method sets the question wording

Parameters:
qWording - , the question wording (String)

isHasCorrectAnswer

public boolean isHasCorrectAnswer()
The following method checks whether a question has or not a correct answer.

Returns:
true if the question has a correct answer

setHasCorrectAnswer

public void setHasCorrectAnswer(boolean correctAnswer)
The following method sets whether a question has or not a correct answer.

Parameters:
correctAnswer - (boolean) true if the question has a correct answer, false if not.

getCorrectAnswers

public Object[] getCorrectAnswers()
The following method gets the correct answer associated to a question.

Returns:
correctAnswer (Object)
See Also:
Answer

setCorrectAnswer

public void setCorrectAnswer(Object[] correctAnswers)
The following method sets the correct answers associated to a question.

Parameters:
correctAnswers - (Object)
See Also:
Answer

addCorrectAnswer

public void addCorrectAnswer(Object correctAnswer)
The following method sets the correct answer associated to a question.

Parameters:
correctAnswer - (Object)
See Also:
Answer

getAnswerTypeURI

public String[] getAnswerTypeURI()
The following method gets the answer type associated to a question.

Returns:
answer type URI (String)

addAnswerTypeURI

public void addAnswerTypeURI(String answerType)
The following method sets the answer type associated to a question.

Parameters:
answerType - , the URI of the answer type (String)

setAnswerTypeURI

public void setAnswerTypeURI(String[] answerType)

getChoiceLabel

public ChoiceLabel[] getChoiceLabel()
The following method returns the choices of a question

Returns:
choices (ChoiceLabel)
See Also:
ChoiceLabel

setChoices

public void setChoices(ChoiceLabel[] choices)
The following method set the choices of a question

Parameters:
choices - (ChoiceLabel)
See Also:
ChoiceLabel

getNumberOfChoices

public int getNumberOfChoices()
The following method returns the number of questions associated to a question

Returns:
number of questions (integer)

getLabel

public String getLabel(Object choice)
The following method gets the label associated to a choice.

Parameters:
choice - (Object)
Returns:
label (String)
See Also:
ChoiceLabel


Copyright © 2014 universAAL Consortium. All Rights Reserved.