Package org.dspace.rdf
Class RDFizer
java.lang.Object
org.dspace.rdf.RDFizer
This class manages the handling of RDF data in DSpace. It generates
identifiers, it loads data, it manages the conversion of DSpace Objects into
RDF data. It can be used as instantiated object as well as CLI.
- Author:
- Pascal-Nicolas Becker (dspace -at- pascal -hyphen- becker -dot- de)
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final CommunityServiceprotected final ConfigurationServiceprotected final ContentServiceFactoryprotected Contextprotected booleanprotected final HandleServiceprotected final ItemServiceprotected StringSet to remember with DSpaceObject were converted or deleted from the triplestore already.protected booleanprotected final RDFStorageprotected boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidconvert(DSpaceObject dso, boolean reset) voidConverts and stores all DSpaceObjects that are readable for an anonymous user.protected org.apache.commons.cli.Optionsvoiddelete(DSpaceObject dso, boolean reset) Delete the data about the DSpaceObject from the triplestore.voidDeletes all data stored in the triplestore (drops all named graphs and cleans the default graph).protected voiddspaceDFS(DSpaceObject dso, RDFizer.Callback callback, boolean check, boolean reset) booleanisDryrun()Returns whether this is a dry run.protected booleanisProcessed(DSpaceObject dso) booleanisStdout()Returns whether all converted data is printed to stdout.booleanReturns whether verbose information is printed to System.err.static voidprotected voidprotected voidoverrideContext(Context context) This method allows you to override the context used for conversion and to determine which DSpaceObjects should be deleted from the triplestore, consider well if this is really necessary.protected voidprotected DSpaceObjectresolveHandle(String handle) protected voidvoidsetDryrun(boolean dryrun) Set this true to prevent any changes on the triple store.voidsetStdout(boolean stdout) Set this to true to print all generated data to stdout.voidsetVerbose(boolean verbose) Set this to true to print verbose information to System.err.protected static voidusage(org.apache.commons.cli.Options options)
-
Field Details
-
stdout
protected boolean stdout -
verbose
protected boolean verbose -
dryrun
protected boolean dryrun -
lang
-
context
-
configurationService
-
contentServiceFactory
-
communityService
-
itemService
-
handleService
-
storage
-
processed
Set to remember with DSpaceObject were converted or deleted from the triplestore already. This set is helpful when converting or deleting multiple DSpaceObjects (e.g. Communities with all sub-Communities and Items).
-
-
Constructor Details
-
RDFizer
public RDFizer()
-
-
Method Details
-
overrideContext
This method allows you to override the context used for conversion and to determine which DSpaceObjects should be deleted from the triplestore, consider well if this is really necessary. If this method is not used the context of an anonymous user will be used.Please consider: If your triplestore offers a public sparql endpoint all information readable with the provided context will be exposed to public! If you store your data in a private triplestore that does not provides public access, you might consider to use this method to convert all data stored in your repository.
- Parameters:
context- The relevant DSpace Context.
-
isStdout
public boolean isStdout()Returns whether all converted data is printed to stdout. Turtle will be used as serialization.- Returns:
trueif print all generated data is to be printed to stdout
-
setStdout
public void setStdout(boolean stdout) Set this to true to print all generated data to stdout. The data will be stored as well, unlessdryrunis set true. Turtle will be used as serialization.- Parameters:
stdout- iftrue, print all data to standard output
-
isVerbose
public boolean isVerbose()Returns whether verbose information is printed to System.err. Probably this is helpful for CLI only.- Returns:
trueif verbose mode is on
-
setVerbose
public void setVerbose(boolean verbose) Set this to true to print verbose information to System.err. Probably this is helpful for CLI only.- Parameters:
verbose- print verbose information to stderr
-
isDryrun
public boolean isDryrun()Returns whether this is a dry run. Probably this is helpful for CLI only.- Returns:
trueif dry-run mode is on
-
setDryrun
public void setDryrun(boolean dryrun) Set this true to prevent any changes on the triple store. Probably this is helpful for CLI usage only.- Parameters:
dryrun- test run without any changes to the triple store
-
deleteAll
public void deleteAll()Deletes all data stored in the triplestore (drops all named graphs and cleans the default graph). -
delete
Delete the data about the DSpaceObject from the triplestore. All data about descendent Subcommunities, Collections and Items will be deleted as well.- Parameters:
dso- DSpace objectreset- reset processed status (converted or deleted from the triplestore)- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
convertAll
Converts and stores all DSpaceObjects that are readable for an anonymous user.- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
convert
- Throws:
SQLException
-
dspaceDFS
protected void dspaceDFS(DSpaceObject dso, RDFizer.Callback callback, boolean check, boolean reset) throws SQLException - Throws:
SQLException
-
isProcessed
-
markProcessed
-
report
-
runCLI
-
resolveHandle
-
createOptions
protected org.apache.commons.cli.Options createOptions() -
usage
protected static void usage(org.apache.commons.cli.Options options) -
main
-