1. Uche Ogbuji
  2. scatter-share

Source

scatter-share / balisage09 / slide31.py

MODEL_A = '''<labels xmlns:eg="http://examplotron.org/0/" xmlns:ak="http://purl.org/dc/org/xml3k/akara">
  <label id="tse" added="2003-06-10" eg:occurs="*" ak:resource="@id">
    <!-- use ak:resource="" for an anonymous resource -->
    <quote eg:occurs="?">
      <emph>Midwinter</emph> Spring is its own <strong>season</strong>...
    </quote>
    <name ak:rel="name()">Thomas Eliot</name>
    <address ak:rel="'place'" ak:value="concat(city, ',', province)">
      <street>3 Prufrock Lane</street>
      <city>Stamford</city>
      <province>CT</province>
    </address>
    <opus year="1932" ak:rel="name()" ak:resource="">
      <title ak:rel="name()">The Wasteland</title>
    </opus>
    <tag eg:occurs="*" ak:rel="name()">old possum</tag>
  </label>
</labels>
'''
labelmodel = examplotron_model(MODEL_A)

INSTANCE_A_1 = '''<labels>
  <label id="co" added="2004-11-15">
    <name>Christopher Okigbo</name>
    <address>
      <street>7 Heaven's Gate</street>
      <city>Idoto</city>
      <province>Anambra</province>
    </address>
    <opus>
      <title>Heaven's Gate</title>
    </opus>
    <tag>biafra</tag>
    <tag>poet</tag>
  </label>
</labels>
'''

from amara.bindery.model import generate_metadata

doc = bindery.parse(INSTANCE_A_1, model=labelmodel)

for triple in generate_metadata(doc): #Triples, but only RDF if you want it to be
    print triple