Class BasicObjectVersionHandler

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void addDateEvent​(com.hp.hpl.jena.sparql.modify.request.QuadDataAcc triplesToInsert, String eventTypeURI, String object)
      Utility function for adding a premis date event.
      protected String getCurrentTimeInXSDDateTime()
      Utility function to get the current time properly formatted for SPARQL or XML.
      protected boolean isDateProperty​(String uri)
      Evaluates if an object/datastream property is a date.
      protected void mapProperty​(String origPred, String obj, com.hp.hpl.jena.sparql.modify.request.QuadAcc triplesToRemove, com.hp.hpl.jena.sparql.modify.request.QuadDataAcc triplesToInsert, Boolean isLiteral)
      WIP function to map properties from 3 to 4.
      protected void migrateDc​(DatastreamVersion v, com.hp.hpl.jena.sparql.modify.request.QuadAcc triplesToRemove, com.hp.hpl.jena.sparql.modify.request.QuadDataAcc triplesToInsert)
      Migrates a DC datastream by shredding it into RDF properties and applying them directly to the object.
      protected void migrateRelsExt​(DatastreamVersion v, com.hp.hpl.jena.sparql.modify.request.QuadAcc triplesToRemove, com.hp.hpl.jena.sparql.modify.request.QuadDataAcc triplesToInsert)
      Migrates a RELS-EXT datastream by splitting it apart into triples to update on the object it describes.
      protected void migrateRelsInt​(DatastreamVersion v)
      Migrates a RELS-INT datastream by splitting it apart and updating the other datastreams it describes.
      void processObjectVersions​(Iterable<ObjectVersionReference> versions)
      Invoked to process a version of a Fedora 3 object.
      protected String resolveInternalURI​(String uri)
      Takes a URI (String) and if it appears to be an internal Fedora URI ("info:fedora/pid") the migrated URI for that resource is returned (and a placeholder is created in the repository if it doesn't already exist).
      void setCustomPropertyMapping​(File propertiesFile)
      A property setter for the optional propertly that indicates a Properties file whose key value pairs represent custom mappings from fedora 3 properties to fedora 4 properties.
      void setImportExternal​(boolean value)
      A property setter for a property that determines the handling of External (X) fedora 3 datastreams.
      void setImportRedirect​(boolean value)
      A property setter for a property that determines the handling of Redirect (R) fedora 3 datastreams.
      void setSkipDisseminators​(boolean skip)
      Sets a property that indicates whether fedora 2 disseminators will be skipped or not.
      protected void updateDatastreamProperties​(ObjectReference obj, DatastreamVersion v, String dsPath)
      WIP utility function to update datastream properties.
      protected void updateDateTriple​(com.hp.hpl.jena.sparql.modify.request.QuadAcc triplesToRemove, com.hp.hpl.jena.sparql.modify.request.QuadDataAcc triplesToInsert, String predicate, String object)
      Utility function for updating a date triple.
      protected void updateLiteralTriple​(com.hp.hpl.jena.sparql.modify.request.QuadAcc triplesToRemove, com.hp.hpl.jena.sparql.modify.request.QuadDataAcc triplesToInsert, String predicate, String object)
      Utility function for updating a literal triple.
      protected void updateObjectProperties​(ObjectVersionReference version, String objectPath, com.hp.hpl.jena.sparql.modify.request.QuadAcc triplesToRemove, com.hp.hpl.jena.sparql.modify.request.QuadDataAcc triplesToInsert)
      Updates object properties after mapping them from 3 to 4.
      protected void updateResourceProperties​(String path, com.hp.hpl.jena.sparql.modify.request.QuadAcc triplesToRemove, com.hp.hpl.jena.sparql.modify.request.QuadDataAcc triplesToInsert, boolean isNonRDF)
      Utility function for updating a FedoraResource's properties.
      protected void updateUriTriple​(com.hp.hpl.jena.sparql.modify.request.QuadAcc triplesToRemove, com.hp.hpl.jena.sparql.modify.request.QuadDataAcc triplesToInsert, String predicate, String object)
      Utility function for updating a uri triple.
    • Method Detail

      • setImportExternal

        public void setImportExternal​(boolean value)
        A property setter for a property that determines the handling of External (X) fedora 3 datastreams. If true, the content of the URL to which those datastreams redirect is fetched and ingested as a fedora 4-managed non-RDF resource. If false (default), a non-RDF resource is created in fedora 4 that when fetched results in an HTTP redirect to the external url.
        Parameters:
        value - indicating if content is external
      • setImportRedirect

        public void setImportRedirect​(boolean value)
        A property setter for a property that determines the handling of Redirect (R) fedora 3 datastreams. If true, the content of the URL to which those datastreams redirect is fetched and ingested as a fedora 4-managed non-RDF resource. If false (default), a non-RDF resource is created in fedora 4 that when fetched results in an HTTP redirect to the external url.
        Parameters:
        value - indicating if content is imported
      • setCustomPropertyMapping

        public void setCustomPropertyMapping​(File propertiesFile)
        A property setter for the optional propertly that indicates a Properties file whose key value pairs represent custom mappings from fedora 3 properties to fedora 4 properties.
        Parameters:
        propertiesFile - a properties file containing mappings from foxml to fedoar 4 properties
      • setSkipDisseminators

        public void setSkipDisseminators​(boolean skip)
        Sets a property that indicates whether fedora 2 disseminators will be skipped or not.
        Parameters:
        skip - indicates whether it is ok to skip fedora 2 disseminators.
      • isDateProperty

        protected boolean isDateProperty​(String uri)
        Evaluates if an object/datastream property is a date.
        Parameters:
        uri - The predicate in question.
        Returns:
        True if the property is a date. False otherwise.
      • updateObjectProperties

        protected void updateObjectProperties​(ObjectVersionReference version,
                                              String objectPath,
                                              com.hp.hpl.jena.sparql.modify.request.QuadAcc triplesToRemove,
                                              com.hp.hpl.jena.sparql.modify.request.QuadDataAcc triplesToInsert)
        Updates object properties after mapping them from 3 to 4.
        Parameters:
        version - Object version to reference
        objectPath - Destination path (in f4) for the object being migrated
        triplesToRemove - List of triples to remove from resource.
        triplesToInsert - List of triples to add to resource.
      • mapProperty

        protected void mapProperty​(String origPred,
                                   String obj,
                                   com.hp.hpl.jena.sparql.modify.request.QuadAcc triplesToRemove,
                                   com.hp.hpl.jena.sparql.modify.request.QuadDataAcc triplesToInsert,
                                   Boolean isLiteral)
        WIP function to map properties from 3 to 4. Feel free to override this to suit your needs.
        Parameters:
        origPred - Predicate of property to map from 3 to 4.
        obj - Object of property to map from 3 to 4.
        triplesToRemove - List of triples to remove from resource.
        triplesToInsert - List of triples to add to resource.
        isLiteral - TRUE if obj is a literal triple, FALSE if a URI
      • updateDatastreamProperties

        protected void updateDatastreamProperties​(ObjectReference obj,
                                                  DatastreamVersion v,
                                                  String dsPath)
        WIP utility function to update datastream properties. Feel free to override this to suit your needs.
        Parameters:
        obj - Object to operate upon
        v - Version of the datasream to update.
        dsPath - resolved path (in f4) for the datastream
      • migrateRelsExt

        protected void migrateRelsExt​(DatastreamVersion v,
                                      com.hp.hpl.jena.sparql.modify.request.QuadAcc triplesToRemove,
                                      com.hp.hpl.jena.sparql.modify.request.QuadDataAcc triplesToInsert)
                               throws IOException
        Migrates a RELS-EXT datastream by splitting it apart into triples to update on the object it describes.
        Parameters:
        v - Version of the datasream to migrate.
        triplesToRemove - List of triples to remove from resource.
        triplesToInsert - List of triples to add to resource.
        Throws:
        IOException - on error
      • migrateDc

        protected void migrateDc​(DatastreamVersion v,
                                 com.hp.hpl.jena.sparql.modify.request.QuadAcc triplesToRemove,
                                 com.hp.hpl.jena.sparql.modify.request.QuadDataAcc triplesToInsert)
                          throws IOException,
                                 RuntimeException
        Migrates a DC datastream by shredding it into RDF properties and applying them directly to the object.
        Parameters:
        v - Version of the datasream to migrate.
        triplesToRemove - List of triples to remove from resource.
        triplesToInsert - List of triples to add to resource.
        Throws:
        IOException - on error
        RuntimeException - on error
      • updateResourceProperties

        protected void updateResourceProperties​(String path,
                                                com.hp.hpl.jena.sparql.modify.request.QuadAcc triplesToRemove,
                                                com.hp.hpl.jena.sparql.modify.request.QuadDataAcc triplesToInsert,
                                                boolean isNonRDF)
                                         throws RuntimeException
        Utility function for updating a FedoraResource's properties.
        Parameters:
        path - Path to the fedora resource to update.
        triplesToRemove - List of triples to remove from resource.
        triplesToInsert - List of triples to add to resource.
        isNonRDF - true if the resource is a non-RDF resource.
        Throws:
        RuntimeException - Possible FedoraExcpetions and IOExceptions
      • updateLiteralTriple

        protected void updateLiteralTriple​(com.hp.hpl.jena.sparql.modify.request.QuadAcc triplesToRemove,
                                           com.hp.hpl.jena.sparql.modify.request.QuadDataAcc triplesToInsert,
                                           String predicate,
                                           String object)
        Utility function for updating a literal triple.
        Parameters:
        triplesToRemove - List of triples to remove from resource.
        triplesToInsert - List of triples to add to resource.
        predicate - Predicate of relationship (assumed to be URI).
        object - Object of relationship (assumed to be literal).
      • updateUriTriple

        protected void updateUriTriple​(com.hp.hpl.jena.sparql.modify.request.QuadAcc triplesToRemove,
                                       com.hp.hpl.jena.sparql.modify.request.QuadDataAcc triplesToInsert,
                                       String predicate,
                                       String object)
        Utility function for updating a uri triple.
        Parameters:
        triplesToRemove - List of triples to remove from resource.
        triplesToInsert - List of triples to add to resource.
        predicate - Predicate of relationship (assumed to be URI).
        object - Object of relationship (assumed to URI).
      • resolveInternalURI

        protected String resolveInternalURI​(String uri)
        Takes a URI (String) and if it appears to be an internal Fedora URI ("info:fedora/pid") the migrated URI for that resource is returned (and a placeholder is created in the repository if it doesn't already exist). Otherwise the value is returned unmodified.
        Parameters:
        uri - to be resolved
        Returns:
        string which is either the migrated URI or the unmodified URI
      • updateDateTriple

        protected void updateDateTriple​(com.hp.hpl.jena.sparql.modify.request.QuadAcc triplesToRemove,
                                        com.hp.hpl.jena.sparql.modify.request.QuadDataAcc triplesToInsert,
                                        String predicate,
                                        String object)
        Utility function for updating a date triple.
        Parameters:
        triplesToRemove - List of triples to remove from resource.
        triplesToInsert - List of triples to add to resource.
        predicate - Predicate of relationship (assumed to be URI).
        object - Object of relationship (assumed to be literal).
      • addDateEvent

        protected void addDateEvent​(com.hp.hpl.jena.sparql.modify.request.QuadDataAcc triplesToInsert,
                                    String eventTypeURI,
                                    String object)
        Utility function for adding a premis date event. Current implementation utilizes a blank node.
        Parameters:
        triplesToInsert - List of triples to add to resource.
        eventTypeURI - Type of premis event.
        object - Object of relationship (e.g. the date. Assumed to be literal).
      • getCurrentTimeInXSDDateTime

        protected String getCurrentTimeInXSDDateTime()
        Utility function to get the current time properly formatted for SPARQL or XML.
        Returns:
        String representing current time in XSDdateTime format (null if error).