conversion between JSON and iRODS AVUs. Paul van Schayck, Ton - - PowerPoint PPT Presentation

conversion between json and irods avus
SMART_READER_LITE
LIVE PREVIEW

conversion between JSON and iRODS AVUs. Paul van Schayck, Ton - - PowerPoint PPT Presentation

Providing validated, templated and richer metadata using a bidirectional conversion between JSON and iRODS AVUs. Paul van Schayck, Ton Smeele, Daniel Theunissen and Lazlo Westerhof Metadata Come up with a generic way within iRODS to provide


slide-1
SLIDE 1

Providing validated, templated and richer metadata using a bidirectional conversion between JSON and iRODS AVUs.

Paul van Schayck, Ton Smeele, Daniel Theunissen and Lazlo Westerhof

slide-2
SLIDE 2

Metadata

Come up with a generic way within iRODS to provide metadata templates, validation and user interaction

slide-3
SLIDE 3

Metadata in iRODS

AVU: Attribute Value Unit

iRODS object

(Resource, User, Object, Collection)

Attribute VARCHAR(255) Value VARCHAR(2700) Unit VARCHAR(255)

slide-4
SLIDE 4

Why JSON?

  • Long dark flowing hair
  • Knows C++
  • Loves beer
  • All around nice guy
slide-5
SLIDE 5

Why JSON?

  • JSON is flexible and easy
  • Features: nesting and arrays
  • Human and developer readable
  • Validation: JSON-schema
  • Linked Data: JSON-LD
slide-6
SLIDE 6

Overview - Layers

Conversion Validation Presentation Template Metadata AVUs Metadata Form UI

schema

slide-7
SLIDE 7

Design requirements

  • Bijection between JSON <-> AVU
  • Lean JSON -> AVU conversion.
  • Keep Attribute->Value pairs the same
  • Compatible with existing or additional AVUs
  • Compatible/aware of JSON-LD
slide-8
SLIDE 8

Conversion

Attribute Value Unit title Hello World! root_0_s parameters

  • 1

root_0_o1 size 42 root_1_n readOnly False root_1_b authors Foo root_0_s#0 authors Bar root_0_s#1 references

  • 2

root_o_o2#0 title The Rule Engine root_2_s doi 1234.5678 root_2_s

{ "title": "Hello World!", "parameters": { "size" : 42, "readOnly" : false }, "authors" : ["Foo", "Bar"], "references": [ { "title": "The Rule Engine", "doi": "1234.5678" } ] }

slide-9
SLIDE 9

Attribute Value Unit title Hello World! root_0_s parameters

  • 1

root_0_o1 size 42 root_1_n readOnly False root_1_b authors Foo root_0_s#0 authors Bar root_0_s#1 references

  • 2

root_o_o2#0 title The Rule Engine root_2_s doi 1234.5678 root_2_s

Conversion: step by step

{ "title": "Hello World!", "parameters": { "size" : 42, "readOnly" : false }, "authors" : ["Foo", "Bar"], "references": [ { "title": "The Rule Engine", "doi": "1234.5678" } ] }

slide-10
SLIDE 10

Conversion - Usage of the unit field

root_parent_type#index

JSON-root [a-z] Parent object [0-9] Type [osbnze] array index [0-9]

slide-11
SLIDE 11

Conversion - Implementation

setJsonToObj(*object, *objectType, *jsonRoot, *json) getJsonFromObj(*object, *objectType, *jsonRoot)

Conversion irods_avu_json

  • Python
  • pip package
  • Standalone from iRODS

/MaastrichtUniversity/irods_avu_json

Ruleset irods_avu_json-ruleset

  • Python ruleset (core.py)
  • Includes AVU microservices

/MaastrichtUniversity/irods_avu_json-ruleset

slide-12
SLIDE 12

Conversion - Demo

slide-13
SLIDE 13

Validation - Overview

Conversion Validation Template Metadata AVUs Metadata

schema

slide-14
SLIDE 14

Validation – JSON-schema

JSON Schema is a vocabulary that allows you to annotate and validate JSON documents.

slide-15
SLIDE 15

Validation – Process

iRODS object

(Resource, User, Object, Collection)

A: $id V: URI U: JSON-root PEPs

pep_database_*_avu_*

Validation setJsonToObj() imeta/metalnx/etc Template

schema

Metadata AVUs AVUs

i:/tempZone/path/to/schema.json https://example.com/schema.json

slide-16
SLIDE 16

Validation - Implementation

  • setJsonSchemaToObj(*object, *objectType, *jsonSchema, *jsonRoot)
  • getJsonSchemaFromObj(*object, *objectType, *jsonRoot)
  • pep_database_*_avu_*(*)

Ruleset irods_avu_json-ruleset

  • Python ruleset (core.py)
  • Includes AVU microservices
  • PEPs

/MaastrichtUniversity/irods_avu_json-ruleset

slide-17
SLIDE 17

Validation - Demo

slide-18
SLIDE 18

Overview - Presentation

Conversion Validation Presentation Template Metadata AVUs Metadata Form UI

schema

slide-19
SLIDE 19

Presentation – JSON-schema -> Form

From https://github.com/networknt/react-schema-form

slide-20
SLIDE 20

Our use cases

  • 1. YoDa (Utrecht University)
  • Uses forms defined in JSON-schema (build in ReactJS),
  • utputting JSON
  • 2. DataHub (Maastricht University)
  • Looks at CEDAR, an Angular JSON-schema form

generator, outputting JSON-LD

slide-21
SLIDE 21

Presenation - Demo

slide-22
SLIDE 22

Future

Conversion Validation Presentation Template Metadata AVUs Metadata Form UI

schema

Form Builder Search UI

slide-23
SLIDE 23

Final thoughts

  • Devils advocate:
  • Why not store entire JSON in single AVU?
  • JSON-schema:
  • No real standard for UI presentation (yet)
  • Implementation:
  • Devs: Microservices for setting AVUs! (iRODS-4185)
  • Devs: PEPs for AVU control are difficult to use
  • Possible race conditions during set (locking?)
slide-24
SLIDE 24

Acknowledgements

Daniel Theunissen + rest of team Lazlo Westerhof Ton Smeele

Metadata Templates Working Group

slide-25
SLIDE 25

Hackaton

This Friday!

Ruleset irods_avu_json-ruleset

  • Python ruleset (core.py)
  • Includes AVU microservices
  • PEPs

/MaastrichtUniversity/irods_avu_json-ruleset

Conversion irods_avu_json

  • Python
  • pip package
  • Standalone from iRODS

MaastrichtUniversity/irods_avu_json

Docker irods_avu_json-docker

  • Single iCAT instance
  • Install microservices and

ruleset

  • Runs tests

/MaastrichtUniversity/irods_avu_json-docker

Ideas:

  • Add AVU-unit microservices to core?
  • C++ microservice implementation?
  • Better PEPs?
  • Your applications?
slide-26
SLIDE 26

A quick introduction to JSON-LD

Convert any JSON into linked data by providing the @context Result: Human and developer readable linked data!

{ "id": "http://hdl.handle.net/21.12109/P000000009C000000008", "creator": "https://orcid.org/0000-0001-6591-4637", "description": "Lorem Ipsum", "title": "Foobar" } { "id": "@id" "creator": "http://purl.org/dc/terms/creator" "description": "http://purl.org/dc/terms/description", "title": "http://purl.org/dc/terms/title", }

JSON input @context (also JSON) Result: Linked data (RDF)

<http://hdl.handle.net/21.12109/P000000009C000000008> <http://purl.org/dc/terms/creator> "https://orcid.org/0000 -0001-6591-4637" . <http://hdl.handle.net/21.12109/P000000009C000000008> <http://purl.org/dc/terms/description> "Lorem Ipsum" . <http://hdl.handle.net/21.12109/P000000009C000000008> <http://purl.org/dc/terms/title> "Foobar" .