Skip to content
This repository was archived by the owner on Mar 20, 2020. It is now read-only.

MADS Ruby API

UCSD Library edited this page May 16, 2013 · 3 revisions

There are three types of MADS subjects:

  1. SimpleType: a single typed value.
  2. Name: a single type of name, with a list of typed values.
  3. ComplexSubject: a list of SimpleTypes and/or Names, which can be linked or inline.

SimpleType

<mads:Xxx rdf:about="http://library.ucsd.edu/ark:/20775/123">
    <mads:authoritativeLabel>foo</mads:authoritativeLabel>
    <owl:sameAs rdf:resource="http://foo.com/345"/>
    <mads:elementList rdf:parseType="Collection">
        <mads:XxxElement>
            <mads:elementValue>foo</mads:elementValue>
        </mads:XxxElement>
    </mads:elementList>
</mads:Xxx>
  • Single element value.
  • authoritativeLabel is the same as elementValue.
  • Xxx: BuiltWorkPlace, CulturalContext, Function, GenreForm, Geographic, Iconography, ScientificName, StylePeriod, Technique, Temporal, or Topic.

API:

simple = MadsTopic.new pid: "123", value: "foo", sameAs: "http://foo.com/345"

Name

<mads:XxxName rdf:about="http://library.ucsd.edu/ark:/20775/123">
    <mads:authoritativeLabel>YYY, ZZZ</mads:authoritativeLabel>
    <owl:sameAs rdf:resource="http://foo.com/345"/>
    <mads:elementList rdf:parseType="Collection">
        <mads:YyyNameElement>
            <mads:elementValue>YYY,</mads:elementValue>
        </mads:YyyNameElement>
        <mads:ZzzNameElement>
            <mads:elementValue>ZZZ</mads:elementValue>
        </mads:ZzzNameElement>
    </mads:elementList>
</mads:XxxName>
  • Any number of elements in any order.
  • authoritativeLabel is element values separated by spaces.
  • Xxx: Name, PersonalName, CorporateName, FamilyName, or ConferenceName.
  • Yyy/Zzz: NameElement, DateNameElement, FamilyNameElement, FullNameElement, GivenNameElement, or TermsOfAddressNameElement.

API:

name = MadsXxxName.new pid: "123", sameAs: "http://foo.com/345"
name.elementList[0] = MadsYyyNameElement.new value: "YYY,"
name.elementList[1] = MadsZzzNameElement.new value: "ZZZ"

ComplexSubject

<mads:ComplexSubject rdf:about="http://library.ucsd.edu/ark:/20775/123">
    <mads:authoritativeLabel>ABC--DEF</mads:authoritativeLabel>
    <owl:sameAs rdf:resource="http://foo.com/345"/>
    <mads:componentList rdf:parseType="Collection">
        <mads:Xxx rdf:about="http://library.ucsd.edu/ark:/20775/345"/>
        <mads:Yyy>
            <mads:authoritativeLabel>DEF</mads:authoritativeLabel>
            <owl:sameAs rdf:resource="http://foo.com/678"/>
            <mads:elementList rdf:parseType="Collection">
                <mads:YyyElement>
                    <mads:elementValue>DEF</mads:elementValue>
                </mads:YyyElement>
            </mads:elementList>
        </mads:Yyy>
    </mads:componentList>
</mads:ComplexSubject>
  • Any number of components, either linked or inline.
  • authoritativeLabel is component authoritativeLabels separated by dashes.
  • Xxx/Yyy: any of the Name or SimpleType classes.

API:

complex = MadsComplexSubject.new pid: "123", sameAs: "http://foo.com/345"
complex.componentList[0] = MadsXxx.new pid: "345"
complex.componentList[1] = MadsYyy.new value: "DEF", sameAs: "http://foo.com/678"

RDF examples

<mads:Topic>
  <mads:authoritativeLabel>Cosmology</mads:authoritativeLabel>
  <mads:elementList rdf:parseType="Collection">
    <mads:TopicElement>
      <mads:elementValue>Cosmology</mads:elementValue>
    </mads:TopicElement>
  </mads:elementList>
</mads:Topic>

<mads:Temporal>
  <mads:authoritativeLabel>16th Century</mads:authoritativeLabel>
  <mads:elementList rdf:parseType="Collection">
    <mads:TemporalElement>
      <mads:elementValue>16th Century</mads:elementValue>
    </mads:TemporalElement>
  </mads:elementList>
</mads:Temporal>

<mads:PersonalName>
  <mads:authoritativeLabel>Jefferson, Thomas, 1743-1826</mads:authoritativeLabel>
  <mads:elementList rdf:parseType="Collection">
    <mads:FullNameElement>
      <mads:elementValue>Jefferson, Thomas,</mads:elementValue>
    </mads:FullNameElement>
    <mads:DateNameElement>
      <mads:elementValue>1743-1826</mads:elementValue>
    </mads:DateNameElement>
  </mads:elementList>
</mads:PersonalName>

<mads:CorporateName>
  <mads:authoritativeLabel>University of California, San Diego. University Library</mads:authoritativeLabel>
  <mads:elementList rdf:parseType="Collection">
    <mads:NameElement>
      <mads:elementValue>University of California, San Diego.</mads:elementValue>
    </mads:NameElement>
    <mads:NameElement>
      <mads:elementValue>University Library</mads:elementValue>
    </mads:NameElement>
  </mads:elementList>
</mads:CorporateName>

<mads:ComplexSubject>
  <mads:authoritativeLabel>Jefferson, Thomas, 1743-1826--Presidency--1801-1809</mads:authoritativeLabel>
  <mads:componentList rdf:parseType="Collection">
    <mads:PersonalName>
      <mads:authoritativeLabel>Jefferson, Thomas, 1743-1826</mads:authoritativeLabel>
      <mads:elementList rdf:parseType="Collection">
        <mads:FullNameElement>
          <mads:elementValue>Jefferson, Thomas,</mads:elementValue>
        </mads:FullNameElement>
        <mads:DateNameElement>
          <mads:elementValue>1743-1826</mads:elementValue>
        </mads:DateNameElement>
      </mads:elementList>
    </mads:PersonalName>

    <mads:Topic>
      <mads:authoritativeLabel>Presidency</mads:authoritativeLabel>
      <mads:elementList rdf:parseType="Collection">
        <mads:TopicElement>
          <mads:elementValue>Presidency</mads:elementValue>
        </mads:TopicElement>
      </mads:elementList>
    </mads:Topic>

    <mads:Temporal>
      <mads:authoritativeLabel>1801-1809</mads:authoritativeLabel>
      <mads:elementList rdf:parseType="Collection">
        <mads:TemporalElement>
          <mads:elementValue>1801-1809</mads:elementValue>
        </mads:TemporalElement>
      </mads:elementList>
    </mads:Temporal>
  </mads:componentList>
</mads:ComplexSubject>
Clone this wiki locally