org.universAAL.middleware.service.owl
Class Service

Package class diagram package Service
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.middleware.service.owl.Service
Direct Known Subclasses:
ActivityHub, AuthenticationService, CameraService, ContactManagementService, ContextHistoryService, ContinuaHealthManager, DeviceService, DisplayTreatmentService, DroolsReasoning, HandGestureService, HealthService, Lighting, LightingSimplified, LoudSpeakerService, MicrophoneService, ProfilingEditorService, ProfilingService, QuestionnaireService, ReasoningService, SessionManagementService, SimplifiedApiService, SpaceConfigurationService, UIPreferencesService, UnitConversionService, UnitService, UserInterfaceService, X73

public abstract class Service
extends ManagedIndividual

The root of the hierarchy of service classes in universAAL.

All subclasses must follow the conventions declared by ManagedIndividual.

The main characteristic of services is that they specify their view on their domain by restricting some of the relevant properties from the domain ontology that are reachable from the service class using a sequence of properties. The universAAL middleware calls such sequences a PropertyPath. Subclasses must define a static repository for such restrictions as an empty instance of Hashtable and add their class-level restrictions to this repository a static code segment using the help method addRestriction(MergedRestriction, String[], Hashtable).

In addition to class-level restrictions, concrete instances can add instance-level restrictions using references to their input parameters (see ProcessParameter.asVariableReference() ). The help method addInstanceLevelRestriction(MergedRestriction, String[]) facilitates the addition of such instance-level restrictions.

Author:
mtazari - Saied Tazari

Field Summary
protected  Hashtable instanceLevelRestrictions
          The instance-level repository of defined restrictions on property paths.
static String MY_URI
           
protected  ServiceProfile myProfile
           
protected  int numberOfValueRestrictions
           
static String OWLS_NAMESPACE_PREFIX
           
static String OWLS_SERVICE_NAMESPACE
           
static String PROP_INSTANCE_LEVEL_RESTRICTIONS
           
static String PROP_NUMBER_OF_VALUE_RESTRICTIONS
           
static String PROP_OWLS_PRESENTED_BY
          The OWL-S property http://www.daml.org/services/owl-s/1.1/Service.owl#presentedBy
static String PROP_OWLS_PRESENTS
          The OWL-S property http://www.daml.org/services/owl-s/1.1/Service.owl#presents
 
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
protected Service()
           
protected Service(String uri)
           
 
Method Summary
protected  void addFilteringInput(String inParamURI, String typeURI, int minCardinality, int maxCardinality, String[] propPath)
          Adds a restriction to a given input
protected  void addFilteringType(String inParamURI, String[] propPath)
          Adds a restriction to a given input
protected  void addInputWithAddEffect(String inParamURI, String typeURI, int minCardinality, int maxCardinality, String[] propPath)
          Adds an add effect to default profile
protected  void addInputWithChangeEffect(String inParamURI, String typeURI, int minCardinality, int maxCardinality, String[] propPath)
          Adds a change effect to default profile
protected  void addInputWithRemoveEffect(String inParamURI, String typeURI, int minCardinality, int maxCardinality, String[] propPath)
          Adds a remove effect to default profile
 boolean addInstanceLevelRestriction(MergedRestriction r, String[] toPath)
          A method for adding instance-level restrictions.
protected  void addOutput(String outParamURI, String typeURI, int minCardinality, int maxCardinality, String[] propPath)
          Adds configured output to default profile
protected static boolean addRestriction(MergedRestriction r, String[] toPath, Hashtable restrictions)
          A help method for subclasses to manage their restrictions on properties (from the domain ontology) that are reachable from the subclass, provided that they have a static Hashtable for gathering them.
protected  ProcessInput createInput(String inParamURI, String typeURI, int minCardinality, int maxCardinality)
          Creates an input from the given URI and cardinality
 Object getInstanceLevelFixedValueOnProp(String propURI)
           
 MergedRestriction getInstanceLevelRestrictionOnProp(String propURI)
          Returns the restriction on the given propPath, if it was previously added to instanceLevelRestrictions using addRestriction(MergedRestriction, String[], Hashtable).
 int getNumberOfValueRestrictions()
           
 ServiceProfile getProfile()
           
 int getPropSerializationType(String propURI)
          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[] getRestrictedPropsOnInstanceLevel()
          Returns the set of properties restricted at instance level.
protected static MergedRestriction getRestrictionOnPropPath(Hashtable restrictions, String[] propPath)
          A restriction previously added by addRestriction(MergedRestriction, String[], Hashtable) to the given propPath using the same hash-table of restrictions will be returned by this method.
 boolean setProperty(String propURI, Object value)
          The default implementation that will set a property if it was not set before and the given value complies with the restrictions defined by this class of managed individuals for the given propURI.
 
Methods inherited from class org.universAAL.middleware.owl.ManagedIndividual
checkCompatibility, checkMembership, copy, deepCopy, getClassRestrictionsOnProperty, getClassURI, getInstance, getNonAbstractSuperClasses, getNonabstractSuperClasses, getOntClassInfo, getTypeURI, isRegisteredClassURI, isWellFormed, 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

OWLS_NAMESPACE_PREFIX

public static final String OWLS_NAMESPACE_PREFIX
See Also:
Constant Field Values

OWLS_SERVICE_NAMESPACE

public static final String OWLS_SERVICE_NAMESPACE
See Also:
Constant Field Values

PROP_INSTANCE_LEVEL_RESTRICTIONS

public static final String PROP_INSTANCE_LEVEL_RESTRICTIONS
See Also:
Constant Field Values

PROP_NUMBER_OF_VALUE_RESTRICTIONS

public static final String PROP_NUMBER_OF_VALUE_RESTRICTIONS
See Also:
Constant Field Values

PROP_OWLS_PRESENTS

public static final String PROP_OWLS_PRESENTS
The OWL-S property http://www.daml.org/services/owl-s/1.1/Service.owl#presents


PROP_OWLS_PRESENTED_BY

public static final String PROP_OWLS_PRESENTED_BY
The OWL-S property http://www.daml.org/services/owl-s/1.1/Service.owl#presentedBy


MY_URI

public static final String MY_URI

instanceLevelRestrictions

protected final Hashtable instanceLevelRestrictions
The instance-level repository of defined restrictions on property paths. For adding instance-level restrictions to this repository, the method addRestriction(MergedRestriction, String[], java.util.Hashtable) must be used.


numberOfValueRestrictions

protected int numberOfValueRestrictions

myProfile

protected ServiceProfile myProfile
Constructor Detail

Service

protected Service()

Service

protected Service(String uri)
Method Detail

addRestriction

protected static final boolean addRestriction(MergedRestriction r,
                                              String[] toPath,
                                              Hashtable restrictions)
A help method for subclasses to manage their restrictions on properties (from the domain ontology) that are reachable from the subclass, provided that they have a static Hashtable for gathering them.

Parameters:
r - the restriction to be added on the last element of the path given by 'toPath'.
toPath - the path to which the given restriction must be bound. It must start with a property from the service class and address a reachable property from the domain ontology; the last element of the path must be equal to r.getOnProperty().
restrictions - a class-level static hash-table for managing restrictions
Returns:
true, if all constraints held and the restriction could be added; otherwise, false.

getRestrictionOnPropPath

protected static final MergedRestriction getRestrictionOnPropPath(Hashtable restrictions,
                                                                  String[] propPath)
A restriction previously added by addRestriction(MergedRestriction, String[], Hashtable) to the given propPath using the same hash-table of restrictions will be returned by this method.


addInstanceLevelRestriction

public final boolean addInstanceLevelRestriction(MergedRestriction r,
                                                 String[] toPath)
A method for adding instance-level restrictions.

See Also:
instanceLevelRestrictions, addRestriction(MergedRestriction, String[], Hashtable)

getInstanceLevelFixedValueOnProp

public final Object getInstanceLevelFixedValueOnProp(String propURI)

getInstanceLevelRestrictionOnProp

public final MergedRestriction getInstanceLevelRestrictionOnProp(String propURI)
Returns the restriction on the given propPath, if it was previously added to instanceLevelRestrictions using addRestriction(MergedRestriction, String[], Hashtable).


getNumberOfValueRestrictions

public final int getNumberOfValueRestrictions()

getProfile

public final ServiceProfile getProfile()

createInput

protected ProcessInput createInput(String inParamURI,
                                   String typeURI,
                                   int minCardinality,
                                   int maxCardinality)
Creates an input from the given URI and cardinality


addFilteringInput

protected void addFilteringInput(String inParamURI,
                                 String typeURI,
                                 int minCardinality,
                                 int maxCardinality,
                                 String[] propPath)
Adds a restriction to a given input


addFilteringType

protected void addFilteringType(String inParamURI,
                                String[] propPath)
Adds a restriction to a given input


addInputWithAddEffect

protected void addInputWithAddEffect(String inParamURI,
                                     String typeURI,
                                     int minCardinality,
                                     int maxCardinality,
                                     String[] propPath)
Adds an add effect to default profile


addInputWithChangeEffect

protected void addInputWithChangeEffect(String inParamURI,
                                        String typeURI,
                                        int minCardinality,
                                        int maxCardinality,
                                        String[] propPath)
Adds a change effect to default profile


addInputWithRemoveEffect

protected void addInputWithRemoveEffect(String inParamURI,
                                        String typeURI,
                                        int minCardinality,
                                        int maxCardinality,
                                        String[] propPath)
Adds a remove effect to default profile


addOutput

protected void addOutput(String outParamURI,
                         String typeURI,
                         int minCardinality,
                         int maxCardinality,
                         String[] propPath)
Adds configured output to default profile


getPropSerializationType

public int getPropSerializationType(String propURI)
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
See Also:
ManagedIndividual.getPropSerializationType(java.lang.String)

getRestrictedPropsOnInstanceLevel

public final String[] getRestrictedPropsOnInstanceLevel()
Returns the set of properties restricted at instance level.


setProperty

public boolean setProperty(String propURI,
                           Object value)
Description copied from class: ManagedIndividual
The default implementation that will set a property if it was not set before and the given value complies with the restrictions defined by this class of managed individuals for the given propURI.

Overrides:
setProperty in class ManagedIndividual
Returns:
true if the property changed as a result of the call


Copyright © 2014 universAAL Consortium. All Rights Reserved.