public class DataPackage extends Object
Constructor and Description |
---|
DataPackage()
Default constructor without identifier.
|
DataPackage(Identifier id)
Construct a DataPackage using the given identifier to identify this package.
|
Modifier and Type | Method and Description |
---|---|
void |
addAndDownloadData(Identifier id)
Puts an object with the given Identifier to the package's local, temporary
data store.
|
void |
addData(D1Object obj)
Puts a D1Object directly to the package's local, temporary data store without
downloading it from a node.
|
boolean |
contains(Identifier id)
Determine if an object with the given Identifier is already present in
the local data store.
|
static DataPackage |
deserializePackage(String resourceMap)
Deserialize an ORE resourceMap by parsing it, extracting the associated package identifier,
and the list of metadata and data objects aggregated in the ORE Map.
|
static DataPackage |
download(Identifier pid)
Download the resource map
|
D1Object |
get(Identifier id)
Get the D1Object associated with a given Identifier from the local data store.
|
Identifier |
getDocumentedBy(Identifier dataObject)
Convenience function for working with the metadata map.
|
Map<Identifier,List<Identifier>> |
getMetadataMap()
Get a map of the metadata members of the resource map and the associated data
they document.
|
Identifier |
getPackageId() |
org.dspace.foresite.ResourceMap |
getResourceMap()
Return the internally stored resource map
|
SystemMetadata |
getSystemMetadata()
Get the SystemMetadata object associated with the data package.
|
Set<Identifier> |
getUncharacterizedMembers()
Returns a list of package members that are not in the relationship map
(implying that these are not true members, as they will
not be included in the serialized ResourceMap).
|
Set<Identifier> |
getUnresolvableMembers()
Returns the Identifiers in the relationship map that cannot
be found in the object map or resolved by the CN.
|
Set<Identifier> |
identifiers()
Return the set of Identifiers that are part of this package.
|
void |
insertRelationship(Identifier metadataID,
List<Identifier> dataIDList)
Declare which data objects are documented by a metadata object, using their
identifiers.
|
void |
insertRelationship(String blankSubjectId,
org.dspace.foresite.Predicate predicate,
URI object)
Relate a given subject blank node to an object URI using the given predicate.
|
void |
insertRelationship(URI subject,
org.dspace.foresite.Predicate predicate,
List<URI> objects)
Relate a given subject URI to a list of object URIs using the given predicate.
|
void |
insertRelationship(URI subject,
org.dspace.foresite.Predicate predicate,
Object literal)
Relate a given subject URI to a literal using the given predicate.
|
void |
insertRelationship(URI subject,
org.dspace.foresite.Predicate predicate,
URI object)
Relate a given subject URI to an object URI using the given predicate.
|
void |
remove(Identifier id)
Deprecated.
renaming to removeData(Identifier id) for naming consistency
with addData, addAndDownloadData
|
void |
removeData(Identifier id)
Removes a D1Object from the local data store based on its Identifier.
|
String |
serializePackage()
Return an ORE ResourceMap describing this package, serialized as an RDF graph.
|
void |
setPackageId(Identifier packageId) |
void |
setResourceMap(org.dspace.foresite.ResourceMap resourceMap)
Set the internally stored resource map
|
void |
setSystemMetadata(SystemMetadata systemMetadata)
Set the SystemMetadata object to this data package.
|
int |
size()
Used to introspect on the local temporary data store, NOT the number of
DataPackage members.
|
public DataPackage()
public DataPackage(Identifier id)
id
- the Identifier of the packagepublic void addAndDownloadData(Identifier id) throws InvalidToken, ServiceFailure, NotAuthorized, NotFound, NotImplemented, InsufficientResources, InvalidRequest, ClientSideException
id
- the identifier of the object to be addedInvalidRequest
InsufficientResources
NotImplemented
NotFound
NotAuthorized
ServiceFailure
InvalidToken
ClientSideException
public void addData(D1Object obj)
obj
- the D1Object to be added to the object mappublic void insertRelationship(Identifier metadataID, List<Identifier> dataIDList) throws org.dspace.foresite.OREException, URISyntaxException
metadataID
- dataIDList
- URISyntaxException
org.dspace.foresite.OREException
public void insertRelationship(URI subject, org.dspace.foresite.Predicate predicate, URI object) throws URISyntaxException, org.dspace.foresite.OREException
subject
- The subject of the statementpredicate
- The relationship of the statementobject
- the object of the statementURISyntaxException
org.dspace.foresite.OREException
public void insertRelationship(String blankSubjectId, org.dspace.foresite.Predicate predicate, URI object) throws org.dspace.foresite.OREException
blankSubjectId
- The identifier used for the blank node in the resource mappredicate
- the predicate of the statementobject
- the URI of the object of the statementorg.dspace.foresite.OREException
public void insertRelationship(URI subject, org.dspace.foresite.Predicate predicate, List<URI> objects) throws URISyntaxException, org.dspace.foresite.OREException
subject
- The subject of each statementpredicate
- The relationship of each statementobject
- the objects of each statementURISyntaxException
org.dspace.foresite.OREException
public void insertRelationship(URI subject, org.dspace.foresite.Predicate predicate, Object literal) throws org.dspace.foresite.OREException
subject
- predicate
- literal
- org.dspace.foresite.OREException
public int size()
public boolean contains(Identifier id)
id
- the Identifier to be checkedpublic D1Object get(Identifier id)
id
- the identifier of the object to be retrievedpublic void remove(Identifier id)
id
- public void removeData(Identifier id)
id
- the Identifier of the object to be removed.public Set<Identifier> identifiers()
public Identifier getPackageId()
public void setPackageId(Identifier packageId)
packageId
- the packageId to setpublic org.dspace.foresite.ResourceMap getResourceMap()
public void setResourceMap(org.dspace.foresite.ResourceMap resourceMap)
resourceMap
- The resource map to setpublic String serializePackage() throws org.dspace.foresite.OREException, URISyntaxException, org.dspace.foresite.ORESerialiserException
URISyntaxException
org.dspace.foresite.OREException
org.dspace.foresite.ORESerialiserException
public static DataPackage download(Identifier pid) throws InvalidToken, ServiceFailure, NotAuthorized, NotFound, NotImplemented, InsufficientResources, InvalidRequest, org.dspace.foresite.OREException, URISyntaxException, org.dspace.foresite.OREParserException, IOException, ClientSideException
pid
- InvalidToken
ServiceFailure
NotAuthorized
NotFound
NotImplemented
InsufficientResources
InvalidRequest
org.dspace.foresite.OREException
URISyntaxException
org.dspace.foresite.OREParserException
IOException
ClientSideException
public static DataPackage deserializePackage(String resourceMap) throws UnsupportedEncodingException, org.dspace.foresite.OREException, URISyntaxException, org.dspace.foresite.OREParserException, InvalidToken, ServiceFailure, NotAuthorized, NotFound, NotImplemented, InsufficientResources, InvalidRequest, ClientSideException
resourceMap
- the string representation of an ORE map in XML formatorg.dspace.foresite.OREParserException
URISyntaxException
org.dspace.foresite.OREException
UnsupportedEncodingException
InvalidRequest
InsufficientResources
NotImplemented
NotFound
NotAuthorized
ServiceFailure
InvalidToken
ClientSideException
public Identifier getDocumentedBy(Identifier dataObject)
dataObject
- public void setSystemMetadata(SystemMetadata systemMetadata)
systemMetadata
- - the SystemMetadata object will be set.public SystemMetadata getSystemMetadata()
public Set<Identifier> getUncharacterizedMembers()
public Set<Identifier> getUnresolvableMembers() throws InvalidToken, ServiceFailure, NotImplemented
InvalidToken
ServiceFailure
NotImplemented
public Map<Identifier,List<Identifier>> getMetadataMap()
Copyright © 2020. All Rights Reserved.