org.universAAL.middleware.ui
Class UIHandlerProfile

Package class diagram package UIHandlerProfile
java.lang.Object
  extended by org.universAAL.middleware.rdf.Resource
      extended by org.universAAL.middleware.rdf.FinalizedResource
          extended by org.universAAL.middleware.ui.UIHandlerProfile
All Implemented Interfaces:
Advertisement, Matchable, UtilityAdvertisement

public class UIHandlerProfile
extends FinalizedResource
implements UtilityAdvertisement

A profile of the UIHandler that describes its capabilites so that they can be matched with UIRequest ( more specifically User preferences and abilities added by the IDialogManager) and possibly some additional parameters.

Author:
mtazari, Carsten Stockloew, eandgrg

Field Summary
static int MATCH_ADDRESED_USER
           
static int MATCH_ALT_MODALITY
           
static int MATCH_DIALOG_FORM
           
static int MATCH_DIALOG_LANGUAGE
           
static int MATCH_DIALOG_PRIVACY
           
static int MATCH_LEVEL_FAILED
           
static int MATCH_MAIN_MODALITY
           
static int MATCH_USER_IMPAIRMENTS
           
static int MATCH_USER_LOCATION
           
static String MY_URI
           
 
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
UIHandlerProfile()
          Instantiates a new UIHandlerProfile.
 
Method Summary
 boolean addRestriction(MergedRestriction mergedRestriction)
          Adds the restriction.
 int getMatchingDegree(UIRequest uiRequest)
          Determines whether the given UIRequest matches this profile and returns the weighted matching degree.
 Modality[] getSupportedInputModalities()
          Gets the supported input modalities.
 boolean isClosedCollection(String propURI)
          Returns true if the value of the given property should be treated as an rdf:List.
 boolean isWellFormed()
          Returns true, if the state of the resource is valid, otherwise false.
 boolean matches(Matchable subset)
           
 boolean setProperty(String propURI, Object value)
          Adds a statement with this resource as the subject, the given propURI as the predicate and the given value as the object.
 boolean setSupportedInputModalities(Modality[] modalities)
          Sets the supported input modalities.
 
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, copy, deepCopy, equals, generateAnonURI, getDefaultLang, getFilename, getMultiLangProp, getOrConstructLabel, getPropSerializationType, getResource, getResourceComment, getResourceLabel, getStaticFieldValue, hashCode, hasProperty, isAnon, isBlockingAddingTypes, isQualifiedName, literal, representsQualifiedURI, serializesAsXMLLiteral, setPropertyPath, setPropertyPath, setPropertyPathFromOffset, 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

MATCH_ADDRESED_USER

public static final int MATCH_ADDRESED_USER
See Also:
Constant Field Values

MATCH_MAIN_MODALITY

public static final int MATCH_MAIN_MODALITY
See Also:
Constant Field Values

MATCH_ALT_MODALITY

public static final int MATCH_ALT_MODALITY
See Also:
Constant Field Values

MATCH_USER_LOCATION

public static final int MATCH_USER_LOCATION
See Also:
Constant Field Values

MATCH_USER_IMPAIRMENTS

public static final int MATCH_USER_IMPAIRMENTS
See Also:
Constant Field Values

MATCH_DIALOG_PRIVACY

public static final int MATCH_DIALOG_PRIVACY
See Also:
Constant Field Values

MATCH_DIALOG_LANGUAGE

public static final int MATCH_DIALOG_LANGUAGE
See Also:
Constant Field Values

MATCH_DIALOG_FORM

public static final int MATCH_DIALOG_FORM
See Also:
Constant Field Values

MATCH_LEVEL_FAILED

public static final int MATCH_LEVEL_FAILED
See Also:
Constant Field Values
Constructor Detail

UIHandlerProfile

public UIHandlerProfile()
Instantiates a new UIHandlerProfile.

Method Detail

addRestriction

public boolean addRestriction(MergedRestriction mergedRestriction)
Adds the restriction.

Parameters:
mergedRestriction - the restriction

getMatchingDegree

public int getMatchingDegree(UIRequest uiRequest)
Determines whether the given UIRequest matches this profile and returns the weighted matching degree. In UIStrategy (from there this method is called when selecting the best UIHandler for certain UIRequest) additional weight is added on this one that reflects the lastly used UIHandler.

Parameters:
uiRequest - the UIRequest
Returns:
a value indicating to which degree the UIRequest matches the UIHandlerProfile

isClosedCollection

public boolean isClosedCollection(String propURI)
Description copied from class: Resource
Returns true if the value of the given property should be treated as an rdf:List. Serializers can use this to determine if a multi-valued property should be serialized using the concept of rdf:List or the property should appear as often as the number of values assigned to the property. The default behavior is that a property associated with an instance of List is assumed to be a closed collection (unless it is specifically an instance of OpenCollection). Subclasses can change this, if needed.

Overrides:
isClosedCollection in class Resource
See Also:
Resource.isClosedCollection(java.lang.String )

setProperty

public boolean setProperty(String propURI,
                           Object value)
Description copied from class: Resource
Adds a statement with this resource as the subject, the given propURI as the predicate and the given value as the object. Subclasses must override this in order to decide if the statement to be added fits the general class constraints. If not, the call of this method should be ignored. For each property only one single call may be made to this method, unless subsequent calls to this method for setting the value of the same property are treated as an update for an update-able property. Multi-valued properties must be set using an instance of List. The differentiation, if a such list should be treated as an rdf:List, can be made with the help of Resource.isClosedCollection(String). The default implementation here accepts all property-value pairs blindly except for rdf:type which is handled if the value is a type URI, a Resource or a java.util.List of them.

Note: The setting of the property rdf:type is being handled by this class via the final methods Resource.addType(String, boolean), Resource.getType(), and Resource.getTypes(). Although these methods give the view of handling type URIs as strings, but in reality the types are stored as direct instances of this class. So, the subclasses should ignore calls for setting rdf:type; if not, then the subclass must pay attention that the value should be a List of direct instances of this class so that (1) the Resource.toString() method returns just the URI and (2) the serializers get no problems with the value. Also, settings via subclasses may be overwritten by this class if a subsequent call to Resource.addType(String, boolean) is made.

Overrides:
setProperty in class Resource
Returns:
true if the property changed as a result of the call
See Also:
Resource.setProperty(java.lang.String, java.lang.Object)

matches

public boolean matches(Matchable subset)
Specified by:
matches in interface Matchable
Returns:
true if the other Matchable matches, false if not
See Also:
Matchable.matches(Matchable)

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 Resource
See Also:
Resource.isWellFormed()

setSupportedInputModalities

public boolean setSupportedInputModalities(Modality[] modalities)
Sets the supported input modalities.

Parameters:
modalities - the new supported input modalities

getSupportedInputModalities

public Modality[] getSupportedInputModalities()
Gets the supported input modalities.

Returns:
the supported input modalities


Copyright © 2014 universAAL Consortium. All Rights Reserved.