edu.ucsb.nceas.metacat.dataone.resourcemap

## Class ResourceMapModifier

- java.lang.Object
- - edu.ucsb.nceas.metacat.dataone.resourcemap.ResourceMapModifier

-     public class ResourceMapModifier
      extends java.lang.Object

  This class will create a new resource map by modifying a given resourceMap input stream. Note: this class can only be used on the mn.publish method since it will replace the all old pid existing places by the new id. It is only safe for the the mn.publish method.
  Author:
    tao

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `AGENT_URI`
    `static java.lang.String` | `AGGREGATION`
    `static java.lang.String` | `baseURI`
    `static java.lang.String` | `CITO_NAMESPACE`
    `static java.lang.String` | `DEFAULT_CN_URI`
    `static java.lang.String` | `ORE_TER_NAMESPACE`
    `static java.lang.String` | `RDF_NAMESPACE`
    `static java.lang.String` | `RESOLVE`
    `static java.lang.String` | `SLASH`
    `static java.lang.String` | `TERM_NAMESPACE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ResourceMapModifier(org.dataone.service.types.v1.Identifier oldResourceMapId, java.io.InputStream originalResourceMap, org.dataone.service.types.v1.Identifier newResourceMapId)` Constructor

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static com.hp.hpl.jena.rdf.model.Resource` | `getResource(com.hp.hpl.jena.rdf.model.Model model, java.lang.String id)` Get the Resource object which has the given identifier
    `java.util.List<org.dataone.service.types.v1.Identifier>` | `getSubjectsOfDocumentedBy(org.dataone.service.types.v1.Identifier metadataId)` Get all subjects of the triple - * is documentedBy metadataId on the resource map
    `void` | `replaceObsoletedId(org.dataone.service.types.v1.Identifier obsoletedId, org.dataone.service.types.v1.Identifier newId, java.io.OutputStream newResourceMap, org.dataone.service.types.v1.Subject subject)` Create new resource map by replacing obsoleted ids by new ids.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### DEFAULT_CN_URI

          public static final java.lang.String DEFAULT_CN_URI

      See Also:
        Constant Field Values

    - #### SLASH

          public static final java.lang.String SLASH

      See Also:
        Constant Field Values

    - #### RESOLVE

          public static final java.lang.String RESOLVE

      See Also:
        Constant Field Values

    - #### TERM_NAMESPACE

          public static final java.lang.String TERM_NAMESPACE

      See Also:
        Constant Field Values

    - #### CITO_NAMESPACE

          public static final java.lang.String CITO_NAMESPACE

      See Also:
        Constant Field Values

    - #### ORE_TER_NAMESPACE

          public static final java.lang.String ORE_TER_NAMESPACE

      See Also:
        Constant Field Values

    - #### RDF_NAMESPACE

          public static final java.lang.String RDF_NAMESPACE

      See Also:
        Constant Field Values

    - #### AGGREGATION

          public static final java.lang.String AGGREGATION

      See Also:
        Constant Field Values

    - #### AGENT_URI

          public static final java.lang.String AGENT_URI

      See Also:
        Constant Field Values

    - #### baseURI

          public static java.lang.String baseURI

  - ### Constructor Detail

    - #### ResourceMapModifier

          public ResourceMapModifier(org.dataone.service.types.v1.Identifier oldResourceMapId,
                                     java.io.InputStream originalResourceMap,
                                     org.dataone.service.types.v1.Identifier newResourceMapId)

      Constructor
      Parameters:
        `oldResourceMapId` - the identifier of the old resource map which will be modified
        `originalResourceMap` - the content of original resource map
        `newResourceMapId` - the identifier of the new resource map which will be generated

  - ### Method Detail

    - #### replaceObsoletedId

          public void replaceObsoletedId(org.dataone.service.types.v1.Identifier obsoletedId,
                                         org.dataone.service.types.v1.Identifier newId,
                                         java.io.OutputStream newResourceMap,
                                         org.dataone.service.types.v1.Subject subject)
                                  throws java.io.UnsupportedEncodingException

      Create new resource map by replacing obsoleted ids by new ids. Note: this method can only be used on the mn.publish method since it will replace the all old pid existing places by the new id. It is only safe for the the mn.publish method.
      Parameters:
        `obsoletedId` - the pid will be replaced
        `newId` - the pid will be used to replace the old pid
        `newResourceMap` - the place where the created new resource map will be written
        `subject` - the subject who generates the resource map
      Throws:
        `java.io.UnsupportedEncodingException`

    - #### getResource

          public static com.hp.hpl.jena.rdf.model.Resource getResource(com.hp.hpl.jena.rdf.model.Model model,
                                                                       java.lang.String id)

      Get the Resource object which has the given identifier
      Parameters:
        `model` - the model where the query will be applied
        `id` - the identifier of the Resource object has
      Returns:
        the Resource object with the given identifier. It can return null if not found.

    - #### getSubjectsOfDocumentedBy

          public java.util.List<org.dataone.service.types.v1.Identifier> getSubjectsOfDocumentedBy(org.dataone.service.types.v1.Identifier metadataId)

      Get all subjects of the triple - * is documentedBy metadataId on the resource map
      Parameters:
        `metadataId` - the id of object on the triple (it always be a metadata id). If it is null, it will be anything.
      Returns:
        the all the identifiers of the subjects match the query

Copyright © 2020 Regents of the University of California. All Rights Reserved.