Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sbJson 2.0 parentId #63

Closed
2 tasks done
stansmith907 opened this issue Mar 6, 2017 · 5 comments
Closed
2 tasks done

sbJson 2.0 parentId #63

stansmith907 opened this issue Mar 6, 2017 · 5 comments

Comments

@stansmith907
Copy link
Contributor

stansmith907 commented Mar 6, 2017

Mapping of sbJson parentId to mdTranslator internal data structure:

  • reader complete
  • writer complete
{
    "parentId":"4f46607504a61aa9773f463d""
}

Definition: The unique ScienceBase id of the parent of this item. This is a string. This is one of two required fields in creating a new item, the other field is title.

  • Map to metadata metadataInfo parentMetadata identifier:
    [schema][metadata][metadataInfo][parentMetadata][identifiers][n].identifier
    view mdTools
    [schema][metadata][metadataInfo][parentMetadata][identifiers][n].namespace
    view mdTools
    [schema][metadata][metadataInfo][parentMetadata].title
    view mdTools

Mapping to mdTranslator

   def newBase
      intObj = {
         metadata: {
            metadataInfo: {
               parentMetadata: {
                  title: 'USGS ScienceBase parent identifier',
                  alternateTitles: [],
                  dates: [],
                  edition: nil,
                  responsibleParties: [],
                  presentationForms: [],
                  identifiers: [
                     {
                        identifier: '4f46607504a61aa9773f463d',
                        namespace: 'gov.sciencebase.catalog',
                        version: nil,
                        description: nil,
                        citation: {}
                     }
                  ],
                  series: {},
                  otherDetails: [],
                  onlineResources: [],
                  browseGraphics: []
               }
            }
         }
      }
   end

Translation to mdJson

{
   "metadata": {
      "metadataInfo": {
         "parentMetadata": {
            "title": "USGS ScienceBase parent identifier",
            "identifier": [
               {
                  "identifier": "4f46607504a61aa9773f463d",
                  "nameSpace": "gov.sciencebase.catalog"
               }
            ]
         }
      }
   }
}
@jlblcc
Copy link
Member

jlblcc commented Mar 6, 2017

Note that the title here is only provided as an example. It may be any character string. The writer will need to search for the first identifier with namespace = gov.sciencebase.catalog.

@stansmith907
Copy link
Contributor Author

Actually, I inserted the title. I assume 'gov.sciencebase.catelog' namespace will be multiply occurring. I'm not sure what we need to search? parentMetadata is in its own tag. Which would have been obvious if I had not messed up the mdJson example above - fixed now :).

@jlblcc
Copy link
Member

jlblcc commented Mar 6, 2017

Each item in SB can only have one parent(AFAIK). So an identifier with "namespace": "gov.sciencebase.catalog" should only appear once in the parentMetadata > identifier array. So we just need to search until we find one.

@stansmith907
Copy link
Contributor Author

stansmith907 commented Mar 6, 2017

Ahh, you thinking we could end up with multiple identifiers? I suppose we could if someone were to extend the record. We should take the first one with the namespace of 'gov.scienceBase.catalog'

@jlblcc
Copy link
Member

jlblcc commented Mar 6, 2017

I'm sure we'll end up with all kinds of strange and wonderful things. 😬

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants