public class RDFUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
CONTENT_NEGOTIATION_KEY |
static String |
CONTEXT_PATH_KEY
Property key to load the URL of the dspace-rdf module.
|
static String |
CONVERTER_DSOTYPES_KEY
Key of the Property to load the types of DSpaceObjects that should get
converted.
|
static String |
SPARQL_ENDPOINT_KEY
Property key to load the public address of the SPARQL endpoint.
|
static String |
STORAGE_GRAPHSTORE_ENDPOINT_KEY
Property key to load the address of the SPARQL 1.1 GRAPH STORE HTTP
PROTOCOL endpoint.
|
static String |
STORAGE_GRAPHSTORE_LOGIN_KEY
Property key to load the username if authentication for the graph store
endpoint is required.
|
static String |
STORAGE_GRAPHSTORE_PASSWORD_KEY
Property key to load the password if authentication for the graph store
endpoint is required.
|
static String |
STORAGE_SPARQL_ENDPOINT_KEY
Property key to load the address of the SPARQL endpoint to use within
DSpace.
|
static String |
STORAGE_SPARQL_LOGIN_KEY
Property key to load the username if authentication for the internal
SPARQL endpoint is required.
|
static String |
STORAGE_SPARQL_PASSWORD_KEY
Property key to load the password if authentication for the internal
SPARQL endpoint is required.
|
| 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,
UUID id,
String handle,
List<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,
UUID id,
String handle,
List<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 final String CONTENT_NEGOTIATION_KEY
public static final String CONVERTER_DSOTYPES_KEY
public static final String STORAGE_GRAPHSTORE_PASSWORD_KEY
public static final String CONTEXT_PATH_KEY
public static final String SPARQL_ENDPOINT_KEY
public static final String STORAGE_SPARQL_LOGIN_KEY
public static final String STORAGE_SPARQL_PASSWORD_KEY
public static final String STORAGE_GRAPHSTORE_ENDPOINT_KEY
public static final String STORAGE_SPARQL_ENDPOINT_KEY
public static final String STORAGE_GRAPHSTORE_LOGIN_KEY
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, UUID id, String handle, List<String> identifier) throws SQLException
context - DSpace Context.type - Type of the DSpaceObject you want to generate a URI for (e.g.
Constants.ITEM.id - UUID 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.SQLException - if database errorItemNotArchivedException - 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.SQLException - if database errorItemNotArchivedException - 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.SQLException - if database errorItemNotArchivedException - 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.SQLException - if database errorpublic static void delete(String uri)
uri - URI to identify the named graph to delete.public static void delete(Context ctx, int type, UUID id, String handle, List<String> identifiers) throws SQLException, org.dspace.rdf.RDFMissingIdentifierException
ctx - type - DSpaceObject type (e.g. Constants.ITEM).id - Id of the DspaceObject.handle - Handle of the DSpaceObject.SQLException - if database errorRDFMissingIdentifierException - In case that no Identifier could be generated.Copyright © 2016 DuraSpace. All rights reserved.