public class ContextEvent extends ManagedIndividual
ContextEvent
as a ManagedIndividual
with the possibility of not defining some of its properties.
This is the class that must be used by service callers that wish to call CHe
services, instead of the middleware one (
ContextEvent
), in the
ServiceRequests they build (as input or outputs). Then, the output events
received in a service response will have to be casted to
ContextEvent
, thus performing the
conversion from
org.universAAL.platform.casf.che.ontology.ContextEvent
to
ContextEvent
in the casting.Modifier and Type | Field and Description |
---|---|
static String |
CONTEXT_EVENT_URI_PREFIX |
static String |
CONTEXT_NAMESPACE |
static String |
LOCAL_NAME_CONFIDENCE |
static String |
LOCAL_NAME_EXPIRATION_TIME |
static String |
LOCAL_NAME_OBJECT |
static String |
LOCAL_NAME_PREDICATE |
static String |
LOCAL_NAME_PROVIDER |
static String |
LOCAL_NAME_SUBJECT |
static String |
LOCAL_NAME_TIMESTAMP |
static String |
MY_URI |
static String |
PROP_CONTEXT_CONFIDENCE |
static String |
PROP_CONTEXT_EXPIRATION_TIME |
static String |
PROP_CONTEXT_PROVIDER |
static String |
PROP_CONTEXT_TIMESTAMP |
static String |
PROP_RDF_OBJECT |
static String |
PROP_RDF_PREDICATE |
static String |
PROP_RDF_SUBJECT |
OWL_NAMESPACE, TYPE_OWL_INDIVIDUAL, 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
Constructor and Description |
---|
ContextEvent()
Empty constructor, needed because this is a ManagedIndividual.
|
ContextEvent(Resource subject,
String predicate)
Construct a CHe stub ContextEvent inferring the object from the predicate
which URI is present in the properties of the subject.
|
ContextEvent(String uri)
This constructor is NOT for the exclusive usage by deserializers.
|
Modifier and Type | Method and Description |
---|---|
static ContextEvent |
constructSimpleEvent(String subjectURI,
String subjectTypeURI,
String predicate,
Object object)
Constructs a CHe stub ContextEvent according to the parameters passed.
|
String |
getClassURI()
Get the class URI for this ManagedIndividual.
|
Integer |
getConfidence()
Get the confidence of the event.
|
Long |
getExpirationTime()
Get the expiration time.
|
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.
|
ContextProvider |
getProvider()
Get the ContextProvider of the event.
|
Object |
getRDFObject()
Get the object of the event.
|
String |
getRDFPredicate()
Get the predicate of the event.
|
Resource |
getRDFSubject()
Get the subject of the event.
|
String |
getSubjectTypeURI()
Get the type of the subject of the event.
|
String |
getSubjectURI()
Get the URI of the subject of the event.
|
Long |
getTimestamp()
Get the timestamp of the event.
|
boolean |
isWellFormed()
Returns true, if the state of the resource is valid, otherwise false.
|
boolean |
setConfidence(Integer confidence)
Set the confidence.
|
boolean |
setExpirationTime(Long expirationTime)
Set the expiration time.
|
boolean |
setProperty(String propURI,
Object value)
Overrides the ManagedIndividual implementation in order to avoid its
checks and allow null values for wildcarding.
|
boolean |
setProvider(ContextProvider src)
Set the Context Provider.
|
boolean |
setRDFObject(Object o)
Set the object.
|
boolean |
setRDFPredicate(String propURI)
Set the predicate.
|
boolean |
setRDFSubject(Resource subj)
Set the subject.
|
boolean |
setTimestamp(Long timestamp)
Set the timestamp.
|
checkCompatibility, checkMembership, copy, deepCopy, getClassRestrictionsOnProperty, getInstance, getNonAbstractSuperClasses, getNonabstractSuperClasses, getOntClassInfo, getTypeURI, isRegisteredClassURI, setPropertyPathFromOffset, toManagedIndividual
addType, getLocalName, getNamespace, getProperty, getPropertyURIs, getType, getTypes, getURI, hasQualifiedName, isAnon, numberOfProperties
addMultiLangProp, asList, asList, asRDFList, changeProperty, equals, generateAnonURI, getDefaultLang, getFilename, getMultiLangProp, getOrConstructLabel, getOrConstructLabel, getResource, getResourceComment, getResourceLabel, getResourceLabel, getStaticFieldValue, hashCode, hasProperty, isAnon, isBlockingAddingTypes, isClosedCollection, isQualifiedName, literal, representsQualifiedURI, serializesAsXMLLiteral, setPropertyPath, setPropertyPath, setResourceComment, setResourceLabel, toString, toStringRecursive, toStringRecursive, unliteral
public static final String CONTEXT_NAMESPACE
public static final String MY_URI
public static final String CONTEXT_EVENT_URI_PREFIX
public static final String LOCAL_NAME_SUBJECT
public static final String PROP_RDF_SUBJECT
public static final String LOCAL_NAME_PREDICATE
public static final String PROP_RDF_PREDICATE
public static final String LOCAL_NAME_OBJECT
public static final String PROP_RDF_OBJECT
public static final String LOCAL_NAME_CONFIDENCE
public static final String PROP_CONTEXT_CONFIDENCE
public static final String LOCAL_NAME_PROVIDER
public static final String PROP_CONTEXT_PROVIDER
public static final String LOCAL_NAME_EXPIRATION_TIME
public static final String PROP_CONTEXT_EXPIRATION_TIME
public static final String LOCAL_NAME_TIMESTAMP
public static final String PROP_CONTEXT_TIMESTAMP
public ContextEvent()
public ContextEvent(String uri)
uri
- URI of the event. Set it to null for an anonymous event,
although this might give unexpected results.public ContextEvent(Resource subject, String predicate)
subject
- The Resource representing the subject of the event. Must
include the property specified in the second parameter, and
must have a certain valuepredicate
- The property of the subject that will be used as object in the
eventpublic static ContextEvent constructSimpleEvent(String subjectURI, String subjectTypeURI, String predicate, Object object)
subjectURI
- URI of the subject.subjectTypeURI
- URI of the subject type.predicate
- URI of the predicate.object
- The object of the event.public Integer getConfidence()
public Long getExpirationTime()
public int getPropSerializationType(String propURI)
ManagedIndividual
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.getPropSerializationType
in class ManagedIndividual
public Object getRDFObject()
public String getRDFPredicate()
public ContextProvider getProvider()
ContextProvider
representing the provider that originated the eventpublic Resource getRDFSubject()
Resource
that is the
subject to the eventpublic String getSubjectTypeURI()
public String getSubjectURI()
public Long getTimestamp()
public boolean isWellFormed()
Resource
Subclasses should overwrite this methods as the default implementation returns always true.
isWellFormed
in class ManagedIndividual
public boolean setConfidence(Integer confidence)
confidence
- The confidence in percentage (0 to 100)public boolean setExpirationTime(Long expirationTime)
expirationTime
- The amount of millisecond after which the event is not valid
afer receptionpublic boolean setRDFObject(Object o)
o
- public boolean setRDFPredicate(String propURI)
propURI
- The URI of the predicatepublic boolean setProvider(ContextProvider src)
src
- public boolean setRDFSubject(Resource subj)
subj
- public boolean setTimestamp(Long timestamp)
timestamp
- The timestamp in UNIX formatpublic boolean setProperty(String propURI, Object value)
setProperty
in class ManagedIndividual
ManagedIndividual.setProperty(java.lang.String,
java.lang.Object)
public String getClassURI()
ManagedIndividual
getClassURI
in class ManagedIndividual
Copyright © 2018 universAAL Consortium. All rights reserved.