Package com.janeirodigital.sai.core.data
Class DataInstance
java.lang.Object
com.janeirodigital.sai.core.resources.ReadableResource
com.janeirodigital.sai.core.resources.CRUDResource
com.janeirodigital.sai.core.data.DataInstance
- Direct Known Subclasses:
BasicDataInstance
General instantiation of a
Data Instance.
This class should either be extended (through inheritance) or included through composition
in a class specific to a given data domain. For a specific instantiation, see
BasicDataInstance.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDataInstance.Builder<T extends CRUDResource.Builder<T>>Builder forDataInstanceinstances. -
Field Summary
Fields inherited from class com.janeirodigital.sai.core.resources.ReadableResource
contentType, dataset, exists, httpClient, jsonLdContext, resource, saiSession, unprotected, uri -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddChildInstance(DataInstance childInstance) Add a child data instance by adding a shape tree reference relationship to the instance graph, as authorized by an inherited data grant.voiddelete()Delete the correspondingDataInstanceresource over HTTP .findChildGrant(URI shapeTreeUri) findChildReferences(com.janeirodigital.shapetrees.core.validation.ShapeTreeReference reference) Searches the instance graph for instances of the provided shape tree reference and returns the associated targets (objects) they link tostatic URIgenerateUri(ReadableDataGrant dataGrant) Generate the URI for a newDataInstanceas permitted by the provideddataGrant, with a generated UUID as resource name.static URIgenerateUri(ReadableDataGrant dataGrant, String resourceName) Generate the URI for a newDataInstanceas permitted by the provideddataGrant.getChildInstances(URI shapeTreeUri) Gets a list of "child" data instances that are associated with the current instance via shape tree reference as part of an inherited data grant.getChildReferences(URI shapeTreeUri) Gets a list of references to "child" data instances based on a shape tree reference in the shape tree identified by the providedshapeTreeUri.booleanhasAccessible(URI shapeTreeUri) voidremoveChildInstance(DataInstance childInstance) Remove a child data instance by removing a shape tree reference relationship from the instance graph.voidupdate()Update the correspondingDataInstanceresource over HTTP with the current contents of thedataset.Methods inherited from class com.janeirodigital.sai.core.resources.ReadableResource
checkReadableResponse, read
-
Constructor Details
-
DataInstance
- Throws:
SaiException
-
-
Method Details
-
update
Update the correspondingDataInstanceresource over HTTP with the current contents of thedataset. In the event that an inherited instance is being created, the parent instance is updated to add a reference to the created child instance.- Overrides:
updatein classCRUDResource- Throws:
SaiException
-
delete
Delete the correspondingDataInstanceresource over HTTP . In the event that an inherited instance is being deleted, the parent instance is updated to remove the reference to the deleted child instance.- Overrides:
deletein classCRUDResource- Throws:
SaiException
-
getChildInstances
Gets a list of "child" data instances that are associated with the current instance via shape tree reference as part of an inherited data grant.- Parameters:
shapeTreeUri- URI of the shape tree type to get children for- Returns:
- List of data instances for the provided shape tree
- Throws:
SaiException
-
addChildInstance
Add a child data instance by adding a shape tree reference relationship to the instance graph, as authorized by an inherited data grant.- Parameters:
childInstance- ChildDataInstanceto add- Throws:
SaiException
-
removeChildInstance
Remove a child data instance by removing a shape tree reference relationship from the instance graph.- Parameters:
childInstance- ChildDataInstanceto remove- Throws:
SaiException
-
getChildReferences
Gets a list of references to "child" data instances based on a shape tree reference in the shape tree identified by the providedshapeTreeUri.- Parameters:
shapeTreeUri- URI of the shape tree type to get children for- Returns:
- List of child data instance URIs
- Throws:
SaiException
-
generateUri
Generate the URI for a newDataInstanceas permitted by the provideddataGrant. UUID will be generated and used forresourceNameif it is null.- Parameters:
dataGrant-ReadableDataGrantallowing the instance to be createdresourceName- Name of the instance to create- Returns:
- URI for new instance
- Throws:
SaiException
-
generateUri
Generate the URI for a newDataInstanceas permitted by the provideddataGrant, with a generated UUID as resource name.- Parameters:
dataGrant-ReadableDataGrantallowing the instance to be created- Returns:
- URI for new instance
- Throws:
SaiException
-
findChildGrant
- Throws:
SaiException
-
hasAccessible
- Throws:
SaiException
-
findChildReferences
protected List<URI> findChildReferences(com.janeirodigital.shapetrees.core.validation.ShapeTreeReference reference) throws SaiException Searches the instance graph for instances of the provided shape tree reference and returns the associated targets (objects) they link to- Parameters:
reference- shape tree references search with- Returns:
- List of referenced URIs
- Throws:
SaiException
-