org.universAAL.middleware.owl
Class TypeExpression

Package class diagram package TypeExpression
java.lang.Object
  extended by org.universAAL.middleware.rdf.Resource
      extended by org.universAAL.middleware.owl.TypeExpression
Direct Known Subclasses:
Complement, Enumeration, Intersection, PropertyRestriction, TypeRestriction, TypeURI, Union

public abstract class TypeExpression
extends Resource

A class for the concept of OWL class expressions and OWL data ranges, which represent sets of individuals by formally specifying conditions on the individuals' properties. Example conditions are intersection of individuals, or restrictions. Each type expression represents a set of individuals (just like a class in an object-oriented programming language represents a set of objects). There are three main methods to compare type expression:

All three methods have three parameters in common:

Author:
mtazari - Saied Tazari, Carsten Stockloew

Field Summary
static String EXCEPTION_TTL
           
static String OWL_CLASS
          URI for owl:class.
static String OWL_NAMESPACE
          URI namespace for OWL.
static String PROP_RDFS_SUB_CLASS_OF
          URI for rdfs:subClassOf.
static String RDFS_DATATYPE
          URI for rdfs:Datatype.
static String TYPE_OWL_THING
          URI for 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 TypeExpression()
          Constructor for use with serializers.
protected TypeExpression(String uri)
          Constructor to create a new instance with the given URI.
protected TypeExpression(String[] additionalTypes)
          Constructor.
 
Method Summary
protected  int checkTTL(int ttl)
          Check the time-to-live parameter.
protected  void collectTypesMinimized(String typeURI, List l)
          Provided that the given list is already a minimized list of type URIs, i.e. no two members have any hierarchical relationships with each other, adds the given typeURI to the list so that the above condition continues to hold and no information is lost.
abstract  TypeExpression copy()
          Create a copy of this object, i.e. create a new object of this class and copy the necessary properties.
static int getDefaultMatchmakingTTL()
          Returns the default value for time-to-live.
abstract  String[] getNamedSuperclasses()
          Get the set of class URIs for all super classes of the individuals of this class expression.
abstract  Object[] getUpperEnumeration()
          Each type expression can contain multiple objects; this method returns this set of objects.
 boolean hasMember(Object member)
          Returns true if the given object is a member of the class represented by this type expression, otherwise false.
abstract  boolean hasMember(Object member, HashMap context, int ttl, List<MatchLogEntry> log)
          Returns true if the given object is a member of the class represented by this type expression, otherwise false.
 boolean hasMember(Object member, Hashtable context)
          Deprecated. replaced by hasMember(Object, HashMap, int, List).
 boolean isDisjointWith(TypeExpression other)
          Returns true if the given type expression has no member in common with the class represented by this type expression, otherwise false.
abstract  boolean isDisjointWith(TypeExpression other, HashMap context, int ttl, List<MatchLogEntry> log)
          Returns true if the given type expression has no member in common with the class represented by this type expression, otherwise false.
 boolean isDisjointWith(TypeExpression other, Hashtable context)
          Deprecated. replaced by #isDisjointWith(Object, HashMap, int, List).
abstract  boolean isWellFormed()
          Returns true, if the state of the resource is valid, otherwise false.
 boolean matches(TypeExpression subset)
          Returns true if the given type expression is a subset of the class represented by this type expression, otherwise false.
abstract  boolean matches(TypeExpression subset, HashMap context, int ttl, List<MatchLogEntry> log)
          Returns true if the given type expression is a subset of the class represented by this type expression, otherwise false.
 boolean matches(TypeExpression subset, Hashtable context)
          Deprecated. replaced by #matches(Object, HashMap, int, List).
protected  void synchronize(HashMap context, HashMap cloned)
          Synchronize two HashMap to ensure that the first HashMap contains a value for each key of the second HashMap.
 
Methods inherited from class org.universAAL.middleware.rdf.Resource
addMultiLangProp, addType, asList, asList, asRDFList, changeProperty, copy, deepCopy, equals, generateAnonURI, getDefaultLang, getFilename, getLocalName, getMultiLangProp, getNamespace, getOrConstructLabel, getProperty, getPropertyURIs, getPropSerializationType, getResource, getResourceComment, getResourceLabel, getStaticFieldValue, getType, getTypes, getURI, hashCode, hasProperty, hasQualifiedName, isAnon, isAnon, isBlockingAddingTypes, isClosedCollection, isQualifiedName, literal, numberOfProperties, representsQualifiedURI, serializesAsXMLLiteral, setProperty, 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

OWL_NAMESPACE

public static final String OWL_NAMESPACE
URI namespace for OWL.

See Also:
Constant Field Values

TYPE_OWL_THING

public static final String TYPE_OWL_THING
URI for owl:Thing.

See Also:
Constant Field Values

RDFS_DATATYPE

public static final String RDFS_DATATYPE
URI for rdfs:Datatype.

See Also:
Constant Field Values

OWL_CLASS

public static final String OWL_CLASS
URI for owl:class.

See Also:
Constant Field Values

PROP_RDFS_SUB_CLASS_OF

public static final String PROP_RDFS_SUB_CLASS_OF
URI for rdfs:subClassOf.

See Also:
Constant Field Values

EXCEPTION_TTL

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

TypeExpression

protected TypeExpression()
Constructor for use with serializers.


TypeExpression

protected TypeExpression(String uri)
Constructor to create a new instance with the given URI.


TypeExpression

protected TypeExpression(String[] additionalTypes)
Constructor.

Method Detail

collectTypesMinimized

protected void collectTypesMinimized(String typeURI,
                                     List l)
Provided that the given list is already a minimized list of type URIs, i.e. no two members have any hierarchical relationships with each other, adds the given typeURI to the list so that the above condition continues to hold and no information is lost. In case of a hierarchical relationship, the given typeURI is added if it is more specialized, i.e. a sub class, than any existing type (the less spcialized, i.e. a super class, is then removed from the list).


copy

public abstract TypeExpression copy()
Create a copy of this object, i.e. create a new object of this class and copy the necessary properties.

Returns:
The newly created copy.

getNamedSuperclasses

public abstract String[] getNamedSuperclasses()
Get the set of class URIs for all super classes of the individuals of this class expression.


getUpperEnumeration

public abstract Object[] getUpperEnumeration()
Each type expression can contain multiple objects; this method returns this set of objects.


hasMember

public final boolean hasMember(Object member)
Returns true if the given object is a member of the class represented by this type expression, otherwise false.

Parameters:
member - the object whose membership is going to be checked
Returns:
true if the specified member is a member of this type expression

hasMember

public final boolean hasMember(Object member,
                               Hashtable context)
Deprecated. replaced by hasMember(Object, HashMap, int, List).


hasMember

public abstract boolean hasMember(Object member,
                                  HashMap context,
                                  int ttl,
                                  List<MatchLogEntry> log)
Returns true if the given object is a member of the class represented by this type expression, otherwise false. The context table maps the URIs of certain variables onto values currently assigned to them. The variables are either standard variables managed by the universAAL middleware or parameters of a specific service in whose context this method is called. Both the object whose membership is going to be checked and this type expression may contain references to such variables. If there is already a value assigned to such a referenced variable, it must be replaced by the associated value, otherwise this method may expand the context table by deriving a value for such unassigned but referenced variables with which the membership can be asserted. In case of returning true, the caller must check the size of the context table to see if new conditions are added in order for the membership to be asserted. If the context table is null, the method does a global and unconditional check.

Parameters:
member - the object whose membership is going to be checked
context - context of the matchmaking. May be null.
ttl - time-to-live parameter
log - list that can be filled with log entries. May be null.
Returns:
true if the specified member is a member of this type expression
See Also:
Constants.VAR_uAAL_ACCESSING_BUS_MEMBER, Constants.VAR_uAAL_ACCESSING_HUMAN_USER, Constants.VAR_uAAL_CURRENT_DATETIME, Constants.VAR_uAAL_SERVICE_TO_SELECT

isDisjointWith

public final boolean isDisjointWith(TypeExpression other)
Returns true if the given type expression has no member in common with the class represented by this type expression, otherwise false.

Parameters:
other - the type expression with which the disjointness is going to be checked
Returns:
true if the given type expression has no member in common with the class represented by this type expression, otherwise false

isDisjointWith

public final boolean isDisjointWith(TypeExpression other,
                                    Hashtable context)
Deprecated. replaced by #isDisjointWith(Object, HashMap, int, List).


isDisjointWith

public abstract boolean isDisjointWith(TypeExpression other,
                                       HashMap context,
                                       int ttl,
                                       List<MatchLogEntry> log)
Returns true if the given type expression has no member in common with the class represented by this type expression, otherwise false. The context table maps the URIs of certain variables onto values currently assigned to them. The variables are either standard variables managed by the universAAL middleware or parameters of a specific service in whose context this method is called. Both of the type expressions may contain references to such variables. If there is already a value assigned to such a referenced variable, it must be replaced by the associated value, otherwise this method may expand the context table by deriving a value for such unassigned but referenced variables with which the disjointness of the two classes can be asserted. In case of returning true, the caller must check the size of the context table to see if new conditions are added in order for the disjointness to be asserted. If the context table is null, the method does a global and unconditional check.

Parameters:
other - the type expression with which the disjointness is going to be checked
context - context of the matchmaking. May be null.
ttl - time-to-live parameter
log - list that can be filled with log entries. May be null.
Returns:
true if the given type expression has no member in common with the class represented by this type expression, otherwise false
See Also:
Constants.VAR_uAAL_ACCESSING_BUS_MEMBER, Constants.VAR_uAAL_ACCESSING_HUMAN_USER, Constants.VAR_uAAL_CURRENT_DATETIME, Constants.VAR_uAAL_SERVICE_TO_SELECT

isWellFormed

public abstract boolean isWellFormed()
Returns true, if the state of the resource is valid, otherwise false. Redefined in this class as abstract to force subclasses to override it.

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

matches

public final boolean matches(TypeExpression subset)
Returns true if the given type expression is a subset of the class represented by this type expression, otherwise false.

Parameters:
subset - the type expression with which the compatibility is going to be checked
Returns:
true if the given type expression is a subset of the class represented by this type expression, otherwise false

matches

public final boolean matches(TypeExpression subset,
                             Hashtable context)
Deprecated. replaced by #matches(Object, HashMap, int, List).


matches

public abstract boolean matches(TypeExpression subset,
                                HashMap context,
                                int ttl,
                                List<MatchLogEntry> log)
Returns true if the given type expression is a subset of the class represented by this type expression, otherwise false. The context table maps the URIs of certain variables onto values currently assigned to them. The variables are either standard variables managed by the universAAL middleware or parameters of a specific service in whose context this method is called. Both of the type expressions may contain references to such variables. If there is already a value assigned to such a referenced variable, it must be replaced by the associated value, otherwise this method may expand the context table by deriving a value for such unassigned but referenced variables with which the compatibility of the two classes can be asserted. In case of returning true, the caller must check the size of the context table to see if new conditions are added in order for the compatibility to be asserted. If the context table is null, the method does a global and unconditional check.

Parameters:
subset - the type expression with which the compatibility is going to be checked
context - context of the matchmaking. May be null.
ttl - time-to-live parameter
log - list that can be filled with log entries. May be null.
Returns:
true if the given type expression is a subset of the class represented by this type expression, otherwise false
See Also:
Constants.VAR_uAAL_ACCESSING_BUS_MEMBER, Constants.VAR_uAAL_ACCESSING_HUMAN_USER, Constants.VAR_uAAL_CURRENT_DATETIME, Constants.VAR_uAAL_SERVICE_TO_SELECT

synchronize

protected void synchronize(HashMap context,
                           HashMap cloned)
Synchronize two HashMap to ensure that the first HashMap contains a value for each key of the second HashMap. The values themselves are not checked; if 'cloned' contains a key which is not contained in 'context', then the according (key/value)-pair is added to 'context'. The second HashMap, 'cloned', is not changed.

Parameters:
context - The HashMap to be extended by (key/value)-pairs from the second HashMap.
cloned - The second HashMap.

checkTTL

protected int checkTTL(int ttl)
Check the time-to-live parameter. If this value is zero, the method will throw an IllegalArgumentException, otherwise the parameter will be decreased by one and returned.

Parameters:
ttl - the time-to-live value
Returns:
the time-to-live value decreased by one
Throws:
IllegalArgumentException - if the specified value is zero.

getDefaultMatchmakingTTL

public static final int getDefaultMatchmakingTTL()
Returns the default value for time-to-live.

Returns:
the default value for time-to-live


Copyright © 2014 universAAL Consortium. All Rights Reserved.