Class RDFizer

java.lang.Object
org.dspace.rdf.RDFizer

public class RDFizer extends Object
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)
  • Field Details

    • stdout

      protected boolean stdout
    • verbose

      protected boolean verbose
    • dryrun

      protected boolean dryrun
    • lang

      protected String lang
    • context

      protected Context context
    • configurationService

      protected final ConfigurationService configurationService
    • contentServiceFactory

      protected final ContentServiceFactory contentServiceFactory
    • communityService

      protected final CommunityService communityService
    • itemService

      protected final ItemService itemService
    • handleService

      protected final HandleService handleService
    • storage

      protected final RDFStorage storage
    • processed

      protected Set<UUID> 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

      protected void overrideContext(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. 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:
      true if 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, unless dryrun is set true. Turtle will be used as serialization.
      Parameters:
      stdout - if true, 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:
      true if 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:
      true if 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

      public void delete(DSpaceObject dso, boolean reset) throws SQLException
      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 object
      reset - 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

      public void convertAll() throws SQLException
      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

      protected void convert(DSpaceObject dso, boolean reset) throws SQLException
      Throws:
      SQLException
    • dspaceDFS

      protected void dspaceDFS(DSpaceObject dso, RDFizer.Callback callback, boolean check, boolean reset) throws SQLException
      Throws:
      SQLException
    • isProcessed

      protected boolean isProcessed(DSpaceObject dso)
    • markProcessed

      protected void markProcessed(DSpaceObject dso)
    • report

      protected void report(String message)
    • runCLI

      protected void runCLI(String[] args)
    • resolveHandle

      protected DSpaceObject resolveHandle(String handle)
    • createOptions

      protected org.apache.commons.cli.Options createOptions()
    • usage

      protected static void usage(org.apache.commons.cli.Options options)
    • main

      public static void main(String[] args)