public class RDFUtil extends Object
| Constructor and Description |
|---|
RDFUtil() |
| Modifier and Type | Method and Description |
|---|---|
static com.hp.hpl.jena.rdf.model.Model |
convert(Context context,
DSpaceObject dso)
Converts the the provided DSpaceObject into RDF and returns the model.
|
static com.hp.hpl.jena.rdf.model.Model |
convertAndStore(Context context,
DSpaceObject dso)
Converts a DSpaceObject into RDF data and stores them using the configured
RDFStorage. |
static void |
delete(Context ctx,
int type,
int id,
String handle,
String[] identifiers)
This is a shortcut to generate an RDF identifier for a DSpaceObject and
to delete the identified data from the named graph.
|
static void |
delete(String uri)
Deletes the data identified by the URI from the triple store.
|
static String |
generateIdentifier(Context context,
DSpaceObject dso)
Generates a URI identifying the provided DSpaceObject.
|
static String |
generateIdentifier(Context context,
int type,
int id,
String handle,
String[] identifier)
Generates a URI identifying the provided DSpaceObject.
|
static void |
isPublic(Context context,
DSpaceObject dso)
Checks whether the provided DSpaceObject is readable within the provided
context and if the DSO is an Item whether it is archived, discoverable
and not withdrawn.
|
static boolean |
isPublicBoolean(Context context,
DSpaceObject dso)
Does the same as
isPublic(Context, DSpaceObject) but returns a boolean instead of throwing
exceptions. |
static com.hp.hpl.jena.rdf.model.Model |
loadModel(String identifier)
Loads converted data of a DSpaceObject identified by the URI provided
as
identifier. |
public static com.hp.hpl.jena.rdf.model.Model loadModel(String identifier)
identifier. This method uses the RDFStorage configurated in
the DSpace configuration. Close the model
(Model.close()) as soon
as possible to free system resources.identifier - A URI representing the object you want to load data about.public static String generateIdentifier(Context context, DSpaceObject dso) throws SQLException
context - DSpace Context.dso - DSpace Object you want to get an identifier for.SQLExceptionpublic static String generateIdentifier(Context context, int type, int id, String handle, String[] identifier) throws SQLException
context - DSpace Context.type - Type of the DSpaceObject you want to generate a URI for (g.e.
Constants.ITEM.id - ID of the DSpaceObject you want to generate a URI for.handle - Handle of the DSpaceObject you want to generate a URI for.SQLExceptionpublic static com.hp.hpl.jena.rdf.model.Model convert(Context context, DSpaceObject dso) throws org.dspace.rdf.RDFMissingIdentifierException, SQLException, ItemNotArchivedException, ItemWithdrawnException, ItemNotDiscoverableException, AuthorizeException, IllegalArgumentException
context - Consider that the converted data will be stored in a
triple store, that is outside the range of the DSpace
authorization mechanism. Unless you are really sure what
you are doing, you should provide the context of an
anonymous user here, as the triple store probably provides
a public SPARQL endpoint.dso - DSpaceObject to convert.RDFMissingIdentifierException - If no identifier could be generated.SQLExceptionItemNotArchivedException - If you want to convert an Item that is
not archived.ItemWithdrawnException - If you want to convert an Item that is
withdrawn.ItemNotDiscoverableException - If you want to convert an Item that
is not discoverable.AuthorizeException - If the DSpaceObject does not have READ
permissions with the provided context.IllegalArgumentException - If the DSpaceObject is not of type SITE,
COMMUNITY, COLLECTION or ITEM.public static com.hp.hpl.jena.rdf.model.Model convertAndStore(Context context, DSpaceObject dso) throws org.dspace.rdf.RDFMissingIdentifierException, SQLException, ItemNotArchivedException, ItemWithdrawnException, ItemNotDiscoverableException, AuthorizeException, IllegalArgumentException
RDFStorage.
Please note that dspace-rdf doesn't support Bundles or Bitstreams as
independent entity. You can convert DSpaceObjects of type SITE,
COMMUNITY, COLLECTION or ITEM.context - Consider that the converted data will be stored in a
triple store, that is outside the range of the DSpace
authorization mechanism. Unless you are really sure what
you are doing, you should provide the context of an
anonymous user here, as the triple store probably provides
a public SPARQL endpoint.dso - DSpaceObject to convert.RDFMissingIdentifierException - If no identifier could be generated.SQLExceptionItemNotArchivedException - If you want to convert an Item that is
not archived.ItemWithdrawnException - If you want to convert an Item that is
withdrawn.ItemNotDiscoverableException - If you want to convert an Item that
is not discoverable.AuthorizeException - If the DSpaceObject does not have READ
permissions with the provided context.IllegalArgumentException - If the DSpaceObject is not of type SITE,
COMMUNITY, COLLECTION or ITEM.public static void isPublic(Context context, DSpaceObject dso) throws SQLException, ItemNotArchivedException, ItemWithdrawnException, ItemNotDiscoverableException, AuthorizeException
context - Consider that the converted data will be stored in a
triple store, that is outside the range of the DSpace
authorization mechanism. Unless you are really sure what
you are doing, you should provide the context of an
anonymous user here, as the triple store probably provides
a public SPARQL endpoint.dso - The DSpaceObjet to check.SQLExceptionItemNotArchivedException - If dso is an Item and is not
archived.ItemWithdrawnException - If dso is an Item and is withdrawn.ItemNotDiscoverableException - If dso is an Item and is not
discoverable.AuthorizeException - If context does not grant READ
permissions for dso.public static boolean isPublicBoolean(Context context, DSpaceObject dso) throws SQLException
isPublic(Context, DSpaceObject) but returns a boolean instead of throwing
exceptions. For those who don't want to deal with catching exceptions.context - Consider that the converted data will be stored in a
triple store, that is outside the range of the DSpace
authorization mechanism. Unless you are really sure what
you are doing, you should provide the context of an
anonymous user here, as the triple store probably provides
a public SPARQL endpoint.dso - The DSpaceObjet to check.isPublic(Context, DSpaceObject) doesn't throw an exception, false if it
did.SQLExceptionpublic static void delete(String uri)
uri - URI to identify the named graph to delete.public static void delete(Context ctx, int type, int id, String handle, String[] identifiers) throws SQLException, org.dspace.rdf.RDFMissingIdentifierException
ctx - type - DSpaceObject type (g.e. Constants.ITEM).id - Id of the DspaceObject.handle - Handle of the DSpaceObject.SQLExceptionRDFMissingIdentifierException - In case that no Identifier could be generated.Copyright © 2014 DuraSpace. All Rights Reserved.