[med-svn] r18722 - trunk/community/edam
Steffen Möller
moeller at moszumanska.debian.org
Sun Feb 1 18:49:40 UTC 2015
Author: moeller
Date: 2015-02-01 18:49:33 +0000 (Sun, 01 Feb 2015)
New Revision: 18722
Modified:
trunk/community/edam/registry-tool.py
Log:
EDAM: Added placeholder uri->term routine
Modified: trunk/community/edam/registry-tool.py
===================================================================
--- trunk/community/edam/registry-tool.py 2015-02-01 18:03:45 UTC (rev 18721)
+++ trunk/community/edam/registry-tool.py 2015-02-01 18:49:33 UTC (rev 18722)
@@ -5,7 +5,18 @@
import os.path
import getpass
import re
+import random # for uri2term, to be removed
+def uri2term(uri):
+ """The routine is meant to retrieve the human-readable term name for a URI provided.
+
+ The current implementation merely produces a combination of the first and
+ last name of Pipi Longstocking as named in different languages.
+ """
+ pipi= [["Pippi","Langstrumpf"],["Pippi","Longstocking"],["Inger","Nilsson"],["Fifi","Brindacier"],
+ ["Pippi","Långstrump"],["Pippi","Langstrømpe"],["Pippi","Calcesllargues"],["Pipi","Ŝtrumpolonga"],["Pippi","Uzunçorap"]]
+ return(random.choice(pipi)[0]+" "+random.choice(pipi)[1])
+
def doc_to_dict(pack_dir):
debian_path = os.path.join(pack_dir, 'debian')
control_path = os.path.join(debian_path, 'control')
@@ -27,7 +38,7 @@
'collection': 'debian',
'interface': {}, #TODO
'description': control.get('Description'),
- 'topic': [{'uri':uri,'term':'Pippi Langstrumpf'} for uri in edam.get('topic')],
+ 'topic': [{'uri':uri,'term':uri2term(el['data'])} for uri in edam.get('topic')],
'sourceRegistry': '',
'publications': [{'publicationsOtherID': [i['DOI'] for i in metadata['Reference']]}],
'function': []
@@ -35,18 +46,18 @@
for scope in edam['scopes']:
function = {}
function['functionHandle'] = scope['name']
- function['functionName'] = [{'uri':uri,'term':'Pippi Langstrumpf'} for uri in scope.get('function')]
+ function['functionName'] = [{'uri':uri,'term':uri2term(el['data'])} for uri in scope.get('function')]
function['input'] = []
for el in scope.get('inputs'):
function['input'].append({
- 'dataType': {'uri':el['data'],'term':'Pippi Langstrumpf'},
- 'dataFormat' : [{'uri':format_el,'term':'Pippi Langstrumpf'} for format_el in el['formats']]
+ 'dataType': {'uri':el['data'],'term':uri2term(el['data'])},
+ 'dataFormat' : [{'uri':format_el,'term':uri2term(el['data'])} for format_el in el['formats']]
})
function['output'] = []
for el in scope.get('outputs'):
function['output'].append({
- 'dataType': {'uri':el['data'],'term':'Pippi Langstrumpf'},
- 'dataFormat' : [{'uri':format_el,'term':'Pippi Langstrumpf'} for format_el in el['formats']]
+ 'dataType': {'uri':el['data'],'term':uri2term(el['data'])},
+ 'dataFormat' : [{'uri':format_el,'term':uri2term(el['data'])} for format_el in el['formats']]
})
resource['function'].append(function)
return resource
More information about the debian-med-commit
mailing list