dublincore Documentation

Similar documents
invenio-formatter Documentation

TPS Documentation. Release Thomas Roten

invenio-groups Documentation

Roman Numeral Converter Documentation

Python Project Example Documentation

Python wrapper for Viscosity.app Documentation

PyCon APAC 2014 Documentation

chatterbot-weather Documentation

Python simple arp table reader Documentation

PyCRC Documentation. Release 1.0

sainsmart Documentation

Aircrack-ng python bindings Documentation

I2C LCD Documentation

Release Nicholas A. Del Grosso

Simple libtorrent streaming module Documentation

django-idioticon Documentation

django-reinhardt Documentation

git-pr Release dev2+ng5b0396a

Pykemon Documentation

google-search Documentation

Poulpe Documentation. Release Edouard Klein

Django Wordpress API Documentation

Simple Binary Search Tree Documentation

Redis Timeseries Documentation

DNS Zone Test Documentation

Release Fulfil.IO Inc.

Google Domain Shared Contacts Client Documentation

Mantis STIX Importer Documentation

django-cas Documentation

Game Server Manager Documentation

OpenUpgrade Library Documentation

smartfilesorter Documentation

Poetaster. Release 0.1.1

Python Schema Generator Documentation

pydrill Documentation

Frontier Documentation

doconv Documentation Release Jacob Mourelos

e24paymentpipe Documentation

django-users2 Documentation

Python State Machine Documentation

open-helpdesk Documentation

dj-libcloud Documentation

gunny Documentation Release David Blewett

django CMS Export Objects Documentation

Python AutoTask Web Services Documentation

pyldavis Documentation

Python AMT Tools Documentation

withenv Documentation

xmljson Documentation

django-telegram-bot Documentation

AnyDo API Python Documentation

eventbrite-sdk-python Documentation

Release Ralph Offinger

Python State Machine Documentation

Sensor-fusion Demo Documentation

smsghussd Documentation

nacelle Documentation

PyZillow Documentation

Aldryn Installer Documentation

timegate Documentation

Python data pipelines similar to R Documentation

xmodels Documentation

pvl Documentation Release William Trevor Olson

Python Finite State Machine. Release 0.1.5

API Wrapper Documentation

django-responsive2 Documentation

django-composite-foreignkey Documentation

ejpiaj Documentation Release Marek Wywiał

django-composite-foreignkey Documentation

Dragon Mapper Documentation

lazy-object-proxy Release 1.3.1

gpib-ctypes Documentation

Elegans Documentation

syslog-ng Apache Kafka destination

yardstick Documentation

django-stored-messages Documentation

django-private-chat Documentation

CID Documentation. Release Francis Reyes

inflection Documentation

Gearthonic Documentation

Flask-Sitemap Documentation

dicompyler-core Documentation

DoJSON Documentation. Release Invenio collaboration

OTX to MISP. Release 1.4.2

utidylib Documentation Release 0.4

Airoscript-ng Documentation

cwmon-mysql Release 0.5.0

Job Submitter Documentation

django-bootstrap3 Documentation

Infoblox Client Documentation

CuteFlow-V4 Documentation

Flask Gravatar. Release 0.5.0

twstock Documentation

Connexion Sqlalchemy Utils Documentation

Tailor Documentation. Release 0.1. Derek Stegelman, Garrett Pennington, and Jon Faustman

Durga Documentation. Release dev2. transcode

mp3fm Documentation Release Akshit Agarwal

ProxySQL Tools Documentation

pytest-benchmark Release 2.5.0

disspcap Documentation

Transcription:

dublincore Documentation Release 0.1.1 CERN Mar 25, 2018

Contents 1 User s Guide 3 1.1 Installation................................................ 3 1.2 Usage................................................... 3 2 API Reference 5 2.1 Simple Dublin Core........................................... 5 3 Additional Notes 7 3.1 Contributing............................................... 7 3.2 Changes................................................. 9 3.3 License.................................................. 9 3.4 Contributors............................................... 9 Python Module Index 11 i

ii

dublincore Documentation, Release 0.1.1 Dublin Core XML generation from Python dictionaries. Free software: MIT license Documentation: https://dcxml.readthedocs.io/ Contents 1

dublincore Documentation, Release 0.1.1 2 Contents

CHAPTER 1 User s Guide This part of the documentation will show you how to get started in using dcxml. 1.1 Installation Dublin Core package is on PyPI so all you need is: $ pip install dcxml 1.2 Usage Dublin Core XML generation from Python dictionaries. The Dublin Core Python package allows you to generate XML (either as string or ElementTree) for the 15 elements in Simplified Dublin Core. By default the package wraps the 15 elements in an OAI DC element (customizable). See http://dublincore.org/documents/dces/ for the description of all 15 elements. First let s create a Python dictionary with all 15 elements: >>> data = dict(... contributors = ['CERN'],... coverage = ['Geneva'],... creators = ['CERN'],... dates = ['2002'],... descriptions = ['Simple Dublin Core generation'],... formats = ['application/xml'],... identifiers = ['dublin-core'],... languages = ['en'],... publishers = ['CERN'],... relations = ['Invenio Software'],... rights = ['MIT'], 3

dublincore Documentation, Release 0.1.1... sources = ['Python'],... subject = ['XML'],... titles = ['Dublin Core XML'],... types = ['Software'],... ) The structure of the dictionary is: Keys: Normally the plural version of the DC element name except for ( rights and coverage). Values: List of strings. Each item in the list will result in one DC element. Now, let s generate the Dublin Core XML: >>> from dcxml import simpledc >>> xml = simpledc.tostring(data) and print the 15 elements (without the container element) >>> for l in xml.splitlines()[2:-1]:... print(l) <dc:contributor>cern</dc:contributor> <dc:coverage>geneva</dc:coverage> <dc:creator>cern</dc:creator> <dc:date>2002</dc:date> <dc:description>simple Dublin Core generation</dc:description> <dc:format>application/xml</dc:format> <dc:identifier>dublin-core</dc:identifier> <dc:language>en</dc:language> <dc:publisher>cern</dc:publisher> <dc:relation>invenio Software</dc:relation> <dc:rights>mit</dc:rights> <dc:source>python</dc:source> <dc:title>dublin Core XML</dc:title> <dc:type>software</dc:type> The container element is by default the <oai_dc:dc> element: >>> print(xml.splitlines()[1]) <oai_dc:dc... In case you need an ElementTree instead of a string, it s as simple as: >>> tree = simpledc.dump_etree(data) 4 Chapter 1. User s Guide

CHAPTER 2 API Reference If you are looking for information on a specific function, class or method, this part of the documentation is for you. 2.1 Simple Dublin Core Generation of Simple Dublin Core XML v1.1. By default the package will wrap elements in an OAI DC element. This behavior can be changed by specifying container, nsmap and attribs to the API functions. dcxml.simpledc.dump_etree(data, container=none, nsmap=none, attribs=none) Convert dictionary to Simple Dublin Core XML as ElementTree. Parameters data Dictionary. container Name (include namespace) of container element. nsmap Namespace mapping for lxml. attribs Default attributes for container element. Returns LXML ElementTree. dcxml.simpledc.tostring(data, **kwargs) Convert dictionary to Simple Dublin Core XML as string. Parameters data Dictionary. container Name (include namespace) of container element. nsmap Namespace mapping for lxml. attribs Default attributes for container element. Returns LXML ElementTree. 5

dublincore Documentation, Release 0.1.1 dcxml.simpledc.ns = {'xml': 'xml', 'oai_dc': 'http://www.openarchives.org/oai/2.0/oai_dc/ Default namespace mapping. dcxml.simpledc.container_attribs = {'{http://www.w3.org/2001/xmlschema-instance}schemalocat Default container element attributes. dcxml.simpledc.container_element = '{http://www.openarchives.org/oai/2.0/oai_dc/}dc' Default container element. 6 Chapter 2. API Reference

CHAPTER 3 Additional Notes Notes on how to contribute, legal information and changes are here for the interested. 3.1 Contributing Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given. 3.1.1 Types of Contributions Report Bugs Report bugs at https://github.com/inveniosoftware/dublincore/issues. If you are reporting a bug, please include: Your operating system name and version. Any details about your local setup that might be helpful in troubleshooting. Detailed steps to reproduce the bug. Fix Bugs Look through the GitHub issues for bugs. Anything tagged with bug is open to whoever wants to implement it. Implement Features Look through the GitHub issues for features. Anything tagged with feature is open to whoever wants to implement it. 7

dublincore Documentation, Release 0.1.1 Write Documentation Dublin Core could always use more documentation, whether as part of the official Dublin Core docs, in docstrings, or even on the web in blog posts, articles, and such. Submit Feedback The best way to send feedback is to file an issue at https://github.com/inveniosoftware/dcxml/issues. If you are proposing a feature: Explain in detail how it would work. Keep the scope as narrow as possible, to make it easier to implement. Remember that this is a volunteer-driven project, and that contributions are welcome :) 3.1.2 Get Started! Ready to contribute? Here s how to set up invenio for local development. 1. Fork the invenio repo on GitHub. 2. Clone your fork locally: $ git clone git@github.com:your_name_here/dcxml.git 3. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development: $ mkvirtualenv dcxml $ cd dcxml/ $ pip install -e.[all] 4. Create a branch for local development: $ git checkout -b name-of-your-bugfix-or-feature Now you can make your changes locally. 5. When you re done making changes, check that your changes pass tests: $./run-tests.sh The tests will provide you with test coverage and also check PEP8 (code style), PEP257 (documentation), flake8 as well as build the Sphinx documentation and run doctests. 6. Commit your changes and push your branch to GitHub: $ git add. $ git commit -s -m "Your detailed description of your changes." $ git push origin name-of-your-bugfix-or-feature 7. Submit a pull request through the GitHub website. 8 Chapter 3. Additional Notes

dublincore Documentation, Release 0.1.1 3.1.3 Pull Request Guidelines Before you submit a pull request, check that it meets these guidelines: 1. The pull request should include tests and must not decrease test coverage. 2. If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring. 3. The pull request should work for Python 2.7, 3.3, 3.4 and 3.5. Check https://travis-ci.org/inveniosoftware/ dcxml/pull_requests and make sure that the tests pass for all supported Python versions. 3.2 Changes Version 0.1.0 (released 2016-03-21) Initial public release. 3.3 License MIT License Copyright (C) 2016-2018 CERN. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Software ), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PAR- TICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFT- WARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Note: In applying this license, CERN does not waive the privileges and immunities granted to it by virtue of its status as an Intergovernmental Organization or submit itself to any jurisdiction. 3.4 Contributors Jiri Kuncar Lars Holm Nielsen Tibor Simko 3.2. Changes 9

dublincore Documentation, Release 0.1.1 10 Chapter 3. Additional Notes

Python Module Index d dcxml, 3 dcxml.simpledc, 5 11

dublincore Documentation, Release 0.1.1 12 Python Module Index

Index C container_attribs (in module dcxml.simpledc), 6 container_element (in module dcxml.simpledc), 6 D dcxml (module), 3 dcxml.simpledc (module), 5 dump_etree() (in module dcxml.simpledc), 5 N ns (in module dcxml.simpledc), 5 T tostring() (in module dcxml.simpledc), 5 13