public abstract class LengthRestriction extends TypeRestriction
TypeRestriction
s that define a restriction on the
length of a value of a given data type. Implementation of XSD Value
Restrictions: it contains all literals that meet the specified conditions.
These conditions are either:
LengthRestriction
. If minimum and maximum length
are equal, only the length facet should be set.TypeRestriction.Facet
Modifier and Type | Field and Description |
---|---|
protected static String |
XSD_FACET_LENGTH
URI for the facet xsd:length.
|
protected static String |
XSD_FACET_MAX_LENGTH
URI for the facet xsd:maxLength.
|
protected static String |
XSD_FACET_MIN_LENGTH
URI for the facet xsd:minLength.
|
PROP_OWL_ON_DATATYPE, PROP_OWL_WITH_RESTRICTIONS, restrictions, XSD_FACET_PATTERN
EXCEPTION_TTL, OWL_CLASS, OWL_NAMESPACE, PROP_RDFS_SUB_CLASS_OF, RDFS_DATATYPE, TYPE_OWL_THING
ANON_URI_PREFIX, blockAddingTypes, isXMLLiteral, NAMESPACE_PREFIX, ns_delim_index, PROP_INVOLVED_HUMAN_USER, 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, props, RDF_EMPTY_LIST, RDF_NAMESPACE, RDFS_NAMESPACE, SERVICE_NAMESPACE, TYPE_RDF_LIST, TYPE_RDFS_CLASS, uri, VOCABULARY_NAMESPACE
Modifier | Constructor and Description |
---|---|
protected |
LengthRestriction(String datatypeURI)
Standard constructor.
|
Modifier and Type | Method and Description |
---|---|
protected TypeExpression |
copyTo(LengthRestriction copy)
Copy the facets to a different
LengthRestriction . |
Object |
getLen()
Get the length.
|
Object |
getMax()
Get the maximum length.
|
protected Object |
getMemberLen(Object member)
Calculate the length of a member.
|
protected Object |
getMemberValueToCheck(Object member)
Calculate the value for the member that needs to be checked during
TypeExpression.hasMember(Object) . |
Object |
getMin()
Get the minimum length.
|
protected Comparable |
getNext(Comparable c)
Returns the next element, i.e.
|
protected Comparable |
getPrevious(Comparable c)
Returns the previous element, i.e.
|
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 |
isDisjointWith(TypeExpression other,
HashMap context,
int ttl,
List<MatchLogEntry> log)
Not supported.
|
boolean |
isWellFormed()
Returns true, if the state of the resource is valid, otherwise
false.
|
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 |
setLen(int len)
Set the length.
|
boolean |
setLen(NonNegativeInteger len)
Set the length.
|
boolean |
setLen(Resource len)
Set the length.
|
boolean |
setMax(int max)
Set the maximum length.
|
boolean |
setMax(NonNegativeInteger max)
Set the maximum length.
|
boolean |
setMax(Resource max)
Set the maximum length.
|
boolean |
setMin(int min)
Set the minimum length.
|
boolean |
setMin(NonNegativeInteger min)
Set the minimum length.
|
boolean |
setMin(Resource min)
Set the minimum length.
|
boolean |
setProperty(String propURI,
Object o)
Adds a statement with this resource as the subject, the given
propURI as the predicate and the given value as the object. |
addConstrainingFacet, copyTo, getNamedSuperclasses, getTypeURI, getUpperEnumeration, hasMember, iterate, matches, resolveVarByGreaterEqual, resolveVarByLessEqual, setFacet, setPattern
checkTTL, collectTypesMinimized, copy, getDefaultMatchmakingTTL, hasMember, hasMember, isDisjointWith, isDisjointWith, matches, matches, synchronize
addMultiLangProp, addType, asList, asList, asRDFList, changeProperty, copy, deepCopy, equals, generateAnonURI, getDefaultLang, getFilename, getLocalName, getMultiLangProp, getNamespace, getOrConstructLabel, getOrConstructLabel, getProperty, getPropertyURIs, getPropSerializationType, getResource, getResourceComment, getResourceLabel, getResourceLabel, getStaticFieldValue, getType, getTypes, getURI, hashCode, hasProperty, hasQualifiedName, isAnon, isAnon, isBlockingAddingTypes, isClosedCollection, isQualifiedName, literal, numberOfProperties, representsQualifiedURI, serializesAsXMLLiteral, setPropertyPath, setPropertyPath, setPropertyPathFromOffset, setResourceComment, setResourceLabel, toString, toStringRecursive, toStringRecursive, unliteral
protected static final String XSD_FACET_LENGTH
protected static final String XSD_FACET_MIN_LENGTH
protected static final String XSD_FACET_MAX_LENGTH
protected LengthRestriction(String datatypeURI)
datatypeURI
- URI of the data type for which this restriction is defined.
Must be one of the supported data types.public boolean setLen(int len)
len
- the length.public boolean setLen(NonNegativeInteger len)
len
- the length.public boolean setLen(Resource len)
len
- the length.public boolean setMin(int min)
min
- the minimum length.public boolean setMin(NonNegativeInteger min)
min
- the minimum length.public boolean setMin(Resource min)
min
- the minimum length.public boolean setMax(int max)
max
- the maximum length.public boolean setMax(NonNegativeInteger max)
max
- the maximum length.public boolean setMax(Resource max)
max
- the maximum length.public Object getLen()
Variable
reference.public Object getMin()
Variable
reference.public Object getMax()
Variable
reference.protected TypeExpression copyTo(LengthRestriction copy)
LengthRestriction
.copy
- The object to which to copy the facets.TypeExpression.copy()
public boolean isWellFormed()
TypeExpression
isWellFormed
in class TypeExpression
Resource.isWellFormed()
protected Comparable getNext(Comparable c)
TypeRestriction
getNext
in class TypeRestriction
c
- A value for which to get the next value.protected Comparable getPrevious(Comparable c)
TypeRestriction
getPrevious
in class TypeRestriction
c
- A value for which to get the previous value.protected Object getMemberLen(Object member)
protected Object getMemberValueToCheck(Object member)
TypeRestriction
TypeExpression.hasMember(Object)
. Sub classes may override this method.getMemberValueToCheck
in class TypeRestriction
member
- the member.public boolean hasMember(Object member, HashMap context, int ttl, List<MatchLogEntry> log)
TypeExpression
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.hasMember
in class TypeRestriction
member
- the object whose membership is going to be checkedcontext
- context of the matchmaking. May be null.ttl
- time-to-live parameterlog
- list that can be filled with log entries. May be null.org.universAAL.middleware.util.Constants#VAR_ACCESSING_BUS_MEMBER
,
org.universAAL.middleware.util.Constants#VAR_ACCESSING_HUMAN_USER
,
org.universAAL.middleware.util.Constants#VAR_CURRENT_DATETIME
,
org.universAAL.middleware.util.Constants#VAR_SERVICE_TO_SELECT
public boolean matches(TypeExpression subset, HashMap context, int ttl, List<MatchLogEntry> log)
TypeExpression
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.matches
in class TypeExpression
subset
- the type expression with which the compatibility is going to
be checkedcontext
- context of the matchmaking. May be null.ttl
- time-to-live parameterlog
- list that can be filled with log entries. May be null.org.universAAL.middleware.util.Constants#VAR_ACCESSING_BUS_MEMBER
,
org.universAAL.middleware.util.Constants#VAR_ACCESSING_HUMAN_USER
,
org.universAAL.middleware.util.Constants#VAR_CURRENT_DATETIME
,
org.universAAL.middleware.util.Constants#VAR_SERVICE_TO_SELECT
public boolean isDisjointWith(TypeExpression other, HashMap context, int ttl, List<MatchLogEntry> log)
isDisjointWith
in class TypeExpression
other
- the type expression with which the disjointness is going to be
checkedcontext
- context of the matchmaking. May be null.ttl
- time-to-live parameterlog
- list that can be filled with log entries. May be null.org.universAAL.middleware.util.Constants#VAR_ACCESSING_BUS_MEMBER
,
org.universAAL.middleware.util.Constants#VAR_ACCESSING_HUMAN_USER
,
org.universAAL.middleware.util.Constants#VAR_CURRENT_DATETIME
,
org.universAAL.middleware.util.Constants#VAR_SERVICE_TO_SELECT
public boolean setProperty(String propURI, Object o)
Resource
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.
setProperty
in class TypeRestriction
Copyright © 2018 universAAL Consortium. All rights reserved.