|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface IContext
As defined at http://spwiki.editme.com/Context and http://spwiki.editme.com/ContextProvider, This interface holds a set of IEntity objects.
All Contexts follow the http://www.eclipse.org/higgins/ontologies/2008/6/higgins ontology as a base. As such, each Context may have the attributes:
http://www.eclipse.org/higgins/ontologies/2008/6/higgins#contextRelation
http://www.eclipse.org/higgins/ontologies/2008/6/higgins#contextCorrelation
Also, each Context has the attribute
http://www.eclipse.org/higgins/ontologies/2008/6/higgins#contextId. getContextID()
provides a shortcut to access the value of this attribute.
| Field Summary | |
|---|---|
static URI |
defaultEntityType
|
| Method Summary | |
|---|---|
IEntity |
addEntity(IEntity copyFrom)
Creates a new Entity for this Context by copying the data from the passed entity Note: This operation is only applied to any backing data store after applyUpdates() is called. |
IEntity |
addEntity(URI entityType,
String entityID)
Creates a new Entity for this Context. This call is typically followed by one or more calls to IHasAttributes.addAttribute(java.net.URI) on the returned IEntity
Note: This operation is only applied to any backing data
store after applyUpdates() |
void |
applyUpdates()
Applies all update operations which have been called on this Context and called on any element held by this Context (including entities, attributes, attribute meta-attributes and it's value(s), and attribute values) to a backing data store. |
IAttribute |
buildAttribute(URI attrID)
Builds an IAttribute (unassociated with any Entity). |
IFilterAttributeAssertion |
buildAttributeAssertion()
Builds an assertion for Entity Attributes (see IHasAttributes.getAttributes() and IHasAttributes.getAttribute(URI))
which can be passed to IFilter.setAssertion(IFilterAssertion) |
IAuthNAttributesMaterials |
buildAuthNAttributesMaterials()
Builds an IAuthNAttributesMaterials that may be used when calling #open(Object) |
IEntity |
buildComplexAttrValue(URI dataType)
Builds a complex attribute value to be passed to IFilterAttributeAssertion.setAssertionValue(IValue). |
IFilterEntityIDAssertion |
buildEntityIDAssertion()
Builds an assertion for Entity IDs (see IEntity.getEntityID())
which can be passed to IFilter.setAssertion(IFilterAssertion)
Note that this is simply a convenience method equivalent to creating an
IFilterAttributeAssertion for the
http://www.eclipse.org/higgins/ontologies/2008/6/higgins#entityId attribute |
IFilterEntityTypeAssertion |
buildEntityTypeAssertion()
Builds an assertion for Entity Types (see IEntity#getEntityType())
which can be passed to IFilter.setAssertion(IFilterAssertion) |
IFilter |
buildFilter()
Builds an IFilter instance that may be used when calling getEntities(IFilter) |
ISimpleValue |
buildSimpleAttrValue(URI dataType,
Object value)
Builds a simple attribute value to be passed to IFilterAttributeAssertion#setAssertionValue(IAttributeValue). |
void |
cancelUpdates()
Cancels all update operations which have been called on this Context and called on any element held by this Context (including entities, attributes, attribute meta-attributes and it's value(s), and attribute values). |
void |
close()
Closes this Context and returns it to an un-open state. |
String |
exportData(String filter,
String representationFormat)
Exports this Context. |
URI |
getContextID()
Returns a reference to this Context. |
IContextModel |
getContextModel()
Returns a model of the context object as it defined in the context's schema. |
Iterator |
getEntities(IFilter filter)
|
Iterator |
getEntities(IFilter filter,
Iterator attrSelectionList)
From this context, return IEntitys that match the specified filter |
Iterator |
getEntities(IFilter filter,
Iterator attrSelectionList,
IExtension[] extensions)
From this context, return IEntitys that match the specified filter |
Iterator |
getEntities(String query)
|
Iterator |
getEntities(String query,
Iterator attrSelectionList)
From this context, return IEntitys that match the specified SPARQL query |
Iterator |
getEntities(String query,
Iterator attrSelectionList,
IExtension[] extensions)
From this context, return IEntitys that match the specified query |
IEntity |
getEntity(String entityID)
This is the same as passing null as the attrSelectionList in getEntity(String, Iterator) |
IEntity |
getEntity(String entityID,
Iterator attrSelectionList)
Returns the Entity matching the specified entityID. |
String |
getSchema()
Returns the schema governing this context. |
void |
importData(String filter,
String representationFormat)
Imports this Context. |
boolean |
isOpen(Object identity)
Tests whether this context is open and authenticated using the specified identity |
String |
open(IAuthNMaterials authentication)
|
String |
open(IAuthNMaterials authentication,
IExtension[] extensions)
Opens this Context using the provided authentication object. |
void |
reopen()
Causes this context to re-authenticate the previously passed authentication materials passed in the #open(Object) or #open(Object, IExtension[])
method. |
void |
setComponentSetting(String key,
Object value)
|
void |
setComponentSetting(String key,
Object value,
boolean failUnsupported)
Used to update one setting element for this context. |
void |
setSchema(String schema)
Sets the schema governing this context. |
boolean |
verifyEntityAttributes(String entityID,
Iterator attributes)
Simple method for comparing a set of attribute assertions against a Entity. |
| Methods inherited from interface org.eclipse.higgins.idas.api.IHasAttributes |
|---|
addAttribute, addAttribute, addAttributeValue, getAttribute, getAttributes, getSingleValuedAttribute, removeAttribute, removeAttributeValue, removeAttributeValue |
| Field Detail |
|---|
static final URI defaultEntityType
| Method Detail |
|---|
String open(IAuthNMaterials authentication,
IExtension[] extensions)
throws IdASException,
ContextOpenException
Upon success (return with no exception), this Context is in an "open" state
and is available to have other methods called (such as
addEntity(URI, String),
exportData(String, String),
getEntity(String),
getEntity(String, Iterator),
getEntities(String),
getEntities(String, Iterator),
importData(String, String),
verifyEntityAttributes(String, Iterator)}
).
Methods requiring the context to be open throw ContextNotOpenException
when in an un-open state.
An open state specifies that the specified authentication materials have been used to successfully authenticate to this Context.
If this IContext is already in an open state, this throws ContextOpenException.
The antithesis of this method is close().
authentication - AuthN object used to open the context. This may be an instance of IAuthNAttributesMaterials or some other object used to authenticate.extensions - may be null. One or more extensions valid for this operation.
null.
IdASException
ContextOpenException, - AuthenticationException
ContextOpenExceptionclose()
String open(IAuthNMaterials authentication)
throws IdASException,
ContextOpenException
IdASException
ContextOpenException#open(Object, IExtension[])
void reopen()
throws IdASException,
AuthenticationException
#open(Object) or #open(Object, IExtension[])
method. This method is called when the context is already in an open state.
If the context provider no longer has access to the previously passed authentication
materials, or if those materials are unable to be used to authenticate,
an AuthenticationException is thrown.
IdASException
AuthenticationException
void close()
throws IdASException
Methods requiring the context to be open throw ContextNotOpenException when in an un-open state.
IdASException
boolean isOpen(Object identity)
throws IdASException
identity - May be null.
When provided, asserts that this context was opened with the specified identity.
When (@code null), no identity check is performed.
true if this context is open as specified, false otherwise
IdASException
String getSchema()
throws IdASException
TODO (Doc): Add pointers to OWL.
TODO (Doc): Add (or point to) documentation which includes sample schema.
TODO (Arch)(Impl): Add method(s) which return the schema as a stream, DOM document, or other iterable object.
String in OWL-DL format.
IdASException
void setSchema(String schema)
throws IdASException
TODO (Doc): Add pointers to OWL.
TODO (Doc): Add (or point to) documentation which includes sample schema.
TODO (Arch)(Impl): Add method(s) which take the schema as a stream, DOM document, or other iterable object.
schema - a String in OWL-DL format.
IdASException
IContextModel getContextModel()
throws IdASException
IdASException
URI getContextID()
throws IdASException
IdASException
String exportData(String filter,
String representationFormat)
throws IdASException
TODO (Arch): filter format TBD
TODO (Arch): Does this export only Entities, or the entire Context (Attributes, Schema, Entities)?
filter - May be null. Used to select a subset of this Context to be exported.representationFormat - Indicates the format of the string to be returned. TODO (Arch)(Doc): Specify format type. Give example
IdASException
void importData(String filter,
String representationFormat)
throws IdASException
TODO (Arch): filter format TBD
TODO (Arch): Does this import only Entities, or the entire Context (Attributes, Schema, Entities)? TODO (Arch)(Doc): Discuss collisions.
filter - May be null. Used to select a subset of the external data set to be imported.representationFormat - Indicates the format of the external data string being specified in external. TODO (Arch)(Doc): Specify format type. Give example
IdASException
IAuthNAttributesMaterials buildAuthNAttributesMaterials()
throws IdASException
IAuthNAttributesMaterials that may be used when calling #open(Object)
IdASException
IAttribute buildAttribute(URI attrID)
throws IdASException
IAuthNAttributesMaterials
attrID -
IAttribute
IdASException
IFilter buildFilter()
throws IdASException
getEntities(IFilter)
IdASException
IFilterAttributeAssertion buildAttributeAssertion()
throws IdASException
IHasAttributes.getAttributes() and IHasAttributes.getAttribute(URI))
which can be passed to IFilter.setAssertion(IFilterAssertion)
IdASException
IFilterEntityIDAssertion buildEntityIDAssertion()
throws IdASException
IEntity.getEntityID())
which can be passed to IFilter.setAssertion(IFilterAssertion)
Note that this is simply a convenience method equivalent to creating an
IFilterAttributeAssertion for the
http://www.eclipse.org/higgins/ontologies/2008/6/higgins#entityId attribute
IdASException
IFilterEntityTypeAssertion buildEntityTypeAssertion()
throws IdASException
IEntity#getEntityType())
which can be passed to IFilter.setAssertion(IFilterAssertion)
IdASException
ISimpleValue buildSimpleAttrValue(URI dataType,
Object value)
throws IdASException,
InvalidTypeException
IFilterAttributeAssertion#setAssertionValue(IAttributeValue).Example:
IValue value = buildSimpleValue("http://www.w3.org/2001/XMLSchema/normalizedString", new String("Some Value"));
dataType - The type for the simple valuevalue - The value for the simple type.
IdASException
InvalidTypeException
IEntity buildComplexAttrValue(URI dataType)
throws IdASException,
InvalidTypeException
IFilterAttributeAssertion.setAssertionValue(IValue).Example:
TODO: do an example of building this and then adding some attributes
dataType - The type for the simple value
IdASException
InvalidTypeException
IEntity addEntity(URI entityType,
String entityID)
throws IdASException,
InvalidTypeException,
InvalidEntityIDException,
EntityExistsException
IHasAttributes.addAttribute(java.net.URI) on the returned IEntity
Note: This operation is only applied to any backing data
store after applyUpdates()
entityType - The URI specifying the type of Entity being created. If null, entity should
be created with default type http://www.w3.org/1999/02/22-rdf-syntax-ns#ResourceentityID - May be null. When specified, uniquely names the Entity within
this Context. When null, unique Entity ID should be assigned
applyUpdates()
InvalidTypeException - when the entityType is invalid
InvalidEntityIDException - when the entityID is invalid
EntityExistsException - when the entityID is known to already exist
IdASException
IEntity addEntity(IEntity copyFrom)
throws IdASException,
EntityExistsException
applyUpdates() is called.
copyFrom - an IEntity from which data is copied to construct a new
Entity
applyUpdates() is called.
EntityExistsException - when copyFrom is known to already exist
IdASException
IEntity getEntity(String entityID)
throws IdASException
null as the attrSelectionList in getEntity(String, Iterator)
IdASExceptiongetEntity(String, Iterator)
IEntity getEntity(String entityID,
Iterator attrSelectionList)
throws IdASException
getEntities(org.eclipse.higgins.idas.api.IFilter) with
the filter set to <appropriate filter for entityID=name>
entityID - Contextually unique ID of Entity to return.attrSelectionList - Iterator holding the URIs of IAttribute types
that the caller expects to access.
A nullindicates that the caller expects to read all attributes.
An empty set indicates that the caller expects to read no attributes.
Note that this is only an indicator of what the caller expects to read.
The caller may eventually end up reading more or less. The purpose of this
parameter is so that a context provider which gathers data across a network
connection can optimize based on the callers intended usage.
IdASException - (typically a subclass of. See below).
Iterator getEntities(IFilter filter)
throws IdASException
IEntitys that match the filter
IdASExceptionThis is the same as passing {@code null} as the attrSelectionList in {@link #getEntities(IFilter, Iterator)}
Iterator getEntities(IFilter filter,
Iterator attrSelectionList)
throws IdASException
IEntitys that match the specified filter
filter - Filter used to constrain the set of IEntitys returned.
A null or empty filter causes all IEntitys to be returned.attrSelectionList - Iterator of URIs of IAttribute types that the caller expects to access. A null indicates that all attributes will be read. An empty set indicates that no attributes will be read.
IEntitys that match the filter
IdASException
Iterator getEntities(IFilter filter,
Iterator attrSelectionList,
IExtension[] extensions)
throws IdASException
IEntitys that match the specified filter
filter - Filter used to constrain the set of IEntitys returned.
A null or empty filter causes all IEntitys to be returned.
This behavior may be overridden by the presence of certain extensions.attrSelectionList - Iterator of URIs of IAttribute types that the caller
expects to access.
A null indicates that all attributes will be read.
An empty set indicates that no attributes will be read.extensions - may be null. One or more extensions valid for this operation.
IEntitys that match the filter
IdASException
Iterator getEntities(String query)
throws IdASException
query - SPARQL query used to constrain the set of IEntitys returned
IEntitys that match the query
IdASExceptionThis is the same as passing {@code null} as the attrSelectionList in {@link #getEntities(String, Iterator)}
Iterator getEntities(String query,
Iterator attrSelectionList)
throws IdASException
IEntitys that match the specified SPARQL query
query - SPARQL query used to constrain the set of IEntitys returnedattrSelectionList - Iterator of URIs of IAttribute types that the caller expects to access. A null indicates that all attributes will be read. An empty set indicates that no attributes will be read.
IEntitys that match the query
IdASException
Iterator getEntities(String query,
Iterator attrSelectionList,
IExtension[] extensions)
throws IdASException
IEntitys that match the specified query
query - SPARQL query used to constrain the set of IEntitys returned.
This behavior may be overridden by the presence of certain extensions.attrSelectionList - Iterator of URIs of IAttribute types that the caller
expects to access.
A null indicates that all attributes will be read.
An empty set indicates that no attributes will be read.extensions - may be null. One or more extensions valid for this operation.
IEntitys that match the query
IdASException
boolean verifyEntityAttributes(String entityID,
Iterator attributes)
throws IdASException
TODO (Arch): This doesn't leave a way to verify that a Entity representing a group contains a specific member in its member value. We may want to consider allowing a filter to be passed here, or at least a partial attribute.
entityID - Contextually unique ID of Entity being verified.attributes - Iterator of IAttribute to be compared to the Entity specified by entityID.
true if all attribute assertions in attributes are found to be equal to those attributes in the Entity specified by entityID. false otherwise.
IdASException - (typically a subclass of. See below).
NoSuchEntityException - when Entity specified by entityID is not found.
void applyUpdates()
throws IdASException
addEntity(URI, String)addEntity(IEntity)IValue.remove()IHasAttributes.addAttribute(IAttribute)IHasAttributes.addAttribute(URI)IHasAttributes.removeAttribute(URI)IHasAttributes.removeAttributeValue(IAttribute)IHasAttributes#rremoveAttributeValue(URI, Object)IAttribute.addComplexValue(URI)IAttribute.addSimpleValue(URI, Object)IAttribute#addValue(IAttributeValue)IAttribute.addValue(URI)IAttribute.remove()IAttributeValue#remove()ITypedValue.setData(Object)applyUpdates(). Alternately, the caller may call
cancelUpdates() in order to cancel all updates which have not yet been applied.
IdASException
void cancelUpdates()
throws IdASException
applyUpdates()) are not canceled.
IdASExceptionapplyUpdates()
void setComponentSetting(String key,
Object value,
boolean failUnsupported)
throws IdASException
IConfigurableComponent. In this case, the new
setting will typically be set (or reset) in the component's settings Map
key - setting namevalue - setting valuefailUnsupported - Default false. When true, the operation will fail with
{@link NotImplementedException) if the context does not support settings of this type.
When true, if the context does not support settings of this type, the setting will be
ignored by the context.
IdASException
void setComponentSetting(String key,
Object value)
throws IdASException
IdASExceptionsetComponentSetting(String, Object, boolean)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||