|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.semanticdesktop.aperture.accessor.base.ModelAccessData
public class ModelAccessData
ModelAccessData provides an AccessData implementation storing its information to and retrieving it from a Model.
This implementation assumes that IDs used to store data are valid URIs and that keys contain only characters that can be used in URIs.
The AccessData.DATE_KEY, AccessData.BYTE_SITE_KEY and AccessData.REDIRECTS_TO_KEY keys are mapped to Aperture DATA predicates. In that case the value must be a long encoded as a String or, in the last case, a URL encoded as a String.
| Field Summary | |
|---|---|
static URI |
aggregates
|
static URI |
byteSize
|
static URI |
dateAsNumber
|
static URI |
linksTo
|
static URI |
NS_MAD
|
static String |
NS_MAD_STRING
|
static URI |
redirectsTo
|
static URI |
timestamp
|
static String |
URI_PREFIX
Used as a prefix to derive URIs from AccessData key names. |
| Fields inherited from interface org.semanticdesktop.aperture.accessor.AccessData |
|---|
BYTE_SIZE_KEY, DATE_KEY, REDIRECTS_TO_KEY |
| Constructor Summary | |
|---|---|
ModelAccessData(Model model)
Creates a new ModelAccessData instance. |
|
| Method Summary | |
|---|---|
void |
clear()
Clears this AccessData. |
String |
get(String id,
String key)
Gets specific information about the specified id. |
Set |
getAggregatedIDs(String id)
Returns a set of id's that are aggregated immediately below the given one. |
ClosableIterator |
getAggregatedIDsClosure(String id)
Returns an iterator over all ids aggregated within the given one, both directly and indirectly. |
Set<String> |
getReferredIDs(String id)
Returns all referred resources of the specified resource. |
int |
getSize()
Warning: expensive operation, as this implementation queries for all unique subjects used in this ModelAccessData's context. |
Set<String> |
getStoredIDs()
Gets the IDs of all resources for which information has been stored in this AccessData. |
ClosableIterator |
getUntouchedIDsIterator()
Returns an iterator over all ID's in this access data instance that have not been touched since the last call to AccessData.initialize() |
void |
initialize()
Prepares the AccessData for operation. |
boolean |
isKnownId(String id)
Returns whether this AccessData holds any information about the specified ID. |
boolean |
isTouched(String id)
Returns true if this id is known and has been touched since the last call to AccessData.initialize(),
false if the id is not known, or hasn't been touched since the last call to AccessData.initialize(). |
void |
put(String id,
String key,
String value)
Stores information (a key-value pair) for the specified id. |
void |
putAggregatedID(String id,
String aggregatedID)
Puts a link between the given id and the aggregated ID. |
void |
putReferredID(String id,
String referredID)
Stores a reference relation between two resources, modeling e.g. a link. |
void |
remove(String id)
Removes all information about the resource with the specified ID. |
void |
remove(String id,
String key)
Removes the value for the specified id and key. |
void |
removeAggregatedID(String id,
String aggregatedID)
Removes the link between the given id and the aggregated ID. |
void |
removeReferredID(String id,
String referredID)
Removes a reference relationship between two resources. |
void |
removeReferredIDs(String id)
Removes all referred IDs of a resource. |
void |
removeUntouchedIDs()
Removes all untouched IDS |
void |
store()
Informs the AccessData that processing has completed and, in case of a persistent storage, now is a good time to write or flush results. |
void |
touch(String id)
Touches an id. |
void |
touchRecursively(String id)
Recursively touches all ids within the aggregation subtree beginning with the given id |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String NS_MAD_STRING
public static final URI NS_MAD
public static final URI linksTo
public static final URI aggregates
public static final URI redirectsTo
public static final URI dateAsNumber
public static final URI byteSize
public static final URI timestamp
public static final String URI_PREFIX
| Constructor Detail |
|---|
public ModelAccessData(Model model)
model - The Model used to store all access data in and retrieve all data from. This cannot be
null.| Method Detail |
|---|
public void clear()
throws IOException
AccessData
clear in interface AccessDataIOExceptionpublic void touch(String id)
AccessDataAccessData.getUntouchedIDsIterator() and
will not be removed by AccessData.removeUntouchedIDs()
touch in interface AccessDatapublic boolean isTouched(String id)
AccessDataAccessData.initialize(),
false if the id is not known, or hasn't been touched since the last call to AccessData.initialize().
isTouched in interface AccessDataid - the id to check
public String get(String id,
String key)
AccessData
get in interface AccessDataid - The resource's ID.key - The info key.
public Set<String> getReferredIDs(String id)
AccessData
getReferredIDs in interface AccessDatapublic int getSize()
getSize in interface AccessDatapublic Set<String> getStoredIDs()
AccessData
getStoredIDs in interface AccessData
public void initialize()
throws IOException
AccessData
initialize in interface AccessDataIOExceptionpublic boolean isKnownId(String id)
AccessData
isKnownId in interface AccessData
public void put(String id,
String key,
String value)
AccessData
put in interface AccessDataid - The resource's ID.key - The info key.value - The info value.
public void putReferredID(String id,
String referredID)
AccessData
putReferredID in interface AccessDataid - The referring resource's ID.referredID - The referred resource's ID.
public void remove(String id,
String key)
AccessData
remove in interface AccessDataid - A resource ID.key - A key under which info is stored.public void remove(String id)
AccessData
remove in interface AccessDataid - A resource ID.
public void removeReferredID(String id,
String referredID)
AccessData
removeReferredID in interface AccessDataid - The referring resource's ID.referredID - The referred resource's ID.public void removeReferredIDs(String id)
AccessData
removeReferredIDs in interface AccessDataid - The referring resource's ID.
public void store()
throws IOException
AccessData
store in interface AccessDataIOExceptionpublic Set getAggregatedIDs(String id)
AccessData
getAggregatedIDs in interface AccessData
public void putAggregatedID(String id,
String aggregatedID)
AccessDataAccessData.getAggregatedIDsClosure(String)), will be touched by the
AccessData.touchRecursively(String) method, it will be removed if the id is removed (@link
AccessData.remove(String)). Note that the aggregation graph must not contain cycles, each id can have at
most one parent, the implementations are expected to enforce this. If the aggregatedID had a parent
before, the previous link will be removed.
putAggregatedID in interface AccessDataid - the parent idaggregatedID - the aggregated id
public void removeAggregatedID(String id,
String aggregatedID)
AccessDataAccessData.getAggregatedIDsClosure(String) and
will not be touched by the AccessData.touchRecursively(String) method. A call to remove the id will not
remove the aggregated id.
removeAggregatedID in interface AccessDatapublic void removeUntouchedIDs()
AccessData
removeUntouchedIDs in interface AccessDatapublic ClosableIterator getUntouchedIDsIterator()
AccessDataAccessData.initialize()
getUntouchedIDsIterator in interface AccessDatapublic void touchRecursively(String id)
AccessData
touchRecursively in interface AccessDatapublic ClosableIterator getAggregatedIDsClosure(String id)
AccessData
getAggregatedIDsClosure in interface AccessDataid - the id whose aggregation subtree is to be traversed
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||