<dc:description ak:rel="local-name()" ak:value=".">Cohen's Comments on Adam Przeworski's article "Could We Feed Everyone?"</dc:description>
          <dc:format>2146519 bytes</dc:format>
          <dc:format>application/pdf</dc:format>
          <dc:language>en_US</dc:language>
          <dc:publisher ak:rel="local-name()" ak:value=".">Politics and Society</dc:publisher>
          <dc:title ak:rel="local-name()" ak:value=".">"Maximizing Social Welfare or Institutionalizing Democratic Ideals?"</dc:title>
          <dc:type>Article</dc:type>
          <dc:identifier>Joshua Cohen, "Maximizing Social Welfare or Institutionalizing Democratic Ideals?"; Politics and Society, Vol. 19, No. 1</dc:identifier>
        </oai_dc:dc>
      </metadata>
    </record>
  </GetRecord>
</OAI-PMH>
'''

OAI_MODEL = examplotron_model(OAI_MODEL_XML)

@simple_service('GET', 'http://open-science.zepheira.com/content/dspace/source', 'osci.dspace.atom', 'application/atom+xml')
def dspace_adapter(search=None, id=None):
    '''
    Sample queries:
    curl "http://localhost:8880/dspace?search=stem+cells"
    curl "http://localhost:8880/dspace?id=19358275"
    '''
    #FIXME: How do we handle no search or id param?  Just serve up the latest entries?  Or error as below?
    #assert_(not(search and id), msg="You must specify the 'search' or 'id' query parameter is mandatory.")
    if search:
        search = first_item(search)
        #reldate: only search for last N days
        #query = urllib.urlencode({'db' : NCBI_DB, 'term': query, 'reldate': '60', 'datetype': 'edat', 'retmax': DEFAULT_MAX_RESULTS, 'usehistory': 'y'})
        query = urllib.urlencode({'query': search, 'scope': '/', 'rpp': DEFAULT_MAX_RESULTS, 'sort_by': '0', 'order': 'DESC', 'submit': 'Go'})
Exemple #2
0
ATTACHMENTS_IMT = 'application/x-moin-attachments+xml'
ORIG_BASE_HEADER = 'x-akara-wrapped-moin'
WIKI_RELATIVE_HEADER = 'x-wiki-relative-location'

#Note: this requires the user to install the demo/etc/application_xml.py (a fixed Moin XML formatter) in plugin/formatter/ for th eMoin instance
XML_IMT = 'application/xml'

# XML models

ATTACHMENTS_MODEL_XML = '''<?xml version="1.0" encoding="UTF-8"?>
<attachments xmlns:eg="http://examplotron.org/0/" xmlns:ak="http://purl.org/xml3k/akara/xmlmodel">
  <attachment href="" ak:rel="name()" ak:value="@href"/>
</attachments>
'''

ATTACHMENTS_MODEL = examplotron_model(ATTACHMENTS_MODEL_XML)

HISTORY_MODEL_XML = '''<?xml version="1.0" encoding="UTF-8"?>
<history xmlns:eg="http://examplotron.org/0/" xmlns:ak="http://purl.org/xml3k/akara/xmlmodel">
  <rev eg:occurs="*" editor="akara" date="2010-05-12T21:35:34" id="20"/>
</history>
'''

HISTORY_MODEL = examplotron_model(HISTORY_MODEL_XML)

MOIN_DOCBOOK_MODEL_XML = '''<?xml version="1.0" encoding="UTF-8"?>
<article xmlns:eg="http://examplotron.org/0/" xmlns:ak="http://purl.org/xml3k/akara/xmlmodel" ak:resource="">
  <ak:rel name="'ak-old-type'" ak:value="glosslist[1]/glossentry[glossterm='akara:type']/glossdef//ulink/@url"/>
  <ak:rel name="'ak-type'" ak:value="section[title='akara:metadata']/glosslist/glossentry[glossterm='akara:type']/glossdef//ulink/@url"/>
  <ak:rel name="'ak-updated'" ak:value="articleinfo/revhistory/revision[1]/date"/>
  <articleinfo>
Exemple #3
0
Fichier : oai.py Projet : dpla/zen
      <header>
        <identifier>oai:dspace.mit.edu:1721.1/5451</identifier>
        <datestamp ak:rel="local-name()" ak:value=".">2006-09-20T00:15:44Z</datestamp>
        <setSpec>hdl_1721.1_5443</setSpec>
      </header>
      <metadata>
        <oai_dc:dc xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
          <dc:creator ak:rel="local-name()" ak:value=".">Cohen, Joshua</dc:creator>
          <dc:date ak:rel="local-name()" ak:value=".">2004-08-20T19:48:34Z</dc:date>
          <dc:date>2004-08-20T19:48:34Z</dc:date>
          <dc:date>1991</dc:date>
          <dc:identifier ak:rel="'handle'" ak:value=".">http://hdl.handle.net/1721.1/5451</dc:identifier>
          <dc:description ak:rel="local-name()" ak:value=".">Cohen's Comments on Adam Przeworski's article "Could We Feed Everyone?"</dc:description>
          <dc:format>2146519 bytes</dc:format>
          <dc:format>application/pdf</dc:format>
          <dc:language>en_US</dc:language>
          <dc:publisher ak:rel="local-name()" ak:value=".">Politics and Society</dc:publisher>
          <dc:title ak:rel="local-name()" ak:value=".">"Maximizing Social Welfare or Institutionalizing Democratic Ideals?"</dc:title>
          <dc:type>Article</dc:type>
          <dc:identifier>Joshua Cohen, "Maximizing Social Welfare or Institutionalizing Democratic Ideals?"; Politics and Society, Vol. 19, No. 1</dc:identifier>
        </oai_dc:dc>
      </metadata>
    </record>
  </GetRecord>
</OAI-PMH>
"""

OAI_GETRECORD_MODEL = examplotron_model(OAI_GETRECORD_XML)
OAI_LISTRECORDS_MODEL = examplotron_model(OAI_LISTRECORDS_XML)

Exemple #4
0
          <dc:provenance>This copy once owned by Benjamin Spock</dc:provenance>
          <dc:accrualmethod ak:rel="local-name()" ak:value=".">Purchase</dc:accrualmethod>
          <dc:instructionalmethod ak:rel="local-name()" ak:value=".">Experiential learning</dc:instructionalmethod>
          <dc:rightsholder ak:rel="local-name()" ak:value=".">MIT</dc:rightsholder>
          <dc:rights ak:rel="local-name()" ak:value=".">Collection may be protected under Title 17 of the U.S. Copyright Law.</dc:rights>
          <dc:rights>Access limited to members</dc:rights>
          <dc:identifier ak:rel="'handle'" ak:value=".">04980676</dc:identifier>
          <dc:identifier>http://hdl.handle.net/1721.1/27225</dc:identifier>
          <dc:language ak:rel="local-name()" ak:value=".">en_US</dc:language>
          <dc:relation ak:rel="local-name()" ak:value=".">MIT-EL</dc:relation>
          <dc:relation>78-021</dc:relation>
          <dc:relation>MIT-EL</dc:relation>
          <dc:relation>78-022</dc:relation>
        </oai_dc:dc>
      </metadata>
    </record>
  </GetRecord>
</OAI-PMH>
"""

OAI_GETRECORD_MODEL = examplotron_model(OAI_GETRECORD_XML)
QDC_LISTRECORDS_MODEL = examplotron_model(QDC_LISTRECORDS_XML)
MODS_LISTRECORDS_MODEL = examplotron_model(MODS_LISTRECORDS_XML)
OAI_DC_LISTRECORDS_MODEL = examplotron_model(OAI_DC_LISTRECORDS_XML)

LISTRECORDS_MODELS = {
    "qdc": QDC_LISTRECORDS_MODEL,
    "mods": MODS_LISTRECORDS_MODEL,
    "oai_dc": OAI_DC_LISTRECORDS_MODEL
}
Exemple #5
0
ATTACHMENTS_IMT = 'application/x-moin-attachments+xml'
ORIG_BASE_HEADER = 'x-akara-wrapped-moin'
WIKI_RELATIVE_HEADER = 'x-wiki-relative-location'

#Note: this requires the user to install the demo/etc/application_xml.py (a fixed Moin XML formatter) in plugin/formatter/ for th eMoin instance
XML_IMT = 'application/xml'

# XML models

ATTACHMENTS_MODEL_XML = '''<?xml version="1.0" encoding="UTF-8"?>
<attachments xmlns:eg="http://examplotron.org/0/" xmlns:ak="http://purl.org/xml3k/akara/xmlmodel">
  <attachment href="" ak:rel="name()" ak:value="@href"/>
</attachments>
'''

ATTACHMENTS_MODEL = examplotron_model(ATTACHMENTS_MODEL_XML)

HISTORY_MODEL_XML = '''<?xml version="1.0" encoding="UTF-8"?>
<history xmlns:eg="http://examplotron.org/0/" xmlns:ak="http://purl.org/xml3k/akara/xmlmodel">
  <rev eg:occurs="*" editor="akara" date="2010-05-12T21:35:34" id="20"/>
</history>
'''

HISTORY_MODEL = examplotron_model(HISTORY_MODEL_XML)

MOIN_DOCBOOK_MODEL_XML = '''<?xml version="1.0" encoding="UTF-8"?>
<article xmlns:eg="http://examplotron.org/0/" xmlns:ak="http://purl.org/xml3k/akara/xmlmodel" ak:resource="">
  <ak:rel name="'ak-old-type'" ak:value="glosslist[1]/glossentry[glossterm='akara:type']/glossdef//ulink/@url"/>
  <ak:rel name="'ak-type'" ak:value="section[title='akara:metadata']/glosslist/glossentry[glossterm='akara:type']/glossdef//ulink/@url"/>
  <ak:rel name="'ak-updated'" ak:value="articleinfo/revhistory/revision[1]/date"/>
  <articleinfo>
                <Hour>9</Hour>
                <Minute>0</Minute>
            </PubMedPubDate>
        </History>
        <PublicationStatus>aheadofprint</PublicationStatus>
        <ArticleIdList>
            <ArticleId IdType="doi" ak:rel="concat(local-name(), ':', @IdType)" ak:value=".">10.1002/bmc.1202</ArticleId>
            <ArticleId IdType="pubmed">19353725</ArticleId>
        </ArticleIdList>

    </PubmedData>
</PubmedArticle>

</PubmedArticleSet>"""

PUBMED_MODEL = examplotron_model(PUBMED_MODEL_XML)

NCBI_DB = u"pubmed"

PUBMED_NS = OSCI_BASE + u'/content/pubmed/datamodel#'

#Per-article search http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=pubmed&id=18324973&retmode=xml
#http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&term=cancer&reldate=60&datetype=edat&retmax=100&usehistory=y

#http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=pubmed&id=11748933,11700088&retmode=xml

#http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=pubmed&id=18324973&retmode=xml
NCBI_ARTICLE_ACCESS_PATTERN = "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?"

#http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&term=cancer&reldate=60&datetype=edat&retmax=100&usehistory=y
NCBI_SEARCH_PATTERN = "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?"
Exemple #7
0
          <dc:provenance>This copy once owned by Benjamin Spock</dc:provenance>
          <dc:accrualmethod ak:rel="local-name()" ak:value=".">Purchase</dc:accrualmethod>
          <dc:instructionalmethod ak:rel="local-name()" ak:value=".">Experiential learning</dc:instructionalmethod>
          <dc:rightsholder ak:rel="local-name()" ak:value=".">MIT</dc:rightsholder>
          <dc:rights ak:rel="local-name()" ak:value=".">Collection may be protected under Title 17 of the U.S. Copyright Law.</dc:rights>
          <dc:rights>Access limited to members</dc:rights>
          <dc:identifier ak:rel="'handle'" ak:value=".">04980676</dc:identifier>
          <dc:identifier>http://hdl.handle.net/1721.1/27225</dc:identifier>
          <dc:language ak:rel="local-name()" ak:value=".">en_US</dc:language>
          <dc:relation ak:rel="local-name()" ak:value=".">MIT-EL</dc:relation>
          <dc:relation>78-021</dc:relation>
          <dc:relation>MIT-EL</dc:relation>
          <dc:relation>78-022</dc:relation>
        </oai_dc:dc>
      </metadata>
    </record>
  </GetRecord>
</OAI-PMH>
"""

OAI_GETRECORD_MODEL = examplotron_model(OAI_GETRECORD_XML)
QDC_LISTRECORDS_MODEL = examplotron_model(QDC_LISTRECORDS_XML)
MODS_LISTRECORDS_MODEL = examplotron_model(MODS_LISTRECORDS_XML)
OAI_DC_LISTRECORDS_MODEL = examplotron_model(OAI_DC_LISTRECORDS_XML)

LISTRECORDS_MODELS = {
    "qdc": QDC_LISTRECORDS_MODEL,
    "mods": MODS_LISTRECORDS_MODEL,
    "oai_dc": OAI_DC_LISTRECORDS_MODEL
}
Exemple #8
0
          <dc:description ak:rel="local-name()" ak:value=".">Cohen's Comments on Adam Przeworski's article "Could We Feed Everyone?"</dc:description>
          <dc:format>2146519 bytes</dc:format>
          <dc:format>application/pdf</dc:format>
          <dc:language>en_US</dc:language>
          <dc:publisher ak:rel="local-name()" ak:value=".">Politics and Society</dc:publisher>
          <dc:title ak:rel="local-name()" ak:value=".">"Maximizing Social Welfare or Institutionalizing Democratic Ideals?"</dc:title>
          <dc:type>Article</dc:type>
          <dc:identifier>Joshua Cohen, "Maximizing Social Welfare or Institutionalizing Democratic Ideals?"; Politics and Society, Vol. 19, No. 1</dc:identifier>
        </oai_dc:dc>
      </metadata>
    </record>
  </GetRecord>
</OAI-PMH>
'''

OAI_MODEL = examplotron_model(OAI_MODEL_XML)

ATOM_ENVELOPE = '''<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:sd="http://kds.elsevier.com/datamodel/sciencedirect#" xmlns:os="http://a9.com/-/spec/opensearch/1.1/">
  <title>MIT DSpace</title>
  <id>http://dspace.mit.edu/</id>
</feed>
'''

SERVICE_ID = 'http://purl.org/akara/services/demo/oai.json'


@simple_service('GET', SERVICE_ID, 'akara.oai.atom', 'application/atom+xml')
def atomize_oai_record(endpoint=None, id=None):
    '''
    endpoint - the OAI request URL, e.g. http://dspace.mit.edu/oai/request