Print

Print


If there are no explicit METS to JSON-LD transformations, it might be worth
looking at METS to RDF/XML workflow. Going from RDF/XML (or other
serialisations) to JSON-LD is  straight forward.

On Wed, 2 Aug 2023, 17:37 Manuela Pallotto Strickland, <
[log in to unmask]> wrote:

> Hi Gregory,
> Thanks so much for your comment. I am getting the sense that the general
> opinion is that there is not a lot to think about but simply converting ad
> hoc from XML if/when needed. I just had a look at the METS 2.0
> documentation in GitHub and cannot really see any explicit/direct reference
> to Linked Data in it (although the original working group was interested in
> modelling the schema as a more LD-friendly schema). Nonetheless, the 2.0
> documentation references hybrid/LD-compatible data exchange standard
> formats and protocols such as IIIF and BagIt, so who knows... I will post
> my question in the METS listserv, and see what they say.
> Thanks again!
> Best,
> Manuela
>
>
>
> __________________________________________________________________________________
>
> Dr Manuela Pallotto Strickland | Metadata and Digital Preservation
> Coordinator | Archives & Research Collections | Libraries & Collections
> King's College London | Strand | London WC2R 2LS |
> [log in to unmask]
> Tel: Please call me using MS Teams or Skype for Business, or email to
> arrange a call
>
> W: https://www.kcl.ac.uk/library/collections/archives
> T: twitter.com/KingsArchives and twitter.com/kingslibraries
> Blog: blogs.kcl.ac.uk/kingscollections
>
> -----Original Message-----
> From: Code for Libraries <[log in to unmask]> On Behalf Of Murray,
> Gregory
> Sent: Tuesday, August 1, 2023 5:09 PM
> To: [log in to unmask]
> Subject: Re: [CODE4LIB] METS in JSON-LD?
>
> [You don't often get email from [log in to unmask] Learn why this
> is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> Hi Manuela,
>
> Personally I'd recommend storing and managing your METS documents as XML
> and converting to JSON only at the point where you need to process them as
> JSON. That assumes you have the option of storing as XML. If your database
> is built mainly or only for JSON, then you'll have to do a one-time
> conversion from XML to JSON. In any case, as has already been said it's
> strictly a matter of conversion, and there are lots of tools that can take
> XML and output generic JSON in a lossless way. Whether you would then need
> to have another process to go from JSON to JSON-LD I don't know; that's
> outside my knowledge.
>
> Hope this helps,
> Greg
>
>
> Gregory Murray
> Director of Digital Initiatives
> Wright Library
> Princeton Theological Seminary
>
>
> From: Code for Libraries <[log in to unmask]> on behalf of parker,
> anson D (adp6j) <[log in to unmask]>
> Date: Tuesday, August 1, 2023 at 10:55 AM
> To: [log in to unmask] <[log in to unmask]>
> Subject: Re: [CODE4LIB] METS in JSON-LD?
> [You don't often get email from
> [log in to unmask] Learn why this is
> important at https://aka.ms/LearnAboutSenderIdentification ]
>
> might be worth spending a minute on some AI bots to play with this
>
> at the end of the day it's an XML->JSON project and there are a bunch of
> tools that will streamline that
>
> for instance here's a dumbed down python script with a streamlit interface
> i got out of claude.ai in a couple of queries
>
>
> import streamlit as st
> import xml.etree.ElementTree as ET
> import json
>
> st.title('METS to JSON-LD Converter')
>
> uploaded_file = st.file_uploader('Choose a METS XML file', type=['xml'])
>
> if uploaded_file is not None:
>     # Load METS file
>     tree = ET.parse(uploaded_file)
>     root = tree.getroot()
>
>     # JSON-LD context
>     context = {
>         '@vocab': 'http://schema.org/<http://schema.org/>',
>         'dc': 'http://purl.org/dc/elements/1.1/<
> http://purl.org/dc/elements/1.1/>'
>     }
>
>     jsonld = {'@context': context}
>     jsonld['metadata'] = []
>
>     # Parse METS and generate JSON-LD
>     for dmdSec in root.iter('dmdSec'):
>         # Extract metadata
>         md = {
>             'name':
> dmdSec.find('mdWrap/xmlData/mods/titleInfo/title').text,
>             'author': [{'@type': 'Person', 'name': namePart.text} for
> namePart in dmdSec.find('mdWrap/xmlData/mods/name')],
>             'datePublished':
> dmdSec.find('mdWrap/xmlData/mods/originInfo/dateIssued').text,
>             'publisher': {'@type': 'Organization', 'name':
> dmdSec.find('mdWrap/xmlData/mods/originInfo/publisher').text},
>             'genre': dmdSec.find('mdWrap/xmlData/mods/genre').text,
>             'description': dmdSec.find('mdWrap/xmlData/mods/abstract').text
>         }
>
>         jsonld['metadata'].append(md)
>
>     # Output JSON-LD file for download
>     json_txt = json.dumps(jsonld, indent=4)
>     st.download_button('Download JSON-LD', json_txt, 'metadata.jsonld')
>
> ________________________________________
> From: Code for Libraries <[log in to unmask]> on behalf of Manuela
> Pallotto Strickland <[log in to unmask]>
> Sent: Tuesday, August 1, 2023 10:47 AM
> To: [log in to unmask]
> Subject: [CODE4LIB] METS in JSON-LD?
>
> Hello,
> I am posting this question on a couple of lists, so sincere apologies to
> those who might see it twice (or thrice).
> Does anyone know of any work that has been/is being/will be done on 'a'
> METS JSON-LD serialization?
> Any relevant info or comment in this re will be very much appreciated.
> Thank you!
> Best wishes,
> Manuela
>
>
>
> __________________________________________________________________________________
>
> Dr Manuela Pallotto Strickland | Metadata and Digital Preservation
> Coordinator | Archives & Research Collections | Libraries & Collections
> King's College London | Strand | London WC2R 2LS |
> [log in to unmask]<mailto:
> [log in to unmask]>
> Tel: Please call me using MS Teams or Skype for Business, or email to
> arrange a call
>
> W: https://www.kcl.ac.uk/library/collections/archives<
> https://www.kcl.ac.uk/library/collections/archives>
> T: twitter.com/KingsArchives<http://twitter.com/KingsArchives> and
> twitter.com/kingslibraries<http://twitter.com/kingslibraries>
> Blog: blogs.kcl.ac.uk/kingscollections<
> http://blogs.kcl.ac.uk/kingscollections>
>