org.universAAL.middleware.owl
Class ManagedIndividual

Package class diagram package ManagedIndividual
java.lang.Object
  extended by org.universAAL.middleware.rdf.Resource
      extended by org.universAAL.middleware.rdf.FinalizedResource
          extended by org.universAAL.middleware.owl.ManagedIndividual
Direct Known Subclasses:
AALService, AbsoluteTimeStamp, AccessImpairment, ActivityHubSensorEvent, Address, AlertType, Answer, AnsweredQuestionnaire, AudioFile, BloodPressureMeasurement, ChoiceLabel, ColorType, ComparableIndividual, compoundBasicNuValue, Compression, ConnectionDetails, Consequence, ConsequenceProperty, ContactListSubProfile, ContentDensityType, ContextEvent, ContextProvider, ContextProviderType, ContinuaHealthDevice, CoordinateSystem, Credentials, Diagnostic, DialogType, Disease, DiseaseSeverityStatus, DiseaseTimeEvolvingStatus, DosageValue, Email, EndPoint, Epidemiology, ErrorDetector, Etiology, ExitValue, Fact, FactProperty, Fault, FCR, Format, FurnitureType, Gender, GenericFontFamily, GestureRecognition, HandGestures, HandGestureType, HealthMeasurement, Intensity, Language, LightType, MainMenuConfigurationType, MDSAttribute, MeasurableDimension, Measurement, MeasurementRequirements, MenuEntry, Modality, MotionValue, MotivationalStatusType, MyConcept, MyEnumeration, Name, OntologyEntry, Organization, Patogeny, PendingDialogsBuilderType, PendingMessageBuilderType, PerformedSession, Persistent, PhysicalThing, PlannedSession, Preference, Prefix, Profilable, Profile, Pronostic, Property, Question, Questionnaire, Recommendation, RecoveryAction, Requirement, RoomFunction, Rule, Service, Session, Shape, Size, SizeUnit, Status, StatusType, StatusValue, Stream, SubProfile, Sympthom, Symptom, SystemModel, Tel, TemperatureLevelValue, Treatment, TreatmentPlanning, Unit, UnitSystem, ValueType, VCard, VoiceGender, WindowLayoutType

public abstract class ManagedIndividual
extends FinalizedResource

The root of the whole manageable class hierarchy in uAAL.

Conventions to be followed by all subclasses in the class hierarchy rooted at ManagedIndividual are:

  1. They should define a public static final field of type String with the name MY_URI initialized by the URI of the ontology class they represent.
  2. They MUST overwrite the method getClassURI() which usually just returns MY_URI.
  3. All sub classes MUST be registered by creating a sub class of Ontology and registering this at the OntologyManagement.
  4. Instance methods that are serious candidates to be overwritten are Resource.isClosedCollection(String) and setProperty(String, Object). Please read the comments below on these methods as well as comments provided within Resource.

Author:
mtazari - Saied Tazari, cstockloew

Field Summary
static String MY_URI
          The URI of the ontology class.
static String OWL_NAMESPACE
          URI namespace for OWL.
static String TYPE_OWL_INDIVIDUAL
          Definition of owl:Individual.
static String TYPE_OWL_THING
          Definition of 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 ManagedIndividual()
          The constructor for (de-)serializers.
protected ManagedIndividual(String uri)
          Creates an instance of ManagedIndividual with a given URI.
protected ManagedIndividual(String uriPrefix, int numProps)
          Creates an instance of ManagedIndividual with a URI that is created by appending a unique ID to the given 'uriPrefix'.
 
Method Summary
static boolean checkCompatibility(String supertypeURI, String subtypeURI)
          Assuming that the given parameters are the URIs of two registered classes or datatypes, checks if the second type is derived from the first one.
static boolean checkMembership(String typeURI, Object value)
          Checks if the given value object is an instance of the type with the given URI.
 Resource copy(boolean isXMLLiteral)
          Create a copy of this resource.
 Resource deepCopy()
          Create a deep copy of this ManagedIndividual, i.e. create a new ManagedIndividual for this object (according to the class URI of this object) and for the resources of all properties.
static MergedRestriction getClassRestrictionsOnProperty(String classURI, String propURI)
          Returns the restrictions that apply to the given property in the context of the class with the given URI.
 String getClassURI()
          Get the class URI for this ManagedIndividual.
static ManagedIndividual getInstance(String classURI, String instanceURI)
          Returns an instance of a registered subclass selected by the given class URI.
static Vector getNonAbstractSuperClasses(ManagedIndividual indi)
           
static String[] getNonabstractSuperClasses(String classURI)
          For a given class URI get the set of URIs for all super classes which are instanceable (which are not abstract)
 OntClassInfo getOntClassInfo()
          Get the ontological information for this individual.
abstract  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.
static String getTypeURI(Object o)
          Get the class URI for a given object.
static boolean isRegisteredClassURI(String classURI)
          Checks if a registered class with the given URI can be found.
 boolean isWellFormed()
          Returns true, if the state of the resource is valid, otherwise false.
 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.
 boolean setPropertyPathFromOffset(String[] propPath, int fromIndex, Object value, boolean force)
          Change or add the Resource at the end of the given property path to the given value.
static Resource toManagedIndividual(String classURI, Resource pr)
          For a given Resource, create a new instance of ManagedIndividual with the given class URI and copy all properties from the Resource object to this new ManagedIndividual.
 
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

OWL_NAMESPACE

public static final String OWL_NAMESPACE
URI namespace for OWL.

See Also:
Constant Field Values

TYPE_OWL_INDIVIDUAL

public static final String TYPE_OWL_INDIVIDUAL
Definition of owl:Individual.

See Also:
Constant Field Values

TYPE_OWL_THING

public static final String TYPE_OWL_THING
Definition of owl:Thing.

See Also:
Constant Field Values

MY_URI

public static final String MY_URI
The URI of the ontology class. Must be overwritten

See Also:
Constant Field Values
Constructor Detail

ManagedIndividual

protected ManagedIndividual()
The constructor for (de-)serializers.


ManagedIndividual

protected ManagedIndividual(String uri)
Creates an instance of ManagedIndividual with a given URI.

Parameters:
uri - The URI.

ManagedIndividual

protected ManagedIndividual(String uriPrefix,
                            int numProps)
Creates an instance of ManagedIndividual with a URI that is created by appending a unique ID to the given 'uriPrefix'. This constructor has a pseudo parameter 'numProps' in order to make it distinct from the other constructor that also takes a string. Later versions of ManagedIndividual may decide to make some use of numProps in some way, however.

Parameters:
uriPrefix - Prefix of the URI.
numProps - Not used.
See Also:
Resource.Resource(String, int)
Method Detail

checkCompatibility

public static final boolean checkCompatibility(String supertypeURI,
                                               String subtypeURI)
Assuming that the given parameters are the URIs of two registered classes or datatypes, checks if the second type is derived from the first one.

Parameters:
supertypeURI - The URI of the class that is assumed to be the super class of the second parameter.
subtypeURI - The URI of the class that needs to be checked whether it is derived from the first parameter.
Returns:
true, if the second type is derived from the first one.

checkMembership

public static final boolean checkMembership(String typeURI,
                                            Object value)
Checks if the given value object is an instance of the type with the given URI. It uses the information provided in the ontologies about inheritance of the registered classes and types for checking compatibility.

Parameters:
typeURI - The URI of the class that is assumed to be the super class of the second parameter.
value - An instance of the class that needs to be checked whether it is derived from the first parameter.
Returns:
true, if the second type is derived from the first one.

getClassRestrictionsOnProperty

public static final MergedRestriction getClassRestrictionsOnProperty(String classURI,
                                                                     String propURI)
Returns the restrictions that apply to the given property in the context of the class with the given URI.

Parameters:
classURI - URI of the class for which the restrictions apply.
propURI - URI of the property.

getInstance

public static final ManagedIndividual getInstance(String classURI,
                                                  String instanceURI)
Returns an instance of a registered subclass selected by the given class URI. Only if the selected subclass has a distinguished instance with the given URI, the returned instance will be well-formed, otherwise it is just an "empty" one that must be "filled in" by setting its properties.


getNonAbstractSuperClasses

public static Vector getNonAbstractSuperClasses(ManagedIndividual indi)

getNonabstractSuperClasses

public static final String[] getNonabstractSuperClasses(String classURI)
For a given class URI get the set of URIs for all super classes which are instanceable (which are not abstract)

Parameters:
classURI - The URI for which to get the super classes.
Returns:
The set of URIs for all non-abstract super classes.

getTypeURI

public static final String getTypeURI(Object o)
Get the class URI for a given object. If the object is an instance of List, the class URI for the first object from this list is returned.

Parameters:
o - The object for which to return the class URI.
Returns:
The class URI.

isRegisteredClassURI

public static final boolean isRegisteredClassURI(String classURI)
Checks if a registered class with the given URI can be found.


toManagedIndividual

public static Resource toManagedIndividual(String classURI,
                                           Resource pr)
For a given Resource, create a new instance of ManagedIndividual with the given class URI and copy all properties from the Resource object to this new ManagedIndividual.

Parameters:
classURI - The class URI of the ManagedIndividual.
pr - The Resource which needs to be copied.
Returns:
A new instance of ManagedIndividual with all properties from the given Resource.

copy

public Resource copy(boolean isXMLLiteral)
Create a copy of this resource.

Overrides:
copy in class Resource
Returns:
the copied resource. If possible, this is a specialized instance of ManagedIndividual, i.e. a subclass of it.
See Also:
Resource.copy(boolean)

deepCopy

public Resource deepCopy()
Create a deep copy of this ManagedIndividual, i.e. create a new ManagedIndividual for this object (according to the class URI of this object) and for the resources of all properties.

Overrides:
deepCopy in class Resource
Returns:
The copied ManagedIndividual.
See Also:
Resource

getClassURI

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

Returns:
The class URI.

getPropSerializationType

public abstract 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. 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.

Overrides:
getPropSerializationType in class Resource

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()

setProperty

public 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.

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

setPropertyPathFromOffset

public boolean setPropertyPathFromOffset(String[] propPath,
                                         int fromIndex,
                                         Object value,
                                         boolean force)
Description copied from class: Resource
Change or add the Resource at the end of the given property path to the given value. This method starts from this Resource and follows the given property path through the RDF graph. If a property from the path does not yet exist, a new anonymous Resource is automatically created. At the end of the property path, the given value is set as RDF object with the last property from the path as RDF predicate.

Overrides:
setPropertyPathFromOffset in class Resource
Parameters:
propPath - The set of properties defining the path through the RDF graph.
fromIndex - The property path is evaluated from this index on; if 'fromIndex' is greater than zero, then some entries at the beginning are just ignored.
value - The value to set at the end of the property path
force - Determines if setting the value has to be forced. If true, Resource.changeProperty(String, Object) is called, otherwise Resource.setProperty(String, Object) is called.
Returns:
true, if the operation was successful.
See Also:
Resource

getOntClassInfo

public OntClassInfo getOntClassInfo()
Get the ontological information for this individual.



Copyright © 2014 universAAL Consortium. All Rights Reserved.