GithubHelp home page GithubHelp logo

Comments (3)

miku avatar miku commented on July 30, 2024

Just curious, is that something documented in the spec?

Another question: aren't there XML tools that would allow specific XML tag extraction? That way, we could keep functionality separate.

from metha.

nichtich avatar nichtich commented on July 30, 2024

As far as I understand the spec, oai:metadata is nested in oai:OAI-PMH/oai:ListRecords/oai:record and it may contain any XML elements.

<complexType name="metadataType">
  <annotation>
    <documentation>Metadata must be expressed in XML that complies
     with another XML Schema (namespace=#other). Metadata must be 
      explicitly qualified in the response.</documentation>
  </annotation>
  <sequence>
    <any namespace="##other" processContents="strict"/>
  </sequence>
</complexType>

I'm only interested in this child element(s) of oia:metadata because this is the actual payload. I'm surprised people keep the OAI envelope.

Suire Workaround is to apply an XSLT to each record (when using find and xargs) or to the while set (when using meta-cat), but this is far from a one-liner:

<?xml version="1.0" encoding="UTF-8"?>
<!-- Extract OAI metadata records from OAI-PMH responses -->
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
    xmlns:oai="http://www.openarchives.org/OAI/2.0/" exclude-result-prefixes="oai">
  <xsl:strip-space elements="*"/>
  <xsl:output method="xml" indent="yes"/>

  <xsl:template match="/Response">
    <records>
      <xsl:apply-templates select="ListRecords/oai:record"/>
    </records>
  </xsl:template>

  <xsl:template match="/Records">
    <records>
      <xsl:apply-templates select="oai:record"/>
    </records>
  </xsl:template>

  <xsl:template match="oai:record">
      <xsl:copy-of select="oai:metadata/*"/>
  </xsl:template>
</xsl:transform>  

I suppose the extraction would only be a few lines and an optional command line flag in metha source code.

from metha.

miku avatar miku commented on July 30, 2024

I'm only interested in this child element(s) of oia:metadata because this is the actual payload. I'm surprised people keep the OAI envelope.I'm surprised people keep the OAI envelope.

Yes, metadata is the most interesting. If the envelop - oai:record/oai:metadata/* - would be just the metadata then one may mis the "set specifier" that's sometimes useful.

<record>
  <header status="">
    <identifier>oai:ojs.pkp.sfu.ca:article/2287</identifier>
    <datestamp>2020-06-22T11:34:53Z</datestamp>
    <setSpec>EJOEH:E</setSpec>
    <setSpec>driver</setSpec>
  </header>
  <metadata>
    <oai_dc:dc xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" ....oai_dc.xsd">
      <dc:title xml:lang="it-IT">Editoriale / Editorial</dc:title>
      <dc:creator>Szmigielski, S.</dc:creator>
      ...
    </oai_dc:dc>
  </metadata>
</record>

Thanks for the XSTL.

but this is far from a one-liner:

I appreciate the desire for one-liners.

from metha.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.