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 class
DataInstance.Builder<T extends CRUDResource.Builder<T>>
Builder forDataInstance
instances. -
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 TypeMethodDescriptionvoid
addChildInstance
(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.void
delete()
Delete the correspondingDataInstance
resource 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 URI
generateUri
(ReadableDataGrant dataGrant) Generate the URI for a newDataInstance
as permitted by the provideddataGrant
, with a generated UUID as resource name.static URI
generateUri
(ReadableDataGrant dataGrant, String resourceName) Generate the URI for a newDataInstance
as 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
.boolean
hasAccessible
(URI shapeTreeUri) void
removeChildInstance
(DataInstance childInstance) Remove a child data instance by removing a shape tree reference relationship from the instance graph.void
update()
Update the correspondingDataInstance
resource 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 correspondingDataInstance
resource 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:
update
in classCRUDResource
- Throws:
SaiException
-
delete
Delete the correspondingDataInstance
resource 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:
delete
in 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
- ChildDataInstance
to add- Throws:
SaiException
-
removeChildInstance
Remove a child data instance by removing a shape tree reference relationship from the instance graph.- Parameters:
childInstance
- ChildDataInstance
to 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 newDataInstance
as permitted by the provideddataGrant
. UUID will be generated and used forresourceName
if it is null.- Parameters:
dataGrant
-ReadableDataGrant
allowing the instance to be createdresourceName
- Name of the instance to create- Returns:
- URI for new instance
- Throws:
SaiException
-
generateUri
Generate the URI for a newDataInstance
as permitted by the provideddataGrant
, with a generated UUID as resource name.- Parameters:
dataGrant
-ReadableDataGrant
allowing 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
-